mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
md, reworked cart protection handling, added some unlicensed
This commit is contained in:
parent
27b26d0478
commit
e1e8ca17be
6 changed files with 625 additions and 195 deletions
17
pico/cart.c
17
pico/cart.c
|
@ -917,15 +917,16 @@ void PicoCartUnload(void)
|
|||
PicoGameLoaded = 0;
|
||||
}
|
||||
|
||||
static unsigned int rom_crc32(void)
|
||||
static unsigned int rom_crc32(int size)
|
||||
{
|
||||
unsigned int crc;
|
||||
elprintf(EL_STATUS, "caclulating CRC32..");
|
||||
if (size <= 0 || size > Pico.romsize) size = Pico.romsize;
|
||||
|
||||
// have to unbyteswap for calculation..
|
||||
Byteswap(Pico.rom, Pico.rom, Pico.romsize);
|
||||
crc = crc32(0, Pico.rom, Pico.romsize);
|
||||
Byteswap(Pico.rom, Pico.rom, Pico.romsize);
|
||||
Byteswap(Pico.rom, Pico.rom, size);
|
||||
crc = crc32(0, Pico.rom, size);
|
||||
Byteswap(Pico.rom, Pico.rom, size);
|
||||
return crc;
|
||||
}
|
||||
|
||||
|
@ -1116,7 +1117,7 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram,
|
|||
goto bad;
|
||||
|
||||
if (rom_crc == 0)
|
||||
rom_crc = rom_crc32();
|
||||
rom_crc = rom_crc32(64*1024);
|
||||
if (crc == rom_crc)
|
||||
any_checks_passed = 1;
|
||||
else
|
||||
|
@ -1153,8 +1154,10 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram,
|
|||
carthw_sf002_startup();
|
||||
else if (strcmp(p, "sf004_mapper") == 0)
|
||||
carthw_sf004_startup();
|
||||
else if (strcmp(p, "prot_lk3") == 0)
|
||||
carthw_prot_lk3_startup();
|
||||
else if (strcmp(p, "lk3_mapper") == 0)
|
||||
carthw_lk3_startup();
|
||||
else if (strcmp(p, "smw64_mapper") == 0)
|
||||
carthw_smw64_startup();
|
||||
else {
|
||||
elprintf(EL_STATUS, "carthw:%d: unsupported mapper: %s", line, p);
|
||||
skip_sect = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue