New feature: iNES head editor

This commit is contained in:
owomomo 2019-05-30 01:13:59 +08:00
parent 959c94fcdf
commit 9369bed6ec
15 changed files with 1820 additions and 148 deletions

View File

@ -1,3 +1,6 @@
#ifndef CART_H
#define CART_H
typedef struct {
// Set by mapper/board code:
void (*Power)(void);
@ -100,3 +103,5 @@ void FCEU_GeniePower(void);
bool FCEU_OpenGenie(void);
void FCEU_CloseGenie(void);
void FCEU_KillGenie(void);
#endif

View File

@ -1196,10 +1196,7 @@ void DoGGConv()
ShowWindow(hGGConv, SW_SHOWNORMAL);
SetForegroundWindow(hGGConv);
} else
{
hGGConv = CreateDialog(fceu_hInstance,"GGCONV",NULL,GGConvCallB);
}
return;
}
inline void GetCheatStr(char* buf, int a, int v, int c)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
#ifndef HEADEREDITOR_H
#define HEADEREDITOR_H
extern HWND hHeadEditor;
struct iNES_HEADER;
HWND InitHeaderEditDialog(HWND hwnd, iNES_HEADER* header);
bool ShowINESFileBox(HWND parent, char* buf, bool save);
void ToggleINES20(HWND hwnd, bool ines20);
void ToggleExtendSystemList(HWND hwnd, bool enable);
void ToggleVSSystemGroup(HWND hwnd, bool enable);
void ToggleUnofficialPropertiesEnabled(HWND hwnd, bool ines20, bool check);
void ToggleUnofficialExtraRegionCode(HWND hwnd, bool ines20, bool unofficial_check, bool check);
void ToggleUnofficialPrgRamPresent(HWND hwnd, bool ines20, bool unofficial_check, bool check);
void SetHeaderData(HWND hwnd, iNES_HEADER* header);
bool WriteHeaderData(HWND hwnd, iNES_HEADER* header);
int GetComboBoxByteSize(HWND hwnd, UINT id, int* value);
bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exact = false);
bool SaveINESFile(HWND hwnd, char* path, iNES_HEADER* header);
LRESULT CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP);
void DoHeadEdit();
#endif

View File

