mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 08:51:05 -04:00
feat: added more empty stubs
feat: added TODO_NAMED to help debug fix: disable for now audio thread
This commit is contained in:
@@ -154,12 +154,24 @@
|
||||
X(njTextureShadingMode) \
|
||||
X(njInitView) \
|
||||
X(njSetAspect) \
|
||||
X(njInitSystem) \
|
||||
X(njInitPrint) \
|
||||
X(njPolygonCullingMode) \
|
||||
X(njSetView) \
|
||||
X(njGetMatrix) \
|
||||
X(njInitTexture) \
|
||||
X(njInitTextureBuffer) \
|
||||
X(njSetPaletteMode) \
|
||||
X(njClipZ) \
|
||||
X(syRtcInit) \
|
||||
X(_builtin_set_imask) \
|
||||
X(syFree) \
|
||||
X(InitSdcParameter) \
|
||||
X(Ps2_pad_actuater) \
|
||||
X(syMallocInit) \
|
||||
X(syHwInit) \
|
||||
X(syHwInit2) \
|
||||
X(InitGdSystemEx) \
|
||||
X(pdInitPeripheral) \
|
||||
X(njSetVertexBuffer) \
|
||||
X(njPrintSize) \
|
||||
@@ -172,4 +184,7 @@
|
||||
X(sdSysFinish) \
|
||||
X(ADXT_Init) \
|
||||
X(ADXT_SetNumRetry) \
|
||||
X(cvFsSetDefDev)
|
||||
X(cvFsSetDefDev) \
|
||||
X(sndr_trans_func) \
|
||||
X(sdDrvInit) \
|
||||
X(ADXF_LoadPartitionNw)
|
||||
@@ -12,6 +12,7 @@ namespace ps2_stubs
|
||||
#undef PS2_DECLARE_STUB
|
||||
|
||||
void TODO(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime);
|
||||
void TODO_NAMED(const char *name, uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime);
|
||||
}
|
||||
|
||||
#endif // PS2_STUBS_H
|
||||
|
||||
@@ -1119,6 +1119,105 @@ namespace ps2_stubs
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njInitSystem(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njInitSystem" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njInitPrint(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njInitPrint" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njPolygonCullingMode(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njPolygonCullingMode" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njSetView(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njSetView" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njGetMatrix(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njGetMatrix" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njInitTexture(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njInitTexture" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njInitTextureBuffer(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njInitTextureBuffer" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njSetPaletteMode(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njSetPaletteMode" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void njClipZ(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub njClipZ" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void syRtcInit(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
@@ -1185,6 +1284,39 @@ namespace ps2_stubs
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void syHwInit(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub syHwInit" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void syHwInit2(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub syHwInit2" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void InitGdSystemEx(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub InitGdSystemEx" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void pdInitPeripheral(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
@@ -1273,6 +1405,52 @@ namespace ps2_stubs
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void sndr_trans_func(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub sndr_trans_func (noop)" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
|
||||
// For now just clear the snd busy flag used by sdMultiUnitDownload/SysServer loops.
|
||||
constexpr uint32_t kSndBusyAddr = 0x01E0E170;
|
||||
if (rdram)
|
||||
{
|
||||
uint32_t offset = kSndBusyAddr & PS2_RAM_MASK;
|
||||
if (offset + sizeof(uint32_t) <= PS2_RAM_SIZE)
|
||||
{
|
||||
*reinterpret_cast<uint32_t *>(rdram + offset) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void sdDrvInit(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub sdDrvInit (noop)" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void ADXF_LoadPartitionNw(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
if (logCount < 8)
|
||||
{
|
||||
std::cout << "ps2_stub ADXF_LoadPartitionNw (noop)" << std::endl;
|
||||
++logCount;
|
||||
}
|
||||
// Return success to keep the ADX partition setup moving.
|
||||
setReturnS32(ctx, 0);
|
||||
}
|
||||
|
||||
void sdSndStopAll(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
static int logCount = 0;
|
||||
@@ -1330,10 +1508,16 @@ namespace ps2_stubs
|
||||
|
||||
void TODO(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
uint32_t stub_num = getRegU32(ctx, 2); // $v0 often holds stub num *before* call
|
||||
TODO_NAMED("unknown", rdram, ctx, runtime);
|
||||
}
|
||||
|
||||
void TODO_NAMED(const char *name, uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
|
||||
{
|
||||
uint32_t stub_num = getRegU32(ctx, 2); // $v0
|
||||
uint32_t caller_ra = getRegU32(ctx, 31); // $ra
|
||||
|
||||
std::cerr << "Warning: Unimplemented PS2 stub called. PC=0x" << std::hex << ctx->pc
|
||||
std::cerr << "Warning: Unimplemented PS2 stub called. name=" << (name ? name : "unknown")
|
||||
<< " PC=0x" << std::hex << ctx->pc
|
||||
<< ", RA=0x" << caller_ra
|
||||
<< ", Stub# guess (from $v0)=0x" << stub_num << std::dec << std::endl;
|
||||
|
||||
|
||||
@@ -221,6 +221,16 @@ namespace ps2_syscalls
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO check later skip audio threads to avoid runaway recursion/stack overflows.
|
||||
if (info.entry == 0x2f42a0 || info.entry == 0x2f4258)
|
||||
{
|
||||
std::cout << "[StartThread] id=" << tid
|
||||
<< " entry=0x" << std::hex << info.entry << std::dec
|
||||
<< " skipped (audio thread stub)" << std::endl;
|
||||
setReturnS32(ctx, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Spawn a host thread to simulate PS2 thread execution.
|
||||
g_activeThreads.fetch_add(1, std::memory_order_relaxed);
|
||||
std::thread([=]() mutable
|
||||
|
||||
Reference in New Issue
Block a user