Header editor (#294)

* 1. Fix a bug that VS System, Extend System and Input Device Combobox don't change any value of the header.
2. Add hex preview to iNES Header Editor.

* Detail bug fix.
This commit is contained in:
owomomo 2021-01-01 22:44:49 +08:00 committed by GitHub
parent 5f1263aef3
commit 65c5b0d2a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 560 additions and 295 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ extern HWND hHeadEditor;
void DoHeadEdit();
HWND InitHeaderEditDialog(HWND hwnd, iNES_HEADER* header);
bool ShowINESFileBox(HWND parent, char* buf = NULL, bool save = false);
bool ShowINESFileBox(HWND parent, char* buf = NULL, iNES_HEADER* header = NULL);
void ToggleINES20(HWND hwnd, bool ines20);
void ToggleExtendSystemList(HWND hwnd, bool enable);
void ToggleVSSystemGroup(HWND hwnd, bool enable);
@ -16,13 +16,12 @@ void ToggleUnofficialExtraRegionCode(HWND hwnd, bool ines20, bool unofficial_che
void ToggleUnofficialPrgRamPresent(HWND hwnd, bool ines20, bool unofficial_check, bool check);
void SetHeaderData(HWND hwnd, iNES_HEADER* header);
bool LoadHeader(HWND parent, iNES_HEADER* header);
bool WriteHeaderData(HWND hwnd, iNES_HEADER* header);
int GetComboBoxByteSize(HWND hwnd, UINT id, int* value);
bool SearchByString(HWND hwnd, UINT id, int* value, char* buf);
bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exact = false);
bool WriteHeaderData(HWND hwnd, iNES_HEADER* header = NULL);
int GetComboBoxByteSize(HWND hwnd, UINT id, int* value, iNES_HEADER* header);
bool SearchByString(HWND hwnd, UINT id, int* value, char* buf, iNES_HEADER* header = NULL);
bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, iNES_HEADER* header = NULL);
bool SaveINESFile(HWND hwnd, char* path, iNES_HEADER* header);
INT_PTR CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP);
extern WNDPROC DefaultEditCtrlProc;
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP);

View File

