Core: Add new Free Look settings and config
This commit is contained in:
parent
f6ab9a9b6f
commit
27acba620c
|
@ -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,8 @@ add_library(core
|
|||
CoreTiming.h
|
||||
DSPEmulator.cpp
|
||||
DSPEmulator.h
|
||||
FreeLookConfig.cpp
|
||||
FreeLookConfig.h
|
||||
GeckoCodeConfig.cpp
|
||||
GeckoCodeConfig.h
|
||||
GeckoCode.cpp
|
||||
|
@ -58,6 +60,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
|
|
@ -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;
|
||||
|
|
|
@ -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,7 @@
|
|||
<ClCompile Include="FifoPlayer\FifoPlayer.cpp" />
|
||||
<ClCompile Include="FifoPlayer\FifoRecordAnalyzer.cpp" />
|
||||
<ClCompile Include="FifoPlayer\FifoRecorder.cpp" />
|
||||
<ClCompile Include="FreeLookConfig.cpp" />
|
||||
<ClCompile Include="GeckoCode.cpp" />
|
||||
<ClCompile Include="GeckoCodeConfig.cpp" />
|
||||
<ClCompile Include="HLE\HLE.cpp" />
|
||||
|
@ -386,6 +388,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 +439,7 @@
|
|||
<ClInclude Include="FifoPlayer\FifoPlayer.h" />
|
||||
<ClInclude Include="FifoPlayer\FifoRecordAnalyzer.h" />
|
||||
<ClInclude Include="FifoPlayer\FifoRecorder.h" />
|
||||
<ClInclude Include="FreeLookConfig.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
|
Loading…
Reference in New Issue