Fixed header editor bug, mappers>255 support were totally broken
This commit is contained in:
parent
9471ff5e7b
commit
7e38d08bdb
|
@ -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
|
||||
|
@ -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