file->param = cso;\r
file->size = cso->header.total_bytes;\r
file->type = PMT_CSO;\r
+ strncpy(file->ext, ext, sizeof(file->ext) - 1);\r
return file;\r
\r
cso_failed:\r
}
ret = PicoCartLoad(rom, &rom_data, &rom_size, (PicoIn.AHW & PAHW_SMS) ? 1 : 0);
- pm_close(rom);
if (ret != 0) {
if (ret == 2) lprintf("Out of memory\n");
else if (ret == 3) lprintf("Read failed\n");
// simple test for GG. Do this here since m.hardware is nulled in Insert
if (PicoIn.AHW & PAHW_SMS) {
- if (strstr(filename,".gg")) {
+ if (!strcmp(rom->ext,"gg")) {
Pico.m.hardware |= 0x1;
lprintf("detected GG ROM\n");
} else
PicoSetInputDevice(0, PICO_INPUT_PAD_6BTN);
out:
+ if (rom)
+ pm_close(rom);
if (rom_data)
free(rom_data);
return media_type;
void PicoPowerMS(void)
{
int s, tmp;
+ unsigned tmr;
memset(&PicoMem,0,sizeof(PicoMem));
memset(&Pico.video,0,sizeof(Pico.video));
tmp = 1 << s;
bank_mask = (tmp - 1) >> 14;
+ // check if the ROM header contains more system information to detect GG
+ for (tmr = 0x2000; tmr < 0xbfff && tmr <= Pico.romsize; tmr *= 2) {
+ if (!memcmp(Pico.rom + tmr-16, "TMR SEGA", 8)) {
+ if (Pico.rom[tmr-1] >= 0x50 && Pico.rom[tmr-1] < 0x80)
+ Pico.m.hardware |= 0x1;
+ break;
+ }
+ }
+
PicoReset();
}