MCPcopy Create free account
hub / github.com/TASEmulators/fceux / PatcherCallB

Function PatcherCallB

src/drivers/win/debugger.cpp:1437–1503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1435}
1436
1437INT_PTR CALLBACK PatcherCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
1438 char str[64]; //mbg merge 7/18/06 changed from unsigned char
1439 uint8 *c;
1440 int i;
1441 int *p;
1442
1443 switch(uMsg) {
1444 case WM_INITDIALOG:
1445 CenterWindow(hwndDlg);
1446
1447 //set limits
1448 SendDlgItemMessage(hwndDlg,IDC_ROMPATCHER_OFFSET,EM_SETLIMITTEXT,6,0);
1449 SendDlgItemMessage(hwndDlg,IDC_ROMPATCHER_PATCH_DATA,EM_SETLIMITTEXT,30,0);
1450 UpdatePatcher(hwndDlg);
1451
1452 if(iapoffset != -1){
1453 CheckDlgButton(hwndDlg, IDC_ROMPATCHER_DOTNES_OFFSET, BST_CHECKED);
1454 sprintf((char*)str,"%X",iapoffset); //mbg merge 7/18/06 added cast
1455 SetDlgItemText(hwndDlg,IDC_ROMPATCHER_OFFSET,str);
1456 }
1457
1458 SetFocus(GetDlgItem(hwndDlg,IDC_ROMPATCHER_OFFSET_BOX));
1459 break;
1460 case WM_CLOSE:
1461 case WM_QUIT:
1462 EndDialog(hwndDlg,0);
1463 break;
1464 case WM_COMMAND:
1465 switch(HIWORD(wParam)) {
1466 case BN_CLICKED:
1467 switch(LOWORD(wParam)) {
1468 case IDC_ROMPATCHER_BTN_EDIT: //todo: maybe get rid of this button and cause iapoffset to update every time you change the text
1469 if(IsDlgButtonChecked(hwndDlg,IDC_ROMPATCHER_DOTNES_OFFSET) == BST_CHECKED)
1470 iapoffset = GetEditHex(hwndDlg,IDC_ROMPATCHER_OFFSET);
1471 else
1472 iapoffset = GetNesFileAddress(GetEditHex(hwndDlg,IDC_ROMPATCHER_OFFSET));
1473 if((iapoffset < 16) && (iapoffset != -1)){
1474 MessageBox(hDebug, "Sorry, NES Header editing isn't supported by this tool. If you want to edit the header, please use NES Header Editor", "Error", MB_OK | MB_ICONASTERISK);
1475 iapoffset = -1;
1476 }
1477 if((iapoffset > PRGsize[0]) && (iapoffset != -1)){
1478 MessageBox(hDebug, "Error: .Nes offset outside of PRG rom", "Error", MB_OK | MB_ICONERROR);
1479 iapoffset = -1;
1480 }
1481 UpdatePatcher(hwndDlg);
1482 break;
1483 case IDC_ROMPATCHER_BTN_APPLY:
1484 p = GetEditHexData(hwndDlg,IDC_ROMPATCHER_PATCH_DATA);
1485 i=0;
1486 c = GetNesPRGPointer(iapoffset-16);
1487 while(p[i] != -1){
1488 c[i] = p[i];
1489 i++;
1490 }
1491 UpdatePatcher(hwndDlg);
1492 break;
1493 case IDC_ROMPATCHER_BTN_SAVE:
1494 if (!iNesSave())

Callers

nothing calls this directly

Calls 7

CenterWindowFunction · 0.85
UpdatePatcherFunction · 0.85
GetEditHexFunction · 0.85
GetNesFileAddressFunction · 0.85
GetEditHexDataFunction · 0.85
GetNesPRGPointerFunction · 0.85
iNesSaveFunction · 0.85

Tested by

no test coverage detected