mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
bugfixes, CD swap, autorepeat
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@85 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
d915372968
commit
721cd3963f
17 changed files with 252 additions and 281 deletions
|
@ -70,6 +70,8 @@ static u32 CPU_CALL PicoCheckPc(u32 pc)
|
|||
#if defined(EMU_C68K)
|
||||
pc-=PicoCpu.membase; // Get real pc
|
||||
pc&=0xfffffe;
|
||||
if (pc == 0)
|
||||
return (int)Pico.rom + Pico.romsize; // common crash condition, can happen if acc timing is off
|
||||
|
||||
PicoCpu.membase=PicoMemBase(pc);
|
||||
|
||||
|
@ -192,6 +194,7 @@ static void OtherWrite8End(u32 a,u32 d,int realsize)
|
|||
//if(a==0x200000) dprintf("cc : %02x @ %06x [%i|%i]", d, SekPc, SekCyclesDoneT(), SekCyclesDone());
|
||||
//if(a==0x200001) dprintf("w8 : %02x @ %06x [%i]", d, SekPc, SekCyclesDoneT());
|
||||
if(a >= SRam.start && a <= SRam.end) {
|
||||
dprintf("sram w%i: %06x, %08x @%06x", realsize, a&0xffffff, d, SekPc);
|
||||
unsigned int sreg = Pico.m.sram_reg;
|
||||
if(!(sreg & 0x10)) {
|
||||
// not detected SRAM
|
||||
|
@ -229,7 +232,9 @@ static void OtherWrite8End(u32 a,u32 d,int realsize)
|
|||
#else
|
||||
// sram access register
|
||||
if(a == 0xA130F1) {
|
||||
Pico.m.sram_reg = (u8)(d&3);
|
||||
dprintf("sram reg=%02x", d);
|
||||
Pico.m.sram_reg &= ~3;
|
||||
Pico.m.sram_reg |= (u8)(d&3);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -443,6 +443,7 @@ m_read16_rom4: @ 0x200000 - 0x27ffff, SRAM area (NBA Live 95)
|
|||
mov r0, r0, lsr #8
|
||||
orr r0, r0, r1, lsl #8
|
||||
bx lr
|
||||
|
||||
m_read16_nosram:
|
||||
ldr r1, [r3, #4] @ 1ci
|
||||
cmp r0, r1
|
||||
|
@ -490,8 +491,6 @@ m_read16_misc:
|
|||
bic r0, r0, #1
|
||||
mov r1, #16
|
||||
b OtherRead16
|
||||
@ ldr r2, =OtherRead16
|
||||
@ bx r2
|
||||
|
||||
m_read16_vdp:
|
||||
tst r0, #0x70000
|
||||
|
@ -499,8 +498,6 @@ m_read16_vdp:
|
|||
bxne lr @ invalid read
|
||||
bic r0, r0, #1
|
||||
b PicoVideoRead
|
||||
@ ldr r1, =PicoVideoRead
|
||||
@ bx r1
|
||||
|
||||
m_read16_ram:
|
||||
ldr r1, =Pico
|
||||
|
@ -513,8 +510,6 @@ m_read16_above_rom:
|
|||
bic r0, r0, #1
|
||||
mov r1, #16
|
||||
b OtherRead16End
|
||||
@ ldr r2, =OtherRead16End
|
||||
@ bx r2
|
||||
|
||||
.pool
|
||||
|
||||
|
@ -573,6 +568,7 @@ m_read32_rom4: @ 0x200000 - 0x27ffff, SRAM area (does any game do long reads?)
|
|||
and r1, r1, #0xff
|
||||
orr r0, r0, r1, lsl #8
|
||||
bx lr
|
||||
|
||||
m_read32_nosram:
|
||||
ldr r1, [r3, #4] @ (1ci)
|
||||
cmp r0, r1
|
||||
|
@ -682,8 +678,11 @@ PicoWriteRomHW_SSF2: @ u32 a, u32 d
|
|||
|
||||
@ sram register
|
||||
ldr r2, =(Pico+0x22211) @ Pico.m.sram_reg
|
||||
ldrb r0, [r2]
|
||||
and r1, r1, #3
|
||||
strb r1, [r2]
|
||||
bic r0, r0, #3
|
||||
orr r0, r0, r1
|
||||
strb r0, [r2]
|
||||
bx lr
|
||||
|
||||
pwr_banking:
|
||||
|
@ -705,3 +704,4 @@ pwr_banking:
|
|||
str r12, [r2, r0, lsl #2]
|
||||
|
||||
bx lr
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ u32 OtherRead16(u32 a, int realsize)
|
|||
// |=0x80 for Shadow of the Beast & Super Offroad; rotate fakes next fetched instruction for Time Killers
|
||||
if (a==0xa11100) { // z80 busreq
|
||||
d=Pico.m.z80Run&1;
|
||||
#if 1
|
||||
if (!d) {
|
||||
// needed by buggy Terminator (Sega CD)
|
||||
extern int z80stopCycle;
|
||||
|
@ -106,6 +107,7 @@ u32 OtherRead16(u32 a, int realsize)
|
|||
if (stop_before > 0 && stop_before <= 32) // Gens uses 16 here
|
||||
d = 1; // bus not yet available
|
||||
}
|
||||
#endif
|
||||
d=(d<<8)|0x8000|Pico.m.rotate++;
|
||||
dprintf("get_zrun: %04x [%i|%i] @%06x", d, Pico.m.scanline, SekCyclesDone(), SekPc);
|
||||
goto end;
|
||||
|
|
|
@ -195,6 +195,8 @@ int PicoReset(int hard)
|
|||
// Dino Dini's Soccer malfunctions if SRAM is not filled with 0xff
|
||||
if (strncmp((char *)Pico.rom+0x150, "IDOND NI'I", 10) == 0)
|
||||
memset(SRam.data, 0xff, sram_size);
|
||||
dprintf("sram: det: %i; eeprom: %i; start: %06x; end: %06x\n",
|
||||
(Pico.m.sram_reg>>4)&1, (Pico.m.sram_reg>>2)&1, SRam.start, SRam.end);
|
||||
}
|
||||
|
||||
Pico.m.sram_reg = SRam.reg_back; // restore sram_reg
|
||||
|
|
|
@ -45,7 +45,10 @@ extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU
|
|||
extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware
|
||||
extern void (*PicoMessage)(const char *msg); // callback to output text message from emu
|
||||
|
||||
// cd/Pico.c
|
||||
int PicoFrameMCD(void);
|
||||
extern void (*PicoMCDopenTray)(void);
|
||||
extern int (*PicoMCDcloseTray)(void);
|
||||
|
||||
extern int PicoCDBuffers;
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ struct PicoMisc
|
|||
char dirtyPal; // Is the palette dirty (1 - change @ this frame, 2 - some time before)
|
||||
unsigned char hardware; // Hardware value for country
|
||||
unsigned char pal; // 1=PAL 0=NTSC
|
||||
unsigned char sram_reg; // SRAM mode register. bit0: allow read? bit1: deny write? bit2: EEPROM?
|
||||
unsigned char sram_reg; // SRAM mode register. bit0: allow read? bit1: deny write? bit2: EEPROM? bit4: detected? (header or by access)
|
||||
unsigned short z80_bank68k;
|
||||
unsigned short z80_lastaddr; // this is for Z80 faking
|
||||
unsigned char z80_fakeval;
|
||||
|
@ -151,7 +151,7 @@ struct PicoMisc
|
|||
unsigned short sram_addr; // EEPROM address register
|
||||
unsigned char sram_cycle; // EEPROM SRAM cycle number
|
||||
unsigned char sram_slave; // EEPROM slave word for X24C02 and better SRAMs
|
||||
unsigned char prot_bytes[2]; // simple protection fakeing
|
||||
unsigned char prot_bytes[2]; // simple protection faking
|
||||
unsigned short dma_bytes; //
|
||||
unsigned char pad[2];
|
||||
unsigned int frame_count; // mainly for movies
|
||||
|
|
|
@ -112,12 +112,12 @@ void Update_CDC_TRansfer(int which)
|
|||
|
||||
memcpy16bswap(dest, src, length);
|
||||
|
||||
{ // debug
|
||||
/*{ // debug
|
||||
unsigned char *b1 = Pico_mcd->word_ram1M[bank] + dep;
|
||||
unsigned char *b2 = (unsigned char *)(dest+length) - 8;
|
||||
dprintf("%02x %02x %02x %02x .. %02x %02x %02x %02x",
|
||||
b1[0], b1[1], b1[4], b1[5], b2[0], b2[1], b2[4], b2[5]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -128,12 +128,12 @@ void Update_CDC_TRansfer(int which)
|
|||
|
||||
memcpy16bswap(dest, src, length);
|
||||
|
||||
{ // debug
|
||||
/*{ // debug
|
||||
unsigned char *b1 = Pico_mcd->word_ram2M + dep;
|
||||
unsigned char *b2 = (unsigned char *)(dest+length) - 4;
|
||||
dprintf("%02x %02x %02x %02x .. %02x %02x %02x %02x",
|
||||
b1[0], b1[1], b1[2], b1[3], b2[0], b2[1], b2[2], b2[3]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else if (which == 4) // PCM RAM (check: popful Mail)
|
||||
|
@ -156,12 +156,12 @@ void Update_CDC_TRansfer(int which)
|
|||
|
||||
memcpy16bswap(dest, src, length);
|
||||
|
||||
{ // debug
|
||||
/*{ // debug
|
||||
unsigned char *b1 = Pico_mcd->prg_ram + dep;
|
||||
unsigned char *b2 = (unsigned char *)(dest+length) - 4;
|
||||
dprintf("%02x %02x %02x %02x .. %02x %02x %02x %02x",
|
||||
b1[0], b1[1], b1[2], b1[3], b2[0], b2[1], b2[2], b2[3]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
length <<= 1;
|
||||
|
@ -227,20 +227,6 @@ unsigned short Read_CDC_Host(int is_sub)
|
|||
(Pico_mcd->cdc.Buffer[addr]<<8) | Pico_mcd->cdc.Buffer[addr+1], Pico_mcd->cdc.DAC.N, Pico_mcd->cdc.DBC.N);
|
||||
|
||||
return (Pico_mcd->cdc.Buffer[addr]<<8) | Pico_mcd->cdc.Buffer[addr+1];
|
||||
|
||||
#if 0
|
||||
__asm
|
||||
{
|
||||
mov esi, Pico_mcd->cdc.DAC.N
|
||||
lea ebx, Pico_mcd->cdc.Buffer
|
||||
// and esi, 0x3FFF
|
||||
mov ax, [ebx + esi]
|
||||
add esi, 2
|
||||
rol ax, 8
|
||||
mov Pico_mcd->cdc.DAC.N, esi
|
||||
mov val, ax
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ typedef unsigned int u32;
|
|||
//#define __debug_io
|
||||
//#define __debug_io2
|
||||
|
||||
//#define rdprintf dprintf
|
||||
#define rdprintf(...)
|
||||
#define rdprintf dprintf
|
||||
//#define rdprintf(...)
|
||||
//#define wrdprintf dprintf
|
||||
#define wrdprintf(...)
|
||||
//#define plprintf dprintf
|
||||
#define plprintf(...)
|
||||
#define plprintf dprintf
|
||||
//#define plprintf(...)
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
|
@ -118,6 +118,7 @@ void m68k_reg_write8(u32 a, u32 d)
|
|||
Pico_mcd->m.busreq = d;
|
||||
return;
|
||||
case 2:
|
||||
dprintf("m68k: prg wp=%02x", d);
|
||||
Pico_mcd->s68k_regs[2] = d; // really use s68k side register
|
||||
return;
|
||||
case 3: {
|
||||
|
@ -405,7 +406,7 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
|
|||
{
|
||||
if ((a&0xffffc0)==0xa12000) { m68k_reg_write8(a, d); return; }
|
||||
|
||||
dprintf("m68k FIXME: strange w%i: %06x, %08x @%06x", realsize, a&0xffffff, d, SekPc);
|
||||
dprintf("m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -433,7 +434,7 @@ static u8 PicoReadM68k8(u32 a)
|
|||
if (a < 0x20000) { d = *(u8 *)(Pico_mcd->bios+(a^1)); goto end; } // bios
|
||||
|
||||
// prg RAM
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&3)!=1) {
|
||||
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
|
||||
d = *(prg_bank+((a^1)&0x1ffff));
|
||||
goto end;
|
||||
|
@ -490,7 +491,7 @@ static u16 PicoReadM68k16(u32 a)
|
|||
if (a < 0x20000) { d = *(u16 *)(Pico_mcd->bios+a); goto end; } // bios
|
||||
|
||||
// prg RAM
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&3)!=1) {
|
||||
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
|
||||
wrdprintf("m68k_prgram r16: [%i,%06x] @%06x", Pico_mcd->s68k_regs[3]>>6, a, SekPc);
|
||||
d = *(u16 *)(prg_bank+(a&0x1fffe));
|
||||
|
@ -547,7 +548,7 @@ static u32 PicoReadM68k32(u32 a)
|
|||
if (a < 0x20000) { u16 *pm=(u16 *)(Pico_mcd->bios+a); d = (pm[0]<<16)|pm[1]; goto end; } // bios
|
||||
|
||||
// prg RAM
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&3)!=1) {
|
||||
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
|
||||
u16 *pm=(u16 *)(prg_bank+(a&0x1fffe));
|
||||
d = (pm[0]<<16)|pm[1];
|
||||
|
@ -595,7 +596,6 @@ static u32 PicoReadM68k32(u32 a)
|
|||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Write Ram
|
||||
|
||||
#ifdef _ASM_CD_MEMORY_C
|
||||
void PicoWriteM68k8(u32 a,u8 d);
|
||||
|
@ -617,7 +617,7 @@ static void PicoWriteM68k8(u32 a,u8 d)
|
|||
a&=0xffffff;
|
||||
|
||||
// prg RAM
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&3)!=1) {
|
||||
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
|
||||
*(u8 *)(prg_bank+((a^1)&0x1ffff))=d;
|
||||
return;
|
||||
|
@ -668,7 +668,7 @@ static void PicoWriteM68k16(u32 a,u16 d)
|
|||
a&=0xfffffe;
|
||||
|
||||
// prg RAM
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&3)!=1) {
|
||||
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
|
||||
wrdprintf("m68k_prgram w16: [%i,%06x] %04x @%06x", Pico_mcd->s68k_regs[3]>>6, a, d, SekPc);
|
||||
*(u16 *)(prg_bank+(a&0x1fffe))=d;
|
||||
|
@ -734,7 +734,7 @@ static void PicoWriteM68k32(u32 a,u32 d)
|
|||
a&=0xfffffe;
|
||||
|
||||
// prg RAM
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&2)) {
|
||||
if ((a&0xfe0000)==0x020000 && (Pico_mcd->m.busreq&3)!=1) {
|
||||
u8 *prg_bank = Pico_mcd->prg_ram_b[Pico_mcd->s68k_regs[3]>>6];
|
||||
u16 *pm=(u16 *)(prg_bank+(a&0x1fffe));
|
||||
pm[0]=(u16)(d>>16); pm[1]=(u16)d;
|
||||
|
@ -777,6 +777,8 @@ static void PicoWriteM68k32(u32 a,u32 d)
|
|||
#endif
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// S68k
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
#ifdef _ASM_CD_MEMORY_C
|
||||
|
@ -1139,7 +1141,7 @@ static void PicoWriteS68k8(u32 a,u8 d)
|
|||
// prg RAM
|
||||
if (a < 0x80000) {
|
||||
u8 *pm=(u8 *)(Pico_mcd->prg_ram+(a^1));
|
||||
*pm=d;
|
||||
if (a >= (Pico_mcd->s68k_regs[2]<<8)) *pm=d;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1215,7 +1217,8 @@ static void PicoWriteS68k16(u32 a,u16 d)
|
|||
// prg RAM
|
||||
if (a < 0x80000) {
|
||||
wrdprintf("s68k_prgram w16: [%06x] %04x @%06x", a, d, SekPcS68k);
|
||||
*(u16 *)(Pico_mcd->prg_ram+a)=d;
|
||||
if (a >= (Pico_mcd->s68k_regs[2]<<8)) // needed for Dungeon Explorer
|
||||
*(u16 *)(Pico_mcd->prg_ram+a)=d;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1299,8 +1302,10 @@ static void PicoWriteS68k32(u32 a,u32 d)
|
|||
|
||||
// prg RAM
|
||||
if (a < 0x80000) {
|
||||
u16 *pm=(u16 *)(Pico_mcd->prg_ram+a);
|
||||
pm[0]=(u16)(d>>16); pm[1]=(u16)d;
|
||||
if (a >= (Pico_mcd->s68k_regs[2]<<8)) {
|
||||
u16 *pm=(u16 *)(Pico_mcd->prg_ram+a);
|
||||
pm[0]=(u16)(d>>16); pm[1]=(u16)d;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -390,7 +390,8 @@ m_m68k_read8_prgbank:
|
|||
orr r3, r2, #0x002200
|
||||
ldr r3, [r1, r3]
|
||||
ldr r2, [r1, r2]
|
||||
tst r3, #0x00020000 @ have bus?
|
||||
and r3, r3, #0x00030000
|
||||
cmp r3, #0x00010000 @ have bus or in reset state?
|
||||
moveq r0, #0
|
||||
bxeq lr
|
||||
and r2, r2, #0xc0000000 @ r3 & 0xC0
|
||||
|
@ -596,7 +597,8 @@ m_m68k_read16_prgbank:
|
|||
orr r3, r2, #0x002200
|
||||
ldr r3, [r1, r3]
|
||||
ldr r2, [r1, r2]
|
||||
tst r3, #0x00020000 @ have bus?
|
||||
and r3, r3, #0x00030000
|
||||
cmp r3, #0x00010000 @ have bus or in reset state?
|
||||
moveq r0, #0
|
||||
bxeq lr
|
||||
and r2, r2, #0xc0000000 @ r3 & 0xC0
|
||||
|
@ -766,7 +768,8 @@ m_m68k_read32_prgbank:
|
|||
orr r3, r2, #0x002200
|
||||
ldr r3, [r1, r3]
|
||||
ldr r2, [r1, r2]
|
||||
tst r3, #0x00020000 @ have bus?
|
||||
and r3, r3, #0x00030000
|
||||
cmp r3, #0x00010000 @ have bus or in reset state?
|
||||
moveq r0, #0
|
||||
bxeq lr
|
||||
and r2, r2, #0xc0000000 @ r3 & 0xC0
|
||||
|
@ -924,7 +927,8 @@ m_m68k_write8_prgbank:
|
|||
orr r3, r12, #0x002200
|
||||
ldr r3, [r2, r3]
|
||||
ldr r12,[r2, r12]
|
||||
tst r3, #0x00020000 @ have bus?
|
||||
and r3, r3, #0x00030000
|
||||
cmp r3, #0x00010000 @ have bus or in reset state?
|
||||
bxeq lr
|
||||
and r12,r12,#0xc0000000 @ r3 & 0xC0
|
||||
add r2, r2, r12, lsr #12
|
||||
|
@ -1027,7 +1031,8 @@ m_m68k_write16_prgbank:
|
|||
orr r3, r12, #0x002200
|
||||
ldr r3, [r2, r3]
|
||||
ldr r12,[r2, r12]
|
||||
tst r3, #0x00020000 @ have bus?
|
||||
and r3, r3, #0x00030000
|
||||
cmp r3, #0x00010000 @ have bus or in reset state?
|
||||
bxeq lr
|
||||
and r12,r12,#0xc0000000 @ r3 & 0xC0
|
||||
add r2, r2, r12, lsr #12
|
||||
|
@ -1159,7 +1164,8 @@ m_m68k_write32_prgbank:
|
|||
orr r3, r12, #0x002200
|
||||
ldr r3, [r2, r3]
|
||||
ldr r12,[r2, r12]
|
||||
tst r3, #0x00020000 @ have bus?
|
||||
and r3, r3, #0x00030000
|
||||
cmp r3, #0x00010000 @ have bus or in reset state?
|
||||
bxeq lr
|
||||
and r12,r12,#0xc0000000 @ r3 & 0xC0
|
||||
add r2, r2, r12, lsr #12
|
||||
|
@ -1687,6 +1693,18 @@ m_s68k_read32_regs_gfx:
|
|||
|
||||
|
||||
m_s68k_write8_prg: @ 0x000000 - 0x07ffff
|
||||
ldr r2, =(Pico+0x22200)
|
||||
eor r0, r0, #1
|
||||
ldr r2, [r2]
|
||||
add r3, r0, #0x020000 @ map to our address
|
||||
add r12,r2, #0x110000
|
||||
ldr r12,[r12]
|
||||
and r12,r12,#0x00ff0000 @ wp
|
||||
cmp r0, r12, lsr #8
|
||||
strgeb r1, [r2, r3]
|
||||
bx lr
|
||||
|
||||
|
||||
m_s68k_write8_wordram_2M: @ 0x080000 - 0x0bffff
|
||||
m_s68k_write8_wordram_1M_b1: @ 0x0c0000 - 0x0dffff, maps to 0x0e0000
|
||||
m_s68k_write8_ram 0x020000
|
||||
|
@ -1837,6 +1855,18 @@ m_s68k_write8_regs:
|
|||
|
||||
|
||||
m_s68k_write16_prg: @ 0x000000 - 0x07ffff
|
||||
ldr r2, =(Pico+0x22200)
|
||||
bic r0, r0, #1
|
||||
ldr r2, [r2]
|
||||
add r3, r0, #0x020000 @ map to our address
|
||||
add r12,r2, #0x110000
|
||||
ldr r12,[r12]
|
||||
and r12,r12,#0x00ff0000 @ wp
|
||||
cmp r0, r12, lsr #8
|
||||
strgeh r1, [r2, r3]
|
||||
bx lr
|
||||
|
||||
|
||||
m_s68k_write16_wordram_2M: @ 0x080000 - 0x0bffff
|
||||
m_s68k_write16_wordram_1M_b1: @ 0x0c0000 - 0x0dffff, maps to 0x0e0000
|
||||
m_s68k_write16_ram 0x020000
|
||||
|
@ -2010,6 +2040,21 @@ m_s68k_write16_regs_spec: @ special case
|
|||
|
||||
|
||||
m_s68k_write32_prg: @ 0x000000 - 0x07ffff
|
||||
ldr r2, =(Pico+0x22200)
|
||||
bic r0, r0, #1
|
||||
ldr r2, [r2]
|
||||
add r3, r0, #0x020000 @ map to our address
|
||||
add r12,r2, #0x110000
|
||||
ldr r12,[r12]
|
||||
and r12,r12,#0x00ff0000 @ wp
|
||||
cmp r0, r12, lsr #8
|
||||
bxlt lr
|
||||
mov r0, r1, lsr #16
|
||||
strh r0, [r2, r3]!
|
||||
strh r1, [r2, #2]
|
||||
bx lr
|
||||
|
||||
|
||||
m_s68k_write32_wordram_2M: @ 0x080000 - 0x0bffff
|
||||
m_s68k_write32_wordram_1M_b1: @ 0x0c0000 - 0x0dffff, maps to 0x0e0000
|
||||
m_s68k_write32_ram 0x020000
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
extern unsigned char formatted_bram[4*0x10];
|
||||
extern unsigned int s68k_poll_adclk;
|
||||
|
||||
void (*PicoMCDopenTray)(void) = NULL;
|
||||
int (*PicoMCDcloseTray)(void) = NULL;
|
||||
|
||||
#define dump_ram(ram,fname) \
|
||||
{ \
|
||||
|
|
230
Pico/cd/cd_sys.c
230
Pico/cd/cd_sys.c
|
@ -209,7 +209,7 @@ void Reset_CD(void)
|
|||
Pico_mcd->scd.Cur_Track = 0;
|
||||
Pico_mcd->scd.Cur_LBA = -150;
|
||||
Pico_mcd->scd.Status_CDC &= ~1;
|
||||
Pico_mcd->scd.Status_CDD = READY;
|
||||
Pico_mcd->scd.Status_CDD = CD_Present ? READY : NOCD;
|
||||
Pico_mcd->scd.CDD_Complete = 0;
|
||||
Pico_mcd->scd.File_Add_Delay = 0;
|
||||
}
|
||||
|
@ -223,12 +223,15 @@ int Insert_CD(char *iso_name, int is_bin)
|
|||
// memset(CD_Audio_Buffer_R, 0, 4096 * 4);
|
||||
|
||||
CD_Present = 0;
|
||||
Pico_mcd->scd.Status_CDD = NOCD;
|
||||
|
||||
if (iso_name != NULL)
|
||||
{
|
||||
ret = Load_ISO(iso_name, is_bin);
|
||||
if (ret == 0)
|
||||
if (ret == 0) {
|
||||
CD_Present = 1;
|
||||
Pico_mcd->scd.Status_CDD = READY;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -671,31 +674,23 @@ int Fast_Rewind_CDD_c9(void)
|
|||
|
||||
int Close_Tray_CDD_cC(void)
|
||||
{
|
||||
CD_Present = 0;
|
||||
//Clear_Sound_Buffer();
|
||||
|
||||
Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
|
||||
|
||||
{
|
||||
#if 0 // TODO
|
||||
char new_iso[1024];
|
||||
printf("tray close\n");
|
||||
|
||||
memset(new_iso, 0, 1024);
|
||||
if (PicoMCDcloseTray != NULL)
|
||||
CD_Present = PicoMCDcloseTray();
|
||||
|
||||
while (!Change_File_L(new_iso, Rom_Dir, "Load SegaCD image file", "SegaCD image file\0*.bin;*.iso;*.raw\0All files\0*.*\0\0", ""));
|
||||
Reload_SegaCD(new_iso);
|
||||
Pico_mcd->scd.Status_CDD = CD_Present ? STOPPED : NOCD;
|
||||
Pico_mcd->cdd.Status = 0x0000;
|
||||
|
||||
CD_Present = 1;
|
||||
#else
|
||||
CD_Present = 0;
|
||||
#endif
|
||||
Pico_mcd->scd.Status_CDD = STOPPED;
|
||||
Pico_mcd->cdd.Status = 0x0000;
|
||||
|
||||
Pico_mcd->cdd.Minute = 0;
|
||||
Pico_mcd->cdd.Seconde = 0;
|
||||
Pico_mcd->cdd.Frame = 0;
|
||||
Pico_mcd->cdd.Ext = 0;
|
||||
}
|
||||
Pico_mcd->cdd.Minute = 0;
|
||||
Pico_mcd->cdd.Seconde = 0;
|
||||
Pico_mcd->cdd.Frame = 0;
|
||||
Pico_mcd->cdd.Ext = 0;
|
||||
|
||||
Pico_mcd->scd.CDD_Complete = 1;
|
||||
|
||||
|
@ -709,9 +704,14 @@ int Open_Tray_CDD_cD(void)
|
|||
|
||||
Pico_mcd->scd.Status_CDC &= ~1; // Stop CDC read
|
||||
|
||||
printf("tray open\n");
|
||||
|
||||
Unload_ISO();
|
||||
CD_Present = 0;
|
||||
|
||||
if (PicoMCDopenTray != NULL)
|
||||
PicoMCDopenTray();
|
||||
|
||||
Pico_mcd->scd.Status_CDD = TRAY_OPEN;
|
||||
Pico_mcd->cdd.Status = 0x0E00;
|
||||
|
||||
|
@ -760,193 +760,3 @@ int CDD_Def(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************
|
||||
* Others CD functions *
|
||||
**************************/
|
||||
|
||||
|
||||
// do we need them?
|
||||
#if 0
|
||||
void Write_CD_Audio(short *Buf, int rate, int channel, int lenght)
|
||||
{
|
||||
unsigned int lenght_src, lenght_dst;
|
||||
unsigned int pos_src, pas_src;
|
||||
|
||||
if (rate == 0) return;
|
||||
if (Sound_Rate == 0) return;
|
||||
|
||||
if (CD_Audio_Starting)
|
||||
{
|
||||
CD_Audio_Starting = 0;
|
||||
memset(CD_Audio_Buffer_L, 0, 4096 * 4);
|
||||
memset(CD_Audio_Buffer_R, 0, 4096 * 4);
|
||||
CD_Audio_Buffer_Write_Pos = (CD_Audio_Buffer_Read_Pos + 2000) & 0xFFF;
|
||||
}
|
||||
|
||||
lenght_src = rate / 75; // 75th of a second
|
||||
lenght_dst = Sound_Rate / 75; // 75th of a second
|
||||
|
||||
pas_src = (lenght_src << 16) / lenght_dst;
|
||||
pos_src = 0;
|
||||
|
||||
#ifdef DEBUG_CD
|
||||
fprintf(debug_SCD_file, "\n********* Write Pos = %d ", CD_Audio_Buffer_Write_Pos);
|
||||
#endif
|
||||
|
||||
if (channel == 2)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov edi, CD_Audio_Buffer_Write_Pos
|
||||
mov ebx, Buf
|
||||
xor esi, esi
|
||||
mov ecx, lenght_dst
|
||||
xor eax, eax
|
||||
mov edx, pas_src
|
||||
dec ecx
|
||||
jmp short loop_stereo
|
||||
|
||||
align 16
|
||||
|
||||
loop_stereo:
|
||||
movsx eax, word ptr [ebx + esi * 4]
|
||||
mov CD_Audio_Buffer_L[edi * 4], eax
|
||||
movsx eax, word ptr [ebx + esi * 4 + 2]
|
||||
mov CD_Audio_Buffer_R[edi * 4], eax
|
||||
mov esi, dword ptr pos_src
|
||||
inc edi
|
||||
add esi, edx
|
||||
and edi, 0xFFF
|
||||
mov dword ptr pos_src, esi
|
||||
shr esi, 16
|
||||
dec ecx
|
||||
jns short loop_stereo
|
||||
|
||||
mov CD_Audio_Buffer_Write_Pos, edi
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov edi, CD_Audio_Buffer_Write_Pos
|
||||
mov ebx, Buf
|
||||
xor esi, esi
|
||||
mov ecx, lenght_dst
|
||||
xor eax, eax
|
||||
mov edx, pas_src
|
||||
dec ecx
|
||||
jmp short loop_mono
|
||||
|
||||
align 16
|
||||
|
||||
loop_mono:
|
||||
movsx eax, word ptr [ebx + esi * 2]
|
||||
mov CD_Audio_Buffer_L[edi * 4], eax
|
||||
mov CD_Audio_Buffer_R[edi * 4], eax
|
||||
mov esi, dword ptr pos_src
|
||||
inc edi
|
||||
add esi, edx
|
||||
and edi, 0xFFF
|
||||
mov dword ptr pos_src, esi
|
||||
shr esi, 16
|
||||
dec ecx
|
||||
jns short loop_mono
|
||||
|
||||
mov CD_Audio_Buffer_Write_Pos, edi
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CD
|
||||
fprintf(debug_SCD_file, "Write Pos 2 = %d\n\n", CD_Audio_Buffer_Write_Pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Update_CD_Audio(int **buf, int lenght)
|
||||
{
|
||||
int *Buf_L, *Buf_R;
|
||||
int diff;
|
||||
|
||||
Buf_L = buf[0];
|
||||
Buf_R = buf[1];
|
||||
|
||||
if (Pico_mcd->s68k_regs[0x36] & 0x01) return;
|
||||
if (!(Pico_mcd->scd.Status_CDC & 1)) return;
|
||||
if (CD_Audio_Starting) return;
|
||||
|
||||
#ifdef DEBUG_CD
|
||||
fprintf(debug_SCD_file, "\n********* Read Pos Normal = %d ", CD_Audio_Buffer_Read_Pos);
|
||||
#endif
|
||||
|
||||
if (CD_Audio_Buffer_Write_Pos < CD_Audio_Buffer_Read_Pos)
|
||||
{
|
||||
diff = CD_Audio_Buffer_Write_Pos + (4096) - CD_Audio_Buffer_Read_Pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
diff = CD_Audio_Buffer_Write_Pos - CD_Audio_Buffer_Read_Pos;
|
||||
}
|
||||
|
||||
if (diff < 500) CD_Audio_Buffer_Read_Pos -= 2000;
|
||||
else if (diff > 3500) CD_Audio_Buffer_Read_Pos += 2000;
|
||||
|
||||
#ifdef DEBUG_CD
|
||||
else fprintf(debug_SCD_file, " pas de modifs ");
|
||||
#endif
|
||||
|
||||
CD_Audio_Buffer_Read_Pos &= 0xFFF;
|
||||
|
||||
#ifdef DEBUG_CD
|
||||
fprintf(debug_SCD_file, "Read Pos = %d ", CD_Audio_Buffer_Read_Pos);
|
||||
#endif
|
||||
|
||||
if (CDDA_Enable)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
mov ecx, lenght
|
||||
mov esi, CD_Audio_Buffer_Read_Pos
|
||||
mov edi, Buf_L
|
||||
dec ecx
|
||||
|
||||
loop_L:
|
||||
mov eax, CD_Audio_Buffer_L[esi * 4]
|
||||
add [edi], eax
|
||||
inc esi
|
||||
add edi, 4
|
||||
and esi, 0xFFF
|
||||
dec ecx
|
||||
jns short loop_L
|
||||
|
||||
mov ecx, lenght
|
||||
mov esi, CD_Audio_Buffer_Read_Pos
|
||||
mov edi, Buf_R
|
||||
dec ecx
|
||||
|
||||
loop_R:
|
||||
mov eax, CD_Audio_Buffer_R[esi * 4]
|
||||
add [edi], eax
|
||||
inc esi
|
||||
add edi, 4
|
||||
and esi, 0xFFF
|
||||
dec ecx
|
||||
jns short loop_R
|
||||
|
||||
mov CD_Audio_Buffer_Read_Pos, esi
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CD_Audio_Buffer_Read_Pos += lenght;
|
||||
CD_Audio_Buffer_Read_Pos &= 0xFFF;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CD
|
||||
fprintf(debug_SCD_file, "Read Pos 2 = %d\n\n", CD_Audio_Buffer_Read_Pos);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ int find_bios(int region, char **bios_file)
|
|||
|
||||
/* checks if romFileName points to valid MegaCD image
|
||||
* if so, checks for suitable BIOS */
|
||||
static int cd_check(char **bios_file)
|
||||
int emu_cd_check(char **bios_file)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
pm_file *cd_f;
|
||||
|
@ -177,7 +177,7 @@ static int cd_check(char **bios_file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* it seems we have a CD image here. Try to detect region and load a suitable BIOS 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_read(buf, 1, cd_f);
|
||||
pm_close(cd_f);
|
||||
|
@ -193,7 +193,9 @@ static int cd_check(char **bios_file)
|
|||
printf("overrided region to %s\n", region != 4 ? (region == 8 ? "EU" : "JAP") : "USA");
|
||||
}
|
||||
|
||||
if(find_bios(region, bios_file))
|
||||
if (bios_file == NULL) return type;
|
||||
|
||||
if (find_bios(region, bios_file))
|
||||
return type; // CD and BIOS detected
|
||||
|
||||
return -1; // CD detected but load failed
|
||||
|
@ -271,7 +273,7 @@ int emu_ReloadRom(void)
|
|||
}
|
||||
|
||||
// check for MegaCD image
|
||||
cd_state = cd_check(&used_rom_name);
|
||||
cd_state = emu_cd_check(&used_rom_name);
|
||||
if (cd_state > 0) {
|
||||
PicoMCD |= 1;
|
||||
get_ext(used_rom_name, ext);
|
||||
|
@ -381,6 +383,7 @@ int emu_ReloadRom(void)
|
|||
|
||||
|
||||
static void emu_msg_cb(const char *msg);
|
||||
static void emu_msg_tray_open(void);
|
||||
|
||||
void emu_Init(void)
|
||||
{
|
||||
|
@ -399,8 +402,8 @@ void emu_Init(void)
|
|||
|
||||
PicoInit();
|
||||
PicoMessage = emu_msg_cb;
|
||||
|
||||
// logf = fopen("log.txt", "w");
|
||||
PicoMCDopenTray = emu_msg_tray_open;
|
||||
PicoMCDcloseTray = menu_loop_tray;
|
||||
}
|
||||
|
||||
|
||||
|
@ -528,8 +531,9 @@ int emu_ReadConfig(int game)
|
|||
}
|
||||
scaling_update();
|
||||
// some sanity checks
|
||||
if (currentConfig.CPUclock < 1 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;
|
||||
if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;
|
||||
if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100;
|
||||
if (currentConfig.volume < 0 || currentConfig.volume > 99) currentConfig.volume = 50;
|
||||
// if volume keys are unbound, bind them to volume control
|
||||
if (!currentConfig.KeyBinds[23] && !currentConfig.KeyBinds[22]) {
|
||||
currentConfig.KeyBinds[23] = 1<<29; // vol up
|
||||
|
@ -603,7 +607,6 @@ void emu_Deinit(void)
|
|||
free(framebuff);
|
||||
|
||||
PicoExit();
|
||||
// fclose(logf);
|
||||
|
||||
// restore gamma
|
||||
if (gp2x_old_gamma != 100)
|
||||
|
@ -824,6 +827,12 @@ static void emu_state_cb(const char *str)
|
|||
blit("", str);
|
||||
}
|
||||
|
||||
static void emu_msg_tray_open(void)
|
||||
{
|
||||
strcpy(noticeMsg, "CD tray opened");
|
||||
gettimeofday(¬iceMsgTime, 0);
|
||||
}
|
||||
|
||||
static void RunEvents(unsigned int which)
|
||||
{
|
||||
if(which & 0x1800) { // save or load (but not both)
|
||||
|
@ -974,7 +983,7 @@ static void updateKeys(void)
|
|||
if(events & 0x6000) {
|
||||
int vol = currentConfig.volume;
|
||||
if (events & 0x2000) {
|
||||
if (vol < 90) vol++;
|
||||
if (vol < 99) vol++;
|
||||
} else {
|
||||
if (vol > 0) vol--;
|
||||
}
|
||||
|
@ -1196,7 +1205,7 @@ void emu_Loop(void)
|
|||
if (frames_shown > frames_done) frames_shown = frames_done;
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
#if 0
|
||||
sprintf(fpsbuff, "%05i", Pico.m.frame_count);
|
||||
#endif
|
||||
lim_time = (frames_done+1) * target_frametime;
|
||||
|
|
|
@ -13,6 +13,7 @@ enum TPicoGameState {
|
|||
PGS_KeyConfig,
|
||||
PGS_ReloadRom,
|
||||
PGS_Menu,
|
||||
PGS_RestartRun,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -52,6 +53,7 @@ char *emu_GetSaveFName(int load, int is_sram, int slot);
|
|||
int emu_check_save_file(int slot);
|
||||
void emu_set_save_cbs(int gz);
|
||||
void emu_forced_frame(void);
|
||||
int emu_cd_check(char **bios_file);
|
||||
int find_bios(int region, char **bios_file);
|
||||
void scaling_update(void);
|
||||
|
||||
|
|
|
@ -120,6 +120,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
break;
|
||||
|
||||
case PGS_RestartRun:
|
||||
engineState = PGS_Running;
|
||||
|
||||
case PGS_Running:
|
||||
emu_Loop();
|
||||
break;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "menu.h"
|
||||
#include "fonts.h"
|
||||
#include "usbjoy.h"
|
||||
#include "asmutils.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <Pico/PicoInt.h>
|
||||
|
@ -170,14 +171,16 @@ static int inp_prevjoy = 0;
|
|||
static unsigned long wait_for_input(unsigned long interesting)
|
||||
{
|
||||
unsigned long ret;
|
||||
static int repeats = 0, wait = 300*1000;
|
||||
static int repeats = 0, wait = 50*1000;
|
||||
int release = 0, i;
|
||||
|
||||
if (repeats == 5 || repeats == 15 || repeats == 30) wait /= 2;
|
||||
if (repeats == 2 || repeats == 4) wait /= 2;
|
||||
if (repeats == 6) wait = 15 * 1000;
|
||||
|
||||
for (i = 0; i < 6 && inp_prev == gp2x_joystick_read(1); i++) {
|
||||
if(i == 0) repeats++;
|
||||
usleep(wait/6);
|
||||
if (i == 0) repeats++;
|
||||
if (wait >= 30*1000) usleep(wait); // usleep sleeps for ~30ms minimum
|
||||
else spend_cycles(wait * currentConfig.CPUclock);
|
||||
}
|
||||
|
||||
while ( !((ret = gp2x_joystick_read(1)) & interesting) ) {
|
||||
|
@ -187,7 +190,7 @@ static unsigned long wait_for_input(unsigned long interesting)
|
|||
|
||||
if (release || ret != inp_prev) {
|
||||
repeats = 0;
|
||||
wait = 300*1000;
|
||||
wait = 50*1000;
|
||||
}
|
||||
inp_prev = ret;
|
||||
inp_prevjoy = 0;
|
||||
|
@ -356,8 +359,10 @@ static char *romsel_loop(char *curr_path)
|
|||
inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_L|GP2X_R|GP2X_B|GP2X_X);
|
||||
if(inp & GP2X_UP ) { sel--; if (sel < 0) sel = n-2; }
|
||||
if(inp & GP2X_DOWN) { sel++; if (sel > n-2) sel = 0; }
|
||||
if(inp &(GP2X_LEFT|GP2X_L)) { sel-=10; if (sel < 0) sel = 0; }
|
||||
if(inp &(GP2X_RIGHT|GP2X_R)) { sel+=10; if (sel > n-2) sel = n-2; }
|
||||
if(inp & GP2X_LEFT) { sel-=10; if (sel < 0) sel = 0; }
|
||||
if(inp & GP2X_L) { sel-=24; if (sel < 0) sel = 0; }
|
||||
if(inp & GP2X_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; }
|
||||
if(inp & GP2X_R) { sel+=24; if (sel > n-2) sel = n-2; }
|
||||
if(inp & GP2X_B) { // enter dir/select
|
||||
again:
|
||||
if (namelist[sel+1]->d_type == DT_REG) {
|
||||
|
@ -872,7 +877,7 @@ static void draw_amenu_options(int menu_sel)
|
|||
gp2x_text_out8(tl_x, (y+=10), "Emulate YM2612 (FM) %s", (currentConfig.PicoOpt&0x001)?"ON":"OFF"); // 2
|
||||
gp2x_text_out8(tl_x, (y+=10), "Emulate SN76496 (PSG) %s", (currentConfig.PicoOpt&0x002)?"ON":"OFF"); // 3
|
||||
gp2x_text_out8(tl_x, (y+=10), "gzip savestates %s", (currentConfig.EmuOpt &0x008)?"ON":"OFF"); // 4
|
||||
gp2x_text_out8(tl_x, (y+=10), "Don't save config on exit %s", (currentConfig.EmuOpt &0x020)?"ON":"OFF"); // 5
|
||||
gp2x_text_out8(tl_x, (y+=10), "Don't save last used ROM %s", (currentConfig.EmuOpt &0x020)?"ON":"OFF"); // 5
|
||||
gp2x_text_out8(tl_x, (y+=10), "needs restart:");
|
||||
gp2x_text_out8(tl_x, (y+=10), "craigix's RAM timings %s", (currentConfig.EmuOpt &0x100)?"ON":"OFF"); // 7
|
||||
gp2x_text_out8(tl_x, (y+=10), "squidgehack (now %s %s", mms, (currentConfig.EmuOpt &0x010)?"ON":"OFF"); // 8
|
||||
|
@ -1256,7 +1261,11 @@ static void menu_loop_root(void)
|
|||
if(inp & GP2X_B ) {
|
||||
switch (menu_sel) {
|
||||
case 0: // resume game
|
||||
if (rom_data) { engineState = PGS_Running; return; }
|
||||
if (rom_data) {
|
||||
while (gp2x_joystick_read(1) & GP2X_B) usleep(50*1000);
|
||||
engineState = PGS_Running;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 1: // save state
|
||||
if (rom_data) {
|
||||
|
@ -1355,3 +1364,85 @@ void menu_loop(void)
|
|||
|
||||
menuErrorMsg[0] = 0;
|
||||
}
|
||||
|
||||
|
||||
// --------- CD tray close menu ----------
|
||||
|
||||
static void draw_menu_tray(int menu_sel)
|
||||
{
|
||||
int tl_x = 70, tl_y = 90, y;
|
||||
memset(gp2x_screen, 0xe0, 320*240);
|
||||
|
||||
gp2x_text_out8(tl_x, 20, "The unit is about to");
|
||||
gp2x_text_out8(tl_x, 30, "close the CD tray.");
|
||||
|
||||
y = tl_y;
|
||||
gp2x_text_out8(tl_x, y, "Load new CD image");
|
||||
gp2x_text_out8(tl_x, (y+=10), "Insert nothing");
|
||||
|
||||
// draw cursor
|
||||
gp2x_text_out8(tl_x - 16, tl_y + menu_sel*10, ">");
|
||||
// error
|
||||
if (menuErrorMsg[0]) gp2x_text_out8(5, 226, menuErrorMsg);
|
||||
gp2x_video_flip2();
|
||||
}
|
||||
|
||||
|
||||
int menu_loop_tray(void)
|
||||
{
|
||||
int menu_sel = 0, menu_sel_max = 1;
|
||||
unsigned long inp = 0;
|
||||
char curr_path[PATH_MAX], *selfname;
|
||||
FILE *tstf;
|
||||
|
||||
gp2x_memset_all_buffers(0, 0xe0, 320*240);
|
||||
menu_gfx_prepare();
|
||||
|
||||
if ( (tstf = fopen(currentConfig.lastRomFile, "rb")) )
|
||||
{
|
||||
fclose(tstf);
|
||||
strcpy(curr_path, currentConfig.lastRomFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
getcwd(curr_path, PATH_MAX);
|
||||
}
|
||||
|
||||
/* make sure action buttons are not pressed on entering menu */
|
||||
draw_menu_tray(menu_sel);
|
||||
while (gp2x_joystick_read(1) & GP2X_B) usleep(50*1000);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
draw_menu_tray(menu_sel);
|
||||
inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_B);
|
||||
if(inp & GP2X_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = menu_sel_max; }
|
||||
if(inp & GP2X_DOWN) { menu_sel++; if (menu_sel > menu_sel_max) menu_sel = 0; }
|
||||
if(inp & GP2X_B ) {
|
||||
switch (menu_sel) {
|
||||
case 0: // select image
|
||||
selfname = romsel_loop(curr_path);
|
||||
if (selfname) {
|
||||
int ret = -1, cd_type;
|
||||
cd_type = emu_cd_check(NULL);
|
||||
if (cd_type > 0)
|
||||
ret = Insert_CD(romFileName, cd_type == 2);
|
||||
if (ret != 0) {
|
||||
sprintf(menuErrorMsg, "Load failed, invalid CD image?");
|
||||
printf("%s\n", menuErrorMsg);
|
||||
continue;
|
||||
}
|
||||
engineState = PGS_RestartRun;
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 1: // insert nothing
|
||||
engineState = PGS_RestartRun;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
menuErrorMsg[0] = 0; // clear error msg
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ void gp2x_text_out8 (int x, int y, const char *texto, ...);
|
|||
void gp2x_text_out15 (int x, int y, const char *text);
|
||||
void gp2x_text_out8_2(int x, int y, const char *texto, int color);
|
||||
void menu_loop(void);
|
||||
int menu_loop_tray(void);
|
||||
|
||||
#define CONFIGURABLE_KEYS \
|
||||
(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_A|GP2X_B|GP2X_X|GP2X_Y| \
|
||||
|
|
|
@ -216,12 +216,17 @@ Changelog
|
|||
---------
|
||||
1.32
|
||||
+ Added some new scaling options.
|
||||
+ Added ability to reaload CD images while game is running (needed for games
|
||||
with multiple CDs, like Night Trap).
|
||||
* Fixed DMA timing emulation (caused lock-ups for some genesis games).
|
||||
* Idle loop detection was picking up wrong code and causing glitches, fixed.
|
||||
* The ym2612 code on 940 now can handle multiple updates per frame
|
||||
(fixes Thunger Force III "seiren" level drums for example).
|
||||
* Memory handlers were ignoring some writes to PSG chip, fixed (missing sounds in
|
||||
Popful Mail, Silpheed).
|
||||
* Improved z80 timing, should fix some sound problems.
|
||||
* Fixed a bug with sram register (fixes Phantasy Star 4).
|
||||
* Added code for PRG ram write protection register (Dungeon Explorer).
|
||||
|
||||
1.31
|
||||
* Changed the way memory mode register is read (fixes Lunar 2, broken in 1.30).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue