* Fixed iNesSave and iNesSaveAs (#579)
* Moved "Config->Game Genie" to "Config->Enable->Game Genie ROM"
This commit is contained in:
parent
b7584d0da2
commit
3d9095fc29
|
@ -1158,7 +1158,8 @@ BOOL CALLBACK PatcherCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
UpdatePatcher(hwndDlg);
|
UpdatePatcher(hwndDlg);
|
||||||
break;
|
break;
|
||||||
case IDC_ROMPATCHER_BTN_SAVE:
|
case IDC_ROMPATCHER_BTN_SAVE:
|
||||||
if(!iNesSave())MessageBox(NULL,"Error Saving","Error",MB_OK);
|
if (!iNesSave())
|
||||||
|
MessageBox(NULL, "Error Saving", "Error", MB_OK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -120,6 +120,7 @@ BEGIN
|
||||||
MENUITEM "&Frame Adv. - Skip Lag", MENU_DISPLAY_FA_LAGSKIP
|
MENUITEM "&Frame Adv. - Skip Lag", MENU_DISPLAY_FA_LAGSKIP
|
||||||
MENUITEM "Backup Savestates", ID_ENABLE_BACKUPSAVESTATES
|
MENUITEM "Backup Savestates", ID_ENABLE_BACKUPSAVESTATES
|
||||||
MENUITEM "Compress Savestates", ID_ENABLE_COMPRESSSAVESTATES
|
MENUITEM "Compress Savestates", ID_ENABLE_COMPRESSSAVESTATES
|
||||||
|
MENUITEM "&Game Genie ROM", MENU_GAME_GENIE
|
||||||
MENUITEM "Auto-resume old play session", ID_ENABLE_AUTORESUME
|
MENUITEM "Auto-resume old play session", ID_ENABLE_AUTORESUME
|
||||||
END
|
END
|
||||||
POPUP "&Display"
|
POPUP "&Display"
|
||||||
|
@ -143,14 +144,13 @@ BEGIN
|
||||||
MENUITEM "Graphics: &OBJ", MENU_DISPLAY_OBJ
|
MENUITEM "Graphics: &OBJ", MENU_DISPLAY_OBJ
|
||||||
END
|
END
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "&Game Genie", MENU_GAME_GENIE
|
|
||||||
MENUITEM "&PAL Emulation", MENU_PAL
|
MENUITEM "&PAL Emulation", MENU_PAL
|
||||||
MENUITEM SEPARATOR
|
|
||||||
POPUP "PPU"
|
POPUP "PPU"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "Old PPU", ID_OLDPPU
|
MENUITEM "Old PPU", ID_OLDPPU
|
||||||
MENUITEM "New PPU (slow!)", ID_NEWPPU
|
MENUITEM "New PPU (slow!)", ID_NEWPPU
|
||||||
END
|
END
|
||||||
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "&Directories...", MENU_DIRECTORIES
|
MENUITEM "&Directories...", MENU_DIRECTORIES
|
||||||
MENUITEM "&GUI...", MENU_GUI_OPTIONS
|
MENUITEM "&GUI...", MENU_GUI_OPTIONS
|
||||||
MENUITEM "&Input...", MENU_INPUT
|
MENUITEM "&Input...", MENU_INPUT
|
||||||
|
|
31
src/ines.cpp
31
src/ines.cpp
|
@ -890,25 +890,32 @@ int iNesSave() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fp = fopen(name, "wb");
|
fp = fopen(name, "wb");
|
||||||
|
if (!fp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (fwrite(&head, 1, 16, fp) != 16) {
|
if (fwrite(&head, 1, 16, fp) != 16)
|
||||||
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head.ROM_type & 4) { /* Trainer */
|
if (head.ROM_type & 4)
|
||||||
|
{
|
||||||
|
/* Trainer */
|
||||||
fwrite(trainerpoo, 512, 1, fp);
|
fwrite(trainerpoo, 512, 1, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(ROM, 0x4000, ROM_size, fp);
|
fwrite(ROM, 0x4000, ROM_size, fp);
|
||||||
|
|
||||||
if (head.VROM_size) fwrite(VROM, 0x2000, head.VROM_size, fp);
|
if (head.VROM_size)
|
||||||
fclose(fp);
|
fwrite(VROM, 0x2000, head.VROM_size, fp);
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int iNesSaveAs(char* name) {
|
int iNesSaveAs(char* name)
|
||||||
|
{
|
||||||
//adelikat: TODO: iNesSave() and this have pretty much the same code, outsource the common code to a single function
|
//adelikat: TODO: iNesSave() and this have pretty much the same code, outsource the common code to a single function
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
@ -916,21 +923,27 @@ int iNesSaveAs(char* name) {
|
||||||
if (GameInterface != iNESGI) return 0;
|
if (GameInterface != iNESGI) return 0;
|
||||||
|
|
||||||
fp = fopen(name, "wb");
|
fp = fopen(name, "wb");
|
||||||
|
if (!fp)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (fwrite(&head, 1, 16, fp) != 16) {
|
if (fwrite(&head, 1, 16, fp) != 16)
|
||||||
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head.ROM_type & 4) { /* Trainer */
|
if (head.ROM_type & 4)
|
||||||
|
{
|
||||||
|
/* Trainer */
|
||||||
fwrite(trainerpoo, 512, 1, fp);
|
fwrite(trainerpoo, 512, 1, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite(ROM, 0x4000, ROM_size, fp);
|
fwrite(ROM, 0x4000, ROM_size, fp);
|
||||||
|
|
||||||
if (head.VROM_size) fwrite(VROM, 0x2000, head.VROM_size, fp);
|
if (head.VROM_size)
|
||||||
fclose(fp);
|
fwrite(VROM, 0x2000, head.VROM_size, fp);
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue