mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 08:33:12 -05:00
AnyPS5 resolves a title's imports by NID, so a title that imports a system function no library provides fails to load with an unresolved import. The PS5 3.20 export inventory lists 193 such exports across 37 PS5 system libraries AnyPS5 implements but does not provide. Declare them as throwing stubs so those titles load and reach their next blocker. Each declaration calls NotImplemented_nid_no_patch and returns 0; none of them implements the function. Declarations with a credible prototype use it and cite the source with a pinned commit, and the rest are declared without parameters, which resolves the import without making an ABI claim. The technical-debt files record the limitation per library. libSceMbus and libSceSystemService are left out because pull request #7821 declares them. libSceAgc is left out because its exports are versioned, so the 3.20 NID names a different symbol from the one AnyPS5 ships. libSceAvPlayer.native is left out because it compiles libSceAvPlayer's Export.cpp. Names and NIDs come from the PS5 3.20 export inventory at https://github.com/DNNDHH/PS5-3.20_Libs/tree/b2a77c09cd71c01f34c790cfbe98c751a13262ad
93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
#include <cstdint>
|
|
#include <cstddef>
|
|
#include <cstring>
|
|
#include "SceTypes.hpp"
|
|
#include "prx/libc/include/General.hpp"
|
|
|
|
namespace {
|
|
|
|
constexpr int COMMON_DIALOG_STATUS_NONE = 0;
|
|
constexpr int COMMON_DIALOG_STATUS_INITIALIZED = 1;
|
|
constexpr int COMMON_DIALOG_STATUS_FINISHED = 3;
|
|
constexpr int COMMON_DIALOG_RESULT_USER_CANCELED = 1;
|
|
constexpr int COMMON_DIALOG_ERROR_NOT_INITIALIZED = static_cast<int>(0x80B80003u);
|
|
constexpr int COMMON_DIALOG_ERROR_ALREADY_INITIALIZED = static_cast<int>(0x80B80004u);
|
|
constexpr int COMMON_DIALOG_ERROR_NOT_FINISHED = static_cast<int>(0x80B80006u);
|
|
constexpr int COMMON_DIALOG_ERROR_ARG_NULL = static_cast<int>(0x80B80009u);
|
|
|
|
int g_status = COMMON_DIALOG_STATUS_NONE;
|
|
|
|
}
|
|
|
|
extern "C" {
|
|
|
|
// The store dialog has nothing to show: every open finishes at once as cancelled by the user.
|
|
int APS5_VABI sceNpCommerceDialogInitialize() {
|
|
if (g_status != COMMON_DIALOG_STATUS_NONE) return COMMON_DIALOG_ERROR_ALREADY_INITIALIZED;
|
|
g_status = COMMON_DIALOG_STATUS_INITIALIZED;
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogOpen(const void* param) {
|
|
if (g_status == COMMON_DIALOG_STATUS_NONE) return COMMON_DIALOG_ERROR_NOT_INITIALIZED;
|
|
if (param == nullptr) return COMMON_DIALOG_ERROR_ARG_NULL;
|
|
g_status = COMMON_DIALOG_STATUS_FINISHED;
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogUpdateStatus(void) {
|
|
return g_status;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogGetStatus(void) {
|
|
return g_status;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogGetResult(void* result) {
|
|
if (result == nullptr) return COMMON_DIALOG_ERROR_ARG_NULL;
|
|
if (g_status != COMMON_DIALOG_STATUS_FINISHED) return COMMON_DIALOG_ERROR_NOT_FINISHED;
|
|
// SceNpCommerceDialogResult: int32 result, bool authorized, then reserved bytes.
|
|
std::int32_t value = COMMON_DIALOG_RESULT_USER_CANCELED;
|
|
std::memcpy(result, &value, sizeof(value));
|
|
std::uint8_t authorized = 0;
|
|
std::memcpy(static_cast<std::uint8_t*>(result) + sizeof(value), &authorized, sizeof(authorized));
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogClose(void) {
|
|
if (g_status == COMMON_DIALOG_STATUS_NONE) return COMMON_DIALOG_ERROR_NOT_INITIALIZED;
|
|
g_status = COMMON_DIALOG_STATUS_FINISHED;
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogTerminate() {
|
|
g_status = COMMON_DIALOG_STATUS_NONE;
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceHidePsStoreIcon(void) {
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceShowPsStoreIcon(int pos) {
|
|
(void)pos;
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceSetPsStoreIconLayout(int layout) {
|
|
(void)layout;
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogOpen2(void) {
|
|
g_status = COMMON_DIALOG_STATUS_FINISHED;
|
|
return 0;
|
|
}
|
|
|
|
int APS5_VABI sceNpCommerceDialogInitializeInternal() {
|
|
NotImplemented_nid_no_patch(__func__);
|
|
return 0;
|
|
}
|
|
|
|
}
|