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

View File

@ -117,6 +117,8 @@ char* inputDevList[] = {
0 0
}; };
static HFONT hFont, hNewFont;
char** dropDownList[] = { char** dropDownList[] = {
vsSysList, vsPPUList, extConsoleList, inputDevList, 0 vsSysList, vsPPUList, extConsoleList, inputDevList, 0
}; };
@ -316,7 +318,7 @@ HWND InitHeaderEditDialog(HWND hwnd, iNES_HEADER* header)
for (int j = 0; dropDownList[i][j]; ++j) for (int j = 0; dropDownList[i][j]; ++j)
{ {
sprintf(buf, dropDownList[i] == inputDevList ? "$%02X %s" : "$%X %s", j, dropDownList[i][j]); sprintf(buf, dropDownList[i] == inputDevList ? "$%02X %s" : "$%X %s", j, dropDownList[i][j]);
SendDlgItemMessage(hwnd, IDC_MAPPER_COMBO, CB_SETITEMDATA, SendDlgItemMessage(hwnd, dropDownIdList[i], CB_ADDSTRING, 0, (LPARAM)buf), j); SendDlgItemMessage(hwnd, dropDownIdList[i], CB_SETITEMDATA, SendDlgItemMessage(hwnd, dropDownIdList[i], CB_ADDSTRING, 0, (LPARAM)buf), j);
} }
// Mapper# // Mapper#
@ -514,41 +516,88 @@ INT_PTR CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP)
if (GameInfo) if (GameInfo)
CalcSubWindowPos(hDlg, NULL); CalcSubWindowPos(hDlg, NULL);
SetDlgItemText(hDlg, IDC_ROM_FILE_EDIT, LoadedRomFName);
char textHeader[16 * 3];
sprintf(textHeader, "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", header->ID[0], header->ID[1], header->ID[2], header->ID[3], header->ROM_size, header->VROM_size, header->ROM_size, header->ROM_type2, header->ROM_type3, header->Upper_ROM_VROM_size, header->RAM_size, header->VRAM_size, header->TV_system, header->VS_hardware, header->reserved[0], header->reserved[1]);
SetDlgItemText(hDlg, IDC_HEX_HEADER_EDIT, textHeader);
hFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0);
LOGFONT lf;
GetObject(hFont, sizeof(LOGFONT), &lf);
strcpy(lf.lfFaceName, "Courier New");
hNewFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hDlg, IDC_HEX_HEADER_EDIT, WM_SETFONT, (WPARAM)hNewFont, FALSE);
} }
break; break;
case WM_COMMAND: case WM_COMMAND:
switch (HIWORD(wP)) switch (HIWORD(wP))
{ {
case EN_UPDATE:
switch (LOWORD(wP))
{
case IDC_SUBMAPPER_EDIT:
case IDC_MISCELLANEOUS_ROMS_EDIT:
WriteHeaderData(hDlg);
}
break;
case CBN_EDITUPDATE:
case CBN_SELCHANGE:
switch (LOWORD(wP))
{
case IDC_MAPPER_COMBO:
case IDC_PRGROM_COMBO:
case IDC_PRGRAM_COMBO:
case IDC_PRGNVRAM_COMBO:
case IDC_CHRROM_COMBO:
case IDC_CHRRAM_COMBO:
case IDC_CHRNVRAM_COMBO:
case IDC_VS_SYSTEM_COMBO:
case IDC_VS_PPU_COMBO:
case IDC_SYSTEM_EXTEND_COMBO:
case IDC_INPUT_DEVICE_COMBO:
WriteHeaderData(hDlg);
}
break;
case BN_CLICKED: case BN_CLICKED:
{ {
int id = LOWORD(wP); switch (LOWORD(wP))
switch (id)
{ {
case IDC_RADIO_VERSION_STANDARD: case IDC_RADIO_VERSION_STANDARD:
ToggleINES20(hDlg, false); ToggleINES20(hDlg, false);
WriteHeaderData(hDlg);
break; break;
case IDC_RADIO_VERSION_INES20: case IDC_RADIO_VERSION_INES20:
ToggleINES20(hDlg, true); ToggleINES20(hDlg, true);
WriteHeaderData(hDlg);
break; break;
case IDC_RADIO_SYSTEM_NORMAL: case IDC_RADIO_SYSTEM_NORMAL:
case IDC_RADIO_SYSTEM_PLAYCHOICE10: case IDC_RADIO_SYSTEM_PLAYCHOICE10:
case IDC_RADIO_SYSTEM_EXTEND: case IDC_RADIO_SYSTEM_EXTEND:
ToggleExtendSystemList(hDlg, IsDlgButtonChecked(hDlg, IDC_RADIO_SYSTEM_EXTEND) == BST_CHECKED); ToggleExtendSystemList(hDlg, IsDlgButtonChecked(hDlg, IDC_RADIO_SYSTEM_EXTEND) == BST_CHECKED);
WriteHeaderData(hDlg);
case IDC_RADIO_SYSTEM_VS: case IDC_RADIO_SYSTEM_VS:
// Both ines 1.0 and 2.0 can trigger VS System, but only 2.0 enables the extra detailed properties // Both ines 1.0 and 2.0 can trigger VS System, but only 2.0 enables the extra detailed properties
ToggleVSSystemGroup(hDlg, IsDlgButtonChecked(hDlg, IDC_RADIO_VERSION_INES20) == BST_CHECKED && IsDlgButtonChecked(hDlg, IDC_RADIO_SYSTEM_VS) == BST_CHECKED); ToggleVSSystemGroup(hDlg, IsDlgButtonChecked(hDlg, IDC_RADIO_VERSION_INES20) == BST_CHECKED && IsDlgButtonChecked(hDlg, IDC_RADIO_SYSTEM_VS) == BST_CHECKED);
WriteHeaderData(hDlg);
break; break;
case IDC_CHECK_UNOFFICIAL: case IDC_CHECK_UNOFFICIAL:
ToggleUnofficialPropertiesEnabled(hDlg, false, IsDlgButtonChecked(hDlg, IDC_CHECK_UNOFFICIAL) == BST_CHECKED); ToggleUnofficialPropertiesEnabled(hDlg, false, IsDlgButtonChecked(hDlg, IDC_CHECK_UNOFFICIAL) == BST_CHECKED);
WriteHeaderData(hDlg);
break; break;
case IDC_CHECK_UNOFFICIAL_PRGRAM: case IDC_CHECK_UNOFFICIAL_PRGRAM:
ToggleUnofficialPrgRamPresent(hDlg, false, true, IsDlgButtonChecked(hDlg, IDC_CHECK_UNOFFICIAL_PRGRAM) == BST_CHECKED); ToggleUnofficialPrgRamPresent(hDlg, false, true, IsDlgButtonChecked(hDlg, IDC_CHECK_UNOFFICIAL_PRGRAM) == BST_CHECKED);
WriteHeaderData(hDlg);
break; break;
case IDC_CHECK_UNOFFICIAL_EXTRA_REGION: case IDC_CHECK_UNOFFICIAL_EXTRA_REGION:
ToggleUnofficialExtraRegionCode(hDlg, false, true, IsDlgButtonChecked(hDlg, IDC_CHECK_UNOFFICIAL_EXTRA_REGION) == BST_CHECKED); ToggleUnofficialExtraRegionCode(hDlg, false, true, IsDlgButtonChecked(hDlg, IDC_CHECK_UNOFFICIAL_EXTRA_REGION) == BST_CHECKED);
WriteHeaderData(hDlg);
break; break;
case IDC_RESTORE_BUTTON: case IDC_RESTORE_BUTTON:
SetHeaderData(hDlg, header); SetHeaderData(hDlg, header);
char textHeader[16 * 3];
sprintf(textHeader, "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", header->ID[0], header->ID[1], header->ID[2], header->ID[3], header->ROM_size, header->VROM_size, header->ROM_size, header->ROM_type2, header->ROM_type3, header->Upper_ROM_VROM_size, header->RAM_size, header->VRAM_size, header->TV_system, header->VS_hardware, header->reserved[0], header->reserved[1]);
SetDlgItemText(hDlg, IDC_HEX_HEADER_EDIT, textHeader);
break; break;
case IDSAVE: case IDSAVE:
{ {
@ -556,11 +605,23 @@ INT_PTR CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP)
if (WriteHeaderData(hDlg, &newHeader)) if (WriteHeaderData(hDlg, &newHeader))
{ {
char path[4096] = { 0 }; char path[4096] = { 0 };
if (ShowINESFileBox(hDlg, path, true)) if (ShowINESFileBox(hDlg, path, &newHeader))
SaveINESFile(hDlg, path, &newHeader); SaveINESFile(hDlg, path, &newHeader);
} }
} }
break; break;
case IDC_CHECK_BATTERYNVRAM:
case IDC_RADIO_MIRR_HORIZONTAL:
case IDC_RADIO_MIRR_VERTICAL:
case IDC_RADIO_MIRR_4SCREEN:
case IDC_RADIO_REGION_NTSC:
case IDC_RADIO_REGION_PAL:
case IDC_RADIO_REGION_DENDY:
case IDC_RADIO_REGION_DUAL:
case IDC_CHECK_TRAINER:
case IDC_CHECK_UNOFFICIAL_BUS_CONFLICT:
WriteHeaderData(hDlg);
break;
case IDCLOSE: case IDCLOSE:
goto wm_close; goto wm_close;
} }
@ -577,6 +638,10 @@ INT_PTR CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP)
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
LoadedRomFName[0] = 0; LoadedRomFName[0] = 0;
} }
DeleteObject(hFont);
DeleteObject(hNewFont);
hFont = NULL;
hNewFont = NULL;
break; break;
case WM_DESTROY: case WM_DESTROY:
hHeadEditor = NULL; hHeadEditor = NULL;
@ -884,10 +949,15 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
// Mapper // Mapper
int mapper; int mapper;
if (!GetComboBoxListItemData(hwnd, IDC_MAPPER_COMBO, &mapper, buf)) if (!GetComboBoxListItemData(hwnd, IDC_MAPPER_COMBO, &mapper, buf, header))
{ {
if (header) {
MessageBox(hwnd, "The mapper# you have entered is invalid. Please enter a decimal number or select an item from the dropdown list.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "The mapper# you have entered is invalid. Please enter a decimal number or select an item from the dropdown list.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO));
SendDlgItemMessage(hwnd, IDC_MAPPER_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
@ -901,17 +971,29 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
_header.ROM_type3 |= mapper >> 8; _header.ROM_type3 |= mapper >> 8;
else else
{ {
if (header) {
sprintf(buf, "Mapper# should be less than %d in iNES %d.0 format.", 256, 1); sprintf(buf, "Mapper# should be less than %d in iNES %d.0 format.", 256, 1);
MessageBox(hwnd, buf, "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, buf, "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO));
SendDlgItemMessage(hwnd, IDC_MAPPER_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
} }
else { else {
if (header) {
sprintf(buf, "Mapper# should be less than %d in iNES %d.0 format.", 4096, 2); sprintf(buf, "Mapper# should be less than %d in iNES %d.0 format.", 4096, 2);
MessageBox(hwnd, buf, "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, buf, "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO));
SendDlgItemMessage(hwnd, IDC_MAPPER_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
@ -925,22 +1007,34 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
_header.ROM_type3 |= submapper << 4; _header.ROM_type3 |= submapper << 4;
else else
{ {
if (header) {
MessageBox(hwnd, "The sub mapper# should less than 16 in iNES 2.0 format.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "The sub mapper# should less than 16 in iNES 2.0 format.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_SUBMAPPER_EDIT)); SetFocus(GetDlgItem(hwnd, IDC_SUBMAPPER_EDIT));
SendDlgItemMessage(hwnd, IDC_SUBMAPPER_EDIT, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
else else
{ {
if (header) {
MessageBox(hwnd, "The sub mapper# you have entered is invalid. Please enter a decimal number.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "The sub mapper# you have entered is invalid. Please enter a decimal number.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_SUBMAPPER_EDIT)); SetFocus(GetDlgItem(hwnd, IDC_SUBMAPPER_EDIT));
SendDlgItemMessage(hwnd, IDC_SUBMAPPER_EDIT, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
// PRG ROM // PRG ROM
int prg_rom; int prg_rom;
if (GetComboBoxByteSize(hwnd, IDC_PRGROM_COMBO, &prg_rom) == 0) if (GetComboBoxByteSize(hwnd, IDC_PRGROM_COMBO, &prg_rom, header) == 0)
{ {
// max value which a iNES 2.0 header can hold // max value which a iNES 2.0 header can hold
if (prg_rom < 16 * 1024 * 0xEFF) if (prg_rom < 16 * 1024 * 0xEFF)
@ -974,6 +1068,7 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (!fit) if (!fit)
{ {
if (header) {
int result10 = (prg_rom / 16 / 1024 + 1) * 16 * 1024; int result10 = (prg_rom / 16 / 1024 + 1) * 16 * 1024;
if (result10 < result) if (result10 < result)
result = result10; result = result10;
@ -988,14 +1083,24 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
else else
{ {
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGROM_COMBO, EM_SETSEL, 0, -1);
}
return false; return false;
} }
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
} }
} }
else { else {
// ines 1.0 can't handle this kind of value if (header) {
MessageBox(hwnd, "PRG ROM size must be multiple of 16KB in iNES 1.0", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "PRG ROM size must be multiple of 16KB in iNES 1.0", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGROM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
// ines 1.0 can't handle this kind of value
return false; return false;
} }
} }
@ -1009,8 +1114,14 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (ines20) if (ines20)
_header.Upper_ROM_VROM_size |= prg_rom / 16 / 1024 >> 8 & 0xF; _header.Upper_ROM_VROM_size |= prg_rom / 16 / 1024 >> 8 & 0xF;
else { else {
if (header)
{
MessageBox(hwnd, "PRG ROM size exceeded the limit of iNES 1.0 (4080KB).", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "PRG ROM size exceeded the limit of iNES 1.0 (4080KB).", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGROM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1018,8 +1129,14 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
} }
// A too large size // A too large size
else { else {
if (header)
{
MessageBox(hwnd, "PRG ROM size you entered is too large to fit into a cartridge, by the way this is an NES emulator, not for XBOX360 or PlayStation2.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "PRG ROM size you entered is too large to fit into a cartridge, by the way this is an NES emulator, not for XBOX360 or PlayStation2.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGROM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1030,7 +1147,7 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (ines20 || IsDlgButtonChecked(hwnd, IDC_CHECK_UNOFFICIAL) == BST_UNCHECKED || IsDlgButtonChecked(hwnd, IDC_CHECK_UNOFFICIAL_PRGRAM) == BST_CHECKED) if (ines20 || IsDlgButtonChecked(hwnd, IDC_CHECK_UNOFFICIAL) == BST_UNCHECKED || IsDlgButtonChecked(hwnd, IDC_CHECK_UNOFFICIAL_PRGRAM) == BST_CHECKED)
{ {
int prg_ram; int prg_ram;
if (GetComboBoxByteSize(hwnd, IDC_PRGRAM_COMBO, &prg_ram) == 0) if (GetComboBoxByteSize(hwnd, IDC_PRGRAM_COMBO, &prg_ram, header) == 0)
{ {
if (ines20) if (ines20)
{ {
@ -1039,15 +1156,29 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (prg_ram % 64 == 0) if (prg_ram % 64 == 0)
_header.RAM_size |= (int)log2(prg_ram / 64); _header.RAM_size |= (int)log2(prg_ram / 64);
else else
{
if (header)
{ {
MessageBox(hwnd, "Invalid PRG RAM size", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid PRG RAM size", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
else { else {
if (header)
{
MessageBox(hwnd, "PRG RAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "PRG RAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1057,14 +1188,28 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (prg_ram % (8 * 1024) == 0) if (prg_ram % (8 * 1024) == 0)
_header.ROM_type3 |= prg_ram / 8 / 1024; _header.ROM_type3 |= prg_ram / 8 / 1024;
else { else {
if (header)
{
MessageBox(hwnd, "PRG RAM size must be multiple of 8KB in iNES 1.0", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "PRG RAM size must be multiple of 8KB in iNES 1.0", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
else { else {
if (header)
{
MessageBox(hwnd, "PRG RAM size exceeded the limit (2040KB)", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "PRG RAM size exceeded the limit (2040KB)", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1079,23 +1224,37 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
{ {
// only iNES 2.0 has value for PRG VMRAM // only iNES 2.0 has value for PRG VMRAM
int prg_nvram; int prg_nvram;
if (GetComboBoxByteSize(hwnd, IDC_PRGNVRAM_COMBO, &prg_nvram) == 0) if (GetComboBoxByteSize(hwnd, IDC_PRGNVRAM_COMBO, &prg_nvram, header) == 0)
{ {
if (prg_nvram < 64 << 0xF) if (prg_nvram < 64 << 0xF)
{ {
if (prg_nvram % 64 == 0) if (prg_nvram % 64 == 0)
_header.RAM_size |= (int)log2(prg_nvram / 64) << 4; _header.RAM_size |= (int)log2(prg_nvram / 64) << 4;
else else
{
if (header)
{ {
MessageBox(hwnd, "Invalid PRG NVRAM size", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid PRG NVRAM size", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGNVRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGNVRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGNVRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
else else
{
if (header)
{ {
MessageBox(hwnd, "PRG NVRAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "PRG NVRAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGNVRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGNVRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGNVRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
@ -1114,7 +1273,7 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
// CHR ROM // CHR ROM
int chr_rom; int chr_rom;
if (GetComboBoxByteSize(hwnd, IDC_CHRROM_COMBO, &chr_rom) == 0) if (GetComboBoxByteSize(hwnd, IDC_CHRROM_COMBO, &chr_rom, header) == 0)
{ {
// max value which a iNES 2.0 header can hold // max value which a iNES 2.0 header can hold
if (chr_rom < 8 * 1024 * 0xEFF) if (chr_rom < 8 * 1024 * 0xEFF)
@ -1160,16 +1319,30 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONERROR) == IDYES) if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONERROR) == IDYES)
SetDlgItemText(hwnd, IDC_CHRROM_COMBO, buf2); SetDlgItemText(hwnd, IDC_CHRROM_COMBO, buf2);
else else
{
if (header)
{ {
SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO));
SendDlgItemMessage(hwnd, IDC_CHRROM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
} }
else { else {
// ines 1.0 can't handle this kind of value // ines 1.0 can't handle this kind of value
if (header)
{
MessageBox(hwnd, "CHR ROM size must be multiple of 8KB in iNES 1.0", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "CHR ROM size must be multiple of 8KB in iNES 1.0", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO));
SendDlgItemMessage(hwnd, IDC_CHRROM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1183,9 +1356,16 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (ines20) if (ines20)
_header.Upper_ROM_VROM_size |= chr_rom / 8 / 1024 >> 4 & 0xF0; _header.Upper_ROM_VROM_size |= chr_rom / 8 / 1024 >> 4 & 0xF0;
else else
{
if (header)
{ {
MessageBox(hwnd, "CHR ROM size exceeded the limit of iNES 1.0 (2040KB).", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "CHR ROM size exceeded the limit of iNES 1.0 (2040KB).", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
SendDlgItemMessage(hwnd, IDC_PRGROM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1193,8 +1373,15 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
} }
// A too large size // A too large size
else { else {
if (header)
{
MessageBox(hwnd, "CHR ROM size you entered cannot be fitted in iNES 2.0.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "CHR ROM size you entered cannot be fitted in iNES 2.0.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO));
SendDlgItemMessage(hwnd, IDC_CHRROM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1206,22 +1393,36 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
{ {
// only iNES 2.0 has value for CHR RAM // only iNES 2.0 has value for CHR RAM
int chr_ram; int chr_ram;
if (GetComboBoxByteSize(hwnd, IDC_CHRRAM_COMBO, &chr_ram) == 0) if (GetComboBoxByteSize(hwnd, IDC_CHRRAM_COMBO, &chr_ram, header) == 0)
{ {
if (chr_ram < 64 << 0xF) if (chr_ram < 64 << 0xF)
{ {
if (chr_ram % 64 == 0) if (chr_ram % 64 == 0)
_header.VRAM_size |= (int)log2(chr_ram / 64); _header.VRAM_size |= (int)log2(chr_ram / 64);
else else
{
if (header)
{ {
MessageBox(hwnd, "Invalid CHR RAM size", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid CHR RAM size", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_CHRRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_CHRRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_CHRRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
else { else {
if (header)
{
MessageBox(hwnd, "CHR RAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "CHR RAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_CHRRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_CHRRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_CHRRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1234,21 +1435,35 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
{ {
// only iNES 2.0 has value for CHR NVRAM // only iNES 2.0 has value for CHR NVRAM
int chr_nvram; int chr_nvram;
if (GetComboBoxByteSize(hwnd, IDC_CHRNVRAM_COMBO, &chr_nvram) == 0) if (GetComboBoxByteSize(hwnd, IDC_CHRNVRAM_COMBO, &chr_nvram, header) == 0)
{ {
if (chr_nvram < 64 << 0xF) if (chr_nvram < 64 << 0xF)
{ {
if (chr_nvram % 64 == 0) if (chr_nvram % 64 == 0)
_header.VRAM_size |= (int)log2(chr_nvram / 64) << 4; _header.VRAM_size |= (int)log2(chr_nvram / 64) << 4;
else { else {
if (header)
{
MessageBox(hwnd, "Invalid CHR NVRAM size", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid CHR NVRAM size", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_CHRNVRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_CHRNVRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_CHRNVRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
else { else {
if (header)
{
MessageBox(hwnd, "CHR NVRAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "CHR NVRAM size exceeded the limit (4096KB)", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_CHRNVRAM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_CHRNVRAM_COMBO));
SendDlgItemMessage(hwnd, IDC_CHRNVRAM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
@ -1294,22 +1509,36 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (ines20) { if (ines20) {
// VS System type // VS System type
int system; int system;
if (GetComboBoxListItemData(hwnd, IDC_VS_SYSTEM_COMBO, &system, buf) && system <= 0xF) if (GetComboBoxListItemData(hwnd, IDC_VS_SYSTEM_COMBO, &system, buf, header) && system <= 0xF)
_header.VS_hardware |= (system & 0xF) << 4; _header.VS_hardware |= (system & 0xF) << 4;
else else
{
if (header)
{ {
MessageBox(hwnd, "Invalid VS System hardware type.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid VS System hardware type.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_VS_SYSTEM_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_VS_SYSTEM_COMBO));
SendDlgItemMessage(hwnd, IDC_VS_SYSTEM_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
// VS PPU type // VS PPU type
int ppu; int ppu;
if (GetComboBoxListItemData(hwnd, IDC_VS_PPU_COMBO, &ppu, buf) && system <= 0xF) if (GetComboBoxListItemData(hwnd, IDC_VS_PPU_COMBO, &ppu, buf, header) && system <= 0xF)
_header.VS_hardware |= ppu & 0xF; _header.VS_hardware |= ppu & 0xF;
else else
{
if (header)
{ {
MessageBox(hwnd, "Invalid VS System PPU type.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid VS System PPU type.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_VS_PPU_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_VS_PPU_COMBO));
SendDlgItemMessage(hwnd, IDC_VS_PPU_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1321,12 +1550,19 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
// Extend System // Extend System
_header.ROM_type2 |= 3; _header.ROM_type2 |= 3;
int extend; int extend;
if (GetComboBoxListItemData(hwnd, IDC_SYSTEM_EXTEND_COMBO, &extend, buf) && extend <= 0x3F) if (GetComboBoxListItemData(hwnd, IDC_SYSTEM_EXTEND_COMBO, &extend, buf, header) && extend <= 0x3F)
_header.VS_hardware |= extend & 0x3F; _header.VS_hardware |= extend & 0x3F;
else else
{
if (header)
{ {
MessageBox(hwnd, "Invalid extend system type", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid extend system type", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_SYSTEM_EXTEND_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_SYSTEM_EXTEND_COMBO));
SendDlgItemMessage(hwnd, IDC_SYSTEM_EXTEND_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1335,12 +1571,19 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
if (ines20) if (ines20)
{ {
int input; int input;
if (GetComboBoxListItemData(hwnd, IDC_INPUT_DEVICE_COMBO, &input, buf, true) && input <= 0x3F) if (GetComboBoxListItemData(hwnd, IDC_INPUT_DEVICE_COMBO, &input, buf, header) && input <= 0x3F)
_header.reserved[1] |= input & 0x3F; _header.reserved[1] |= input & 0x3F;
else else
{
if (header)
{ {
MessageBox(hwnd, "Invalid input device.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid input device.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_INPUT_DEVICE_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_INPUT_DEVICE_COMBO));
SendDlgItemMessage(hwnd, IDC_INPUT_DEVICE_COMBO, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
} }
@ -1351,15 +1594,29 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
GetDlgItemText(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT, buf, 256); GetDlgItemText(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT, buf, 256);
int misc_roms = 0; int misc_roms = 0;
if (sscanf(buf, "%d", &misc_roms) < 1) if (sscanf(buf, "%d", &misc_roms) < 1)
{
if (header)
{ {
MessageBox(hwnd, "Invalid miscellanous ROM(s) count. If you don't know what value should be, we recommend to set it to 0.", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Invalid miscellanous ROM(s) count. If you don't know what value should be, we recommend to set it to 0.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT)); SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT));
SendDlgItemMessage(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
if (misc_roms > 3) if (misc_roms > 3)
{
if (header)
{ {
MessageBox(hwnd, "Miscellanous ROM(s) count has exceeded the limit of iNES 2.0 (3)", "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, "Miscellanous ROM(s) count has exceeded the limit of iNES 2.0 (3)", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT)); SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT));
SendDlgItemMessage(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT, EM_SETSEL, 0, -1);
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false; return false;
} }
_header.reserved[0] |= misc_roms & 3; _header.reserved[0] |= misc_roms & 3;
@ -1392,44 +1649,35 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
} }
if (!fceux_support) if (!fceux_support)
{
if (header)
{ {
sprintf(buf, "FCEUX doesn't support iNES Mapper# %d, this is not a serious problem, but the ROM will not be run in FCEUX properly.\nDo you want to continue?", mapper); sprintf(buf, "FCEUX doesn't support iNES Mapper# %d, this is not a serious problem, but the ROM will not be run in FCEUX properly.\nDo you want to continue?", mapper);
if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONWARNING) == IDNO) if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONWARNING) == IDNO)
{ {
SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO)); SetFocus(GetDlgItem(hwnd, IDC_MAPPER_COMBO));
return false; SendDlgItemMessage(hwnd, IDC_MAPPER_COMBO, EM_SETSEL, 0, -1);
} }
} }
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return false;
}
memcpy(_header.ID, "NES\x1A", 4); memcpy(_header.ID, "NES\x1A", 4);
if (header) if (header)
memcpy(header, &_header, sizeof(iNES_HEADER)); memcpy(header, &_header, sizeof(iNES_HEADER));
else
#ifdef _DEBUG {
printf("header: "); sprintf(buf, "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X", _header.ID[0], _header.ID[1], _header.ID[2], _header.ID[3], _header.ROM_size, _header.VROM_size, _header.ROM_type, _header.ROM_type2, _header.ROM_type3, _header.Upper_ROM_VROM_size, _header.RAM_size, _header.VRAM_size, _header.TV_system, _header.VS_hardware, _header.reserved[0], _header.reserved[1]);
printf("%02X ", _header.ID[0]); SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, buf);
printf("%02X ", _header.ID[1]); }
printf("%02X ", _header.ID[2]);
printf("%02X ", _header.ID[3]);
printf("%02X ", _header.ROM_size);
printf("%02X ", _header.VROM_size);
printf("%02X ", _header.ROM_type);
printf("%02X ", _header.ROM_type2);
printf("%02X ", _header.ROM_type3);
printf("%02X ", _header.Upper_ROM_VROM_size);
printf("%02X ", _header.RAM_size);
printf("%02X ", _header.VRAM_size);
printf("%02X ", _header.TV_system);
printf("%02X ", _header.VS_hardware);
printf("%02X ", _header.reserved[0]);
printf("%02X\n", _header.reserved[1]);
#endif
return true; return true;
} }
int GetComboBoxByteSize(HWND hwnd, UINT id, int* value) int GetComboBoxByteSize(HWND hwnd, UINT id, int* value, iNES_HEADER* header)
{ {
char* name = ""; char* name = "";
char buf[256]; char buf[256];
@ -1453,7 +1701,7 @@ int GetComboBoxByteSize(HWND hwnd, UINT id, int* value)
case IDC_CHRNVRAM_COMBO: name = "CHR NVRAM"; break; case IDC_CHRNVRAM_COMBO: name = "CHR NVRAM"; break;
} }
if (!GetComboBoxListItemData(hwnd, id, value, buf, true)) if (!GetComboBoxListItemData(hwnd, id, value, buf, header))
{ {
char buf2[4]; char buf2[4];
if (sscanf(buf, "%d%3[KMB]", value, buf2) < 2 || !strcmp(buf2, "")) if (sscanf(buf, "%d%3[KMB]", value, buf2) < 2 || !strcmp(buf2, ""))
@ -1471,6 +1719,8 @@ int GetComboBoxByteSize(HWND hwnd, UINT id, int* value)
} }
} }
if (header)
{
switch (err) switch (err)
{ {
case errors::FORMAT_ERR: case errors::FORMAT_ERR:
@ -1488,12 +1738,16 @@ int GetComboBoxByteSize(HWND hwnd, UINT id, int* value)
{ {
MessageBox(hwnd, buf, "Error", MB_OK | MB_ICONERROR); MessageBox(hwnd, buf, "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, id)); SetFocus(GetDlgItem(hwnd, id));
SendDlgItemMessage(hwnd, id, EM_SETSEL, 0, -1);
} }
}
else
SetDlgItemText(hwnd, IDC_HEX_HEADER_EDIT, "");
return err; return err;
} }
bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exact) bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, iNES_HEADER* header)
{ {
bool success = true; bool success = true;
@ -1503,10 +1757,10 @@ bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exa
else { else {
GetDlgItemText(hwnd, id, buf, 256); GetDlgItemText(hwnd, id, buf, 256);
if (exact) if (header)
*value = SendDlgItemMessage(hwnd, id, CB_FINDSTRINGEXACT, 0, (LPARAM)buf);
else
*value = SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf); *value = SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf);
else
*value = SendDlgItemMessage(hwnd, id, CB_FINDSTRINGEXACT, 0, (LPARAM)buf);
if (*value != CB_ERR) if (*value != CB_ERR)
*value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, *value, 0); *value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, *value, 0);
@ -1519,16 +1773,16 @@ bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exa
break; break;
case IDC_MAPPER_COMBO: case IDC_MAPPER_COMBO:
if (!(success = sscanf(buf, "%d", value) > 0)) if (!(success = sscanf(buf, "%d", value) > 0))
success = SearchByString(hwnd, id, value, buf); success = SearchByString(hwnd, id, value, buf, header);
else else if (header)
SetDlgItemText(hwnd, id, buf); SetDlgItemText(hwnd, id, buf);
break; break;
case IDC_VS_SYSTEM_COMBO: case IDC_VS_SYSTEM_COMBO:
case IDC_VS_PPU_COMBO: case IDC_VS_PPU_COMBO:
case IDC_SYSTEM_EXTEND_COMBO: case IDC_SYSTEM_EXTEND_COMBO:
if (!(success = sscanf(buf, "$%X", (unsigned int *)value) > 0)) if (!(success = sscanf(buf, "$%X", (unsigned int *)value) > 0))
success = SearchByString(hwnd, id, value, buf); success = SearchByString(hwnd, id, value, buf, header);
else else if (header)
SetDlgItemText(hwnd, id, buf); SetDlgItemText(hwnd, id, buf);
break; break;
case IDC_INPUT_DEVICE_COMBO: case IDC_INPUT_DEVICE_COMBO:
@ -1536,15 +1790,15 @@ bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exa
{ {
char buf2[8]; char buf2[8];
sprintf(buf2, "$%02X", *value); sprintf(buf2, "$%02X", *value);
if (SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf2) == CB_ERR) if (header && SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf2) == CB_ERR)
SetDlgItemText(hwnd, id, buf); SetDlgItemText(hwnd, id, buf);
} }
else else
success = SearchByString(hwnd, id, value, buf); success = SearchByString(hwnd, id, value, buf, header);
break; break;
} }
if (!success) if (header && !success)
SetDlgItemText(hwnd, id, buf); SetDlgItemText(hwnd, id, buf);
} }
} }
@ -1553,12 +1807,12 @@ bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exa
} }
// Warning: when in save mode, the content of buf might be overwritten by the save filename which user changed. // Warning: when in save mode, the content of buf might be overwritten by the save filename which user changed.
bool ShowINESFileBox(HWND parent, char* buf, bool save) bool ShowINESFileBox(HWND parent, char* buf, iNES_HEADER* header)
{ {
char *filename = NULL, *path = NULL; char *filename = NULL, *path = NULL;
bool success = true; bool success = true;
if (save) if (header)
{ {
// When open this dialog for saving prpose, the buf must be a separate buf. // When open this dialog for saving prpose, the buf must be a separate buf.
if (buf && buf != LoadedRomFName) if (buf && buf != LoadedRomFName)
@ -1577,7 +1831,9 @@ bool ShowINESFileBox(HWND parent, char* buf, bool save)
free(filename); free(filename);
filename = _filename; filename = _filename;
} }
strcat(filename, " [header modified].nes"); char header_str[32];
sprintf(header_str, " [%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X].nes", header->ROM_size, header->VROM_size, header->ROM_size, header->ROM_type2, header->ROM_type3, header->Upper_ROM_VROM_size, header->RAM_size, header->VRAM_size, header->TV_system, header->VS_hardware, header->reserved[0], header->reserved[1]);
strcat(filename, header_str);
path = GetRomPath(true); path = GetRomPath(true);
} }
else else
@ -1595,7 +1851,7 @@ bool ShowINESFileBox(HWND parent, char* buf, bool save)
OPENFILENAME ofn; OPENFILENAME ofn;
memset(&ofn, 0, sizeof(OPENFILENAME)); memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME); ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrTitle = save ? "Save NES file" : "Open NES file"; ofn.lpstrTitle = header ? "Save NES file" : "Open NES file";
ofn.lpstrFilter = "NES ROM file (*.nes)\0*.nes\0All files (*.*)\0*.*\0\0"; ofn.lpstrFilter = "NES ROM file (*.nes)\0*.nes\0All files (*.*)\0*.*\0\0";
ofn.hInstance = fceu_hInstance; ofn.hInstance = fceu_hInstance;
ofn.hwndOwner = parent; ofn.hwndOwner = parent;
@ -1605,7 +1861,7 @@ bool ShowINESFileBox(HWND parent, char* buf, bool save)
ofn.lpstrInitialDir = path; ofn.lpstrInitialDir = path;
ofn.lpstrDefExt = "nes"; ofn.lpstrDefExt = "nes";
if (save ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn)) if (header ? GetSaveFileName(&ofn) : GetOpenFileName(&ofn))
strcpy(buf, filename); strcpy(buf, filename);
else else
success = false; success = false;
@ -1658,7 +1914,7 @@ bool SaveINESFile(HWND hwnd, char* path, iNES_HEADER* header)
} }
bool SearchByString(HWND hwnd, UINT id, int* value, char* buf) bool SearchByString(HWND hwnd, UINT id, int* value, char* buf, iNES_HEADER* header)
{ {
if (buf[0] != ' ' && buf[0] != 0) if (buf[0] != ' ' && buf[0] != 0)
{ {
@ -1669,6 +1925,7 @@ bool SearchByString(HWND hwnd, UINT id, int* value, char* buf)
{ {
if (!stricmp(buf, bmap[i].name)) if (!stricmp(buf, bmap[i].name))
{ {
if (header)
SendDlgItemMessage(hwnd, id, CB_SETCURSEL, i, 0); SendDlgItemMessage(hwnd, id, CB_SETCURSEL, i, 0);
*value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, i, 0); *value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, i, 0);
return true; return true;
@ -1686,6 +1943,7 @@ bool SearchByString(HWND hwnd, UINT id, int* value, char* buf)
{ {
if (!stricmp(buf, checkList[j])) if (!stricmp(buf, checkList[j]))
{ {
if (header)
SendDlgItemMessage(hwnd, id, CB_SETCURSEL, j, 0); SendDlgItemMessage(hwnd, id, CB_SETCURSEL, j, 0);
*value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, j, 0); *value = SendDlgItemMessage(hwnd, id, CB_GETITEMDATA, j, 0);
return true; return true;

View File

@ -7,7 +7,7 @@ extern HWND hHeadEditor;
void DoHeadEdit(); void DoHeadEdit();
HWND InitHeaderEditDialog(HWND hwnd, iNES_HEADER* header); 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 ToggleINES20(HWND hwnd, bool ines20);
void ToggleExtendSystemList(HWND hwnd, bool enable); void ToggleExtendSystemList(HWND hwnd, bool enable);
void ToggleVSSystemGroup(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 ToggleUnofficialPrgRamPresent(HWND hwnd, bool ines20, bool unofficial_check, bool check);
void SetHeaderData(HWND hwnd, iNES_HEADER* header); void SetHeaderData(HWND hwnd, iNES_HEADER* header);
bool LoadHeader(HWND parent, iNES_HEADER* header); bool LoadHeader(HWND parent, iNES_HEADER* header);
bool WriteHeaderData(HWND hwnd, iNES_HEADER* header); bool WriteHeaderData(HWND hwnd, iNES_HEADER* header = NULL);
int GetComboBoxByteSize(HWND hwnd, UINT id, int* value); int GetComboBoxByteSize(HWND hwnd, UINT id, int* value, iNES_HEADER* header);
bool SearchByString(HWND hwnd, UINT id, int* value, char* buf); bool SearchByString(HWND hwnd, UINT id, int* value, char* buf, iNES_HEADER* header = NULL);
bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exact = false); bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, iNES_HEADER* header = NULL);
bool SaveINESFile(HWND hwnd, char* path, iNES_HEADER* header); bool SaveINESFile(HWND hwnd, char* path, iNES_HEADER* header);
INT_PTR CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP); INT_PTR CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP);
extern WNDPROC DefaultEditCtrlProc; extern WNDPROC DefaultEditCtrlProc;
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP); 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 CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,311,214
END 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 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "iNES Header Editor" CAPTION "iNES Header Editor"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
GROUPBOX "iNES Header",IDC_INESHEADER_GROUP,6,3,309,231,WS_DISABLED LTEXT "NES ROM:",IDC_STATIC,7,9,35,8
GROUPBOX "Version",IDC_VERSION_GROUP,14,13,79,27,WS_DISABLED EDITTEXT IDC_ROM_FILE_EDIT,47,6,231,14,ES_AUTOHSCROLL | ES_READONLY
CONTROL "iNES",IDC_RADIO_VERSION_STANDARD,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,20,24,27,10 PUSHBUTTON "Restore",IDC_RESTORE_BUTTON,282,6,42,14,WS_DISABLED
CONTROL "NES 2.0",IDC_RADIO_VERSION_INES20,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,51,24,38,10 GROUPBOX "iNES Header",IDC_INESHEADER_GROUP,7,22,317,232,WS_DISABLED
GROUPBOX "Mapper",IDC_MAPPER_GROUP,98,13,210,27,WS_DISABLED GROUPBOX "Version",IDC_VERSION_GROUP,14,32,79,27,WS_DISABLED
LTEXT "Mapper#:",IDC_MAPPER_TEXT,104,24,33,8,WS_DISABLED CONTROL "iNES",IDC_RADIO_VERSION_STANDARD,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,20,43,27,10
COMBOBOX IDC_MAPPER_COMBO,139,22,115,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP CONTROL "NES 2.0",IDC_RADIO_VERSION_INES20,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,51,43,38,10
LTEXT "Sub#:",IDC_SUBMAPPER_TEXT,261,24,21,8,WS_DISABLED GROUPBOX "Mapper",IDC_MAPPER_GROUP,98,32,217,27,WS_DISABLED
EDITTEXT IDC_SUBMAPPER_EDIT,284,21,15,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED LTEXT "Mapper#:",IDC_MAPPER_TEXT,104,43,33,8,WS_DISABLED
GROUPBOX "PRG",IDC_PRG_GROUP,14,42,294,27,WS_DISABLED COMBOBOX IDC_MAPPER_COMBO,142,41,115,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PRG ROM:",IDC_PRGROM_TEXT,20,53,34,8,WS_DISABLED LTEXT "Sub#:",IDC_SUBMAPPER_TEXT,264,43,24,8,WS_DISABLED
COMBOBOX IDC_PRGROM_COMBO,57,51,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_SUBMAPPER_EDIT,291,40,15,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
LTEXT "PRG RAM:",IDC_PRGRAM_TEXT,115,53,34,8,WS_DISABLED GROUPBOX "PRG",IDC_PRG_GROUP,14,61,301,27,WS_DISABLED
COMBOBOX IDC_PRGRAM_COMBO,151,51,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP LTEXT "PRG ROM:",IDC_PRGROM_TEXT,20,72,34,8,WS_DISABLED
CONTROL "Battery-backed NVRAM",IDC_CHECK_BATTERYNVRAM,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,211,53,86,10 COMBOBOX IDC_PRGROM_COMBO,57,70,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LTEXT "PRG NVRAM:",IDC_PRGNVRAM_TEXT,208,53,42,8,WS_DISABLED LTEXT "PRG RAM:",IDC_PRGRAM_TEXT,118,72,34,8,WS_DISABLED
COMBOBOX IDC_PRGNVRAM_COMBO,253,51,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_PRGRAM_COMBO,154,70,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 CONTROL "Battery-backed NVRAM",IDC_CHECK_BATTERYNVRAM,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,215,71,86,10
LTEXT "CHR ROM:",IDC_CHRROM_TEXT,20,82,35,8,WS_DISABLED LTEXT "PRG NVRAM:",IDC_PRGNVRAM_TEXT,215,72,42,8,WS_DISABLED
COMBOBOX IDC_CHRROM_COMBO,57,80,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_PRGNVRAM_COMBO,261,70,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 GROUPBOX "CHR",IDC_CHR_GROUP,14,90,301,27,WS_DISABLED
COMBOBOX IDC_CHRRAM_COMBO,151,80,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP LTEXT "CHR ROM:",IDC_CHRROM_TEXT,20,101,35,8,WS_DISABLED
LTEXT "CHR NVRAM:",IDC_CHRNVRAM_TEXT,207,82,43,8,WS_DISABLED COMBOBOX IDC_CHRROM_COMBO,57,99,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_CHRNVRAM_COMBO,253,80,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
GROUPBOX "Mirroring",IDC_MIRRORING_GROUP,14,102,59,46,WS_DISABLED COMBOBOX IDC_CHRRAM_COMBO,154,99,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
CONTROL "Horizontal",IDC_RADIO_MIRR_HORIZONTAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,19,112,48,10 LTEXT "CHR NVRAM:",IDC_CHRNVRAM_TEXT,214,101,43,8,WS_DISABLED
CONTROL "Vertical",IDC_RADIO_MIRR_VERTICAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,19,123,39,10 COMBOBOX IDC_CHRNVRAM_COMBO,261,99,46,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_UPPERCASE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
CONTROL "Four-screen",IDC_RADIO_MIRR_4SCREEN,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,19,134,51,10 GROUPBOX "Mirroring",IDC_MIRRORING_GROUP,14,121,59,46,WS_DISABLED
CONTROL "Trainer",IDC_CHECK_TRAINER,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,14,152,55,10 CONTROL "Horizontal",IDC_RADIO_MIRR_HORIZONTAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,18,131,48,10
GROUPBOX "Region",IDC_REGION_GROUP,78,102,40,58,WS_DISABLED CONTROL "Vertical",IDC_RADIO_MIRR_VERTICAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,18,142,39,10
CONTROL "NTSC",IDC_RADIO_REGION_NTSC,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,83,112,29,10 CONTROL "Four-screen",IDC_RADIO_MIRR_4SCREEN,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,18,153,53,10
CONTROL "PAL",IDC_RADIO_REGION_PAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,83,123,28,10 GROUPBOX "Region",IDC_REGION_GROUP,80,121,40,58,WS_DISABLED
CONTROL "Dual",IDC_RADIO_REGION_DUAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,83,146,30,10 CONTROL "NTSC",IDC_RADIO_REGION_NTSC,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,85,131,32,10
CONTROL "Dendy",IDC_RADIO_REGION_DENDY,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,83,134,33,10 CONTROL "PAL",IDC_RADIO_REGION_PAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,85,142,28,10
GROUPBOX "System",IDC_SYSTEM_GROUP,123,102,184,109,WS_DISABLED CONTROL "Dendy",IDC_RADIO_REGION_DENDY,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,85,153,33,10
CONTROL "Normal",IDC_RADIO_SYSTEM_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,129,114,34,10 CONTROL "Dual",IDC_RADIO_REGION_DUAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,85,165,30,10
CONTROL "VS. Sys",IDC_RADIO_SYSTEM_VS,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,167,114,37,10 CONTROL "Trainer",IDC_CHECK_TRAINER,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,14,171,55,10
CONTROL "Playchoice-10",IDC_RADIO_SYSTEM_PLAYCHOICE10,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,208,114,56,10 GROUPBOX "System",IDC_SYSTEM_GROUP,127,121,188,109,WS_DISABLED
CONTROL "Extend",IDC_RADIO_SYSTEM_EXTEND,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,268,114,35,10 CONTROL "Normal",IDC_RADIO_SYSTEM_NORMAL,"Button",BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP | WS_TABSTOP,133,133,36,10
GROUPBOX "Extend System",IDC_EXTEND_SYSTEM_GROUP,130,176,171,29,WS_DISABLED CONTROL "VS. Sys",IDC_RADIO_SYSTEM_VS,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,173,133,37,10
LTEXT "Console:",IDC_EXTEND_SYSTEM_TEXT,136,189,29,8,WS_DISABLED CONTROL "Playchoice-10",IDC_RADIO_SYSTEM_PLAYCHOICE10,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,214,133,56,10
COMBOBOX IDC_SYSTEM_EXTEND_COMBO,168,186,127,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP CONTROL "Extend",IDC_RADIO_SYSTEM_EXTEND,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,274,133,35,10
GROUPBOX "VS. System",IDC_VS_SYSTEM_GROUP,130,126,171,46,WS_DISABLED GROUPBOX "VS. System",IDC_VS_SYSTEM_GROUP,135,145,172,46,WS_DISABLED
LTEXT "Hardware:",IDC_VS_SYSTEM_TEXT,136,138,35,8,WS_DISABLED LTEXT "Hardware:",IDC_VS_SYSTEM_TEXT,141,157,35,8,WS_DISABLED
COMBOBOX IDC_VS_SYSTEM_COMBO,174,136,121,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP 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,136,155,16,8,WS_DISABLED LTEXT "PPU:",IDC_VS_PPU_TEXT,141,174,16,8,WS_DISABLED
COMBOBOX IDC_VS_PPU_COMBO,155,154,140,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP 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, CONTROL "iNES 1.0 Unofficial Properties",IDC_CHECK_UNOFFICIAL,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,14,164,103,10 "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,14,183,110,10
GROUPBOX "iNES 1.0 Unofficial Properties",IDC_UNOFFICIAL_GROUP,13,176,105,35,WS_DISABLED 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,186,48,10 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,70,188,43,17 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,198,49,10 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,106,218,44,8,WS_DISABLED LTEXT "Input device:",IDC_INPUT_DEVICE_TEXT,114,237,44,8,WS_DISABLED
COMBOBOX IDC_INPUT_DEVICE_COMBO,153,216,154,30,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP 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,218,48,8,WS_DISABLED LTEXT "Misc. ROM(s)",IDC_MISCELLANEOUS_ROMS_TEXT,29,237,48,8,WS_DISABLED
EDITTEXT IDC_MISCELLANEOUS_ROMS_EDIT,14,215,12,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED EDITTEXT IDC_MISCELLANEOUS_ROMS_EDIT,14,234,12,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
PUSHBUTTON "Restore",IDC_RESTORE_BUTTON,6,237,44,14,WS_DISABLED LTEXT "Hex:",IDC_STATIC,9,262,16,8
PUSHBUTTON "Save as...",IDSAVE,223,237,44,14,WS_DISABLED EDITTEXT IDC_HEX_HEADER_EDIT,29,260,203,14,ES_AUTOHSCROLL | ES_READONLY
DEFPUSHBUTTON "Close",IDCLOSE,271,237,44,14 PUSHBUTTON "Save as...",IDSAVE,237,260,42,14,WS_DISABLED
DEFPUSHBUTTON "Close",IDCLOSE,282,260,42,14
END END
@ -2099,9 +2103,9 @@ BEGIN
IDD_EDIT_HEADER, DIALOG IDD_EDIT_HEADER, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 314 RIGHTMARGIN, 324
TOPMARGIN, 7 TOPMARGIN, 6
BOTTOMMARGIN, 251 BOTTOMMARGIN, 274
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED

View File

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