most of ini stuff converted. Still need to build Qt UI. Slot B not yet defaulting to slippi for some reason

This commit is contained in:
R2DLiu 2023-06-15 15:25:39 -04:00
commit b32a07656d
21 changed files with 321 additions and 232 deletions

View file

@ -25,11 +25,34 @@
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/HW/SI/SI_Device.h" #include "Core/HW/SI/SI_Device.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
namespace Config namespace Config
{ {
// Main.Slippi
// Netplay Settings
const Info<u8> SLIPPI_ONLINE_DELAY{{System::Main, "Slippi", "OnlineDelay"}, 2};
const Info<bool> SLIPPI_ENABLE_SPECTATOR{{System::Main, "Slippi", "EnableSpectator"}, true};
const Info<u32> SLIPPI_SPECTATOR_LOCAL_PORT{{System::Main, "Slippi", "SpectatorLocalPort"}, 51441};
const Info<bool> SLIPPI_SAVE_REPLAYS{{System::Main, "Slippi", "SaveReplays"}, true};
const Info<Slippi::Chat> SLIPPI_ENABLE_QUICK_CHAT{{System::Main, "Slippi", "EnableQuickChat"},
Slippi::Chat::ON};
const Info<bool> SLIPPI_FORCE_NETPLAY_PORT{{System::Main, "Slippi", "ForceNetplayPort"}, false};
const Info<u32> SLIPPI_NETPLAY_PORT{{System::Main, "Slippi", "NetplayPort"}, 2626};
const Info<bool> SLIPPI_FORCE_LAN_IP{{System::Main, "Slippi", "ForceLanIP"}, false};
const Info<std::string> SLIPPI_LAN_IP{{System::Main, "Slippi", "LanIP"}, ""};
const Info<bool> SLIPPI_REPLAY_MONTH_FOLDERS{{System::Main, "Slippi", "ReplayMonthFolders"}, true};
const Info<std::string> SLIPPI_REPLAY_DIR{{System::Main, "Slippi", "ReplayDir"},
File::GetHomeDirectory() + DIR_SEP + "Slippi"};
const Info<bool> SLIPPI_ENABLE_FRAME_INDEX{{System::Main, "Slippi", "EnableFrameIndex"}, false};
const Info<bool> SLIPPI_BLOCKING_PIPES{{System::Main, "Slippi", "BlockingPipes"}, false};
// Playback Settings
const Info<bool> SLIPPI_ENABLE_SEEK{{System::Main, "Slippi", "EnableSeek"}, true};
// Main.Core // Main.Core
const Info<bool> MAIN_SKIP_IPL{{System::Main, "Core", "SkipIPL"}, true}; const Info<bool> MAIN_SKIP_IPL{{System::Main, "Core", "SkipIPL"}, true};
@ -107,10 +130,10 @@ const Info<std::string>& GetInfoForGCIPathOverride(ExpansionInterface::Slot slot
const Info<int> MAIN_MEMORY_CARD_SIZE{{System::Main, "Core", "MemoryCardSize"}, -1}; const Info<int> MAIN_MEMORY_CARD_SIZE{{System::Main, "Core", "MemoryCardSize"}, -1};
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A{ const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A{{System::Main, "Core", "SlotA"},
{System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDeviceType::None}; ExpansionInterface::EXIDeviceType::None};
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B{{System::Main, "Core", "SlotB"}, const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B{
ExpansionInterface::EXIDeviceType::Slippi}; {System::Main, "Core", "SlotB"}, ExpansionInterface::EXIDeviceType::Slippi};
const Info<ExpansionInterface::EXIDeviceType> MAIN_SERIAL_PORT_1{ const Info<ExpansionInterface::EXIDeviceType> MAIN_SERIAL_PORT_1{
{System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDeviceType::None}; {System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDeviceType::None};

View file

@ -10,6 +10,8 @@
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Core/Slippi/SlippiConfig.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
// DSP Backend Types // DSP Backend Types
@ -49,6 +51,26 @@ enum class HSPDeviceType : int;
namespace Config namespace Config
{ {
// Main.Slippi
// Netplay Settings
extern const Info<u8> SLIPPI_ONLINE_DELAY;
extern const Info<bool> SLIPPI_ENABLE_SPECTATOR;
extern const Info<u32> SLIPPI_SPECTATOR_LOCAL_PORT;
extern const Info<bool> SLIPPI_SAVE_REPLAYS;
extern const Info<Slippi::Chat> SLIPPI_ENABLE_QUICK_CHAT;
extern const Info<bool> SLIPPI_FORCE_NETPLAY_PORT;
extern const Info<u32> SLIPPI_NETPLAY_PORT;
extern const Info<bool> SLIPPI_FORCE_LAN_IP;
extern const Info<std::string> SLIPPI_LAN_IP;
extern const Info<bool> SLIPPI_REPLAY_MONTH_FOLDERS;
extern const Info<std::string> SLIPPI_REPLAY_DIR;
extern const Info<bool> SLIPPI_ENABLE_FRAME_INDEX;
extern const Info<bool> SLIPPI_BLOCKING_PIPES;
// Playback Settings
extern const Info<bool> SLIPPI_ENABLE_SEEK;
// Main.Core // Main.Core
extern const Info<bool> MAIN_SKIP_IPL; extern const Info<bool> MAIN_SKIP_IPL;

View file

@ -116,6 +116,29 @@ void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
volume.GetTitleID(partition).value_or(0), volume.GetTitleID(partition).value_or(0),
volume.GetRevision(partition).value_or(0), volume.GetRegion()); volume.GetRevision(partition).value_or(0), volume.GetRegion());
} }
// Set Slippi specific metadata
if (m_game_id == "GALE01" || m_game_id == "GALJ01")
{
slippi_config.melee_version = Melee::Version::NTSC;
if (volume.GetLongNames()[DiscIO::Language::English].find("20XX") != std::string::npos)
slippi_config.melee_version = Melee::Version::TwentyXX;
else
{
// check for m-ex based build
if (volume.GetFileSystem(partition)->FindFileInfo("MxDt.dat") != nullptr)
{
slippi_config.melee_version = Melee::Version::MEX;
}
}
}
else if (m_game_id == "GTME01")
{
slippi_config.melee_version = Melee::Version::UPTM;
}
INFO_LOG_FMT(SLIPPI, "GameType: {}", m_game_id);
} }
void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform) void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform)

View file

@ -40,8 +40,8 @@ struct BootParameters;
struct SConfig struct SConfig
{ {
// Melee Version // Slippi Config
Melee::Version m_melee_version; Slippi::Config slippi_config;
// Settings // Settings
bool bAutomaticStart = false; bool bAutomaticStart = false;
@ -55,25 +55,6 @@ struct SConfig
bool bWii = false; bool bWii = false;
bool m_is_mios = false; bool m_is_mios = false;
// SLIPPITODO: MOVE SOME OF THESE TO Config/Config.h
// enable Slippi Networking output
bool m_OCEnable = true;
float m_OCFactor = 1.0f;
bool m_enableSpectator = true;
int m_spectatorPort = 51441;
std::string m_strSlippiInput = "";
int m_slippiOnlineDelay = 2;
bool m_slippiEnableSeek = true;
bool m_slippiSaveReplays = true;
Slippi::Chat m_slippiEnableQuickChat = Slippi::Chat::ON;
bool m_slippiReplayMonthFolders = true;
std::string m_strSlippiReplayDir;
bool m_blockingPipes = false;
bool m_slippiForceNetplayPort = false;
int m_slippiNetplayPort = 2626;
bool m_slippiForceLanIp = false;
std::string m_slippiLanIp = "";
DiscIO::Region m_region; DiscIO::Region m_region;
// files // files
@ -125,6 +106,7 @@ struct SConfig
// Return the permanent and somewhat globally used instance of this struct // Return the permanent and somewhat globally used instance of this struct
static SConfig& GetInstance() { return (*m_Instance); } static SConfig& GetInstance() { return (*m_Instance); }
static Slippi::Config& GetSlippiConfig() { return m_Instance->slippi_config; }
static void Init(); static void Init();
static void Shutdown(); static void Shutdown();

View file

@ -323,7 +323,10 @@ void CoreTimingManager::Advance()
m_event_queue.pop_back(); m_event_queue.pop_back();
Throttle(evt.time); Throttle(evt.time);
evt.type->callback(system, evt.userdata, m_globals.global_timer - evt.time); if (evt.type != nullptr)
{
evt.type->callback(system, evt.userdata, m_globals.global_timer - evt.time);
}
} }
m_is_global_timer_sane = false; m_is_global_timer_sane = false;

View file

