mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Fix cheat detection when using Scenario Options in-game, rename sub_69E869()
This commit is contained in:
@@ -462,7 +462,7 @@ static int editor_read_s6(const char *path)
|
||||
|
||||
RCT2_GLOBAL(0x013573DC, uint32) = min(RCT2_GLOBAL(0x013573DC, uint32), 100000);
|
||||
finance_reset_cash_to_initial();
|
||||
sub_69E869();
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = clamp(
|
||||
MONEY(0,00),
|
||||
|
||||
@@ -776,7 +776,7 @@ int game_load_save(const char *path)
|
||||
window_new_ride_init_vars();
|
||||
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
|
||||
if (RCT2_GLOBAL(0x0013587C4, uint32) == 0) // this check is not in scenario play
|
||||
sub_69E869();
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
|
||||
load_palette();
|
||||
gfx_invalidate_screen();
|
||||
|
||||
@@ -188,7 +188,7 @@ void finance_init() {
|
||||
|
||||
RCT2_GLOBAL(0x013587D8, uint16) = 0x3F;
|
||||
|
||||
sub_69E869();
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,9 +243,9 @@ void finance_update_daily_profit()
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
}
|
||||
|
||||
void sub_69E869()
|
||||
// This subroutine is used to mark loan changes as 'legitimate', to prevent cheat detection from incorrectly interfering
|
||||
void finance_mark_loan_settings_as_legitimate()
|
||||
{
|
||||
// This subroutine is loan related and is used for cheat detection
|
||||
sint32 value = 0x70093A;
|
||||
value -= RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32);
|
||||
value = ror32(value, 5);
|
||||
@@ -314,7 +314,7 @@ void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int*
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = newLoan;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) = money;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(money);
|
||||
sub_69E869();
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
RCT2_GLOBAL(0x009A9804, uint16) |= 1;
|
||||
|
||||
@@ -61,7 +61,7 @@ void finance_reset_history();
|
||||
void finance_init();
|
||||
void finance_update_daily_profit();
|
||||
void finance_shift_expenditure_table();
|
||||
void sub_69E869();
|
||||
void finance_mark_loan_settings_as_legitimate();
|
||||
void finance_reset_cash_to_initial();
|
||||
|
||||
void finance_set_loan(money32 loan);
|
||||
@@ -71,4 +71,4 @@ money32 finance_get_maximum_loan();
|
||||
money32 finance_get_current_cash();
|
||||
void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -259,7 +259,7 @@ void rct1_fix_landscape()
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32)
|
||||
);
|
||||
finance_reset_cash_to_initial();
|
||||
sub_69E869();
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = clamp(
|
||||
MONEY(0,00),
|
||||
|
||||
@@ -276,7 +276,7 @@ void scenario_begin()
|
||||
RCT2_GLOBAL(0x013587D0, money32) = RCT2_GLOBAL(0x013573DC, money32) - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(RCT2_GLOBAL(0x013573DC, sint32));
|
||||
|
||||
sub_69E869(); // (loan related)
|
||||
finance_mark_loan_settings_as_legitimate(); // (loan related)
|
||||
|
||||
strcpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, s6Info->details);
|
||||
strcpy((char*)RCT2_ADDRESS_SCENARIO_NAME, s6Info->name);
|
||||
@@ -315,7 +315,7 @@ void scenario_begin()
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TOTAL_ADMISSIONS, uint32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, uint32) = 0;
|
||||
RCT2_GLOBAL(0x013587D8, uint16) = 63;
|
||||
sub_69E869(); // (loan related, called above already)
|
||||
finance_mark_loan_settings_as_legitimate(); // (loan related, called above already)
|
||||
park_reset_history();
|
||||
finance_reset_history();
|
||||
award_reset();
|
||||
|
||||
@@ -485,7 +485,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) < MONEY(1000000,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) += MONEY(500,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
sub_69E869();
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
} else {
|
||||
window_error_open(3248, STR_NONE);
|
||||
}
|
||||
@@ -495,7 +495,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) > MONEY(0,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) -= MONEY(500,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
sub_69E869();
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
} else {
|
||||
window_error_open(3249, STR_NONE);
|
||||
}
|
||||
@@ -505,6 +505,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) < MONEY(5000000,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) += MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
} else {
|
||||
window_error_open(3250, STR_NONE);
|
||||
}
|
||||
@@ -514,6 +515,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) > MONEY(0,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) -= MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
} else {
|
||||
window_error_open(3251, STR_NONE);
|
||||
}
|
||||
@@ -523,6 +525,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) < MONEY(5000000,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) += MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = min(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
} else {
|
||||
window_error_open(3252, STR_NONE);
|
||||
}
|
||||
@@ -532,6 +535,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) > MONEY(0,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) -= MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = min(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_mark_loan_settings_as_legitimate();
|
||||
} else {
|
||||
window_error_open(3253, STR_NONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user