mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
Fix issue for some cheats across build optimizations[D
This commit is contained in:
1 parent
246d737663
commit
426f9c6890
1 file changed
+5
-4
+5
-4
@@ -309,7 +309,7 @@ MenuItemHandlerResult cheatCheckboxMenuHandler(s32 operation, struct menuitem *i
|
||||
return false;
|
||||
}
|
||||
|
||||
if (g_CheatsEnabledBank1 & (1 << item->param)) {
|
||||
if (g_CheatsEnabledBank1 & (1 << (item->param - 32))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -334,11 +334,12 @@ MenuItemHandlerResult cheatCheckboxMenuHandler(s32 operation, struct menuitem *i
|
||||
}
|
||||
} else {
|
||||
// Bank 1
|
||||
if (g_CheatsEnabledBank1 & (1 << item->param)) {
|
||||
if (g_CheatsEnabledBank1 & (1 << (item->param - 32))) {
|
||||
// We need to subtract 32 on lines like these to avoid undefined behavior, namely ensuring that all cheats are toggled correctly and regardless of build optimiaztion
|
||||
if (1);
|
||||
g_CheatsEnabledBank1 = g_CheatsEnabledBank1 & ~(1 << item->param);
|
||||
g_CheatsEnabledBank1 = g_CheatsEnabledBank1 & ~(1 << (item->param - 32));
|
||||
} else {
|
||||
g_CheatsEnabledBank1 = g_CheatsEnabledBank1 | 1 << item->param;
|
||||
g_CheatsEnabledBank1 = g_CheatsEnabledBank1 | (1 << (item->param - 32));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user