mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 08:33:12 -05:00
UFC 6 (PPSA23566) imports both. Initialization marks the library initialized and termination clears it, as in shadPS4. Termination without initialization and a second initialization throw, since no PS5 source settles their results. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit d2866a886a7702cdaad56d161460a3ce86ede629)
25 lines
618 B
C++
25 lines
618 B
C++
#include "prx/libc/include/General.hpp"
|
|
#include <atomic>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
namespace {
|
|
std::atomic<bool> g_initialized{false};
|
|
}
|
|
|
|
extern "C" {
|
|
|
|
int APS5_VABI sceNpEAAccessInitialize(void) {
|
|
bool expected = false;
|
|
if (!g_initialized.compare_exchange_strong(expected, true)) throw std::logic_error(std::string(__func__) + ": already initialized");
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpEAAccessTerminate(void) {
|
|
bool expected = true;
|
|
if (!g_initialized.compare_exchange_strong(expected, false)) throw std::logic_error(std::string(__func__) + ": not initialized");
|
|
return 0;
|
|
}
|
|
|
|
}
|