Skip to content

Commit 8a25bd2

Browse files
committed
reset fixes
Signed-off-by: Joseph Mattiello <[email protected]>
1 parent 0a50424 commit 8a25bd2

1 file changed

Lines changed: 3 additions & 38 deletions

File tree

libretro.c

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,26 +1177,26 @@ bool retro_load_game(const struct retro_game_info *info)
11771177
jagMemSpace[0x80040B] &= 0xFE;
11781178
fprintf(stderr, "[CD-TRACE] Boot ROM wait bypass applied at $80040B (value now $%02X)\n",
11791179
jagMemSpace[0x80040B]);
1180+
1181+
JaguarReset();
11801182
}
11811183
else if (jaguar_cd_mode)
11821184
{
11831185
/* HLE path: no external BIOS — JaguarCDHLEBoot() will be called
11841186
* after JaguarReset() to set up the boot stub directly. */
11851187
jaguarCartInserted = false;
1188+
JaguarReset();
11861189
}
11871190
else
11881191
{
1189-
// Standard cartridge loading (need_fullpath=true, so load from file)
11901192
SET32(jaguarMainRAM, 0, 0x00200000);
11911193

11921194
if (info->data && info->size > 0)
11931195
{
1194-
// Data provided directly
11951196
JaguarLoadFile((uint8_t*)info->data, info->size);
11961197
}
11971198
else if (info->path)
11981199
{
1199-
// Load ROM from file path
12001200
RFILE *romFile;
12011201
romFile = rfopen(info->path, "rb");
12021202
if (romFile)
@@ -1222,41 +1222,6 @@ bool retro_load_game(const struct retro_game_info *info)
12221222

12231223
JaguarReset();
12241224

1225-
/* JaguarReset() randomizes all of main RAM ($8–$200000), which
1226-
* destroys RAM-loaded executables (ABS/COFF files loaded at $4000).
1227-
* Cartridge ROMs are fine since they live in jagMemSpace + $800000.
1228-
* Fix: re-load the file into RAM after the reset completes. */
1229-
if (!jaguarCartInserted && !jaguar_cd_mode)
1230-
{
1231-
if (info->data && info->size > 0)
1232-
{
1233-
JaguarLoadFile((uint8_t*)info->data, info->size);
1234-
}
1235-
else if (info->path)
1236-
{
1237-
RFILE *romFile = rfopen(info->path, "rb");
1238-
if (romFile)
1239-
{
1240-
int64_t fileSize;
1241-
uint8_t *romData;
1242-
1243-
rfseek(romFile, 0, SEEK_END);
1244-
fileSize = rftell(romFile);
1245-
rfseek(romFile, 0, SEEK_SET);
1246-
1247-
romData = (uint8_t *)malloc(fileSize);
1248-
if (romData)
1249-
{
1250-
rfread(romData, 1, fileSize, romFile);
1251-
JaguarLoadFile(romData, fileSize);
1252-
free(romData);
1253-
}
1254-
rfclose(romFile);
1255-
}
1256-
}
1257-
SET32(jaguarMainRAM, 4, jaguarRunAddress);
1258-
}
1259-
12601225
/* HLE CD boot: if CD mode and no external BIOS, boot via HLE.
12611226
* Must happen after JaguarReset() since reset clears RAM/GPU state. */
12621227
if (jaguar_cd_mode && !cd_bios_loaded_externally)

0 commit comments

Comments
 (0)