mirror of
https://github.com/Gericom/GBARunner3.git
synced 2025-06-18 11:15:39 -04:00
Improved consistency and readability of the code
This commit is contained in:
parent
66d6a3e313
commit
340ee2b120
@ -26,9 +26,9 @@
|
||||
#define KEY_RUN_SETTINGS_ENABLE_WRAM_ICACHE "enableWramICache"
|
||||
#define KEY_RUN_SETTINGS_ENABLE_IWRAM_DCACHE "enableIWramDCache"
|
||||
#define KEY_RUN_SETTINGS_ENABLE_EWRAM_DCACHE "enableEWramDCache"
|
||||
#define KEY_RUN_SETTINGS_ARM9_CLOCK_SPEED "forceDSModeArm9Clock"
|
||||
#define KEY_RUN_SETTINGS_SELF_MODIFYING_PATCH_ADDRESSES "selfModifyingPatchAddresses"
|
||||
#define KEY_RUN_SETTINGS_SKIP_BIOS_INTRO "skipBiosIntro"
|
||||
#define KEY_RUN_SETTINGS_ARM9_CLOCK_SPEED "forceDSArm9Clock"
|
||||
|
||||
#define KEY_GAME_SETTINGS "gameSettings"
|
||||
#define KEY_GAME_SETTINGS_SAVE_TYPE "saveType"
|
||||
@ -194,16 +194,6 @@ static bool tryParseSelfModifyingPatchAddresses(const JsonArrayConst& selfModify
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool tryParseArm9ClockSpeed(bool forceDSArm9Clock, ScfgArm9Clock& forceDSArm9ClockSpeed)
|
||||
{
|
||||
if (forceDSArm9Clock)
|
||||
forceDSArm9ClockSpeed = ScfgArm9Clock::Nitro67MHz;
|
||||
else
|
||||
forceDSArm9ClockSpeed = ScfgArm9Clock::Twl134MHz;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void readRunSettings(const JsonObjectConst& json, RunSettings& runSettings)
|
||||
{
|
||||
if (json.isNull())
|
||||
@ -214,9 +204,9 @@ static void readRunSettings(const JsonObjectConst& json, RunSettings& runSetting
|
||||
readBoolSetting(json[KEY_RUN_SETTINGS_ENABLE_WRAM_ICACHE], runSettings.enableWramInstructionCache);
|
||||
readBoolSetting(json[KEY_RUN_SETTINGS_ENABLE_IWRAM_DCACHE], runSettings.enableIWramDataCache);
|
||||
readBoolSetting(json[KEY_RUN_SETTINGS_ENABLE_EWRAM_DCACHE], runSettings.enableEWramDataCache);
|
||||
readBoolSetting(json[KEY_RUN_SETTINGS_ARM9_CLOCK_SPEED], runSettings.forceDSModeArm9ClockSpeed);
|
||||
tryParseSelfModifyingPatchAddresses(json[KEY_RUN_SETTINGS_SELF_MODIFYING_PATCH_ADDRESSES], runSettings);
|
||||
readBoolSetting(json[KEY_RUN_SETTINGS_SKIP_BIOS_INTRO], runSettings.skipBiosIntro);
|
||||
tryParseArm9ClockSpeed(json[KEY_RUN_SETTINGS_ARM9_CLOCK_SPEED], runSettings.forceDSArm9ClockSpeed);
|
||||
}
|
||||
|
||||
static void readGameSettings(const JsonObjectConst& json, GameSettings& gameSettings)
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include <memory>
|
||||
#include "arm9Clock.h"
|
||||
|
||||
class RunSettings
|
||||
{
|
||||
@ -24,12 +23,12 @@ public:
|
||||
/// @brief Specifies whether the data cache should be enabled on ewram.
|
||||
bool16 enableEWramDataCache = true;
|
||||
|
||||
/// @brief Specifies whether the console clockspeed is forced to 67MHz mode in DSi mode.
|
||||
ScfgArm9Clock forceDSArm9ClockSpeed = ScfgArm9Clock::Twl134MHz;
|
||||
|
||||
/// @brief Specifies whether the data cache should be enabled on iwram.
|
||||
bool16 enableIWramDataCache = false;
|
||||
|
||||
/// @brief Specifies whether the Arm9 CPU clockspeed is forced to 67MHz in DSi mode.
|
||||
bool16 forceDSModeArm9ClockSpeed = false;
|
||||
|
||||
/// @brief Specifies the rom addresses of instructions that perform a self-modifying write and that should be patched.
|
||||
std::unique_ptr<u32[]> selfModifyingPatchAddresses;
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "Emulator/BootAnimationSkip.h"
|
||||
#include "MemoryEmulator/Arm/ArmDispatchTable.h"
|
||||
#include "VirtualMachine/VMUndefinedArmTable.h"
|
||||
#include "arm9Clock.h"
|
||||
#include "Arm9Clock.h"
|
||||
|
||||
#define DEFAULT_ROM_FILE_PATH "/rom.gba"
|
||||
#define BIOS_FILE_PATH "/_gba/bios.bin"
|
||||
@ -356,10 +356,14 @@ static void setupEWramDataCache()
|
||||
mpu_setRegionDataBufferability(MPU_REGION_GBA_EWRAM, false);
|
||||
}
|
||||
|
||||
static void setupForceDSArm9Clock()
|
||||
static void setupArm9Clock()
|
||||
{
|
||||
const auto& runSettings = gAppSettingsService.GetAppSettings().runSettings;
|
||||
scfg_setArm9Clock(runSettings.forceDSArm9ClockSpeed);
|
||||
ScfgArm9Clock arm9Clock = runSettings.forceDSModeArm9ClockSpeed
|
||||
? ScfgArm9Clock::Nitro67MHz // Force DS mode clock if true
|
||||
: ScfgArm9Clock::Twl134MHz;
|
||||
|
||||
scfg_setArm9Clock(arm9Clock);
|
||||
}
|
||||
|
||||
static void loadGameSpecificSettings()
|
||||
@ -519,7 +523,7 @@ extern "C" void gbaRunnerMain(int argc, char* argv[])
|
||||
setupRomInstructionCache();
|
||||
setupIWramDataCache();
|
||||
setupEWramDataCache();
|
||||
setupForceDSArm9Clock();
|
||||
setupArm9Clock();
|
||||
|
||||
rtos_setIrqMask(RTOS_IRQ_VBLANK);
|
||||
rtos_ackIrqMask(~0u);
|
||||
|
@ -6,6 +6,6 @@
|
||||
"0x0815A56C",
|
||||
"0x0815A578"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -6,6 +6,6 @@
|
||||
"0x08159F6C",
|
||||
"0x08159F78"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -4,6 +4,6 @@
|
||||
"0x080000C4",
|
||||
"0x080000D0"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -4,6 +4,6 @@
|
||||
"0x080000C4",
|
||||
"0x080000D0"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -4,6 +4,6 @@
|
||||
"0x080000C4",
|
||||
"0x080000D0"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -17,6 +17,6 @@
|
||||
"0x080BE314",
|
||||
"0x080BE324"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -4,6 +4,6 @@
|
||||
"0x080000C4",
|
||||
"0x080000D0"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -10,6 +10,6 @@
|
||||
"0x08F9F7F8",
|
||||
"0x08F9F804"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
@ -10,6 +10,6 @@
|
||||
"0x080001FC",
|
||||
"0x0800020C"
|
||||
],
|
||||
"forceDSArm9Clock": true
|
||||
"forceDSModeArm9Clock": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user