Skip to content

Commit

Permalink
Merge pull request #17552 from unknownbrackets/debug-hle-names
Browse files Browse the repository at this point in the history
HLE: Add some assorted detected func names
  • Loading branch information
hrydgard committed Jun 7, 2023
2 parents 733b7b0 + c122ee0 commit 7519af8
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 21 deletions.
9 changes: 9 additions & 0 deletions Common/RiscVEmitter.h
Expand Up @@ -302,6 +302,12 @@ class RiscVEmitter {
void NEG(RiscVReg rd, RiscVReg rs) {
SUB(rd, R_ZERO, rs);
}
void SNEZ(RiscVReg rd, RiscVReg rs) {
SLTU(rd, R_ZERO, rs);
}
void SEQZ(RiscVReg rd, RiscVReg rs) {
SLTIU(rd, rs, 1);
}

void FENCE(Fence predecessor, Fence successor);
void FENCE_TSO();
Expand Down Expand Up @@ -896,6 +902,9 @@ class RiscVEmitter {
void MINU(RiscVReg rd, RiscVReg rs1, RiscVReg rs2);
void SEXT_B(RiscVReg rd, RiscVReg rs);
void SEXT_H(RiscVReg rd, RiscVReg rs);
void SEXT_W(RiscVReg rd, RiscVReg rs) {
ADDIW(rd, rs, 0);
}
void ZEXT_H(RiscVReg rd, RiscVReg rs);
void ZEXT_W(RiscVReg rd, RiscVReg rs) {
ADD_UW(rd, rs, R_ZERO);
Expand Down
4 changes: 2 additions & 2 deletions Core/Dialog/SavedataParam.cpp
Expand Up @@ -947,7 +947,7 @@ int SavedataParam::EncryptData(unsigned int mode,
return -5;

/* Verify encryption */
if (sceChnnlsv_21BE78B4_(ctx2) < 0)
if (sceSdCleanList_(ctx2) < 0)
return -6;

/* Build the file hash from this PSP */
Expand Down Expand Up @@ -989,7 +989,7 @@ int SavedataParam::DecryptSave(unsigned int mode, unsigned char *data, int *data
return -6;

/* Verify that it decrypted correctly */
if (sceChnnlsv_21BE78B4_(ctx2) < 0)
if (sceSdCleanList_(ctx2) < 0)
return -7;

if (expectedHash) {
Expand Down
6 changes: 3 additions & 3 deletions Core/HLE/HLETables.cpp
Expand Up @@ -183,9 +183,9 @@ const HLEFunction KDebugForKernel[] =
{0X24C32559, nullptr, "sceKernelDipsw", '?', "" },
{0XD636B827, nullptr, "sceKernelRemoveByDebugSection", '?', "" },
{0X5282DD5E, nullptr, "sceKernelDipswSet", '?', "" },
{0X9F8703E4, nullptr, "KDebugForKernel_9F8703E4", '?', "" },
{0X333DCEC7, nullptr, "KDebugForKernel_333DCEC7", '?', "" },
{0XE892D9A1, nullptr, "KDebugForKernel_E892D9A1", '?', "" },
{0X9F8703E4, nullptr, "sceKernelDipswCpTime", '?', "" },
{0X333DCEC7, nullptr, "sceKernelSm1RegisterOperations", '?', "" },
{0XE892D9A1, nullptr, "sceKernelSm1ReferOperations", '?', "" },
{0XA126F497, nullptr, "KDebugForKernel_A126F497", '?', "" },
{0XB7251823, nullptr, "sceKernelAcceptMbogoSig", '?', "" },
};
Expand Down
8 changes: 4 additions & 4 deletions Core/HLE/sceChnnlsv.cpp
Expand Up @@ -497,14 +497,14 @@ int sceSdSetMember_(pspChnnlsvContext2& ctx, u8* data, int alignedLen)
return res;
}

static int sceChnnlsv_21BE78B4(u32 ctxAddr) {
static int sceSdCleanList(u32 ctxAddr) {
auto ctx = PSPPointer<pspChnnlsvContext2>::Create(ctxAddr);
if (!ctx.IsValid())
return hleLogError(SCEMISC, 0, "Invalid pointer");
return hleLogSuccessI(SCEMISC, sceChnnlsv_21BE78B4_(*ctx));
return hleLogSuccessI(SCEMISC, sceSdCleanList_(*ctx));
}

int sceChnnlsv_21BE78B4_(pspChnnlsvContext2& ctx)
int sceSdCleanList_(pspChnnlsvContext2& ctx)
{
memset(ctx.cryptedData, 0, 16);
ctx.unkn = 0;
Expand All @@ -520,7 +520,7 @@ const HLEFunction sceChnnlsv[] =
{0XC4C494F8, &WrapI_UUU<sceSdGetLastIndex>, "sceSdGetLastIndex", 'i', "xxx" },
{0XABFDFC8B, &WrapI_UIIUU<sceSdCreateList>, "sceSdCreateList", 'i', "xiixx"},
{0X850A7FA1, &WrapI_UUI<sceSdSetMember>, "sceSdSetMember", 'i', "xxi" },
{0X21BE78B4, &WrapI_U<sceChnnlsv_21BE78B4>, "sceChnnlsv_21BE78B4", 'i', "x" },
{0X21BE78B4, &WrapI_U<sceSdCleanList>, "sceSdCleanList", 'i', "x" },
};

void Register_sceChnnlsv()
Expand Down
2 changes: 1 addition & 1 deletion Core/HLE/sceChnnlsv.h
Expand Up @@ -38,7 +38,7 @@ int sceSdSetIndex_(pspChnnlsvContext1& ctx, int value);
int sceSdRemoveValue_(pspChnnlsvContext1& ctx, u8* data, int length);
int sceSdCreateList_(pspChnnlsvContext2& ctx2, int mode, int uknw, u8* data, u8* cryptkey);
int sceSdSetMember_(pspChnnlsvContext2& ctx, u8* data, int alignedLen);
int sceChnnlsv_21BE78B4_(pspChnnlsvContext2& ctx);
int sceSdCleanList_(pspChnnlsvContext2& ctx);
int sceSdGetLastIndex_(pspChnnlsvContext1& ctx, u8* in_hash, u8* in_key);

void Register_sceChnnlsv();
2 changes: 1 addition & 1 deletion Core/HLE/sceIo.cpp
Expand Up @@ -3038,7 +3038,7 @@ const HLEFunction IoFileMgrForKernel[] = {
{0x3251EA56, &WrapU_IU<sceIoPollAsync>, "sceIoPollAsync", 'i', "iP", HLE_KERNEL_SYSCALL },
{0xE23EEC33, &WrapI_IU<sceIoWaitAsync>, "sceIoWaitAsync", 'i', "iP", HLE_KERNEL_SYSCALL },
{0x35DBD746, &WrapI_IU<sceIoWaitAsyncCB>, "sceIoWaitAsyncCB", 'i', "iP", HLE_KERNEL_SYSCALL },
{0xBD17474F, nullptr, "IoFileMgrForKernel_BD17474F", '?', "" },
{0xBD17474F, nullptr, "sceIoGetIobUserLevel", '?', "" },
{0x76DA16E3, nullptr, "IoFileMgrForKernel_76DA16E3", '?', "" },
};

Expand Down
9 changes: 5 additions & 4 deletions Core/HLE/sceKernelHeap.cpp
Expand Up @@ -7,6 +7,7 @@
#include "Core/HLE/sceKernel.h"
#include "Core/HLE/sceKernelHeap.h"
#include "Core/HLE/sceKernelMemory.h"
#include "Core/Reporting.h"
#include "Core/Util/BlockAllocator.h"

static const u32 KERNEL_HEAP_BLOCK_HEADER_SIZE = 8;
Expand Down Expand Up @@ -112,9 +113,9 @@ static u32 sceKernelPartitionMaxFreeMemSize(int partitionId) {
return hleLogWarning(SCEKERNEL, allocator->GetLargestFreeBlockSize());
}

static u32 SysMemForKernel_536AD5E1()
static u32 sceKernelGetUidmanCB()
{
ERROR_LOG(SCEKERNEL, "UNIMP SysMemForKernel_536AD5E1");
ERROR_LOG_REPORT(SCEKERNEL, "UNIMP sceKernelGetUidmanCB");
return 0;
}

Expand Down Expand Up @@ -165,9 +166,9 @@ const HLEFunction SysMemForKernel[] = {
{ 0x9697CD32, &WrapU_I<sceKernelPartitionTotalFreeMemSize>, "sceKernelPartitionTotalFreeMemSize", 'x', "i" , HLE_KERNEL_SYSCALL },
{ 0xE6581468, &WrapU_I<sceKernelPartitionMaxFreeMemSize>, "sceKernelPartitionMaxFreeMemSize", 'x', "i" , HLE_KERNEL_SYSCALL },
{ 0X3FC9AE6A, &WrapU_V<sceKernelDevkitVersion>, "sceKernelDevkitVersion", 'x', "" , HLE_KERNEL_SYSCALL },
{ 0X536AD5E1, &WrapU_V<SysMemForKernel_536AD5E1>, "SysMemForKernel_536AD5E1", 'i', "i" , HLE_KERNEL_SYSCALL },
{ 0X536AD5E1, &WrapU_V<sceKernelGetUidmanCB>, "sceKernelGetUidmanCB", 'i', "i" , HLE_KERNEL_SYSCALL },
{ 0X7B749390, &WrapI_IU<sceKernelFreeHeapMemory>, "sceKernelFreeHeapMemory", 'i', "ix" , HLE_KERNEL_SYSCALL },
{ 0XEB7A74DB , &WrapI_IUU<sceKernelAllocHeapMemoryWithOption>, "sceKernelAllocHeapMemoryWithOption", 'i', "ixp" , HLE_KERNEL_SYSCALL },
{ 0XEB7A74DB, &WrapI_IUU<sceKernelAllocHeapMemoryWithOption>, "sceKernelAllocHeapMemoryWithOption", 'i', "ixp" , HLE_KERNEL_SYSCALL },
};

void Register_SysMemForKernel() {
Expand Down
4 changes: 2 additions & 2 deletions Core/HLE/sceKernelModule.cpp
Expand Up @@ -2708,8 +2708,8 @@ const HLEFunction ModuleMgrForKernel[] =
{0x50F0C1EC, &WrapV_UUUUU<sceKernelStartModule>, "sceKernelStartModule", 'v', "xxxxx", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED | HLE_KERNEL_SYSCALL },
{0x977DE386, &WrapU_CUU<sceKernelLoadModule>, "sceKernelLoadModule", 'x', "sxx", HLE_KERNEL_SYSCALL },
{0xA1A78C58, &WrapU_CUU<sceKernelLoadModuleForLoadExecVSHDisc>, "sceKernelLoadModuleForLoadExecVSHDisc", 'x', "sxx", HLE_KERNEL_SYSCALL }, //fix for tiger x dragon
{0xCC1D3699, &WrapU_UUU<sceKernelSelfStopUnloadModule>, "sceKernelSelfStopUnloadModule", 'x', "xxx", HLE_KERNEL_SYSCALL }, // used in Dissidia final fantasy chinese patch
{0XD1FF982A, &WrapU_UUUUU<sceKernelStopModule>, "sceKernelStopModule", 'x', "xxxxx", HLE_KERNEL_SYSCALL | HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED }, // used in Dissidia final fantasy chinese patch
{0xCC1D3699, &WrapU_UUU<sceKernelSelfStopUnloadModule>, "sceKernelStopUnloadSelfModule", 'x', "xxx", HLE_KERNEL_SYSCALL }, // used in Dissidia final fantasy chinese patch
{0XD1FF982A, &WrapU_UUUUU<sceKernelStopModule>, "sceKernelStopModule", 'x', "xxxxx", HLE_KERNEL_SYSCALL | HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED }, // used in Dissidia final fantasy chinese patch
{0x748CBED9, &WrapU_UU<sceKernelQueryModuleInfo>, "sceKernelQueryModuleInfo", 'x', "xx", HLE_KERNEL_SYSCALL },
{0x644395E2, &WrapU_UUU<sceKernelGetModuleIdList>, "sceKernelGetModuleIdList", 'x', "xxx", HLE_KERNEL_SYSCALL },
{0X2E0911AA, &WrapU_U<sceKernelUnloadModule>, "sceKernelUnloadModule", 'x', "x" , HLE_KERNEL_SYSCALL },
Expand Down
9 changes: 5 additions & 4 deletions Core/HLE/sceOpenPSID.cpp
Expand Up @@ -20,6 +20,7 @@
#include "Core/HLE/proAdhoc.h"
#include "Core/HLE/sceOpenPSID.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"

SceOpenPSID dummyOpenPSID = { 0x10, 0x02, 0xA3, 0x44, 0x13, 0xF5, 0x93, 0xB0, 0xCC, 0x6E, 0xD1, 0x32, 0x27, 0x85, 0x0F, 0x9D };

Expand Down Expand Up @@ -79,17 +80,17 @@ static s32 sceDdrdb_F013F8BF(u32 pDataPtr, u32 pSigPtr) {
}

// unkPtr might be a pointer to OpenPSID
static s32 sceOpenPSID_B29330DE(u32 unkPtr) {
ERROR_LOG(HLE, "UNIMPL %s(%08x)", __FUNCTION__, unkPtr);
static s32 sceOpenPSIDGetProductCode(u32 unkPtr) {
ERROR_LOG_REPORT(HLE, "UNIMPL %s(%08x)", __FUNCTION__, unkPtr);

return 0;
}


const HLEFunction sceOpenPSID[] =
{
{0XC69BEBCE, &WrapI_U<sceOpenPSIDGetOpenPSID>, "sceOpenPSIDGetOpenPSID", 'i', "x" },
{0xB29330DE, &WrapI_U<sceOpenPSID_B29330DE>, "sceOpenPSID_B29330DE", 'i', "x" },
{0xC69BEBCE, &WrapI_U<sceOpenPSIDGetOpenPSID>, "sceOpenPSIDGetOpenPSID", 'i', "x" },
{0xB29330DE, &WrapI_U<sceOpenPSIDGetProductCode>, "sceOpenPSIDGetProductCode", 'i', "x" },
};

void Register_sceOpenPSID()
Expand Down

0 comments on commit 7519af8

Please sign in to comment.