ekeeke / Genesis-Plus-GX

An enhanced port of Genesis Plus - accurate & portable Sega 8/16 bit emulator
Other
697 stars 198 forks source link

Light Crusader (Russian Translation) doesn't save in game #541

Closed O1dGamer closed 7 months ago

O1dGamer commented 7 months ago

Does not create a *.srm file, as a result of which it does not save progress in the game. When you first start it, it shows that 3 save slots are occupied and when you select them, it freezes. However, it works fine in Fusion or Gens-GS

EDIT: link removed

genesis-plus-gx gens-gs

ekeeke commented 7 months ago

Your link does not work (403 forbidden error). Most likely this hack expects SRAM to be all zeroes on startup while this emulator initializes it with 0xFF by default (as this is the default with licensed games that use backup RAM). Have you tried replacing the srm file produced by Retroarch with the one produced by Kega or Gens ?

O1dGamer commented 7 months ago

EDIT: link removed

Retroarch does not create srm file. Created by Kega or Gens does not see

birdybro commented 7 months ago

Check against Sonic 1 Remastered hack as well --> https://info.sonicretro.org/Sonic_1_Remastered_(hack) - which requires initialization to 0x00 (which is faulty design, but still).

ekeeke commented 7 months ago

@O1dGamer That ROM crashes Retroarch (32-bit windows version at least) and gives me a red screen in SDL port I use for testing. Looking at ROM header, it indicates backup RAM support ("RA" is present at ROM address 0x1b0) but SRAM start & end addresses (located at ROM addresses 0x1b4 and 0x1b8) are invalid (indicates 0x20202001 and 0x20203fff instead of 0x00200001 and 0x00203fff). This results in emulator trying to map SRAM in non-existing memory area, thus causing a buffer overflow because the emulator was not robust to this. Indeed, it uses an array with read/write handlers and memory pointers with only 256 entries (corresponding to 256 x 64KB banks covering the addressable 68k cpu memory area i.e 0x000000 to 0xfffff) but was trying to initialize non-existing array entries in this case because it did not detect SRAM start address was invalid. This should be fixed by this commit, which improves invalid SRAM infos detection in ROM header.

@birdybro This hack exception is already supported, see https://github.com/ekeeke/Genesis-Plus-GX/blob/master/core/cart_hw/sram.c#L68