Hacking [WIP] (S)NESInject: A ROM injector tool for Loadiine

daxtsu

Well-Known Member
OP
Member
Joined
Jun 9, 2007
Messages
5,627
Trophies
2
XP
5,194
Country
Antarctica
@daxtsu, or maybe @gamesquest1

At which hex address are you looking for these values in the ROM?

Code:
case 0x40: return 4 * 1024 * 1024; // 4MB
case 0x30: return 3 * 1024 * 1024; // 3MB
case 0x20: return 2 * 1024 * 1024; // 2MB
case 0x10: return 1 * 1024 * 1024; // 1MB
case 0x0C: return 128 * 1024; // 128KB? Contra uses this weird value, but then, Contra doesn't seem to work as a base game anyway.
case 0x08: return 512 * 1024; // 512KB
case 0x06: return 384 * 1024; // 384KB
case 0x04: return 256 * 1024; // 256KB
case 0x02: return 128 * 1024; // 128KB
case 0x01: return 64 * 1024; // 64KB
case 0x00: return 32 * 1024; // 32KB
default: return 0xDEADC0DE; // Give an absurd size if we get anything invalid

Contra is 128KB but I don't see 0C in the ROM header?
Super Mario Bros is 40KB but I don't even see that in the list lol, so I'm curious what value that should have.

Nintendo provides their own ROM size info before the ines header. First you find the magic "WUP-CNTR" (for Contra, it'll be different for other games), then you jump back 0xE (14) bytes and that's how you get the ROM's size (for SNES it's 0x16 bytes back, iirc, I'm just looking at the source for snesinject 0.3). I have no clue why they use 0xC for 128kB when it's also 0x02, but it is what it is. :P

Edit: As for Super Mario Bros, I would guess it would use 0x01 (64KB) since you can fit 40k in 64k.
 
Last edited by daxtsu,

fiveighteen

Distractible Dabbler
Member
Joined
Jun 30, 2008
Messages
1,768
Trophies
2
XP
1,930
Country
United States
Nintendo provides their own ROM size info before the ines header. First you find the magic "WUP-CNTR" (for Contra, it'll be different for other games), then you jump back 0xE (14) bytes and that's how you get the ROM's size (for SNES it's 0x16 bytes back, iirc, I'm just looking at the source for snesinject 0.3). I have no clue why they use 0xC for 128kB when it's also 0x02, but it is what it is. :P

Edit: As for Super Mario Bros, I would guess it would use 0x01 (64KB) since you can fit 40k in 64k.
Ah, thanks. For SNES, the file size is also specified in the header of the ROM, so you can alternatively check that before replacing it. I did some quick checks with NES RPXs and ROMs. Your table is missing 0x05.
Code:
Title            Game ID     ID Loc    Size Loc   Size Value   ROM Size   Table Value   Valid?
Baseball         WUP-FBLE    0x06C0    0x06B2     0x00         24KB       32KB          YES
Mario Bros       WUP-FAEE    0x0700    0x06F2     0x00         24KB       32KB          YES
Legend of Zelda  WUP-FBAE    0x0700    0x06F2     0x02         128KB      128KB         YES
Bases Loaded     WUP-FC2E    0x06C0    0x06B2     0x05         320KB      N/A           NO
 
  • Like
Reactions: daxtsu

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    OctoAori20 @ OctoAori20: Nice nice-