@ -167,8 +167,8 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
PowerPC::HostWrite_U32(guard, MAGIC_GAMEID, INSTALLER_BASE_ADDRESS); PowerPC::HostWrite_U32(guard, MAGIC_GAMEID, INSTALLER_BASE_ADDRESS);
// Install the custom bootloader to write gecko codes to the heap // Install the custom bootloader to write gecko codes to the heap
if (SConfig::GetInstance().m_melee_version == Melee::Version::NTSC || if (SConfig::GetSlippiConfig().melee_version == Melee::Version::NTSC ||
SConfig::GetInstance().m_melee_version == Melee::Version::MEX) SConfig::GetSlippiConfig().melee_version == Melee::Version::MEX)
{ {
// Write GCT loader into memory which will eventually load the real GCT into the heap // Write GCT loader into memory which will eventually load the real GCT into the heap
std::string bootloaderData; std::string bootloaderData;

View file

@ -90,24 +90,15 @@ std::unique_ptr<IEXIDevice> EXIDevice_Create(Core::System& system, EXIDeviceType
template <> template <>
struct fmt::formatter<ExpansionInterface::EXIDeviceType> struct fmt::formatter<ExpansionInterface::EXIDeviceType>
: EnumFormatter<ExpansionInterface::EXIDeviceType::EthernetBuiltIn> : EnumFormatter<ExpansionInterface::EXIDeviceType::Slippi>
{ {
static constexpr array_type names = { static constexpr array_type names = {
_trans("Dummy"), _trans("Dummy"), _trans("Memory Card"), _trans("Mask ROM"),
_trans("Memory Card"),
_trans("Mask ROM"),
// i18n: A mysterious debugging/diagnostics peripheral for the GameCube. // i18n: A mysterious debugging/diagnostics peripheral for the GameCube.
_trans("AD16"), _trans("AD16"), _trans("Microphone"), _trans("Broadband Adapter (TAP)"),
_trans("Microphone"), _trans("Triforce AM Baseboard"), _trans("USB Gecko"), _trans("GCI Folder"),
_trans("Broadband Adapter (TAP)"), _trans("Advance Game Port"), _trans("Broadband Adapter (XLink Kai)"),
_trans("Triforce AM Baseboard"), _trans("Broadband Adapter (tapserver)"), _trans("Broadband Adapter (HLE)"), _trans("Slippi")};
_trans("USB Gecko"),
_trans("GCI Folder"),
_trans("Advance Game Port"),
_trans("Broadband Adapter (XLink Kai)"),
_trans("Broadband Adapter (tapserver)"),
_trans("Broadband Adapter (HLE)"),
};
constexpr formatter() : EnumFormatter(names) {} constexpr formatter() : EnumFormatter(names) {}

View file

@ -28,7 +28,10 @@
#include "Core/NetPlayClient.h" #include "Core/NetPlayClient.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/Slippi/SlippiMatchmaking.h" #include "Core/Slippi/SlippiMatchmaking.h"
// SlippiTODO: should we remove this import for netplay build?? ifdef?
#include "Core/Slippi/SlippiPlayback.h" #include "Core/Slippi/SlippiPlayback.h"
#include "Core/Slippi/SlippiPremadeText.h" #include "Core/Slippi/SlippiPremadeText.h"
#include "Core/Slippi/SlippiReplayComm.h" #include "Core/Slippi/SlippiReplayComm.h"
#include "Core/State.h" #include "Core/State.h"
@ -399,7 +402,7 @@ std::vector<u8> CEXISlippi::generateMetadata()
void CEXISlippi::writeToFileAsync(u8* payload, u32 length, std::string fileOption) void CEXISlippi::writeToFileAsync(u8* payload, u32 length, std::string fileOption)
{ {
if (!SConfig::GetInstance().m_slippiSaveReplays) if (!Config::Get(Config::SLIPPI_SAVE_REPLAYS))
{ {
return; return;
} }
@ -543,12 +546,12 @@ void CEXISlippi::createNewFile()
closeFile(); closeFile();
} }
std::string dirpath = SConfig::GetInstance().m_strSlippiReplayDir; std::string dirpath = Config::Get(Config::SLIPPI_REPLAY_DIR);
// in case the config value just gets lost somehow // in case the config value just gets lost somehow
if (dirpath.empty()) if (dirpath.empty())
{ {
SConfig::GetInstance().m_strSlippiReplayDir = File::GetHomeDirectory() + DIR_SEP + "Slippi"; Config::Get(Config::SLIPPI_REPLAY_DIR) = File::GetHomeDirectory() + DIR_SEP + "Slippi";
dirpath = SConfig::GetInstance().m_strSlippiReplayDir; dirpath = Config::Get(Config::SLIPPI_REPLAY_DIR);
} }
// Remove a trailing / or \\ if the user managed to have that in their config // Remove a trailing / or \\ if the user managed to have that in their config
@ -563,7 +566,7 @@ void CEXISlippi::createNewFile()
// Now we have a dir such as /home/Replays but we need to make one such // Now we have a dir such as /home/Replays but we need to make one such
// as /home/Replays/2020-06 if month categorization is enabled // as /home/Replays/2020-06 if month categorization is enabled
if (SConfig::GetInstance().m_slippiReplayMonthFolders) if (Config::Get(Config::SLIPPI_REPLAY_MONTH_FOLDERS))
{ {
dirpath.push_back('/'); dirpath.push_back('/');
@ -657,8 +660,8 @@ void CEXISlippi::prepareGameInfo(u8* payload)
Slippi::GameSettings* settings = m_current_game->GetSettings(); Slippi::GameSettings* settings = m_current_game->GetSettings();
// Unlikely but reset the overclocking in case we quit during a hard ffw in a previous play // Unlikely but reset the overclocking in case we quit during a hard ffw in a previous play
SConfig::GetInstance().m_OCEnable = g_playbackStatus->origOCEnable; SConfig::GetSlippiConfig().oc_enable = g_playbackStatus->origOCEnable;
SConfig::GetInstance().m_OCFactor = g_playbackStatus->origOCFactor; SConfig::GetSlippiConfig().oc_factor = g_playbackStatus->origOCFactor;
// Start in Fast Forward if this is mirrored // Start in Fast Forward if this is mirrored
auto replayCommSettings = g_replayComm->getSettings(); auto replayCommSettings = g_replayComm->getSettings();
@ -2042,7 +2045,7 @@ void CEXISlippi::startFindMatch(u8* payload)
{ {
// Some special handling for teams since it is being heavily used for unranked // Some special handling for teams since it is being heavily used for unranked
if (localSelections.characterId >= 26 && if (localSelections.characterId >= 26 &&
SConfig::GetInstance().m_melee_version != Melee::Version::MEX) SConfig::GetSlippiConfig().melee_version != Melee::Version::MEX)
{ {
forcedError = "The character you selected is not allowed in this mode"; forcedError = "The character you selected is not allowed in this mode";
return; return;
@ -2479,7 +2482,7 @@ void CEXISlippi::prepareOnlineMatchState()
} }
else if (lastSearch.mode == SlippiMatchmaking::OnlinePlayMode::TEAMS) else if (lastSearch.mode == SlippiMatchmaking::OnlinePlayMode::TEAMS)
{ {
auto isMEX = SConfig::GetInstance().m_melee_version == Melee::Version::MEX; auto isMEX = SConfig::GetSlippiConfig().melee_version == Melee::Version::MEX;
if (!localCharOk && !isMEX) if (!localCharOk && !isMEX)
{ {
@ -2597,7 +2600,7 @@ void CEXISlippi::prepareOnlineMatchState()
appendWordToBuffer(&m_read_queue, rngOffset); appendWordToBuffer(&m_read_queue, rngOffset);
// Add delay frames to output // Add delay frames to output
m_read_queue.push_back(static_cast<u8>(SConfig::GetInstance().m_slippiOnlineDelay)); m_read_queue.push_back(static_cast<u8>(Config::Get(Config::SLIPPI_ONLINE_DELAY)));
// Add chat messages id // Add chat messages id
m_read_queue.push_back(static_cast<u8>(sentChatMessageId)); m_read_queue.push_back(static_cast<u8>(sentChatMessageId));
@ -2865,7 +2868,7 @@ void CEXISlippi::preparePremadeTextLoad(u8* payload)
bool CEXISlippi::isSlippiChatEnabled() bool CEXISlippi::isSlippiChatEnabled()
{ {
auto chatEnabledChoice = SConfig::GetInstance().m_slippiEnableQuickChat; auto chatEnabledChoice = Config::Get(Config::SLIPPI_ENABLE_QUICK_CHAT);
bool res = true; bool res = true;
switch (lastSearch.mode) switch (lastSearch.mode)
{ {
@ -3057,7 +3060,7 @@ void CEXISlippi::prepareDelayResponse()
m_read_queue.push_back(0); m_read_queue.push_back(0);
return; return;
} }
m_read_queue.push_back((u8)SConfig::GetInstance().m_slippiOnlineDelay); m_read_queue.push_back(Config::Get(Config::SLIPPI_ONLINE_DELAY));
} }
void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize) void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize)

View file

@ -2,20 +2,20 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "Core/HotkeyManager.h" #include "Core/HotkeyManager.h"
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <fmt/format.h> #include <fmt/format.h>
#include "Core/ConfigManager.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
#include "InputCommon/ControllerEmu/Control/Input.h" #include "InputCommon/ControllerEmu/Control/Input.h"
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h" #include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
@ -477,7 +477,8 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
// Slippi Playback // Slippi Playback
#ifdef IS_PLAYBACK #ifdef IS_PLAYBACK
if (SConfig::GetInstance().m_slippiEnableSeek) { if (SConfig::GetInstance().m_slippiEnableSeek)
{
#ifdef _WIN32 #ifdef _WIN32
set_key_expression(HK_SLIPPI_JUMP_BACK, hotkey_string({"Shift", "`LEFT`"})); set_key_expression(HK_SLIPPI_JUMP_BACK, hotkey_string({"Shift", "`LEFT`"}));
@ -503,29 +504,29 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
#endif #endif
#endif #endif
// GBA // GBA
set_key_expression(HK_GBA_LOAD, hotkey_string({"`Ctrl`", "`Shift`", "`O`"})); set_key_expression(HK_GBA_LOAD, hotkey_string({"`Ctrl`", "`Shift`", "`O`"}));
set_key_expression(HK_GBA_UNLOAD, hotkey_string({"`Ctrl`", "`Shift`", "`W`"})); set_key_expression(HK_GBA_UNLOAD, hotkey_string({"`Ctrl`", "`Shift`", "`W`"}));
set_key_expression(HK_GBA_RESET, hotkey_string({"`Ctrl`", "`Shift`", "`R`"})); set_key_expression(HK_GBA_RESET, hotkey_string({"`Ctrl`", "`Shift`", "`R`"}));
#ifdef _WIN32 #ifdef _WIN32
set_key_expression(HK_GBA_VOLUME_DOWN, "`SUBTRACT`"); set_key_expression(HK_GBA_VOLUME_DOWN, "`SUBTRACT`");
set_key_expression(HK_GBA_VOLUME_UP, "`ADD`"); set_key_expression(HK_GBA_VOLUME_UP, "`ADD`");
#else #else
set_key_expression(HK_GBA_VOLUME_DOWN, "`KP_Subtract`"); set_key_expression(HK_GBA_VOLUME_DOWN, "`KP_Subtract`");
set_key_expression(HK_GBA_VOLUME_UP, "`KP_Add`"); set_key_expression(HK_GBA_VOLUME_UP, "`KP_Add`");
#endif #endif
set_key_expression(HK_GBA_TOGGLE_MUTE, "`M`"); set_key_expression(HK_GBA_TOGGLE_MUTE, "`M`");
#ifdef _WIN32 #ifdef _WIN32
set_key_expression(HK_GBA_1X, "`NUMPAD1`"); set_key_expression(HK_GBA_1X, "`NUMPAD1`");
set_key_expression(HK_GBA_2X, "`NUMPAD2`"); set_key_expression(HK_GBA_2X, "`NUMPAD2`");
set_key_expression(HK_GBA_3X, "`NUMPAD3`"); set_key_expression(HK_GBA_3X, "`NUMPAD3`");
set_key_expression(HK_GBA_4X, "`NUMPAD4`"); set_key_expression(HK_GBA_4X, "`NUMPAD4`");
#else #else
set_key_expression(HK_GBA_1X, "`KP_1`"); set_key_expression(HK_GBA_1X, "`KP_1`");
set_key_expression(HK_GBA_2X, "`KP_2`"); set_key_expression(HK_GBA_2X, "`KP_2`");
set_key_expression(HK_GBA_3X, "`KP_3`"); set_key_expression(HK_GBA_3X, "`KP_3`");
set_key_expression(HK_GBA_4X, "`KP_4`"); set_key_expression(HK_GBA_4X, "`KP_4`");
#endif #endif
} }

View file

@ -167,6 +167,12 @@ enum Hotkey
HK_INCREMENT_SELECTED_STATE_SLOT, HK_INCREMENT_SELECTED_STATE_SLOT,
HK_DECREMENT_SELECTED_STATE_SLOT, HK_DECREMENT_SELECTED_STATE_SLOT,
// Slippi Playback
HK_SLIPPI_JUMP_BACK,
HK_SLIPPI_STEP_BACK,
HK_SLIPPI_STEP_FORWARD,
HK_SLIPPI_JUMP_FORWARD,
HK_GBA_LOAD, HK_GBA_LOAD,
HK_GBA_UNLOAD, HK_GBA_UNLOAD,
HK_GBA_RESET, HK_GBA_RESET,
@ -180,12 +186,6 @@ enum Hotkey
HK_GBA_3X, HK_GBA_3X,
HK_GBA_4X, HK_GBA_4X,
// Slippi Playback
HK_SLIPPI_JUMP_BACK,
HK_SLIPPI_STEP_BACK,
HK_SLIPPI_STEP_FORWARD,
HK_SLIPPI_JUMP_FORWARD,
NUM_HOTKEYS, NUM_HOTKEYS,
}; };

View file

@ -20,4 +20,12 @@ enum class Chat
DIRECT_ONLY, DIRECT_ONLY,
OFF OFF
}; };
}
struct Config
{
Melee::Version melee_version;
bool oc_enable = true;
float oc_factor = 1.0f;
std::string slippi_input = "";
};
} // namespace Slippi

View file

@ -6,6 +6,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Version.h" #include "Common/Version.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#if defined __linux__ && HAVE_ALSA #if defined __linux__ && HAVE_ALSA
@ -218,8 +219,8 @@ void SlippiMatchmaking::startMatchmaking()
auto userInfo = m_user->GetUserInfo(); auto userInfo = m_user->GetUserInfo();
while (m_client == nullptr && retryCount < 15) while (m_client == nullptr && retryCount < 15)
{ {
if (SConfig::GetInstance().m_slippiForceNetplayPort) if (Config::Get(Config::SLIPPI_FORCE_NETPLAY_PORT))
m_hostPort = SConfig::GetInstance().m_slippiNetplayPort; m_hostPort = Config::Get(Config::SLIPPI_NETPLAY_PORT);
else else
m_hostPort = 41000 + (generator() % 10000); m_hostPort = 41000 + (generator() % 10000);
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Port to use: {}...", m_hostPort); ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Port to use: {}...", m_hostPort);
@ -364,10 +365,10 @@ void SlippiMatchmaking::startMatchmaking()
} }
} }
if (SConfig::GetInstance().m_slippiForceLanIp) if (Config::Get(Config::SLIPPI_FORCE_LAN_IP))
{ {
WARN_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Overwriting LAN IP sent with configured address"); WARN_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Overwriting LAN IP sent with configured address");
sprintf(lan_addr, "%s:%d", SConfig::GetInstance().m_slippiLanIp.c_str(), m_hostPort); sprintf(lan_addr, "%s:%d", Config::Get(Config::SLIPPI_LAN_IP).c_str(), m_hostPort);
} }
WARN_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Sending LAN address: {}", lan_addr); WARN_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Sending LAN address: {}", lan_addr);

