Pico_mcd->scd.Cur_Track = 0;\r
Pico_mcd->scd.Cur_LBA = -150;\r
Pico_mcd->scd.Status_CDC &= ~1;\r
- Pico_mcd->scd.Status_CDD = CD_Present ? READY : NOCD;\r
+ if (Pico_mcd->scd.Status_CDD != TRAY_OPEN)\r
+ Pico_mcd->scd.Status_CDD = CD_Present ? READY : NOCD;\r
Pico_mcd->scd.CDD_Complete = 0;\r
Pico_mcd->scd.File_Add_Delay = 0;\r
}\r
int ret = 1;\r
\r
CD_Present = 0;\r
- Pico_mcd->scd.Status_CDD = NOCD;\r
\r
if (cdimg_name != NULL && type != CIT_NOT_CD)\r
{\r
ret = Load_CD_Image(cdimg_name, type);\r
if (ret == 0) {\r
CD_Present = 1;\r
- /* for open tray close command will handle Status_CDD */\r
- if (Pico_mcd->scd.Status_CDD != TRAY_OPEN)\r
+\r
+ if (Pico_mcd->scd.Status_CDD == TRAY_OPEN)\r
+ {\r
+ if (Pico_mcd->bios[0x122 ^ 1] == '2')\r
+ Close_Tray_CDD_cC();\r
+ // else bios will issue it\r
+ }\r
+ else\r
+ {\r
Pico_mcd->scd.Status_CDD = READY;\r
+ }\r
}\r
}\r
\r
+ if (Pico_mcd->scd.Status_CDD != TRAY_OPEN && !CD_Present)\r
+ Pico_mcd->scd.Status_CDD = NOCD;\r
+\r
return ret;\r
}\r
\r
\r
-void Stop_CD(void)\r
+int Stop_CD(void)\r
{\r
+ int ret = CD_Present;\r
+\r
Unload_ISO();\r
CD_Present = 0;\r
+\r
+ return ret;\r
}\r
\r
\r
if (delay < 0) delay = -delay;\r
delay >>= 12;\r
\r
- // based on genplys GX\r
- if (delay < 13)\r
+ if (Pico_mcd->scd.Cur_LBA > 0 && delay < 13)\r
+ // based on genplus GX\r
delay = 13;\r
\r
Pico_mcd->scd.Cur_LBA = new_lba;\r
memset(&Pico_mcd->pcm, 0, sizeof(Pico_mcd->pcm));
memset(&Pico_mcd->m, 0, sizeof(Pico_mcd->m));
+ Reset_CD();
+
// cold reset state (tested)
Pico_mcd->m.state_flags = PCD_ST_S68K_RST;
Pico_mcd->m.busreq = 2; // busreq on, s68k in reset
memset(Pico_mcd->bios + 0x70, 0xff, 4);
}
-PICO_INTERNAL int PicoResetMCD(void)
+void pcd_soft_reset(void)
{
- // ??
- Reset_CD();
+ // Reset_CD(); // breaks Fahrenheit CD swap
+
LC89510_Reset();
gfx_cd_reset();
#ifdef _ASM_CD_MEMORY_C
//PicoMemResetCDdecode(1); // don't have to call this in 2M mode
#endif
+ pcd_event_schedule_s68k(PCD_EVENT_CDC, 12500000/75);
+
+ // TODO: test if register state/timers change
+}
+
+PICO_INTERNAL int PicoResetMCD(void)
+{
+ // reset button doesn't affect MCD hardware
+
// use SRam.data for RAM cart
if (PicoOpt & POPT_EN_MCD_RAMCART) {
if (SRam.data == NULL)
}
SRam.start = SRam.end = 0; // unused
- pcd_event_schedule(0, PCD_EVENT_CDC, 12500000/75);
-
return 0;
}
{\r
// Warning: d might have upper bits set\r
switch (a) {\r
+ case 1:\r
+ if (!(d & 1))\r
+ pcd_soft_reset();\r
+ return;\r
case 2:\r
return; // only m68k can change WP\r
case 3: {\r
\r
// cd/cd_sys.c\r
int Insert_CD(const char *cdimg_name, int type);\r
-void Stop_CD(void); // releases all resources taken when CD game was started.\r
+int Stop_CD(void); // unloads CD, returns 1 if there was cd loaded\r
\r
// Cart.c\r
typedef enum\r
unsigned int pcd_cycles_m68k_to_s68k(unsigned int c);\r
int pcd_sync_s68k(unsigned int m68k_target, int m68k_poll_sync);\r
void pcd_run_cpus(int m68k_cycles);\r
+void pcd_soft_reset(void);\r
void pcd_state_loaded(void);\r
\r
// pico/pico.c\r
return 1;
}
break;
+ case MA_MAIN_CHANGE_CD:
+ if (PicoAHW & PAHW_MCD) {
+ if (!Stop_CD())
+ menu_loop_tray();
+ return 1;
+ }
+ break;
case MA_MAIN_CREDITS:
draw_menu_message(credits, NULL);
in_menu_wait(PBTN_MOK|PBTN_MBACK, NULL, 70);
mee_handler_id("Load State", MA_MAIN_LOAD_STATE, main_menu_handler),
mee_handler_id("Reset game", MA_MAIN_RESET_GAME, main_menu_handler),
mee_handler_id("Load new ROM/ISO", MA_MAIN_LOAD_ROM, main_menu_handler),
+ mee_handler_id("Change CD/ISO", MA_MAIN_CHANGE_CD, main_menu_handler),
mee_handler ("Change options", menu_loop_options),
mee_handler ("Configure controls", menu_loop_keyconfig),
mee_handler_id("Credits", MA_MAIN_CREDITS, main_menu_handler),
me_enable(e_menu_main, MA_MAIN_SAVE_STATE, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_LOAD_STATE, PicoGameLoaded);
me_enable(e_menu_main, MA_MAIN_RESET_GAME, PicoGameLoaded);
+ me_enable(e_menu_main, MA_MAIN_CHANGE_CD, PicoAHW & PAHW_MCD);
me_enable(e_menu_main, MA_MAIN_PATCHES, PicoPatches != NULL);
menu_enter(PicoGameLoaded);
MA_MAIN_LOAD_STATE,
MA_MAIN_RESET_GAME,
MA_MAIN_LOAD_ROM,
+ MA_MAIN_CHANGE_CD,
MA_MAIN_CONTROLS,
MA_MAIN_CREDITS,
MA_MAIN_PATCHES,