diff --git a/rpcs3/Emu/Io/WiimoteManager.cpp b/rpcs3/Emu/Io/WiimoteManager.cpp index 64e85160f5..23a049cecc 100644 --- a/rpcs3/Emu/Io/WiimoteManager.cpp +++ b/rpcs3/Emu/Io/WiimoteManager.cpp @@ -5,6 +5,7 @@ #include "Emu/system_config.h" #include "Utilities/File.h" #include "util/yaml.hpp" +#include "util/logs.hpp" #include #include @@ -226,9 +227,10 @@ static std::string get_config_path() void wiimote_manager::load_config() { const std::string path = get_config_path(); - if (!fs::exists(path)) return; + fs::file f(path, fs::read); + if (!f) return; - auto [root, error] = yaml_load(fs::read_all_text(path)); + auto [root, error] = yaml_load(f.to_string()); if (!error.empty()) { wiimote_log.error("Failed to load wiimote config: %s", error); @@ -240,14 +242,7 @@ void wiimote_manager::load_config() { if (root[key]) { - try - { - btn = static_cast(root[key].as()); - } - catch (const YAML::Exception&) - { - wiimote_log.error("Invalid value for %s in wiimote config", key); - } + btn = static_cast(root[key].as(static_cast(btn))); } }; @@ -283,7 +278,7 @@ void wiimote_manager::save_config() YAML::Emitter emitter; emitter << root; - fs::write_all_text(get_config_path(), emitter.c_str()); + fs::write_file(get_config_path(), fs::rewrite, emitter.c_str(), emitter.size()); } wiimote_manager::wiimote_manager() diff --git a/rpcs3/Emu/Io/WiimoteManager.h b/rpcs3/Emu/Io/WiimoteManager.h index 4d6151fc47..770f4b3735 100644 --- a/rpcs3/Emu/Io/WiimoteManager.h +++ b/rpcs3/Emu/Io/WiimoteManager.h @@ -3,7 +3,7 @@ #include "util/types.hpp" #include "Utilities/Thread.h" #include "Utilities/mutex.h" -#include +#include #include #include #include diff --git a/rpcs3/Input/hid_instance.cpp b/rpcs3/Input/hid_instance.cpp index 56079fa4aa..cde3dd7f84 100644 --- a/rpcs3/Input/hid_instance.cpp +++ b/rpcs3/Input/hid_instance.cpp @@ -1,14 +1,15 @@ #include "stdafx.h" #include "hid_instance.h" #include "util/logs.hpp" +#include "stdafx.h" +#include "hid_instance.h" +#include "util/logs.hpp" #include "Emu/System.h" #if defined(__APPLE__) -#include +#include "3rdparty/hidapi/hidapi/mac/hidapi_darwin.h" #endif -LOG_CHANNEL(hid_log, "HID"); - std::mutex g_hid_mutex; hid_instance::~hid_instance() diff --git a/rpcs3/Input/hid_instance.h b/rpcs3/Input/hid_instance.h index 9cfc321f20..f98e40b5a3 100644 --- a/rpcs3/Input/hid_instance.h +++ b/rpcs3/Input/hid_instance.h @@ -1,8 +1,11 @@ #pragma once #include "util/types.hpp" +#include "util/logs.hpp" #include -#include +#include + +LOG_CHANNEL(hid_log, "HID"); struct hid_instance {