mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Remove wxMessageBoxes from non-gui code
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "Cafe/OS/common/OSCommon.h"
|
||||
#include "gui/wxgui.h"
|
||||
#include "Cafe/OS/libs/gx2/GX2.h"
|
||||
#include "Cafe/GameProfile/GameProfile.h"
|
||||
#include "Cafe/HW/Espresso/Interpreter/PPCInterpreterInternal.h"
|
||||
@@ -163,7 +162,7 @@ void LoadMainExecutable()
|
||||
applicationRPX = rpl_loadFromMem(rpxData, rpxSize, (char*)_pathToExecutable.c_str());
|
||||
if (!applicationRPX)
|
||||
{
|
||||
wxMessageBox(_("Failed to run this title because the executable is damaged"));
|
||||
cemuLog_log(LogType::Force, "Failed to run this title because the executable is damaged");
|
||||
cemuLog_createLogFile(false);
|
||||
cemuLog_waitForFlush();
|
||||
exit(0);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <wx/msgdlg.h>
|
||||
#include <mutex>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
@@ -74,7 +73,7 @@ void KeyCache_Prepare()
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox("Unable to create file keys.txt\nThis can happen if Cemu does not have write permission to it's own directory, the disk is full or if anti-virus software is blocking Cemu.", "Error", wxOK | wxCENTRE | wxICON_ERROR);
|
||||
cemuLog_log(LogType::Force, "Unable to create file keys.txt\nThis can happen if Cemu does not have write permission to it's own directory, the disk is full or if anti-virus software is blocking Cemu.");
|
||||
}
|
||||
mtxKeyCache.unlock();
|
||||
return;
|
||||
@@ -107,10 +106,7 @@ void KeyCache_Prepare()
|
||||
continue;
|
||||
if( strishex(line) == false )
|
||||
{
|
||||
// show error message
|
||||
char errorMsg[512];
|
||||
sprintf(errorMsg, "Error in keys.txt in line %d\n", lineNumber);
|
||||
wxMessageBox(errorMsg, "Error", wxOK | wxCENTRE | wxICON_ERROR);
|
||||
cemuLog_log(LogType::Force, "rror in keys.txt in line {}", lineNumber);
|
||||
continue;
|
||||
}
|
||||
if(line.size() == 32 )
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||
#include "boost/algorithm/string.hpp"
|
||||
|
||||
#include "gui/wxgui.h" // for wxMessageBox
|
||||
|
||||
// error handler
|
||||
void PatchErrorHandler::printError(class PatchGroup* patchGroup, sint32 lineNumber, std::string_view errorMsg)
|
||||
{
|
||||
@@ -60,8 +58,7 @@ void PatchErrorHandler::showStageErrorMessageBox()
|
||||
errorMsg.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
wxMessageBox(errorMsg, "Graphic pack error");
|
||||
cemuLog_log(LogType::Force, "Graphic pack error: {}", errorMsg);
|
||||
}
|
||||
|
||||
// loads Cemu-style patches (patch_<anything>.asm)
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "Cafe/HW/Latte/Common/ShaderSerializer.h"
|
||||
#include "util/helpers/Serializer.h"
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
#include <psapi.h>
|
||||
#endif
|
||||
@@ -66,8 +64,6 @@ void LatteShaderCache_loadVulkanPipelineCache(uint64 cacheTitleId);
|
||||
bool LatteShaderCache_updatePipelineLoadingProgress();
|
||||
void LatteShaderCache_ShowProgress(const std::function <bool(void)>& loadUpdateFunc, bool isPipelines);
|
||||
|
||||
void LatteShaderCache_handleDeprecatedCacheFiles(fs::path pathGeneric, fs::path pathGenericPre1_25_0, fs::path pathGenericPre1_16_0);
|
||||
|
||||
struct
|
||||
{
|
||||
struct
|
||||
@@ -245,10 +241,7 @@ void LatteShaderCache_load()
|
||||
RendererShaderGL::ShaderCacheLoading_begin(cacheTitleId);
|
||||
// get cache file name
|
||||
const auto pathGeneric = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}_shaders.bin", cacheTitleId);
|
||||
const auto pathGenericPre1_25_0 = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}.bin", cacheTitleId); // before 1.25.0
|
||||
const auto pathGenericPre1_16_0 = ActiveSettings::GetCachePath("shaderCache/transferable/{:08x}.bin", CafeSystem::GetRPXHashBase()); // before 1.16.0
|
||||
|
||||
LatteShaderCache_handleDeprecatedCacheFiles(pathGeneric, pathGenericPre1_25_0, pathGenericPre1_16_0);
|
||||
// calculate extraVersion for transferable and precompiled shader cache
|
||||
uint32 transferableExtraVersion = SHADER_CACHE_GENERIC_EXTRA_VERSION;
|
||||
fc_shaderCacheGeneric = FileCache::Open(pathGeneric.generic_wstring(), false, transferableExtraVersion); // legacy extra version (1.25.0 - 1.25.1b)
|
||||
@@ -758,31 +751,3 @@ bool LatteShaderCache_readSeparableShader(uint8* shaderInfoData, sint32 shaderIn
|
||||
return LatteShaderCache_readSeparablePixelShader(streamReader, version);
|
||||
return false;
|
||||
}
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
void LatteShaderCache_handleDeprecatedCacheFiles(fs::path pathGeneric, fs::path pathGenericPre1_25_0, fs::path pathGenericPre1_16_0)
|
||||
{
|
||||
std::error_code ec;
|
||||
|
||||
bool hasOldCacheFiles = fs::exists(pathGenericPre1_25_0, ec) || fs::exists(pathGenericPre1_16_0, ec);
|
||||
bool hasNewCacheFiles = fs::exists(pathGeneric, ec);
|
||||
|
||||
if (hasOldCacheFiles && !hasNewCacheFiles)
|
||||
{
|
||||
// ask user if they want to delete or keep the old cache file
|
||||
const auto infoMsg = L"Outdated shader cache\n\nCemu detected that the shader cache for this game is outdated\nOnly shader caches generated with Cemu 1.25.0 or above are supported\n\n"
|
||||
"We recommend deleting the outdated cache file as it will no longer be used by Cemu";
|
||||
|
||||
wxMessageDialog dialog(nullptr, _(infoMsg), _("Outdated shader cache"),
|
||||
wxYES_NO | wxCENTRE | wxICON_EXCLAMATION);
|
||||
|
||||
dialog.SetYesNoLabels(_("Delete outdated cache file [recommended]"), _("Keep outdated cache file"));
|
||||
const auto result = dialog.ShowModal();
|
||||
if (result == wxID_YES)
|
||||
{
|
||||
fs::remove(pathGenericPre1_16_0, ec);
|
||||
fs::remove(pathGenericPre1_25_0, ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
#include <glslang/Include/Types.h>
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#ifndef VK_API_VERSION_MAJOR
|
||||
#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22) & 0x7FU)
|
||||
#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU)
|
||||
@@ -281,12 +279,8 @@ void VulkanRenderer::GetDeviceFeatures()
|
||||
cemuLog_log(LogType::Force, "Shader round mode control not available on this device or driver. Some rendering issues might occur.");
|
||||
|
||||
if (!m_featureControl.deviceExtensions.pipeline_creation_cache_control)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "VK_EXT_pipeline_creation_cache_control not supported. Cannot use asynchronous shader and pipeline compilation");
|
||||
// if async shader compilation is enabled show warning message
|
||||
if (GetConfig().async_compile)
|
||||
wxMessageBox(_("The currently installed graphics driver does not support the Vulkan extension necessary for asynchronous shader compilation. Asynchronous compilation cannot be used.\n \nRequired extension: VK_EXT_pipeline_creation_cache_control\n\nInstalling the latest graphics driver may solve this error."), _("Information"), wxOK | wxCENTRE);
|
||||
}
|
||||
|
||||
if (!m_featureControl.deviceExtensions.custom_border_color_without_format)
|
||||
{
|
||||
if (m_featureControl.deviceExtensions.custom_border_color)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "Cafe/HW/MMU/MMU.h"
|
||||
#include "Cafe/GraphicPack/GraphicPack2.h"
|
||||
#include "util/MemMapper/MemMapper.h"
|
||||
#include <wx/msgdlg.h>
|
||||
#include "config/ActiveSettings.h"
|
||||
|
||||
uint8* memory_base = NULL; // base address of the reserved 4GB space
|
||||
@@ -90,8 +89,7 @@ void MMURange::mapMem()
|
||||
cemu_assert_debug(!m_isMapped);
|
||||
if (MemMapper::AllocateMemory(memory_base + baseAddress, size, MemMapper::PAGE_PERMISSION::P_RW, true) == nullptr)
|
||||
{
|
||||
std::string errorMsg = fmt::format("Unable to allocate {} memory", name);
|
||||
wxMessageBox(errorMsg.c_str(), "Error", wxOK | wxCENTRE | wxICON_ERROR);
|
||||
cemuLog_log(LogType::Force, "Unable to allocate {} memory", name);
|
||||
#if BOOST_OS_WINDOWS
|
||||
ExitProcess(-1);
|
||||
#else
|
||||
@@ -131,9 +129,8 @@ void memory_init()
|
||||
memory_base = (uint8*)MemMapper::ReserveMemory(nullptr, (size_t)0x100000000, MemMapper::PAGE_PERMISSION::P_RW);
|
||||
if( !memory_base )
|
||||
{
|
||||
debug_printf("memory_init(): Unable to reserve 4GB of memory\n");
|
||||
debugBreakpoint();
|
||||
wxMessageBox("Unable to reserve 4GB of memory\n", "Error", wxOK | wxCENTRE | wxICON_ERROR);
|
||||
cemuLog_log(LogType::Force, "Unable to reserve 4GB of memory");
|
||||
exit(-1);
|
||||
}
|
||||
for (auto& itr : g_mmuRanges)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "Cafe/OS/common/OSCommon.h"
|
||||
#include "gui/wxgui.h"
|
||||
#include "nn_save.h"
|
||||
|
||||
#include "Cafe/OS/libs/nn_acp/nn_acp.h"
|
||||
@@ -203,79 +202,6 @@ namespace save
|
||||
return ConvertACPToSaveStatus(status);
|
||||
}
|
||||
|
||||
void _CheckAndMoveLegacySaves()
|
||||
{
|
||||
const uint64 titleId = CafeSystem::GetForegroundTitleId();
|
||||
|
||||
fs::path targetPath, sourcePath;
|
||||
try
|
||||
{
|
||||
bool copiedUser = false, copiedCommon = false;
|
||||
|
||||
const auto sourceSavePath = ActiveSettings::GetMlcPath("emulatorSave/{:08x}", CafeSystem::GetRPXHashBase());
|
||||
sourcePath = sourceSavePath;
|
||||
|
||||
if (fs::exists(sourceSavePath) && is_directory(sourceSavePath))
|
||||
{
|
||||
targetPath = ActiveSettings::GetMlcPath("usr/save/{:08x}/{:08x}/user/{:08x}", GetTitleIdHigh(titleId), GetTitleIdLow(titleId), 0x80000001);
|
||||
fs::create_directories(targetPath);
|
||||
copy(sourceSavePath, targetPath, fs::copy_options::overwrite_existing | fs::copy_options::recursive);
|
||||
copiedUser = true;
|
||||
}
|
||||
|
||||
const auto sourceCommonPath = ActiveSettings::GetMlcPath("emulatorSave/{:08x}_255", CafeSystem::GetRPXHashBase());
|
||||
sourcePath = sourceCommonPath;
|
||||
|
||||
if (fs::exists(sourceCommonPath) && is_directory(sourceCommonPath))
|
||||
{
|
||||
targetPath = ActiveSettings::GetMlcPath("usr/save/{:08x}/{:08x}/user/common", GetTitleIdHigh(titleId), GetTitleIdLow(titleId));
|
||||
fs::create_directories(targetPath);
|
||||
copy(sourceCommonPath, targetPath, fs::copy_options::overwrite_existing | fs::copy_options::recursive);
|
||||
copiedCommon = true;
|
||||
}
|
||||
|
||||
if (copiedUser)
|
||||
fs::remove_all(sourceSavePath);
|
||||
|
||||
if (copiedCommon)
|
||||
fs::remove_all(sourceCommonPath);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
std::wstringstream errorMsg;
|
||||
errorMsg << L"Couldn't move your save files!" << std::endl << std::endl;
|
||||
errorMsg << L"Error: " << ex.what() << std::endl << std::endl;
|
||||
errorMsg << L"From:" << std::endl << sourcePath << std::endl << std::endl << "To:" << std::endl << targetPath;
|
||||
|
||||
const DWORD lastError = GetLastError();
|
||||
if (lastError != ERROR_SUCCESS)
|
||||
{
|
||||
LPTSTR lpMsgBuf = nullptr;
|
||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, lastError, 0, (LPTSTR)&lpMsgBuf, 0, nullptr);
|
||||
if (lpMsgBuf)
|
||||
{
|
||||
errorMsg << std::endl << std::endl << L"Details: " << lpMsgBuf;
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMsg << std::endl << std::endl << L"Error Code: 0x" << std::hex << lastError;
|
||||
}
|
||||
}
|
||||
|
||||
errorMsg << std::endl << std::endl << "Continuing will create a new save at the target location." << std::endl << "Do you want to continue?";
|
||||
|
||||
int result = wxMessageBox(errorMsg.str(), "Save Migration - Error", wxCENTRE | wxYES_NO | wxICON_ERROR);
|
||||
if (result != wxYES)
|
||||
{
|
||||
exit(0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
SAVEStatus SAVEInit()
|
||||
{
|
||||
const uint64 titleId = CafeSystem::GetForegroundTitleId();
|
||||
@@ -295,8 +221,6 @@ namespace save
|
||||
SAVEMountSaveDir();
|
||||
g_nn_save->initialized = true;
|
||||
|
||||
_CheckAndMoveLegacySaves();
|
||||
|
||||
uint32 high = GetTitleIdHigh(titleId) & (~0xC);
|
||||
uint32 low = GetTitleIdLow(titleId);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "Cafe/OS/libs/coreinit/coreinit.h"
|
||||
|
||||
#include "boost/program_options.hpp"
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
@@ -196,10 +195,7 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::string errorMsg;
|
||||
errorMsg.append("Error while trying to parse command line parameter:\n");
|
||||
errorMsg.append(ex.what());
|
||||
wxMessageBox(errorMsg, wxT("Parameter error"), wxICON_ERROR);
|
||||
cemuLog_log(LogType::Force, "Error while trying to parse command line parameter: {}", ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user