UWP buildfix, tweaks and de-clauding

This commit is contained in:
Henrik Rydgård committed 2026-08-24 12:15:31 +02:00
1 parent e9cdb2b20f
commit 9205eb642a
7 files changed
+15 -26

No files matched your search

+1 -8
View File
@@ -168,14 +168,7 @@ static const HLEFunction LoadCoreForKernel[] = {
// sceKernelSm1ReferOperations() returns a pointer to a driver-registered "SM1 operations"
// table (set up via the sibling sceKernelSm1RegisterOperations(), also unimplemented here),
// or NULL if nothing has registered one. Real callers (e.g. kd/lowio.prx) only check the
// return value against exactly zero before dereferencing it as a struct/vtable pointer -
// leaving this as a generic `nullptr` HLE table entry meant it fell through to the "function
// unimplemented" fallback, which returns SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED
// (0x8002013A) in v0 instead of 0. That error code isn't zero, so the caller's null check
// didn't catch it, and it went on to call through a function pointer read from an offset
// within that "structure" - really an unrelated error code - causing a wild read/jump. Since
// nothing currently registers real SM1 operations, returning NULL here is correct.
// or NULL if nothing has registered one.
static u32 sceKernelSm1ReferOperations() {
return hleLogDebug(Log::sceKernel, 0);
}
+1 -12
View File
@@ -1027,18 +1027,7 @@ static int sceKernelLoadExecBufferVSHUsbWlan(int bufferSize, u32 bufferAddr, u32
return hleLogInfo(Log::sceKernel, 0);
}
const HLEFunction LoadExecForKernel[] =
{
// The first 5 entries below (up through sceKernelExitGame) are this array's original,
// pre-VSH-work content, in their original order - kept exactly where they were. Every entry
// added since must go after them, never inserted earlier in this table: the funcindex (this
// array position) gets baked directly into resolved-import syscall opcodes written into
// guest RAM (see GetSyscallOp() in HLE.cpp), which savestates capture verbatim, so inserting
// a new entry before an existing one shifts every later entry's index and silently corrupts
// any savestate taken after that entry was already resolved (see AGENTS.md). A previous
// version of this table's VSH additions violated this three separate times (shifting
// sceKernelLoadExecVSHMs2/0X28D0D249, sceKernelExitVSHKernel/0x6D302D3D, and
// sceKernelExitGame/0x05572A5F) - fixed by moving the new entries after them instead.
const HLEFunction LoadExecForKernel[] = {
{0x4AC57943, &WrapI_I<sceKernelRegisterExitCallback>, "sceKernelRegisterExitCallback", 'i', "i", HLE_KERNEL_SYSCALL },
{0XA3D5E142, &WrapI_U<sceKernelExitVSH>, "sceKernelExitVSHVSH", 'i', "x", HLE_KERNEL_SYSCALL },
{0X28D0D249, &WrapI_CU<sceKernelLoadExec>, "sceKernelLoadExecVSHMs2", 'i', "sx" },
+2 -2
View File
@@ -1679,7 +1679,7 @@ static u32 SysMemUserForUser_D8DE5C1E() {
// free size, see sceKernelMaxFreeMemSize above) of the user memory partition. Was previously
// an unconditional `return 0` - real callers doing size-based decisions (e.g. "is there enough
// memory to enable feature X") would see 0 total memory instead of a real, sane value.
static u32 SysMemUserForUser_ACBD88CA() {
static u32 sceKernelTotalMemSize() {
return hleLogDebug(Log::sceKernel, PSP_GetUserMemoryEnd() - PSP_GetUserMemoryBase());
}
@@ -2116,7 +2116,7 @@ const HLEFunction SysMemUserForUser[] = {
{0X358CA1BB, &WrapI_I<sceKernelSetCompiledSdkVersion606>, "sceKernelSetCompiledSdkVersion606", 'i', "i" },
{0XFC114573, &WrapI_V<sceKernelGetCompiledSdkVersion>, "sceKernelGetCompiledSdkVersion", 'i', "" },
{0X2A3E5280, nullptr, "sceKernelQueryMemoryInfo", '?', "" },
{0XACBD88CA, &WrapU_V<SysMemUserForUser_ACBD88CA>, "SysMemUserForUser_ACBD88CA", 'x', "" },
{0XACBD88CA, &WrapU_V<sceKernelTotalMemSize>, "sceKernelTotalMemSize", 'x', "" },
{0X945E45DA, &WrapU_V<SysMemUserForUser_945E45DA>, "SysMemUserForUser_945E45DA", 'x', "" },
{0XA6848DF8, nullptr, "sceKernelSetUsersystemLibWork", '?', "" },
{0X6231A71D, nullptr, "sceKernelSetPTRIG", '?', "" },
+7 -2
View File
@@ -1495,7 +1495,10 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
module->nm.gp_value = modinfo->gp;
strncpy(module->nm.name, modinfo->name, ARRAY_SIZE(module->nm.name));
if (!strcmp(module->nm.name, "scePaf_Module")) {
if (equals(module->nm.name, "scePaf_Module")) {
// NOTE: This hackery is likely firmware-version-specific, so will need tweaking for
// other firmware versions than 6.61.
//
// scePaf's own heap allocator expects a real memory-pool base address to already be
// patched into this BSS slot before any of its code runs. Real hardware's loader (or
// an early kernel init step) apparently does this - checked all 27 of scePaf's
@@ -1515,7 +1518,9 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load
}
}
if (!strcmp(module->nm.name, "vsh_module")) {
if (equals(module->nm.name, "vsh_module")) {
// Like the above patch, this is likely firmware-version-specific.
//
// vsh_module's SCE_VSH_GRAPHICS thread runs a scan over a small fixed table of
// "alarm task" categories (2 categories, each with a count followed by that many
// 4-byte item IDs). Category 0's data is legitimate, compiled-in content (count=8,
-2
View File
@@ -17,8 +17,6 @@
#include <vector>
// MemMap.h first: PrxDecrypter.h's PSP_Header is written in u32_le and friends, and doesn't pull
// in the header that defines them.
#include "Core/MemMap.h"
#include "Core/Debugger/MemBlockInfo.h"
#include "Core/ELF/PrxDecrypter.h"
+2
View File
@@ -167,6 +167,7 @@
<ClInclude Include="..\..\Core\HLE\sceNetResolver.h" />
<ClInclude Include="..\..\Core\HLE\sceNp2.h" />
<ClInclude Include="..\..\Core\HLE\sceReg.h" />
<ClInclude Include="..\..\Core\HLE\sceVshBridge.h" />
<ClInclude Include="..\..\Core\HLE\SocketManager.h" />
<ClInclude Include="..\..\Core\HW\GranularMixer.h" />
<ClInclude Include="..\..\Core\Instance.h" />
@@ -449,6 +450,7 @@
<ClCompile Include="..\..\Core\HLE\sceNetResolver.cpp" />
<ClCompile Include="..\..\Core\HLE\sceNp2.cpp" />
<ClCompile Include="..\..\Core\HLE\sceReg.cpp" />
<ClCompile Include="..\..\Core\HLE\sceVshBridge.cpp" />
<ClCompile Include="..\..\Core\HLE\SocketManager.cpp" />
<ClCompile Include="..\..\Core\HW\GranularMixer.cpp" />
<ClCompile Include="..\..\Core\Instance.cpp" />
+2
View File
@@ -422,6 +422,7 @@
<ClCompile Include="..\..\Core\CmdLine.cpp" />
<ClCompile Include="..\..\Core\EmuThread.cpp" />
<ClCompile Include="..\..\Core\HLE\sceChkreg.cpp" />
<ClCompile Include="..\..\Core\HLE\sceVshBridge.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Core\AVIDump.h" />
@@ -706,6 +707,7 @@
<ClInclude Include="..\..\Core\CmdLine.h" />
<ClInclude Include="..\..\Core\EmuThread.h" />
<ClInclude Include="..\..\Core\HLE\sceChkreg.h" />
<ClInclude Include="..\..\Core\HLE\sceVshBridge.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\ext\gason\LICENSE" />