C:\Program Files (x86)\Steam\steamapps\common\NiGHTS Into Dreams\afs .
Among these are a variety of file formats including .adx, .csb, .sfd, and most importantly, .bin files. A number of these files, labeled GAMEUI_GALLERY_XXX.BIN, where XXX is a 3-digit number, seemed likely candidates for gallery image files, so I took a look at them in a hex editor. Long story short, I spent the next few weeks trying to reverse engineer as much of the image files as I could using my amateur programming skills. If you want to see the details I put them in the spoiler below.
With knowledge of these file formats, it's now simple to convert images into the game's format and create custom textures. Here are a couple I've tried for NiGHTS:
The code I have can be modified to potentially edit any of the game's textures. However, at the moment it's very user-unfriendly. I'm trying to improve it and adding a GUI or at least a way to use it from the command line, but right now it's pretty messy.
I'm having technical problems due to the amount of images so here are links:
Most of the gallery images correspond with the ones in-game, and are in a similar order. Some however, are not seen in-game, namely these merch images, which dhoppy203 on the NiGHTS Into Dreams amino pointed out to be from Saturn Christmas NiGHTS:
Images are always square and have a size corresponding to a power of 2, with 256x256 and 512x512 being the most common. Images that are larger than this are split into 512x512 blocks each with separate palette.
The files have an interesting header structure with the bytes representing "P Q R S" repeating a certain number of times before the actual image data begins. I don't know what the header data means aside from that there are more repetitions for images with multiple 512x512 blocks. The header portion ends with four FF bytes. The image data doesn't immediately follow the header but begins at some multiple of 0x100.
All of the gallery images appear to be squashed horizontally to 5/6 of their correct ratio. I would guess that this is intentional because the video files are also horizontally squashed.
The gallery files appear not to be used in-game, as renaming them doesn't change the gallery images' in-game appearance. The in-game gallery also appears to have higher quality images than the bitmaps.
Texture files can be found about midway through files with names such as DATCLARIS.BIN and DATWIZE.BIN. The rest of the data is probably for the character's 3d model itself.
Interestingly, Christmas NiGHTS' model data includes the halloween texture, even though Halloween NiGHTS also has a separate file.
Some textures ripped using this method:
Some questions I have for you guys:
Has anyone else had luck with ripping textures and other data from this game, and might have an easier way of viewing the files than my cobbled-together programs?
Is anyone familiar with the file formats used in this game, and knows the meaning of the header data or what program the files were designed for?
Does the PS2 version of NiGHTS Into Dreams include the merch images in its gallery?
That's all I have for now. I'm curious to hear what you guys think!