mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 14:57:46 -04:00
.cue support, Pico stubs
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@433 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
1ceda4176f
commit
9fe01b9693
4 changed files with 37 additions and 13 deletions
40
common/emu.c
40
common/emu.c
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <Pico/PicoInt.h>
|
#include <Pico/PicoInt.h>
|
||||||
#include <Pico/Patch.h>
|
#include <Pico/Patch.h>
|
||||||
|
#include <Pico/cd/cue.h>
|
||||||
#include <zlib/zlib.h>
|
#include <zlib/zlib.h>
|
||||||
|
|
||||||
#if defined(__GP2X__)
|
#if defined(__GP2X__)
|
||||||
|
@ -163,12 +164,24 @@ int emu_cdCheck(int *pregion)
|
||||||
{
|
{
|
||||||
unsigned char buf[32];
|
unsigned char buf[32];
|
||||||
pm_file *cd_f;
|
pm_file *cd_f;
|
||||||
int type = 0, region = 4; // 1: Japan, 4: US, 8: Europe
|
int region = 4; // 1: Japan, 4: US, 8: Europe
|
||||||
char ext[5];
|
char ext[5], *fname = romFileName;
|
||||||
|
cue_track_type type = CT_UNKNOWN;
|
||||||
|
cue_data_t *cue_data = NULL;
|
||||||
|
|
||||||
get_ext(romFileName, ext);
|
get_ext(romFileName, ext);
|
||||||
|
if (strcasecmp(ext, ".cue") == 0) {
|
||||||
|
cue_data = cue_parse(romFileName);
|
||||||
|
if (cue_data != NULL) {
|
||||||
|
fname = cue_data->tracks[1].fname;
|
||||||
|
type = cue_data->tracks[1].type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cd_f = pm_open(fname);
|
||||||
|
if (cue_data != NULL)
|
||||||
|
cue_destroy(cue_data);
|
||||||
|
|
||||||
cd_f = pm_open(romFileName);
|
|
||||||
if (!cd_f) return 0; // let the upper level handle this
|
if (!cd_f) return 0; // let the upper level handle this
|
||||||
|
|
||||||
if (pm_read(buf, 32, cd_f) != 32) {
|
if (pm_read(buf, 32, cd_f) != 32) {
|
||||||
|
@ -176,18 +189,27 @@ int emu_cdCheck(int *pregion)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x00, 14)) type = 1; // Sega CD (ISO)
|
if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x00, 14)) {
|
||||||
if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x10, 14)) type = 2; // Sega CD (BIN)
|
if (type && type != CT_ISO)
|
||||||
if (type == 0) {
|
elprintf(EL_STATUS, ".cue has wrong type: %i", type);
|
||||||
|
type = CT_ISO; // Sega CD (ISO)
|
||||||
|
}
|
||||||
|
if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x10, 14)) {
|
||||||
|
if (type && type != CT_BIN)
|
||||||
|
elprintf(EL_STATUS, ".cue has wrong type: %i", type);
|
||||||
|
type = CT_BIN; // Sega CD (BIN)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == CT_UNKNOWN) {
|
||||||
pm_close(cd_f);
|
pm_close(cd_f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pm_seek(cd_f, (type == 1) ? 0x100 : 0x110, SEEK_SET);
|
pm_seek(cd_f, (type == CT_ISO) ? 0x100 : 0x110, SEEK_SET);
|
||||||
pm_read(id_header, sizeof(id_header), cd_f);
|
pm_read(id_header, sizeof(id_header), cd_f);
|
||||||
|
|
||||||
/* it seems we have a CD image here. Try to detect region now.. */
|
/* it seems we have a CD image here. Try to detect region now.. */
|
||||||
pm_seek(cd_f, (type == 1) ? 0x100+0x10B : 0x110+0x10B, SEEK_SET);
|
pm_seek(cd_f, (type == CT_ISO) ? 0x100+0x10B : 0x110+0x10B, SEEK_SET);
|
||||||
pm_read(buf, 1, cd_f);
|
pm_read(buf, 1, cd_f);
|
||||||
pm_close(cd_f);
|
pm_close(cd_f);
|
||||||
|
|
||||||
|
@ -195,7 +217,7 @@ int emu_cdCheck(int *pregion)
|
||||||
if (buf[0] == 0xa1) region = 1; // JAP
|
if (buf[0] == 0xa1) region = 1; // JAP
|
||||||
|
|
||||||
lprintf("detected %s Sega/Mega CD image with %s region\n",
|
lprintf("detected %s Sega/Mega CD image with %s region\n",
|
||||||
type == 2 ? "BIN" : "ISO", region != 4 ? (region == 8 ? "EU" : "JAP") : "USA");
|
type == CT_BIN ? "BIN" : "ISO", region != 4 ? (region == 8 ? "EU" : "JAP") : "USA");
|
||||||
|
|
||||||
if (pregion != NULL) *pregion = region;
|
if (pregion != NULL) *pregion = region;
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.
|
||||||
../../Pico/Patch.o
|
../../Pico/Patch.o
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
||||||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/cue.o ../../Pico/cd/gfx_cd.o \
|
||||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
||||||
endif
|
endif
|
||||||
# Pico - carthw
|
# Pico - carthw
|
||||||
|
|
|
@ -39,8 +39,10 @@ OBJS += Pico/Area.o Pico/Cart.o Pico/Memory.o Pico/Misc.o Pico/Pico.o Pico/Sek.o
|
||||||
Pico/VideoPort.o Pico/Draw2.o Pico/Draw.o Pico/Patch.o
|
Pico/VideoPort.o Pico/Draw2.o Pico/Draw.o Pico/Patch.o
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \
|
OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \
|
||||||
Pico/cd/cd_sys.o Pico/cd/cd_file.o Pico/cd/gfx_cd.o \
|
Pico/cd/cd_sys.o Pico/cd/cd_file.o Pico/cd/cue.o Pico/cd/gfx_cd.o \
|
||||||
Pico/cd/Area.o Pico/cd/Misc.o Pico/cd/pcm.o Pico/cd/buffering.o
|
Pico/cd/Area.o Pico/cd/Misc.o Pico/cd/pcm.o Pico/cd/buffering.o
|
||||||
|
# Pico - Pico
|
||||||
|
OBJS += Pico/Pico/Pico.o Pico/Pico/Memory.o
|
||||||
# Pico - sound
|
# Pico - sound
|
||||||
OBJS += Pico/sound/sound.o Pico/sound/sn76496.o Pico/sound/ym2612.o Pico/sound/mix.o
|
OBJS += Pico/sound/sound.o Pico/sound/sn76496.o Pico/sound/ym2612.o Pico/sound/mix.o
|
||||||
# Pico - carthw
|
# Pico - carthw
|
||||||
|
@ -77,7 +79,7 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
vpath %.c = ../..
|
vpath %.c = ../..
|
||||||
DIRS = platform platform/gp2x platform/common Pico Pico/cd Pico/sound Pico/carthw/svp \
|
DIRS = platform platform/gp2x platform/common Pico Pico/cd Pico/Pico Pico/sound Pico/carthw/svp \
|
||||||
zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
|
zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80
|
||||||
|
|
||||||
all: mkdirs PicoDrive
|
all: mkdirs PicoDrive
|
||||||
|
|
|
@ -38,7 +38,7 @@ OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.
|
||||||
../../Pico/Patch.o ../../Pico/Draw_amips.o ../../Pico/Memory_amips.o ../../Pico/Misc_amips.o
|
../../Pico/Patch.o ../../Pico/Draw_amips.o ../../Pico/Memory_amips.o ../../Pico/Misc_amips.o
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
||||||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/cue.o ../../Pico/cd/gfx_cd.o \
|
||||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
||||||
# Pico - carthw
|
# Pico - carthw
|
||||||
OBJS += ../../Pico/carthw/carthw.o ../../Pico/carthw/svp/svp.o ../../Pico/carthw/svp/Memory.o \
|
OBJS += ../../Pico/carthw/carthw.o ../../Pico/carthw/svp/svp.o ../../Pico/carthw/svp/Memory.o \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue