summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra/CMakeLists.txt5
-rw-r--r--src/citra/citra.cpp9
-rw-r--r--src/citra/config.cpp65
-rw-r--r--src/citra/config.h24
-rw-r--r--src/citra/default_ini.h30
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp47
-rw-r--r--src/citra/emu_window/emu_window_glfw.h6
-rw-r--r--src/citra_qt/CMakeLists.txt2
-rw-r--r--src/citra_qt/bootmanager.cpp54
-rw-r--r--src/citra_qt/bootmanager.hxx3
-rw-r--r--src/citra_qt/config.cpp79
-rw-r--r--src/citra_qt/config.h23
-rw-r--r--src/citra_qt/main.cpp5
-rw-r--r--src/common/common_paths.h44
-rw-r--r--src/common/emu_window.h10
-rw-r--r--src/common/file_util.cpp72
-rw-r--r--src/common/file_util.h14
-rw-r--r--src/common/log.h1
-rw-r--r--src/common/log_manager.cpp1
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/settings.cpp11
-rw-r--r--src/core/settings.h29
22 files changed, 406 insertions, 130 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index f10f3e603..f2add394f 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -1,9 +1,12 @@
1set(SRCS 1set(SRCS
2 emu_window/emu_window_glfw.cpp 2 emu_window/emu_window_glfw.cpp
3 citra.cpp 3 citra.cpp
4 config.cpp
4 ) 5 )
5set(HEADERS 6set(HEADERS
6 emu_window/emu_window_glfw.h 7 emu_window/emu_window_glfw.h
8 config.h
9 default_ini.h
7 resource.h 10 resource.h
8 ) 11 )
9 12
@@ -16,7 +19,7 @@ endif()
16 19
17add_executable(citra ${SRCS} ${HEADERS}) 20add_executable(citra ${SRCS} ${HEADERS})
18target_link_libraries(citra core common video_core) 21target_link_libraries(citra core common video_core)
19target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES}) 22target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih)
20 23
21if (APPLE) 24if (APPLE)
22 target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY}) 25 target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY})
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index 7dc721dc3..46781defa 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -4,12 +4,12 @@
4 4
5#include "common/common.h" 5#include "common/common.h"
6#include "common/log_manager.h" 6#include "common/log_manager.h"
7#include "common/file_util.h"
8 7
9#include "core/system.h" 8#include "core/system.h"
10#include "core/core.h" 9#include "core/core.h"
11#include "core/loader/loader.h" 10#include "core/loader/loader.h"
12 11
12#include "citra/config.h"
13#include "citra/emu_window/emu_window_glfw.h" 13#include "citra/emu_window/emu_window_glfw.h"
14 14
15/// Application entry point 15/// Application entry point
@@ -21,13 +21,16 @@ int __cdecl main(int argc, char **argv) {
21 return -1; 21 return -1;
22 } 22 }
23 23
24 Config config;
25
24 std::string boot_filename = argv[1]; 26 std::string boot_filename = argv[1];
25 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW; 27 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
26 28
27 System::Init(emu_window); 29 System::Init(emu_window);
28 30
29 if (Loader::ResultStatus::Success != Loader::LoadFile(boot_filename)) { 31 Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
30 ERROR_LOG(BOOT, "Failed to load ROM!"); 32 if (Loader::ResultStatus::Success != load_result) {
33 ERROR_LOG(BOOT, "Failed to load ROM (Error %i)!", load_result);
31 return -1; 34 return -1;
32 } 35 }
33 36
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
new file mode 100644
index 000000000..1d5e9c717
--- /dev/null
+++ b/src/citra/config.cpp
@@ -0,0 +1,65 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include <GLFW/glfw3.h>
6
7#include "citra/default_ini.h"
8#include "common/file_util.h"
9#include "core/settings.h"
10
11#include "config.h"
12
13Config::Config() {
14 // TODO: Don't hardcode the path; let the frontend decide where to put the config files.
15 glfw_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "glfw-config.ini";
16 glfw_config = new INIReader(glfw_config_loc);
17
18 Reload();
19}
20
21bool Config::LoadINI(INIReader* config, const char* location, const std::string& default_contents, bool retry) {
22 if (config->ParseError() < 0) {
23 if (retry) {
24 ERROR_LOG(CONFIG, "Failed to load %s. Creating file from defaults...", location);
25 FileUtil::CreateFullPath(location);
26 FileUtil::WriteStringToFile(true, default_contents, location);
27 *config = INIReader(location); // Reopen file
28
29 return LoadINI(config, location, default_contents, false);
30 }
31 ERROR_LOG(CONFIG, "Failed.");
32 return false;
33 }
34 INFO_LOG(CONFIG, "Successfully loaded %s", location);
35 return true;
36}
37
38void Config::ReadControls() {
39 Settings::values.pad_a_key = glfw_config->GetInteger("Controls", "pad_a", GLFW_KEY_A);
40 Settings::values.pad_b_key = glfw_config->GetInteger("Controls", "pad_b", GLFW_KEY_S);
41 Settings::values.pad_x_key = glfw_config->GetInteger("Controls", "pad_x", GLFW_KEY_Z);
42 Settings::values.pad_y_key = glfw_config->GetInteger("Controls", "pad_y", GLFW_KEY_X);
43 Settings::values.pad_l_key = glfw_config->GetInteger("Controls", "pad_l", GLFW_KEY_Q);
44 Settings::values.pad_r_key = glfw_config->GetInteger("Controls", "pad_r", GLFW_KEY_W);
45 Settings::values.pad_start_key = glfw_config->GetInteger("Controls", "pad_start", GLFW_KEY_M);
46 Settings::values.pad_select_key = glfw_config->GetInteger("Controls", "pad_select", GLFW_KEY_N);
47 Settings::values.pad_home_key = glfw_config->GetInteger("Controls", "pad_home", GLFW_KEY_B);
48 Settings::values.pad_dup_key = glfw_config->GetInteger("Controls", "pad_dup", GLFW_KEY_T);
49 Settings::values.pad_ddown_key = glfw_config->GetInteger("Controls", "pad_ddown", GLFW_KEY_G);
50 Settings::values.pad_dleft_key = glfw_config->GetInteger("Controls", "pad_dleft", GLFW_KEY_F);
51 Settings::values.pad_dright_key = glfw_config->GetInteger("Controls", "pad_dright", GLFW_KEY_H);
52 Settings::values.pad_sup_key = glfw_config->GetInteger("Controls", "pad_sup", GLFW_KEY_UP);
53 Settings::values.pad_sdown_key = glfw_config->GetInteger("Controls", "pad_sdown", GLFW_KEY_DOWN);
54 Settings::values.pad_sleft_key = glfw_config->GetInteger("Controls", "pad_sleft", GLFW_KEY_LEFT);
55 Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
56}
57
58void Config::Reload() {
59 LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file);
60 ReadControls();
61}
62
63Config::~Config() {
64 delete glfw_config;
65}
diff --git a/src/citra/config.h b/src/citra/config.h
new file mode 100644
index 000000000..de0570b42
--- /dev/null
+++ b/src/citra/config.h
@@ -0,0 +1,24 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <map>
8
9#include <inih/cpp/INIReader.h>
10
11#include "common/common_types.h"
12
13class Config {
14 INIReader* glfw_config;
15 std::string glfw_config_loc;
16
17 bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true);
18 void ReadControls();
19public:
20 Config();
21 ~Config();
22
23 void Reload();
24};
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
new file mode 100644
index 000000000..11b985e1b
--- /dev/null
+++ b/src/citra/default_ini.h
@@ -0,0 +1,30 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace DefaultINI {
8
9const char* glfw_config_file = R"(
10[Controls]
11pad_start =
12pad_select =
13pad_home =
14pad_dup =
15pad_ddown =
16pad_dleft =
17pad_dright =
18pad_a =
19pad_b =
20pad_x =
21pad_y =
22pad_r =
23pad_l =
24pad_sup =
25pad_sdown =
26pad_sleft =
27pad_sright =
28)";
29
30}
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index b911e60c5..661521eb7 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -6,26 +6,9 @@
6 6
7#include "video_core/video_core.h" 7#include "video_core/video_core.h"
8 8
9#include "citra/emu_window/emu_window_glfw.h" 9#include "core/settings.h"
10 10
11static const std::pair<int, HID_User::PadState> default_key_map[] = { 11#include "citra/emu_window/emu_window_glfw.h"
12 { GLFW_KEY_A, HID_User::PAD_A },
13 { GLFW_KEY_B, HID_User::PAD_B },
14 { GLFW_KEY_BACKSLASH, HID_User::PAD_SELECT },
15 { GLFW_KEY_ENTER, HID_User::PAD_START },
16 { GLFW_KEY_RIGHT, HID_User::PAD_RIGHT },
17 { GLFW_KEY_LEFT, HID_User::PAD_LEFT },
18 { GLFW_KEY_UP, HID_User::PAD_UP },
19 { GLFW_KEY_DOWN, HID_User::PAD_DOWN },
20 { GLFW_KEY_R, HID_User::PAD_R },
21 { GLFW_KEY_L, HID_User::PAD_L },
22 { GLFW_KEY_X, HID_User::PAD_X },
23 { GLFW_KEY_Y, HID_User::PAD_Y },
24 { GLFW_KEY_H, HID_User::PAD_CIRCLE_RIGHT },
25 { GLFW_KEY_F, HID_User::PAD_CIRCLE_LEFT },
26 { GLFW_KEY_T, HID_User::PAD_CIRCLE_UP },
27 { GLFW_KEY_G, HID_User::PAD_CIRCLE_DOWN },
28};
29 12
30/// Called by GLFW when a key event occurs 13/// Called by GLFW when a key event occurs
31void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) { 14void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods) {
@@ -48,14 +31,9 @@ void EmuWindow_GLFW::OnKeyEvent(GLFWwindow* win, int key, int scancode, int acti
48 31
49/// EmuWindow_GLFW constructor 32/// EmuWindow_GLFW constructor
50EmuWindow_GLFW::EmuWindow_GLFW() { 33EmuWindow_GLFW::EmuWindow_GLFW() {
51
52 // Register a new ID for the default keyboard
53 keyboard_id = KeyMap::NewDeviceId(); 34 keyboard_id = KeyMap::NewDeviceId();
54 35
55 // Set default key mappings for keyboard 36 ReloadSetKeymaps();
56 for (auto mapping : default_key_map) {
57 KeyMap::SetKeyMapping({mapping.first, keyboard_id}, mapping.second);
58 }
59 37
60 // Initialize the window 38 // Initialize the window
61 if(glfwInit() != GL_TRUE) { 39 if(glfwInit() != GL_TRUE) {
@@ -111,3 +89,22 @@ void EmuWindow_GLFW::MakeCurrent() {
111void EmuWindow_GLFW::DoneCurrent() { 89void EmuWindow_GLFW::DoneCurrent() {
112 glfwMakeContextCurrent(NULL); 90 glfwMakeContextCurrent(NULL);
113} 91}
92
93void EmuWindow_GLFW::ReloadSetKeymaps() {
94 KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, HID_User::PAD_A);
95 KeyMap::SetKeyMapping({Settings::values.pad_b_key, keyboard_id}, HID_User::PAD_B);
96 KeyMap::SetKeyMapping({Settings::values.pad_select_key, keyboard_id}, HID_User::PAD_SELECT);
97 KeyMap::SetKeyMapping({Settings::values.pad_start_key, keyboard_id}, HID_User::PAD_START);
98 KeyMap::SetKeyMapping({Settings::values.pad_dright_key, keyboard_id}, HID_User::PAD_RIGHT);
99 KeyMap::SetKeyMapping({Settings::values.pad_dleft_key, keyboard_id}, HID_User::PAD_LEFT);
100 KeyMap::SetKeyMapping({Settings::values.pad_dup_key, keyboard_id}, HID_User::PAD_UP);
101 KeyMap::SetKeyMapping({Settings::values.pad_ddown_key, keyboard_id}, HID_User::PAD_DOWN);
102 KeyMap::SetKeyMapping({Settings::values.pad_r_key, keyboard_id}, HID_User::PAD_R);
103 KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, HID_User::PAD_L);
104 KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, HID_User::PAD_X);
105 KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, HID_User::PAD_Y);
106 KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, HID_User::PAD_CIRCLE_RIGHT);
107 KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, HID_User::PAD_CIRCLE_LEFT);
108 KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, HID_User::PAD_CIRCLE_UP);
109 KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, HID_User::PAD_CIRCLE_DOWN);
110}
diff --git a/src/citra/emu_window/emu_window_glfw.h b/src/citra/emu_window/emu_window_glfw.h
index 29325bb75..d38a11c2c 100644
--- a/src/citra/emu_window/emu_window_glfw.h
+++ b/src/citra/emu_window/emu_window_glfw.h
@@ -27,7 +27,11 @@ public:
27 27
28 static void OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods); 28 static void OnKeyEvent(GLFWwindow* win, int key, int scancode, int action, int mods);
29 29
30 void ReloadSetKeymaps() override;
31
30private: 32private:
31 GLFWwindow* m_render_window; ///< Internal GLFW render window 33 GLFWwindow* m_render_window; ///< Internal GLFW render window
32 int keyboard_id; ///< Device id of keyboard for use with KeyMap 34
35 /// Device id of keyboard for use with KeyMap
36 int keyboard_id;
33}; 37};
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 426e4ef99..98a48a69a 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -4,6 +4,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
4set(SRCS 4set(SRCS
5 config/controller_config.cpp 5 config/controller_config.cpp
6 config/controller_config_util.cpp 6 config/controller_config_util.cpp
7 config.cpp
7 debugger/callstack.cpp 8 debugger/callstack.cpp
8 debugger/disassembler.cpp 9 debugger/disassembler.cpp
9 debugger/graphics.cpp 10 debugger/graphics.cpp
@@ -18,6 +19,7 @@ set(SRCS
18set(HEADERS 19set(HEADERS
19 config/controller_config.hxx 20 config/controller_config.hxx
20 config/controller_config_util.hxx 21 config/controller_config_util.hxx
22 config.h
21 debugger/callstack.hxx 23 debugger/callstack.hxx
22 debugger/disassembler.hxx 24 debugger/disassembler.hxx
23 debugger/graphics.hxx 25 debugger/graphics.hxx
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index cf4d8b32b..5dce9e570 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -6,12 +6,11 @@
6#include "bootmanager.hxx" 6#include "bootmanager.hxx"
7 7
8#include "core/core.h" 8#include "core/core.h"
9#include "core/loader/loader.h" 9#include "core/settings.h"
10#include "core/hw/hw.h"
11 10
12#include "video_core/video_core.h" 11#include "video_core/video_core.h"
13 12
14#include "version.h" 13#include "citra_qt/version.h"
15 14
16#define APP_NAME "citra" 15#define APP_NAME "citra"
17#define APP_VERSION "0.1-" VERSION 16#define APP_VERSION "0.1-" VERSION
@@ -102,40 +101,15 @@ private:
102 GRenderWindow* parent_; 101 GRenderWindow* parent_;
103}; 102};
104 103
105
106EmuThread& GRenderWindow::GetEmuThread() 104EmuThread& GRenderWindow::GetEmuThread()
107{ 105{
108 return emu_thread; 106 return emu_thread;
109} 107}
110 108
111static const std::pair<int, HID_User::PadState> default_key_map[] = { 109GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this), keyboard_id(0)
112 { Qt::Key_A, HID_User::PAD_A },
113 { Qt::Key_B, HID_User::PAD_B },
114 { Qt::Key_Backslash, HID_User::PAD_SELECT },
115 { Qt::Key_Enter, HID_User::PAD_START },
116 { Qt::Key_Right, HID_User::PAD_RIGHT },
117 { Qt::Key_Left, HID_User::PAD_LEFT },
118 { Qt::Key_Up, HID_User::PAD_UP },
119 { Qt::Key_Down, HID_User::PAD_DOWN },
120 { Qt::Key_R, HID_User::PAD_R },
121 { Qt::Key_L, HID_User::PAD_L },
122 { Qt::Key_X, HID_User::PAD_X },
123 { Qt::Key_Y, HID_User::PAD_Y },
124 { Qt::Key_H, HID_User::PAD_CIRCLE_RIGHT },
125 { Qt::Key_F, HID_User::PAD_CIRCLE_LEFT },
126 { Qt::Key_T, HID_User::PAD_CIRCLE_UP },
127 { Qt::Key_G, HID_User::PAD_CIRCLE_DOWN },
128};
129
130GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this)
131{ 110{
132 // Register a new ID for the default keyboard
133 keyboard_id = KeyMap::NewDeviceId(); 111 keyboard_id = KeyMap::NewDeviceId();
134 112 ReloadSetKeymaps();
135 // Set default key mappings for keyboard
136 for (auto mapping : default_key_map) {
137 KeyMap::SetKeyMapping({mapping.first, keyboard_id}, mapping.second);
138 }
139 113
140 // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose 114 // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose
141 QGLFormat fmt; 115 QGLFormat fmt;
@@ -245,3 +219,23 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event)
245 HID_User::PadUpdateComplete(); 219 HID_User::PadUpdateComplete();
246} 220}
247 221
222void GRenderWindow::ReloadSetKeymaps()
223{
224 KeyMap::SetKeyMapping({Settings::values.pad_a_key, keyboard_id}, HID_User::PAD_A);
225 KeyMap::SetKeyMapping({Settings::values.pad_b_key, keyboard_id}, HID_User::PAD_B);
226 KeyMap::SetKeyMapping({Settings::values.pad_select_key, keyboard_id}, HID_User::PAD_SELECT);
227 KeyMap::SetKeyMapping({Settings::values.pad_start_key, keyboard_id}, HID_User::PAD_START);
228 KeyMap::SetKeyMapping({Settings::values.pad_dright_key, keyboard_id}, HID_User::PAD_RIGHT);
229 KeyMap::SetKeyMapping({Settings::values.pad_dleft_key, keyboard_id}, HID_User::PAD_LEFT);
230 KeyMap::SetKeyMapping({Settings::values.pad_dup_key, keyboard_id}, HID_User::PAD_UP);
231 KeyMap::SetKeyMapping({Settings::values.pad_ddown_key, keyboard_id}, HID_User::PAD_DOWN);
232 KeyMap::SetKeyMapping({Settings::values.pad_r_key, keyboard_id}, HID_User::PAD_R);
233 KeyMap::SetKeyMapping({Settings::values.pad_l_key, keyboard_id}, HID_User::PAD_L);
234 KeyMap::SetKeyMapping({Settings::values.pad_x_key, keyboard_id}, HID_User::PAD_X);
235 KeyMap::SetKeyMapping({Settings::values.pad_y_key, keyboard_id}, HID_User::PAD_Y);
236 KeyMap::SetKeyMapping({Settings::values.pad_sright_key, keyboard_id}, HID_User::PAD_CIRCLE_RIGHT);
237 KeyMap::SetKeyMapping({Settings::values.pad_sleft_key, keyboard_id}, HID_User::PAD_CIRCLE_LEFT);
238 KeyMap::SetKeyMapping({Settings::values.pad_sup_key, keyboard_id}, HID_User::PAD_CIRCLE_UP);
239 KeyMap::SetKeyMapping({Settings::values.pad_sdown_key, keyboard_id}, HID_User::PAD_CIRCLE_DOWN);
240}
241
diff --git a/src/citra_qt/bootmanager.hxx b/src/citra_qt/bootmanager.hxx
index eedf19471..816ffed2e 100644
--- a/src/citra_qt/bootmanager.hxx
+++ b/src/citra_qt/bootmanager.hxx
@@ -107,6 +107,8 @@ public:
107 void keyPressEvent(QKeyEvent* event); 107 void keyPressEvent(QKeyEvent* event);
108 void keyReleaseEvent(QKeyEvent* event); 108 void keyReleaseEvent(QKeyEvent* event);
109 109
110 void ReloadSetKeymaps() override;
111
110public slots: 112public slots:
111 void moveContext(); 113 void moveContext();
112 114
@@ -117,5 +119,6 @@ private:
117 119
118 QByteArray geometry; 120 QByteArray geometry;
119 121
122 /// Device id of keyboard for use with KeyMap
120 int keyboard_id; 123 int keyboard_id;
121}; 124};
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
new file mode 100644
index 000000000..1b116edc5
--- /dev/null
+++ b/src/citra_qt/config.cpp
@@ -0,0 +1,79 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include <QString>
6#include <QStringList>
7
8#include "core/settings.h"
9#include "common/file_util.h"
10
11#include "config.h"
12
13Config::Config() {
14
15 // TODO: Don't hardcode the path; let the frontend decide where to put the config files.
16 qt_config_loc = FileUtil::GetUserPath(D_CONFIG_IDX) + "qt-config.ini";
17 FileUtil::CreateFullPath(qt_config_loc);
18 qt_config = new QSettings(QString::fromStdString(qt_config_loc), QSettings::IniFormat);
19
20 Reload();
21}
22
23void Config::ReadControls() {
24 qt_config->beginGroup("Controls");
25 Settings::values.pad_a_key = qt_config->value("pad_a", Qt::Key_A).toInt();
26 Settings::values.pad_b_key = qt_config->value("pad_b", Qt::Key_S).toInt();
27 Settings::values.pad_x_key = qt_config->value("pad_x", Qt::Key_Z).toInt();
28 Settings::values.pad_y_key = qt_config->value("pad_y", Qt::Key_X).toInt();
29 Settings::values.pad_l_key = qt_config->value("pad_l", Qt::Key_Q).toInt();
30 Settings::values.pad_r_key = qt_config->value("pad_r", Qt::Key_W).toInt();
31 Settings::values.pad_start_key = qt_config->value("pad_start", Qt::Key_M).toInt();
32 Settings::values.pad_select_key = qt_config->value("pad_select", Qt::Key_N).toInt();
33 Settings::values.pad_home_key = qt_config->value("pad_home", Qt::Key_B).toInt();
34 Settings::values.pad_dup_key = qt_config->value("pad_dup", Qt::Key_T).toInt();
35 Settings::values.pad_ddown_key = qt_config->value("pad_ddown", Qt::Key_G).toInt();
36 Settings::values.pad_dleft_key = qt_config->value("pad_dleft", Qt::Key_F).toInt();
37 Settings::values.pad_dright_key = qt_config->value("pad_dright", Qt::Key_H).toInt();
38 Settings::values.pad_sup_key = qt_config->value("pad_sup", Qt::Key_Up).toInt();
39 Settings::values.pad_sdown_key = qt_config->value("pad_sdown", Qt::Key_Down).toInt();
40 Settings::values.pad_sleft_key = qt_config->value("pad_sleft", Qt::Key_Left).toInt();
41 Settings::values.pad_sright_key = qt_config->value("pad_sright", Qt::Key_Right).toInt();
42 qt_config->endGroup();
43}
44
45void Config::SaveControls() {
46 qt_config->beginGroup("Controls");
47 qt_config->setValue("pad_a", Settings::values.pad_a_key);
48 qt_config->setValue("pad_b", Settings::values.pad_b_key);
49 qt_config->setValue("pad_x", Settings::values.pad_x_key);
50 qt_config->setValue("pad_y", Settings::values.pad_y_key);
51 qt_config->setValue("pad_l", Settings::values.pad_l_key);
52 qt_config->setValue("pad_r", Settings::values.pad_r_key);
53 qt_config->setValue("pad_start", Settings::values.pad_start_key);
54 qt_config->setValue("pad_select", Settings::values.pad_select_key);
55 qt_config->setValue("pad_home", Settings::values.pad_home_key);
56 qt_config->setValue("pad_dup", Settings::values.pad_dup_key);
57 qt_config->setValue("pad_ddown", Settings::values.pad_ddown_key);
58 qt_config->setValue("pad_dleft", Settings::values.pad_dleft_key);
59 qt_config->setValue("pad_dright", Settings::values.pad_dright_key);
60 qt_config->setValue("pad_sup", Settings::values.pad_sup_key);
61 qt_config->setValue("pad_sdown", Settings::values.pad_sdown_key);
62 qt_config->setValue("pad_sleft", Settings::values.pad_sleft_key);
63 qt_config->setValue("pad_sright", Settings::values.pad_sright_key);
64 qt_config->endGroup();
65}
66
67void Config::Reload() {
68 ReadControls();
69}
70
71void Config::Save() {
72 SaveControls();
73}
74
75Config::~Config() {
76 Save();
77
78 delete qt_config;
79}
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h
new file mode 100644
index 000000000..ae390be6b
--- /dev/null
+++ b/src/citra_qt/config.h
@@ -0,0 +1,23 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <QSettings>
8
9#include "common/common_types.h"
10
11class Config {
12 QSettings* qt_config;
13 std::string qt_config_loc;
14
15 void ReadControls();
16 void SaveControls();
17public:
18 Config();
19 ~Config();
20
21 void Reload();
22 void Save();
23};
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 1bf9bc53c..bac6a6bb8 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -26,12 +26,16 @@
26#include "core/core.h" 26#include "core/core.h"
27#include "core/loader/loader.h" 27#include "core/loader/loader.h"
28#include "core/arm/disassembler/load_symbol_map.h" 28#include "core/arm/disassembler/load_symbol_map.h"
29#include "citra_qt/config.h"
29 30
30#include "version.h" 31#include "version.h"
31 32
32 33
33GMainWindow::GMainWindow() 34GMainWindow::GMainWindow()
34{ 35{
36 LogManager::Init();
37 Config config;
38
35 ui.setupUi(this); 39 ui.setupUi(this);
36 statusBar()->hide(); 40 statusBar()->hide();
37 41
@@ -112,7 +116,6 @@ GMainWindow::GMainWindow()
112 116
113 show(); 117 show();
114 118
115 LogManager::Init();
116 System::Init(render_window); 119 System::Init(render_window);
117} 120}
118 121
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index 7cd5b1f35..ae08d082a 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -7,25 +7,25 @@
7// Make sure we pick up USER_DIR if set in config.h 7// Make sure we pick up USER_DIR if set in config.h
8#include "common/common.h" 8#include "common/common.h"
9 9
10// Directory seperators, do we need this? 10// Directory separators, do we need this?
11#define DIR_SEP "/" 11#define DIR_SEP "/"
12#define DIR_SEP_CHR '/' 12#define DIR_SEP_CHR '/'
13 13
14#ifndef MAX_PATH 14#ifndef MAX_PATH
15#define MAX_PATH 260 15#define MAX_PATH 260
16#endif 16#endif
17 17
18// The user data dir 18// The user data dir
19#define ROOT_DIR "." 19#define ROOT_DIR "."
20#ifdef _WIN32 20#ifdef _WIN32
21 #define USERDATA_DIR "user" 21 #define USERDATA_DIR "user"
22 #define EMU_DATA_DIR "emu" 22 #define EMU_DATA_DIR "Citra Emulator"
23#else 23#else
24 #define USERDATA_DIR "user" 24 #define USERDATA_DIR "user"
25 #ifdef USER_DIR 25 #ifdef USER_DIR
26 #define EMU_DATA_DIR USER_DIR 26 #define EMU_DATA_DIR USER_DIR
27 #else 27 #else
28 #define EMU_DATA_DIR ".emu" 28 #define EMU_DATA_DIR ".citra-emu"
29 #endif 29 #endif
30#endif 30#endif
31 31
@@ -48,30 +48,30 @@
48#define JAP_DIR "JAP" 48#define JAP_DIR "JAP"
49 49
50// Subdirs in the User dir returned by GetUserPath(D_USER_IDX) 50// Subdirs in the User dir returned by GetUserPath(D_USER_IDX)
51#define CONFIG_DIR "config" 51#define CONFIG_DIR "config"
52#define GAMECONFIG_DIR "game_config" 52#define GAMECONFIG_DIR "game_config"
53#define MAPS_DIR "maps" 53#define MAPS_DIR "maps"
54#define CACHE_DIR "cache" 54#define CACHE_DIR "cache"
55#define SDMC_DIR "sdmc" 55#define SDMC_DIR "sdmc"
56#define SHADERCACHE_DIR "shader_cache" 56#define SHADERCACHE_DIR "shader_cache"
57#define STATESAVES_DIR "state_saves" 57#define STATESAVES_DIR "state_saves"
58#define SCREENSHOTS_DIR "screenShots" 58#define SCREENSHOTS_DIR "screenShots"
59#define DUMP_DIR "dump" 59#define DUMP_DIR "dump"
60#define DUMP_TEXTURES_DIR "textures" 60#define DUMP_TEXTURES_DIR "textures"
61#define DUMP_FRAMES_DIR "frames" 61#define DUMP_FRAMES_DIR "frames"
62#define DUMP_AUDIO_DIR "audio" 62#define DUMP_AUDIO_DIR "audio"
63#define LOGS_DIR "logs" 63#define LOGS_DIR "logs"
64#define SHADERS_DIR "shaders" 64#define SHADERS_DIR "shaders"
65#define SYSCONF_DIR "sysconf" 65#define SYSCONF_DIR "sysconf"
66 66
67// Filenames 67// Filenames
68// Files in the directory returned by GetUserPath(D_CONFIG_IDX) 68// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
69#define EMU_CONFIG "emu.ini" 69#define EMU_CONFIG "emu.ini"
70#define DEBUGGER_CONFIG "debugger.ini" 70#define DEBUGGER_CONFIG "debugger.ini"
71#define LOGGER_CONFIG "logger.ini" 71#define LOGGER_CONFIG "logger.ini"
72 72
73// Files in the directory returned by GetUserPath(D_LOGS_IDX) 73// Files in the directory returned by GetUserPath(D_LOGS_IDX)
74#define MAIN_LOG "emu.log" 74#define MAIN_LOG "emu.log"
75 75
76// Files in the directory returned by GetUserPath(D_SYSCONF_IDX) 76// Files in the directory returned by GetUserPath(D_SYSCONF_IDX)
77#define SYSCONF "SYSCONF" 77#define SYSCONF "SYSCONF"
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index 23f178fdf..34cecb40b 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -16,7 +16,7 @@ class EmuWindow
16 16
17public: 17public:
18 /// Data structure to store an emuwindow configuration 18 /// Data structure to store an emuwindow configuration
19 struct Config{ 19 struct WindowConfig {
20 bool fullscreen; 20 bool fullscreen;
21 int res_width; 21 int res_width;
22 int res_height; 22 int res_height;
@@ -34,17 +34,19 @@ public:
34 /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread 34 /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread
35 virtual void DoneCurrent() = 0; 35 virtual void DoneCurrent() = 0;
36 36
37 virtual void ReloadSetKeymaps() = 0;
38
37 /// Signals a key press action to the HID module 39 /// Signals a key press action to the HID module
38 static void KeyPressed(KeyMap::HostDeviceKey key); 40 static void KeyPressed(KeyMap::HostDeviceKey key);
39 41
40 /// Signals a key release action to the HID module 42 /// Signals a key release action to the HID module
41 static void KeyReleased(KeyMap::HostDeviceKey key); 43 static void KeyReleased(KeyMap::HostDeviceKey key);
42 44
43 Config GetConfig() const { 45 WindowConfig GetConfig() const {
44 return m_config; 46 return m_config;
45 } 47 }
46 48
47 void SetConfig(const Config& val) { 49 void SetConfig(const WindowConfig& val) {
48 m_config = val; 50 m_config = val;
49 } 51 }
50 52
@@ -86,6 +88,6 @@ protected:
86 int m_client_area_height; ///< Current client height, should be set by window impl. 88 int m_client_area_height; ///< Current client height, should be set by window impl.
87 89
88private: 90private:
89 Config m_config; ///< Internal configuration 91 WindowConfig m_config; ///< Internal configuration
90 92
91}; 93};
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 40cd32d96..d1f19e3ff 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -648,7 +648,7 @@ std::string GetSysDirectory()
648 return sysDir; 648 return sysDir;
649} 649}
650 650
651// Returns a string with a Dolphin data dir or file in the user's home 651// Returns a string with a Citra data dir or file in the user's home
652// directory. To be used in "multi-user" mode (that is, installed). 652// directory. To be used in "multi-user" mode (that is, installed).
653const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath) 653const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath)
654{ 654{
@@ -668,22 +668,22 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
668 getenv("PWD") : "") + DIR_SEP EMU_DATA_DIR DIR_SEP; 668 getenv("PWD") : "") + DIR_SEP EMU_DATA_DIR DIR_SEP;
669#endif 669#endif
670 670
671 paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; 671 paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
672 paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; 672 paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP;
673 paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; 673 paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
674 paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; 674 paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
675 paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; 675 paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
676 paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; 676 paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
677 paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; 677 paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
678 paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; 678 paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
679 paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; 679 paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
680 paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; 680 paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
681 paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; 681 paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
682 paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; 682 paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
683 paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; 683 paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
684 paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; 684 paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
685 paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; 685 paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
686 paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; 686 paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
687 paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; 687 paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
688 } 688 }
689 689
@@ -702,44 +702,44 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
702 switch (DirIDX) 702 switch (DirIDX)
703 { 703 {
704 case D_ROOT_IDX: 704 case D_ROOT_IDX:
705 paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; 705 paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP;
706 paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR + DIR_SEP; 706 paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR + DIR_SEP;
707 paths[F_SYSCONF_IDX] = paths[D_SYSCONF_IDX] + SYSCONF; 707 paths[F_SYSCONF_IDX] = paths[D_SYSCONF_IDX] + SYSCONF;
708 break; 708 break;
709 709
710 case D_USER_IDX: 710 case D_USER_IDX:
711 paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP; 711 paths[D_USER_IDX] = paths[D_ROOT_IDX] + DIR_SEP;
712 paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; 712 paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
713 paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP; 713 paths[D_GAMECONFIG_IDX] = paths[D_USER_IDX] + GAMECONFIG_DIR DIR_SEP;
714 paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP; 714 paths[D_MAPS_IDX] = paths[D_USER_IDX] + MAPS_DIR DIR_SEP;
715 paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP; 715 paths[D_CACHE_IDX] = paths[D_USER_IDX] + CACHE_DIR DIR_SEP;
716 paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP; 716 paths[D_SDMC_IDX] = paths[D_USER_IDX] + SDMC_DIR DIR_SEP;
717 paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP; 717 paths[D_SHADERCACHE_IDX] = paths[D_USER_IDX] + SHADERCACHE_DIR DIR_SEP;
718 paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP; 718 paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
719 paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP; 719 paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
720 paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP; 720 paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
721 paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP; 721 paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
722 paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; 722 paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
723 paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; 723 paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
724 paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; 724 paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
725 paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP; 725 paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
726 paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR DIR_SEP; 726 paths[D_SYSCONF_IDX] = paths[D_USER_IDX] + SYSCONF_DIR DIR_SEP;
727 paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; 727 paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG;
728 paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; 728 paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
729 paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; 729 paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
730 paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG; 730 paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
731 break; 731 break;
732 732
733 case D_CONFIG_IDX: 733 case D_CONFIG_IDX:
734 paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG; 734 paths[F_EMUCONFIG_IDX] = paths[D_CONFIG_IDX] + EMU_CONFIG;
735 paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; 735 paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
736 paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG; 736 paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
737 break; 737 break;
738 738
739 case D_DUMP_IDX: 739 case D_DUMP_IDX:
740 paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP; 740 paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
741 paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP; 741 paths[D_DUMPAUDIO_IDX] = paths[D_DUMP_IDX] + DUMP_AUDIO_DIR DIR_SEP;
742 paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP; 742 paths[D_DUMPTEXTURES_IDX] = paths[D_DUMP_IDX] + DUMP_TEXTURES_DIR DIR_SEP;
743 break; 743 break;
744 744
745 case D_LOGS_IDX: 745 case D_LOGS_IDX:
diff --git a/src/common/file_util.h b/src/common/file_util.h
index cddcd1951..c7e11ec0c 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -47,7 +47,7 @@ enum {
47namespace FileUtil 47namespace FileUtil
48{ 48{
49 49
50// FileSystem tree node/ 50// FileSystem tree node/
51struct FSTEntry 51struct FSTEntry
52{ 52{
53 bool isDirectory; 53 bool isDirectory;
@@ -85,13 +85,13 @@ bool Delete(const std::string &filename);
85// Deletes a directory filename, returns true on success 85// Deletes a directory filename, returns true on success
86bool DeleteDir(const std::string &filename); 86bool DeleteDir(const std::string &filename);
87 87
88// renames file srcFilename to destFilename, returns true on success 88// renames file srcFilename to destFilename, returns true on success
89bool Rename(const std::string &srcFilename, const std::string &destFilename); 89bool Rename(const std::string &srcFilename, const std::string &destFilename);
90 90
91// copies file srcFilename to destFilename, returns true on success 91// copies file srcFilename to destFilename, returns true on success
92bool Copy(const std::string &srcFilename, const std::string &destFilename); 92bool Copy(const std::string &srcFilename, const std::string &destFilename);
93 93
94// creates an empty file filename, returns true on success 94// creates an empty file filename, returns true on success
95bool CreateEmptyFile(const std::string &filename); 95bool CreateEmptyFile(const std::string &filename);
96 96
97// Scans the directory tree gets, starting from _Directory and adds the 97// Scans the directory tree gets, starting from _Directory and adds the
@@ -110,7 +110,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path);
110// Set the current directory to given directory 110// Set the current directory to given directory
111bool SetCurrentDir(const std::string &directory); 111bool SetCurrentDir(const std::string &directory);
112 112
113// Returns a pointer to a string with a Dolphin data dir in the user's home 113// Returns a pointer to a string with a Citra data dir in the user's home
114// directory. To be used in "multi-user" mode (that is, installed). 114// directory. To be used in "multi-user" mode (that is, installed).
115const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath=""); 115const std::string& GetUserPath(const unsigned int DirIDX, const std::string &newPath="");
116 116
@@ -142,10 +142,10 @@ public:
142 IOFile(const std::string& filename, const char openmode[]); 142 IOFile(const std::string& filename, const char openmode[]);
143 143
144 ~IOFile(); 144 ~IOFile();
145 145
146 IOFile(IOFile&& other); 146 IOFile(IOFile&& other);
147 IOFile& operator=(IOFile&& other); 147 IOFile& operator=(IOFile&& other);
148 148
149 void Swap(IOFile& other); 149 void Swap(IOFile& other);
150 150
151 bool Open(const std::string& filename, const char openmode[]); 151 bool Open(const std::string& filename, const char openmode[]);
diff --git a/src/common/log.h b/src/common/log.h
index 291534c67..bfd73f8a5 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -28,6 +28,7 @@ enum LOG_TYPE {
28 COMMANDPROCESSOR, 28 COMMANDPROCESSOR,
29 COMMON, 29 COMMON,
30 CONSOLE, 30 CONSOLE,
31 CONFIG,
31 DISCIO, 32 DISCIO,
32 FILEMON, 33 FILEMON,
33 DSPHLE, 34 DSPHLE,
diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp
index 28b72fa20..4d590d98f 100644
--- a/src/common/log_manager.cpp
+++ b/src/common/log_manager.cpp
@@ -30,6 +30,7 @@ LogManager::LogManager()
30 m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log"); 30 m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
31 m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot"); 31 m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");
32 m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common"); 32 m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common");
33 m_Log[LogTypes::CONFIG] = new LogContainer("CONFIG", "Configuration");
33 m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO"); 34 m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
34 m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor"); 35 m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor");
35 m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad"); 36 m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 2b26292fd..06df9a677 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -56,6 +56,7 @@ set(SRCS
56 core_timing.cpp 56 core_timing.cpp
57 mem_map.cpp 57 mem_map.cpp
58 mem_map_funcs.cpp 58 mem_map_funcs.cpp
59 settings.cpp
59 system.cpp 60 system.cpp
60 ) 61 )
61 62
@@ -117,6 +118,7 @@ set(HEADERS
117 core.h 118 core.h
118 core_timing.h 119 core_timing.h
119 mem_map.h 120 mem_map.h
121 settings.h
120 system.h 122 system.h
121 ) 123 )
122 124
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
new file mode 100644
index 000000000..c486f6274
--- /dev/null
+++ b/src/core/settings.cpp
@@ -0,0 +1,11 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "settings.h"
6
7namespace Settings {
8
9Values values = {};
10
11}
diff --git a/src/core/settings.h b/src/core/settings.h
new file mode 100644
index 000000000..a84c3d4b6
--- /dev/null
+++ b/src/core/settings.h
@@ -0,0 +1,29 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Settings {
8
9struct Values {
10 int pad_a_key;
11 int pad_b_key;
12 int pad_x_key;
13 int pad_y_key;
14 int pad_l_key;
15 int pad_r_key;
16 int pad_start_key;
17 int pad_select_key;
18 int pad_home_key;
19 int pad_dup_key;
20 int pad_ddown_key;
21 int pad_dleft_key;
22 int pad_dright_key;
23 int pad_sup_key;
24 int pad_sdown_key;
25 int pad_sleft_key;
26 int pad_sright_key;
27} extern values;
28
29}