mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 08:33:12 -05:00
Returns the name of the directory under which a title's sandbox exposes system files, which homebrew SDKs splice into paths such as /<name>/common/cert/CA_LIST.cer and /<name>/common/lib/libc.sprx. The name is fixed here; recorded in TechnicalDebt together with the fact that nothing is mounted under it. Registers guest_sandbox_random_word. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <cctype>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <string>
|
|
#include <thread>
|
|
|
|
extern "C" {
|
|
const char* APS5_VABI sceKernelGetFsSandboxRandomWord();
|
|
int APS5_VABI open_nid_postfix(const char*, int, int);
|
|
int* APS5_VABI __error_nid_postfix();
|
|
}
|
|
|
|
static void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
int main() {
|
|
const char* word = sceKernelGetFsSandboxRandomWord();
|
|
Require(word != nullptr);
|
|
const std::size_t length = std::strlen(word);
|
|
Require(length >= 1);
|
|
for (std::size_t index = 0; index < length; ++index)
|
|
Require(std::isalnum(static_cast<unsigned char>(word[index])));
|
|
|
|
Require(sceKernelGetFsSandboxRandomWord() == word);
|
|
const char* fromThread = nullptr;
|
|
std::thread([&] { fromThread = sceKernelGetFsSandboxRandomWord(); }).join();
|
|
Require(fromThread == word);
|
|
|
|
const std::string path = std::string("/") + word + "/common/lib/libc.sprx";
|
|
*__error_nid_postfix() = 0;
|
|
Require(open_nid_postfix(path.c_str(), 0, 0) == -1);
|
|
Require(*__error_nid_postfix() == 2);
|
|
return 0;
|
|
}
|