- C++ 65.3%
- Python 25.4%
- C 9.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| tools | ||
| .gitignore | ||
| backport_hooks.cpp | ||
| backports.cpp | ||
| hde64.cpp | ||
| hde64.h | ||
| hooks.cpp | ||
| hooks.h | ||
| libSceRtc.sln | ||
| LICENSE | ||
| prx.vcxproj | ||
| prx.vcxproj.filters | ||
| README.md | ||
| rtc.cpp | ||
| rtc.h | ||
| table64.h | ||
libSceRtc Backport Stub
libSceRtc replacement module.
This is a special compatibility version of the library. It is intended to add missing functions and hook existing functions so applications can run on older SDK and firmware versions.
The module exports the public RTC API plus the extra entry points present in the
reference libSceRtc.sprx: current clock/network clock helpers, date conversion,
tick arithmetic, RFC2822/RFC3339 parsing and formatting, DOS/Win32/time_t
conversion, and tick comparison.
Build with Visual Studio Prospero platform:
msbuild libSceRtc.sln /p:Configuration=Release /p:Platform=Prospero
Visual Studio also exposes Backport4|Prospero through Backport13|Prospero
solution configurations for building a single target variant directly from the
IDE.
The default Release build also generates compatibility variants:
out/sdk4/libSceRtc.prx
out/sdk5/libSceRtc.prx
...
out/sdk13/libSceRtc.prx
Add version-specific exports to backports.cpp and guard them by target version:
#if BACKPORT_SDK <= 6
PRX_INTERFACE int sceRtcNewCompatExport(void) {
return SCE_OK;
}
#endif
This example is included in Backport4, Backport5, and Backport6.
If the original function name is unknown and only the 11-character export NID is
known, use a local alias and the raw-NID table. backports.cpp contains a
disabled example guarded by BACKPORT_RAW_NID_EXAMPLE; add the local export
name and target NID to tools/nidmaps/libSceRtc.raw-nids.txt:
backportRawNid_ReplaceMe=AAAAAAAAAAA
Then build normally. The post-link step runs automatically for every build,
computes the temporary lld NID from backportRawNid_ReplaceMe, replaces it with
the target raw NID, and rebuilds the PRX .hash table.
To compile the disabled example itself:
msbuild libSceRtc.sln /p:Configuration=Backport13 /p:Platform=Prospero /p:BackportExtraPreprocessorDefinitions=BACKPORT_RAW_NID_EXAMPLE
The generic runtime hook engine lives in hooks.cpp. Concrete backport hooks
live in backport_hooks.cpp. The module installs them from module_start and
removes them from module_stop. The hook engine patches the target function
body, creates an executable trampoline for the stolen prologue, relocates
relative/RIP-relative instructions where supported, and logs install status to
kernel debug output.
Add new always-available hooks to the g_backportHooks[] table with the symbol
name, imported target pointer, matching *_hook replacement, and an optional
flag. Required hook failures abort installation and roll back already installed
hooks; optional hook failures are logged and ignored. Use
hookGetOriginalFunction("symbol") inside a hook when the replacement needs to
forward to the original trampoline.
For functions from modules loaded after this PRX, add entries to
g_lateDlsymHooks[]. The hook engine scans modules that are already loaded and
also checks each module loaded later through sceKernelLoadStartModule or
sceKernelLoadStartModuleForSysmodule. Set moduleName to nullptr or ""
when the export name is known but the owning module is not:
{nullptr, "sceSomeLateFunction", reinterpret_cast<void*>(&sceSomeLateFunction_hook)}
Use hookGetOriginalLateDlsymFunction("symbol") inside the replacement to
forward to the resolved original. This path hooks exported function bodies by
resolving them with sceKernelDlsym; it does not rewrite static import
relocations that were already bound by the loader.
License
This project is licensed under the GNU General Public License v3.0. See
LICENSE for details.