Merge pull request #151 from archshift/dyncom-enabled

Use configuration files to enable or disable the new dyncom interpreter.
This commit is contained in:
bunnei 2014-10-27 22:51:10 -04:00
commit 48f80bb79e
10 changed files with 63 additions and 7 deletions

View file

@ -7,6 +7,7 @@
#include "citra/default_ini.h" #include "citra/default_ini.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "core/settings.h" #include "core/settings.h"
#include "core/core.h"
#include "config.h" #include "config.h"
@ -55,6 +56,11 @@ void Config::ReadControls() {
Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
} }
void Config::ReadCore() {
Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter);
Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 60);
}
void Config::ReadData() { void Config::ReadData() {
Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
} }
@ -62,6 +68,7 @@ void Config::ReadData() {
void Config::Reload() { void Config::Reload() {
LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file); LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file);
ReadControls(); ReadControls();
ReadCore();
ReadData(); ReadData();
} }

View file

@ -16,6 +16,7 @@ class Config {
bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true); bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true);
void ReadControls(); void ReadControls();
void ReadCore();
void ReadData(); void ReadData();
public: public:
Config(); Config();

View file

@ -26,6 +26,10 @@ pad_sdown =
pad_sleft = pad_sleft =
pad_sright = pad_sright =
[Core]
cpu_core = ## 0: Interpreter (default), 1: FastInterpreter (experimental)
gpu_refresh_rate = ## 60 (default), 1024 or 2048 may work better on the FastInterpreter
[Data Storage] [Data Storage]
use_virtual_sd = use_virtual_sd =
)"; )";

View file

@ -6,6 +6,7 @@
#include <QStringList> #include <QStringList>
#include "core/settings.h" #include "core/settings.h"
#include "core/core.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "config.h" #include "config.h"
@ -64,6 +65,20 @@ void Config::SaveControls() {
qt_config->endGroup(); qt_config->endGroup();
} }
void Config::ReadCore() {
qt_config->beginGroup("Core");
Settings::values.cpu_core = qt_config->value("cpu_core", Core::CPU_Interpreter).toInt();
Settings::values.gpu_refresh_rate = qt_config->value("gpu_refresh_rate", 60).toInt();
qt_config->endGroup();
}
void Config::SaveCore() {
qt_config->beginGroup("Core");
qt_config->setValue("cpu_core", Settings::values.cpu_core);
qt_config->setValue("gpu_refresh_rate", Settings::values.gpu_refresh_rate);
qt_config->endGroup();
}
void Config::ReadData() { void Config::ReadData() {
qt_config->beginGroup("Data Storage"); qt_config->beginGroup("Data Storage");
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
@ -78,11 +93,13 @@ void Config::SaveData() {
void Config::Reload() { void Config::Reload() {
ReadControls(); ReadControls();
ReadCore();
ReadData(); ReadData();
} }
void Config::Save() { void Config::Save() {
SaveControls(); SaveControls();
SaveCore();
SaveData(); SaveData();
} }

View file

@ -14,7 +14,8 @@ class Config {
void ReadControls(); void ReadControls();
void SaveControls(); void SaveControls();
void ReadCore();
void SaveCore();
void ReadData(); void ReadData();
void SaveData(); void SaveData();
public: public:

View file

@ -5,12 +5,14 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
#include "core/hw/hw.h"
#include "core/settings.h"
#include "core/arm/disassembler/arm_disasm.h" #include "core/arm/disassembler/arm_disasm.h"
#include "core/arm/interpreter/arm_interpreter.h" #include "core/arm/interpreter/arm_interpreter.h"
#include "core/arm/dyncom/arm_dyncom.h"
#include "core/hle/hle.h" #include "core/hle/hle.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hw/hw.h"
namespace Core { namespace Core {
@ -48,9 +50,18 @@ int Init() {
NOTICE_LOG(MASTER_LOG, "initialized OK"); NOTICE_LOG(MASTER_LOG, "initialized OK");
g_disasm = new ARM_Disasm(); g_disasm = new ARM_Disasm();
g_app_core = new ARM_Interpreter();
g_sys_core = new ARM_Interpreter(); g_sys_core = new ARM_Interpreter();
switch (Settings::values.cpu_core) {
case CPU_FastInterpreter:
g_app_core = new ARM_DynCom();
break;
case CPU_Interpreter:
default:
g_app_core = new ARM_Interpreter();
break;
}
g_last_ticks = Core::g_app_core->GetTicks(); g_last_ticks = Core::g_app_core->GetTicks();
return 0; return 0;

View file

@ -11,6 +11,11 @@
namespace Core { namespace Core {
enum CPUCore {
CPU_Interpreter,
CPU_FastInterpreter
};
extern ARM_Interface* g_app_core; ///< ARM11 application core extern ARM_Interface* g_app_core; ///< ARM11 application core
extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core

View file

@ -4,6 +4,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/settings.h"
#include "core/core.h" #include "core/core.h"
#include "core/mem_map.h" #include "core/mem_map.h"
@ -24,6 +25,9 @@ u32 g_cur_line = 0; ///< Current vertical screen line
u64 g_last_line_ticks = 0; ///< CPU tick count from last vertical screen line u64 g_last_line_ticks = 0; ///< CPU tick count from last vertical screen line
u64 g_last_frame_ticks = 0; ///< CPU tick count from last frame u64 g_last_frame_ticks = 0; ///< CPU tick count from last frame
static u32 kFrameCycles = 0; ///< 268MHz / 60 frames per second
static u32 kFrameTicks = 0; ///< Approximate number of instructions/frame
template <typename T> template <typename T>
inline void Read(T &var, const u32 raw_addr) { inline void Read(T &var, const u32 raw_addr) {
u32 addr = raw_addr - 0x1EF00000; u32 addr = raw_addr - 0x1EF00000;
@ -214,6 +218,9 @@ void Update() {
/// Initialize hardware /// Initialize hardware
void Init() { void Init() {
kFrameCycles = 268123480 / Settings::values.gpu_refresh_rate;
kFrameTicks = kFrameCycles / 3;
g_cur_line = 0; g_cur_line = 0;
g_last_frame_ticks = g_last_line_ticks = Core::g_app_core->GetTicks(); g_last_frame_ticks = g_last_line_ticks = Core::g_app_core->GetTicks();

View file

@ -11,9 +11,6 @@
namespace GPU { namespace GPU {
static const u32 kFrameCycles = 268123480 / 60; ///< 268MHz / 60 frames per second
static const u32 kFrameTicks = kFrameCycles / 3; ///< Approximate number of instructions/frame
// Returns index corresponding to the Regs member labeled by field_name // Returns index corresponding to the Regs member labeled by field_name
// TODO: Due to Visual studio bug 209229, offsetof does not return constant expressions // TODO: Due to Visual studio bug 209229, offsetof does not return constant expressions
// when used with array elements (e.g. GPU_REG_INDEX(memory_fill_config[0])). // when used with array elements (e.g. GPU_REG_INDEX(memory_fill_config[0])).

View file

@ -7,6 +7,7 @@
namespace Settings { namespace Settings {
struct Values { struct Values {
// Controls
int pad_a_key; int pad_a_key;
int pad_b_key; int pad_b_key;
int pad_x_key; int pad_x_key;
@ -25,6 +26,11 @@ struct Values {
int pad_sleft_key; int pad_sleft_key;
int pad_sright_key; int pad_sright_key;
// Core
int cpu_core;
int gpu_refresh_rate;
// Data Storage
bool use_virtual_sd; bool use_virtual_sd;
} extern values; } extern values;