mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Windows default to non-portable + Reworked MLC handling and related UI (#1252)
This commit is contained in:
@@ -7,41 +7,47 @@
|
||||
#include "config/LaunchSettings.h"
|
||||
#include "util/helpers/helpers.h"
|
||||
|
||||
std::set<fs::path>
|
||||
ActiveSettings::LoadOnce(
|
||||
const fs::path& executablePath,
|
||||
const fs::path& userDataPath,
|
||||
const fs::path& configPath,
|
||||
const fs::path& cachePath,
|
||||
const fs::path& dataPath)
|
||||
void ActiveSettings::SetPaths(bool isPortableMode,
|
||||
const fs::path& executablePath,
|
||||
const fs::path& userDataPath,
|
||||
const fs::path& configPath,
|
||||
const fs::path& cachePath,
|
||||
const fs::path& dataPath,
|
||||
std::set<fs::path>& failedWriteAccess)
|
||||
{
|
||||
cemu_assert_debug(!s_setPathsCalled); // can only change paths before loading
|
||||
s_isPortableMode = isPortableMode;
|
||||
s_executable_path = executablePath;
|
||||
s_user_data_path = userDataPath;
|
||||
s_config_path = configPath;
|
||||
s_cache_path = cachePath;
|
||||
s_data_path = dataPath;
|
||||
std::set<fs::path> failed_write_access;
|
||||
failedWriteAccess.clear();
|
||||
for (auto&& path : {userDataPath, configPath, cachePath})
|
||||
{
|
||||
if (!fs::exists(path))
|
||||
{
|
||||
std::error_code ec;
|
||||
std::error_code ec;
|
||||
if (!fs::exists(path, ec))
|
||||
fs::create_directories(path, ec);
|
||||
}
|
||||
if (!TestWriteAccess(path))
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Failed to write to {}", _pathToUtf8(path));
|
||||
failed_write_access.insert(path);
|
||||
failedWriteAccess.insert(path);
|
||||
}
|
||||
}
|
||||
|
||||
s_executable_filename = s_executable_path.filename();
|
||||
s_setPathsCalled = true;
|
||||
}
|
||||
|
||||
g_config.SetFilename(GetConfigPath("settings.xml").generic_wstring());
|
||||
g_config.Load();
|
||||
[[nodiscard]] bool ActiveSettings::IsPortableMode()
|
||||
{
|
||||
return s_isPortableMode;
|
||||
}
|
||||
|
||||
void ActiveSettings::Init()
|
||||
{
|
||||
cemu_assert_debug(s_setPathsCalled);
|
||||
std::string additionalErrorInfo;
|
||||
s_has_required_online_files = iosuCrypt_checkRequirementsForOnlineMode(additionalErrorInfo) == IOS_CRYPTO_ONLINE_REQ_OK;
|
||||
return failed_write_access;
|
||||
}
|
||||
|
||||
bool ActiveSettings::LoadSharedLibrariesEnabled()
|
||||
@@ -229,6 +235,7 @@ bool ActiveSettings::ForceSamplerRoundToPrecision()
|
||||
|
||||
fs::path ActiveSettings::GetMlcPath()
|
||||
{
|
||||
cemu_assert_debug(s_setPathsCalled);
|
||||
if(const auto launch_mlc = LaunchSettings::GetMLCPath(); launch_mlc.has_value())
|
||||
return launch_mlc.value();
|
||||
|
||||
@@ -238,6 +245,17 @@ fs::path ActiveSettings::GetMlcPath()
|
||||
return GetDefaultMLCPath();
|
||||
}
|
||||
|
||||
bool ActiveSettings::IsCustomMlcPath()
|
||||
{
|
||||
cemu_assert_debug(s_setPathsCalled);
|
||||
return !GetConfig().mlc_path.GetValue().empty();
|
||||
}
|
||||
|
||||
bool ActiveSettings::IsCommandLineMlcPath()
|
||||
{
|
||||
return LaunchSettings::GetMLCPath().has_value();
|
||||
}
|
||||
|
||||
fs::path ActiveSettings::GetDefaultMLCPath()
|
||||
{
|
||||
return GetUserDataPath("mlc01");
|
||||
|
||||
@@ -34,12 +34,16 @@ private:
|
||||
|
||||
public:
|
||||
// Set directories and return all directories that failed write access test
|
||||
static std::set<fs::path>
|
||||
LoadOnce(const fs::path& executablePath,
|
||||
const fs::path& userDataPath,
|
||||
const fs::path& configPath,
|
||||
const fs::path& cachePath,
|
||||
const fs::path& dataPath);
|
||||
static void
|
||||
SetPaths(bool isPortableMode,
|
||||
const fs::path& executablePath,
|
||||
const fs::path& userDataPath,
|
||||
const fs::path& configPath,
|
||||
const fs::path& cachePath,
|
||||
const fs::path& dataPath,
|
||||
std::set<fs::path>& failedWriteAccess);
|
||||
|
||||
static void Init();
|
||||
|
||||
[[nodiscard]] static fs::path GetExecutablePath() { return s_executable_path; }
|
||||
[[nodiscard]] static fs::path GetExecutableFilename() { return s_executable_filename; }
|
||||
@@ -56,11 +60,14 @@ public:
|
||||
|
||||
template <typename ...TArgs>
|
||||
[[nodiscard]] static fs::path GetMlcPath(TArgs&&... args){ return GetPath(GetMlcPath(), std::forward<TArgs>(args)...); };
|
||||
static bool IsCustomMlcPath();
|
||||
static bool IsCommandLineMlcPath();
|
||||
|
||||
// get mlc path to default cemu root dir/mlc01
|
||||
[[nodiscard]] static fs::path GetDefaultMLCPath();
|
||||
|
||||
private:
|
||||
inline static bool s_isPortableMode{false};
|
||||
inline static fs::path s_executable_path;
|
||||
inline static fs::path s_user_data_path;
|
||||
inline static fs::path s_config_path;
|
||||
@@ -70,6 +77,9 @@ private:
|
||||
inline static fs::path s_mlc_path;
|
||||
|
||||
public:
|
||||
// can be called before Init
|
||||
[[nodiscard]] static bool IsPortableMode();
|
||||
|
||||
// general
|
||||
[[nodiscard]] static bool LoadSharedLibrariesEnabled();
|
||||
[[nodiscard]] static bool DisplayDRCEnabled();
|
||||
@@ -111,6 +121,7 @@ public:
|
||||
[[nodiscard]] static bool ForceSamplerRoundToPrecision();
|
||||
|
||||
private:
|
||||
inline static bool s_setPathsCalled = false;
|
||||
// dump options
|
||||
inline static bool s_dump_shaders = false;
|
||||
inline static bool s_dump_textures = false;
|
||||
|
||||
@@ -8,10 +8,6 @@ add_library(CemuConfig
|
||||
LaunchSettings.h
|
||||
NetworkSettings.cpp
|
||||
NetworkSettings.h
|
||||
PermanentConfig.cpp
|
||||
PermanentConfig.h
|
||||
PermanentStorage.cpp
|
||||
PermanentStorage.h
|
||||
XMLConfig.h
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <wx/language.h>
|
||||
|
||||
#include "PermanentConfig.h"
|
||||
#include "ActiveSettings.h"
|
||||
|
||||
XMLCemuConfig_t g_config(L"settings.xml");
|
||||
@@ -15,23 +14,6 @@ void CemuConfig::SetMLCPath(fs::path path, bool save)
|
||||
mlc_path.SetValue(_pathToUtf8(path));
|
||||
if(save)
|
||||
g_config.Save();
|
||||
|
||||
// if custom mlc path has been selected, store it in permanent config
|
||||
if (path != ActiveSettings::GetDefaultMLCPath())
|
||||
{
|
||||
try
|
||||
{
|
||||
auto pconfig = PermanentConfig::Load();
|
||||
pconfig.custom_mlc_path = _pathToUtf8(path);
|
||||
pconfig.Store();
|
||||
}
|
||||
catch (const PSDisabledException&) {}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "can't store custom mlc path in permanent storage: {}", ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
Account::RefreshAccounts();
|
||||
}
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ struct CemuConfig
|
||||
ConfigValue<bool> save_screenshot{true};
|
||||
|
||||
ConfigValue<bool> did_show_vulkan_warning{false};
|
||||
ConfigValue<bool> did_show_graphic_pack_download{false};
|
||||
ConfigValue<bool> did_show_graphic_pack_download{false}; // no longer used but we keep the config value around in case people downgrade Cemu. Despite the name this was used for the Getting Started dialog
|
||||
ConfigValue<bool> did_show_macos_disclaimer{false};
|
||||
|
||||
ConfigValue<bool> show_icon_column{ true };
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#include "PermanentConfig.h"
|
||||
|
||||
#include "pugixml.hpp"
|
||||
|
||||
#include "PermanentStorage.h"
|
||||
|
||||
struct xml_string_writer : pugi::xml_writer
|
||||
{
|
||||
std::string result;
|
||||
|
||||
void write(const void* data, size_t size) override
|
||||
{
|
||||
result.append(static_cast<const char*>(data), size);
|
||||
}
|
||||
};
|
||||
|
||||
std::string PermanentConfig::ToXMLString() const noexcept
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
doc.append_child(pugi::node_declaration).append_attribute("encoding") = "UTF-8";
|
||||
auto root = doc.append_child("config");
|
||||
root.append_child("MlcPath").text().set(this->custom_mlc_path.c_str());
|
||||
|
||||
xml_string_writer writer;
|
||||
doc.save(writer);
|
||||
return writer.result;
|
||||
}
|
||||
|
||||
PermanentConfig PermanentConfig::FromXMLString(std::string_view str) noexcept
|
||||
{
|
||||
PermanentConfig result{};
|
||||
|
||||
pugi::xml_document doc;
|
||||
if(doc.load_buffer(str.data(), str.size()))
|
||||
{
|
||||
result.custom_mlc_path = doc.select_node("/config/MlcPath").node().text().as_string();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PermanentConfig PermanentConfig::Load()
|
||||
{
|
||||
PermanentStorage storage;
|
||||
|
||||
const auto str = storage.ReadFile(kFileName);
|
||||
if (!str.empty())
|
||||
return FromXMLString(str);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
bool PermanentConfig::Store() noexcept
|
||||
{
|
||||
try
|
||||
{
|
||||
PermanentStorage storage;
|
||||
storage.WriteStringToFile(kFileName, ToXMLString());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "PermanentStorage.h"
|
||||
|
||||
struct PermanentConfig
|
||||
{
|
||||
static constexpr const char* kFileName = "perm_setting.xml";
|
||||
|
||||
std::string custom_mlc_path;
|
||||
|
||||
[[nodiscard]] std::string ToXMLString() const noexcept;
|
||||
static PermanentConfig FromXMLString(std::string_view str) noexcept;
|
||||
|
||||
// gets from permanent storage
|
||||
static PermanentConfig Load();
|
||||
// saves to permanent storage
|
||||
bool Store() noexcept;
|
||||
};
|
||||
@@ -1,76 +0,0 @@
|
||||
#include "PermanentStorage.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "util/helpers/SystemException.h"
|
||||
|
||||
PermanentStorage::PermanentStorage()
|
||||
{
|
||||
if (!GetConfig().permanent_storage)
|
||||
throw PSDisabledException();
|
||||
|
||||
const char* appdata = std::getenv("LOCALAPPDATA");
|
||||
if (!appdata)
|
||||
throw std::runtime_error("can't get LOCALAPPDATA");
|
||||
m_storage_path = appdata;
|
||||
m_storage_path /= "Cemu";
|
||||
|
||||
fs::create_directories(m_storage_path);
|
||||
}
|
||||
|
||||
PermanentStorage::~PermanentStorage()
|
||||
{
|
||||
if (m_remove_storage)
|
||||
{
|
||||
std::error_code ec;
|
||||
fs::remove_all(m_storage_path, ec);
|
||||
if (ec)
|
||||
{
|
||||
SystemException ex(ec);
|
||||
cemuLog_log(LogType::Force, "can't remove permanent storage: {}", ex.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PermanentStorage::ClearAllFiles() const
|
||||
{
|
||||
fs::remove_all(m_storage_path);
|
||||
fs::create_directories(m_storage_path);
|
||||
}
|
||||
|
||||
void PermanentStorage::RemoveStorage()
|
||||
{
|
||||
m_remove_storage = true;
|
||||
}
|
||||
|
||||
void PermanentStorage::WriteStringToFile(std::string_view filename, std::string_view content)
|
||||
{
|
||||
const auto name = m_storage_path.append(filename.data(), filename.data() + filename.size());
|
||||
std::ofstream file(name.string());
|
||||
file.write(content.data(), (uint32_t)content.size());
|
||||
}
|
||||
|
||||
std::string PermanentStorage::ReadFile(std::string_view filename) noexcept
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto name = m_storage_path.append(filename.data(), filename.data() + filename.size());
|
||||
std::ifstream file(name, std::ios::in | std::ios::ate);
|
||||
if (!file.is_open())
|
||||
return {};
|
||||
|
||||
const auto end = file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
const auto file_size = end - file.tellg();
|
||||
if (file_size == 0)
|
||||
return {};
|
||||
|
||||
std::string result;
|
||||
result.resize(file_size);
|
||||
file.read(result.data(), file_size);
|
||||
return result;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// disabled by config
|
||||
class PSDisabledException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
PSDisabledException()
|
||||
: std::runtime_error("permanent storage is disabled by user") {}
|
||||
};
|
||||
|
||||
class PermanentStorage
|
||||
{
|
||||
public:
|
||||
PermanentStorage();
|
||||
~PermanentStorage();
|
||||
|
||||
void ClearAllFiles() const;
|
||||
// flags storage to be removed on destruction
|
||||
void RemoveStorage();
|
||||
|
||||
void WriteStringToFile(std::string_view filename, std::string_view content);
|
||||
std::string ReadFile(std::string_view filename) noexcept;
|
||||
|
||||
private:
|
||||
fs::path m_storage_path;
|
||||
bool m_remove_storage = false;
|
||||
};
|
||||
+254
-153
File diff suppressed because it is too large
Load Diff
+9
-4
@@ -15,13 +15,18 @@ public:
|
||||
|
||||
std::vector<const wxLanguageInfo*> GetLanguages() const;
|
||||
|
||||
static void CreateDefaultFiles(bool first_start = false);
|
||||
static bool TrySelectMLCPath(fs::path path);
|
||||
static bool SelectMLCPath(wxWindow* parent = nullptr);
|
||||
static bool CheckMLCPath(const fs::path& mlc);
|
||||
static bool CreateDefaultMLCFiles(const fs::path& mlc);
|
||||
static void CreateDefaultCemuFiles();
|
||||
|
||||
static void InitializeNewMLCOrFail(fs::path mlc);
|
||||
static void InitializeExistingMLCOrFail(fs::path mlc);
|
||||
private:
|
||||
void LocalizeUI(wxLanguage languageToUse);
|
||||
|
||||
void DeterminePaths(std::set<fs::path>& failedWriteAccess);
|
||||
|
||||
void ActivateApp(wxActivateEvent& event);
|
||||
void LocalizeUI();
|
||||
static std::vector<const wxLanguageInfo*> GetAvailableTranslationLanguages(wxTranslations* translationsMgr);
|
||||
|
||||
MainWindow* m_mainFrame = nullptr;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include "util/helpers/SystemException.h"
|
||||
#include "gui/dialogs/CreateAccount/wxCreateAccountDialog.h"
|
||||
#include "config/PermanentStorage.h"
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <VersionHelpers.h>
|
||||
@@ -176,19 +175,15 @@ wxPanel* GeneralSettings2::AddGeneralPage(wxNotebook* notebook)
|
||||
m_save_screenshot->SetToolTip(_("Pressing the screenshot key (F12) will save a screenshot directly to the screenshots folder"));
|
||||
second_row->Add(m_save_screenshot, 0, botflag, 5);
|
||||
|
||||
m_permanent_storage = new wxCheckBox(box, wxID_ANY, _("Use permanent storage"));
|
||||
m_permanent_storage->SetToolTip(_("Cemu will remember your custom mlc path in %LOCALAPPDATA%/Cemu for new installations."));
|
||||
second_row->Add(m_permanent_storage, 0, botflag, 5);
|
||||
second_row->AddSpacer(10);
|
||||
m_disable_screensaver = new wxCheckBox(box, wxID_ANY, _("Disable screen saver"));
|
||||
m_disable_screensaver->SetToolTip(_("Prevents the system from activating the screen saver or going to sleep while running a game."));
|
||||
second_row->Add(m_disable_screensaver, 0, botflag, 5);
|
||||
|
||||
// Enable/disable feral interactive gamemode
|
||||
// Enable/disable feral interactive gamemode
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
m_feral_gamemode = new wxCheckBox(box, wxID_ANY, _("Enable Feral GameMode"));
|
||||
m_feral_gamemode->SetToolTip(_("Use FeralInteractive GameMode if installed."));
|
||||
second_row->Add(m_feral_gamemode, 0, botflag, 5);
|
||||
m_feral_gamemode = new wxCheckBox(box, wxID_ANY, _("Enable Feral GameMode"));
|
||||
m_feral_gamemode->SetToolTip(_("Use FeralInteractive GameMode if installed."));
|
||||
second_row->Add(m_feral_gamemode, 0, botflag, 5);
|
||||
#endif
|
||||
|
||||
// temporary workaround because feature crashes on macOS
|
||||
@@ -203,23 +198,33 @@ wxPanel* GeneralSettings2::AddGeneralPage(wxNotebook* notebook)
|
||||
}
|
||||
|
||||
{
|
||||
auto* box = new wxStaticBox(panel, wxID_ANY, _("MLC Path"));
|
||||
auto* box_sizer = new wxStaticBoxSizer(box, wxHORIZONTAL);
|
||||
auto* outerMlcBox = new wxStaticBox(panel, wxID_ANY, _("Custom MLC path"));
|
||||
|
||||
m_mlc_path = new wxTextCtrl(box, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
||||
auto* box_sizer_mlc = new wxStaticBoxSizer(outerMlcBox, wxVERTICAL);
|
||||
box_sizer_mlc->Add(new wxStaticText(box_sizer_mlc->GetStaticBox(), wxID_ANY, _("You can configure a custom path for the emulated internal Wii U storage (MLC).\nThis is where Cemu stores saves, accounts and other Wii U system files."), wxDefaultPosition, wxDefaultSize, 0), 0, wxALL, 5);
|
||||
|
||||
auto* mlcPathLineSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_mlc_path = new wxTextCtrl(outerMlcBox, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
||||
m_mlc_path->SetMinSize(wxSize(150, -1));
|
||||
m_mlc_path->Bind(wxEVT_CHAR, &GeneralSettings2::OnMLCPathChar, this);
|
||||
m_mlc_path->SetToolTip(_("The mlc directory contains your save games and installed game update/dlc data"));
|
||||
|
||||
box_sizer->Add(m_mlc_path, 1, wxALL | wxEXPAND, 5);
|
||||
mlcPathLineSizer->Add(m_mlc_path, 1, wxALL | wxEXPAND, 5);
|
||||
|
||||
auto* change_path = new wxButton(box, wxID_ANY, "...");
|
||||
change_path->Bind(wxEVT_BUTTON, &GeneralSettings2::OnMLCPathSelect, this);
|
||||
change_path->SetToolTip(_("Select a custom mlc path\nThe mlc path is used to store Wii U related files like save games, game updates and dlc data"));
|
||||
box_sizer->Add(change_path, 0, wxALL, 5);
|
||||
auto* changePath = new wxButton(outerMlcBox, wxID_ANY, "Change");
|
||||
changePath->Bind(wxEVT_BUTTON, &GeneralSettings2::OnMLCPathSelect, this);
|
||||
mlcPathLineSizer->Add(changePath, 0, wxALL, 5);
|
||||
if (LaunchSettings::GetMLCPath().has_value())
|
||||
change_path->Disable();
|
||||
general_panel_sizer->Add(box_sizer, 0, wxEXPAND | wxALL, 5);
|
||||
changePath->Disable();
|
||||
|
||||
auto* clearPath = new wxButton(outerMlcBox, wxID_ANY, "Clear custom path");
|
||||
clearPath->Bind(wxEVT_BUTTON, &GeneralSettings2::OnMLCPathClear, this);
|
||||
mlcPathLineSizer->Add(clearPath, 0, wxALL, 5);
|
||||
if (LaunchSettings::GetMLCPath().has_value() || !ActiveSettings::IsCustomMlcPath())
|
||||
clearPath->Disable();
|
||||
|
||||
box_sizer_mlc->Add(mlcPathLineSizer, 0, wxEXPAND, 5);
|
||||
general_panel_sizer->Add(box_sizer_mlc, 0, wxEXPAND | wxALL, 5);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -897,39 +902,12 @@ void GeneralSettings2::StoreConfig()
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
config.feral_gamemode = m_feral_gamemode->IsChecked();
|
||||
#endif
|
||||
const bool use_ps = m_permanent_storage->IsChecked();
|
||||
if(use_ps)
|
||||
{
|
||||
config.permanent_storage = use_ps;
|
||||
try
|
||||
{
|
||||
|
||||
PermanentStorage storage;
|
||||
storage.RemoveStorage();
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// delete permanent storage
|
||||
PermanentStorage storage;
|
||||
storage.RemoveStorage();
|
||||
}
|
||||
catch (...) {}
|
||||
config.permanent_storage = use_ps;
|
||||
}
|
||||
|
||||
config.disable_screensaver = m_disable_screensaver->IsChecked();
|
||||
// Toggle while a game is running
|
||||
if (CafeSystem::IsTitleRunning())
|
||||
{
|
||||
ScreenSaver::SetInhibit(config.disable_screensaver);
|
||||
}
|
||||
|
||||
if (!LaunchSettings::GetMLCPath().has_value())
|
||||
config.SetMLCPath(wxHelper::MakeFSPath(m_mlc_path->GetValue()), false);
|
||||
|
||||
// -1 is default wx widget value -> set to dummy 0 so mainwindow and padwindow will update it
|
||||
config.window_position = m_save_window_position_size->IsChecked() ? Vector2i{ 0,0 } : Vector2i{-1,-1};
|
||||
@@ -1560,7 +1538,6 @@ void GeneralSettings2::ApplyConfig()
|
||||
m_auto_update->SetValue(config.check_update);
|
||||
m_save_screenshot->SetValue(config.save_screenshot);
|
||||
|
||||
m_permanent_storage->SetValue(config.permanent_storage);
|
||||
m_disable_screensaver->SetValue(config.disable_screensaver);
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
m_feral_gamemode->SetValue(config.feral_gamemode);
|
||||
@@ -1570,6 +1547,7 @@ void GeneralSettings2::ApplyConfig()
|
||||
m_disable_screensaver->SetValue(false);
|
||||
#endif
|
||||
|
||||
m_game_paths->Clear();
|
||||
for (auto& path : config.game_paths)
|
||||
{
|
||||
m_game_paths->Append(to_wxString(path));
|
||||
@@ -1985,34 +1963,70 @@ void GeneralSettings2::OnAccountServiceChanged(wxCommandEvent& event)
|
||||
|
||||
void GeneralSettings2::OnMLCPathSelect(wxCommandEvent& event)
|
||||
{
|
||||
if (!CemuApp::SelectMLCPath(this))
|
||||
if(CafeSystem::IsTitleRunning())
|
||||
{
|
||||
wxMessageBox(_("Can't change MLC path while a game is running!"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||
return;
|
||||
|
||||
m_mlc_path->SetValue(wxHelper::FromPath(ActiveSettings::GetMlcPath()));
|
||||
m_reload_gamelist = true;
|
||||
m_mlc_modified = true;
|
||||
}
|
||||
// show directory dialog
|
||||
wxDirDialog path_dialog(this, _("Select MLC directory"), wxEmptyString, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
||||
if (path_dialog.ShowModal() != wxID_OK || path_dialog.GetPath().empty())
|
||||
return;
|
||||
// check if the choosen MLC path is an already initialized MLC location
|
||||
fs::path newMlc = wxHelper::MakeFSPath(path_dialog.GetPath());
|
||||
if(CemuApp::CheckMLCPath(newMlc))
|
||||
{
|
||||
// ask user if they are sure they want to use this folder and let them know that accounts and saves wont transfer
|
||||
wxString message = _("Note that changing the MLC location will not transfer any accounts or save files. Are you sure you want to change the path?");
|
||||
wxMessageDialog dialog(this, message, _("Warning"), wxYES_NO | wxCENTRE | wxICON_WARNING);
|
||||
if(dialog.ShowModal() == wxID_NO)
|
||||
return;
|
||||
if( !CemuApp::CreateDefaultMLCFiles(newMlc) ) // creating also acts as a check for read+write access
|
||||
{
|
||||
wxMessageBox(_("Failed to create default MLC files in the selected directory. The MLC path has not been changed"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ask user if they want to create a new mlc structure at the choosen location
|
||||
wxString message = _("The selected directory does not contain the expected MLC structure. Do you want to create a new MLC structure in this directory?\nNote that changing the MLC location will not transfer any accounts or save files.");
|
||||
wxMessageDialog dialog(this, message, _("Warning"), wxYES_NO | wxCENTRE | wxICON_WARNING);
|
||||
if( !CemuApp::CreateDefaultMLCFiles(newMlc) )
|
||||
{
|
||||
wxMessageBox(_("Failed to create default MLC files in the selected directory. The MLC path has not been changed"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// update MLC path and store any other modified settings
|
||||
GetConfig().SetMLCPath(newMlc);
|
||||
StoreConfig();
|
||||
wxMessageBox(_("Cemu needs to be restarted for the changes to take effect."), _("Information"), wxOK | wxCENTRE | wxICON_INFORMATION, this);
|
||||
// close settings and then cemu
|
||||
wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW);
|
||||
wxPostEvent(this, closeEvent);
|
||||
wxPostEvent(GetParent(), closeEvent);
|
||||
}
|
||||
|
||||
void GeneralSettings2::OnMLCPathChar(wxKeyEvent& event)
|
||||
void GeneralSettings2::OnMLCPathClear(wxCommandEvent& event)
|
||||
{
|
||||
if (LaunchSettings::GetMLCPath().has_value())
|
||||
return;
|
||||
|
||||
if(event.GetKeyCode() == WXK_DELETE || event.GetKeyCode() == WXK_BACK)
|
||||
if(CafeSystem::IsTitleRunning())
|
||||
{
|
||||
fs::path newPath = "";
|
||||
if(!CemuApp::TrySelectMLCPath(newPath))
|
||||
{
|
||||
const auto res = wxMessageBox(_("The default MLC path is inaccessible.\nDo you want to select a different path?"), _("Error"), wxYES_NO | wxCENTRE | wxICON_ERROR);
|
||||
if (res == wxYES && CemuApp::SelectMLCPath(this))
|
||||
newPath = ActiveSettings::GetMlcPath();
|
||||
else
|
||||
return;
|
||||
}
|
||||
m_mlc_path->SetValue(wxHelper::FromPath(newPath));
|
||||
m_reload_gamelist = true;
|
||||
m_mlc_modified = true;
|
||||
wxMessageBox(_("Can't change MLC path while a game is running!"), _("Error"), wxOK | wxCENTRE | wxICON_ERROR, this);
|
||||
return;
|
||||
}
|
||||
wxString message = _("Note that changing the MLC location will not transfer any accounts or save files. Are you sure you want to change the path?");
|
||||
wxMessageDialog dialog(this, message, _("Warning"), wxYES_NO | wxCENTRE | wxICON_WARNING);
|
||||
if(dialog.ShowModal() == wxID_NO)
|
||||
return;
|
||||
GetConfig().SetMLCPath("");
|
||||
StoreConfig();
|
||||
g_config.Save();
|
||||
wxMessageBox(_("Cemu needs to be restarted for the changes to take effect."), _("Information"), wxOK | wxCENTRE | wxICON_INFORMATION, this);
|
||||
// close settings and then cemu
|
||||
wxCloseEvent closeEvent(wxEVT_CLOSE_WINDOW);
|
||||
wxPostEvent(this, closeEvent);
|
||||
wxPostEvent(GetParent(), closeEvent);
|
||||
}
|
||||
|
||||
void GeneralSettings2::OnShowOnlineValidator(wxCommandEvent& event)
|
||||
|
||||
@@ -42,7 +42,6 @@ private:
|
||||
wxCheckBox* m_save_padwindow_position_size;
|
||||
wxCheckBox* m_discord_presence, *m_fullscreen_menubar;
|
||||
wxCheckBox* m_auto_update, *m_save_screenshot;
|
||||
wxCheckBox* m_permanent_storage;
|
||||
wxCheckBox* m_disable_screensaver;
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
wxCheckBox* m_feral_gamemode;
|
||||
@@ -96,7 +95,7 @@ private:
|
||||
void OnRemovePathClicked(wxCommandEvent& event);
|
||||
void OnActiveAccountChanged(wxCommandEvent& event);
|
||||
void OnMLCPathSelect(wxCommandEvent& event);
|
||||
void OnMLCPathChar(wxKeyEvent& event);
|
||||
void OnMLCPathClear(wxCommandEvent& event);
|
||||
void OnShowOnlineValidator(wxCommandEvent& event);
|
||||
void OnAccountServiceChanged(wxCommandEvent& event);
|
||||
static wxString GetOnlineAccountErrorMessage(OnlineAccountError error);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/radiobox.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "gui/CemuApp.h"
|
||||
@@ -11,7 +12,6 @@
|
||||
#include "gui/GraphicPacksWindow2.h"
|
||||
#include "gui/input/InputSettings2.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "config/PermanentConfig.h"
|
||||
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
|
||||
@@ -21,75 +21,100 @@
|
||||
|
||||
#include "wxHelper.h"
|
||||
|
||||
wxDEFINE_EVENT(EVT_REFRESH_FIRST_PAGE, wxCommandEvent); // used to refresh the first page after the language change
|
||||
|
||||
wxPanel* GettingStartedDialog::CreatePage1()
|
||||
{
|
||||
auto* result = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
auto* mainPanel = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
auto* page1_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
{
|
||||
auto* sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
sizer->Add(new wxStaticBitmap(result, wxID_ANY, wxICON(M_WND_ICON128)), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
|
||||
auto* m_staticText11 = new wxStaticText(result, wxID_ANY, _("It looks like you're starting Cemu for the first time.\nThis quick setup assistant will help you get the best experience"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_staticText11->Wrap(-1);
|
||||
sizer->Add(m_staticText11, 0, wxALL, 5);
|
||||
|
||||
sizer->Add(new wxStaticBitmap(mainPanel, wxID_ANY, wxICON(M_WND_ICON128)), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
m_page1.staticText11 = new wxStaticText(mainPanel, wxID_ANY, _("It looks like you're starting Cemu for the first time.\nThis quick setup assistant will help you get the best experience"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_page1.staticText11->Wrap(-1);
|
||||
sizer->Add(m_page1.staticText11, 0, wxALL, 5);
|
||||
page1_sizer->Add(sizer, 0, wxALL | wxEXPAND, 5);
|
||||
}
|
||||
|
||||
if(ActiveSettings::IsPortableMode())
|
||||
{
|
||||
m_mlc_box_sizer = new wxStaticBoxSizer(wxVERTICAL, result, _("mlc01 path"));
|
||||
m_mlc_box_sizer->Add(new wxStaticText(m_mlc_box_sizer->GetStaticBox(), wxID_ANY, _("The mlc path is the root folder of the emulated Wii U internal flash storage. It contains all your saves, installed updates and DLCs.\nIt is strongly recommend that you create a dedicated folder for it (example: C:\\wiiu\\mlc\\) \nIf left empty, the mlc folder will be created inside the Cemu folder.")), 0, wxALL, 5);
|
||||
m_page1.portableModeInfoText = new wxStaticText(mainPanel, wxID_ANY, _("Cemu is running in portable mode"));
|
||||
m_page1.portableModeInfoText->Show(true);
|
||||
page1_sizer->Add(m_page1.portableModeInfoText, 0, wxALL, 5);
|
||||
|
||||
m_prev_mlc_warning = new wxStaticText(m_mlc_box_sizer->GetStaticBox(), wxID_ANY, _("A custom mlc path from a previous Cemu installation has been found and filled in."));
|
||||
m_prev_mlc_warning->SetForegroundColour(*wxRED);
|
||||
m_prev_mlc_warning->Show(false);
|
||||
m_mlc_box_sizer->Add(m_prev_mlc_warning, 0, wxALL, 5);
|
||||
|
||||
auto* mlc_path_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
mlc_path_sizer->Add(new wxStaticText(m_mlc_box_sizer->GetStaticBox(), wxID_ANY, _("Custom mlc01 path")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
|
||||
// workaround since we can't specify our own browse label? >> _("Browse")
|
||||
m_mlc_folder = new wxDirPickerCtrl(m_mlc_box_sizer->GetStaticBox(), wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE);
|
||||
auto tTest1 = m_mlc_folder->GetTextCtrl();
|
||||
if(m_mlc_folder->HasTextCtrl())
|
||||
{
|
||||
m_mlc_folder->GetTextCtrl()->SetEditable(false);
|
||||
m_mlc_folder->GetTextCtrl()->Bind(wxEVT_CHAR, &GettingStartedDialog::OnMLCPathChar, this);
|
||||
}
|
||||
mlc_path_sizer->Add(m_mlc_folder, 1, wxALL, 5);
|
||||
|
||||
mlc_path_sizer->Add(new wxStaticText(m_mlc_box_sizer->GetStaticBox(), wxID_ANY, _("(optional)")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
|
||||
m_mlc_box_sizer->Add(mlc_path_sizer, 0, wxEXPAND, 5);
|
||||
|
||||
page1_sizer->Add(m_mlc_box_sizer, 0, wxALL | wxEXPAND, 5);
|
||||
}
|
||||
|
||||
// language selection
|
||||
#if 0
|
||||
{
|
||||
auto* sizer = new wxStaticBoxSizer(wxVERTICAL, result, _("Game paths"));
|
||||
m_page1.languageBoxSizer = new wxStaticBoxSizer(wxVERTICAL, mainPanel, _("Language"));
|
||||
m_page1.languageText = new wxStaticText(m_page1.languageBoxSizer->GetStaticBox(), wxID_ANY, _("Select the language you want to use in Cemu"));
|
||||
m_page1.languageBoxSizer->Add(m_page1.languageText, 0, wxALL, 5);
|
||||
|
||||
sizer->Add(new wxStaticText(sizer->GetStaticBox(), wxID_ANY, _("The game path is scanned by Cemu to locate your games. We recommend creating a dedicated directory in which\nyou place all your Wii U games. (example: C:\\wiiu\\games\\)\n\nYou can also set additional paths in the general settings of Cemu.")), 0, wxALL, 5);
|
||||
wxString language_choices[] = { _("Default") };
|
||||
wxChoice* m_language = new wxChoice(m_page1.languageBoxSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, std::size(language_choices), language_choices);
|
||||
m_language->SetSelection(0);
|
||||
|
||||
for (const auto& language : wxGetApp().GetLanguages())
|
||||
{
|
||||
m_language->Append(language->DescriptionNative);
|
||||
}
|
||||
|
||||
m_language->SetSelection(0);
|
||||
m_page1.languageBoxSizer->Add(m_language, 0, wxALL | wxEXPAND, 5);
|
||||
|
||||
page1_sizer->Add(m_page1.languageBoxSizer, 0, wxALL | wxEXPAND, 5);
|
||||
|
||||
m_language->Bind(wxEVT_CHOICE, [this, m_language](const auto&)
|
||||
{
|
||||
const auto language = m_language->GetStringSelection();
|
||||
auto selection = m_language->GetSelection();
|
||||
if (selection == 0)
|
||||
GetConfig().language = wxLANGUAGE_DEFAULT;
|
||||
else
|
||||
{
|
||||
auto* app = (CemuApp*)wxTheApp;
|
||||
const auto language = m_language->GetStringSelection();
|
||||
for (const auto& lang : app->GetLanguages())
|
||||
{
|
||||
if (lang->DescriptionNative == language)
|
||||
{
|
||||
app->LocalizeUI(static_cast<wxLanguage>(lang->Language));
|
||||
wxCommandEvent event(EVT_REFRESH_FIRST_PAGE);
|
||||
wxPostEvent(this, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
m_page1.gamePathBoxSizer = new wxStaticBoxSizer(wxVERTICAL, mainPanel, _("Game paths"));
|
||||
m_page1.gamePathText = new wxStaticText(m_page1.gamePathBoxSizer->GetStaticBox(), wxID_ANY, _("The game path is scanned by Cemu to automatically locate your games, game updates and DLCs. We recommend creating a dedicated directory in which\nyou place all your Wii U game files. Additional paths can be set later in Cemu's general settings. All common Wii U game formats are supported by Cemu."));
|
||||
m_page1.gamePathBoxSizer->Add(m_page1.gamePathText, 0, wxALL, 5);
|
||||
|
||||
auto* game_path_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
game_path_sizer->Add(new wxStaticText(sizer->GetStaticBox(), wxID_ANY, _("Game path")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
m_page1.gamePathText2 = new wxStaticText(m_page1.gamePathBoxSizer->GetStaticBox(), wxID_ANY, _("Game path"));
|
||||
game_path_sizer->Add(m_page1.gamePathText2, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
|
||||
m_game_path = new wxDirPickerCtrl(sizer->GetStaticBox(), wxID_ANY, wxEmptyString, _("Select a folder"));
|
||||
game_path_sizer->Add(m_game_path, 1, wxALL, 5);
|
||||
m_page1.gamePathPicker = new wxDirPickerCtrl(m_page1.gamePathBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, _("Select a folder"));
|
||||
game_path_sizer->Add(m_page1.gamePathPicker, 1, wxALL, 5);
|
||||
|
||||
sizer->Add(game_path_sizer, 0, wxEXPAND, 5);
|
||||
m_page1.gamePathBoxSizer->Add(game_path_sizer, 0, wxEXPAND, 5);
|
||||
|
||||
page1_sizer->Add(sizer, 0, wxALL | wxEXPAND, 5);
|
||||
page1_sizer->Add(m_page1.gamePathBoxSizer, 0, wxALL | wxEXPAND, 5);
|
||||
}
|
||||
|
||||
{
|
||||
auto* sizer = new wxStaticBoxSizer(wxVERTICAL, result, _("Graphic packs"));
|
||||
auto* sizer = new wxStaticBoxSizer(wxVERTICAL, mainPanel, _("Graphic packs && mods"));
|
||||
|
||||
sizer->Add(new wxStaticText(sizer->GetStaticBox(), wxID_ANY, _("Graphic packs improve games by offering the possibility to change resolution, tweak FPS or add other visual or gameplay modifications.\nDownload the community graphic packs to get started.\n")), 0, wxALL, 5);
|
||||
sizer->Add(new wxStaticText(sizer->GetStaticBox(), wxID_ANY, _("Graphic packs improve games by offering the ability to change resolution, increase FPS, tweak visuals or add gameplay modifications.\nGet started by opening the graphic packs configuration window.\n")), 0, wxALL, 5);
|
||||
|
||||
auto* download_gp = new wxButton(sizer->GetStaticBox(), wxID_ANY, _("Download community graphic packs"));
|
||||
download_gp->Bind(wxEVT_BUTTON, &GettingStartedDialog::OnDownloadGPs, this);
|
||||
auto* download_gp = new wxButton(sizer->GetStaticBox(), wxID_ANY, _("Download and configure graphic packs"));
|
||||
download_gp->Bind(wxEVT_BUTTON, &GettingStartedDialog::OnConfigureGPs, this);
|
||||
sizer->Add(download_gp, 0, wxALIGN_CENTER | wxALL, 5);
|
||||
|
||||
page1_sizer->Add(sizer, 0, wxALL | wxEXPAND, 5);
|
||||
@@ -102,16 +127,15 @@ wxPanel* GettingStartedDialog::CreatePage1()
|
||||
sizer->SetFlexibleDirection(wxBOTH);
|
||||
sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_ALL);
|
||||
|
||||
auto* next = new wxButton(result, wxID_ANY, _("Next"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
auto* next = new wxButton(mainPanel, wxID_ANY, _("Next"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
next->Bind(wxEVT_BUTTON, [this](const auto&){m_notebook->SetSelection(1); });
|
||||
sizer->Add(next, 0, wxALIGN_BOTTOM | wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
page1_sizer->Add(sizer, 1, wxEXPAND, 5);
|
||||
}
|
||||
|
||||
|
||||
result->SetSizer(page1_sizer);
|
||||
return result;
|
||||
mainPanel->SetSizer(page1_sizer);
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
wxPanel* GettingStartedDialog::CreatePage2()
|
||||
@@ -138,17 +162,17 @@ wxPanel* GettingStartedDialog::CreatePage2()
|
||||
option_sizer->SetFlexibleDirection(wxBOTH);
|
||||
option_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||
|
||||
m_fullscreen = new wxCheckBox(sizer->GetStaticBox(), wxID_ANY, _("Start games with fullscreen"));
|
||||
option_sizer->Add(m_fullscreen, 0, wxALL, 5);
|
||||
m_page2.fullscreenCheckbox = new wxCheckBox(sizer->GetStaticBox(), wxID_ANY, _("Start games with fullscreen"));
|
||||
option_sizer->Add(m_page2.fullscreenCheckbox, 0, wxALL, 5);
|
||||
|
||||
m_separate = new wxCheckBox(sizer->GetStaticBox(), wxID_ANY, _("Open separate pad screen"));
|
||||
option_sizer->Add(m_separate, 0, wxALL, 5);
|
||||
m_page2.separateCheckbox = new wxCheckBox(sizer->GetStaticBox(), wxID_ANY, _("Open separate pad screen"));
|
||||
option_sizer->Add(m_page2.separateCheckbox, 0, wxALL, 5);
|
||||
|
||||
m_update = new wxCheckBox(sizer->GetStaticBox(), wxID_ANY, _("Automatically check for updates"));
|
||||
option_sizer->Add(m_update, 0, wxALL, 5);
|
||||
m_page2.updateCheckbox = new wxCheckBox(sizer->GetStaticBox(), wxID_ANY, _("Automatically check for updates"));
|
||||
option_sizer->Add(m_page2.updateCheckbox, 0, wxALL, 5);
|
||||
#if BOOST_OS_LINUX
|
||||
if (!std::getenv("APPIMAGE")) {
|
||||
m_update->Disable();
|
||||
m_page2.updateCheckbox->Disable();
|
||||
}
|
||||
#endif
|
||||
sizer->Add(option_sizer, 1, wxEXPAND, 5);
|
||||
@@ -162,10 +186,6 @@ wxPanel* GettingStartedDialog::CreatePage2()
|
||||
sizer->SetFlexibleDirection(wxBOTH);
|
||||
sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_ALL);
|
||||
|
||||
m_dont_show = new wxCheckBox(result, wxID_ANY, _("Don't show this again"));
|
||||
m_dont_show->SetValue(true);
|
||||
sizer->Add(m_dont_show, 0, wxALIGN_BOTTOM | wxALL, 5);
|
||||
|
||||
auto* previous = new wxButton(result, wxID_ANY, _("Previous"));
|
||||
previous->Bind(wxEVT_BUTTON, [this](const auto&) {m_notebook->SetSelection(0); });
|
||||
sizer->Add(previous, 0, wxALIGN_BOTTOM | wxALIGN_RIGHT | wxALL, 5);
|
||||
@@ -184,23 +204,9 @@ wxPanel* GettingStartedDialog::CreatePage2()
|
||||
void GettingStartedDialog::ApplySettings()
|
||||
{
|
||||
auto& config = GetConfig();
|
||||
m_fullscreen->SetValue(config.fullscreen.GetValue());
|
||||
m_update->SetValue(config.check_update.GetValue());
|
||||
m_separate->SetValue(config.pad_open.GetValue());
|
||||
m_dont_show->SetValue(true); // we want it always enabled by default
|
||||
m_mlc_folder->SetPath(config.mlc_path.GetValue());
|
||||
|
||||
try
|
||||
{
|
||||
const auto pconfig = PermanentConfig::Load();
|
||||
if(!pconfig.custom_mlc_path.empty())
|
||||
{
|
||||
m_mlc_folder->SetPath(wxString::FromUTF8(pconfig.custom_mlc_path));
|
||||
m_prev_mlc_warning->Show(true);
|
||||
}
|
||||
}
|
||||
catch (const PSDisabledException&) {}
|
||||
catch (...) {}
|
||||
m_page2.fullscreenCheckbox->SetValue(config.fullscreen.GetValue());
|
||||
m_page2.updateCheckbox->SetValue(config.check_update.GetValue());
|
||||
m_page2.separateCheckbox->SetValue(config.pad_open.GetValue());
|
||||
}
|
||||
|
||||
void GettingStartedDialog::UpdateWindowSize()
|
||||
@@ -219,46 +225,25 @@ void GettingStartedDialog::OnClose(wxCloseEvent& event)
|
||||
event.Skip();
|
||||
|
||||
auto& config = GetConfig();
|
||||
config.fullscreen = m_fullscreen->GetValue();
|
||||
config.check_update = m_update->GetValue();
|
||||
config.pad_open = m_separate->GetValue();
|
||||
config.did_show_graphic_pack_download = m_dont_show->GetValue();
|
||||
config.fullscreen = m_page2.fullscreenCheckbox->GetValue();
|
||||
config.check_update = m_page2.updateCheckbox->GetValue();
|
||||
config.pad_open = m_page2.separateCheckbox->GetValue();
|
||||
|
||||
const fs::path gamePath = wxHelper::MakeFSPath(m_game_path->GetPath());
|
||||
if (!gamePath.empty() && fs::exists(gamePath))
|
||||
const fs::path gamePath = wxHelper::MakeFSPath(m_page1.gamePathPicker->GetPath());
|
||||
std::error_code ec;
|
||||
if (!gamePath.empty() && fs::exists(gamePath, ec))
|
||||
{
|
||||
const auto it = std::find(config.game_paths.cbegin(), config.game_paths.cend(), gamePath);
|
||||
if (it == config.game_paths.cend())
|
||||
{
|
||||
config.game_paths.emplace_back(_pathToUtf8(gamePath));
|
||||
m_game_path_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
const fs::path mlcPath = wxHelper::MakeFSPath(m_mlc_folder->GetPath());
|
||||
if(config.mlc_path.GetValue() != mlcPath && (mlcPath.empty() || fs::exists(mlcPath)))
|
||||
{
|
||||
config.SetMLCPath(mlcPath, false);
|
||||
m_mlc_changed = true;
|
||||
}
|
||||
|
||||
g_config.Save();
|
||||
|
||||
if(m_mlc_changed)
|
||||
CemuApp::CreateDefaultFiles();
|
||||
|
||||
CafeTitleList::ClearScanPaths();
|
||||
for (auto& it : GetConfig().game_paths)
|
||||
CafeTitleList::AddScanPath(_utf8ToPath(it));
|
||||
CafeTitleList::Refresh();
|
||||
}
|
||||
|
||||
|
||||
GettingStartedDialog::GettingStartedDialog(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, _("Getting started"), wxDefaultPosition, { 740,530 }, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
{
|
||||
//this->SetSizeHints(wxDefaultSize, { 740,530 });
|
||||
|
||||
auto* sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_notebook = new wxSimplebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
|
||||
@@ -274,24 +259,18 @@ GettingStartedDialog::GettingStartedDialog(wxWindow* parent)
|
||||
this->SetSizer(sizer);
|
||||
this->Centre(wxBOTH);
|
||||
this->Bind(wxEVT_CLOSE_WINDOW, &GettingStartedDialog::OnClose, this);
|
||||
|
||||
|
||||
ApplySettings();
|
||||
UpdateWindowSize();
|
||||
}
|
||||
|
||||
void GettingStartedDialog::OnDownloadGPs(wxCommandEvent& event)
|
||||
void GettingStartedDialog::OnConfigureGPs(wxCommandEvent& event)
|
||||
{
|
||||
DownloadGraphicPacksWindow dialog(this);
|
||||
dialog.ShowModal();
|
||||
|
||||
GraphicPacksWindow2::RefreshGraphicPacks();
|
||||
|
||||
wxMessageDialog ask_dialog(this, _("Do you want to view the downloaded graphic packs?"), _("Graphic packs"), wxCENTRE | wxYES_NO);
|
||||
if (ask_dialog.ShowModal() == wxID_YES)
|
||||
{
|
||||
GraphicPacksWindow2 window(this, 0);
|
||||
window.ShowModal();
|
||||
}
|
||||
GraphicPacksWindow2 window(this, 0);
|
||||
window.ShowModal();
|
||||
}
|
||||
|
||||
void GettingStartedDialog::OnInputSettings(wxCommandEvent& event)
|
||||
@@ -299,20 +278,3 @@ void GettingStartedDialog::OnInputSettings(wxCommandEvent& event)
|
||||
InputSettings2 dialog(this);
|
||||
dialog.ShowModal();
|
||||
}
|
||||
|
||||
void GettingStartedDialog::OnMLCPathChar(wxKeyEvent& event)
|
||||
{
|
||||
//if (LaunchSettings::GetMLCPath().has_value())
|
||||
// return;
|
||||
|
||||
if (event.GetKeyCode() == WXK_DELETE || event.GetKeyCode() == WXK_BACK)
|
||||
{
|
||||
m_mlc_folder->GetTextCtrl()->SetValue(wxEmptyString);
|
||||
if(m_prev_mlc_warning->IsShown())
|
||||
{
|
||||
m_prev_mlc_warning->Show(false);
|
||||
UpdateWindowSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,6 @@ class GettingStartedDialog : public wxDialog
|
||||
public:
|
||||
GettingStartedDialog(wxWindow* parent = nullptr);
|
||||
|
||||
[[nodiscard]] bool HasGamePathChanged() const { return m_game_path_changed; }
|
||||
[[nodiscard]] bool HasMLCChanged() const { return m_mlc_changed; }
|
||||
|
||||
private:
|
||||
wxPanel* CreatePage1();
|
||||
wxPanel* CreatePage2();
|
||||
@@ -23,22 +20,29 @@ private:
|
||||
void UpdateWindowSize();
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnDownloadGPs(wxCommandEvent& event);
|
||||
void OnConfigureGPs(wxCommandEvent& event);
|
||||
void OnInputSettings(wxCommandEvent& event);
|
||||
void OnMLCPathChar(wxKeyEvent& event);
|
||||
|
||||
wxSimplebook* m_notebook;
|
||||
wxCheckBox* m_fullscreen;
|
||||
wxCheckBox* m_separate;
|
||||
wxCheckBox* m_update;
|
||||
wxCheckBox* m_dont_show;
|
||||
|
||||
wxStaticBoxSizer* m_mlc_box_sizer;
|
||||
wxStaticText* m_prev_mlc_warning;
|
||||
wxDirPickerCtrl* m_mlc_folder;
|
||||
wxDirPickerCtrl* m_game_path;
|
||||
struct
|
||||
{
|
||||
// header
|
||||
wxStaticText* staticText11{};
|
||||
wxStaticText* portableModeInfoText{};
|
||||
|
||||
bool m_game_path_changed = false;
|
||||
bool m_mlc_changed = false;
|
||||
// game path box
|
||||
wxStaticBoxSizer* gamePathBoxSizer{};
|
||||
wxStaticText* gamePathText{};
|
||||
wxStaticText* gamePathText2{};
|
||||
wxDirPickerCtrl* gamePathPicker{};
|
||||
}m_page1;
|
||||
|
||||
struct
|
||||
{
|
||||
wxCheckBox* fullscreenCheckbox;
|
||||
wxCheckBox* separateCheckbox;
|
||||
wxCheckBox* updateCheckbox;
|
||||
}m_page2;
|
||||
};
|
||||
|
||||
|
||||
+1
-29
@@ -149,8 +149,6 @@ enum
|
||||
// help
|
||||
MAINFRAME_MENU_ID_HELP_ABOUT = 21700,
|
||||
MAINFRAME_MENU_ID_HELP_UPDATE,
|
||||
MAINFRAME_MENU_ID_HELP_GETTING_STARTED,
|
||||
|
||||
// custom
|
||||
MAINFRAME_ID_TIMER1 = 21800,
|
||||
};
|
||||
@@ -225,7 +223,6 @@ EVT_MENU(MAINFRAME_MENU_ID_DEBUG_VIEW_TEXTURE_RELATIONS, MainWindow::OnDebugView
|
||||
// help menu
|
||||
EVT_MENU(MAINFRAME_MENU_ID_HELP_ABOUT, MainWindow::OnHelpAbout)
|
||||
EVT_MENU(MAINFRAME_MENU_ID_HELP_UPDATE, MainWindow::OnHelpUpdate)
|
||||
EVT_MENU(MAINFRAME_MENU_ID_HELP_GETTING_STARTED, MainWindow::OnHelpGettingStarted)
|
||||
// misc
|
||||
EVT_COMMAND(wxID_ANY, wxEVT_REQUEST_GAMELIST_REFRESH, MainWindow::OnRequestGameListRefresh)
|
||||
|
||||
@@ -418,25 +415,6 @@ wxString MainWindow::GetInitialWindowTitle()
|
||||
return BUILD_VERSION_WITH_NAME_STRING;
|
||||
}
|
||||
|
||||
void MainWindow::ShowGettingStartedDialog()
|
||||
{
|
||||
GettingStartedDialog dia(this);
|
||||
dia.ShowModal();
|
||||
if (dia.HasGamePathChanged() || dia.HasMLCChanged())
|
||||
m_game_list->ReloadGameEntries();
|
||||
|
||||
TogglePadView();
|
||||
|
||||
auto& config = GetConfig();
|
||||
m_padViewMenuItem->Check(config.pad_open.GetValue());
|
||||
m_fullscreenMenuItem->Check(config.fullscreen.GetValue());
|
||||
}
|
||||
|
||||
namespace coreinit
|
||||
{
|
||||
void OSSchedulerEnd();
|
||||
};
|
||||
|
||||
void MainWindow::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
wxTheClipboard->Flush();
|
||||
@@ -2075,11 +2053,6 @@ void MainWindow::OnHelpUpdate(wxCommandEvent& event)
|
||||
test.ShowModal();
|
||||
}
|
||||
|
||||
void MainWindow::OnHelpGettingStarted(wxCommandEvent& event)
|
||||
{
|
||||
ShowGettingStartedDialog();
|
||||
}
|
||||
|
||||
void MainWindow::RecreateMenu()
|
||||
{
|
||||
if (m_menuBar)
|
||||
@@ -2303,8 +2276,7 @@ void MainWindow::RecreateMenu()
|
||||
if (!std::getenv("APPIMAGE")) {
|
||||
m_check_update_menu->Enable(false);
|
||||
}
|
||||
#endif
|
||||
helpMenu->Append(MAINFRAME_MENU_ID_HELP_GETTING_STARTED, _("&Getting started"));
|
||||
#endif
|
||||
helpMenu->AppendSeparator();
|
||||
helpMenu->Append(MAINFRAME_MENU_ID_HELP_ABOUT, _("&About Cemu"));
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ public:
|
||||
void OnAccountSelect(wxCommandEvent& event);
|
||||
void OnConsoleLanguage(wxCommandEvent& event);
|
||||
void OnHelpAbout(wxCommandEvent& event);
|
||||
void OnHelpGettingStarted(wxCommandEvent& event);
|
||||
void OnHelpUpdate(wxCommandEvent& event);
|
||||
void OnDebugSetting(wxCommandEvent& event);
|
||||
void OnDebugLoggingToggleFlagGeneric(wxCommandEvent& event);
|
||||
@@ -150,7 +149,6 @@ private:
|
||||
void RecreateMenu();
|
||||
void UpdateChildWindowTitleRunningState();
|
||||
static wxString GetInitialWindowTitle();
|
||||
void ShowGettingStartedDialog();
|
||||
|
||||
bool InstallUpdate(const fs::path& metaFilePath);
|
||||
|
||||
|
||||
+1
-13
@@ -5,7 +5,6 @@
|
||||
#include "Cafe/OS/RPL/rpl.h"
|
||||
#include "Cafe/OS/libs/gx2/GX2.h"
|
||||
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
|
||||
#include "Cafe/HW/Latte/Core/LatteOverlay.h"
|
||||
#include "Cafe/GameProfile/GameProfile.h"
|
||||
#include "Cafe/GraphicPack/GraphicPack2.h"
|
||||
#include "config/CemuConfig.h"
|
||||
@@ -160,7 +159,7 @@ void ExpressionParser_test();
|
||||
void FSTVolumeTest();
|
||||
void CRCTest();
|
||||
|
||||
void unitTests()
|
||||
void UnitTests()
|
||||
{
|
||||
ExpressionParser_test();
|
||||
gx2CopySurfaceTest();
|
||||
@@ -169,17 +168,6 @@ void unitTests()
|
||||
CRCTest();
|
||||
}
|
||||
|
||||
int mainEmulatorHLE()
|
||||
{
|
||||
LatteOverlay_init();
|
||||
// run a couple of tests if in non-release mode
|
||||
#ifdef CEMU_DEBUG_ASSERT
|
||||
unitTests();
|
||||
#endif
|
||||
CemuCommonInit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool isConsoleConnected = false;
|
||||
void requireConsole()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user