Skip to content

Commit bcd47e9

Browse files
authored
Merge from Pull Alcaro#52
Alcaro#52
1 parent 31ad2c4 commit bcd47e9

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

flips-w32.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct {
9090
unsigned char lastRomType;
9191
bool openInEmulatorOnAssoc;
9292
bool enableAutoRomSelector;
93+
bool skipChecksum;
9394
enum patchtype lastPatchType;
9495
int windowleft;
9596
int windowtop;
@@ -264,7 +265,7 @@ int a_ApplyPatch(LPCWSTR clipatchname)
264265
if (*inromext && *outromext) wcscpy(outromext, inromext);
265266
}
266267
if (!SelectRom(outromname, TEXT("Select Output File"), true)) goto cancel;
267-
struct errorinfo errinf=ApplyPatchMem(patch, inromname, true, outromname, NULL, state.enableAutoRomSelector);
268+
struct errorinfo errinf=ApplyPatchMem(patch, inromname, !state.skipChecksum, outromname, NULL, state.enableAutoRomSelector);
268269
delete patch;
269270
MessageBoxA(hwndMain, errinf.description, flipsversion, mboxtype[errinf.level]);
270271
return errinf.level;
@@ -334,7 +335,7 @@ int a_ApplyPatch(LPCWSTR clipatchname)
334335
if (foundRom!=romname) canUseFoundRom=false;
335336

336337
wcscpy(GetExtension(thisFileName), GetExtension(romname));
337-
struct errorinfo errinf=ApplyPatchMem(patch, romname, true, thisFileNameWithPath, NULL, true);
338+
struct errorinfo errinf=ApplyPatchMem(patch, romname, !state.skipChecksum, thisFileNameWithPath, NULL, true);
338339

339340
if (errinf.level==el_broken) worsterror=max(worsterror, e_invalid);
340341
if (errinf.level==el_notthis) worsterror=max(worsterror, e_no_auto);
@@ -410,7 +411,7 @@ int a_ApplyPatch(LPCWSTR clipatchname)
410411
{
411412
LPWSTR patchExtension=GetExtension(thisFileName);
412413
wcscpy(patchExtension, romExtension);
413-
struct errorinfo errinf=ApplyPatchMem2(patch, inrom, removeheaders, true, thisFileNameWithPath, NULL);
414+
struct errorinfo errinf=ApplyPatchMem2(patch, inrom, removeheaders, !state.skipChecksum, thisFileNameWithPath, NULL);
414415

415416
if (errinf.level==el_broken) worsterror=max(worsterror, e_invalid);
416417
if (errinf.level==el_notthis) worsterror=max(worsterror, e_invalid_this);
@@ -566,7 +567,7 @@ int a_ApplyRun(LPCWSTR clipatchname)
566567
WCHAR outfilename[MAX_PATH];
567568
GetFullPathName(outfilename_rel, MAX_PATH, outfilename, NULL);
568569

569-
errinf=ApplyPatchMem(patch, romname, true, outfilename, NULL, state.enableAutoRomSelector);
570+
errinf=ApplyPatchMem(patch, romname, !state.skipChecksum, outfilename, NULL, state.enableAutoRomSelector);
570571
error:
571572

572573
if (errinf.level!=el_ok) MessageBoxA(hwndMain, errinf.description, flipsversion, mboxtype[errinf.level]);
@@ -616,7 +617,7 @@ void a_ShowSettings()
616617
hwndSettings=CreateWindowA(
617618
"floatingmunchers", flipsversion,
618619
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_BORDER|WS_MINIMIZEBOX,
619-
CW_USEDEFAULT, CW_USEDEFAULT, 3+6+202+6+3, 21 + 6+23+6+23+3+13+1+17+4+17+6 + 3, NULL, NULL, GetModuleHandle(NULL), NULL);
620+
CW_USEDEFAULT, CW_USEDEFAULT, 3+6+202+6+3, 21 + 6+23+6+23+3+13+1+17+4+17+6 + 3+17+6 + 3, NULL, NULL, GetModuleHandle(NULL), NULL);
620621

621622
HFONT hfont=(HFONT)GetStockObject(DEFAULT_GUI_FONT);
622623
HWND item;
@@ -674,6 +675,10 @@ void a_ShowSettings()
674675
check("Enable automatic ROM selector", 202, 17, 105); Button_SetCheck(item, (state.enableAutoRomSelector));
675676
endline(3);
676677

678+
line(17);
679+
check("Ignore checksum when patching", 202, 17, 106); Button_SetCheck(item, (state.skipChecksum));
680+
endline(3);
681+
677682
ShowWindow(hwndSettings, SW_SHOW);
678683
#undef firstbutton
679684
#undef button
@@ -782,6 +787,7 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
782787
if (wParam==103) state.openInEmulatorOnAssoc=false;
783788
if (wParam==104) state.openInEmulatorOnAssoc=true;
784789
if (wParam==105) state.enableAutoRomSelector^=1;
790+
if (wParam==106) state.skipChecksum^=1;
785791
}
786792
break;
787793
case WM_CLOSE:
@@ -934,6 +940,7 @@ void GUILoadConfig()
934940
state.lastRomType=0;
935941
state.openInEmulatorOnAssoc=false;
936942
state.enableAutoRomSelector=false;
943+
state.skipChecksum=false;
937944
state.lastPatchType=ty_bps;
938945
state.windowleft=CW_USEDEFAULT;
939946
state.windowtop=CW_USEDEFAULT;

0 commit comments

Comments
 (0)