summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra/config.cpp17
-rw-r--r--src/citra/config.h5
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp8
-rw-r--r--src/citra_qt/config.cpp52
-rw-r--r--src/citra_qt/config.h11
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp54
-rw-r--r--src/core/hle/kernel/mutex.cpp15
-rw-r--r--src/core/hle/kernel/thread.cpp2
-rw-r--r--src/core/hle/svc.cpp5
9 files changed, 62 insertions, 107 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index f45d09fc2..1f8f5922b 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -36,7 +36,8 @@ bool Config::LoadINI(INIReader* config, const char* location, const std::string&
36 return true; 36 return true;
37} 37}
38 38
39void Config::ReadControls() { 39void Config::ReadValues() {
40 // Controls
40 Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A); 41 Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A);
41 Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S); 42 Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S);
42 Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z); 43 Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z);
@@ -54,27 +55,21 @@ void Config::ReadControls() {
54 Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN); 55 Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN);
55 Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT); 56 Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT);
56 Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); 57 Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
57}
58 58
59void Config::ReadCore() { 59 // Core
60 Settings::values.cpu_core = glfw_config->GetInteger("Core", "cpu_core", Core::CPU_Interpreter); 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); 61 Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 60);
62}
63 62
64void Config::ReadData() { 63 // Data Storage
65 Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); 64 Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
66}
67 65
68void Config::ReadMiscellaneous() { 66 // Miscellaneous
69 Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true); 67 Settings::values.enable_log = glfw_config->GetBoolean("Miscellaneous", "enable_log", true);
70} 68}
71 69
72void Config::Reload() { 70void Config::Reload() {
73 LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file); 71 LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file);
74 ReadControls(); 72 ReadValues();
75 ReadCore();
76 ReadData();
77 ReadMiscellaneous();
78} 73}
79 74
80Config::~Config() { 75Config::~Config() {
diff --git a/src/citra/config.h b/src/citra/config.h
index 19bb83700..2b46fa8aa 100644
--- a/src/citra/config.h
+++ b/src/citra/config.h
@@ -15,10 +15,7 @@ class Config {
15 std::string glfw_config_loc; 15 std::string glfw_config_loc;
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 ReadValues();
19 void ReadCore();
20 void ReadData();
21 void ReadMiscellaneous();
22public: 19public:
23 Config(); 20 Config();
24 ~Config(); 21 ~Config();
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 8efb39e2e..697bf4693 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -58,9 +58,13 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
58 58
59 ReloadSetKeymaps(); 59 ReloadSetKeymaps();
60 60
61 glfwSetErrorCallback([](int error, const char *desc){
62 ERROR_LOG(GUI, "GLFW 0x%08x: %s", error, desc);
63 });
64
61 // Initialize the window 65 // Initialize the window
62 if(glfwInit() != GL_TRUE) { 66 if(glfwInit() != GL_TRUE) {
63 printf("Failed to initialize GLFW! Exiting..."); 67 ERROR_LOG(GUI, "Failed to initialize GLFW! Exiting...");
64 exit(1); 68 exit(1);
65 } 69 }
66 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 70 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
@@ -75,7 +79,7 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
75 window_title.c_str(), NULL, NULL); 79 window_title.c_str(), NULL, NULL);
76 80
77 if (m_render_window == NULL) { 81 if (m_render_window == NULL) {
78 printf("Failed to create GLFW window! Exiting..."); 82 ERROR_LOG(GUI, "Failed to create GLFW window! Exiting...");
79 exit(1); 83 exit(1);
80 } 84 }
81 85
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 09fce4d6f..3209e5900 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -21,7 +21,7 @@ Config::Config() {
21 Reload(); 21 Reload();
22} 22}
23 23
24void Config::ReadControls() { 24void Config::ReadValues() {
25 qt_config->beginGroup("Controls"); 25 qt_config->beginGroup("Controls");
26 Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt(); 26 Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt();
27 Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt(); 27 Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt();
@@ -41,9 +41,22 @@ void Config::ReadControls() {
41 Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt(); 41 Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt();
42 Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt(); 42 Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt();
43 qt_config->endGroup(); 43 qt_config->endGroup();
44
45 qt_config->beginGroup("Core");
46 Settings::values.cpu_core = qt_config->value("cpu_core", Core::CPU_Interpreter).toInt();
47 Settings::values.gpu_refresh_rate = qt_config->value("gpu_refresh_rate", 60).toInt();
48 qt_config->endGroup();
49
50 qt_config->beginGroup("Data Storage");
51 Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
52 qt_config->endGroup();
53
54 qt_config->beginGroup("Miscellaneous");
55 Settings::values.enable_log = qt_config->value("enable_log", true).toBool();
56 qt_config->endGroup();
44} 57}
45 58
46void Config::SaveControls() { 59void Config::SaveValues() {
47 qt_config->beginGroup("Controls"); 60 qt_config->beginGroup("Controls");
48 qt_config->setValue("pad_a", Settings::values.pad_a_key); 61 qt_config->setValue("pad_a", Settings::values.pad_a_key);
49 qt_config->setValue("pad_b", Settings::values.pad_b_key); 62 qt_config->setValue("pad_b", Settings::values.pad_b_key);
@@ -63,58 +76,27 @@ void Config::SaveControls() {
63 qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key); 76 qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key);
64 qt_config->setValue("pad_sright", Settings::values.pad_sright_key); 77 qt_config->setValue("pad_sright", Settings::values.pad_sright_key);
65 qt_config->endGroup(); 78 qt_config->endGroup();
66}
67
68void 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 79
75void Config::SaveCore() {
76 qt_config->beginGroup("Core"); 80 qt_config->beginGroup("Core");
77 qt_config->setValue("cpu_core", Settings::values.cpu_core); 81 qt_config->setValue("cpu_core", Settings::values.cpu_core);
78 qt_config->setValue("gpu_refresh_rate", Settings::values.gpu_refresh_rate); 82 qt_config->setValue("gpu_refresh_rate", Settings::values.gpu_refresh_rate);
79 qt_config->endGroup(); 83 qt_config->endGroup();
80}
81
82void Config::ReadData() {
83 qt_config->beginGroup("Data Storage");
84 Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
85 qt_config->endGroup();
86}
87 84
88void Config::SaveData() {
89 qt_config->beginGroup("Data Storage"); 85 qt_config->beginGroup("Data Storage");
90 qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); 86 qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
91 qt_config->endGroup(); 87 qt_config->endGroup();
92}
93
94void Config::ReadMiscellaneous() {
95 qt_config->beginGroup("Miscellaneous");
96 Settings::values.enable_log = qt_config->value("enable_log", true).toBool();
97 qt_config->endGroup();
98}
99 88
100void Config::SaveMiscellaneous() {
101 qt_config->beginGroup("Miscellaneous"); 89 qt_config->beginGroup("Miscellaneous");
102 qt_config->setValue("enable_log", Settings::values.enable_log); 90 qt_config->setValue("enable_log", Settings::values.enable_log);
103 qt_config->endGroup(); 91 qt_config->endGroup();
104} 92}
105 93
106void Config::Reload() { 94void Config::Reload() {
107 ReadControls(); 95 ReadValues();
108 ReadCore();
109 ReadData();
110 ReadMiscellaneous();
111} 96}
112 97
113void Config::Save() { 98void Config::Save() {
114 SaveControls(); 99 SaveValues();
115 SaveCore();
116 SaveData();
117 SaveMiscellaneous();
118} 100}
119 101
120Config::~Config() { 102Config::~Config() {
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h
index 8c6568cb2..4c95d0cb9 100644
--- a/src/citra_qt/config.h
+++ b/src/citra_qt/config.h
@@ -12,15 +12,8 @@ class Config {
12 QSettings* qt_config; 12 QSettings* qt_config;
13 std::string qt_config_loc; 13 std::string qt_config_loc;
14 14
15 void ReadControls(); 15 void ReadValues();
16 void SaveControls(); 16 void SaveValues();
17 void ReadCore();
18 void SaveCore();
19 void ReadData();
20 void SaveData();
21
22 void ReadMiscellaneous();
23 void SaveMiscellaneous();
24public: 17public:
25 Config(); 18 Config();
26 ~Config(); 19 ~Config();
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index f899e2e8a..233cd3e3a 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -26,7 +26,7 @@
26#define CITRA_IGNORE_EXIT(x) 26#define CITRA_IGNORE_EXIT(x)
27 27
28#include <algorithm> 28#include <algorithm>
29#include <map> 29#include <unordered_map>
30#include <stdio.h> 30#include <stdio.h>
31#include <assert.h> 31#include <assert.h>
32#include <cstdio> 32#include <cstdio>
@@ -94,9 +94,8 @@ typedef unsigned int (*shtop_fp_t)(arm_processor *cpu, unsigned int sht_oper);
94 94
95/* exclusive memory access */ 95/* exclusive memory access */
96static int exclusive_detect(ARMul_State* state, ARMword addr){ 96static int exclusive_detect(ARMul_State* state, ARMword addr){
97 int i;
98 #if 0 97 #if 0
99 for(i = 0; i < 128; i++){ 98 for(int i = 0; i < 128; i++){
100 if(state->exclusive_tag_array[i] == addr) 99 if(state->exclusive_tag_array[i] == addr)
101 return 0; 100 return 0;
102 } 101 }
@@ -108,9 +107,8 @@ static int exclusive_detect(ARMul_State* state, ARMword addr){
108} 107}
109 108
110static void add_exclusive_addr(ARMul_State* state, ARMword addr){ 109static void add_exclusive_addr(ARMul_State* state, ARMword addr){
111 int i;
112 #if 0 110 #if 0
113 for(i = 0; i < 128; i++){ 111 for(int i = 0; i < 128; i++){
114 if(state->exclusive_tag_array[i] == 0xffffffff){ 112 if(state->exclusive_tag_array[i] == 0xffffffff){
115 state->exclusive_tag_array[i] = addr; 113 state->exclusive_tag_array[i] = addr;
116 //DEBUG_LOG(ARM11, "In %s, add addr 0x%x\n", __func__, addr); 114 //DEBUG_LOG(ARM11, "In %s, add addr 0x%x\n", __func__, addr);
@@ -3309,9 +3307,8 @@ const transop_fp_t arm_instruction_trans[] = {
3309 INTERPRETER_TRANSLATE(blx_1_thumb) 3307 INTERPRETER_TRANSLATE(blx_1_thumb)
3310}; 3308};
3311 3309
3312typedef map<unsigned int, int> bb_map; 3310typedef std::unordered_map<u32, int> bb_map;
3313bb_map CreamCache[65536]; 3311bb_map CreamCache;
3314bb_map ProfileCache[65536];
3315 3312
3316//#define USE_DUMMY_CACHE 3313//#define USE_DUMMY_CACHE
3317 3314
@@ -3319,14 +3316,12 @@ bb_map ProfileCache[65536];
3319unsigned int DummyCache[0x100000]; 3316unsigned int DummyCache[0x100000];
3320#endif 3317#endif
3321 3318
3322#define HASH(x) ((x + (x << 3) + (x >> 6)) % 65536)
3323void insert_bb(unsigned int addr, int start) 3319void insert_bb(unsigned int addr, int start)
3324{ 3320{
3325#ifdef USE_DUMMY_CACHE 3321#ifdef USE_DUMMY_CACHE
3326 DummyCache[addr] = start; 3322 DummyCache[addr] = start;
3327#else 3323#else
3328// CreamCache[addr] = start; 3324 CreamCache[addr] = start;
3329 CreamCache[HASH(addr)][addr] = start;
3330#endif 3325#endif
3331} 3326}
3332 3327
@@ -3341,8 +3336,8 @@ int find_bb(unsigned int addr, int &start)
3341 } else 3336 } else
3342 ret = -1; 3337 ret = -1;
3343#else 3338#else
3344 bb_map::const_iterator it = CreamCache[HASH(addr)].find(addr); 3339 bb_map::const_iterator it = CreamCache.find(addr);
3345 if (it != CreamCache[HASH(addr)].end()) { 3340 if (it != CreamCache.end()) {
3346 start = static_cast<int>(it->second); 3341 start = static_cast<int>(it->second);
3347 ret = 0; 3342 ret = 0;
3348#if HYBRID_MODE 3343#if HYBRID_MODE
@@ -3473,30 +3468,15 @@ void flush_bb(uint32_t addr)
3473 uint32_t start; 3468 uint32_t start;
3474 3469
3475 addr &= 0xfffff000; 3470 addr &= 0xfffff000;
3476 for (int i = 0; i < 65536; i ++) { 3471 for (it = CreamCache.begin(); it != CreamCache.end(); ) {
3477 for (it = CreamCache[i].begin(); it != CreamCache[i].end(); ) { 3472 start = static_cast<uint32_t>(it->first);
3478 start = static_cast<uint32_t>(it->first); 3473 //start = (start >> 12) << 12;
3479 //start = (start >> 12) << 12; 3474 start &= 0xfffff000;
3480 start &= 0xfffff000; 3475 if (start == addr) {
3481 if (start == addr) { 3476 //DEBUG_LOG(ARM11, "[ERASE][0x%08x]\n", static_cast<int>(it->first));
3482 //DEBUG_LOG(ARM11, "[ERASE][0x%08x]\n", static_cast<int>(it->first)); 3477 CreamCache.erase(it++);
3483 CreamCache[i].erase(it ++); 3478 } else
3484 } else 3479 ++it;
3485 ++it;
3486 }
3487 }
3488
3489 for (int i = 0; i < 65536; i ++) {
3490 for (it = ProfileCache[i].begin(); it != ProfileCache[i].end(); ) {
3491 start = static_cast<uint32_t>(it->first);
3492 //start = (start >> 12) << 12;
3493 start &= 0xfffff000;
3494 if (start == addr) {
3495 //DEBUG_LOG(ARM11, "[ERASE][0x%08x]\n", static_cast<int>(it->first));
3496 ProfileCache[i].erase(it ++);
3497 } else
3498 ++it;
3499 }
3500 } 3480 }
3501 3481
3502 //DEBUG_LOG(ARM11, "flush bb @ %x\n", addr); 3482 //DEBUG_LOG(ARM11, "flush bb @ %x\n", addr);
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index b303ba128..d07e9761b 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -88,20 +88,19 @@ bool ReleaseMutexForThread(Mutex* mutex, Handle thread) {
88 88
89bool ReleaseMutex(Mutex* mutex) { 89bool ReleaseMutex(Mutex* mutex) {
90 MutexEraseLock(mutex); 90 MutexEraseLock(mutex);
91 bool woke_threads = false;
92 91
93 // Find the next waiting thread for the mutex... 92 // Find the next waiting thread for the mutex...
94 while (!woke_threads && !mutex->waiting_threads.empty()) { 93 while (!mutex->waiting_threads.empty()) {
95 std::vector<Handle>::iterator iter = mutex->waiting_threads.begin(); 94 std::vector<Handle>::iterator iter = mutex->waiting_threads.begin();
96 woke_threads |= ReleaseMutexForThread(mutex, *iter); 95 ReleaseMutexForThread(mutex, *iter);
97 mutex->waiting_threads.erase(iter); 96 mutex->waiting_threads.erase(iter);
98 } 97 }
98
99 // Reset mutex lock thread handle, nothing is waiting 99 // Reset mutex lock thread handle, nothing is waiting
100 if (!woke_threads) { 100 mutex->locked = false;
101 mutex->locked = false; 101 mutex->lock_thread = -1;
102 mutex->lock_thread = -1; 102
103 } 103 return true;
104 return woke_threads;
105} 104}
106 105
107/** 106/**
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index f3f54a4e9..f59795901 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -143,7 +143,7 @@ void ChangeReadyState(Thread* t, bool ready) {
143/// Verify that a thread has not been released from waiting 143/// Verify that a thread has not been released from waiting
144inline bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) { 144inline bool VerifyWait(const Thread* thread, WaitType type, Handle wait_handle) {
145 _dbg_assert_(KERNEL, thread != nullptr); 145 _dbg_assert_(KERNEL, thread != nullptr);
146 return type == thread->wait_type && wait_handle == thread->wait_handle; 146 return (type == thread->wait_type) && (wait_handle == thread->wait_handle) && (thread->IsWaiting());
147} 147}
148 148
149/// Stops the current thread 149/// Stops the current thread
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 87d768856..43a3cbe03 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -189,6 +189,8 @@ static Result CreateAddressArbiter(u32* arbiter) {
189 189
190/// Arbitrate address 190/// Arbitrate address
191static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { 191static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) {
192 DEBUG_LOG(SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter,
193 address, type, value);
192 return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), 194 return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type),
193 address, value).raw; 195 address, value).raw;
194} 196}
@@ -331,6 +333,9 @@ static Result ClearEvent(Handle evt) {
331/// Sleep the current thread 333/// Sleep the current thread
332static void SleepThread(s64 nanoseconds) { 334static void SleepThread(s64 nanoseconds) {
333 DEBUG_LOG(SVC, "called nanoseconds=%lld", nanoseconds); 335 DEBUG_LOG(SVC, "called nanoseconds=%lld", nanoseconds);
336
337 // Check for next thread to schedule
338 HLE::Reschedule(__func__);
334} 339}
335 340
336/// This returns the total CPU ticks elapsed since the CPU was powered-on 341/// This returns the total CPU ticks elapsed since the CPU was powered-on