mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
scePsmlMfsrGetContextBufferRequirement1100, scePsmlMfsrCreateContext1100 and scePsmlMfsrGetDispatchMfsrPacket1100 were not exported, so a title importing them failed to load. In Sony's libScePsml all three return 0x8A810001 (not initialized) without writing their outputs until scePsmlMfsrInit has succeeded. AnyPS5's scePsmlMfsrInit throws, so that is the only state a title can reach, and the three calls now return that error. The existing stubs for scePsmlMfsrInit, scePsmlMfsrReleaseContext and scePsmlMfsrGetDispatchMfsrPacketSizeInDwords get their real names and still throw. libScePsml_debug gets a CMakeLists.txt for the new guest_psml test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.1 KiB
C++
54 lines
2.1 KiB
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
|
|
extern "C" {
|
|
std::int32_t APS5_VABI scePsmlMfsrGetContextBufferRequirement1100(void* requirement, const void* param);
|
|
std::int32_t APS5_VABI scePsmlMfsrCreateContext1100(void** context, const void* param);
|
|
std::int32_t APS5_VABI scePsmlMfsrGetDispatchMfsrPacket1100(void* context, void* commandBuffer, const void* param);
|
|
}
|
|
|
|
namespace {
|
|
|
|
void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
constexpr std::int32_t kErrNotInitialized = static_cast<std::int32_t>(0x8A810001);
|
|
|
|
struct CommandBuffer {
|
|
std::uint32_t* cursor;
|
|
std::uint32_t sizeInDwords;
|
|
};
|
|
|
|
}
|
|
|
|
int main() {
|
|
std::array<std::uint8_t, 0x158> param{};
|
|
|
|
std::array<std::uint8_t, 0x18> requirement;
|
|
requirement.fill(0xa5);
|
|
const auto untouchedRequirement = requirement;
|
|
Require(scePsmlMfsrGetContextBufferRequirement1100(requirement.data(), param.data()) == kErrNotInitialized);
|
|
Require(requirement == untouchedRequirement);
|
|
Require(scePsmlMfsrGetContextBufferRequirement1100(nullptr, nullptr) == kErrNotInitialized);
|
|
|
|
std::uint64_t contextStorage = 0;
|
|
void* const sentinel = &contextStorage;
|
|
void* context = sentinel;
|
|
Require(scePsmlMfsrCreateContext1100(&context, param.data()) == kErrNotInitialized);
|
|
Require(context == sentinel);
|
|
Require(scePsmlMfsrCreateContext1100(nullptr, nullptr) == kErrNotInitialized);
|
|
|
|
std::array<std::uint32_t, 64> dwords;
|
|
dwords.fill(0xa5a5a5a5u);
|
|
const auto untouchedDwords = dwords;
|
|
CommandBuffer commandBuffer{dwords.data(), static_cast<std::uint32_t>(dwords.size())};
|
|
Require(scePsmlMfsrGetDispatchMfsrPacket1100(&contextStorage, &commandBuffer, param.data()) == kErrNotInitialized);
|
|
Require(commandBuffer.cursor == dwords.data());
|
|
Require(commandBuffer.sizeInDwords == dwords.size());
|
|
Require(dwords == untouchedDwords);
|
|
Require(scePsmlMfsrGetDispatchMfsrPacket1100(nullptr, &commandBuffer, param.data()) == kErrNotInitialized);
|
|
Require(commandBuffer.cursor == dwords.data());
|
|
Require(dwords == untouchedDwords);
|
|
}
|