mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-28 13:16:41 +00:00
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:
parent
b3f0422234
commit
b32a07656d
21 changed files with 321 additions and 232 deletions
|
@ -25,11 +25,34 @@
|
|||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/SI/SI_Device.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
|
||||
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
|
||||
|
||||
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<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A{
|
||||
{System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDeviceType::None};
|
||||
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B{{System::Main, "Core", "SlotB"},
|
||||
ExpansionInterface::EXIDeviceType::Slippi};
|
||||
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A{{System::Main, "Core", "SlotA"},
|
||||
ExpansionInterface::EXIDeviceType::None};
|
||||
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B{
|
||||
{System::Main, "Core", "SlotB"}, ExpansionInterface::EXIDeviceType::Slippi};
|
||||
const Info<ExpansionInterface::EXIDeviceType> MAIN_SERIAL_PORT_1{
|
||||
{System::Main, "Core", "SerialPort1"}, ExpansionInterface::EXIDeviceType::None};
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Core/Slippi/SlippiConfig.h"
|
||||
|
||||
#include "DiscIO/Enums.h"
|
||||
|
||||
// DSP Backend Types
|
||||
|
@ -49,6 +51,26 @@ enum class HSPDeviceType : int;
|
|||
|
||||
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
|
||||
|
||||
extern const Info<bool> MAIN_SKIP_IPL;
|
||||
|
|
|
@ -116,6 +116,29 @@ void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
|
|||
volume.GetTitleID(partition).value_or(0),
|
||||
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)
|
||||
|
|
|
@ -40,8 +40,8 @@ struct BootParameters;
|
|||
|
||||
struct SConfig
|
||||
{
|
||||
// Melee Version
|
||||
Melee::Version m_melee_version;
|
||||
// Slippi Config
|
||||
Slippi::Config slippi_config;
|
||||
|
||||
// Settings
|
||||
bool bAutomaticStart = false;
|
||||
|
@ -55,25 +55,6 @@ struct SConfig
|
|||
bool bWii = 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;
|
||||
|
||||
// files
|
||||
|
@ -125,6 +106,7 @@ struct SConfig
|
|||
|
||||
// Return the permanent and somewhat globally used instance of this struct
|
||||
static SConfig& GetInstance() { return (*m_Instance); }
|
||||
static Slippi::Config& GetSlippiConfig() { return m_Instance->slippi_config; }
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
|
|
|
@ -323,7 +323,10 @@ void CoreTimingManager::Advance()
|
|||
m_event_queue.pop_back();
|
||||
|
||||
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;
|
||||
|
|
|
@ -167,8 +167,8 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
|||
PowerPC::HostWrite_U32(guard, MAGIC_GAMEID, INSTALLER_BASE_ADDRESS);
|
||||
|
||||
// Install the custom bootloader to write gecko codes to the heap
|
||||
if (SConfig::GetInstance().m_melee_version == Melee::Version::NTSC ||
|
||||
SConfig::GetInstance().m_melee_version == Melee::Version::MEX)
|
||||
if (SConfig::GetSlippiConfig().melee_version == Melee::Version::NTSC ||
|
||||
SConfig::GetSlippiConfig().melee_version == Melee::Version::MEX)
|
||||
{
|
||||
// Write GCT loader into memory which will eventually load the real GCT into the heap
|
||||
std::string bootloaderData;
|
||||
|
|
|
@ -90,24 +90,15 @@ std::unique_ptr<IEXIDevice> EXIDevice_Create(Core::System& system, EXIDeviceType
|
|||
|
||||
template <>
|
||||
struct fmt::formatter<ExpansionInterface::EXIDeviceType>
|
||||
: EnumFormatter<ExpansionInterface::EXIDeviceType::EthernetBuiltIn>
|
||||
: EnumFormatter<ExpansionInterface::EXIDeviceType::Slippi>
|
||||
{
|
||||
static constexpr array_type names = {
|
||||
_trans("Dummy"),
|
||||
_trans("Memory Card"),
|
||||
_trans("Mask ROM"),
|
||||
_trans("Dummy"), _trans("Memory Card"), _trans("Mask ROM"),
|
||||
// i18n: A mysterious debugging/diagnostics peripheral for the GameCube.
|
||||
_trans("AD16"),
|
||||
_trans("Microphone"),
|
||||
_trans("Broadband Adapter (TAP)"),
|
||||
_trans("Triforce AM Baseboard"),
|
||||
_trans("USB Gecko"),
|
||||
_trans("GCI Folder"),
|
||||
_trans("Advance Game Port"),
|
||||
_trans("Broadband Adapter (XLink Kai)"),
|
||||
_trans("Broadband Adapter (tapserver)"),
|
||||
_trans("Broadband Adapter (HLE)"),
|
||||
};
|
||||
_trans("AD16"), _trans("Microphone"), _trans("Broadband Adapter (TAP)"),
|
||||
_trans("Triforce AM Baseboard"), _trans("USB Gecko"), _trans("GCI Folder"),
|
||||
_trans("Advance Game Port"), _trans("Broadband Adapter (XLink Kai)"),
|
||||
_trans("Broadband Adapter (tapserver)"), _trans("Broadband Adapter (HLE)"), _trans("Slippi")};
|
||||
|
||||
constexpr formatter() : EnumFormatter(names) {}
|
||||
|
||||
|
|
|
@ -28,7 +28,10 @@
|
|||
#include "Core/NetPlayClient.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/Slippi/SlippiMatchmaking.h"
|
||||
|
||||
// SlippiTODO: should we remove this import for netplay build?? ifdef?
|
||||
#include "Core/Slippi/SlippiPlayback.h"
|
||||
|
||||
#include "Core/Slippi/SlippiPremadeText.h"
|
||||
#include "Core/Slippi/SlippiReplayComm.h"
|
||||
#include "Core/State.h"
|
||||
|
@ -399,7 +402,7 @@ std::vector<u8> CEXISlippi::generateMetadata()
|
|||
|
||||
void CEXISlippi::writeToFileAsync(u8* payload, u32 length, std::string fileOption)
|
||||
{
|
||||
if (!SConfig::GetInstance().m_slippiSaveReplays)
|
||||
if (!Config::Get(Config::SLIPPI_SAVE_REPLAYS))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -543,12 +546,12 @@ void CEXISlippi::createNewFile()
|
|||
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
|
||||
if (dirpath.empty())
|
||||
{
|
||||
SConfig::GetInstance().m_strSlippiReplayDir = File::GetHomeDirectory() + DIR_SEP + "Slippi";
|
||||
dirpath = SConfig::GetInstance().m_strSlippiReplayDir;
|
||||
Config::Get(Config::SLIPPI_REPLAY_DIR) = File::GetHomeDirectory() + DIR_SEP + "Slippi";
|
||||
dirpath = Config::Get(Config::SLIPPI_REPLAY_DIR);
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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('/');
|
||||
|
||||
|
@ -657,8 +660,8 @@ void CEXISlippi::prepareGameInfo(u8* payload)
|
|||
Slippi::GameSettings* settings = m_current_game->GetSettings();
|
||||
|
||||
// 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::GetInstance().m_OCFactor = g_playbackStatus->origOCFactor;
|
||||
SConfig::GetSlippiConfig().oc_enable = g_playbackStatus->origOCEnable;
|
||||
SConfig::GetSlippiConfig().oc_factor = g_playbackStatus->origOCFactor;
|
||||
|
||||
// Start in Fast Forward if this is mirrored
|
||||
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
|
||||
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";
|
||||
return;
|
||||
|
@ -2479,7 +2482,7 @@ void CEXISlippi::prepareOnlineMatchState()
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
@ -2597,7 +2600,7 @@ void CEXISlippi::prepareOnlineMatchState()
|
|||
appendWordToBuffer(&m_read_queue, rngOffset);
|
||||
|
||||
// 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
|
||||
m_read_queue.push_back(static_cast<u8>(sentChatMessageId));
|
||||
|
@ -2865,7 +2868,7 @@ void CEXISlippi::preparePremadeTextLoad(u8* payload)
|
|||
|
||||
bool CEXISlippi::isSlippiChatEnabled()
|
||||
{
|
||||
auto chatEnabledChoice = SConfig::GetInstance().m_slippiEnableQuickChat;
|
||||
auto chatEnabledChoice = Config::Get(Config::SLIPPI_ENABLE_QUICK_CHAT);
|
||||
bool res = true;
|
||||
switch (lastSearch.mode)
|
||||
{
|
||||
|
@ -3057,7 +3060,7 @@ void CEXISlippi::prepareDelayResponse()
|
|||
m_read_queue.push_back(0);
|
||||
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)
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "Core/HotkeyManager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Common/Common.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/Control/Input.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||
|
@ -477,7 +477,8 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
|
|||
|
||||
// Slippi Playback
|
||||
#ifdef IS_PLAYBACK
|
||||
if (SConfig::GetInstance().m_slippiEnableSeek) {
|
||||
if (SConfig::GetInstance().m_slippiEnableSeek)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
set_key_expression(HK_SLIPPI_JUMP_BACK, hotkey_string({"Shift", "`LEFT`"}));
|
||||
|
@ -503,29 +504,29 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// GBA
|
||||
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_RESET, hotkey_string({"`Ctrl`", "`Shift`", "`R`"}));
|
||||
// GBA
|
||||
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_RESET, hotkey_string({"`Ctrl`", "`Shift`", "`R`"}));
|
||||
|
||||
#ifdef _WIN32
|
||||
set_key_expression(HK_GBA_VOLUME_DOWN, "`SUBTRACT`");
|
||||
set_key_expression(HK_GBA_VOLUME_UP, "`ADD`");
|
||||
set_key_expression(HK_GBA_VOLUME_DOWN, "`SUBTRACT`");
|
||||
set_key_expression(HK_GBA_VOLUME_UP, "`ADD`");
|
||||
#else
|
||||
set_key_expression(HK_GBA_VOLUME_DOWN, "`KP_Subtract`");
|
||||
set_key_expression(HK_GBA_VOLUME_UP, "`KP_Add`");
|
||||
#endif
|
||||
set_key_expression(HK_GBA_TOGGLE_MUTE, "`M`");
|
||||
set_key_expression(HK_GBA_TOGGLE_MUTE, "`M`");
|
||||
|
||||
#ifdef _WIN32
|
||||
set_key_expression(HK_GBA_1X, "`NUMPAD1`");
|
||||
set_key_expression(HK_GBA_2X, "`NUMPAD2`");
|
||||
set_key_expression(HK_GBA_3X, "`NUMPAD3`");
|
||||
set_key_expression(HK_GBA_4X, "`NUMPAD4`");
|
||||
set_key_expression(HK_GBA_1X, "`NUMPAD1`");
|
||||
set_key_expression(HK_GBA_2X, "`NUMPAD2`");
|
||||
set_key_expression(HK_GBA_3X, "`NUMPAD3`");
|
||||
set_key_expression(HK_GBA_4X, "`NUMPAD4`");
|
||||
#else
|
||||
set_key_expression(HK_GBA_1X, "`KP_1`");
|
||||
set_key_expression(HK_GBA_2X, "`KP_2`");
|
||||
set_key_expression(HK_GBA_3X, "`KP_3`");
|
||||
set_key_expression(HK_GBA_4X, "`KP_4`");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,6 +167,12 @@ enum Hotkey
|
|||
HK_INCREMENT_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_UNLOAD,
|
||||
HK_GBA_RESET,
|
||||
|
@ -180,12 +186,6 @@ enum Hotkey
|
|||
HK_GBA_3X,
|
||||
HK_GBA_4X,
|
||||
|
||||
// Slippi Playback
|
||||
HK_SLIPPI_JUMP_BACK,
|
||||
HK_SLIPPI_STEP_BACK,
|
||||
HK_SLIPPI_STEP_FORWARD,
|
||||
HK_SLIPPI_JUMP_FORWARD,
|
||||
|
||||
NUM_HOTKEYS,
|
||||
};
|
||||
|
||||
|
|
|
@ -20,4 +20,12 @@ enum class Chat
|
|||
DIRECT_ONLY,
|
||||
OFF
|
||||
};
|
||||
}
|
||||
|
||||
struct Config
|
||||
{
|
||||
Melee::Version melee_version;
|
||||
bool oc_enable = true;
|
||||
float oc_factor = 1.0f;
|
||||
std::string slippi_input = "";
|
||||
};
|
||||
} // namespace Slippi
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "Common/Logging/Log.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/Version.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#if defined __linux__ && HAVE_ALSA
|
||||
|
@ -218,8 +219,8 @@ void SlippiMatchmaking::startMatchmaking()
|
|||
auto userInfo = m_user->GetUserInfo();
|
||||
while (m_client == nullptr && retryCount < 15)
|
||||
{
|
||||
if (SConfig::GetInstance().m_slippiForceNetplayPort)
|
||||
m_hostPort = SConfig::GetInstance().m_slippiNetplayPort;
|
||||
if (Config::Get(Config::SLIPPI_FORCE_NETPLAY_PORT))
|
||||
m_hostPort = Config::Get(Config::SLIPPI_NETPLAY_PORT);
|
||||
else
|
||||
m_hostPort = 41000 + (generator() % 10000);
|
||||
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");
|
||||
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);
|
||||
|
|
|
@ -123,7 +123,7 @@ void SlippiPlaybackStatus::processInitialState()
|
|||
// Doing it here to get it out of the way and prevent stutters later
|
||||
// Subsequent calls to SaveToBuffer for cState take ~1 frame
|
||||
State::SaveToBuffer(cState);
|
||||
if (SConfig::GetInstance().m_slippiEnableSeek)
|
||||
if (Config::Get(Config::SLIPPI_ENABLE_SEEK))
|
||||
{
|
||||
Config::SetCurrent(Config::MAIN_SHOW_CURSOR, Config::ShowCursor::Constantly);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void SlippiPlaybackStatus::SavestateThread()
|
|||
processInitialState();
|
||||
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);
|
||||
State::SaveToBuffer(cState);
|
||||
|
@ -262,13 +262,13 @@ void SlippiPlaybackStatus::setHardFFW(bool enable)
|
|||
{
|
||||
if (enable)
|
||||
{
|
||||
SConfig::GetInstance().m_OCEnable = true;
|
||||
SConfig::GetInstance().m_OCFactor = 4.0f;
|
||||
SConfig::GetSlippiConfig().oc_enable = true;
|
||||
SConfig::GetSlippiConfig().oc_factor = 4.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
SConfig::GetInstance().m_OCFactor = origOCFactor;
|
||||
SConfig::GetInstance().m_OCEnable = origOCEnable;
|
||||
SConfig::GetSlippiConfig().oc_factor = origOCFactor;
|
||||
SConfig::GetSlippiConfig().oc_enable = origOCEnable;
|
||||
}
|
||||
|
||||
isHardFFW = enable;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <open-vcdiff/src/google/vcdecoder.h>
|
||||
#include <open-vcdiff/src/google/vcencoder.h>
|
||||
|
||||
#include "../../Common/CommonTypes.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "SlippiGame.h"
|
||||
|
||||
|
@ -24,8 +24,8 @@ public:
|
|||
volatile bool shouldRunThreads = false;
|
||||
bool isHardFFW = false;
|
||||
bool isSoftFFW = false;
|
||||
bool origOCEnable = SConfig::GetInstance().m_OCEnable;
|
||||
float origOCFactor = SConfig::GetInstance().m_OCFactor;
|
||||
bool origOCEnable = SConfig::GetSlippiConfig().oc_enable;
|
||||
float origOCFactor = SConfig::GetSlippiConfig().oc_factor;
|
||||
|
||||
s32 lastFFWFrame = INT_MIN;
|
||||
s32 currentPlaybackFrame = INT_MIN;
|
||||
|
|
|
@ -32,8 +32,8 @@ static inline void trim(std::string& s)
|
|||
SlippiReplayComm::SlippiReplayComm()
|
||||
{
|
||||
INFO_LOG_FMT(EXPANSIONINTERFACE, "SlippiReplayComm: Using playback config path: {}",
|
||||
SConfig::GetInstance().m_strSlippiInput.c_str());
|
||||
configFilePath = SConfig::GetInstance().m_strSlippiInput.c_str();
|
||||
SConfig::GetSlippiConfig().slippi_input);
|
||||
configFilePath = SConfig::GetSlippiConfig().slippi_input;
|
||||
}
|
||||
|
||||
SlippiReplayComm::~SlippiReplayComm()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "SlippiSpectate.h"
|
||||
#include <Core/Config/MainSettings.h>
|
||||
#include <Core/ConfigManager.h>
|
||||
#include "Common/Base64.hpp"
|
||||
#include "Common/CommonTypes.h"
|
||||
|
@ -15,7 +16,7 @@
|
|||
|
||||
inline bool isSpectatorEnabled()
|
||||
{
|
||||
return SConfig::GetInstance().m_enableSpectator;
|
||||
return Config::Get(Config::SLIPPI_ENABLE_SPECTATOR);
|
||||
}
|
||||
|
||||
SlippiSpectateServer& SlippiSpectateServer::getInstance()
|
||||
|
@ -279,7 +280,7 @@ void SlippiSpectateServer::SlippicommSocketThread(void)
|
|||
|
||||
ENetAddress server_address = {0};
|
||||
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
|
||||
// This call can fail if the system is already listening on the specified port
|
||||
|
|
|
@ -702,17 +702,17 @@ void Settings::SetBatchModeEnabled(bool batch)
|
|||
|
||||
std::string Settings::GetSlippiInputFile() const
|
||||
{
|
||||
return SConfig::GetInstance().m_strSlippiInput;
|
||||
return SConfig::GetSlippiConfig().slippi_input;
|
||||
}
|
||||
|
||||
void Settings::SetSlippiInputFile(std::string path)
|
||||
{
|
||||
SConfig::GetInstance().m_strSlippiInput = path;
|
||||
SConfig::GetSlippiConfig().slippi_input = path;
|
||||
}
|
||||
|
||||
void Settings::SetSlippiSeekbarEnabled(bool enabled)
|
||||
{
|
||||
SConfig::GetInstance().m_slippiEnableSeek = enabled;
|
||||
Config::SetBase(Config::SLIPPI_ENABLE_SEEK, enabled);
|
||||
}
|
||||
|
||||
bool Settings::IsSDCardInserted() const
|
||||
|
|
|
@ -134,7 +134,7 @@ void GameCubePane::CreateWidgets()
|
|||
// Add slot devices
|
||||
for (const auto device : {EXIDeviceType::None, EXIDeviceType::Dummy, EXIDeviceType::MemoryCard,
|
||||
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 int value = static_cast<int>(device);
|
||||
|
|
|
@ -1,167 +1,170 @@
|
|||
#include "DolphinQt/Settings/SlippiPane.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QFormLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QSizePolicy>
|
||||
#include <QSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
SlippiPane::SlippiPane(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
CreateLayout();
|
||||
LoadConfig();
|
||||
// ConnectLayout();
|
||||
}
|
||||
|
||||
void SlippiPane::LoadConfig()
|
||||
{
|
||||
}
|
||||
void SlippiPane::CreateLayout()
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
auto* layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
m_main_layout = new QVBoxLayout();
|
||||
setLayout(m_main_layout);
|
||||
|
||||
#ifndef IS_PLAYBACK
|
||||
// Replay Settings
|
||||
auto* replay_settings = new QGroupBox(tr("Replay Settings"));
|
||||
auto* replay_settings_layout = new QVBoxLayout();
|
||||
replay_settings->setLayout(replay_settings_layout);
|
||||
layout->addWidget(replay_settings);
|
||||
m_replay_settings = new QGroupBox(tr("Replay Settings"));
|
||||
m_replay_settings_layout = new QVBoxLayout();
|
||||
m_replay_settings->setLayout(m_replay_settings_layout);
|
||||
m_main_layout->addWidget(m_replay_settings);
|
||||
|
||||
auto* enable_replay_save_checkbox = new QCheckBox(tr("Save Slippi Replays"));
|
||||
enable_replay_save_checkbox->setToolTip(
|
||||
m_enable_replay_save = new QCheckBox(tr("Save Slippi Replays"));
|
||||
m_enable_replay_save->setToolTip(
|
||||
tr("Enable this to make Slippi automatically save .slp recordings of your games."));
|
||||
replay_settings_layout->addWidget(enable_replay_save_checkbox);
|
||||
enable_replay_save_checkbox->setChecked(SConfig::GetInstance().m_slippiSaveReplays);
|
||||
connect(enable_replay_save_checkbox, &QCheckBox::toggled, this,
|
||||
[](bool checked) { SConfig::GetInstance().m_slippiSaveReplays = checked; });
|
||||
m_replay_settings_layout->addWidget(m_enable_replay_save);
|
||||
m_enable_replay_save->setChecked(Config::Get(Config::SLIPPI_SAVE_REPLAYS));
|
||||
// connect(enable_replay_save_checkbox, &QCheckBox::toggled, this,
|
||||
// [](bool checked) { Config::SetBase(Config::SLIPPI_SAVE_REPLAYS, checked); });
|
||||
|
||||
auto* enable_monthly_replay_folders_checkbox =
|
||||
new QCheckBox(tr("Save Replays to Monthly Subfolders"));
|
||||
enable_monthly_replay_folders_checkbox->setToolTip(
|
||||
tr("Enable this to save your replays into subfolders by month (YYYY-MM)."));
|
||||
replay_settings_layout->addWidget(enable_monthly_replay_folders_checkbox);
|
||||
enable_monthly_replay_folders_checkbox->setChecked(
|
||||
SConfig::GetInstance().m_slippiReplayMonthFolders);
|
||||
connect(enable_monthly_replay_folders_checkbox, &QCheckBox::toggled, this,
|
||||
[](bool checked) { SConfig::GetInstance().m_slippiReplayMonthFolders = checked; });
|
||||
// auto* enable_monthly_replay_folders_checkbox =
|
||||
// new QCheckBox(tr("Save Replays to Monthly Subfolders"));
|
||||
// enable_monthly_replay_folders_checkbox->setToolTip(
|
||||
// tr("Enable this to save your replays into subfolders by month (YYYY-MM)."));
|
||||
// replay_settings_layout->addWidget(enable_monthly_replay_folders_checkbox);
|
||||
// enable_monthly_replay_folders_checkbox->setChecked(
|
||||
// SConfig::GetInstance().m_slippiReplayMonthFolders);
|
||||
// connect(enable_monthly_replay_folders_checkbox, &QCheckBox::toggled, this,
|
||||
// [](bool checked) { SConfig::GetInstance().m_slippiReplayMonthFolders = checked; });
|
||||
|
||||
auto* replay_folder_layout = new QGridLayout();
|
||||
m_replay_folder_edit =
|
||||
new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir));
|
||||
m_replay_folder_edit->setToolTip(tr("Choose where your Slippi replay files are saved."));
|
||||
connect(m_replay_folder_edit, &QLineEdit::editingFinished, [this] {
|
||||
SConfig::GetInstance().m_strSlippiReplayDir = m_replay_folder_edit->text().toStdString();
|
||||
});
|
||||
QPushButton* replay_folder_open = new QPushButton(QStringLiteral("..."));
|
||||
connect(replay_folder_open, &QPushButton::clicked, this, &SlippiPane::BrowseReplayFolder);
|
||||
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(replay_folder_open, 0, 2);
|
||||
replay_settings_layout->addLayout(replay_folder_layout);
|
||||
// auto* replay_folder_layout = new QGridLayout();
|
||||
// m_replay_folder_edit =
|
||||
// new QLineEdit(QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir));
|
||||
// m_replay_folder_edit->setToolTip(tr("Choose where your Slippi replay files are saved."));
|
||||
// connect(m_replay_folder_edit, &QLineEdit::editingFinished, [this] {
|
||||
// SConfig::GetInstance().m_strSlippiReplayDir = m_replay_folder_edit->text().toStdString();
|
||||
// });
|
||||
// QPushButton* replay_folder_open = new QPushButton(QStringLiteral("..."));
|
||||
// connect(replay_folder_open, &QPushButton::clicked, this, &SlippiPane::BrowseReplayFolder);
|
||||
// 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(replay_folder_open, 0, 2);
|
||||
// replay_settings_layout->addLayout(replay_folder_layout);
|
||||
|
||||
// Online Settings
|
||||
auto* online_settings = new QGroupBox(tr("Online Settings"));
|
||||
auto* online_settings_layout = new QFormLayout();
|
||||
online_settings->setLayout(online_settings_layout);
|
||||
layout->addWidget(online_settings);
|
||||
//// Online Settings
|
||||
// auto* online_settings = new QGroupBox(tr("Online Settings"));
|
||||
// auto* online_settings_layout = new QFormLayout();
|
||||
// online_settings->setLayout(online_settings_layout);
|
||||
// layout->addWidget(online_settings);
|
||||
|
||||
auto* delay_spin = new QSpinBox();
|
||||
delay_spin->setFixedSize(30, 25);
|
||||
delay_spin->setRange(1, 9);
|
||||
delay_spin->setToolTip(tr("Leave this at 2 unless consistently playing on 120+ ping. "
|
||||
"Increasing this can cause unplayable input delay, and lowering it "
|
||||
"can cause visual artifacts/lag."));
|
||||
online_settings_layout->addRow(tr("Delay Frames:"), delay_spin);
|
||||
delay_spin->setValue(SConfig::GetInstance().m_slippiOnlineDelay);
|
||||
connect(delay_spin, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
[](int delay) { SConfig::GetInstance().m_slippiOnlineDelay = delay; });
|
||||
// auto* delay_spin = new QSpinBox();
|
||||
// delay_spin->setFixedSize(30, 25);
|
||||
// delay_spin->setRange(1, 9);
|
||||
// delay_spin->setToolTip(tr("Leave this at 2 unless consistently playing on 120+ ping. "
|
||||
// "Increasing this can cause unplayable input delay, and lowering it "
|
||||
// "can cause visual artifacts/lag."));
|
||||
// online_settings_layout->addRow(tr("Delay Frames:"), delay_spin);
|
||||
// delay_spin->setValue(SConfig::GetInstance().m_slippiOnlineDelay);
|
||||
// connect(delay_spin, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
// [](int delay) { SConfig::GetInstance().m_slippiOnlineDelay = delay; });
|
||||
|
||||
auto* netplay_quick_chat_combo = new QComboBox();
|
||||
for (const auto& item : {tr("Enabled"), tr("Direct Only"), tr("Off")})
|
||||
{
|
||||
netplay_quick_chat_combo->addItem(item);
|
||||
}
|
||||
connect(netplay_quick_chat_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
[](int index) {
|
||||
SConfig::GetInstance().m_slippiEnableQuickChat = static_cast<Slippi::Chat>(index);
|
||||
});
|
||||
netplay_quick_chat_combo->setCurrentIndex(
|
||||
static_cast<u32>(SConfig::GetInstance().m_slippiEnableQuickChat));
|
||||
// auto* netplay_quick_chat_combo = new QComboBox();
|
||||
// for (const auto& item : {tr("Enabled"), tr("Direct Only"), tr("Off")})
|
||||
//{
|
||||
// netplay_quick_chat_combo->addItem(item);
|
||||
// }
|
||||
// connect(netplay_quick_chat_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
// [](int index) {
|
||||
// SConfig::GetInstance().m_slippiEnableQuickChat = static_cast<Slippi::Chat>(index);
|
||||
// });
|
||||
// netplay_quick_chat_combo->setCurrentIndex(
|
||||
// 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
|
||||
// and a lot of the Qstring bullshit drives me up the wall.
|
||||
auto* netplay_port_spin = new QSpinBox();
|
||||
netplay_port_spin->setFixedSize(60, 25);
|
||||
QSizePolicy sp_retain = netplay_port_spin->sizePolicy();
|
||||
sp_retain.setRetainSizeWhenHidden(true);
|
||||
netplay_port_spin->setSizePolicy(sp_retain);
|
||||
netplay_port_spin->setRange(1000, 65535);
|
||||
netplay_port_spin->setValue(SConfig::GetInstance().m_slippiNetplayPort);
|
||||
if (!SConfig::GetInstance().m_slippiForceNetplayPort)
|
||||
{
|
||||
netplay_port_spin->hide();
|
||||
}
|
||||
auto* enable_force_netplay_port_checkbox = new QCheckBox(tr("Force Netplay Port"));
|
||||
enable_force_netplay_port_checkbox->setToolTip(
|
||||
tr("Enable this to force Slippi to use a specific network port for online peer-to-peer "
|
||||
"connections."));
|
||||
//// 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.
|
||||
// auto* netplay_port_spin = new QSpinBox();
|
||||
// netplay_port_spin->setFixedSize(60, 25);
|
||||
// QSizePolicy sp_retain = netplay_port_spin->sizePolicy();
|
||||
// sp_retain.setRetainSizeWhenHidden(true);
|
||||
// netplay_port_spin->setSizePolicy(sp_retain);
|
||||
// netplay_port_spin->setRange(1000, 65535);
|
||||
// netplay_port_spin->setValue(SConfig::GetInstance().m_slippiNetplayPort);
|
||||
// if (!SConfig::GetInstance().m_slippiForceNetplayPort)
|
||||
//{
|
||||
// netplay_port_spin->hide();
|
||||
// }
|
||||
// auto* enable_force_netplay_port_checkbox = new QCheckBox(tr("Force Netplay Port"));
|
||||
// enable_force_netplay_port_checkbox->setToolTip(
|
||||
// tr("Enable this to force Slippi to use a specific network port for online peer-to-peer "
|
||||
// "connections."));
|
||||
|
||||
enable_force_netplay_port_checkbox->setChecked(SConfig::GetInstance().m_slippiForceNetplayPort);
|
||||
connect(enable_force_netplay_port_checkbox, &QCheckBox::toggled, this,
|
||||
[netplay_port_spin](bool checked) {
|
||||
SConfig::GetInstance().m_slippiForceNetplayPort = checked;
|
||||
checked ? netplay_port_spin->show() : netplay_port_spin->hide();
|
||||
});
|
||||
auto* netplay_port_layout = new QGridLayout();
|
||||
netplay_port_layout->setColumnStretch(1, 1);
|
||||
netplay_port_layout->addWidget(enable_force_netplay_port_checkbox, 0, 0);
|
||||
netplay_port_layout->addWidget(netplay_port_spin, 0, 1, Qt::AlignLeft);
|
||||
// enable_force_netplay_port_checkbox->setChecked(SConfig::GetInstance().m_slippiForceNetplayPort);
|
||||
// connect(enable_force_netplay_port_checkbox, &QCheckBox::toggled, this,
|
||||
// [netplay_port_spin](bool checked) {
|
||||
// SConfig::GetInstance().m_slippiForceNetplayPort = checked;
|
||||
// checked ? netplay_port_spin->show() : netplay_port_spin->hide();
|
||||
// });
|
||||
// auto* netplay_port_layout = new QGridLayout();
|
||||
// netplay_port_layout->setColumnStretch(1, 1);
|
||||
// netplay_port_layout->addWidget(enable_force_netplay_port_checkbox, 0, 0);
|
||||
// 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();
|
||||
netplay_ip_edit->setFixedSize(100, 25);
|
||||
sp_retain = netplay_ip_edit->sizePolicy();
|
||||
sp_retain.setRetainSizeWhenHidden(true);
|
||||
netplay_ip_edit->setSizePolicy(sp_retain);
|
||||
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).
|
||||
QRegularExpression ipRegex(QString::fromStdString(
|
||||
"^" + ipRange + "(\\." + ipRange + ")" + "(\\." + ipRange + ")" + "(\\." + ipRange + ")$"));
|
||||
QRegularExpressionValidator* ipValidator = new QRegularExpressionValidator(ipRegex, this);
|
||||
netplay_ip_edit->setValidator(ipValidator);
|
||||
auto lan_ip = SConfig::GetInstance().m_slippiLanIp;
|
||||
netplay_ip_edit->setText(QString::fromStdString(lan_ip));
|
||||
if (!SConfig::GetInstance().m_slippiForceLanIp)
|
||||
{
|
||||
netplay_ip_edit->hide();
|
||||
}
|
||||
auto* enable_force_netplay_ip_checkbox = new QCheckBox(tr("Force Netplay IP"));
|
||||
enable_force_netplay_ip_checkbox->setToolTip(
|
||||
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."));
|
||||
// auto* netplay_ip_edit = new QLineEdit();
|
||||
// netplay_ip_edit->setFixedSize(100, 25);
|
||||
// sp_retain = netplay_ip_edit->sizePolicy();
|
||||
// sp_retain.setRetainSizeWhenHidden(true);
|
||||
// netplay_ip_edit->setSizePolicy(sp_retain);
|
||||
// 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).
|
||||
// QRegularExpression ipRegex(QString::fromStdString(
|
||||
// "^" + ipRange + "(\\." + ipRange + ")" + "(\\." + ipRange + ")" + "(\\." + ipRange +
|
||||
// ")$"));
|
||||
// QRegularExpressionValidator* ipValidator = new QRegularExpressionValidator(ipRegex, this);
|
||||
// netplay_ip_edit->setValidator(ipValidator);
|
||||
// auto lan_ip = SConfig::GetInstance().m_slippiLanIp;
|
||||
// netplay_ip_edit->setText(QString::fromStdString(lan_ip));
|
||||
// if (!SConfig::GetInstance().m_slippiForceLanIp)
|
||||
//{
|
||||
// netplay_ip_edit->hide();
|
||||
// }
|
||||
// auto* enable_force_netplay_ip_checkbox = new QCheckBox(tr("Force Netplay IP"));
|
||||
// enable_force_netplay_ip_checkbox->setToolTip(
|
||||
// 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);
|
||||
connect(enable_force_netplay_ip_checkbox, &QCheckBox::toggled, this,
|
||||
[netplay_ip_edit](bool checked) {
|
||||
SConfig::GetInstance().m_slippiForceLanIp = checked;
|
||||
checked ? netplay_ip_edit->show() : netplay_ip_edit->hide();
|
||||
});
|
||||
auto* netplay_ip_layout = new QGridLayout();
|
||||
netplay_ip_layout->setColumnStretch(1, 1);
|
||||
netplay_ip_layout->addWidget(enable_force_netplay_ip_checkbox, 0, 0);
|
||||
netplay_ip_layout->addWidget(netplay_ip_edit, 0, 1, Qt::AlignLeft);
|
||||
// enable_force_netplay_ip_checkbox->setChecked(SConfig::GetInstance().m_slippiForceLanIp);
|
||||
// connect(enable_force_netplay_ip_checkbox, &QCheckBox::toggled, this,
|
||||
// [netplay_ip_edit](bool checked) {
|
||||
// SConfig::GetInstance().m_slippiForceLanIp = checked;
|
||||
// checked ? netplay_ip_edit->show() : netplay_ip_edit->hide();
|
||||
// });
|
||||
// auto* netplay_ip_layout = new QGridLayout();
|
||||
// netplay_ip_layout->setColumnStretch(1, 1);
|
||||
// netplay_ip_layout->addWidget(enable_force_netplay_ip_checkbox, 0, 0);
|
||||
// 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
|
||||
// Playback Settings
|
||||
|
@ -187,12 +190,26 @@ void SlippiPane::CreateLayout()
|
|||
|
||||
void SlippiPane::BrowseReplayFolder()
|
||||
{
|
||||
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
|
||||
this, tr("Select Replay Folder"),
|
||||
QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir)));
|
||||
if (!dir.isEmpty())
|
||||
{
|
||||
m_replay_folder_edit->setText(dir);
|
||||
SConfig::GetInstance().m_strSlippiReplayDir = dir.toStdString();
|
||||
}
|
||||
// QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
|
||||
// this, tr("Select Replay Folder"),
|
||||
// QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir)));
|
||||
// if (!dir.isEmpty())
|
||||
//{
|
||||
// m_replay_folder_edit->setText(dir);
|
||||
// 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();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
#include <QLineEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class QLineEdit;
|
||||
|
@ -20,6 +24,15 @@ public:
|
|||
private:
|
||||
void BrowseReplayFolder();
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
#include <Core/Config/MainSettings.h>
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
@ -189,7 +190,7 @@ void PipeDevice::UpdateInput()
|
|||
m_buf.erase(0, newline + 1);
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue