ROM Hack How to view and edit spr.bin and pal.bin files?

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
@FAST6191 Recently, I got the game named called Cookie Shop - Create Your Owen Dream Shop, and I wanted to edit the sprites. The sad part, they're all in _pal.bin and _spr.bin files. I tried tilemolester both in 4bpp linear and 8bpp linear codec and all I got was garbled mess. I've heard that you're an expert at this, and I hope you could help me. I've also checked related forums and so far none came close to helping me.

Example files:
bu_strawberry_sad_pal.bin
bu_strawberry_sad_spr.bin
bg_floor0_pal.bin
bg_floor0_spr.bin
 
Last edited by COR3Z,

Deleted member 383179

Well-Known Member
Newcomer
Joined
Feb 12, 2016
Messages
62
Trophies
0
XP
995
Based off of the filenames the spr.bins are sprites and pal.bins are palettes. If you can load files as different types, you might be able to use that information somehow.

...Also, this is not a tutorial.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
I have not got the game in front of me to look at right now but I do have to ask what the first few bytes of the various files say?

If it is 10, 11 or 40 (though 40 was a far later thing) then it might be compressed. https://www.romhacking.net/utilities/826/ being one of several nice tools to sort that (you probably want the basic LZ stuff).
Compression will see it be a mess in a tile editor.

That said I am not so familiar with modern tile molester and what it means by linear mode when it says it (there are a few choices of things) so might suggest having a play with crystaltile2 or tileggd.

That said while .bin is a generic extension I have on several other occasions seen things end _spr and _pal and not just from the same publisher either. I do wonder if it is then a quasi format shared by some devs or a common library. For those though I don't recall putting any effort into decoding them as I was after text in those games.
If no evidence of compression (or an archive format that might see individual segments compressed) and the tile editors above don't yield much I would tend to go backwards from the game -- usually I would dump a palette from palette memory and search for that or a fragment of it, can also get some stuff done from video memory for sprites.

Also if you can do confirm the files named that do what you want. Either corrupt them somehow, or overwrite one with another and see what happens in the game.
 

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
Based off of the filenames the spr.bins are sprites and pal.bins are palettes. If you can load files as different types, you might be able to use that information somehow.

...Also, this is not a tutorial.
What do you mean loading files as different types?

That said, How is it possible to load access video memory?
 
Last edited by COR3Z,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Uncompressed savestates should feature it, desmume had a nice memory viewer, no$gba debugger is free these days and will also have it.

If you need to find it then depending upon what you are doing (savestates vs memory vs dedicated video section viewer) then some of the following should help.
http://problemkaputt.de/gbatek.htm#dsmemorymaps
http://problemkaputt.de/gbatek.htm#dsvideo

As far as different types I suspect they have used more of the tools that either only work based on extensions or prefer it (quite a few DS tools do this, as opposed to opening the file raw and going from there or allowing you to say open something in the tile viewer just because it is something you felt like doing). If you only used a plain tile editor and loaded a .bin into it then it would have changed much.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Personally I like tiled2002 (though you might have to select all files or put *.* in the name thing to force it to open whatever you like) and crystaltile2 as actual editors.
https://www.romhacking.net/utilities/818/ (click on the DS icon on the top right, it will open a window containing the files of the DS, and possibly indicate compression but it is spotty there. Double click on a file to be taken to that location in whatever of the windows you are in -- most likely the tile viewer or hex editor ones for this sort of thing but works for them all).
https://www.romhacking.net/utilities/112/ (bit more crashy and has some trouble with the huge sprites the DS sometimes uses but has some nice features as far as palettes, editing and reading savestates in GBA games so I keep it around)

For simple viewing then tiledggd is one of the more configurable tools I have ever seen. It lacks editing options but if you have to narrow down a conventional 2d tile format you don't know this will allow you to get there (most other tile editors instead offering a list of prebaked formats it knows about)
https://www.romhacking.net/utilities/646/

The utilities section of rhdn above is also host to many more, however most don't feature the GBA colour modes, and sometimes if they do it is only the 4bpp one and not the 8bpp one (never mind the more exotic ones seen on the GBA and DS that crystaltile2 supports).

