[Wii/Gamecube]

.fixed "Cartridge Hot-Swap" option being locked
.fixed L/R buttons being inverted in cheat menu
.fixed corrupted screen capture when saving Mega CD state files
.fixed RAM cartridge file saving
.added DSP halt/unhalt call when exiting/entering main menu
This commit is contained in:
EkeEke 2012-07-15 17:44:26 +02:00
parent 70e96409c3
commit e9d5f20992
4 changed files with 67 additions and 20 deletions

View File

@ -129,7 +129,24 @@ void slot_autoload(int slot, int device)
fp = fopen(CART_BRAM, "rb");
if (fp != NULL)
{
fread(scd.cartridge.area, scd.cartridge.mask + 1, 1, fp);
int filesize = scd.cartridge.mask + 1;
int done = 0;
/* Read into buffer (2k blocks) */
while (filesize > CHUNKSIZE)
{
fread(scd.cartridge.area + done, CHUNKSIZE, 1, fp);
done += CHUNKSIZE;
filesize -= CHUNKSIZE;
}
/* Read remaining bytes */
if (filesize)
{
fread(scd.cartridge.area + done, filesize, 1, fp);
}
/* close file */
fclose(fp);
/* update CRC */
@ -194,7 +211,24 @@ void slot_autosave(int slot, int device)
FILE *fp = fopen(CART_BRAM, "wb");
if (fp != NULL)
{
fwrite(scd.cartridge.area, scd.cartridge.mask + 1, 1, fp);
int filesize = scd.cartridge.mask + 1;
int done = 0;
/* Write to file (2k blocks) */
while (filesize > CHUNKSIZE)
{
fwrite(scd.cartridge.area + done, CHUNKSIZE, 1, fp);
done += CHUNKSIZE;
filesize -= CHUNKSIZE;
}
/* Write remaining bytes */
if (filesize)
{
fwrite(scd.cartridge.area + done, filesize, 1, fp);
}
/* Close file */
fclose(fp);
/* update CRC */
@ -622,6 +656,9 @@ int slot_save(int slot, int device)
fclose(fp);
free(buffer);
/* Close message box */
GUI_MsgBoxClose();
/* Save state screenshot */
if (slot > 0)
{
@ -768,8 +805,10 @@ int slot_save(int slot, int device)
CARD_Unmount(device);
free(out);
free(buffer);
}
GUI_MsgBoxClose();
/* Close message box */
GUI_MsgBoxClose();
}
return 1;
}

View File

@ -52,8 +52,8 @@
extern const u8 Key_Minus_wii_png[];
extern const u8 Key_Plus_wii_png[];
#else
extern const u8 Key_L_gcn_png[];
extern const u8 Key_R_gcn_png[];
extern const u8 Key_L_gcn_png[];
#endif
extern const u8 Key_DPAD_png[];
@ -784,19 +784,19 @@ static void cheatmenu_cb(void)
gui_image key_enable;
gui_image key_delete;
#ifdef HW_RVL
key_delete.texture = gxTextureOpenPNG(Key_Minus_wii_png,0);
key_enable.texture = gxTextureOpenPNG(Key_Plus_wii_png,0);
gxDrawTexture(key_delete.texture,152,424,24,24,255);
gxDrawTexture(key_enable.texture,372,424,24,24,255);
FONT_write("Delete\nCheat",16,184,436,640,(GXColor)WHITE);
FONT_write(cheatlist[offset + selection].enable ? "Disable\nCheat":"Enable\nCheat",16,404,436,640,(GXColor)WHITE);
key_delete.texture = gxTextureOpenPNG(Key_Minus_wii_png,0);
gxDrawTexture(key_enable.texture,152,424,24,24,255);
gxDrawTexture(key_delete.texture,372,424,24,24,255);
FONT_write(cheatlist[offset + selection].enable ? "Disable\nCheat":"Enable\nCheat",16,184,436,640,(GXColor)WHITE);
FONT_write("Delete\nCheat",16,404,436,640,(GXColor)WHITE);
#else
key_delete.texture = gxTextureOpenPNG(Key_L_gcn_png,0);
key_enable.texture = gxTextureOpenPNG(Key_R_gcn_png,0);
gxDrawTexture(key_delete.texture,136,426,44,20,255);
gxDrawTexture(key_enable.texture,368,426,44,20,255);
FONT_write("Delete\nCheat",16,188,436,640,(GXColor)WHITE);
FONT_write(cheatlist[offset + selection].enable ? "Disable\nCheat":"Enable\nCheat",16,420,436,640,(GXColor)WHITE);
key_enable.texture = gxTextureOpenPNG(Key_L_gcn_png,0);
key_delete.texture = gxTextureOpenPNG(Key_R_gcn_png,0);
gxDrawTexture(key_enable.texture,136,426,44,20,255);
gxDrawTexture(key_delete.texture,368,426,44,20,255);
FONT_write(cheatlist[offset + selection].enable ? "Disable\nCheat":"Enable\nCheat",16,188,436,640,(GXColor)WHITE);
FONT_write("Delete\nCheat",16,420,436,640,(GXColor)WHITE);
#endif
gxTextureClose(&key_enable.texture);
gxTextureClose(&key_delete.texture);
@ -1191,7 +1191,7 @@ void CheatMenu(void)
if ((offset + selection) < maxcheats)
{
/* Special inputs */
if (m_input.keys & PAD_TRIGGER_L)
if (m_input.keys & PAD_TRIGGER_R)
{
/* sort cheat list */
for (i = offset + selection + 1; i < maxcheats; i++)
@ -1223,7 +1223,7 @@ void CheatMenu(void)
/* reset scrolling */
string_offset = 0;
}
else if (m_input.keys & PAD_TRIGGER_R)
else if (m_input.keys & PAD_TRIGGER_L)
{
/* cheat ON/OFF */
cheatlist[offset + selection].enable ^= 1;

View File

@ -1145,7 +1145,7 @@ static void systemmenu ()
else
sprintf (items[7].text, "Lock-On: OFF");
sprintf (items[8].text, "Cartridge Swap: %s", config.hot_swap ? "ON":"OFF");
sprintf (items[8].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
if (svp)
{
@ -1389,7 +1389,7 @@ static void systemmenu ()
case 8: /*** Cartridge Hot Swap ***/
{
config.hot_swap ^= 1;
sprintf (items[8].text, "Cartridge Swap: %s", config.hot_swap ? "ON":"OFF");
sprintf (items[8].text, "Cartridge Swap: %s", (config.hot_swap & 1) ? "ON":"OFF");
break;
}
@ -1421,6 +1421,12 @@ static void systemmenu ()
{
system_init();
system_reset();
/* restore SRAM */
if (config.s_auto & 1)
{
slot_autoload(0,config.s_device);
}
}
else
{

View File

@ -182,6 +182,7 @@ void gx_audio_Start(void)
ASND_End();
AUDIO_StopDMA();
AUDIO_RegisterDMACallback(NULL);
DSP_Halt();
/* when VSYNC is forced OFF or AUTO with TV mode not matching emulated video mode, emulation is synchronized with Audio Hardware */
if (!config.vsync || (config.tv_mode == !vdp_pal))
@ -206,6 +207,7 @@ void gx_audio_Start(void)
void gx_audio_Stop(void)
{
/* restart menu audio processing */
DSP_Unhalt();
ASND_Init();
ASND_Pause(0);