diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/citra/config.cpp | 7 | ||||
| -rw-r--r-- | src/citra/config.h | 1 | ||||
| -rw-r--r-- | src/citra/default_ini.h | 4 | ||||
| -rw-r--r-- | src/citra_qt/config.cpp | 17 | ||||
| -rw-r--r-- | src/citra_qt/config.h | 3 | ||||
| -rw-r--r-- | src/core/core.cpp | 17 | ||||
| -rw-r--r-- | src/core/core.h | 5 | ||||
| -rw-r--r-- | src/core/hw/gpu.cpp | 7 | ||||
| -rw-r--r-- | src/core/hw/gpu.h | 3 | ||||
| -rw-r--r-- | src/core/settings.h | 6 |
10 files changed, 63 insertions, 7 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 03a0ce606..c5ce8a164 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "citra/default_ini.h" | 7 | #include "citra/default_ini.h" |
| 8 | #include "common/file_util.h" | 8 | #include "common/file_util.h" |
| 9 | #include "core/settings.h" | 9 | #include "core/settings.h" |
| 10 | #include "core/core.h" | ||
| 10 | 11 | ||
| 11 | #include "config.h" | 12 | #include "config.h" |
| 12 | 13 | ||
| @@ -55,6 +56,11 @@ void Config::ReadControls() { | |||
| 55 | Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); | 56 | Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 59 | void Config::ReadCore() { | ||
| 60 | Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter); | ||
| 61 | Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 60); | ||
| 62 | } | ||
| 63 | |||
| 58 | void Config::ReadData() { | 64 | void Config::ReadData() { |
| 59 | Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); | 65 | Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); |
| 60 | } | 66 | } |
| @@ -62,6 +68,7 @@ void Config::ReadData() { | |||
| 62 | void Config::Reload() { | 68 | void Config::Reload() { |
| 63 | LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file); | 69 | LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file); |
| 64 | ReadControls(); | 70 | ReadControls(); |
| 71 | ReadCore(); | ||
| 65 | ReadData(); | 72 | ReadData(); |
| 66 | } | 73 | } |
| 67 | 74 | ||
diff --git a/src/citra/config.h b/src/citra/config.h index c4fac2459..4f6551876 100644 --- a/src/citra/config.h +++ b/src/citra/config.h | |||
| @@ -16,6 +16,7 @@ class Config { | |||
| 16 | 16 | ||
| 17 | bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true); | 17 | bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true); |
| 18 | void ReadControls(); | 18 | void ReadControls(); |
| 19 | void ReadCore(); | ||
| 19 | void ReadData(); | 20 | void ReadData(); |
| 20 | public: | 21 | public: |
| 21 | Config(); | 22 | Config(); |
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index e7e45f4a9..7352c70c2 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h | |||
| @@ -26,6 +26,10 @@ pad_sdown = | |||
| 26 | pad_sleft = | 26 | pad_sleft = |
| 27 | pad_sright = | 27 | pad_sright = |
| 28 | 28 | ||
| 29 | [Core] | ||
| 30 | cpu_core = ## 0: Interpreter (default), 1: FastInterpreter (experimental) | ||
| 31 | gpu_refresh_rate = ## 60 (default), 1024 or 2048 may work better on the FastInterpreter | ||
| 32 | |||
| 29 | [Data Storage] | 33 | [Data Storage] |
| 30 | use_virtual_sd = | 34 | use_virtual_sd = |
| 31 | )"; | 35 | )"; |
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 0c4f75a96..63d396439 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <QStringList> | 6 | #include <QStringList> |
| 7 | 7 | ||
| 8 | #include "core/settings.h" | 8 | #include "core/settings.h" |
| 9 | #include "core/core.h" | ||
| 9 | #include "common/file_util.h" | 10 | #include "common/file_util.h" |
| 10 | 11 | ||
| 11 | #include "config.h" | 12 | #include "config.h" |
| @@ -64,6 +65,20 @@ void Config::SaveControls() { | |||
| 64 | qt_config->endGroup(); | 65 | qt_config->endGroup(); |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 68 | void Config::ReadCore() { | ||
| 69 | qt_config->beginGroup("Core"); | ||
| 70 | Settings::values.cpu_core = qt_config->value("cpu_core", Core::CPU_Interpreter).toInt(); | ||
| 71 | Settings::values.gpu_refresh_rate = qt_config->value("gpu_refresh_rate", 60).toInt(); | ||
| 72 | qt_config->endGroup(); | ||
| 73 | } | ||
| 74 | |||
| 75 | void Config::SaveCore() { | ||
| 76 | qt_config->beginGroup("Core"); | ||
| 77 | qt_config->setValue("cpu_core", Settings::values.cpu_core); | ||
| 78 | qt_config->setValue("gpu_refresh_rate", Settings::values.gpu_refresh_rate); | ||
| 79 | qt_config->endGroup(); | ||
| 80 | } | ||
| 81 | |||
| 67 | void Config::ReadData() { | 82 | void Config::ReadData() { |
| 68 | qt_config->beginGroup("Data Storage"); | 83 | qt_config->beginGroup("Data Storage"); |
| 69 | Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); | 84 | Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); |
| @@ -78,11 +93,13 @@ void Config::SaveData() { | |||
| 78 | 93 | ||
| 79 | void Config::Reload() { | 94 | void Config::Reload() { |
| 80 | ReadControls(); | 95 | ReadControls(); |
| 96 | ReadCore(); | ||
| 81 | ReadData(); | 97 | ReadData(); |
| 82 | } | 98 | } |
| 83 | 99 | ||
| 84 | void Config::Save() { | 100 | void Config::Save() { |
| 85 | SaveControls(); | 101 | SaveControls(); |
| 102 | SaveCore(); | ||
| 86 | SaveData(); | 103 | SaveData(); |
| 87 | } | 104 | } |
| 88 | 105 | ||
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h index 74c9ff11d..782c26287 100644 --- a/src/citra_qt/config.h +++ b/src/citra_qt/config.h | |||
| @@ -14,7 +14,8 @@ class Config { | |||
| 14 | 14 | ||
| 15 | void ReadControls(); | 15 | void ReadControls(); |
| 16 | void SaveControls(); | 16 | void SaveControls(); |
| 17 | 17 | void ReadCore(); | |
| 18 | void SaveCore(); | ||
| 18 | void ReadData(); | 19 | void ReadData(); |
| 19 | void SaveData(); | 20 | void SaveData(); |
| 20 | public: | 21 | public: |
diff --git a/src/core/core.cpp b/src/core/core.cpp index 01d4f0afa..25c78d33c 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -5,12 +5,14 @@ | |||
| 5 | #include "common/common_types.h" | 5 | #include "common/common_types.h" |
| 6 | 6 | ||
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/hw/hw.h" | 8 | |
| 9 | #include "core/settings.h" | ||
| 9 | #include "core/arm/disassembler/arm_disasm.h" | 10 | #include "core/arm/disassembler/arm_disasm.h" |
| 10 | #include "core/arm/interpreter/arm_interpreter.h" | 11 | #include "core/arm/interpreter/arm_interpreter.h" |
| 11 | 12 | #include "core/arm/dyncom/arm_dyncom.h" | |
| 12 | #include "core/hle/hle.h" | 13 | #include "core/hle/hle.h" |
| 13 | #include "core/hle/kernel/thread.h" | 14 | #include "core/hle/kernel/thread.h" |
| 15 | #include "core/hw/hw.h" | ||
| 14 | 16 | ||
| 15 | namespace Core { | 17 | namespace Core { |
| 16 | 18 | ||
| @@ -48,9 +50,18 @@ int Init() { | |||
| 48 | NOTICE_LOG(MASTER_LOG, "initialized OK"); | 50 | NOTICE_LOG(MASTER_LOG, "initialized OK"); |
| 49 | 51 | ||
| 50 | g_disasm = new ARM_Disasm(); | 52 | g_disasm = new ARM_Disasm(); |
| 51 | g_app_core = new ARM_Interpreter(); | ||
| 52 | g_sys_core = new ARM_Interpreter(); | 53 | g_sys_core = new ARM_Interpreter(); |
| 53 | 54 | ||
| 55 | switch (Settings::values.cpu_core) { | ||
| 56 | case CPU_FastInterpreter: | ||
| 57 | g_app_core = new ARM_DynCom(); | ||
| 58 | break; | ||
| 59 | case CPU_Interpreter: | ||
| 60 | default: | ||
| 61 | g_app_core = new ARM_Interpreter(); | ||
| 62 | break; | ||
| 63 | } | ||
| 64 | |||
| 54 | g_last_ticks = Core::g_app_core->GetTicks(); | 65 | g_last_ticks = Core::g_app_core->GetTicks(); |
| 55 | 66 | ||
| 56 | return 0; | 67 | return 0; |
diff --git a/src/core/core.h b/src/core/core.h index 87da252b8..872dc0cd1 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -11,6 +11,11 @@ | |||
| 11 | 11 | ||
| 12 | namespace Core { | 12 | namespace Core { |
| 13 | 13 | ||
| 14 | enum CPUCore { | ||
| 15 | CPU_Interpreter, | ||
| 16 | CPU_FastInterpreter | ||
| 17 | }; | ||
| 18 | |||
| 14 | extern ARM_Interface* g_app_core; ///< ARM11 application core | 19 | extern ARM_Interface* g_app_core; ///< ARM11 application core |
| 15 | extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core | 20 | extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core |
| 16 | 21 | ||
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 33a0e0fe7..76dbe3fdc 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/common_types.h" | 5 | #include "common/common_types.h" |
| 6 | 6 | ||
| 7 | #include "core/settings.h" | ||
| 7 | #include "core/core.h" | 8 | #include "core/core.h" |
| 8 | #include "core/mem_map.h" | 9 | #include "core/mem_map.h" |
| 9 | 10 | ||
| @@ -24,6 +25,9 @@ u32 g_cur_line = 0; ///< Current vertical screen line | |||
| 24 | u64 g_last_line_ticks = 0; ///< CPU tick count from last vertical screen line | 25 | u64 g_last_line_ticks = 0; ///< CPU tick count from last vertical screen line |
| 25 | u64 g_last_frame_ticks = 0; ///< CPU tick count from last frame | 26 | u64 g_last_frame_ticks = 0; ///< CPU tick count from last frame |
| 26 | 27 | ||
| 28 | static u32 kFrameCycles = 0; ///< 268MHz / 60 frames per second | ||
| 29 | static u32 kFrameTicks = 0; ///< Approximate number of instructions/frame | ||
| 30 | |||
| 27 | template <typename T> | 31 | template <typename T> |
| 28 | inline void Read(T &var, const u32 raw_addr) { | 32 | inline void Read(T &var, const u32 raw_addr) { |
| 29 | u32 addr = raw_addr - 0x1EF00000; | 33 | u32 addr = raw_addr - 0x1EF00000; |
| @@ -214,6 +218,9 @@ void Update() { | |||
| 214 | 218 | ||
| 215 | /// Initialize hardware | 219 | /// Initialize hardware |
| 216 | void Init() { | 220 | void Init() { |
| 221 | kFrameCycles = 268123480 / Settings::values.gpu_refresh_rate; | ||
| 222 | kFrameTicks = kFrameCycles / 3; | ||
| 223 | |||
| 217 | g_cur_line = 0; | 224 | g_cur_line = 0; |
| 218 | g_last_frame_ticks = g_last_line_ticks = Core::g_app_core->GetTicks(); | 225 | g_last_frame_ticks = g_last_line_ticks = Core::g_app_core->GetTicks(); |
| 219 | 226 | ||
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h index 92097d182..3fa7b9ccf 100644 --- a/src/core/hw/gpu.h +++ b/src/core/hw/gpu.h | |||
| @@ -11,9 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | namespace GPU { | 12 | namespace GPU { |
| 13 | 13 | ||
| 14 | static const u32 kFrameCycles = 268123480 / 60; ///< 268MHz / 60 frames per second | ||
| 15 | static const u32 kFrameTicks = kFrameCycles / 3; ///< Approximate number of instructions/frame | ||
| 16 | |||
| 17 | // Returns index corresponding to the Regs member labeled by field_name | 14 | // Returns index corresponding to the Regs member labeled by field_name |
| 18 | // TODO: Due to Visual studio bug 209229, offsetof does not return constant expressions | 15 | // TODO: Due to Visual studio bug 209229, offsetof does not return constant expressions |
| 19 | // when used with array elements (e.g. GPU_REG_INDEX(memory_fill_config[0])). | 16 | // when used with array elements (e.g. GPU_REG_INDEX(memory_fill_config[0])). |
diff --git a/src/core/settings.h b/src/core/settings.h index d586e2ef4..6a6265e18 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | namespace Settings { | 7 | namespace Settings { |
| 8 | 8 | ||
| 9 | struct Values { | 9 | struct Values { |
| 10 | // Controls | ||
| 10 | int pad_a_key; | 11 | int pad_a_key; |
| 11 | int pad_b_key; | 12 | int pad_b_key; |
| 12 | int pad_x_key; | 13 | int pad_x_key; |
| @@ -25,6 +26,11 @@ struct Values { | |||
| 25 | int pad_sleft_key; | 26 | int pad_sleft_key; |
| 26 | int pad_sright_key; | 27 | int pad_sright_key; |
| 27 | 28 | ||
| 29 | // Core | ||
| 30 | int cpu_core; | ||
| 31 | int gpu_refresh_rate; | ||
| 32 | |||
| 33 | // Data Storage | ||
| 28 | bool use_virtual_sd; | 34 | bool use_virtual_sd; |
| 29 | } extern values; | 35 | } extern values; |
| 30 | 36 | ||