Files
PS2Recomp/ps2xRuntime/src/lib/Kernel/Stubs/Unimplemented.cpp
T
Ranieri 93e221feaa Feature/runtime ecosystem refactor (#107)
* feat: remove memory and pad from stub section

* feat: add support for resume entry targets in CodeGenerator (this allow jumps in address outside function)
feat: refactor entry point discovery one more try to reduce big generated file

* feat: optmizations for release build

* feat: remove unused  file

* feat: added some test cases for code gen

* feat: added log macro and remove win specific code

* feat: refactor runtime folder structure
feat: added reset sound driver RPC state and compatibility layout
feat: rename and added new test
feat: update RPC calls to use defined constants
feat: added more PSMC(16, 32)
feat: change cd read to try find the asset ignoring case sensitive
fix: fix some render problems
feat: add logs on pad
feat: added more RPC handles

* feat: added game override for code veronica

* feat: apply vita patch

* feat: flags to disable build

* feat: fix merges
feat: break a lot of tests

* feat: better throw error on empty cd path
feat: remove recompiler unusde function
feat: apply missing patch

* feat: gamedp is now part of lib
feat: missing file

* feat: small cleanup

* feat: missing vita changes

* feat: fix more merge

* feat: fix tests

* feat: last missing feature

* feat: added missing import

* feat: rename test local functions

* feat: init syscall on ps2 list

* feat: added DMA helpers

* feat: faster builds
feat: more implement for darkcloud

* feat: back missing file

* feat: added missing includes

* feat: remove test

* feat: missing include

* feat: read register funtion

* feat: build  fix

* feat: force  exit on detach thread
2026-04-04 23:09:56 -03:00

50 lines
1.8 KiB
C++

#include "Common.h"
#include "Unimplemented.h"
namespace ps2_stubs
{
void TODO(uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
{
TODO_NAMED("unknown", rdram, ctx, runtime);
}
void TODO_NAMED(const char *name, uint8_t *rdram, R5900Context *ctx, PS2Runtime *runtime)
{
const std::string stubName = name ? name : "unknown";
uint32_t callCount = 0;
{
std::lock_guard<std::mutex> lock(g_stubWarningMutex);
callCount = ++g_stubWarningCount[stubName];
}
if (callCount > kMaxStubWarningsPerName)
{
if (callCount == (kMaxStubWarningsPerName + 1))
{
std::cerr << "Warning: Further calls to PS2 stub '" << stubName
<< "' are suppressed after " << kMaxStubWarningsPerName << " warnings" << std::endl;
}
setReturnS32(ctx, -1);
return;
}
uint32_t stub_num = getRegU32(ctx, 2); // $v0
uint32_t caller_ra = getRegU32(ctx, 31); // $ra
std::cerr << "Warning: Unimplemented PS2 stub called. name=" << stubName
<< " PC=0x" << std::hex << ctx->pc
<< ", RA=0x" << caller_ra
<< ", Stub# guess (from $v0)=0x" << stub_num << std::dec << std::endl;
// More context for debugging
std::cerr << " Args: $a0=0x" << std::hex << getRegU32(ctx, 4)
<< ", $a1=0x" << getRegU32(ctx, 5)
<< ", $a2=0x" << getRegU32(ctx, 6)
<< ", $a3=0x" << getRegU32(ctx, 7) << std::dec << std::endl;
//TODO maybe a macro to disable the exception and just return an success just to see it where goes.
throw std::runtime_error("Unimplemented PS2 stub called: " + stubName);
}
}