mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #8867 from iwubcode/freelook_controller
Make Free Look a proper controller, move to separate UI
This commit is contained in:
@@ -87,6 +87,7 @@
|
||||
#define DEBUGGER_CONFIG "Debugger.ini"
|
||||
#define LOGGER_CONFIG "Logger.ini"
|
||||
#define DUALSHOCKUDPCLIENT_CONFIG "DSUClient.ini"
|
||||
#define FREELOOK_CONFIG "FreeLook.ini"
|
||||
|
||||
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
|
||||
#define MAIN_LOG "dolphin.log"
|
||||
|
||||
@@ -31,6 +31,7 @@ enum class System
|
||||
Logger,
|
||||
Debugger,
|
||||
DualShockUDPClient,
|
||||
FreeLook,
|
||||
};
|
||||
|
||||
constexpr std::array<LayerType, 7> SEARCH_ORDER{{
|
||||
|
||||
@@ -866,6 +866,7 @@ static void RebuildUserDirectories(unsigned int dir_index)
|
||||
s_user_paths[F_LOGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
||||
s_user_paths[F_DUALSHOCKUDPCLIENTCONFIG_IDX] =
|
||||
s_user_paths[D_CONFIG_IDX] + DUALSHOCKUDPCLIENT_CONFIG;
|
||||
s_user_paths[F_FREELOOKCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + FREELOOK_CONFIG;
|
||||
s_user_paths[F_MAINLOG_IDX] = s_user_paths[D_LOGS_IDX] + MAIN_LOG;
|
||||
s_user_paths[F_MEM1DUMP_IDX] = s_user_paths[D_DUMP_IDX] + MEM1_DUMP;
|
||||
s_user_paths[F_MEM2DUMP_IDX] = s_user_paths[D_DUMP_IDX] + MEM2_DUMP;
|
||||
|
||||
@@ -72,6 +72,7 @@ enum
|
||||
F_MEMORYWATCHERSOCKET_IDX,
|
||||
F_WIISDCARD_IDX,
|
||||
F_DUALSHOCKUDPCLIENTCONFIG_IDX,
|
||||
F_FREELOOKCONFIG_IDX,
|
||||
NUM_PATH_INDICES
|
||||
};
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ add_library(core
|
||||
CoreTiming.h
|
||||
DSPEmulator.cpp
|
||||
DSPEmulator.h
|
||||
FreeLookConfig.cpp
|
||||
FreeLookConfig.h
|
||||
FreeLookManager.cpp
|
||||
FreeLookManager.h
|
||||
GeckoCodeConfig.cpp
|
||||
GeckoCodeConfig.h
|
||||
GeckoCode.cpp
|
||||
@@ -58,6 +62,8 @@ add_library(core
|
||||
Boot/ElfReader.cpp
|
||||
Boot/ElfReader.h
|
||||
Boot/ElfTypes.h
|
||||
Config/FreeLookSettings.cpp
|
||||
Config/FreeLookSettings.h
|
||||
Config/GraphicsSettings.cpp
|
||||
Config/GraphicsSettings.h
|
||||
Config/MainSettings.cpp
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2020 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/FreeLookConfig.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
// Configuration Information
|
||||
const Info<bool> FREE_LOOK_ENABLED{{System::FreeLook, "General", "Enabled"}, false};
|
||||
|
||||
// FreeLook.Controller1
|
||||
const Info<FreeLook::ControlType> FL1_CONTROL_TYPE{{System::FreeLook, "Camera1", "ControlType"},
|
||||
FreeLook::ControlType::SixAxis};
|
||||
|
||||
} // namespace Config
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2020 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
namespace FreeLook
|
||||
{
|
||||
enum class ControlType : int;
|
||||
}
|
||||
|
||||
namespace Config
|
||||
{
|
||||
// Configuration Information
|
||||
|
||||
extern const Info<bool> FREE_LOOK_ENABLED;
|
||||
|
||||
// FreeLook.Controller1
|
||||
extern const Info<FreeLook::ControlType> FL1_CONTROL_TYPE;
|
||||
|
||||
} // namespace Config
|
||||
@@ -42,9 +42,6 @@ const Info<bool> GFX_CACHE_HIRES_TEXTURES{{System::GFX, "Settings", "CacheHiresT
|
||||
const Info<bool> GFX_DUMP_EFB_TARGET{{System::GFX, "Settings", "DumpEFBTarget"}, false};
|
||||
const Info<bool> GFX_DUMP_XFB_TARGET{{System::GFX, "Settings", "DumpXFBTarget"}, false};
|
||||
const Info<bool> GFX_DUMP_FRAMES_AS_IMAGES{{System::GFX, "Settings", "DumpFramesAsImages"}, false};
|
||||
const Info<bool> GFX_FREE_LOOK{{System::GFX, "Settings", "FreeLook"}, false};
|
||||
const Info<FreelookControlType> GFX_FREE_LOOK_CONTROL_TYPE{
|
||||
{System::GFX, "Settings", "FreeLookControlType"}, FreelookControlType::SixAxis};
|
||||
const Info<bool> GFX_USE_FFV1{{System::GFX, "Settings", "UseFFV1"}, false};
|
||||
const Info<std::string> GFX_DUMP_FORMAT{{System::GFX, "Settings", "DumpFormat"}, "avi"};
|
||||
const Info<std::string> GFX_DUMP_CODEC{{System::GFX, "Settings", "DumpCodec"}, ""};
|
||||
|
||||
@@ -43,8 +43,6 @@ extern const Info<bool> GFX_CACHE_HIRES_TEXTURES;
|
||||
extern const Info<bool> GFX_DUMP_EFB_TARGET;
|
||||
extern const Info<bool> GFX_DUMP_XFB_TARGET;
|
||||
extern const Info<bool> GFX_DUMP_FRAMES_AS_IMAGES;
|
||||
extern const Info<bool> GFX_FREE_LOOK;
|
||||
extern const Info<FreelookControlType> GFX_FREE_LOOK_CONTROL_TYPE;
|
||||
extern const Info<bool> GFX_USE_FFV1;
|
||||
extern const Info<std::string> GFX_DUMP_FORMAT;
|
||||
extern const Info<std::string> GFX_DUMP_CODEC;
|
||||
|
||||
@@ -90,6 +90,7 @@ const std::map<Config::System, int> system_to_ini = {
|
||||
{Config::System::Logger, F_LOGGERCONFIG_IDX},
|
||||
{Config::System::Debugger, F_DEBUGGERCONFIG_IDX},
|
||||
{Config::System::DualShockUDPClient, F_DUALSHOCKUDPCLIENTCONFIG_IDX},
|
||||
{Config::System::FreeLook, F_FREELOOKCONFIG_IDX},
|
||||
};
|
||||
|
||||
// INI layer configuration loader
|
||||
|
||||
@@ -16,8 +16,9 @@ namespace ConfigLoaders
|
||||
{
|
||||
bool IsSettingSaveable(const Config::Location& config_location)
|
||||
{
|
||||
for (Config::System system : {Config::System::SYSCONF, Config::System::GFX,
|
||||
Config::System::DualShockUDPClient, Config::System::Logger})
|
||||
for (Config::System system :
|
||||
{Config::System::SYSCONF, Config::System::GFX, Config::System::DualShockUDPClient,
|
||||
Config::System::Logger, Config::System::FreeLook})
|
||||
{
|
||||
if (config_location.system == system)
|
||||
return true;
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/DSPEmulator.h"
|
||||
#include "Core/FifoPlayer/FifoPlayer.h"
|
||||
#include "Core/FreeLookManager.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/HW/DSP.h"
|
||||
@@ -83,7 +84,6 @@
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "jni/AndroidCommon/IDCache.h"
|
||||
@@ -485,6 +485,15 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
NetPlay::SetupWiimotes();
|
||||
}
|
||||
|
||||
if (init_controllers)
|
||||
{
|
||||
FreeLook::Initialize();
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeLook::LoadInputConfig();
|
||||
}
|
||||
|
||||
Common::ScopeGuard controller_guard{[init_controllers, init_wiimotes] {
|
||||
if (!init_controllers)
|
||||
return;
|
||||
@@ -495,6 +504,8 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
||||
Wiimote::Shutdown();
|
||||
}
|
||||
|
||||
FreeLook::Shutdown();
|
||||
|
||||
ResetRumble();
|
||||
|
||||
Keyboard::Shutdown();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<ClCompile Include="Boot\Boot_WiiWAD.cpp" />
|
||||
<ClCompile Include="Boot\DolReader.cpp" />
|
||||
<ClCompile Include="Boot\ElfReader.cpp" />
|
||||
<ClCompile Include="Config\FreeLookSettings.cpp" />
|
||||
<ClCompile Include="Config\GraphicsSettings.cpp" />
|
||||
<ClCompile Include="Config\MainSettings.cpp" />
|
||||
<ClCompile Include="Config\NetplaySettings.cpp" />
|
||||
@@ -83,6 +84,8 @@
|
||||
<ClCompile Include="FifoPlayer\FifoPlayer.cpp" />
|
||||
<ClCompile Include="FifoPlayer\FifoRecordAnalyzer.cpp" />
|
||||
<ClCompile Include="FifoPlayer\FifoRecorder.cpp" />
|
||||
<ClCompile Include="FreeLookConfig.cpp" />
|
||||
<ClCompile Include="FreeLookManager.cpp" />
|
||||
<ClCompile Include="GeckoCode.cpp" />
|
||||
<ClCompile Include="GeckoCodeConfig.cpp" />
|
||||
<ClCompile Include="HLE\HLE.cpp" />
|
||||
@@ -386,6 +389,7 @@
|
||||
<ClInclude Include="Boot\ElfReader.h" />
|
||||
<ClInclude Include="Boot\ElfTypes.h" />
|
||||
<ClInclude Include="CheatCodes.h" />
|
||||
<ClInclude Include="Config\FreeLookSettings.h" />
|
||||
<ClInclude Include="Config\GraphicsSettings.h" />
|
||||
<ClInclude Include="Config\MainSettings.h" />
|
||||
<ClInclude Include="Config\NetplaySettings.h" />
|
||||
@@ -436,6 +440,8 @@
|
||||
<ClInclude Include="FifoPlayer\FifoPlayer.h" />
|
||||
<ClInclude Include="FifoPlayer\FifoRecordAnalyzer.h" />
|
||||
<ClInclude Include="FifoPlayer\FifoRecorder.h" />
|
||||
<ClInclude Include="FreeLookConfig.h" />
|
||||
<ClInclude Include="FreeLookManager.h" />
|
||||
<ClInclude Include="GeckoCode.h" />
|
||||
<ClInclude Include="GeckoCodeConfig.h" />
|
||||
<ClInclude Include="HLE\HLE.h" />
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 2020 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/FreeLookConfig.h"
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
namespace FreeLook
|
||||
{
|
||||
static Config s_config;
|
||||
static Config s_active_config;
|
||||
static bool s_has_registered_callback = false;
|
||||
|
||||
Config& GetConfig()
|
||||
{
|
||||
return s_config;
|
||||
}
|
||||
|
||||
const Config& GetActiveConfig()
|
||||
{
|
||||
return s_active_config;
|
||||
}
|
||||
|
||||
void UpdateActiveConfig()
|
||||
{
|
||||
s_active_config = s_config;
|
||||
}
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
camera_config.control_type = ControlType::SixAxis;
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
void Config::Refresh()
|
||||
{
|
||||
if (!s_has_registered_callback)
|
||||
{
|
||||
::Config::AddConfigChangedCallback([] { Core::RunAsCPUThread([] { s_config.Refresh(); }); });
|
||||
s_has_registered_callback = true;
|
||||
}
|
||||
|
||||
camera_config.control_type = ::Config::Get(::Config::FL1_CONTROL_TYPE);
|
||||
enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED);
|
||||
}
|
||||
} // namespace FreeLook
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2020 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
// IMPORTANT: UI etc should modify the value returned by FreeLook::GetConfig().
|
||||
// Free Look code should read from the value returned by FreeLook::GetActiveConfig().
|
||||
// The reason for this is to get rid of race conditions etc when the
|
||||
// configuration changes in the middle of a frame.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace FreeLook
|
||||
{
|
||||
enum class ControlType : int
|
||||
{
|
||||
SixAxis,
|
||||
FPS,
|
||||
Orbital
|
||||
};
|
||||
|
||||
struct CameraConfig
|
||||
{
|
||||
ControlType control_type;
|
||||
};
|
||||
|
||||
// NEVER inherit from this class.
|
||||
struct Config final
|
||||
{
|
||||
Config();
|
||||
void Refresh();
|
||||
|
||||
CameraConfig camera_config;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
Config& GetConfig();
|
||||
const Config& GetActiveConfig();
|
||||
|
||||
// Called every frame.
|
||||
void UpdateActiveConfig();
|
||||
} // namespace FreeLook
|
||||
@@ -0,0 +1,247 @@
|
||||
// Copyright 2020 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/FreeLookManager.h"
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/FreeLookConfig.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
#include "VideoCommon/FreeLookCamera.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace MoveButtons
|
||||
{
|
||||
enum MoveButtons
|
||||
{
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right,
|
||||
Forward,
|
||||
Backward,
|
||||
};
|
||||
}
|
||||
|
||||
namespace SpeedButtons
|
||||
{
|
||||
enum SpeedButtons
|
||||
{
|
||||
Decrease,
|
||||
Increase,
|
||||
Reset,
|
||||
};
|
||||
}
|
||||
|
||||
namespace OtherButtons
|
||||
{
|
||||
enum OtherButtons
|
||||
{
|
||||
ResetView,
|
||||
};
|
||||
}
|
||||
|
||||
namespace FieldOfViewButtons
|
||||
{
|
||||
enum FieldOfViewButtons
|
||||
{
|
||||
IncreaseX,
|
||||
DecreaseX,
|
||||
IncreaseY,
|
||||
DecreaseY,
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
FreeLookController::FreeLookController(const unsigned int index) : m_index(index)
|
||||
{
|
||||
groups.emplace_back(m_move_buttons = new ControllerEmu::Buttons(_trans("Move")));
|
||||
|
||||
m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Up"));
|
||||
m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Down"));
|
||||
m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Left"));
|
||||
m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Right"));
|
||||
m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Forward"));
|
||||
m_move_buttons->AddInput(ControllerEmu::Translate, _trans("Backward"));
|
||||
|
||||
groups.emplace_back(m_speed_buttons = new ControllerEmu::Buttons(_trans("Speed")));
|
||||
|
||||
m_speed_buttons->AddInput(ControllerEmu::Translate, _trans("Decrease"));
|
||||
m_speed_buttons->AddInput(ControllerEmu::Translate, _trans("Increase"));
|
||||
m_speed_buttons->AddInput(ControllerEmu::Translate, _trans("Reset"));
|
||||
|
||||
groups.emplace_back(m_other_buttons = new ControllerEmu::Buttons(_trans("Other")));
|
||||
|
||||
m_other_buttons->AddInput(ControllerEmu::Translate, _trans("Reset View"));
|
||||
|
||||
groups.emplace_back(m_fov_buttons = new ControllerEmu::Buttons(_trans("Field of View")));
|
||||
|
||||
m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Increase X"));
|
||||
m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Decrease X"));
|
||||
m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Increase Y"));
|
||||
m_fov_buttons->AddInput(ControllerEmu::Translate, _trans("Decrease Y"));
|
||||
}
|
||||
|
||||
std::string FreeLookController::GetName() const
|
||||
{
|
||||
return std::string("FreeLook") + char('1' + m_index);
|
||||
}
|
||||
|
||||
void FreeLookController::LoadDefaults(const ControllerInterface& ciface)
|
||||
{
|
||||
EmulatedController::LoadDefaults(ciface);
|
||||
|
||||
auto hotkey_string = [](std::vector<std::string> inputs) {
|
||||
return "@(" + JoinStrings(inputs, "+") + ')';
|
||||
};
|
||||
|
||||
m_move_buttons->SetControlExpression(MoveButtons::Up, hotkey_string({"Shift", "E"}));
|
||||
m_move_buttons->SetControlExpression(MoveButtons::Down, hotkey_string({"Shift", "Q"}));
|
||||
m_move_buttons->SetControlExpression(MoveButtons::Left, hotkey_string({"Shift", "A"}));
|
||||
m_move_buttons->SetControlExpression(MoveButtons::Right, hotkey_string({"Shift", "D"}));
|
||||
m_move_buttons->SetControlExpression(MoveButtons::Forward, hotkey_string({"Shift", "W"}));
|
||||
m_move_buttons->SetControlExpression(MoveButtons::Backward, hotkey_string({"Shift", "S"}));
|
||||
|
||||
m_speed_buttons->SetControlExpression(SpeedButtons::Decrease, hotkey_string({"Shift", "`1`"}));
|
||||
m_speed_buttons->SetControlExpression(SpeedButtons::Increase, hotkey_string({"Shift", "`2`"}));
|
||||
m_speed_buttons->SetControlExpression(SpeedButtons::Reset, hotkey_string({"Shift", "F"}));
|
||||
|
||||
m_other_buttons->SetControlExpression(OtherButtons::ResetView, hotkey_string({"Shift", "R"}));
|
||||
|
||||
m_fov_buttons->SetControlExpression(FieldOfViewButtons::IncreaseX,
|
||||
hotkey_string({"Shift", "`Axis Z+`"}));
|
||||
m_fov_buttons->SetControlExpression(FieldOfViewButtons::DecreaseX,
|
||||
hotkey_string({"Shift", "`Axis Z-`"}));
|
||||
m_fov_buttons->SetControlExpression(FieldOfViewButtons::IncreaseY,
|
||||
hotkey_string({"Shift", "`Axis Z+`"}));
|
||||
m_fov_buttons->SetControlExpression(FieldOfViewButtons::DecreaseY,
|
||||
hotkey_string({"Shift", "`Axis Z-`"}));
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* FreeLookController::GetGroup(FreeLookGroup group) const
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case FreeLookGroup::Move:
|
||||
return m_move_buttons;
|
||||
case FreeLookGroup::Speed:
|
||||
return m_speed_buttons;
|
||||
case FreeLookGroup::FieldOfView:
|
||||
return m_fov_buttons;
|
||||
case FreeLookGroup::Other:
|
||||
return m_other_buttons;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void FreeLookController::Update()
|
||||
{
|
||||
if (!g_freelook_camera.IsActive())
|
||||
return;
|
||||
|
||||
if (m_move_buttons->controls[MoveButtons::Up]->GetState<bool>())
|
||||
g_freelook_camera.MoveVertical(-g_freelook_camera.GetSpeed());
|
||||
|
||||
if (m_move_buttons->controls[MoveButtons::Down]->GetState<bool>())
|
||||
g_freelook_camera.MoveVertical(g_freelook_camera.GetSpeed());
|
||||
|
||||
if (m_move_buttons->controls[MoveButtons::Left]->GetState<bool>())
|
||||
g_freelook_camera.MoveHorizontal(g_freelook_camera.GetSpeed());
|
||||
|
||||
if (m_move_buttons->controls[MoveButtons::Right]->GetState<bool>())
|
||||
g_freelook_camera.MoveHorizontal(-g_freelook_camera.GetSpeed());
|
||||
|
||||
if (m_move_buttons->controls[MoveButtons::Forward]->GetState<bool>())
|
||||
g_freelook_camera.MoveForward(g_freelook_camera.GetSpeed());
|
||||
|
||||
if (m_move_buttons->controls[MoveButtons::Backward]->GetState<bool>())
|
||||
g_freelook_camera.MoveForward(-g_freelook_camera.GetSpeed());
|
||||
|
||||
if (m_fov_buttons->controls[FieldOfViewButtons::IncreaseX]->GetState<bool>())
|
||||
g_freelook_camera.IncreaseFovX(g_freelook_camera.GetFovStepSize());
|
||||
|
||||
if (m_fov_buttons->controls[FieldOfViewButtons::DecreaseX]->GetState<bool>())
|
||||
g_freelook_camera.IncreaseFovX(-1.0f * g_freelook_camera.GetFovStepSize());
|
||||
|
||||
if (m_fov_buttons->controls[FieldOfViewButtons::IncreaseY]->GetState<bool>())
|
||||
g_freelook_camera.IncreaseFovY(g_freelook_camera.GetFovStepSize());
|
||||
|
||||
if (m_fov_buttons->controls[FieldOfViewButtons::DecreaseY]->GetState<bool>())
|
||||
g_freelook_camera.IncreaseFovY(-1.0f * g_freelook_camera.GetFovStepSize());
|
||||
|
||||
if (m_speed_buttons->controls[SpeedButtons::Decrease]->GetState<bool>())
|
||||
g_freelook_camera.ModifySpeed(1.0f / 1.1f);
|
||||
|
||||
if (m_speed_buttons->controls[SpeedButtons::Increase]->GetState<bool>())
|
||||
g_freelook_camera.ModifySpeed(1.1f);
|
||||
|
||||
if (m_speed_buttons->controls[SpeedButtons::Reset]->GetState<bool>())
|
||||
g_freelook_camera.ResetSpeed();
|
||||
|
||||
if (m_other_buttons->controls[OtherButtons::ResetView]->GetState<bool>())
|
||||
g_freelook_camera.Reset();
|
||||
}
|
||||
|
||||
namespace FreeLook
|
||||
{
|
||||
static InputConfig s_config("FreeLookController", _trans("FreeLook"), "FreeLookController");
|
||||
InputConfig* GetInputConfig()
|
||||
{
|
||||
return &s_config;
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
s_config.UnregisterHotplugCallback();
|
||||
|
||||
s_config.ClearControllers();
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
if (s_config.ControllersNeedToBeCreated())
|
||||
{
|
||||
s_config.CreateController<FreeLookController>(0);
|
||||
}
|
||||
|
||||
s_config.RegisterHotplugCallback();
|
||||
|
||||
FreeLook::GetConfig().Refresh();
|
||||
|
||||
s_config.LoadConfig(true);
|
||||
}
|
||||
|
||||
void LoadInputConfig()
|
||||
{
|
||||
s_config.LoadConfig(true);
|
||||
}
|
||||
|
||||
bool IsInitialized()
|
||||
{
|
||||
return !s_config.ControllersNeedToBeCreated();
|
||||
}
|
||||
|
||||
ControllerEmu::ControlGroup* GetInputGroup(int pad_num, FreeLookGroup group)
|
||||
{
|
||||
return static_cast<FreeLookController*>(s_config.GetController(pad_num))->GetGroup(group);
|
||||
}
|
||||
|
||||
void UpdateInput()
|
||||
{
|
||||
for (int i = 0; i < s_config.GetControllerCount(); i++)
|
||||
{
|
||||
static_cast<FreeLookController*>(s_config.GetController(i))->Update();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace FreeLook
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright 2020 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||
|
||||
class InputConfig;
|
||||
|
||||
namespace ControllerEmu
|
||||
{
|
||||
class ControlGroup;
|
||||
class Buttons;
|
||||
} // namespace ControllerEmu
|
||||
|
||||
enum class FreeLookGroup
|
||||
{
|
||||
Move,
|
||||
Speed,
|
||||
FieldOfView,
|
||||
Other
|
||||
};
|
||||
|
||||
namespace FreeLook
|
||||
{
|
||||
void Shutdown();
|
||||
void Initialize();
|
||||
void LoadInputConfig();
|
||||
bool IsInitialized();
|
||||
void UpdateInput();
|
||||
|
||||
InputConfig* GetInputConfig();
|
||||
ControllerEmu::ControlGroup* GetInputGroup(int pad_num, FreeLookGroup group);
|
||||
|
||||
} // namespace FreeLook
|
||||
|
||||
class FreeLookController final : public ControllerEmu::EmulatedController
|
||||
{
|
||||
public:
|
||||
explicit FreeLookController(unsigned int index);
|
||||
|
||||
std::string GetName() const override;
|
||||
void LoadDefaults(const ControllerInterface& ciface) override;
|
||||
|
||||
ControllerEmu::ControlGroup* GetGroup(FreeLookGroup group) const;
|
||||
void Update();
|
||||
|
||||
private:
|
||||
ControllerEmu::Buttons* m_move_buttons;
|
||||
ControllerEmu::Buttons* m_speed_buttons;
|
||||
ControllerEmu::Buttons* m_fov_buttons;
|
||||
ControllerEmu::Buttons* m_other_buttons;
|
||||
|
||||
const unsigned int m_index;
|
||||
};
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
// clang-format off
|
||||
constexpr std::array<const char*, 139> s_hotkey_labels{{
|
||||
constexpr std::array<const char*, 125> s_hotkey_labels{{
|
||||
_trans("Open"),
|
||||
_trans("Change Disc"),
|
||||
_trans("Eject Disc"),
|
||||
@@ -117,21 +117,7 @@ constexpr std::array<const char*, 139> s_hotkey_labels{{
|
||||
// i18n: IR stands for internal resolution
|
||||
_trans("Decrease IR"),
|
||||
|
||||
_trans("Freelook Decrease Speed"),
|
||||
_trans("Freelook Increase Speed"),
|
||||
_trans("Freelook Reset Speed"),
|
||||
_trans("Freelook Move Up"),
|
||||
_trans("Freelook Move Down"),
|
||||
_trans("Freelook Move Left"),
|
||||
_trans("Freelook Move Right"),
|
||||
_trans("Freelook Zoom In"),
|
||||
_trans("Freelook Zoom Out"),
|
||||
_trans("Freelook Reset"),
|
||||
_trans("Freelook Toggle"),
|
||||
_trans("Freelook Increase Field of View X"),
|
||||
_trans("Freelook Decrease Field of View X"),
|
||||
_trans("Freelook Increase Field of View Y"),
|
||||
_trans("Freelook Decrease Field of View Y"),
|
||||
|
||||
_trans("Toggle 3D Side-by-Side"),
|
||||
_trans("Toggle 3D Top-Bottom"),
|
||||
@@ -339,7 +325,7 @@ constexpr std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> s_groups_info = {
|
||||
{_trans("Controller Profile 4"), HK_NEXT_WIIMOTE_PROFILE_4, HK_PREV_GAME_WIIMOTE_PROFILE_4},
|
||||
{_trans("Graphics Toggles"), HK_TOGGLE_CROP, HK_TOGGLE_TEXTURES},
|
||||
{_trans("Internal Resolution"), HK_INCREASE_IR, HK_DECREASE_IR},
|
||||
{_trans("Freelook"), HK_FREELOOK_DECREASE_SPEED, HK_FREELOOK_DECREASE_FOV_Y},
|
||||
{_trans("Freelook"), HK_FREELOOK_TOGGLE, HK_FREELOOK_TOGGLE},
|
||||
// i18n: Stereoscopic 3D
|
||||
{_trans("3D"), HK_TOGGLE_STEREO_SBS, HK_TOGGLE_STEREO_ANAGLYPH},
|
||||
// i18n: Stereoscopic 3D
|
||||
@@ -446,22 +432,6 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
|
||||
set_key_expression(HK_TOGGLE_THROTTLE, "Tab");
|
||||
#endif
|
||||
|
||||
// Freelook
|
||||
set_key_expression(HK_FREELOOK_DECREASE_SPEED, hotkey_string({"Shift", "`1`"}));
|
||||
set_key_expression(HK_FREELOOK_INCREASE_SPEED, hotkey_string({"Shift", "`2`"}));
|
||||
set_key_expression(HK_FREELOOK_RESET_SPEED, hotkey_string({"Shift", "F"}));
|
||||
set_key_expression(HK_FREELOOK_UP, hotkey_string({"Shift", "E"}));
|
||||
set_key_expression(HK_FREELOOK_DOWN, hotkey_string({"Shift", "Q"}));
|
||||
set_key_expression(HK_FREELOOK_LEFT, hotkey_string({"Shift", "A"}));
|
||||
set_key_expression(HK_FREELOOK_RIGHT, hotkey_string({"Shift", "D"}));
|
||||
set_key_expression(HK_FREELOOK_ZOOM_IN, hotkey_string({"Shift", "W"}));
|
||||
set_key_expression(HK_FREELOOK_ZOOM_OUT, hotkey_string({"Shift", "S"}));
|
||||
set_key_expression(HK_FREELOOK_RESET, hotkey_string({"Shift", "R"}));
|
||||
set_key_expression(HK_FREELOOK_INCREASE_FOV_X, hotkey_string({"Shift", "`Axis Z+`"}));
|
||||
set_key_expression(HK_FREELOOK_DECREASE_FOV_X, hotkey_string({"Shift", "`Axis Z-`"}));
|
||||
set_key_expression(HK_FREELOOK_INCREASE_FOV_Y, hotkey_string({"Shift", "`Axis Z+`"}));
|
||||
set_key_expression(HK_FREELOOK_DECREASE_FOV_Y, hotkey_string({"Shift", "`Axis Z-`"}));
|
||||
|
||||
// Savestates
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
|
||||
@@ -101,21 +101,7 @@ enum Hotkey
|
||||
HK_INCREASE_IR,
|
||||
HK_DECREASE_IR,
|
||||
|
||||
HK_FREELOOK_DECREASE_SPEED,
|
||||
HK_FREELOOK_INCREASE_SPEED,
|
||||
HK_FREELOOK_RESET_SPEED,
|
||||
HK_FREELOOK_UP,
|
||||
HK_FREELOOK_DOWN,
|
||||
HK_FREELOOK_LEFT,
|
||||
HK_FREELOOK_RIGHT,
|
||||
HK_FREELOOK_ZOOM_IN,
|
||||
HK_FREELOOK_ZOOM_OUT,
|
||||
HK_FREELOOK_RESET,
|
||||
HK_FREELOOK_TOGGLE,
|
||||
HK_FREELOOK_INCREASE_FOV_X,
|
||||
HK_FREELOOK_DECREASE_FOV_X,
|
||||
HK_FREELOOK_INCREASE_FOV_Y,
|
||||
HK_FREELOOK_DECREASE_FOV_Y,
|
||||
|
||||
HK_TOGGLE_STEREO_SBS,
|
||||
HK_TOGGLE_STEREO_TAB,
|
||||
|
||||
@@ -74,7 +74,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
||||
static std::thread g_save_thread;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
constexpr u32 STATE_VERSION = 124; // Last changed in PR 9097
|
||||
constexpr u32 STATE_VERSION = 125; // Last changed in PR 8867
|
||||
|
||||
// Maps savestate versions to Dolphin versions.
|
||||
// Versions after 42 don't need to be added to this list,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user