View file

@ -123,7 +123,7 @@ void SlippiPlaybackStatus::processInitialState()
// Doing it here to get it out of the way and prevent stutters later // Doing it here to get it out of the way and prevent stutters later
// Subsequent calls to SaveToBuffer for cState take ~1 frame // Subsequent calls to SaveToBuffer for cState take ~1 frame
State::SaveToBuffer(cState); State::SaveToBuffer(cState);
if (SConfig::GetInstance().m_slippiEnableSeek) if (Config::Get(Config::SLIPPI_ENABLE_SEEK))
{ {
Config::SetCurrent(Config::MAIN_SHOW_CURSOR, Config::ShowCursor::Constantly); Config::SetCurrent(Config::MAIN_SHOW_CURSOR, Config::ShowCursor::Constantly);
} }
@ -159,7 +159,7 @@ void SlippiPlaybackStatus::SavestateThread()
processInitialState(); processInitialState();
inSlippiPlayback = true; inSlippiPlayback = true;
} }
else if (SConfig::GetInstance().m_slippiEnableSeek && !hasStateBeenProcessed && !isStartFrame) else if (Config::Get(Config::SLIPPI_ENABLE_SEEK) && !hasStateBeenProcessed && !isStartFrame)
{ {
INFO_LOG_FMT(SLIPPI, "saving diff at frame: {}", fixedFrameNumber); INFO_LOG_FMT(SLIPPI, "saving diff at frame: {}", fixedFrameNumber);
State::SaveToBuffer(cState); State::SaveToBuffer(cState);
@ -262,13 +262,13 @@ void SlippiPlaybackStatus::setHardFFW(bool enable)
{ {
if (enable) if (enable)
{ {
SConfig::GetInstance().m_OCEnable = true; SConfig::GetSlippiConfig().oc_enable = true;
SConfig::GetInstance().m_OCFactor = 4.0f; SConfig::GetSlippiConfig().oc_factor = 4.0f;
} }
else else
{ {
SConfig::GetInstance().m_OCFactor = origOCFactor; SConfig::GetSlippiConfig().oc_factor = origOCFactor;
SConfig::GetInstance().m_OCEnable = origOCEnable; SConfig::GetSlippiConfig().oc_enable = origOCEnable;
} }
isHardFFW = enable; isHardFFW = enable;

View file

@ -8,7 +8,7 @@
#include <open-vcdiff/src/google/vcdecoder.h> #include <open-vcdiff/src/google/vcdecoder.h>
#include <open-vcdiff/src/google/vcencoder.h> #include <open-vcdiff/src/google/vcencoder.h>
#include "../../Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "SlippiGame.h" #include "SlippiGame.h"
@ -24,8 +24,8 @@ public:
volatile bool shouldRunThreads = false; volatile bool shouldRunThreads = false;
bool isHardFFW = false; bool isHardFFW = false;
bool isSoftFFW = false; bool isSoftFFW = false;
bool origOCEnable = SConfig::GetInstance().m_OCEnable; bool origOCEnable = SConfig::GetSlippiConfig().oc_enable;
float origOCFactor = SConfig::GetInstance().m_OCFactor; float origOCFactor = SConfig::GetSlippiConfig().oc_factor;
s32 lastFFWFrame = INT_MIN; s32 lastFFWFrame = INT_MIN;
s32 currentPlaybackFrame = INT_MIN; s32 currentPlaybackFrame = INT_MIN;

View file

@ -32,8 +32,8 @@ static inline void trim(std::string& s)
SlippiReplayComm::SlippiReplayComm() SlippiReplayComm::SlippiReplayComm()
{ {
INFO_LOG_FMT(EXPANSIONINTERFACE, "SlippiReplayComm: Using playback config path: {}", INFO_LOG_FMT(EXPANSIONINTERFACE, "SlippiReplayComm: Using playback config path: {}",
SConfig::GetInstance().m_strSlippiInput.c_str()); SConfig::GetSlippiConfig().slippi_input);
configFilePath = SConfig::GetInstance().m_strSlippiInput.c_str(); configFilePath = SConfig::GetSlippiConfig().slippi_input;
} }
SlippiReplayComm::~SlippiReplayComm() SlippiReplayComm::~SlippiReplayComm()

View file

@ -1,4 +1,5 @@
#include "SlippiSpectate.h" #include "SlippiSpectate.h"
#include <Core/Config/MainSettings.h>
#include <Core/ConfigManager.h> #include <Core/ConfigManager.h>
#include "Common/Base64.hpp" #include "Common/Base64.hpp"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -15,7 +16,7 @@
inline bool isSpectatorEnabled() inline bool isSpectatorEnabled()
{ {
return SConfig::GetInstance().m_enableSpectator; return Config::Get(Config::SLIPPI_ENABLE_SPECTATOR);
} }
SlippiSpectateServer& SlippiSpectateServer::getInstance() SlippiSpectateServer& SlippiSpectateServer::getInstance()
@ -279,7 +280,7 @@ void SlippiSpectateServer::SlippicommSocketThread(void)
ENetAddress server_address = {0}; ENetAddress server_address = {0};
server_address.host = ENET_HOST_ANY; server_address.host = ENET_HOST_ANY;
server_address.port = SConfig::GetInstance().m_spectatorPort; server_address.port = Config::Get(Config::SLIPPI_ENABLE_SPECTATOR);
// Create the spectator server // Create the spectator server
// This call can fail if the system is already listening on the specified port // This call can fail if the system is already listening on the specified port

View file

@ -702,17 +702,17 @@ void Settings::SetBatchModeEnabled(bool batch)
std::string Settings::GetSlippiInputFile() const std::string Settings::GetSlippiInputFile() const
{ {
return SConfig::GetInstance().m_strSlippiInput; return SConfig::GetSlippiConfig().slippi_input;
} }
void Settings::SetSlippiInputFile(std::string path) void Settings::SetSlippiInputFile(std::string path)
{ {
SConfig::GetInstance().m_strSlippiInput = path; SConfig::GetSlippiConfig().slippi_input = path;
} }
void Settings::SetSlippiSeekbarEnabled(bool enabled) void Settings::SetSlippiSeekbarEnabled(bool enabled)
{ {
SConfig::GetInstance().m_slippiEnableSeek = enabled; Config::SetBase(Config::SLIPPI_ENABLE_SEEK, enabled);
} }
bool Settings::IsSDCardInserted() const bool Settings::IsSDCardInserted() const

View file

@ -134,7 +134,7 @@ void GameCubePane::CreateWidgets()
// Add slot devices // Add slot devices
for (const auto device : {EXIDeviceType::None, EXIDeviceType::Dummy, EXIDeviceType::MemoryCard, for (const auto device : {EXIDeviceType::None, EXIDeviceType::Dummy, EXIDeviceType::MemoryCard,
EXIDeviceType::MemoryCardFolder, EXIDeviceType::Gecko, EXIDeviceType::MemoryCardFolder, EXIDeviceType::Gecko,
EXIDeviceType::AGP, EXIDeviceType::Microphone}) EXIDeviceType::AGP, EXIDeviceType::Microphone, EXIDeviceType::Slippi})
{ {
const QString name = tr(fmt::format("{:n}", device).c_str()); const QString name = tr(fmt::format("{:n}", device).c_str());
const int value = static_cast<int>(device); const int value = static_cast<int>(device);

View file

@ -1,167 +1,170 @@
#include "DolphinQt/Settings/SlippiPane.h" #include "DolphinQt/Settings/SlippiPane.h"
#include <QCheckBox>
#include <QComboBox> #include <QComboBox>
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
#include <QFormLayout> #include <QFormLayout>
#include <QGridLayout> #include <QGridLayout>
#include <QGroupBox>
#include <QLabel> #include <QLabel>
#include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <QSizePolicy> #include <QSizePolicy>
#include <QSpinBox> #include <QSpinBox>
#include <QVBoxLayout>
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
SlippiPane::SlippiPane(QWidget* parent) : QWidget(parent) SlippiPane::SlippiPane(QWidget* parent) : QWidget(parent)
{ {
CreateLayout(); CreateLayout();
LoadConfig();
// ConnectLayout();
} }
void SlippiPane::LoadConfig()
{
}
void SlippiPane::CreateLayout() void SlippiPane::CreateLayout()
{ {
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
auto* layout = new QVBoxLayout(); m_main_layout = new QVBoxLayout();
setLayout(layout); setLayout(m_main_layout);
#ifndef IS_PLAYBACK #ifndef IS_PLAYBACK
// Replay Settings // Replay Settings
auto* replay_settings = new QGroupBox(tr("Replay Settings")); m_replay_settings = new QGroupBox(tr("Replay Settings"));
auto* replay_settings_layout = new QVBoxLayout(); m_replay_settings_layout = new QVBoxLayout();
replay_settings->setLayout(replay_settings_layout); m_replay_settings->setLayout(m_replay_settings_layout);
layout->addWidget(replay_settings); m_main_layout->addWidget(m_replay_settings);
auto* enable_replay_save_checkbox = new QCheckBox(tr("Save Slippi Replays")); m_enable_replay_save = new QCheckBox(tr("Save Slippi Replays"));
enable_replay_save_checkbox->setToolTip( m_enable_replay_save->setToolTip(
tr("Enable this to make Slippi automatically save .slp recordings of your games.")); tr("Enable this to make Slippi automatically save .slp recordings of your games."));
replay_settings_layout->addWidget(enable_replay_save_checkbox); m_replay_settings_layout->addWidget(m_enable_replay_save);
enable_replay_save_checkbox->setChecked(SConfig::GetInstance().m_slippiSaveReplays); m_enable_replay_save->setChecked(Config::Get(Config::SLIPPI_SAVE_REPLAYS));
connect(enable_replay_save_checkbox, &QCheckBox::toggled, this, // connect(enable_replay_save_checkbox, &QCheckBox::toggled, this,
[](bool checked) { SConfig::GetInstance().m_slippiSaveReplays = checked; }); // [](bool checked) { Config::SetBase(Config::SLIPPI_SAVE_REPLAYS, checked); });
auto* enable_monthly_replay_folders_checkbox = // auto* enable_monthly_replay_folders_checkbox =
new QCheckBox(tr("Save Replays to Monthly Subfolders")); // new QCheckBox(tr("Save Replays to Monthly Subfolders"));
enable_monthly_replay_folders_checkbox->setToolTip( // enable_monthly_replay_folders_checkbox->setToolTip(
tr("Enable this to save your replays into subfolders by month (YYYY-MM).")); // tr("Enable this to save your replays into subfolders by month (YYYY-MM)."));
replay_settings_layout->addWidget(enable_monthly_replay_folders_checkbox); // replay_settings_layout->addWidget(enable_monthly_replay_folders_checkbox);
enable_monthly_replay_folders_checkbox->setChecked( // enable_monthly_replay_folders_checkbox->setChecked(
SConfig::GetInstance().m_slippiReplayMonthFolders); // SConfig::GetInstance().m_slippiReplayMonthFolders);
connect(enable_monthly_replay_folders_checkbox, &QCheckBox::toggled, this, // connect(enable_monthly_replay_folders_checkbox, &QCheckBox::toggled, this,
[](bool checked) { SConfig::GetInstance().m_slippiReplayMonthFolders = checked; }); // [](bool checked) { SConfig::GetInstance().m_slippiReplayMonthFolders = checked; });
auto* replay_folder_layout = new QGridLayout(); // auto* replay_folder_layout = new QGridLayout();
m_replay_folder_edit = // m_replay_folder_edit =
new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir)); // new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir));
m_replay_folder_edit->setToolTip(tr("Choose where your Slippi replay files are saved.")); // m_replay_folder_edit->setToolTip(tr("Choose where your Slippi replay files are saved."));
connect(m_replay_folder_edit, &QLineEdit::editingFinished, [this] { // connect(m_replay_folder_edit, &QLineEdit::editingFinished, [this] {
SConfig::GetInstance().m_strSlippiReplayDir = m_replay_folder_edit->text().toStdString(); // SConfig::GetInstance().m_strSlippiReplayDir = m_replay_folder_edit->text().toStdString();
}); // });
QPushButton* replay_folder_open = new QPushButton(QStringLiteral("...")); // QPushButton* replay_folder_open = new QPushButton(QStringLiteral("..."));
connect(replay_folder_open, &QPushButton::clicked, this, &SlippiPane::BrowseReplayFolder); // connect(replay_folder_open, &QPushButton::clicked, this, &SlippiPane::BrowseReplayFolder);
replay_folder_layout->addWidget(new QLabel(tr("Replay Folder:")), 0, 0); // replay_folder_layout->addWidget(new QLabel(tr("Replay Folder:")), 0, 0);
replay_folder_layout->addWidget(m_replay_folder_edit, 0, 1); // replay_folder_layout->addWidget(m_replay_folder_edit, 0, 1);
replay_folder_layout->addWidget(replay_folder_open, 0, 2); // replay_folder_layout->addWidget(replay_folder_open, 0, 2);
replay_settings_layout->addLayout(replay_folder_layout); // replay_settings_layout->addLayout(replay_folder_layout);
// Online Settings //// Online Settings
auto* online_settings = new QGroupBox(tr("Online Settings")); // auto* online_settings = new QGroupBox(tr("Online Settings"));
auto* online_settings_layout = new QFormLayout(); // auto* online_settings_layout = new QFormLayout();
online_settings->setLayout(online_settings_layout); // online_settings->setLayout(online_settings_layout);
layout->addWidget(online_settings); // layout->addWidget(online_settings);
auto* delay_spin = new QSpinBox(); // auto* delay_spin = new QSpinBox();
delay_spin->setFixedSize(30, 25); // delay_spin->setFixedSize(30, 25);
delay_spin->setRange(1, 9); // delay_spin->setRange(1, 9);
delay_spin->setToolTip(tr("Leave this at 2 unless consistently playing on 120+ ping. " // delay_spin->setToolTip(tr("Leave this at 2 unless consistently playing on 120+ ping. "
"Increasing this can cause unplayable input delay, and lowering it " // "Increasing this can cause unplayable input delay, and lowering it "
"can cause visual artifacts/lag.")); // "can cause visual artifacts/lag."));
online_settings_layout->addRow(tr("Delay Frames:"), delay_spin); // online_settings_layout->addRow(tr("Delay Frames:"), delay_spin);
delay_spin->setValue(SConfig::GetInstance().m_slippiOnlineDelay); // delay_spin->setValue(SConfig::GetInstance().m_slippiOnlineDelay);
connect(delay_spin, qOverload<int>(&QSpinBox::valueChanged), this, // connect(delay_spin, qOverload<int>(&QSpinBox::valueChanged), this,
[](int delay) { SConfig::GetInstance().m_slippiOnlineDelay = delay; }); // [](int delay) { SConfig::GetInstance().m_slippiOnlineDelay = delay; });
auto* netplay_quick_chat_combo = new QComboBox(); // auto* netplay_quick_chat_combo = new QComboBox();
for (const auto& item : {tr("Enabled"), tr("Direct Only"), tr("Off")}) // for (const auto& item : {tr("Enabled"), tr("Direct Only"), tr("Off")})
{ //{
netplay_quick_chat_combo->addItem(item); // netplay_quick_chat_combo->addItem(item);
} // }
connect(netplay_quick_chat_combo, qOverload<int>(&QComboBox::currentIndexChanged), this, // connect(netplay_quick_chat_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
[](int index) { // [](int index) {
SConfig::GetInstance().m_slippiEnableQuickChat = static_cast<Slippi::Chat>(index); // SConfig::GetInstance().m_slippiEnableQuickChat = static_cast<Slippi::Chat>(index);
}); // });
netplay_quick_chat_combo->setCurrentIndex( // netplay_quick_chat_combo->setCurrentIndex(
static_cast<u32>(SConfig::GetInstance().m_slippiEnableQuickChat)); // static_cast<u32>(SConfig::GetInstance().m_slippiEnableQuickChat));
online_settings_layout->addRow(tr("Quick Chat:"), netplay_quick_chat_combo); // online_settings_layout->addRow(tr("Quick Chat:"), netplay_quick_chat_combo);
// i'd like to note that I hate everything about how this is organized for the next two sections //// i'd like to note that I hate everything about how this is organized for the next two sections
// and a lot of the Qstring bullshit drives me up the wall. //// and a lot of the Qstring bullshit drives me up the wall.
auto* netplay_port_spin = new QSpinBox(); // auto* netplay_port_spin = new QSpinBox();
netplay_port_spin->setFixedSize(60, 25); // netplay_port_spin->setFixedSize(60, 25);
QSizePolicy sp_retain = netplay_port_spin->sizePolicy(); // QSizePolicy sp_retain = netplay_port_spin->sizePolicy();
sp_retain.setRetainSizeWhenHidden(true); // sp_retain.setRetainSizeWhenHidden(true);
netplay_port_spin->setSizePolicy(sp_retain); // netplay_port_spin->setSizePolicy(sp_retain);
netplay_port_spin->setRange(1000, 65535); // netplay_port_spin->setRange(1000, 65535);
netplay_port_spin->setValue(SConfig::GetInstance().m_slippiNetplayPort); // netplay_port_spin->setValue(SConfig::GetInstance().m_slippiNetplayPort);
if (!SConfig::GetInstance().m_slippiForceNetplayPort) // if (!SConfig::GetInstance().m_slippiForceNetplayPort)
{ //{
netplay_port_spin->hide(); // netplay_port_spin->hide();
} // }
auto* enable_force_netplay_port_checkbox = new QCheckBox(tr("Force Netplay Port")); // auto* enable_force_netplay_port_checkbox = new QCheckBox(tr("Force Netplay Port"));
enable_force_netplay_port_checkbox->setToolTip( // enable_force_netplay_port_checkbox->setToolTip(
tr("Enable this to force Slippi to use a specific network port for online peer-to-peer " // tr("Enable this to force Slippi to use a specific network port for online peer-to-peer "
"connections.")); // "connections."));
enable_force_netplay_port_checkbox->setChecked(SConfig::GetInstance().m_slippiForceNetplayPort); // enable_force_netplay_port_checkbox->setChecked(SConfig::GetInstance().m_slippiForceNetplayPort);
connect(enable_force_netplay_port_checkbox, &QCheckBox::toggled, this, // connect(enable_force_netplay_port_checkbox, &QCheckBox::toggled, this,
[netplay_port_spin](bool checked) { // [netplay_port_spin](bool checked) {
SConfig::GetInstance().m_slippiForceNetplayPort = checked; // SConfig::GetInstance().m_slippiForceNetplayPort = checked;
checked ? netplay_port_spin->show() : netplay_port_spin->hide(); // checked ? netplay_port_spin->show() : netplay_port_spin->hide();
}); // });
auto* netplay_port_layout = new QGridLayout(); // auto* netplay_port_layout = new QGridLayout();
netplay_port_layout->setColumnStretch(1, 1); // netplay_port_layout->setColumnStretch(1, 1);
netplay_port_layout->addWidget(enable_force_netplay_port_checkbox, 0, 0); // netplay_port_layout->addWidget(enable_force_netplay_port_checkbox, 0, 0);
netplay_port_layout->addWidget(netplay_port_spin, 0, 1, Qt::AlignLeft); // netplay_port_layout->addWidget(netplay_port_spin, 0, 1, Qt::AlignLeft);
online_settings_layout->addRow(netplay_port_layout); // online_settings_layout->addRow(netplay_port_layout);
auto* netplay_ip_edit = new QLineEdit(); // auto* netplay_ip_edit = new QLineEdit();
netplay_ip_edit->setFixedSize(100, 25); // netplay_ip_edit->setFixedSize(100, 25);
sp_retain = netplay_ip_edit->sizePolicy(); // sp_retain = netplay_ip_edit->sizePolicy();
sp_retain.setRetainSizeWhenHidden(true); // sp_retain.setRetainSizeWhenHidden(true);
netplay_ip_edit->setSizePolicy(sp_retain); // netplay_ip_edit->setSizePolicy(sp_retain);
std::string ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"; // std::string ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])";
// You may want to use QRegularExpression for new code with Qt 5 (not mandatory). //// You may want to use QRegularExpression for new code with Qt 5 (not mandatory).
QRegularExpression ipRegex(QString::fromStdString( // QRegularExpression ipRegex(QString::fromStdString(
"^" + ipRange + "(\\." + ipRange + ")" + "(\\." + ipRange + ")" + "(\\." + ipRange + ")$")); // "^" + ipRange + "(\\." + ipRange + ")" + "(\\." + ipRange + ")" + "(\\." + ipRange +
QRegularExpressionValidator* ipValidator = new QRegularExpressionValidator(ipRegex, this); // ")$"));
netplay_ip_edit->setValidator(ipValidator); // QRegularExpressionValidator* ipValidator = new QRegularExpressionValidator(ipRegex, this);
auto lan_ip = SConfig::GetInstance().m_slippiLanIp; // netplay_ip_edit->setValidator(ipValidator);
netplay_ip_edit->setText(QString::fromStdString(lan_ip)); // auto lan_ip = SConfig::GetInstance().m_slippiLanIp;
if (!SConfig::GetInstance().m_slippiForceLanIp) // netplay_ip_edit->setText(QString::fromStdString(lan_ip));
{ // if (!SConfig::GetInstance().m_slippiForceLanIp)
netplay_ip_edit->hide(); //{
} // netplay_ip_edit->hide();
auto* enable_force_netplay_ip_checkbox = new QCheckBox(tr("Force Netplay IP")); // }
enable_force_netplay_ip_checkbox->setToolTip( // auto* enable_force_netplay_ip_checkbox = new QCheckBox(tr("Force Netplay IP"));
tr("Enable this to force Slippi to use a specific LAN IP when connecting to users with a " // enable_force_netplay_ip_checkbox->setToolTip(
"matching WAN IP. Should not be required for most users.")); // tr("Enable this to force Slippi to use a specific LAN IP when connecting to users with a "
// "matching WAN IP. Should not be required for most users."));
enable_force_netplay_ip_checkbox->setChecked(SConfig::GetInstance().m_slippiForceLanIp); // enable_force_netplay_ip_checkbox->setChecked(SConfig::GetInstance().m_slippiForceLanIp);
connect(enable_force_netplay_ip_checkbox, &QCheckBox::toggled, this, // connect(enable_force_netplay_ip_checkbox, &QCheckBox::toggled, this,
[netplay_ip_edit](bool checked) { // [netplay_ip_edit](bool checked) {
SConfig::GetInstance().m_slippiForceLanIp = checked; // SConfig::GetInstance().m_slippiForceLanIp = checked;
checked ? netplay_ip_edit->show() : netplay_ip_edit->hide(); // checked ? netplay_ip_edit->show() : netplay_ip_edit->hide();
}); // });
auto* netplay_ip_layout = new QGridLayout(); // auto* netplay_ip_layout = new QGridLayout();
netplay_ip_layout->setColumnStretch(1, 1); // netplay_ip_layout->setColumnStretch(1, 1);
netplay_ip_layout->addWidget(enable_force_netplay_ip_checkbox, 0, 0); // netplay_ip_layout->addWidget(enable_force_netplay_ip_checkbox, 0, 0);
netplay_ip_layout->addWidget(netplay_ip_edit, 0, 1, Qt::AlignLeft); // netplay_ip_layout->addWidget(netplay_ip_edit, 0, 1, Qt::AlignLeft);
online_settings_layout->addRow(netplay_ip_layout); // online_settings_layout->addRow(netplay_ip_layout);
#else #else
// Playback Settings // Playback Settings
@ -187,12 +190,26 @@ void SlippiPane::CreateLayout()
void SlippiPane::BrowseReplayFolder() void SlippiPane::BrowseReplayFolder()
{ {
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory( // QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
this, tr("Select Replay Folder"), // this, tr("Select Replay Folder"),
QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir))); // QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir)));
if (!dir.isEmpty()) // if (!dir.isEmpty())
{ //{
m_replay_folder_edit->setText(dir); // m_replay_folder_edit->setText(dir);
SConfig::GetInstance().m_strSlippiReplayDir = dir.toStdString(); // SConfig::GetInstance().m_strSlippiReplayDir = dir.toStdString();
} // }
}
void SlippiPane::OnSaveConfig()
{
Config::ConfigChangeCallbackGuard config_guard;
auto& settings = SConfig::GetInstance();
// Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());
// Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, m_checkbox_cheats->isChecked());
// Settings::Instance().SetFallbackRegion(
// UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex()));
settings.SaveSettings();
} }

View file

@ -2,6 +2,10 @@
#include <vector> #include <vector>
#include <QCheckBox>
#include <QGroupBox>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QWidget> #include <QWidget>
class QLineEdit; class QLineEdit;
@ -20,6 +24,15 @@ public:
private: private:
void BrowseReplayFolder(); void BrowseReplayFolder();
void CreateLayout(); void CreateLayout();
void LoadConfig();
void ConnectLayout();
void OnSaveConfig();
QVBoxLayout* m_main_layout;
// Playback settings
QGroupBox* m_replay_settings;
QVBoxLayout* m_replay_settings_layout;
QCheckBox* m_enable_replay_save;
QLineEdit* m_replay_folder_edit; QLineEdit* m_replay_folder_edit;
}; };

View file

@ -15,6 +15,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <vector> #include <vector>
#include <Core/Config/MainSettings.h>
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
@ -189,7 +190,7 @@ void PipeDevice::UpdateInput()
m_buf.erase(0, newline + 1); m_buf.erase(0, newline + 1);
newline = m_buf.find("\n"); newline = m_buf.find("\n");
} }
} while (!finished && SConfig::GetInstance().m_blockingPipes); } while (!finished && Config::Get(Config::SLIPPI_BLOCKING_PIPES));
} }
void PipeDevice::AddAxis(const std::string& name, double value) void PipeDevice::AddAxis(const std::string& name, double value)