@ -398,6 +398,9 @@ int BlockingCheck()
extern HWND logwin;
if(!handled && logwin && IsChild(logwin, msg.hwnd))
handled = IsDialogMessage(logwin, &msg);
extern HWND hHeadEditor;
if (!handled && hHeadEditor && IsChild(hHeadEditor, msg.hwnd))
handled = IsDialogMessage(hHeadEditor, &msg);
/* //adelikat - Currently no accel keys are used in the main window. Uncomment this block to activate them.
if(!handled)

View File

@ -316,7 +316,7 @@ static int GetFileData(uint32 offset){
}
static int WriteFileData(uint32 addr,int data){
if (addr < 16)MessageBox(hMemView,"Sorry", "Go bug bbit if you really want to edit the header.", MB_OK);
if (addr < 16) MessageBox(hMemView, "Use iNES Header Editor to edit the header.", "Sorry", MB_OK | MB_ICONASTERISK);
if((addr >= 16) && (addr < PRGsize[0]+16)) *(uint8 *)(GetNesPRGPointer(addr-16)) = data;
if((addr >= PRGsize[0]+16) && (addr < CHRsize[0]+PRGsize[0]+16)) *(uint8 *)(GetNesCHRPointer(addr-16-PRGsize[0])) = data;

View File

@ -13,6 +13,7 @@
/////////////////////////////////////////////////////////////////////////////
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1252)
@ -240,6 +241,7 @@ BEGIN
MENUITEM "&Trace Logger...", MENU_TRACELOGGER
MENUITEM "&Code/Data Logger...", MENU_CDLOGGER
MENUITEM "&Game Genie Decoder/Encoder...", MENU_GAMEGENIEDECODER
MENUITEM "&iNES Header Editor...", MENU_INESHEADEREDITOR
END
POPUP "&Help"
BEGIN
@ -850,7 +852,7 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTIO
CAPTION "GUI Configuration"
FONT 8, "Tahoma", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",BUTTON_CLOSE,65,136,56,14
DEFPUSHBUTTON "Close",BTN_CLOSE,65,136,56,14
CONTROL "Load ""File Open"" dialog when FCEUX starts.",CB_LOAD_FILE_OPEN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,8,168,12
CONTROL "Automatically hide menu on game load.",CB_AUTO_HIDE_MENU,
@ -1826,10 +1828,14 @@ BEGIN
CONTROL " Piano Roll",IDC_CHECK_PIANO_ROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,68,67,10
CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,83,67,10
GROUPBOX "Greenzone saving options",IDC_STATIC,13,98,97,72
CONTROL " all frames",IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES,"Button",BS_AUTORADIOBUTTON,23,109,77,10
CONTROL " every 16th frame",IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME,"Button",BS_AUTORADIOBUTTON,23,124,77,10
CONTROL " marked frames",IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES,"Button",BS_AUTORADIOBUTTON,23,139,77,10
CONTROL " don't save",IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE,"Button",BS_AUTORADIOBUTTON,23,154,77,10
CONTROL " all frames",IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES,
"Button",BS_AUTORADIOBUTTON,23,109,77,10
CONTROL " every 16th frame",IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME,
"Button",BS_AUTORADIOBUTTON,23,124,77,10
CONTROL " marked frames",IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES,
"Button",BS_AUTORADIOBUTTON,23,139,77,10
CONTROL " don't save",IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE,
"Button",BS_AUTORADIOBUTTON,23,154,77,10
END
ASSEMBLER DIALOGEX 0, 0, 202, 135
@ -2221,10 +2227,14 @@ BEGIN
CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,92,67,10
GROUPBOX "File contents",IDC_STATIC,105,4,111,177
GROUPBOX "Greenzone saving options",IDC_STATIC,112,106,97,69
CONTROL " all frames",IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES,"Button",BS_AUTORADIOBUTTON,122,117,77,10
CONTROL " every 16th frame", IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME,"Button",BS_AUTORADIOBUTTON,122,131,77,10
CONTROL " marked frames", IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES,"Button",BS_AUTORADIOBUTTON,122,145,77,10
CONTROL " don't save", IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE,"Button",BS_AUTORADIOBUTTON,122,159,77,10
CONTROL " all frames",IDC_RADIO_GREENZONE_SAVINGMODE_ALLFRAMES,
"Button",BS_AUTORADIOBUTTON,122,117,77,10
CONTROL " every 16th frame",IDC_RADIO_GREENZONE_SAVINGMODE_EVERY16FRAME,
"Button",BS_AUTORADIOBUTTON,122,131,77,10
CONTROL " marked frames",IDC_RADIO_GREENZONE_SAVINGMODE_MARKEDFRAMES,
"Button",BS_AUTORADIOBUTTON,122,145,77,10
CONTROL " don't save",IDC_RADIO_GREENZONE_SAVINGMODE_DONTSAVE,
"Button",BS_AUTORADIOBUTTON,122,159,77,10
CONTROL " Autosave project",IDC_AUTOSAVE_PROJECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,17,81,10
CONTROL " silently",IDC_SILENT_AUTOSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,47,42,10
LTEXT "every",IDC_AUTOSAVE_PERIOD_EVERY_TEXT,14,32,21,8
@ -2259,6 +2269,73 @@ BEGIN
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,311,214
END
IDD_EDIT_HEADER DIALOGEX 0, 0, 305, 257
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "iNES Header Editor"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "iNES Header",IDC_INESHEADER_GROUP,7,3,291,231,WS_DISABLED
GROUPBOX "Version",IDC_VERSION_GROUP,14,13,93,27,WS_DISABLED
CONTROL "Standard",IDC_RADIO_VERSION_STANDARD,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,20,25,41,10
CONTROL "iNES 2.0",IDC_RADIO_VERSION_INES20,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,64,25,40,10
GROUPBOX "Mapper",IDC_MAPPER_GROUP,112,13,179,27,WS_DISABLED
LTEXT "#:",IDC_MAPPER_TEXT,118,25,9,8,WS_DISABLED
COMBOBOX IDC_MAPPER_COMBO,130,22,112,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "Sub#:",IDC_SUBMAPPER_TEXT,246,25,21,8,WS_DISABLED
EDITTEXT IDC_SUBMAPPER_EDIT,268,21,15,14,ES_AUTOHSCROLL | WS_DISABLED
GROUPBOX "PRG",IDC_PRG_GROUP,14,42,277,27,WS_DISABLED
LTEXT "PRG ROM:",IDC_PRGROM_TEXT,20,53,34,8,WS_DISABLED
COMBOBOX IDC_PRGROM_COMBO,56,51,42,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PRG RAM:",IDC_PRGRAM_TEXT,111,53,34,8,WS_DISABLED
COMBOBOX IDC_PRGRAM_COMBO,146,51,42,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
CONTROL "Battery-backed NVRAM",IDC_CHECK_BATTERYNVRAM,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,197,53,86,10
LTEXT "PRG NVRAM:",IDC_PRGNVRAM_TEXT,197,53,42,8,WS_DISABLED
COMBOBOX IDC_PRGNVRAM_COMBO,242,51,42,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "CHR",IDC_CHR_GROUP,14,71,277,27,WS_DISABLED
LTEXT "CHR ROM:",IDC_CHRROM_TEXT,20,82,35,8,WS_DISABLED
COMBOBOX IDC_CHRROM_COMBO,56,80,42,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "CHR RAM:",IDC_CHRRAM_TEXT,111,82,34,8,WS_DISABLED
COMBOBOX IDC_CHRRAM_COMBO,146,80,42,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "CHR NVRAM:",IDC_CHRNVRAM_TEXT,197,82,43,8,WS_DISABLED
COMBOBOX IDC_CHRNVRAM_COMBO,242,80,42,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Mirroring",IDC_MIRRORING_GROUP,14,102,59,46,WS_DISABLED
CONTROL "Horizontal",IDC_RADIO_MIRR_HORIZONTAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,19,112,48,10
CONTROL "Vertical",IDC_RADIO_MIRR_VERTICAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,19,123,39,10
CONTROL "Four-screen",IDC_RADIO_MIRR_4SCREEN,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,19,134,51,10
CONTROL "Trainer",IDC_CHECK_TRAINER,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,14,152,55,10
GROUPBOX "Region",IDC_REGION_GROUP,78,102,40,58,WS_DISABLED
CONTROL "NTSC",IDC_RADIO_REGION_NTSC,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,83,112,29,10
CONTROL "PAL",IDC_RADIO_REGION_PAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,83,123,28,10
CONTROL "Dual",IDC_RADIO_REGION_DUAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,83,146,30,10
CONTROL "Dendy",IDC_RADIO_REGION_DENDY,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,83,134,33,10
GROUPBOX "System",IDC_SYSTEM_GROUP,123,102,168,109,WS_DISABLED
CONTROL "Normal",IDC_RADIO_SYSTEM_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,129,114,34,10
CONTROL "VS.",IDC_RADIO_SYSTEM_VS,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,166,114,21,10
CONTROL "Playchoice-10",IDC_RADIO_SYSTEM_PLAYCHOICE10,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,192,114,56,10
CONTROL "Extend",IDC_RADIO_SYSTEM_EXTEND,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,251,114,35,10
GROUPBOX "Extend System",IDC_EXTEND_SYSTEM_GROUP,127,176,160,29,WS_DISABLED
LTEXT "Console:",IDC_EXTEND_SYSTEM_TEXT,133,189,29,8,WS_DISABLED
COMBOBOX IDC_SYSTEM_EXTEND_COMBO,165,186,115,30,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "VS. System",IDC_VS_SYSTEM_GROUP,127,126,160,46,WS_DISABLED
LTEXT "Hardware:",IDC_VS_SYSTEM_TEXT,134,138,35,8,WS_DISABLED
COMBOBOX IDC_VS_SYSTEM_COMBO,172,136,108,30,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PPU:",IDC_VS_PPU_TEXT,134,155,16,8,WS_DISABLED
COMBOBOX IDC_VS_PPU_COMBO,154,154,126,30,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
CONTROL "iNES 1.0 Unofficial Properties",IDC_CHECK_UNOFFICIAL,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,14,164,103,10
GROUPBOX "iNES 1.0 Unofficial Properties",IDC_UNOFFICIAL_GROUP,13,176,104,35,WS_DISABLED
CONTROL "Dual region",IDC_CHECK_UNOFFICIAL_EXTRA_REGION,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,19,186,48,10
CONTROL "PRG RAM exists",IDC_CHECK_UNOFFICIAL_PRGRAM,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,70,188,43,17
CONTROL "Bus conflict",IDC_CHECK_UNOFFICIAL_BUS_CONFLICT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,19,198,49,10
LTEXT "Input device:",IDC_INPUT_DEVICE_TEXT,101,218,44,8,WS_DISABLED
COMBOBOX IDC_INPUT_DEVICE_COMBO,147,216,143,30,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "Misc. ROM(s)",IDC_MISCELLANEOUS_ROMS_TEXT,29,218,48,8,WS_DISABLED
EDITTEXT IDC_MISCELLANEOUS_ROMS_EDIT,14,215,12,14,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "Restore",IDC_RESTORE_BUTTON,7,236,44,14,WS_DISABLED
PUSHBUTTON "Save as...",IDSAVE,208,236,44,14,WS_DISABLED
DEFPUSHBUTTON "Close",IDCLOSE,254,236,44,14
END
/////////////////////////////////////////////////////////////////////////////
//
@ -2473,6 +2550,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 243
END
IDD_EDIT_HEADER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 298
TOPMARGIN, 7
BOTTOMMARGIN, 250
END
END
#endif // APSTUDIO_INVOKED
@ -2512,6 +2597,11 @@ BEGIN
0
END
IDD_EDIT_HEADER AFX_DIALOG_LAYOUT
BEGIN
0
END
/////////////////////////////////////////////////////////////////////////////
//
@ -2683,16 +2773,6 @@ IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp"
IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp"
IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp"
IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp"
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
@ -2717,7 +2797,7 @@ END
#endif // APSTUDIO_INVOKED
#endif // English (U.S) resources
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated file
// for res.rc
// Microsoft Visual C++ generated include file.
// Used by res.rc
//
#define CLOSE_BUTTON 1
#define BUTTON_CLOSE 1
@ -365,6 +365,7 @@
#define MENU_MV_VIEW_ROM 303
#define IDC_BTN_CHEAT_UPD 303
#define IDC_DEBUGGER_DISASSEMBLY_LEFT_PANEL 303
#define IDD_EDIT_HEADER 303
#define MENU_ENABLE_AUTOSAVE 304
#define IDC_LABEL_ROMUSED 304
#define IDC_BTN_CHEAT_RESET 304
@ -468,26 +469,86 @@
#define IDC_NTVIEW_SHOW_ATTRIBUTES 1009
#define IDC_NTVIEW_HIDE_PALETTES 1010
#define MW_ADDR03 1010
#define IDSAVE 1012
#define MW_ADDR04 1013
#define IDC_CHECK1 1013
#define IDC_RESTORE_BUTTON 1014
#define MW_ADDR05 1016
#define IDC_PRGROM_COMBO 1018
#define MW_ADDR06 1019
#define IDC_CHRROM_COMBO 1019
#define IDC_RADIO_MIRR_HORIZONTAL 1020
#define IDC_RADIO_MIRR_VERTICAL 1021
#define MW_ADDR07 1022
#define IDC_RADIO_MIRR_4SCREEN 1022
#define IDC_CHECK_TRAINER 1024
#define MW_ADDR08 1025
#define IDC_PRGRAM_COMBO 1025
#define IDC_MAPPER_COMBO 1026
#define IDC_SUBMAPPER_EDIT 1027
#define MW_ADDR09 1028
#define IDC_CHRRAM_COMBO 1028
#define IDC_PRGNVRAM_COMBO 1029
#define IDC_CHRNVRAM_COMBO 1030
#define MW_ADDR10 1031
#define IDC_RADIO_REGION_NTSC 1031
#define IDC_RADIO_REGION_PAL 1032
#define IDC_RADIO_REGION_DUAL 1033
#define MW_ADDR11 1034
#define IDC_INPUT_DEVICE_COMBO 1036
#define MW_ADDR12 1037
#define IDC_RADIO_REGION_DENDY 1037
#define IDC_RADIO_SYSTEM_NORMAL 1038
#define IDC_RADIO_SYSTEM_VS 1039
#define MW_ADDR13 1040
#define IDC_RADIO_SYSTEM_PLAYCHOICE10 1040
#define IDC_RADIO_SYSTEM_EXTEND 1041
#define MW_ADDR14 1043
#define IDC_SYSTEM_EXTEND_COMBO 1043
#define MW_ADDR15 1046
#define IDC_VS_SYSTEM_COMBO 1046
#define IDC_VS_PPU_COMBO 1047
#define MW_ADDR16 1049
#define IDC_MAPPER_TEXT 1049
#define IDC_SUBMAPPER_TEXT 1050
#define IDC_PRGROM_TEXT 1051
#define MW_ADDR17 1052
#define IDC_CHRROM_TEXT 1053
#define MW_ADDR18 1055
#define IDC_PRGRAM_TEXT 1055
#define IDC_CHRRAM_TEXT 1057
#define MW_ADDR19 1058
#define IDC_PRGNVRAM_TEXT 1059
#define IDC_CHRNVRAM_TEXT 1060
#define MW_ADDR20 1061
#define IDC_INESHEADER_GROUP 1063
#define MW_ADDR21 1064
#define IDC_MIRRORING_GROUP 1064
#define IDC_REGION_GROUP 1065
#define IDC_SYSTEM_GROUP 1066
#define MW_ADDR22 1067
#define IDC_VS_SYSTEM_GROUP 1067
#define IDC_VS_SYSTEM_TEXT 1068
#define IDC_VS_PPU_TEXT 1069
#define MW_ADDR23 1070
#define IDC_RADIO_VERSION_STANDARD 1071
#define IDC_RADIO_VERSION_INES20 1073
#define IDC_VERSION_GROUP 1074
#define IDC_MAPPER_GROUP 1075
#define IDC_CHECK_BATTERYNVRAM 1076
#define IDC_INPUT_DEVICE_TEXT 1077
#define IDC_PRG_GROUP 1078
#define IDC_CHR_GROUP 1079
#define IDC_UNOFFICIAL_GROUP 1081
#define IDC_CHECK_UNOFFICIAL_PRGRAM 1082
#define IDC_CHECK_UNOFFICIAL_EXTRA_REGION 1083
#define IDC_CHECK_UNOFFICIAL_BUS_CONFLICT 1084
#define IDC_CHECK_UNOFFICIAL 1085
#define IDC_MISCELLANEOUS_ROMS_TEXT 1086
#define IDC_MISCELLANEOUS_ROMS_EDIT 1087
#define IDC_EXTEND_SYSTEM_GROUP 1089
#define IDC_EXTEND_SYSTEM_TEXT 1090
#define IDC_BUTTON1 1094
#define BTN_ALLOW_LRUD 1117
#define BTN_PRESET_SET1 1119
#define BTN_PRESET_SET2 1120
@ -704,6 +765,7 @@
#define IDC_CHEAT_VAL_LABEL 1314
#define IDC_CHEAT_COM_LABEL 1315
#define IDC_CHEAT_LABEL_KNOWN 1316
#define MENU_INESHEADEREDITOR 40001
#define MENU_NETWORK 40040
#define MENU_PALETTE 40041
#define MENU_SOUND 40042
@ -997,9 +1059,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 303
#define _APS_NEXT_COMMAND_VALUE 40000
#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_RESOURCE_VALUE 305
#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1095
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -50,6 +50,7 @@
#include "memview.h"
#include "tracer.h"
#include "cdlogger.h"
#include "header_editor.h"
#include "throttle.h"
#include "monitor.h"
#include "keyboard.h"
@ -2312,7 +2313,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case MENU_GAMEGENIEDECODER:
DoGGConv();
break;
case MENU_INESHEADEREDITOR:
DoHeadEdit();
break;
//Help Menu--------------------------------------------------------------
case MENU_HELP:
OpenHelpWindow();

View File

@ -432,9 +432,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
strcat(fullname, "|");
strcat(fullname, fp->filename.c_str());
} else
{
strcpy(fullname, name);
}
// reset loaded game BEFORE it's loading.
ResetGameLoaded();
@ -469,103 +467,94 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
//try to load each different format
bool FCEUXLoad(const char *name, FCEUFILE * fp);
/*if(FCEUXLoad(name,fp))
goto endlseq;*/
if (iNESLoad(fullname, fp, OverwriteVidMode))
goto endlseq;
if (NSFLoad(fullname, fp))
goto endlseq;
if (UNIFLoad(fullname, fp))
goto endlseq;
if (FDSLoad(fullname, fp))
goto endlseq;
if (!silent)
FCEU_PrintError("An error occurred while loading the file.");
FCEU_fclose(fp);
delete GameInfo;
GameInfo = 0;
return 0;
endlseq:
FCEU_fclose(fp);
if (iNESLoad(fullname, fp, OverwriteVidMode) ||
NSFLoad(fullname, fp) ||
UNIFLoad(fullname, fp) ||
FDSLoad(fullname, fp))
{
#ifdef WIN32
// ################################## Start of SP CODE ###########################
extern char LoadedRomFName[2048];
extern int loadDebugDataFailed;
// ################################## Start of SP CODE ###########################
extern char LoadedRomFName[2048];
extern int loadDebugDataFailed;
if ((loadDebugDataFailed = loadPreferences(mass_replace(LoadedRomFName, "|", ".").c_str())))
if (!silent)
FCEU_printf("Couldn't load debugging data.\n");
if ((loadDebugDataFailed = loadPreferences(mass_replace(LoadedRomFName, "|", ".").c_str())))
if (!silent)
FCEU_printf("Couldn't load debugging data.\n");
// ################################## End of SP CODE ###########################
// ################################## End of SP CODE ###########################
#endif
if (OverwriteVidMode)
FCEU_ResetVidSys();
if (OverwriteVidMode)
FCEU_ResetVidSys();
if (GameInfo->type != GIT_NSF)
{
if (FSettings.GameGenie)
if (GameInfo->type != GIT_NSF &&
FSettings.GameGenie &&
FCEU_OpenGenie())
{
if (FCEU_OpenGenie())
{
FCEUI_SetGameGenie(false);
FCEUI_SetGameGenie(false);
#ifdef WIN32
genie = 0;
genie = 0;
#endif
}
}
}
PowerNES();
if (GameInfo->type != GIT_NSF)
FCEU_LoadGamePalette();
PowerNES();
FCEU_ResetPalette();
FCEU_ResetMessages(); // Save state, status messages, etc.
if (GameInfo->type != GIT_NSF)
FCEU_LoadGamePalette();
if (!lastpal && PAL) {
FCEU_DispMessage("PAL mode set", 0);
FCEUI_printf("PAL mode set");
} else if (!lastdendy && dendy) {
// this won't happen, since we don't autodetect dendy, but maybe someday we will?
FCEU_DispMessage("Dendy mode set", 0);
FCEUI_printf("Dendy mode set");
} else if ((lastpal || lastdendy) && !(PAL || dendy)) {
FCEU_DispMessage("NTSC mode set", 0);
FCEUI_printf("NTSC mode set");
}
FCEU_ResetPalette();
FCEU_ResetMessages(); // Save state, status messages, etc.
if (GameInfo->type != GIT_NSF)
FCEU_LoadGameCheats(0);
if (!lastpal && PAL) {
FCEU_DispMessage("PAL mode set", 0);
FCEUI_printf("PAL mode set");
}
else if (!lastdendy && dendy) {
// this won't happen, since we don't autodetect dendy, but maybe someday we will?
FCEU_DispMessage("Dendy mode set", 0);
FCEUI_printf("Dendy mode set");
}
else if ((lastpal || lastdendy) && !(PAL || dendy)) {
FCEU_DispMessage("NTSC mode set", 0);
FCEUI_printf("NTSC mode set");
}
if (AutoResumePlay)
{
// load "-resume" savestate
if (FCEUSS_Load(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str(), false))
FCEU_DispMessage("Old play session resumed.", 0);
}
if (GameInfo->type != GIT_NSF)
FCEU_LoadGameCheats(0);
ResetScreenshotsCounter();
if (AutoResumePlay)
{
// load "-resume" savestate
if (FCEUSS_Load(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str(), false))
FCEU_DispMessage("Old play session resumed.", 0);
}
ResetScreenshotsCounter();
#if defined (WIN32) || defined (WIN64)
DoDebuggerDataReload(); // Reloads data without reopening window
CDLoggerROMChanged();
if (hMemView) UpdateColorTable();
if (hCheat)
{
UpdateCheatsAdded();
UpdateCheatRelatedWindow();
}
if (FrozenAddressCount)
FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount);
DoDebuggerDataReload(); // Reloads data without reopening window
CDLoggerROMChanged();
if (hMemView) UpdateColorTable();
if (hCheat)
{
UpdateCheatsAdded();
UpdateCheatRelatedWindow();
}
if (FrozenAddressCount)
FCEU_DispMessage("%d cheats active", 0, FrozenAddressCount);
#endif
}
else {
if (!silent)
FCEU_PrintError("An error occurred while loading the file.");
delete GameInfo;
GameInfo = 0;
}
FCEU_fclose(fp);
return GameInfo;
}
@ -1377,7 +1366,7 @@ uint8 FCEU_ReadRomByte(uint32 i) {
void FCEU_WriteRomByte(uint32 i, uint8 value) {
if (i < 16)
#ifdef WIN32
MessageBox(hMemView,"Sorry", "You can't edit the ROM header.", MB_OK);
MessageBox(hMemView, "Sorry", "You can't edit the ROM header.", MB_OK);
#else
printf("Sorry, you can't edit the ROM header.\n");
#endif

View File

@ -261,9 +261,9 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
FILE *ipsfile=0;
FCEUFILE *fceufp=0;
bool read = (std::string)mode == "rb";
bool write = (std::string)mode == "wb";
if((read&&write) || (!read&&!write))
bool read = !strcmp(mode, "rb");
bool write = !strcmp(mode, "wb");
if(read && write || !read && !write)
{
FCEU_PrintError("invalid file open mode specified (only wb and rb are supported)");
return 0;

View File

@ -63,7 +63,7 @@ static int iNES_Init(int num);
static int MapperNo = 0;
static int iNES2 = 0;
int iNES2 = 0;
static DECLFR(TrainerRead) {
return(trainerpoo[A & 0x1FF]);
@ -443,13 +443,8 @@ static int not_power2[] =
{
53, 198, 228
};
typedef struct {
char *name;
int32 number;
void (*init)(CartInfo *);
} BMAPPINGLocal;
static BMAPPINGLocal bmap[] = {
BMAPPINGLocal bmap[] = {
{"NROM", 0, NROM_Init},
{"MMC1", 1, Mapper1_Init},
{"UNROM", 2, UNROM_Init},
@ -729,12 +724,9 @@ static BMAPPINGLocal bmap[] = {
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
struct md5_context md5;
if (FCEU_fread(&head, 1, 16, fp) != 16)
if (FCEU_fread(&head, 1, 16, fp) != 16 || memcmp(&head, "NES\x1A", 4))
return 0;
if (memcmp(&head, "NES\x1a", 4))
return 0;
head.cleanup();
memset(&iNESCart, 0, sizeof(iNESCart));

View File

@ -51,40 +51,40 @@ extern TMasterRomInfoParams MasterRomInfoParams;
//mbg merge 7/19/06 changed to c++ decl format
struct iNES_HEADER {
char ID[4]; /*NES^Z*/
uint8 ROM_size;
uint8 VROM_size;
uint8 ROM_type;
uint8 ROM_type2;
uint8 ROM_type3;
uint8 Upper_ROM_VROM_size;
uint8 RAM_size;
uint8 VRAM_size;
uint8 TV_system;
uint8 VS_hardware;
uint8 reserved[2];
char ID[4]; /*NES^Z*/ // 0-3
uint8 ROM_size; // 4
uint8 VROM_size; // 5
uint8 ROM_type; // 6
uint8 ROM_type2; // 7
uint8 ROM_type3; // 8
uint8 Upper_ROM_VROM_size; // 9
uint8 RAM_size; // 10
uint8 VRAM_size; // 11
uint8 TV_system; // 12
uint8 VS_hardware; // 13
uint8 reserved[2]; // 14, 15
void cleanup()
{
if(!memcmp((char *)(this)+0x7,"DiskDude",8))
{
memset((char *)(this)+0x7,0,0x9);
}
if(!memcmp((char*)(this) + 0x7, "DiskDude", 8) || !memcmp((char*)(this) + 0x7, "demiforce", 9))
memset((char*)(this) + 0x7, 0, 0x9);
if(!memcmp((char *)(this)+0x7,"demiforce",9))
if(!memcmp((char*)(this) + 0xA, "Ni03", 4))
{
memset((char *)(this)+0x7,0,0x9);
}
if(!memcmp((char *)(this)+0xA,"Ni03",4))
{
if(!memcmp((char *)(this)+0x7,"Dis",3))
memset((char *)(this)+0x7,0,0x9);
if(!memcmp((char*)(this) + 0x7, "Dis", 3))
memset((char*)(this) + 0x7, 0, 0x9);
else
memset((char *)(this)+0xA,0,0x6);
memset((char*)(this) + 0xA, 0, 0x6);
}
}
};
typedef struct {
char *name;
int32 number;
void(*init)(CartInfo *);
} BMAPPINGLocal;
extern struct iNES_HEADER head; //for mappers usage
void NSFVRC6_Init(void);

View File

@ -557,6 +557,7 @@
<ClCompile Include="..\src\drivers\win\directories.cpp" />
<ClCompile Include="..\src\drivers\win\gui.cpp" />
<ClCompile Include="..\src\drivers\win\guiconfig.cpp" />
<ClCompile Include="..\src\drivers\win\header_editor.cpp" />
<ClCompile Include="..\src\drivers\win\help.cpp" />
<ClCompile Include="..\src\drivers\win\input.cpp" />
<ClCompile Include="..\src\drivers\win\joystick.cpp" />
@ -1012,6 +1013,7 @@
<ClInclude Include="..\src\drivers\win\directories.h" />
<ClInclude Include="..\src\drivers\win\gui.h" />
<ClInclude Include="..\src\drivers\win\guiconfig.h" />
<ClInclude Include="..\src\drivers\win\header_editor.h" />
<ClInclude Include="..\src\drivers\win\help.h" />
<ClInclude Include="..\src\drivers\win\input.h" />
<ClInclude Include="..\src\drivers\win\joystick.h" />

View File

@ -1093,6 +1093,9 @@
<ClCompile Include="..\src\boards\hp10xx_hp20xx.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\drivers\win\header_editor.cpp">
<Filter>drivers\win</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\drivers\common\args.h">
@ -1599,6 +1602,9 @@
<ClInclude Include="..\src\input\fkb.h">
<Filter>input</Filter>
</ClInclude>
<ClInclude Include="..\src\drivers\win\header_editor.h">
<Filter>drivers\win</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\src\drivers\win\res.rc">