Fixed header editor bug, mappers>255 support were totally broken
This commit is contained in:
parent
9471ff5e7b
commit
7e38d08bdb
|
@ -159,11 +159,11 @@ bool LoadHeader(HWND parent, iNES_HEADER* header)
|
|||
error = errors::UNIF_HEADER;
|
||||
else if (!memcmp(header, "NESM", 4))
|
||||
error = errors::NSF_HEADER;
|
||||
/* else if (!memcmp(header, "NSFE", 4))
|
||||
/* else if (!memcmp(header, "NSFE", 4))
|
||||
error = errors::NSFE_HEADER;
|
||||
else if (!memcmp(header, "NESM\2", 4))
|
||||
error = errors::NSF2_HEADER;
|
||||
*/ else
|
||||
*/ else
|
||||
error = errors::INVALID_HEADER;
|
||||
FCEU_fclose(fp);
|
||||
}
|
||||
|
@ -191,8 +191,8 @@ bool LoadHeader(HWND parent, iNES_HEADER* header)
|
|||
MessageBox(parent, "Editing header of a UNIF file is not supported.", "iNES Header Editor", MB_OK | MB_ICONERROR);
|
||||
break;
|
||||
case errors::NSF_HEADER:
|
||||
// case errors::NSF2_HEADER:
|
||||
// case errors::NSFE_HEADER:
|
||||
// case errors::NSF2_HEADER:
|
||||
// case errors::NSFE_HEADER:
|
||||
MessageBox(parent, "Editing header of an NSF file is not supported.", "iNES Header Editor", MB_OK | MB_ICONERROR);
|
||||
break;
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ INT_PTR CALLBACK HeaderEditorProc(HWND hDlg, UINT uMsg, WPARAM wP, LPARAM lP)
|
|||
break;
|
||||
case WM_CLOSE:
|
||||
case WM_QUIT:
|
||||
wm_close:
|
||||
wm_close:
|
||||
if (GameInfo)
|
||||
DestroyWindow(hDlg);
|
||||
else
|
||||
|
@ -628,7 +628,7 @@ void SetHeaderData(HWND hwnd, iNES_HEADER* header) {
|
|||
// Mapper#
|
||||
int mapper = header->ROM_type >> 4 | header->ROM_type2 & 0xF0;
|
||||
if (ines20)
|
||||
mapper |= (header->ROM_type3 & 0xF0) << 4;
|
||||
mapper |= (header->ROM_type3 & 0x0F) << 8;
|
||||
sprintf(buf, "%d ", mapper);
|
||||
if (SendDlgItemMessage(hwnd, IDC_MAPPER_COMBO, CB_SELECTSTRING, 0, (LPARAM)buf) == CB_ERR)
|
||||
SetDlgItemText(hwnd, IDC_MAPPER_COMBO, buf);
|
||||
|
@ -672,7 +672,8 @@ void SetHeaderData(HWND hwnd, iNES_HEADER* header) {
|
|||
else sprintf(buf, "%dB", prg_ram);
|
||||
}
|
||||
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(header->RAM_size & 0x10) && header->ROM_type3)
|
||||
sprintf(buf, "%dKB", header->ROM_type3 ? 1 : header->ROM_type3 * 8);
|
||||
|
@ -692,7 +693,8 @@ void SetHeaderData(HWND hwnd, iNES_HEADER* header) {
|
|||
sprintf(buf, "%dKB", prg_nvram / 1024);
|
||||
else sprintf(buf, "%dB", prg_nvram);
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
CheckDlgButton(hwnd, IDC_CHECK_BATTERYNVRAM, header->ROM_type & 0x2 ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
if (SendDlgItemMessage(hwnd, IDC_PRGNVRAM_COMBO, CB_SELECTSTRING, 0, (LPARAM)buf) == CB_ERR)
|
||||
|
@ -890,12 +892,10 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
|
|||
}
|
||||
|
||||
if (mapper < 4096)
|
||||
{
|
||||
if (mapper < 256)
|
||||
{
|
||||
_header.ROM_type |= (mapper & 0xF) << 4;
|
||||
_header.ROM_type2 |= (mapper & 0xF0);
|
||||
} else
|
||||
if (mapper >= 256)
|
||||
{
|
||||
if (ines20)
|
||||
_header.ROM_type3 |= mapper >> 8;
|
||||
|
@ -929,7 +929,8 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
|
|||
SetFocus(GetDlgItem(hwnd, IDC_SUBMAPPER_EDIT));
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
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));
|
||||
|
@ -1021,7 +1022,8 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
|
|||
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
// PRG RAM
|
||||
|
@ -1424,7 +1426,7 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
|
|||
printf("%02X\n", _header.reserved[1]);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
int GetComboBoxByteSize(HWND hwnd, UINT id, int* value)
|
||||
|
@ -1536,7 +1538,8 @@ bool GetComboBoxListItemData(HWND hwnd, UINT id, int* value, char* buf, bool exa
|
|||
sprintf(buf2, "$%02X", *value);
|
||||
if (SendDlgItemMessage(hwnd, id, CB_SELECTSTRING, 0, (LPARAM)buf2) == CB_ERR)
|
||||
SetDlgItemText(hwnd, id, buf);
|
||||
} else
|
||||
}
|
||||
else
|
||||
success = SearchByString(hwnd, id, value, buf);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue