Files
AnyPS5/core/libs/tests/GuestNpWebApi2.cpp
T
8a7e1195d4 feat(exports): export the calls PPSA01317 imports
Gran Turismo 7 (PPSA01317) fails to load on unresolved imports and on
two needed libraries that AnyPS5 does not build (#4782).

- sceAppContentDownloadDataFormat empties /download0, as
  sceAppContentTemporaryDataFormat does for /temp0.
- sceNpAuthSetTimeout returns REQUEST_NOT_FOUND for an unknown request
  like the other request calls, and OK otherwise; no request reaches the
  network the timeouts would bound.
- sceNpWebApi2PushEventSetHandleTimeout throws for an unknown library
  context, like sceNpWebApi2GetMemoryPoolStats, and returns OK
  otherwise; push event handles are not tracked and nothing waits on
  one offline.
- sceSslDisableVerifyOption, sceSslGetAlpnSelected, sceSslSetAlpn,
  sceSslSetMinSslVersion, sceAudioOutDeviceIdOpen and the unnamed
  libScePsml NIDs xNZM9Y5lf-M and lcZD9tJraAw are declared without
  parameters and throw; their signatures are unknown.
- libSceUsbStorage and libSceUsbStorageDialog exist with no exports,
  like libSceXml: the title lists both as needed but imports nothing
  from them.

Each assumption is recorded in the library's technical debt file.

Co-authored-by: dawid-swiecicki <8942606+dawid-swiecicki@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 01:11:29 +02:00

52 lines
1.8 KiB
C++

#include "SceTypes.hpp"
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <stdexcept>
struct NpWebApi2MemoryPoolStats {
std::size_t pool_size;
std::size_t max_inuse_size;
std::size_t current_inuse_size;
std::int32_t reserved;
};
extern "C" {
int APS5_VABI sceNpWebApi2Initialize(int, std::size_t);
int APS5_VABI sceNpWebApi2Terminate(int);
int APS5_VABI sceNpWebApi2GetMemoryPoolStats(int, NpWebApi2MemoryPoolStats*);
int APS5_VABI sceNpWebApi2PushEventCreateHandle(int);
int APS5_VABI sceNpWebApi2PushEventSetHandleTimeout(int, int, std::uint32_t);
}
static void Require(bool value) { if (!value) std::abort(); }
template <typename TCall>
static bool Throws(TCall call) {
try {
call();
} catch (const std::exception&) {
return true;
}
return false;
}
int main() {
const int context = sceNpWebApi2Initialize(1, 0x20000);
const int other = sceNpWebApi2Initialize(1, 0x8000);
Require(context > 0 && other > 0 && context != other);
NpWebApi2MemoryPoolStats stats{1, 1, 1, 1};
Require(sceNpWebApi2GetMemoryPoolStats(context, &stats) == 0);
Require(stats.pool_size == 0x20000 && stats.max_inuse_size == 0 && stats.current_inuse_size == 0 && stats.reserved == 0);
Require(sceNpWebApi2GetMemoryPoolStats(other, &stats) == 0 && stats.pool_size == 0x8000);
Require(Throws([&] { sceNpWebApi2GetMemoryPoolStats(context, nullptr); }));
const int handle = sceNpWebApi2PushEventCreateHandle(context);
Require(handle > 0);
Require(sceNpWebApi2PushEventSetHandleTimeout(context, handle, 30000) == 0);
Require(sceNpWebApi2Terminate(context) == 0);
Require(Throws([&] { sceNpWebApi2GetMemoryPoolStats(context, &stats); }));
Require(Throws([&] { sceNpWebApi2PushEventSetHandleTimeout(context, handle, 30000); }));
Require(sceNpWebApi2Terminate(other) == 0);
return 0;
}