From 3f497f0426480edc7456174f1284e8bafe93247f Mon Sep 17 00:00:00 2001 From: Anon Date: Sat, 30 Jul 2016 09:59:26 -0500 Subject: [PATCH] more cleanup --- src/citra_qt/config.cpp | 2 +- src/core/settings.h | 2 +- src/input_core/input_core.cpp | 9 ++++----- src/input_core/input_core.h | 7 +++++-- src/input_core/key_map.cpp | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 8f8e2a8dc..ae27dd497 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -125,7 +125,7 @@ void Config::SaveValues() { qt_config->beginGroup("Controls"); for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { qt_config->setValue(QString::fromStdString(Settings::NativeInput::Mapping[i]), - QString::fromStdString(Settings::values.input_mappings[Settings::NativeInput::All[i]].Save())); + QString::fromStdString(Settings::values.input_mappings[Settings::NativeInput::All[i]].toString())); } qt_config->setValue("pad_circle_modifier_scale", (double)Settings::values.pad_circle_modifier_scale); qt_config->endGroup(); diff --git a/src/core/settings.h b/src/core/settings.h index bc7720fe4..ae1032c68 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -91,7 +91,7 @@ namespace Settings { bool operator==(const InputDeviceMapping& rhs) const { return (this->device == rhs.device) && (this->framework == rhs.framework) && (this->number == rhs.number); } - std::string Save() { + std::string toString() { std::string result = ""; if (this->framework == DeviceFramework::Qt) result = "Qt"; diff --git a/src/input_core/input_core.cpp b/src/input_core/input_core.cpp index 608cbde0a..40c8a3243 100644 --- a/src/input_core/input_core.cpp +++ b/src/input_core/input_core.cpp @@ -19,8 +19,8 @@ namespace InputCore { static int tick_event; Service::HID::PadState pad_state; std::tuple circle_pad = { 0,0 }; - shared_ptr main_keyboard; /// Instance of main keyboard device. Always initialized regardless of settings. - vector> devices; ///Devices that are handling input for the game + shared_ptr main_keyboard; + vector> devices; ///< Devices that are handling input for the game static void InputTickCallback(u64, int cycles_late) { for (auto& device : devices) @@ -42,7 +42,6 @@ namespace InputCore { devices.clear(); } - ///Parse the settings to initialize necessary devices to handle input vector> InputCore::ParseSettings() { vector> devices; vector uniqueMappings; //unique mappings from settings file, used to init devices. @@ -91,13 +90,13 @@ namespace InputCore { input->InitDevice(mapping.number, keyMapping); } + //init keyboard, if it hasn't already if (main_keyboard == nullptr) main_keyboard = std::make_shared(); return devices; } - ///Helper method to check if device has already been initialized from the mapping. bool InputCore::CheckIfMappingExists(vector uniqueMapping, Settings::InputDeviceMapping mappingToCheck) { for (auto& mapping : uniqueMapping) { if (mapping == mappingToCheck) @@ -105,4 +104,4 @@ namespace InputCore { } return false; } -} \ No newline at end of file +} diff --git a/src/input_core/input_core.h b/src/input_core/input_core.h index 175b9d2a2..092877071 100644 --- a/src/input_core/input_core.h +++ b/src/input_core/input_core.h @@ -16,11 +16,14 @@ namespace InputCore { extern Service::HID::PadState pad_state; extern std::tuple circle_pad; - extern std::shared_ptr main_keyboard; + extern std::shared_ptr main_keyboard; ///< Instance of main keyboard device. Always initialized regardless of settings. void Init(); void Shutdown(); + ///Read settings to initialize devices std::vector> ParseSettings(); + + ///Helper method to check if device was already initialized bool CheckIfMappingExists(std::vector uniqueMapping, Settings::InputDeviceMapping mappingToCheck); -} // namespace \ No newline at end of file +} diff --git a/src/input_core/key_map.cpp b/src/input_core/key_map.cpp index 6184e89e5..d6136d8f2 100644 --- a/src/input_core/key_map.cpp +++ b/src/input_core/key_map.cpp @@ -60,4 +60,4 @@ namespace KeyMap { } } } -} \ No newline at end of file +}