mirror of
https://github.com/Retropex/dolphin.git
synced 2025-05-13 03:40:44 +02:00
All PrimeHack settings implemented and should update correctly. Changed title and forced portable.
This commit is contained in:
parent
3dd22b9755
commit
fa04cad490
@ -18,7 +18,7 @@ namespace Common
|
||||
#define BUILD_TYPE_STR ""
|
||||
#endif
|
||||
|
||||
const std::string scm_rev_str = "Dolphin "
|
||||
const std::string scm_rev_str = "PrimeHack (v0.3.0) "
|
||||
#if !SCM_IS_MASTER
|
||||
"[" SCM_BRANCH_STR "] "
|
||||
#endif
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
#include "Core/PrimeHack/HackConfig.h"
|
||||
|
||||
// Limit the amount of wiimote connect requests, when a button is pressed in disconnected state
|
||||
static std::array<u8, MAX_BBMOTES> s_last_connect_request_counter;
|
||||
|
||||
@ -141,6 +143,8 @@ void LoadConfig()
|
||||
{
|
||||
s_config.LoadConfig(false);
|
||||
s_last_connect_request_counter.fill(0);
|
||||
|
||||
prime::UpdateHackSettings();
|
||||
}
|
||||
|
||||
void Resume()
|
||||
@ -220,6 +224,13 @@ bool CheckBeam(int beamcount)
|
||||
return wiimote->CheckBeamCtrl(beamcount);
|
||||
}
|
||||
|
||||
std::tuple<double, double, double, bool, bool> PrimeSettings()
|
||||
{
|
||||
WiimoteEmu::Wiimote* wiimote = static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(0));
|
||||
|
||||
return wiimote->GetPrimeSettings();
|
||||
}
|
||||
|
||||
// This function is called periodically by the Core to update Wiimote state.
|
||||
void Update(int number, bool connected)
|
||||
{
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include <tuple>
|
||||
|
||||
class InputConfig;
|
||||
class PointerWrap;
|
||||
|
||||
@ -89,6 +91,8 @@ ControllerEmu::ControlGroup* GetTaTaConGroup(int number, WiimoteEmu::TaTaConGrou
|
||||
bool CheckVisor(int visor_count);
|
||||
bool CheckBeam(int beam_count);
|
||||
|
||||
std::tuple<double, double, double, bool, bool> PrimeSettings();
|
||||
|
||||
void ControlChannel(int number, u16 channel_id, const void* data, u32 size);
|
||||
void InterruptChannel(int number, u16 channel_id, const void* data, u32 size);
|
||||
bool ButtonPressed(int number);
|
||||
|
@ -49,6 +49,8 @@
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/PrimeHackButtons.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/PrimeHackMisc.h"
|
||||
|
||||
#include "Core/PrimeHack/HackConfig.h"
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
using namespace WiimoteCommon;
|
||||
@ -662,6 +664,15 @@ bool Wiimote::CheckBeamCtrl(int beamcount)
|
||||
return m_primehack_beams->controls[beamcount].get()->control_ref->State() > 0.5;
|
||||
}
|
||||
|
||||
std::tuple<double, double, double, bool, bool> Wiimote::GetPrimeSettings()
|
||||
{
|
||||
std::tuple t = std::make_tuple(m_primehack_camera_sensitivity.GetValue(),
|
||||
m_primehack_cursor_sensitivity.GetValue(), m_primehack_fieldofview.GetValue(),
|
||||
m_primehack_invert_x.GetValue(), m_primehack_invert_y.GetValue());
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
void Wiimote::LoadDefaults(const ControllerInterface& ciface)
|
||||
{
|
||||
|
@ -130,6 +130,7 @@ public:
|
||||
|
||||
bool CheckVisorCtrl(int visor_count);
|
||||
bool CheckBeamCtrl(int beam_count);
|
||||
std::tuple <double, double, double, bool, bool> GetPrimeSettings();
|
||||
|
||||
void Reset();
|
||||
|
||||
|
@ -39,75 +39,6 @@ void InitializeHack(std::string const& mkb_device_name, std::string const& mkb_d
|
||||
|
||||
device_name = mkb_device_name;
|
||||
device_source = mkb_device_source;
|
||||
|
||||
IniFile cfg_file;
|
||||
cfg_file.Load(config_path, true);
|
||||
if (!cfg_file.GetIfExists<float>("mouse", "sensitivity", &sensitivity))
|
||||
{
|
||||
auto* section = cfg_file.GetOrCreateSection("mouse");
|
||||
section->Set("sensitivity", 15.f);
|
||||
sensitivity = 15.f;
|
||||
}
|
||||
|
||||
if (!cfg_file.GetIfExists<float>("mouse", "cursor_sensitivity", &cursor_sensitivity))
|
||||
{
|
||||
auto* section = cfg_file.GetOrCreateSection("mouse");
|
||||
section->Set("cursor_sensitivity", 15.f);
|
||||
cursor_sensitivity = 15.f;
|
||||
}
|
||||
|
||||
if (!cfg_file.GetIfExists<float>("misc", "fov", &camera_fov))
|
||||
{
|
||||
auto* section = cfg_file.GetOrCreateSection("misc");
|
||||
section->Set("fov", 60.f);
|
||||
camera_fov = 60.f;
|
||||
}
|
||||
|
||||
if (!cfg_file.GetIfExists<bool>("misc", "inverted_y", &inverted_y))
|
||||
{
|
||||
auto* section = cfg_file.GetOrCreateSection("misc");
|
||||
section->Set("inverted_y", false);
|
||||
inverted_y = false;
|
||||
}
|
||||
|
||||
if (!cfg_file.GetIfExists<bool>("misc", "inverted_x", &inverted_x))
|
||||
{
|
||||
auto* section = cfg_file.GetOrCreateSection("misc");
|
||||
section->Set("inverted_x", false);
|
||||
inverted_x = false;
|
||||
}
|
||||
|
||||
control_list.resize(8);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
std::string control = std::string("index_") + std::to_string(i);
|
||||
std::string control_expr;
|
||||
|
||||
if (!cfg_file.GetIfExists<std::string>("beam", control.c_str(), &control_expr))
|
||||
{
|
||||
auto* section = cfg_file.GetOrCreateSection("beam");
|
||||
section->Set(control.c_str(), beam_binds[i]);
|
||||
control_expr = beam_binds[i];
|
||||
}
|
||||
control_list[i] = std::make_unique<InputReference>();
|
||||
control_list[i]->UpdateReference(
|
||||
g_controller_interface,
|
||||
ciface::Core::DeviceQualifier(mkb_device_source.c_str(), 0, mkb_device_name.c_str()));
|
||||
control_list[i]->SetExpression(control_expr);
|
||||
|
||||
if (!cfg_file.GetIfExists<std::string>("visor", control.c_str(), &control_expr))
|
||||
{
|
||||
auto* section = cfg_file.GetOrCreateSection("visor");
|
||||
section->Set(control.c_str(), visor_binds[i]);
|
||||
control_expr = visor_binds[i];
|
||||
}
|
||||
control_list[i + 4] = std::make_unique<InputReference>();
|
||||
control_list[i + 4]->SetExpression(control_expr);
|
||||
control_list[i + 4]->UpdateReference(
|
||||
g_controller_interface,
|
||||
ciface::Core::DeviceQualifier(mkb_device_source.c_str(), 0, mkb_device_name.c_str()));
|
||||
}
|
||||
cfg_file.Save(config_path);
|
||||
}
|
||||
|
||||
void RefreshControlDevices()
|
||||
@ -178,10 +109,26 @@ bool CheckBeamCtl(int beam_num)
|
||||
|
||||
bool CheckVisorCtl(int visor_num)
|
||||
{
|
||||
//return control_list[visor_num + 4]->State() > 0.5;
|
||||
// return control_list[visor_num + 4]->State() > 0.5;
|
||||
return Wiimote::CheckVisor(visor_num);
|
||||
}
|
||||
|
||||
void UpdateHackSettings()
|
||||
{
|
||||
std::tuple<double, double, double, bool, bool> t = Wiimote::PrimeSettings();
|
||||
double camera = std::get<0>(t);
|
||||
double cursor = std::get<1>(t);
|
||||
double fov = std::get<2>(t);
|
||||
bool invertx = std::get<3>(t);
|
||||
bool inverty = std::get<4>(t);
|
||||
|
||||
SetSensitivity((float)camera);
|
||||
SetCursorSensitivity((float)cursor);
|
||||
SetFov((float)fov);
|
||||
SetInvertedX(invertx);
|
||||
SetInvertedY(inverty);
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<ControlReference>>& GetMutableControls()
|
||||
{
|
||||
return control_list;
|
||||
|
@ -17,6 +17,7 @@ namespace prime
|
||||
void LoadStateFromIni();
|
||||
bool CheckBeamCtl(int beam_num);
|
||||
bool CheckVisorCtl(int visor_num);
|
||||
void UpdateHackSettings();
|
||||
|
||||
float GetSensitivity();
|
||||
void SetSensitivity(float sensitivity);
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Attachments.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
#include "Core/PrimeHack/HackConfig.h"
|
||||
|
||||
PrimeHackEmuGeneral::PrimeHackEmuGeneral(MappingWindow* window, WiimoteEmuExtension* extension)
|
||||
: MappingWidget(window), m_extension_widget(extension)
|
||||
{
|
||||
@ -64,17 +66,22 @@ void PrimeHackEmuGeneral::OnAttachmentChanged(int extension)
|
||||
|
||||
void PrimeHackEmuGeneral::ConfigChanged()
|
||||
{
|
||||
|
||||
prime::UpdateHackSettings();
|
||||
}
|
||||
|
||||
void PrimeHackEmuGeneral::LoadSettings()
|
||||
{
|
||||
Wiimote::LoadConfig();
|
||||
|
||||
prime::UpdateHackSettings();
|
||||
}
|
||||
|
||||
void PrimeHackEmuGeneral::SaveSettings()
|
||||
{
|
||||
Wiimote::GetConfig()->SaveConfig();
|
||||
|
||||
|
||||
prime::UpdateHackSettings();
|
||||
}
|
||||
|
||||
InputConfig* PrimeHackEmuGeneral::GetConfig()
|
||||
|
@ -24,6 +24,8 @@ private:
|
||||
void OnAttachmentChanged(int index);
|
||||
void ConfigChanged();
|
||||
|
||||
void UpdateHackSettings();
|
||||
|
||||
// Extensions
|
||||
QComboBox* m_extension_combo;
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
#include "Core/PrimeHack/HackConfig.h"
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
static std::recursive_mutex s_get_state_mutex;
|
||||
|
@ -99,6 +99,7 @@ void ControllerInterface::RefreshDevices()
|
||||
|
||||
#ifdef CIFACE_USE_WIN32
|
||||
ciface::Win32::PopulateDevices(m_wsi.render_surface);
|
||||
|
||||
prime::InitializeHack("Keyboard Mouse", "DInput");
|
||||
#endif
|
||||
#ifdef CIFACE_USE_XLIB
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "InputCommon/InputConfig.h"
|
||||
#include "InputCommon/InputProfile.h"
|
||||
|
||||
#include "Core/PrimeHack/HackConfig.h"
|
||||
|
||||
InputConfig::InputConfig(const std::string& ini_name, const std::string& gui_name,
|
||||
const std::string& profile_name)
|
||||
: m_ini_name(ini_name), m_gui_name(gui_name), m_profile_name(profile_name)
|
||||
@ -138,6 +140,7 @@ bool InputConfig::LoadConfig(bool isGC)
|
||||
{
|
||||
m_controllers[0]->LoadDefaults(g_controller_interface);
|
||||
m_controllers[0]->UpdateReferences(g_controller_interface);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -232,18 +232,8 @@ void SetUserDirectory(const std::string& custom_path)
|
||||
local = local || File::Exists(File::GetExeDirectory() + DIR_SEP "portable.txt");
|
||||
|
||||
// Get Program Files path in case we need it.
|
||||
TCHAR my_documents[MAX_PATH];
|
||||
bool my_documents_found = SUCCEEDED(
|
||||
SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, my_documents));
|
||||
|
||||
if (local) // Case 1-2
|
||||
user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
else if (configPath[0]) // Case 3
|
||||
user_path = TStrToUTF8(configPath);
|
||||
else if (my_documents_found) // Case 4
|
||||
user_path = TStrToUTF8(my_documents) + DIR_SEP "Dolphin Emulator" DIR_SEP;
|
||||
else // Case 5
|
||||
user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
user_path = File::GetExeDirectory() + DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
|
||||
// Prettify the path: it will be displayed in some places, we don't want a mix
|
||||
// of \ and /.
|
||||
@ -254,7 +244,7 @@ void SetUserDirectory(const std::string& custom_path)
|
||||
user_path += DIR_SEP;
|
||||
|
||||
#else
|
||||
if (File::IsDirectory(ROOT_DIR DIR_SEP USERDATA_DIR))
|
||||
if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
|
||||
{
|
||||
user_path = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user