Added Initial Achievement Settings

Added AchievementSettings in Config with RA_INTEGRATION_ENABLED, RA_USERNAME, and RA_API_TOKEN. Includes code to load and store from Achievements.ini file in config folder.
This commit is contained in:
LillyJadeKatrin 2023-03-16 09:06:24 -04:00
parent f3114b59f4
commit 07d2f3d305
11 changed files with 49 additions and 1 deletions

View File

@ -112,6 +112,7 @@
#define LOGGER_CONFIG "Logger.ini"
#define DUALSHOCKUDPCLIENT_CONFIG "DSUClient.ini"
#define FREELOOK_CONFIG "FreeLook.ini"
#define RETROACHIEVEMENTS_CONFIG "RetroAchievements.ini"
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
#define MAIN_LOG "dolphin.log"

View File

@ -160,7 +160,8 @@ static const std::map<System, std::string> system_to_name = {
{System::DualShockUDPClient, "DualShockUDPClient"},
{System::FreeLook, "FreeLook"},
{System::Session, "Session"},
{System::GameSettingsOnly, "GameSettingsOnly"}};
{System::GameSettingsOnly, "GameSettingsOnly"},
{System::Achievements, "Achievements"}};
const std::string& GetSystemName(System system)
{

View File

@ -34,6 +34,7 @@ enum class System
FreeLook,
Session,
GameSettingsOnly,
Achievements,
};
constexpr std::array<LayerType, 7> SEARCH_ORDER{{

View File

@ -847,6 +847,8 @@ static void RebuildUserDirectories(unsigned int dir_index)
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_RETROACHIEVEMENTSCONFIG_IDX] =
s_user_paths[D_CONFIG_IDX] + RETROACHIEVEMENTS_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;

View File

@ -85,6 +85,7 @@ enum
F_DUALSHOCKUDPCLIENTCONFIG_IDX,
F_FREELOOKCONFIG_IDX,
F_GBABIOS_IDX,
F_RETROACHIEVEMENTSCONFIG_IDX,
NUM_PATH_INDICES
};

View File

@ -21,6 +21,8 @@ add_library(core
CheatSearch.cpp
CheatSearch.h
CommonTitles.h
Config/AchievementSettings.cpp
Config/AchievementSettings.h
Config/DefaultLocale.cpp
Config/DefaultLocale.h
Config/FreeLookSettings.cpp

View File

@ -0,0 +1,16 @@
// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "Core/Config/AchievementSettings.h"
#include <string>
#include "Common/Config/Config.h"
namespace Config
{
// Configuration Information
const Info<bool> RA_ENABLED{{System::Achievements, "Achievements", "Enabled"}, false};
const Info<std::string> RA_USERNAME{{System::Achievements, "Achievements", "Username"}, ""};
const Info<std::string> RA_API_TOKEN{{System::Achievements, "Achievements", "ApiToken"}, ""};
} // namespace Config

View File

@ -0,0 +1,14 @@
// Copyright 2023 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "Common/Config/Config.h"
namespace Config
{
// Configuration Information
extern const Info<bool> RA_ENABLED;
extern const Info<std::string> RA_USERNAME;
extern const Info<std::string> RA_API_TOKEN;
} // namespace Config

View File

@ -94,6 +94,7 @@ const std::map<Config::System, int> system_to_ini = {
{Config::System::Debugger, F_DEBUGGERCONFIG_IDX},
{Config::System::DualShockUDPClient, F_DUALSHOCKUDPCLIENTCONFIG_IDX},
{Config::System::FreeLook, F_FREELOOKCONFIG_IDX},
{Config::System::Achievements, F_RETROACHIEVEMENTSCONFIG_IDX},
// Config::System::Session should not be added to this list
};

View File

@ -7,6 +7,7 @@
#include <vector>
#include "Common/Config/Config.h"
#include "Core/Config/AchievementSettings.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/UISettings.h"
@ -37,6 +38,12 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::WIIMOTE_3_SOURCE.GetLocation(),
&Config::WIIMOTE_4_SOURCE.GetLocation(),
&Config::WIIMOTE_BB_SOURCE.GetLocation(),
// Achievements
&Config::RA_ENABLED.GetLocation(),
&Config::RA_USERNAME.GetLocation(),
&Config::RA_API_TOKEN.GetLocation(),
};
return std::any_of(begin(s_setting_saveable), end(s_setting_saveable),

View File

@ -172,6 +172,7 @@
<ClInclude Include="Core\CheatGeneration.h" />
<ClInclude Include="Core\CheatSearch.h" />
<ClInclude Include="Core\CommonTitles.h" />
<ClInclude Include="Core\Config\AchievementSettings.h" />
<ClInclude Include="Core\Config\DefaultLocale.h" />
<ClInclude Include="Core\Config\FreeLookSettings.h" />
<ClInclude Include="Core\Config\GraphicsSettings.h" />
@ -805,6 +806,7 @@
<ClCompile Include="Core\BootManager.cpp" />
<ClCompile Include="Core\CheatGeneration.cpp" />
<ClCompile Include="Core\CheatSearch.cpp" />
<ClCompile Include="Core\Config\AchievementSettings.cpp" />
<ClCompile Include="Core\Config\DefaultLocale.cpp" />
<ClCompile Include="Core\Config\FreeLookSettings.cpp" />
<ClCompile Include="Core\Config\GraphicsSettings.cpp" />