ScanVar(sn76496_regs,28*4,"SN76496state", PmovFile, PmovAction); // regs and other stuff\r
if(PicoOpt&1) {\r
ScanVar(ym2612_regs, 0x200+4, "YM2612state", PmovFile, PmovAction); // regs + addr line\r
- if((PmovAction&3)==2) YM2612PicoStateLoad(); // reload YM2612 state from it's regs\r
+ if((PmovAction&3)==2) ym2612_unpack_state(); // reload YM2612 state from it's regs\r
}\r
}\r
\r
}\r
\r
// Unusual region 'code'\r
- if (rom_strcmp(0x1f0, "EUROPE") == 0)\r
+ if (rom_strcmp(0x1f0, "EUROPE") == 0 || rom_strcmp(0x1f0, "Europe") == 0)\r
*(int *) (Pico.rom+0x1f0) = 0x20204520;\r
}\r
\r
return YM2612Write_(a, d);\r
}\r
\r
-// TODO: savestates\r
+\r
#define ym2612_read_local() \\r
if (xcycles >= timer_a_next_oflow) \\r
ym2612.OPN.ST.status |= (ym2612.OPN.ST.mode >> 2) & 1; \\r
if (xcycles >= timer_b_next_oflow) \\r
ym2612.OPN.ST.status |= (ym2612.OPN.ST.mode >> 2) & 2\r
\r
-\r
u32 ym2612_read_local_z80(void)\r
{\r
int xcycles = z80_cyclesDone() << 8;\r
return ym2612.OPN.ST.status;\r
}\r
\r
+// TODO: new ym2612 savestates\r
+void ym2612_unpack_state(void)\r
+{\r
+ int i;\r
+ YM2612PicoStateLoad();\r
+\r
+ // feed all the registers and update internal state\r
+ for (i = 0x20; i < 0xC0; i++) {\r
+ ym2612_write_local(0, i, 0);\r
+ ym2612_write_local(1, ym2612.REGS[i], 0);\r
+ }\r
+ for (i = 0x30; i < 0xC0; i++) {\r
+ ym2612_write_local(2, i, 0);\r
+ ym2612_write_local(3, ym2612.REGS[i|0x100], 0);\r
+ }\r
+}\r
+\r
// -----------------------------------------------------------------\r
// z80 memhandlers\r
\r
extern int timer_b_next_oflow, timer_b_step, timer_b_offset;\r
\r
void ym2612_sync_timers(int z80_cycles, int mode_old, int mode_new);\r
+void ym2612_unpack_state(void);\r
\r
#define timers_cycle() \\r
if (timer_a_next_oflow > 0 && timer_a_next_oflow < 0x70000000) \\r
case CHUNK_PSG: CHECKED_READ2(28*4, sn76496_regs); break;
case CHUNK_FM:
CHECKED_READ2(0x200+4, ym2612_regs);
- YM2612PicoStateLoad();
+ ym2612_unpack_state();
break;
// cd stuff
if (preserve_state) {\r
// feed it back it's own registers, just like after loading state\r
memcpy(YM2612GetRegs(), state, 0x200);\r
- YM2612PicoStateLoad();\r
+ ym2612_unpack_state();\r
if ((PicoAHW & PAHW_MCD) && !(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1))\r
cdda_start_play();\r
}\r
\r
void YM2612PicoStateLoad_(void)\r
{\r
-#ifndef EXTERNAL_YM2612\r
- int i, real_A1 = ym2612.addr_A1;\r
-\r
- reset_channels( &ym2612.CH[0] );\r
-\r
- // feed all the registers and update internal state\r
- for(i = 0; i < 0x100; i++) {\r
- YM2612Write_(0, i);\r
- YM2612Write_(1, ym2612.REGS[i]);\r
- }\r
-\r
- for(i = 0; i < 0x100; i++) {\r
- YM2612Write_(2, i);\r
- YM2612Write_(3, ym2612.REGS[i|0x100]);\r
- }\r
-\r
- ym2612.addr_A1 = real_A1;\r
-#else\r
reset_channels( &ym2612.CH[0] );\r
-#endif\r
}\r
\r
#ifndef EXTERNAL_YM2612\r
{\r
UINT8 *REGS = YM2612GetRegs();\r
\r
- int i;\r
-\r
/* make sure JOB940_PICOSTATELOAD gets done before next JOB940_YM2612UPDATEONE */\r
add_job_940(JOB940_PICOSTATELOAD);\r
if (CHECK_BUSY(JOB940_PICOSTATELOAD)) wait_busy_940(JOB940_PICOSTATELOAD);\r
\r
writebuff_ptr = 0;\r
-\r
- // feed all the registers and update internal state\r
- for(i = 0; i < 0x100; i++) {\r
- YM2612Write_940(0, i, -1);\r
- YM2612Write_940(1, REGS[i], -1);\r
- }\r
- for(i = 0; i < 0x100; i++) {\r
- YM2612Write_940(2, i, -1);\r
- YM2612Write_940(3, REGS[i|0x100], -1);\r
- }\r
-\r
addr_A1 = *(INT32 *) (REGS + 0x200);\r
}\r
\r
static unsigned long wait_for_input(unsigned int interesting, int is_key_config)
{
unsigned int ret;
- static int repeats = 0, wait = 50;
+ static int repeats = 0, wait = 6;
int release = 0, count, i;
if (!is_key_config)
interesting |= (interesting & 0xf0) << 24; // also use analog
- if (repeats == 2 || repeats == 4) wait /= 2;
- if (repeats == 6) wait = 15;
+ if (repeats == 2) wait = 3;
+ else if (repeats == 4) wait = 2;
+ else if (repeats == 6) wait = 1;
- for (i = 0; i < 6 && inp_prev == psp_pad_read(1); i++) {
+ for (i = 0; i < wait && inp_prev == gp2x_joystick_read(1); i++) {
+
+ for (i = 0; i < wait && inp_prev == psp_pad_read(1); i++) {
if (i == 0) repeats++;
- psp_msleep(wait);
+ psp_msleep(30);
}
for (count = 0; !((ret = psp_pad_read(1)) & interesting) && count < 100; count++) {
if (release || ret != inp_prev) {
repeats = 0;
- wait = 50;
+ wait = 6;
}
inp_prev = ret;