What's new

Getting a ROMs Header Name Without Closing Loaded ROM

paulscode

New member
Is there a way to get a ROM's header name (or CRC number), without having to close the currently loaded ROM and opening the second one? I can probably just copy code from the core for reading the header or call some existing functions if they don't affect the currently loaded ROM. I just wanted to make sure I didn't miss a method for doing this if there is already one built into the API.
 

Richard42

Emulator Developer
You can look at open_rom() in src/main/rom.c in the core to see how this works. If you have a ROM image loaded in some buffer (and byte-swapped if necessary), then the first 1k or so is the header. You can use the m64p_rom_header typedef to get the CRC values from the image. Some time ago I added a front-end function called CoreGetRomSettings() for slougi's Qt GUI. This function takes the CRC values and fills in a ROM_SETTINGS structure with some useful data if it matches an entry in the mupen64plus ROM .ini data file. You can use this method to get GoodNames for ROM images without loading them in the core.
 
OP
paulscode

paulscode

New member
Got it working. Thanks! I'm going to use this to provide an interface in my front-end for pairing texture packs with games, without having to end a currently paused game just to read the header from another game to get the header name. I coppied the code from rom.c as you suggested (so it can still get the name even with modified ROMs that aren't necessarily in the .ini data file, and I needed to support .zip files too).
 
OP
paulscode

paulscode

New member
Just realized I don't need to read headers for this anyway, since the hires texture image names have the ROM header name in them so I can just get it from there. Haha, oh well.. at least I know how to do it if I need it for something else.
 

Top