Update APT::AppletUtility (#168)

* Update APT::AppletUtility

* Fix derp

* Update apt.cpp

* Update apt.cpp

* Update apt.cpp
This commit is contained in:
wheremyfoodat 2023-08-10 14:32:15 +03:00 committed by GitHub
parent 54ef53bb95
commit 4b2c0f42ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,8 @@
#include "ipc.hpp"
#include "kernel.hpp"
#include <vector>
namespace APTCommands {
enum : u32 {
GetLockHandle = 0x00010040,
@ -94,10 +96,24 @@ void APTService::appletUtility(u32 messagePointer) {
u32 outputSize = mem.read32(messagePointer + 12);
u32 inputPointer = mem.read32(messagePointer + 20);
log("APT::AppletUtility(utility = %d, input size = %x, output size = %x, inputPointer = %08X) (Stubbed)\n", utility, inputSize,
outputSize, inputPointer);
log("APT::AppletUtility(utility = %d, input size = %x, output size = %x, inputPointer = %08X) (Stubbed)\n", utility, inputSize, outputSize,
inputPointer);
std::vector<u8> out(outputSize);
const u32 outputBuffer = mem.read32(messagePointer + 0x104);
if (outputSize >= 1 && utility == 6) {
// TryLockTransition expects a bool indicating success in the output buffer. Set it to true to avoid games panicking (Thanks to Citra)
out[0] = true;
}
mem.write32(messagePointer, IPC::responseHeader(0x4B, 2, 2));
mem.write32(messagePointer + 4, Result::Success);
mem.write32(messagePointer + 8, Result::Success);
for (u32 i = 0; i < outputSize; i++) {
mem.write8(outputBuffer + i, out[i]);
}
}
void APTService::preloadLibraryApplet(u32 messagePointer) {