tinke ( https://github.com/pleonex/tinke/releases ) is a good tool but at least was something of an example of the "do what we know" rather than "allow me to do what I want even if it is theoretically silly*". It does however do better with 3d textures (which many games use to varying degrees -- I often have to note for people that New Super Mario Brothers is technically a 3d game) than the others above as DS 3d textures do things even something as configurable as tiledggd is not built to handle.

*we have seen people edit hex in a tile editor, and more practically quickly scanning a visual representation of a file often tells me more about its contents than scanning through hex -- you yourself did a version of this when you said it was random junk. Certainly helps with eliminating those things that are simple patterns if I want something that will not appear as such.
 

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
I opened the fnt.bin and then I saw a bunch of NCLRs, NANRs and NCBR files listed there.

I've also opened the fat.bin ( which I think is a file allocation table) and the hexadecimals are kinda evenly placed.

Will both of these help or they're just information for something else?

--------------------- MERGED ---------------------------

I opened the fnt.bin and then I saw a bunch of NCLRs, NANRs and NCBR files listed there.

Nevermind that. I accidentally uploaded the wrong ro. But the fact that the hexadecimals in fat.bin are still evenly placed.
 
Last edited by COR3Z,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
fat.bin will change depending upon where it is. If it was in the same directory (the very highest/first one) as ARM9.bin ARM9.bin and the like then ignore it; it is part of the ROM management. If it is in a directory with other files it might be a listing, name table or just something the devs left in but might help.

fnt.bin might either be file name table, or possibly a font. If it has ascii in then probably the former. Though again directory you found it in will change things (same questions and things to note as above).

NCLRs, NANRs and NCBR are part of 2d graphics formats Nintendo provided ( https://www.romhacking.net/documents/469/ for an older overview) but they could just be something from somewhere else in the ROM as there was nothing stopping the devs from doing whatever they liked.

Have you tried swapping the files around and putting them back in/rebuilding the ROM yet?
 

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
Uncompressed savestates should feature it, desmume had a nice memory viewer, no$gba debugger is free these days and will also have it.

If you need to find it then depending upon what you are doing (savestates vs memory vs dedicated video section viewer) then some of the following should help.
http://problemkaputt.de/gbatek.htm#dsmemorymaps
http://problemkaputt.de/gbatek.htm#dsvideo

As far as different types I suspect they have used more of the tools that either only work based on extensions or prefer it (quite a few DS tools do this, as opposed to opening the file raw and going from there or allowing you to say open something in the tile viewer just because it is something you felt like doing). If you only used a plain tile editor and loaded a .bin into it then it would have changed much.

Alright, I'm trying the no$gba debugger, but I cant get it to debug mode... Is there something I should do?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Grab it from
https://problemkaputt.de/gba.htm
Partial guide to it
https://problemkaputt.de/gba-dev.htm

It should start with a whole bunch of extra windows (indeed the gameplay might be one of the smaller parts) covering aspects of the hardware it is emulating.

From there memory should be viewable/editable/dumpable, breakpoints can be set, various graphics aspects viewed...
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
VRAM viewer is for the section of memory dedicated to video. On the DS it is entirely software controlled and unrelated to any hardware (some old systems might map things directly).
Said VRAM viewer (and BG viewer for that matter) only showcase what is there in RAM, with the palettes available. You can use this to quickly grab sprites for a sprite sheet, see what settings it is using (takes the guesswork out of things with a tile editor that way), and see where it VRAM it is.
That last one is fairly key here for while VRAM is small as these things go but still enough to hold several dozen sprites, that way you can go exactly to the sprite in the conventional memory viewer and grab the relevant data to use in a search. More advanced hacking uses a method called tracing (this is for the GBA but it is broadly similar for the DS https://www.romhacking.net/documents/361/ ) to see how it got there.

Also on BG then while it is technically a texture if you say texture most people will assume you mean 3d textures which is a different aspect entirely. Some games do use 3d for the backgrounds (castlevania is probably one of the more notable examples as its 3d textures in the background bothered earlier emulators) or are 3d entirely, and some ways of considering the whole setup do make for other things.
Back on topic though then on older systems, and still on the DS, a background might be made up of tiles. However on many occasions I have seen full resolution backgrounds on the DS, such that you set your tile viewer to 256 width to get it (crystaltile2 being good for this).
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
I have not got it in front of me to play with to give any specifics but in general

1) If it knows the formats it is dealing with then open the ROM first in crystaltile2, now click on the DS file browser (the icon of the DS on the right of all the menu icons), find the palette and image files and right click on each, compared to other files it does not know there will be some options to load it.
It might also give you compression options if it thinks it detects compression (can give false positives from time to time).

2) If you have to go manual then you get to figure things out.
The tile viewer should be fairly obvious -- the GBA and DS mostly stick to 4bpp GBA and 8bpp GBA if you want that format option, everything else varies by game and is what you get to figure out (or possibly be told from the tile viewer in an emulator).
The palette stuff is slightly offbeat compared to some tile editors. You need to go to the hex editor and on the left in the options is hex to palette and palette to hex or something similar. This will take the currently selected part and either decode it as a plain hex palette (no regard for any headers, pointers or anything), or take the palette and encode it back into hex (overwriting as it goes so be careful).

Bonus feature. If you double click on the file in question in the DS viewer then it will set whatever mode (hex, tile, assembly...) you are in to that location.

If things are compressed you may want to first decompress them. While CT2 will happily decompress and load right away (or load the file it decompresses) it is trickier to share data between "windows" or instances. This makes things trickier so I sometimes instead like to decompress what I want, rebuild the ROM and then open it in CT2 or Tinke or whatever and have it load things accordingly.
 

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
That’s a bit of a problem, because all these spr.bin and pal.bin files are inside _LZ.bin file, and the sprites are garbled.

The spr.bin and pal.bin files are not compressed, but they still leave a garbled mess when I put it in the crystaltile2

The game also never shows the codec they use, so it’s a bit of a problem.

Additionally, I can’t retrieve the tile address due to not being an NCGR.
 
Last edited by COR3Z,

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
I just plopped in the TiledGDD, set the offsets for the pallete, and here is my result:

upload_2020-4-18_21-23-47.png
Can you please tell me how to fix the final issue?
 

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
wait I was able to figure it out!
upload_2020-4-18_21-45-1.png
All it took was to change the panel size to 128x160, set the offset to 0x4, and this is the result.

Without your help, I would never known Tiledgdd, the tile editor that I used to convert this.

Ans I apologize for any of your time being wasted. I once tried this on another sprite, and thought it was garbled mess.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Nice one.

128x160 as a tile size is a new one for me I think. Reasonably in line with standards but not normally one I see.

But yeah if your image looks like the big one, which is to say somewhat like a bad tv reception (I say despite most people today having not seen it in years) and all staggered all over the place (or in some cases looking like it is missing a line) then your tile width is wrong or the point where it starts decoding is wrong. Either pull them from the emulator or dial it all in (it is usually pretty obvious when you are heading in the right direction and most of the time you want to be going up by 8,16 or a multiple thereof).
 

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
Now is there a way to automate the process in TiledGGD? because I think I had more than 500 more sprites to do this.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    LeoTCK @ LeoTCK: yes for nearly a month i was officially a wanted fugitive, until yesterday when it ended