mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
pico, added detection by extension
This commit is contained in:
parent
d4a08748fa
commit
4fc85c80af
5 changed files with 28 additions and 31 deletions
|
@ -837,7 +837,7 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_
|
||||||
}
|
}
|
||||||
pdb_cleanup();
|
pdb_cleanup();
|
||||||
|
|
||||||
PicoIn.AHW &= PAHW_MCD|PAHW_SMS;
|
PicoIn.AHW &= PAHW_MCD|PAHW_SMS|PAHW_PICO;
|
||||||
|
|
||||||
PicoCartMemSetup = NULL;
|
PicoCartMemSetup = NULL;
|
||||||
PicoDmaHook = NULL;
|
PicoDmaHook = NULL;
|
||||||
|
@ -846,9 +846,9 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_
|
||||||
PicoLoadStateHook = NULL;
|
PicoLoadStateHook = NULL;
|
||||||
carthw_chunks = NULL;
|
carthw_chunks = NULL;
|
||||||
|
|
||||||
if (!(PicoIn.AHW & (PAHW_MCD|PAHW_SMS)))
|
if (!(PicoIn.AHW & (PAHW_MCD|PAHW_SMS|PAHW_PICO)))
|
||||||
PicoCartDetect(carthw_cfg);
|
PicoCartDetect(carthw_cfg);
|
||||||
else if (PicoIn.AHW & PAHW_SMS)
|
if (PicoIn.AHW & PAHW_SMS)
|
||||||
PicoCartDetectMS();
|
PicoCartDetectMS();
|
||||||
|
|
||||||
// setup correct memory map for loaded ROM
|
// setup correct memory map for loaded ROM
|
||||||
|
|
|
@ -42,24 +42,13 @@ check_str = 0x150, "VIRTUA RACING"
|
||||||
check_str = 0x810, "OHMP"
|
check_str = 0x810, "OHMP"
|
||||||
hw = svp
|
hw = svp
|
||||||
|
|
||||||
[Pico]
|
[Soreike! Anpanman no Game de Asobou Anpanman - Pico]
|
||||||
check_str = 0x100, "SEGA PICO"
|
check_str = 0x100, "SEGA IAC "
|
||||||
hw = pico
|
hw = pico
|
||||||
|
|
||||||
[Pico]
|
# Unou Kaihatsu Series: IMA IKUNO[U]JYUKU
|
||||||
check_str = 0x100, "SEGATOYS PICO"
|
[Unou Kaihatsu Series - Pico]
|
||||||
hw = pico
|
check_str = 0x100, "IMA IKUNO"
|
||||||
|
|
||||||
[Pico]
|
|
||||||
check_str = 0x100, "SEGA TOYS PICO"
|
|
||||||
hw = pico
|
|
||||||
|
|
||||||
[Pico]
|
|
||||||
check_str = 0x100, "SAMSUNG PICO"
|
|
||||||
hw = pico
|
|
||||||
|
|
||||||
[Pico]
|
|
||||||
check_str = 0x100, "IMA IKUNOUJYUKU"
|
|
||||||
hw = pico
|
hw = pico
|
||||||
|
|
||||||
# sram emulation triggers some protection for this one
|
# sram emulation triggers some protection for this one
|
||||||
|
|
|
@ -9,19 +9,10 @@ static const char builtin_carthw_cfg[] =
|
||||||
"check_str=0x810,\"OHMP\"\n"
|
"check_str=0x810,\"OHMP\"\n"
|
||||||
"hw=svp\n"
|
"hw=svp\n"
|
||||||
"[]\n"
|
"[]\n"
|
||||||
"check_str=0x100,\"SEGA PICO\"\n"
|
"check_str=0x100,\"SEGA IAC \"\n"
|
||||||
"hw=pico\n"
|
"hw=pico\n"
|
||||||
"[]\n"
|
"[]\n"
|
||||||
"check_str=0x100,\"SEGATOYS PICO\"\n"
|
"check_str=0x100,\"IMA IKUNO\"\n"
|
||||||
"hw=pico\n"
|
|
||||||
"[]\n"
|
|
||||||
"check_str=0x100,\"SEGA TOYS PICO\"\n"
|
|
||||||
"hw=pico\n"
|
|
||||||
"[]\n"
|
|
||||||
"check_str=0x100,\"SAMSUNG PICO\"\n"
|
|
||||||
"hw=pico\n"
|
|
||||||
"[]\n"
|
|
||||||
"check_str=0x100,\"IMA IKUNOUJYUKU\"\n"
|
|
||||||
"hw=pico\n"
|
"hw=pico\n"
|
||||||
"[]\n"
|
"[]\n"
|
||||||
"check_str=0x120,\"PUGGSY\"\n"
|
"check_str=0x120,\"PUGGSY\"\n"
|
||||||
|
|
18
pico/media.c
18
pico/media.c
|
@ -36,6 +36,7 @@ static int detect_media(const char *fname)
|
||||||
static const short sms_offsets[] = { 0x7ff0, 0x3ff0, 0x1ff0 };
|
static const short sms_offsets[] = { 0x7ff0, 0x3ff0, 0x1ff0 };
|
||||||
static const char *sms_exts[] = { "sms", "gg", "sg" };
|
static const char *sms_exts[] = { "sms", "gg", "sg" };
|
||||||
static const char *md_exts[] = { "gen", "smd" };
|
static const char *md_exts[] = { "gen", "smd" };
|
||||||
|
static const char *pico_exts[] = { "pco" };
|
||||||
char buff0[512], buff[32];
|
char buff0[512], buff[32];
|
||||||
unsigned short *d16;
|
unsigned short *d16;
|
||||||
pm_file *pmf;
|
pm_file *pmf;
|
||||||
|
@ -78,8 +79,12 @@ static int detect_media(const char *fname)
|
||||||
goto extension_check;
|
goto extension_check;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MD header? Act as TMSS BIOS here */
|
|
||||||
if (pm_seek(pmf, 0x100, SEEK_SET) == 0x100 && pm_read(buff, 16, pmf) == 16) {
|
if (pm_seek(pmf, 0x100, SEEK_SET) == 0x100 && pm_read(buff, 16, pmf) == 16) {
|
||||||
|
/* PICO header? Almost always appropriately marked */
|
||||||
|
buff[16] = '\0';
|
||||||
|
if (strstr(buff, " PICO "))
|
||||||
|
goto looks_like_pico;
|
||||||
|
/* MD header? Act as TMSS BIOS here */
|
||||||
if (strncmp(buff, "SEGA", 4) == 0 || strncmp(buff, " SEG", 4) == 0)
|
if (strncmp(buff, "SEGA", 4) == 0 || strncmp(buff, " SEG", 4) == 0)
|
||||||
goto looks_like_md;
|
goto looks_like_md;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +110,10 @@ extension_check:
|
||||||
if (strcasecmp(pmf->ext, sms_exts[i]) == 0)
|
if (strcasecmp(pmf->ext, sms_exts[i]) == 0)
|
||||||
goto looks_like_sms;
|
goto looks_like_sms;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(pico_exts); i++)
|
||||||
|
if (strcasecmp(pmf->ext, pico_exts[i]) == 0)
|
||||||
|
goto looks_like_pico;
|
||||||
|
|
||||||
/* If everything else fails, make a guess on the reset vector */
|
/* If everything else fails, make a guess on the reset vector */
|
||||||
d16 = (unsigned short *)(buff0 + 4);
|
d16 = (unsigned short *)(buff0 + 4);
|
||||||
if ((((d16[0] << 16) | d16[1]) & 0xffffff) >= pmf->size) {
|
if ((((d16[0] << 16) | d16[1]) & 0xffffff) >= pmf->size) {
|
||||||
|
@ -124,6 +133,10 @@ looks_like_md:
|
||||||
looks_like_sms:
|
looks_like_sms:
|
||||||
pm_close(pmf);
|
pm_close(pmf);
|
||||||
return PM_MARK3;
|
return PM_MARK3;
|
||||||
|
|
||||||
|
looks_like_pico:
|
||||||
|
pm_close(pmf);
|
||||||
|
return PM_PICO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checks if fname points to valid MegaCD image */
|
/* checks if fname points to valid MegaCD image */
|
||||||
|
@ -250,6 +263,9 @@ enum media_type_e PicoLoadMedia(const char *filename,
|
||||||
else if (media_type == PM_MARK3) {
|
else if (media_type == PM_MARK3) {
|
||||||
PicoIn.AHW = PAHW_SMS;
|
PicoIn.AHW = PAHW_SMS;
|
||||||
}
|
}
|
||||||
|
else if (media_type == PM_PICO) {
|
||||||
|
PicoIn.AHW = PAHW_PICO;
|
||||||
|
}
|
||||||
|
|
||||||
rom = pm_open(rom_fname);
|
rom = pm_open(rom_fname);
|
||||||
if (rom == NULL) {
|
if (rom == NULL) {
|
||||||
|
|
|
@ -264,6 +264,7 @@ enum media_type_e {
|
||||||
PM_BAD_CD_NO_BIOS = -4,
|
PM_BAD_CD_NO_BIOS = -4,
|
||||||
PM_MD_CART = 1, /* also 32x */
|
PM_MD_CART = 1, /* also 32x */
|
||||||
PM_MARK3,
|
PM_MARK3,
|
||||||
|
PM_PICO,
|
||||||
PM_CD,
|
PM_CD,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue