From ff9d180154699ed991e0fbda380c7f8db88e92de Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Sun, 1 Oct 2023 11:43:24 +0200 Subject: [PATCH] Code cleanup --- CMakeSettings.json | 2 +- src/Cafe/CafeSystem.cpp | 7 --- src/Cafe/GamePatch.cpp | 2 +- src/Cafe/HW/Espresso/Debugger/Debugger.cpp | 6 +- src/Cafe/HW/Espresso/Debugger/GDBStub.cpp | 4 +- src/Cafe/HW/Latte/Core/LatteConst.h | 24 +++++--- src/Cafe/HW/Latte/Core/LatteTextureLegacy.cpp | 8 +-- .../LatteDecompilerAnalyzer.cpp | 8 +-- .../HW/Latte/Renderer/Vulkan/CachedFBOVk.h | 4 -- .../Renderer/Vulkan/VulkanRendererCore.cpp | 12 ++-- src/Cafe/IOSU/legacy/iosu_ioctl.cpp | 3 +- src/Cafe/OS/libs/coreinit/coreinit.cpp | 6 +- src/Cafe/OS/libs/coreinit/coreinit.h | 9 +-- src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp | 1 - src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp | 48 +++++++--------- src/Cafe/OS/libs/coreinit/coreinit_Thread.h | 5 +- src/Cafe/OS/libs/gx2/GX2.h | 5 -- src/Cafe/OS/libs/nlibcurl/nlibcurl.cpp | 4 +- src/Cafe/OS/libs/nn_act/nn_act.cpp | 1 - src/Cafe/OS/libs/nn_save/nn_save.cpp | 55 +++++++++++-------- src/Cafe/OS/libs/nsysnet/nsysnet.cpp | 2 +- src/gui/MainWindow.cpp | 12 +--- src/gui/TitleManager.h | 1 - src/gui/components/wxTitleManagerList.h | 3 +- src/gui/debugger/DisasmCtrl.cpp | 2 +- src/gui/guiWrapper.h | 2 - 26 files changed, 105 insertions(+), 131 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index 3097caab..0927e98b 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -14,7 +14,7 @@ "generator": "Ninja", "inheritEnvironments": [ "msvc_x64_x64" ], "buildRoot": "${projectDir}\\out\\build\\${name}", - "installRoot": "${projectDir}\\out\\install\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}" }, { "name": "Debug", diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index dd761f6e..668def01 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -254,13 +254,6 @@ void InfoLog_PrintActiveSettings() cemuLog_log(LogType::Force, "Console language: {}", config.console_language); } -void PPCCore_setupSPR(PPCInterpreter_t* hCPU, uint32 coreIndex) -{ - hCPU->sprExtended.PVR = 0x70010001; - hCPU->spr.UPIR = coreIndex; - hCPU->sprExtended.msr |= MSR_FP; // enable floating point -} - struct SharedDataEntry { /* +0x00 */ uint32be name; diff --git a/src/Cafe/GamePatch.cpp b/src/Cafe/GamePatch.cpp index 84bfcb21..77eaff32 100644 --- a/src/Cafe/GamePatch.cpp +++ b/src/Cafe/GamePatch.cpp @@ -52,7 +52,7 @@ typedef struct void hleExport_xcx_enterCriticalSection(PPCInterpreter_t* hCPU) { ppcDefineParamStructPtr(xcxCS, xcxCS_t, 0); - uint32 threadId = coreinitThread_getCurrentThreadMPTRDepr(hCPU); + uint32 threadId = MEMPTR(coreinit::OSGetCurrentThread()).GetMPTR(); cemu_assert_debug(xcxCS->ukn08 != 0); cemu_assert_debug(threadId); if (xcxCS->ownerThreadId == (uint32be)threadId) diff --git a/src/Cafe/HW/Espresso/Debugger/Debugger.cpp b/src/Cafe/HW/Espresso/Debugger/Debugger.cpp index e99ce522..62a5d592 100644 --- a/src/Cafe/HW/Espresso/Debugger/Debugger.cpp +++ b/src/Cafe/HW/Espresso/Debugger/Debugger.cpp @@ -513,10 +513,10 @@ void debugger_enterTW(PPCInterpreter_t* hCPU) if (bp->bpType == DEBUGGER_BP_T_LOGGING && bp->enabled) { std::string logName = !bp->comment.empty() ? "Breakpoint '"+boost::nowide::narrow(bp->comment)+"'" : fmt::format("Breakpoint at 0x{:08X} (no comment)", bp->address); - std::string logContext = fmt::format("Thread: {:08x} LR: 0x{:08x}", coreinitThread_getCurrentThreadMPTRDepr(hCPU), hCPU->spr.LR, cemuLog_advancedPPCLoggingEnabled() ? " Stack Trace:" : ""); + std::string logContext = fmt::format("Thread: {:08x} LR: 0x{:08x}", MEMPTR(coreinit::OSGetCurrentThread()).GetMPTR(), hCPU->spr.LR, cemuLog_advancedPPCLoggingEnabled() ? " Stack Trace:" : ""); cemuLog_log(LogType::Force, "[Debugger] {} was executed! {}", logName, logContext); if (cemuLog_advancedPPCLoggingEnabled()) - DebugLogStackTrace(coreinitThread_getCurrentThreadDepr(hCPU), hCPU->gpr[1]); + DebugLogStackTrace(coreinit::OSGetCurrentThread(), hCPU->gpr[1]); break; } bp = bp->next; @@ -535,7 +535,7 @@ void debugger_enterTW(PPCInterpreter_t* hCPU) // handle breakpoints debuggerState.debugSession.isTrapped = true; - debuggerState.debugSession.debuggedThreadMPTR = coreinitThread_getCurrentThreadMPTRDepr(hCPU); + debuggerState.debugSession.debuggedThreadMPTR = MEMPTR(coreinit::OSGetCurrentThread()).GetMPTR(); debuggerState.debugSession.instructionPointer = hCPU->instructionPointer; debuggerState.debugSession.hCPU = hCPU; debugger_createPPCStateSnapshot(hCPU); diff --git a/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp b/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp index b7e15407..e934e55d 100644 --- a/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp +++ b/src/Cafe/HW/Espresso/Debugger/GDBStub.cpp @@ -900,7 +900,7 @@ void GDBServer::HandleTrapInstruction(PPCInterpreter_t* hCPU) return cemu_assert_suspicious(); // Secondly, delete one-shot breakpoints but also temporarily delete patched instruction to run original instruction - OSThread_t* currThread = coreinitThread_getCurrentThreadDepr(hCPU); + OSThread_t* currThread = coreinit::OSGetCurrentThread(); std::string pauseReason = fmt::format("T05thread:{:08X};core:{:02X};{}", GET_THREAD_ID(currThread), PPCInterpreter_getCoreIndex(hCPU), patchedBP->second.GetReason()); bool pauseThreads = patchedBP->second.ShouldBreakThreads() || patchedBP->second.ShouldBreakThreadsOnNextInterrupt(); if (patchedBP->second.IsPersistent()) @@ -939,7 +939,7 @@ void GDBServer::HandleTrapInstruction(PPCInterpreter_t* hCPU) ThreadPool::FireAndForget(&waitForBrokenThreads, std::move(m_resumed_context), pauseReason); } - breakThreads(GET_THREAD_ID(coreinitThread_getCurrentThreadDepr(hCPU))); + breakThreads(GET_THREAD_ID(coreinit::OSGetCurrentThread())); cemuLog_logDebug(LogType::Force, "[GDBStub] Resumed from a breakpoint!"); } } diff --git a/src/Cafe/HW/Latte/Core/LatteConst.h b/src/Cafe/HW/Latte/Core/LatteConst.h index ffbead1c..04c7b888 100644 --- a/src/Cafe/HW/Latte/Core/LatteConst.h +++ b/src/Cafe/HW/Latte/Core/LatteConst.h @@ -1,21 +1,27 @@ #pragma once #include "Cafe/HW/Latte/ISA/LatteReg.h" -// this file contains legacy C-style defines, modernize and merge into LatteReg.h +// todo - this file contains legacy C-style defines, modernize and merge into LatteReg.h // GPU7/Latte hardware info -#define LATTE_NUM_GPR (128) -#define LATTE_NUM_STREAMOUT_BUFFER (4) -#define LATTE_NUM_COLOR_TARGET (8) +#define LATTE_NUM_GPR 128 +#define LATTE_NUM_STREAMOUT_BUFFER 4 +#define LATTE_NUM_COLOR_TARGET 8 -#define LATTE_NUM_MAX_TEX_UNITS (18) // number of available texture units per shader stage (this might be higher than 18? BotW is the only game which uses more than 16?) -#define LATTE_NUM_MAX_UNIFORM_BUFFERS (16) // number of supported uniform buffer binding locations +#define LATTE_NUM_MAX_TEX_UNITS 18 // number of available texture units per shader stage (this might be higher than 18? BotW is the only game which uses more than 16?) +#define LATTE_NUM_MAX_UNIFORM_BUFFERS 16 // number of supported uniform buffer binding locations -#define LATTE_VS_ATTRIBUTE_LIMIT (32) // todo: verify -#define LATTE_NUM_MAX_ATTRIBUTE_LOCATIONS (256) // should this be 128 since there are only 128 GPRs? +#define LATTE_VS_ATTRIBUTE_LIMIT 32 // todo: verify +#define LATTE_NUM_MAX_ATTRIBUTE_LOCATIONS 256 // should this be 128 since there are only 128 GPRs? -#define LATTE_MAX_VERTEX_BUFFERS (16) +#define LATTE_MAX_VERTEX_BUFFERS 16 + +// Cemu-specific constants + +#define LATTE_CEMU_PS_TEX_UNIT_BASE 0 +#define LATTE_CEMU_VS_TEX_UNIT_BASE 32 +#define LATTE_CEMU_GS_TEX_UNIT_BASE 64 // vertex formats diff --git a/src/Cafe/HW/Latte/Core/LatteTextureLegacy.cpp b/src/Cafe/HW/Latte/Core/LatteTextureLegacy.cpp index 1bf17c51..9cce2526 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureLegacy.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTextureLegacy.cpp @@ -1,10 +1,8 @@ #include "Cafe/HW/Latte/ISA/RegDefines.h" -#include "Cafe/OS/libs/gx2/GX2.h" // todo - remove this dependency #include "Cafe/HW/Latte/Core/Latte.h" #include "Cafe/HW/Latte/Core/LatteShader.h" #include "Cafe/HW/Latte/Renderer/Renderer.h" -#include "Cafe/GraphicPack/GraphicPack2.h" #include "Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.h" #include "Cafe/HW/Latte/Renderer/OpenGL/LatteTextureGL.h" @@ -330,15 +328,15 @@ void LatteTexture_updateTextures() // pixel shader LatteDecompilerShader* pixelShader = LatteSHRC_GetActivePixelShader(); if (pixelShader) - LatteTexture_updateTexturesForStage(pixelShader, CEMU_PS_TEX_UNIT_BASE, LatteGPUState.contextNew.SQ_TEX_START_PS); + LatteTexture_updateTexturesForStage(pixelShader, LATTE_CEMU_PS_TEX_UNIT_BASE, LatteGPUState.contextNew.SQ_TEX_START_PS); // vertex shader LatteDecompilerShader* vertexShader = LatteSHRC_GetActiveVertexShader(); cemu_assert_debug(vertexShader != nullptr); - LatteTexture_updateTexturesForStage(vertexShader, CEMU_VS_TEX_UNIT_BASE, LatteGPUState.contextNew.SQ_TEX_START_VS); + LatteTexture_updateTexturesForStage(vertexShader, LATTE_CEMU_VS_TEX_UNIT_BASE, LatteGPUState.contextNew.SQ_TEX_START_VS); // geometry shader LatteDecompilerShader* geometryShader = LatteSHRC_GetActiveGeometryShader(); if (geometryShader) - LatteTexture_updateTexturesForStage(geometryShader, CEMU_GS_TEX_UNIT_BASE, LatteGPUState.contextNew.SQ_TEX_START_GS); + LatteTexture_updateTexturesForStage(geometryShader, LATTE_CEMU_GS_TEX_UNIT_BASE, LatteGPUState.contextNew.SQ_TEX_START_GS); } // returns the width, height, depth of the texture diff --git a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp index 7285d312..2e837198 100644 --- a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp +++ b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp @@ -1,9 +1,7 @@ #include "Cafe/HW/Latte/Core/LatteConst.h" #include "Cafe/HW/Latte/Core/LatteShaderAssembly.h" #include "Cafe/HW/Latte/ISA/RegDefines.h" -#include "Cafe/OS/libs/gx2/GX2.h" // todo - remove this dependency #include "Cafe/HW/Latte/Core/Latte.h" -#include "Cafe/HW/Latte/Core/LatteDraw.h" #include "Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompiler.h" #include "Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerInternal.h" #include "Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerInstructions.h" @@ -477,11 +475,11 @@ namespace LatteDecompiler continue; sint32 textureBindingPoint; if (decompilerContext->shaderType == LatteConst::ShaderType::Vertex) - textureBindingPoint = i + CEMU_VS_TEX_UNIT_BASE; + textureBindingPoint = i + LATTE_CEMU_VS_TEX_UNIT_BASE; else if (decompilerContext->shaderType == LatteConst::ShaderType::Geometry) - textureBindingPoint = i + CEMU_GS_TEX_UNIT_BASE; + textureBindingPoint = i + LATTE_CEMU_GS_TEX_UNIT_BASE; else if (decompilerContext->shaderType == LatteConst::ShaderType::Pixel) - textureBindingPoint = i + CEMU_PS_TEX_UNIT_BASE; + textureBindingPoint = i + LATTE_CEMU_PS_TEX_UNIT_BASE; decompilerContext->output->resourceMappingGL.textureUnitToBindingPoint[i] = textureBindingPoint; } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/CachedFBOVk.h b/src/Cafe/HW/Latte/Renderer/Vulkan/CachedFBOVk.h index 4e6be012..bf72996e 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/CachedFBOVk.h +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/CachedFBOVk.h @@ -75,10 +75,6 @@ private: VkRenderingAttachmentInfoKHR m_vkColorAttachments[8]; VkRenderingAttachmentInfoKHR m_vkDepthAttachment; VkRenderingAttachmentInfoKHR m_vkStencilAttachment; - //uint8 m_vkColorAttachmentsCount{0}; - bool m_vkHasDepthAttachment{ false }; - bool m_vkHasStencilAttachment{ false }; - std::vector m_usedByPipelines; // PipelineInfo objects which use this renderpass/framebuffer }; diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp index 8b0e3b63..320357f1 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp @@ -513,15 +513,15 @@ uint64 VulkanRenderer::GetDescriptorSetStateHash(LatteDecompilerShader* shader) switch (shader->shaderType) { case LatteConst::ShaderType::Vertex: - hostTextureUnit += CEMU_VS_TEX_UNIT_BASE; + hostTextureUnit += LATTE_CEMU_VS_TEX_UNIT_BASE; texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_VS; break; case LatteConst::ShaderType::Pixel: - hostTextureUnit += CEMU_PS_TEX_UNIT_BASE; + hostTextureUnit += LATTE_CEMU_PS_TEX_UNIT_BASE; texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_PS; break; case LatteConst::ShaderType::Geometry: - hostTextureUnit += CEMU_GS_TEX_UNIT_BASE; + hostTextureUnit += LATTE_CEMU_GS_TEX_UNIT_BASE; texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_GS; break; default: @@ -631,15 +631,15 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo* switch (shader->shaderType) { case LatteConst::ShaderType::Vertex: - hostTextureUnit += CEMU_VS_TEX_UNIT_BASE; + hostTextureUnit += LATTE_CEMU_VS_TEX_UNIT_BASE; texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_VS; break; case LatteConst::ShaderType::Pixel: - hostTextureUnit += CEMU_PS_TEX_UNIT_BASE; + hostTextureUnit += LATTE_CEMU_PS_TEX_UNIT_BASE; texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_PS; break; case LatteConst::ShaderType::Geometry: - hostTextureUnit += CEMU_GS_TEX_UNIT_BASE; + hostTextureUnit += LATTE_CEMU_GS_TEX_UNIT_BASE; texUnitRegIndex += Latte::REGADDR::SQ_TEX_RESOURCE_WORD0_N_GS; break; default: diff --git a/src/Cafe/IOSU/legacy/iosu_ioctl.cpp b/src/Cafe/IOSU/legacy/iosu_ioctl.cpp index 1fc2a27a..22e5a55d 100644 --- a/src/Cafe/IOSU/legacy/iosu_ioctl.cpp +++ b/src/Cafe/IOSU/legacy/iosu_ioctl.cpp @@ -1,6 +1,5 @@ #include "Cafe/OS/common/OSCommon.h" #include "Cafe/OS/libs/coreinit/coreinit_Thread.h" -#include "Cafe/OS/libs/coreinit/coreinit.h" #include "iosu_ioctl.h" #include "util/helpers/ringbuffer.h" @@ -23,7 +22,7 @@ sint32 iosuIoctl_pushAndWait(uint32 ioctlHandle, ioQueueEntry_t* ioQueueEntry) } __OSLockScheduler(); ioctlMutex.lock(); - ioQueueEntry->ppcThread = coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()); + ioQueueEntry->ppcThread = coreinit::OSGetCurrentThread(); _ioctlRingbuffer[ioctlHandle].Push(ioQueueEntry); ioctlMutex.unlock(); diff --git a/src/Cafe/OS/libs/coreinit/coreinit.cpp b/src/Cafe/OS/libs/coreinit/coreinit.cpp index 8738e3a4..660f874f 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit.cpp @@ -35,7 +35,7 @@ #include "Cafe/OS/libs/coreinit/coreinit_MEM_BlockHeap.h" #include "Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.h" -coreinitData_t* gCoreinitData = NULL; +CoreinitSharedData* gCoreinitData = NULL; sint32 ScoreStackTrace(OSThread_t* thread, MPTR sp) { @@ -323,8 +323,8 @@ void coreinit_load() coreinit::InitializeSysHeap(); // allocate coreinit global data - gCoreinitData = (coreinitData_t*)memory_getPointerFromVirtualOffset(coreinit_allocFromSysArea(sizeof(coreinitData_t), 32)); - memset(gCoreinitData, 0x00, sizeof(coreinitData_t)); + gCoreinitData = (CoreinitSharedData*)memory_getPointerFromVirtualOffset(coreinit_allocFromSysArea(sizeof(CoreinitSharedData), 32)); + memset(gCoreinitData, 0x00, sizeof(CoreinitSharedData)); // coreinit weak links osLib_addVirtualPointer("coreinit", "MEMAllocFromDefaultHeap", memory_getVirtualOffsetFromPointer(&gCoreinitData->MEMAllocFromDefaultHeap)); diff --git a/src/Cafe/OS/libs/coreinit/coreinit.h b/src/Cafe/OS/libs/coreinit/coreinit.h index 046ffe1e..74aab9b2 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit.h +++ b/src/Cafe/OS/libs/coreinit/coreinit.h @@ -16,8 +16,7 @@ void coreinitAsyncCallback_addWithLock(MPTR functionMPTR, uint32 numParameters, void coreinit_load(); // coreinit shared memory - -typedef struct +struct CoreinitSharedData { MEMPTR MEMAllocFromDefaultHeap; MEMPTR MEMAllocFromDefaultHeapEx; @@ -26,11 +25,9 @@ typedef struct MPTR __cpp_exception_init_ptr; MPTR __cpp_exception_cleanup_ptr; MPTR __stdio_cleanup; -}coreinitData_t; +}; -extern coreinitData_t* gCoreinitData; - -#include "Cafe/OS/libs/coreinit/coreinit_Spinlock.h" +extern CoreinitSharedData* gCoreinitData; // coreinit init void coreinit_start(PPCInterpreter_t* hCPU); diff --git a/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp b/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp index b348218f..14d7a645 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp @@ -71,7 +71,6 @@ sint32 MCP_GetSysProdSettings(MCPHANDLE mcpHandle, SysProdSettings* sysProdSetti void coreinitExport_MCP_GetSysProdSettings(PPCInterpreter_t* hCPU) { - cemuLog_logDebug(LogType::Force, "MCP_GetSysProdSettings(0x{:08x},0x{:08x})", hCPU->gpr[3], hCPU->gpr[4]); sint32 result = MCP_GetSysProdSettings(hCPU->gpr[3], (SysProdSettings*)memory_getPointerFromVirtualOffset(hCPU->gpr[4])); osLib_returnFromFunction(hCPU, result); } diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp index 71e5d493..d9b33dca 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp @@ -198,7 +198,7 @@ namespace coreinit void threadEntry(PPCInterpreter_t* hCPU) { - OSThread_t* currentThread = coreinitThread_getCurrentThreadDepr(hCPU); + OSThread_t* currentThread = coreinit::OSGetCurrentThread(); uint32 r3 = hCPU->gpr[3]; uint32 r4 = hCPU->gpr[4]; uint32 lr = hCPU->spr.LR; @@ -368,39 +368,38 @@ namespace coreinit { PPCInterpreter_t* hCPU = PPCInterpreter_getCurrentInstance(); hCPU->gpr[3] = exitValue; - OSThread_t* threadBE = coreinitThread_getCurrentThreadDepr(hCPU); - MPTR t = memory_getVirtualOffsetFromPointer(threadBE); + OSThread_t* currentThread = coreinit::OSGetCurrentThread(); // thread cleanup callback - if (!threadBE->cleanupCallback2.IsNull()) + if (!currentThread->cleanupCallback2.IsNull()) { - threadBE->stateFlags = _swapEndianU32(_swapEndianU32(threadBE->stateFlags) | 0x00000001); - PPCCoreCallback(threadBE->cleanupCallback2.GetMPTR(), threadBE, _swapEndianU32(threadBE->stackEnd)); + currentThread->stateFlags = _swapEndianU32(_swapEndianU32(currentThread->stateFlags) | 0x00000001); + PPCCoreCallback(currentThread->cleanupCallback2.GetMPTR(), currentThread, _swapEndianU32(currentThread->stackEnd)); } // cpp exception cleanup - if (gCoreinitData->__cpp_exception_cleanup_ptr != 0 && threadBE->crt.eh_globals != nullptr) + if (gCoreinitData->__cpp_exception_cleanup_ptr != 0 && currentThread->crt.eh_globals != nullptr) { - PPCCoreCallback(_swapEndianU32(gCoreinitData->__cpp_exception_cleanup_ptr), &threadBE->crt.eh_globals); - threadBE->crt.eh_globals = nullptr; + PPCCoreCallback(_swapEndianU32(gCoreinitData->__cpp_exception_cleanup_ptr), ¤tThread->crt.eh_globals); + currentThread->crt.eh_globals = nullptr; } // set exit code - threadBE->exitValue = exitValue; + currentThread->exitValue = exitValue; __OSLockScheduler(); // release held synchronization primitives - if (!threadBE->mutexQueue.isEmpty()) + if (!currentThread->mutexQueue.isEmpty()) { cemuLog_log(LogType::Force, "OSExitThread: Thread is holding mutexes"); while (true) { - OSMutex* mutex = threadBE->mutexQueue.getFirst(); + OSMutex* mutex = currentThread->mutexQueue.getFirst(); if (!mutex) break; - if (mutex->owner != threadBE) + if (mutex->owner != currentThread) { cemuLog_log(LogType::Force, "OSExitThread: Thread is holding mutex which it doesn't own"); - threadBE->mutexQueue.removeMutex(mutex); + currentThread->mutexQueue.removeMutex(mutex); continue; } coreinit::OSUnlockMutexInternal(mutex); @@ -409,22 +408,22 @@ namespace coreinit // todo - release all fast mutexes // handle join queue - if (!threadBE->joinQueue.isEmpty()) - threadBE->joinQueue.wakeupEntireWaitQueue(false); + if (!currentThread->joinQueue.isEmpty()) + currentThread->joinQueue.wakeupEntireWaitQueue(false); - if ((threadBE->attr & 8) != 0) + if ((currentThread->attr & 8) != 0) { // deactivate thread since it is detached - threadBE->state = OSThread_t::THREAD_STATE::STATE_NONE; - coreinit::__OSDeactivateThread(threadBE); + currentThread->state = OSThread_t::THREAD_STATE::STATE_NONE; + coreinit::__OSDeactivateThread(currentThread); // queue call to thread deallocator if set - if (!threadBE->deallocatorFunc.IsNull()) - __OSQueueThreadDeallocation(threadBE); + if (!currentThread->deallocatorFunc.IsNull()) + __OSQueueThreadDeallocation(currentThread); } else { // non-detached threads remain active - threadBE->state = OSThread_t::THREAD_STATE::STATE_MORIBUND; + currentThread->state = OSThread_t::THREAD_STATE::STATE_MORIBUND; } PPCCore_switchToSchedulerWithLock(); } @@ -1401,11 +1400,6 @@ void coreinit_resumeThread(OSThread_t* OSThreadBE, sint32 count) __OSUnlockScheduler(); } -MPTR coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_t* hCPU) -{ - return memory_getVirtualOffsetFromPointer(coreinit::__currentCoreThread[PPCInterpreter_getCoreIndex(hCPU)]); -} - OSThread_t* coreinitThread_getCurrentThreadDepr(PPCInterpreter_t* hCPU) { return coreinit::__currentCoreThread[PPCInterpreter_getCoreIndex(hCPU)]; diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Thread.h b/src/Cafe/OS/libs/coreinit/coreinit_Thread.h index e2f5bef2..e619d5b6 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Thread.h +++ b/src/Cafe/OS/libs/coreinit/coreinit_Thread.h @@ -486,8 +486,8 @@ struct OSThread_t /* +0x668 */ MPTR tlsBlocksMPTR; /* +0x66C */ MEMPTR waitingForFastMutex; - /* +0x670 */ coreinit::OSFastMutexLink contendedFastMutex; // link or queue? - /* +0x678 */ coreinit::OSFastMutexLink ownedFastMutex; // link or queue? + /* +0x670 */ coreinit::OSFastMutexLink contendedFastMutex; + /* +0x678 */ coreinit::OSFastMutexLink ownedFastMutex; /* +0x680 */ uint32 padding680[28 / 4]; }; @@ -615,7 +615,6 @@ namespace coreinit void coreinit_suspendThread(OSThread_t* OSThreadBE, sint32 count = 1); void coreinit_resumeThread(OSThread_t* OSThreadBE, sint32 count = 1); -MPTR coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_t* hCPU); OSThread_t* coreinitThread_getCurrentThreadDepr(PPCInterpreter_t* hCPU); extern MPTR activeThread[256]; diff --git a/src/Cafe/OS/libs/gx2/GX2.h b/src/Cafe/OS/libs/gx2/GX2.h index b8a3f919..58d98191 100644 --- a/src/Cafe/OS/libs/gx2/GX2.h +++ b/src/Cafe/OS/libs/gx2/GX2.h @@ -7,11 +7,6 @@ #define GX2_ENABLE 1 #define GX2_DISABLE 0 -// tex unit base for render backends -#define CEMU_PS_TEX_UNIT_BASE 0 -#define CEMU_VS_TEX_UNIT_BASE 32 -#define CEMU_GS_TEX_UNIT_BASE 64 - #include "GX2_Surface.h" // general diff --git a/src/Cafe/OS/libs/nlibcurl/nlibcurl.cpp b/src/Cafe/OS/libs/nlibcurl/nlibcurl.cpp index ce9501ab..53981a5a 100644 --- a/src/Cafe/OS/libs/nlibcurl/nlibcurl.cpp +++ b/src/Cafe/OS/libs/nlibcurl/nlibcurl.cpp @@ -225,7 +225,7 @@ void CurlWorkerThread(CURL_t* curl, PPCConcurrentQueue* callerQueue, uint32 SendOrderToWorker(CURL_t* curl, QueueOrder order, uint32 arg1 = 0) { - OSThread_t* currentThread = coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()); + OSThread_t* currentThread = coreinit::OSGetCurrentThread(); curl->curlThread = currentThread; // cemuLog_logDebug(LogType::Force, "CURRENTTHREAD: 0x{} -> {}",currentThread, order) @@ -707,7 +707,7 @@ void export_curl_easy_init(PPCInterpreter_t* hCPU) memset(result.GetPtr(), 0, sizeof(CURL_t)); *result = {}; result->curl = curl_easy_init(); - result->curlThread = coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()); + result->curlThread = coreinit::OSGetCurrentThread(); result->info_contentType = nullptr; result->info_redirectUrl = nullptr; diff --git a/src/Cafe/OS/libs/nn_act/nn_act.cpp b/src/Cafe/OS/libs/nn_act/nn_act.cpp index fb1d4d14..68109586 100644 --- a/src/Cafe/OS/libs/nn_act/nn_act.cpp +++ b/src/Cafe/OS/libs/nn_act/nn_act.cpp @@ -283,7 +283,6 @@ void nnActExport_GetSimpleAddressIdEx(PPCInterpreter_t* hCPU) void nnActExport_GetPrincipalId(PPCInterpreter_t* hCPU) { // return error for non-nnid accounts? - cemuLog_logDebug(LogType::Force, "nn_act.GetPrincipalId()"); uint32be principalId; GetPrincipalIdEx(&principalId, iosu::act::ACT_SLOT_CURRENT); osLib_returnFromFunction(hCPU, (uint32)principalId); diff --git a/src/Cafe/OS/libs/nn_save/nn_save.cpp b/src/Cafe/OS/libs/nn_save/nn_save.cpp index 1311dd46..78de8291 100644 --- a/src/Cafe/OS/libs/nn_save/nn_save.cpp +++ b/src/Cafe/OS/libs/nn_save/nn_save.cpp @@ -446,19 +446,20 @@ namespace save SAVEStatus SAVEOpenFileOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParamsNew_t asyncParams; asyncParams.ioMsgQueue = nullptr; asyncParams.userCallback = PPCInterpreter_makeCallableExportDepr(AsyncCallback); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetPointer(); SAVEStatus status = SAVEOpenFileOtherApplicationAsync(client, block, titleId, accountSlot, path, mode, hFile, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -680,19 +681,20 @@ namespace save SAVEStatus SAVEGetFreeSpaceSize(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FSLargeSize* freeSize, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEGetFreeSpaceSizeAsync(client, block, accountSlot, freeSize, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -749,19 +751,20 @@ namespace save SAVEStatus SAVERemove(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVERemoveAsync(client, block, accountSlot, path, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -862,19 +865,20 @@ namespace save SAVEStatus SAVEOpenDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEOpenDirAsync(client, block, accountSlot, path, hDir, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -935,19 +939,20 @@ namespace save SAVEStatus SAVEOpenDirOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSDirHandlePtr hDir, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEOpenDirOtherApplicationAsync(client, block, titleId, accountSlot, path, hDir, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -1071,19 +1076,20 @@ namespace save SAVEStatus SAVEMakeDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEMakeDirAsync(client, block, accountSlot, path, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -1122,19 +1128,20 @@ namespace save SAVEStatus SAVEOpenFile(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, const char* mode, FSFileHandleDepr_t* hFile, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParamsNew_t asyncParams; asyncParams.ioMsgQueue = nullptr; asyncParams.userCallback = PPCInterpreter_makeCallableExportDepr(AsyncCallback); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetPointer(); SAVEStatus status = SAVEOpenFileAsync(client, block, accountSlot, path, mode, hFile, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -1182,19 +1189,20 @@ namespace save SAVEStatus SAVEGetStat(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEGetStatAsync(client, block, accountSlot, path, stat, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -1233,19 +1241,20 @@ namespace save SAVEStatus SAVEGetStatOtherApplication(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint64 titleId, uint8 accountSlot, const char* path, FSStat_t* stat, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEGetStatOtherApplicationAsync(client, block, titleId, accountSlot, path, stat, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -1422,19 +1431,20 @@ namespace save SAVEStatus SAVEChangeDir(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, const char* path, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEChangeDirAsync(client, block, accountSlot, path, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } @@ -1491,19 +1501,20 @@ namespace save SAVEStatus SAVEFlushQuota(coreinit::FSClient_t* client, coreinit::FSCmdBlock_t* block, uint8 accountSlot, FS_ERROR_MASK errHandling) { + MEMPTR currentThread{coreinit::OSGetCurrentThread()}; FSAsyncParams_t asyncParams; asyncParams.ioMsgQueue = MPTR_NULL; asyncParams.userCallback = _swapEndianU32(PPCInterpreter_makeCallableExportDepr(AsyncCallback)); StackAllocator param; - param->thread = coreinitThread_getCurrentThreadMPTRDepr(PPCInterpreter_getCurrentInstance()); + param->thread = currentThread; param->returnStatus = (FSStatus)FS_RESULT::SUCCESS; asyncParams.userContext = param.GetMPTRBE(); SAVEStatus status = SAVEFlushQuotaAsync(client, block, accountSlot, errHandling, &asyncParams); if (status == (FSStatus)FS_RESULT::SUCCESS) { - coreinit_suspendThread(coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()), 1000); + coreinit_suspendThread(currentThread, 1000); PPCCore_switchToScheduler(); return param->returnStatus; } diff --git a/src/Cafe/OS/libs/nsysnet/nsysnet.cpp b/src/Cafe/OS/libs/nsysnet/nsysnet.cpp index f39a24ea..e0224148 100644 --- a/src/Cafe/OS/libs/nsysnet/nsysnet.cpp +++ b/src/Cafe/OS/libs/nsysnet/nsysnet.cpp @@ -85,7 +85,7 @@ void nsysnetExport_socket_lib_finish(PPCInterpreter_t* hCPU) uint32* __gh_errno_ptr() { - OSThread_t* osThread = coreinitThread_getCurrentThreadDepr(PPCInterpreter_getCurrentInstance()); + OSThread_t* osThread = coreinit::OSGetCurrentThread(); return &osThread->context.error; } diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index c220c686..c0d975ec 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -14,8 +14,6 @@ #include "gui/canvas/VulkanCanvas.h" #include "Cafe/OS/libs/nn_nfp/nn_nfp.h" #include "Cafe/OS/libs/swkbd/swkbd.h" -#include "Cafe/IOSU/legacy/iosu_crypto.h" -#include "Cafe/GameProfile/GameProfile.h" #include "gui/debugger/DebuggerWindow2.h" #include "util/helpers/helpers.h" #include "config/CemuConfig.h" @@ -23,10 +21,8 @@ #include "util/ScreenSaver/ScreenSaver.h" #include "gui/GeneralSettings2.h" #include "gui/GraphicPacksWindow2.h" -#include "gui/GameProfileWindow.h" #include "gui/CemuApp.h" #include "gui/CemuUpdateWindow.h" -#include "gui/helpers/wxCustomData.h" #include "gui/LoggingWindow.h" #include "config/ActiveSettings.h" #include "config/LaunchSettings.h" @@ -36,9 +32,7 @@ #include "gui/TitleManager.h" #include "Cafe/CafeSystem.h" -#include "Cafe/TitleList/GameInfo.h" -#include #include "util/helpers/SystemException.h" #include "gui/DownloadGraphicPacksWindow.h" #include "gui/GettingStartedDialog.h" @@ -529,8 +523,8 @@ bool MainWindow::FileLoad(const fs::path launchPath, wxLaunchGameEvent::INITIATE } else //if (launchTitle.GetFormat() == TitleInfo::TitleDataFormat::INVALID_STRUCTURE ) { - // title is invalid, if its an RPX/ELF we can launch it directly - // otherwise its an error + // title is invalid, if it's an RPX/ELF we can launch it directly + // otherwise it's an error CafeTitleFileType fileType = DetermineCafeSystemFileType(launchPath); if (fileType == CafeTitleFileType::RPX || fileType == CafeTitleFileType::ELF) { @@ -1875,7 +1869,7 @@ public: { wxSizer* lineSizer = new wxBoxSizer(wxHORIZONTAL); lineSizer->Add(new wxStaticText(parent, -1, "zLib ("), 0); - lineSizer->Add(new wxHyperlinkCtrl(parent, -1, "http://www.zlib.net", "http://www.zlib.net"), 0); + lineSizer->Add(new wxHyperlinkCtrl(parent, -1, "https://www.zlib.net", "https://www.zlib.net"), 0); lineSizer->Add(new wxStaticText(parent, -1, ")"), 0); sizer->Add(lineSizer); } diff --git a/src/gui/TitleManager.h b/src/gui/TitleManager.h index 17a48976..2973618f 100644 --- a/src/gui/TitleManager.h +++ b/src/gui/TitleManager.h @@ -86,7 +86,6 @@ private: void OnDisconnect(wxCommandEvent& event); void OnDlFilterCheckbox(wxCommandEvent& event); - void OnDlCheckboxShowUpdates(wxCommandEvent& event); void SetConnected(bool state); diff --git a/src/gui/components/wxTitleManagerList.h b/src/gui/components/wxTitleManagerList.h index cab531c4..14721c57 100644 --- a/src/gui/components/wxTitleManagerList.h +++ b/src/gui/components/wxTitleManagerList.h @@ -107,8 +107,7 @@ private: [[nodiscard]] boost::optional GetTitleEntry(long item); [[nodiscard]] boost::optional GetTitleEntry(const fs::path& path) const; [[nodiscard]] boost::optional GetTitleEntry(const fs::path& path); - - bool VerifyEntryFiles(TitleEntry& entry); + void OnConvertToCompressedFormat(uint64 titleId, uint64 rightClickedUID); bool DeleteEntry(long index, const TitleEntry& entry); diff --git a/src/gui/debugger/DisasmCtrl.cpp b/src/gui/debugger/DisasmCtrl.cpp index 21f6fc1d..c2cd5722 100644 --- a/src/gui/debugger/DisasmCtrl.cpp +++ b/src/gui/debugger/DisasmCtrl.cpp @@ -256,7 +256,7 @@ void DisasmCtrl::DrawDisassemblyLine(wxDC& dc, const wxPoint& linePosition, MPTR { sint32 sImm = disasmInstr.operand[o].immS32; if (disasmInstr.operand[o].immWidth == 16 && (sImm & 0x8000)) - sImm |= 0xFFFF0000; + sImm |= (sint32)0xFFFF0000; if ((sImm > -10 && sImm < 10) || forceDecDisplay) string = wxString::Format("%d", sImm); diff --git a/src/gui/guiWrapper.h b/src/gui/guiWrapper.h index 0e13596b..dd77819c 100644 --- a/src/gui/guiWrapper.h +++ b/src/gui/guiWrapper.h @@ -1,7 +1,5 @@ #pragma once -#include - #if BOOST_OS_LINUX #include "xcb/xproto.h" #include