@ -1733,71 +1733,75 @@ BEGIN
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,311,214
END
IDD_EDIT_HEADER DIALOGEX 0, 0, 321, 258
IDD_EDIT_HEADER DIALOGEX 0, 0, 331, 281
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,6,3,309,231,WS_DISABLED
GROUPBOX "Version",IDC_VERSION_GROUP,14,13,79,27,WS_DISABLED
CONTROL "iNES",IDC_RADIO_VERSION_STANDARD,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,20,24,27,10
CONTROL "NES 2.0",IDC_RADIO_VERSION_INES20,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,51,24,38,10
GROUPBOX "Mapper",IDC_MAPPER_GROUP,98,13,210,27,WS_DISABLED
LTEXT "Mapper#:",IDC_MAPPER_TEXT,104,24,33,8,WS_DISABLED
COMBOBOX IDC_MAPPER_COMBO,139,22,115,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "Sub#:",IDC_SUBMAPPER_TEXT,261,24,21,8,WS_DISABLED
EDITTEXT IDC_SUBMAPPER_EDIT,284,21,15,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
GROUPBOX "PRG",IDC_PRG_GROUP,14,42,294,27,WS_DISABLED
LTEXT "PRG ROM:",IDC_PRGROM_TEXT,20,53,34,8,WS_DISABLED
COMBOBOX IDC_PRGROM_COMBO,57,51,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PRG RAM:",IDC_PRGRAM_TEXT,115,53,34,8,WS_DISABLED
COMBOBOX IDC_PRGRAM_COMBO,151,51,46,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,211,53,86,10
LTEXT "PRG NVRAM:",IDC_PRGNVRAM_TEXT,208,53,42,8,WS_DISABLED
COMBOBOX IDC_PRGNVRAM_COMBO,253,51,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "CHR",IDC_CHR_GROUP,14,71,294,27,WS_DISABLED
LTEXT "CHR ROM:",IDC_CHRROM_TEXT,20,82,35,8,WS_DISABLED
COMBOBOX IDC_CHRROM_COMBO,57,80,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "CHR RAM:",IDC_CHRRAM_TEXT,115,82,34,8,WS_DISABLED
COMBOBOX IDC_CHRRAM_COMBO,151,80,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "CHR NVRAM:",IDC_CHRNVRAM_TEXT,207,82,43,8,WS_DISABLED
COMBOBOX IDC_CHRNVRAM_COMBO,253,80,46,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,184,109,WS_DISABLED
CONTROL "Normal",IDC_RADIO_SYSTEM_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,129,114,34,10
CONTROL "VS. Sys",IDC_RADIO_SYSTEM_VS,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,167,114,37,10
CONTROL "Playchoice-10",IDC_RADIO_SYSTEM_PLAYCHOICE10,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,208,114,56,10
CONTROL "Extend",IDC_RADIO_SYSTEM_EXTEND,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,268,114,35,10
GROUPBOX "Extend System",IDC_EXTEND_SYSTEM_GROUP,130,176,171,29,WS_DISABLED
LTEXT "Console:",IDC_EXTEND_SYSTEM_TEXT,136,189,29,8,WS_DISABLED
COMBOBOX IDC_SYSTEM_EXTEND_COMBO,168,186,127,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "VS. System",IDC_VS_SYSTEM_GROUP,130,126,171,46,WS_DISABLED
LTEXT "Hardware:",IDC_VS_SYSTEM_TEXT,136,138,35,8,WS_DISABLED
COMBOBOX IDC_VS_SYSTEM_COMBO,174,136,121,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PPU:",IDC_VS_PPU_TEXT,136,155,16,8,WS_DISABLED
COMBOBOX IDC_VS_PPU_COMBO,155,154,140,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "NES ROM:",IDC_STATIC,7,9,35,8
EDITTEXT IDC_ROM_FILE_EDIT,47,6,231,14,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Restore",IDC_RESTORE_BUTTON,282,6,42,14,WS_DISABLED
GROUPBOX "iNES Header",IDC_INESHEADER_GROUP,7,22,317,232,WS_DISABLED
GROUPBOX "Version",IDC_VERSION_GROUP,14,32,79,27,WS_DISABLED
CONTROL "iNES",IDC_RADIO_VERSION_STANDARD,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,20,43,27,10
CONTROL "NES 2.0",IDC_RADIO_VERSION_INES20,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,51,43,38,10
GROUPBOX "Mapper",IDC_MAPPER_GROUP,98,32,217,27,WS_DISABLED
LTEXT "Mapper#:",IDC_MAPPER_TEXT,104,43,33,8,WS_DISABLED
COMBOBOX IDC_MAPPER_COMBO,142,41,115,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "Sub#:",IDC_SUBMAPPER_TEXT,264,43,24,8,WS_DISABLED
EDITTEXT IDC_SUBMAPPER_EDIT,291,40,15,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
GROUPBOX "PRG",IDC_PRG_GROUP,14,61,301,27,WS_DISABLED
LTEXT "PRG ROM:",IDC_PRGROM_TEXT,20,72,34,8,WS_DISABLED
COMBOBOX IDC_PRGROM_COMBO,57,70,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PRG RAM:",IDC_PRGRAM_TEXT,118,72,34,8,WS_DISABLED
COMBOBOX IDC_PRGRAM_COMBO,154,70,46,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,215,71,86,10
LTEXT "PRG NVRAM:",IDC_PRGNVRAM_TEXT,215,72,42,8,WS_DISABLED
COMBOBOX IDC_PRGNVRAM_COMBO,261,70,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "CHR",IDC_CHR_GROUP,14,90,301,27,WS_DISABLED
LTEXT "CHR ROM:",IDC_CHRROM_TEXT,20,101,35,8,WS_DISABLED
COMBOBOX IDC_CHRROM_COMBO,57,99,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "CHR RAM:",IDC_CHRRAM_TEXT,118,101,34,8,WS_DISABLED
COMBOBOX IDC_CHRRAM_COMBO,154,99,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "CHR NVRAM:",IDC_CHRNVRAM_TEXT,214,101,43,8,WS_DISABLED
COMBOBOX IDC_CHRNVRAM_COMBO,261,99,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Mirroring",IDC_MIRRORING_GROUP,14,121,59,46,WS_DISABLED
CONTROL "Horizontal",IDC_RADIO_MIRR_HORIZONTAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,18,131,48,10
CONTROL "Vertical",IDC_RADIO_MIRR_VERTICAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,18,142,39,10
CONTROL "Four-screen",IDC_RADIO_MIRR_4SCREEN,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,18,153,53,10
GROUPBOX "Region",IDC_REGION_GROUP,80,121,40,58,WS_DISABLED
CONTROL "NTSC",IDC_RADIO_REGION_NTSC,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,85,131,32,10
CONTROL "PAL",IDC_RADIO_REGION_PAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,85,142,28,10
CONTROL "Dendy",IDC_RADIO_REGION_DENDY,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,85,153,33,10
CONTROL "Dual",IDC_RADIO_REGION_DUAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,85,165,30,10
CONTROL "Trainer",IDC_CHECK_TRAINER,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,14,171,55,10
GROUPBOX "System",IDC_SYSTEM_GROUP,127,121,188,109,WS_DISABLED
CONTROL "Normal",IDC_RADIO_SYSTEM_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,133,133,36,10
CONTROL "VS. Sys",IDC_RADIO_SYSTEM_VS,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,173,133,37,10
CONTROL "Playchoice-10",IDC_RADIO_SYSTEM_PLAYCHOICE10,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,214,133,56,10
CONTROL "Extend",IDC_RADIO_SYSTEM_EXTEND,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,274,133,35,10
GROUPBOX "VS. System",IDC_VS_SYSTEM_GROUP,135,145,172,46,WS_DISABLED
LTEXT "Hardware:",IDC_VS_SYSTEM_TEXT,141,157,35,8,WS_DISABLED
COMBOBOX IDC_VS_SYSTEM_COMBO,179,155,121,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PPU:",IDC_VS_PPU_TEXT,141,174,16,8,WS_DISABLED
COMBOBOX IDC_VS_PPU_COMBO,160,173,140,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Extend System",IDC_EXTEND_SYSTEM_GROUP,135,195,172,29,WS_DISABLED
LTEXT "Console:",IDC_EXTEND_SYSTEM_TEXT,141,208,29,8,WS_DISABLED
COMBOBOX IDC_SYSTEM_EXTEND_COMBO,173,206,127,30,CBS_DROPDOWN | 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,105,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,106,218,44,8,WS_DISABLED
COMBOBOX IDC_INPUT_DEVICE_COMBO,153,216,154,30,CBS_DROPDOWN | 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 | ES_NUMBER | WS_DISABLED
PUSHBUTTON "Restore",IDC_RESTORE_BUTTON,6,237,44,14,WS_DISABLED
PUSHBUTTON "Save as...",IDSAVE,223,237,44,14,WS_DISABLED
DEFPUSHBUTTON "Close",IDCLOSE,271,237,44,14
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,14,183,110,10
GROUPBOX "iNES 1.0 Unofficial Properties",IDC_UNOFFICIAL_GROUP,14,195,106,35,WS_DISABLED
CONTROL "Dual region",IDC_CHECK_UNOFFICIAL_EXTRA_REGION,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,19,205,50,10
CONTROL "PRG RAM exists",IDC_CHECK_UNOFFICIAL_PRGRAM,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,73,207,45,17
CONTROL "Bus conflict",IDC_CHECK_UNOFFICIAL_BUS_CONFLICT,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,19,217,53,10
LTEXT "Input device:",IDC_INPUT_DEVICE_TEXT,114,237,44,8,WS_DISABLED
COMBOBOX IDC_INPUT_DEVICE_COMBO,161,235,154,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "Misc. ROM(s)",IDC_MISCELLANEOUS_ROMS_TEXT,29,237,48,8,WS_DISABLED
EDITTEXT IDC_MISCELLANEOUS_ROMS_EDIT,14,234,12,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
LTEXT "Hex:",IDC_STATIC,9,262,16,8
EDITTEXT IDC_HEX_HEADER_EDIT,29,260,203,14,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Save as...",IDSAVE,237,260,42,14,WS_DISABLED
DEFPUSHBUTTON "Close",IDCLOSE,282,260,42,14
END
@ -2099,9 +2103,9 @@ BEGIN
IDD_EDIT_HEADER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 314
TOPMARGIN, 7
BOTTOMMARGIN, 251
RIGHTMARGIN, 324
TOPMARGIN, 6
BOTTOMMARGIN, 274
END
END
#endif // APSTUDIO_INVOKED

View File

@ -571,7 +571,10 @@
#define IDC_RADIO_REGION_DUAL 1033
#define MW_NAME11 1033
#define MW_ADDR11 1034
#define IDC_ROM_FILE_EDIT 1034
#define MW_VAL11 1035
#define IDC_EDIT2 1035
#define IDC_HEX_HEADER_EDIT 1035
#define IDC_INPUT_DEVICE_COMBO 1036
#define MW_NAME12 1036
#define MW_ADDR12 1037
@ -585,6 +588,7 @@
#define IDC_RADIO_SYSTEM_EXTEND 1041
#define MW_VAL13 1041
#define MW_NAME14 1042
#define IDC_COMBO1 1042
#define MW_ADDR14 1043
#define IDC_SYSTEM_EXTEND_COMBO 1043
#define MW_VAL14 1044
@ -1207,7 +1211,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 312
#define _APS_NEXT_COMMAND_VALUE 40009
#define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_CONTROL_VALUE 1043
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif