commit 42296ddcbdd8bf499a4de9816320357cfe537f4b Author: Cody Brocious Date: Thu Sep 21 20:38:04 2017 -0600 Initial commit. Mephisto lives. diff --git a/Cpu.cpp b/Cpu.cpp new file mode 100644 index 0000000..04f1898 --- /dev/null +++ b/Cpu.cpp @@ -0,0 +1,333 @@ +#include "Ctu.h" + +void intrHook(uc_engine *uc, uint32_t intNo, void *user_data) { + ((Cpu *) user_data)->interruptHook(intNo); +} + +bool unmpdHook(uc_engine *uc, uc_mem_type type, gptr addr, int size, guint value, void *user_data) { + return ((Cpu *) user_data)->unmappedHook(type, addr, size, value); +} + +void mmioHook(uc_engine *uc, uc_mem_type type, gptr address, int size, gptr value, void *user_data) { + gptr physicalAddress = ((Cpu *) user_data)->mmioHandler->getPhysicalAddressFromVirtual(address); + MmioBase *mmio = ((Cpu *) user_data)->mmioHandler->getMMIOFromPhysicalAddress(address); + assert(mmio != nullptr); + switch(type) { + case UC_MEM_READ: + LOG_DEBUG(Cpu, "MMIO Read at " ADDRFMT " size %x", physicalAddress, size); + ((Cpu *) user_data)->readmem(address, &value, size); + LOG_DEBUG(Cpu, "Stored value %x", (int) ((Cpu *) user_data)->read8(address)); + break; + case UC_MEM_WRITE: + LOG_DEBUG(Cpu, "MMIO Write at " ADDRFMT " size %x data %lx", physicalAddress, size, value); + /*if() { + ((Cpu *) user_data)->writemem(address, &value, size); + }*/ + //mmio->swrite(physicalAddress, size, &value); + ((Cpu *) user_data)->writemem(address, &value, size); + break; + } +} + +void codeBpHook(uc_engine *uc, uint64_t address, uint32_t size, void *user_data) { + auto ctu = (Ctu *) user_data; + cout << "Hit breakpoint at ... " << hex << address << endl; + auto thread = ctu->tm.current(); + assert(thread != nullptr); + ctu->tm.requeue(); + thread->regs.PC = address; + ctu->cpu.stop(); + ctu->gdbStub._break(); +} + +Cpu::Cpu(Ctu *_ctu) : ctu(_ctu) { + CHECKED(uc_open(UC_ARCH_ARM64, UC_MODE_ARM, &uc)); + + CHECKED(uc_mem_map(uc, TERMADDR, 0x1000, UC_PROT_ALL)); + guestptr(TERMADDR) = 0xd503201f; // nop + + auto fpv = 3 << 20; + CHECKED(uc_reg_write(uc, UC_ARM64_REG_CPACR_EL1, &fpv)); + + uc_hook hookHandle; + CHECKED(uc_hook_add(uc, &hookHandle, UC_HOOK_INTR, (void *) intrHook, this, 0, -1)); + CHECKED(uc_hook_add(uc, &hookHandle, UC_HOOK_MEM_INVALID, (void *) unmpdHook, this, 0, -1)); + + for(auto i = 0; i < 0x80; ++i) + svcHandlers[i] = nullptr; +} + +Cpu::~Cpu() { + CHECKED(uc_close(uc)); +} + +guint Cpu::call(gptr _pc, guint x0, guint x1, guint x2, guint x3) { + reg(0, x0); + reg(1, x1); + reg(2, x2); + reg(3, x3); + reg(30, TERMADDR); + CHECKED(uc_emu_start(uc, _pc, TERMADDR + 4, 0, 0)); + return reg(0); +} + +void Cpu::setMmio(Mmio *_mmioHandler) { + mmioHandler = _mmioHandler; + uc_hook hookHandle; + CHECKED(uc_hook_add(uc, &hookHandle, UC_HOOK_MEM_READ, (void *)mmioHook, this, mmioHandler->GetBase(), mmioHandler->GetBase()+mmioHandler->GetSize() )); + CHECKED(uc_hook_add(uc, &hookHandle, UC_HOOK_MEM_WRITE, (void *)mmioHook, this, mmioHandler->GetBase(), mmioHandler->GetBase()+mmioHandler->GetSize() )); +} + +void Cpu::exec(size_t insnCount) { + CHECKED(uc_emu_start(uc, pc(), TERMADDR + 4, 0, insnCount)); +} + +void Cpu::stop() { + CHECKED(uc_emu_stop(uc)); +} + +bool Cpu::map(gptr addr, guint size) { + CHECKED(uc_mem_map(uc, addr, size, UC_PROT_ALL)); + auto temp = new uint8_t[size]; + memset(temp, 0, size); + writemem(addr, temp, size); + delete[] temp; + return true; +} + +bool Cpu::unmap(gptr addr, guint size) { + CHECKED(uc_mem_unmap(uc, addr, size)); + return true; +} + +list> Cpu::regions() { + list> ret; + + uc_mem_region *regions; + uint32_t count; + + CHECKED(uc_mem_regions(uc, ®ions, &count)); + list> temp; + for(auto i = 0; i < count; ++i) { + auto region = regions[i]; + temp.push_back(make_tuple(region.begin, region.end)); + } + uc_free(regions); + + temp.sort([](auto a, auto b) { auto [ab, _] = a; auto [bb, __] = b; return ab < bb; }); + + gptr last = 0; + for(auto [begin, end] : temp) { + if(last != begin) + ret.push_back(make_tuple(last, begin - 1, -1)); + ret.push_back(make_tuple(begin, end, 0)); + last = end + 1; + } + + if(last != 0xFFFFFFFFFFFFFFFF) + ret.push_back(make_tuple(last, 0xFFFFFFFFFFFFFFFF, -1)); + + return ret; +} + +bool Cpu::readmem(gptr addr, void *dest, guint size) { + return uc_mem_read(uc, addr, dest, size) == UC_ERR_OK; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +void Cpu::dumpmem(gptr addr, guint size) { + char *data = (char*)malloc(size); + memset(data, 0, size); + readmem(addr, data, size); + + auto hfmt = "%08lx | "; + if((addr + size) & 0xFFFF000000000000) + hfmt = "%016lx | "; + else if((addr + size) & 0xFFFFFFFF00000000) + hfmt = "%012lx | "; + + for(uint32_t i = 0; i < size; i += 16) { + printf(hfmt, addr+i); + string ascii = ""; + for(uint8_t j = 0; j < 16; j++) { + if((i+j) < size) { + printf("%02x ", (uint8_t)data[i+j]); + if(isprint(data[i+j])) + ascii += data[i+j]; + else + ascii += "."; + } else { + printf(" "); + ascii += " "; + } + if(j==7) { + printf(" "); + ascii += " "; + } + } + printf("| %s\n", ascii.c_str()); + } + + free(data); +} +#pragma clang diagnostic pop + +guchar Cpu::read8(gptr addr) { + return *guestptr(addr); +} + +std::string Cpu::readstring(gptr addr) { + std::string out; + uint32_t offset = 0; + while(guchar c = read8(addr+offset)) { + if(c == 0) + break; + out += c; + offset++; + } + return out; +} + +bool Cpu::writemem(gptr addr, void *src, guint size) { + return uc_mem_write(uc, addr, src, size) == UC_ERR_OK; +} + +gptr Cpu::pc() { + gptr val; + CHECKED(uc_reg_read(uc, UC_ARM64_REG_PC, &val)); + return val; +} + +void Cpu::pc(gptr val) { + CHECKED(uc_reg_write(uc, UC_ARM64_REG_PC, &val)); +} + +guint Cpu::reg(uint regn) { + guint val; + auto treg = UC_ARM64_REG_SP; + if(regn <= 28) + treg = (uc_arm64_reg) (UC_ARM64_REG_X0 + regn); + else if(regn < 31) + treg = (uc_arm64_reg) (UC_ARM64_REG_X29 + regn - 29); + CHECKED(uc_reg_read(uc, treg, &val)); + return val; +} + +void Cpu::reg(uint regn, guint val) { + auto treg = UC_ARM64_REG_SP; + if(regn <= 28) + treg = (uc_arm64_reg) (UC_ARM64_REG_X0 + regn); + else if(regn < 31) + treg = (uc_arm64_reg) (UC_ARM64_REG_X29 + regn - 29); + CHECKED(uc_reg_write(uc, treg, &val)); +} + +void Cpu::loadRegs(ThreadRegisters ®s) { + int uregs[32]; + void *tregs[32]; + + CHECKED(uc_reg_write(uc, UC_ARM64_REG_SP, ®s.SP)); + CHECKED(uc_reg_write(uc, UC_ARM64_REG_PC, ®s.PC)); + CHECKED(uc_reg_write(uc, UC_ARM64_REG_NZCV, ®s.NZCV)); + + for(auto i = 0; i < 29; ++i) { + uregs[i] = UC_ARM64_REG_X0 + i; + tregs[i] = ®s.gprs[i]; + } + CHECKED(uc_reg_write_batch(uc, uregs, tregs, 29)); + CHECKED(uc_reg_write(uc, UC_ARM64_REG_X29, ®s.X29)); + CHECKED(uc_reg_write(uc, UC_ARM64_REG_X30, ®s.X30)); + + for(auto i = 0; i < 32; ++i) { + uregs[i] = UC_ARM64_REG_Q0 + i; + tregs[i] = ®s.fprs[i]; + } + CHECKED(uc_reg_write_batch(uc, uregs, tregs, 32)); +} + +void Cpu::storeRegs(ThreadRegisters ®s) { + int uregs[32]; + void *tregs[32]; + + CHECKED(uc_reg_read(uc, UC_ARM64_REG_SP, ®s.SP)); + CHECKED(uc_reg_read(uc, UC_ARM64_REG_PC, ®s.PC)); + CHECKED(uc_reg_read(uc, UC_ARM64_REG_NZCV, ®s.NZCV)); + + for(auto i = 0; i < 29; ++i) { + uregs[i] = UC_ARM64_REG_X0 + i; + tregs[i] = ®s.gprs[i]; + } + CHECKED(uc_reg_read_batch(uc, uregs, tregs, 29)); + CHECKED(uc_reg_read(uc, UC_ARM64_REG_X29, ®s.X29)); + CHECKED(uc_reg_read(uc, UC_ARM64_REG_X30, ®s.X30)); + + for(auto i = 0; i < 32; ++i) { + uregs[i] = UC_ARM64_REG_Q0 + i; + tregs[i] = ®s.fprs[i]; + } + CHECKED(uc_reg_read_batch(uc, uregs, tregs, 32)); +} + +gptr Cpu::tlsBase() { + gptr base; + CHECKED(uc_reg_read(uc, UC_ARM64_REG_TPIDRRO_EL0, &base)); + return base; +} + +void Cpu::tlsBase(gptr base) { + CHECKED(uc_reg_write(uc, UC_ARM64_REG_TPIDRRO_EL0, &base)); +} + +void Cpu::interruptHook(uint32_t intNo) { + uint32_t esr; + CHECKED(uc_reg_read(uc, UC_ARM64_REG_ESR, &esr)); + auto ec = esr >> 26; + auto iss = esr & 0xFFFFFF; + switch(ec) { + case 0x15: // SVC + if(iss >= 0x80 || svcHandlers[iss] == nullptr) + LOG_ERROR(Cpu, "Unhandled SVC 0x%02x", iss); + svcHandlers[iss](this); + break; + } +} + +bool Cpu::unmappedHook(uc_mem_type type, gptr addr, int size, guint value) { + cout << "!!!!!!!!!!!!!!!!!!!!!!!! Unmapped !!!!!!!!!!!!!!!!!!!!!!!" << endl; + switch(type) { + case UC_MEM_READ_UNMAPPED: + case UC_MEM_READ_PROT: + LOG_INFO(Cpu, "Attempted to read from %s memory at " ADDRFMT " from " ADDRFMT, (type == UC_MEM_READ_UNMAPPED ? "unmapped" : "protected"), addr, pc()); + break; + case UC_MEM_FETCH_UNMAPPED: + case UC_MEM_FETCH_PROT: + LOG_INFO(Cpu, "Attempted to fetch from %s memory at " ADDRFMT " from " ADDRFMT, (type == UC_MEM_READ_UNMAPPED ? "unmapped" : "protected"), addr, pc()); + break; + case UC_MEM_WRITE_UNMAPPED: + case UC_MEM_WRITE_PROT: + LOG_INFO(Cpu, "Attempted to write to %s memory at " ADDRFMT " from " ADDRFMT, (type == UC_MEM_READ_UNMAPPED ? "unmapped" : "protected"), addr, pc()); + break; + } + return false; +} + +void Cpu::registerSvcHandler(int num, std::function handler) { + registerSvcHandler(num, [=](auto _) { handler(); }); +} + +void Cpu::registerSvcHandler(int num, std::function handler) { + svcHandlers[num] = handler; +} + +hook_t Cpu::addCodeBreakpoint(gptr addr) { + assert(ctu->gdbStub.enabled); + + hook_t hookHandle; + CHECKED(uc_hook_add(uc, &hookHandle, UC_HOOK_CODE, (void *)codeBpHook, ctu, addr, addr + 2)); + return hookHandle; +} + +void Cpu::removeCodeBreakpoint(hook_t hook) { + CHECKED(uc_hook_del(uc, hook)); +} diff --git a/Cpu.h b/Cpu.h new file mode 100644 index 0000000..45b8d73 --- /dev/null +++ b/Cpu.h @@ -0,0 +1,100 @@ +#pragma once +#include "Ctu.h" +#include + +typedef uc_hook hook_t; + +#define CHECKED(expr) do { if(auto _cerr = (expr)) { printf("Call " #expr " failed with error: %u (%s)\n", _cerr, uc_strerror(_cerr)); exit(1); } } while(0) + +template class Guest; + +class Cpu { +public: + Cpu(Ctu *_ctu); + ~Cpu(); + + uint64_t call(gptr addr, uint64_t x0=0, uint64_t x1=0, uint64_t x2=0, uint64_t x3=0); + void exec(size_t insnCount=0); + void stop(); + + bool map(gptr addr, guint size); + bool unmap(gptr addr, guint size); + list> regions(); + bool readmem(gptr addr, void *dest, guint size); + guchar read8(gptr addr); + void dumpmem(gptr addr, guint size); + std::string readstring(gptr addr); + bool writemem(gptr addr, void *src, guint size); + + gptr pc(); + void pc(gptr val); + guint reg(uint reg); + void reg(uint reg, guint val); + + void loadRegs(ThreadRegisters ®s); + void storeRegs(ThreadRegisters ®s); + + gptr tlsBase(); + void tlsBase(gptr base); + + template Guest guestptr(gptr addr) { + Guest ret(this, addr); + return ret; + } + + void registerSvcHandler(int num, std::function handler); + void registerSvcHandler(int num, std::function handler); + + hook_t addCodeBreakpoint(gptr addr); + void removeCodeBreakpoint(hook_t hook); + + void interruptHook(uint32_t intNo); + bool unmappedHook(uc_mem_type type, gptr addr, int size, guint value); + + void setMmio(Mmio *_mmioHandler);// { mmioHandler = _mmioHandler; } + Mmio *mmioHandler; + +private: + Ctu *ctu; + uc_engine *uc; + std::function svcHandlers[0x80]; +}; + +template +class Guest { +public: + Guest(Cpu *cpu, gptr addr) : cpu(cpu), addr(addr) { + } + + const T& operator*() { + cpu->readmem(addr, &store, sizeof(T)); + return store; + } + + T* operator->() { + cpu->readmem(addr, &store, sizeof(T)); + return &store; + } + + Guest &operator=(const T &v) { + cpu->writemem(addr, (void *) &v, sizeof(T)); + return *this; + } + + const T &operator[](int i) { + return *Guest(cpu, addr + i * sizeof(T)); + } + + Guest operator+(const int &i) { + return Guest(cpu, addr + i * sizeof(T)); + } + + void writeback() { + cpu->writemem(addr, &store, sizeof(T)); + } + +private: + Cpu *cpu; + gptr addr; + T store; +}; diff --git a/Ctu.cpp b/Ctu.cpp new file mode 100644 index 0000000..a9f2b20 --- /dev/null +++ b/Ctu.cpp @@ -0,0 +1,37 @@ +#include "Ctu.h" + +LogLevel g_LogLevel = Info; + +Ctu::Ctu() : cpu(this), svc(this), ipc(this), tm(this), mmiohandler(this), bridge(this), gdbStub(this), handleId(0xde00), heapsize(0x0) { + handles[0xffff8001] = make_shared(this); +} + +void Ctu::execProgram(gptr ep) { + auto sp = 7 << 24; + auto ss = 8 * 1024 * 1024; + + cpu.map(sp - ss, ss); + cpu.setMmio(&mmiohandler); + mmiohandler.MMIOInitialize(); + + auto mainThread = tm.create(ep, sp); + mainThread->regs.X1 = mainThread->handle; + mainThread->resume(); + + tm.start(); +} + +ghandle Ctu::duplicateHandle(KObject *ptr) { + for(auto elem : handles) + if(elem.second.get() == ptr) + return newHandle(elem.second); + return 0; +} + +void Ctu::deleteHandle(ghandle handle) { + if(handles.find(handle) != handles.end()) { + auto hnd = getHandle(handle); + handles.erase(handle); + hnd->close(); + } +} diff --git a/Ctu.h b/Ctu.h new file mode 100644 index 0000000..afcf74a --- /dev/null +++ b/Ctu.h @@ -0,0 +1,171 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +typedef __int128_t int128_t; +typedef __uint128_t uint128_t; +typedef float float32_t; +typedef double float64_t; +typedef uint64_t gptr; +typedef uint64_t guint; +typedef uint8_t guchar; +typedef uint16_t gushort; +typedef uint32_t ghandle; +typedef uint64_t gpid; +const gptr TERMADDR = 1ULL << 61; + +#define FOURCC(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | (a)) + +#define ADDRFMT "%016lx" +#define LONGFMT "%lx" + +enum LogLevel { + None = 0, + Error = 1, + Warn = 2, + Debug = 3, + Info = 4 +}; + +extern LogLevel g_LogLevel; + +#define LOG_ERROR(module, msg, ...) do { \ + if(g_LogLevel >= Error) { \ + fprintf(stderr, "[" #module "] ERROR: " msg "\n", ##__VA_ARGS__); \ + cerr << endl; \ + } \ + exit(1); \ +} while(0) +#define LOG_INFO(module, msg, ...) do { \ + if(g_LogLevel >= Info) { \ + printf("[" #module "] INFO: " msg, ##__VA_ARGS__); \ + cout << endl; \ + } \ +} while(0) +#define LOG_DEBUG(module, msg, ...) do { \ + if(g_LogLevel >= Debug) { \ + printf("[" #module "] DEBUG: " msg, ##__VA_ARGS__); \ + cout << endl; \ + } \ +} while(0) + +class Ctu; + +#include "optionparser.h" +#include "Lisparser.h" +#include "KObject.h" +#include "ThreadManager.h" +#include "Mmio.h" +#include "Cpu.h" +#include "Sync.h" +#include "Svc.h" +#include "Ipc.h" +#include "Nxo.h" +#include "IpcBridge.h" +#include "GdbStub.h" + +template +void hexdump(shared_ptr> buf, unsigned long count=N) { + if(g_LogLevel < Debug) + return; + + for(auto i = 0; i < count; i += 16) { + printf("%04x | ", i); + for(auto j = 0; j < 16; ++j) { + printf("%02x ", buf->data()[i + j]); + if(j == 7) + printf(" "); + } + printf("| "); + for(auto j = 0; j < 16; ++j) { + auto val = buf->data()[i + j]; + if(isprint(val)) + printf("%c", val); + else + printf("."); + if(j == 7) + printf(" "); + } + printf("\n"); + } + printf("%04x\n", (int) count); +} + +class Ctu { +public: + Ctu(); + void execProgram(gptr ep); + + template + ghandle newHandle(shared_ptr obj) { + static_assert(std::is_base_of::value, "T must derive from KObject"); + auto hnd = handleId++; + handles[hnd] = dynamic_pointer_cast(obj); + return hnd; + } + template + shared_ptr getHandle(ghandle handle) { + static_assert(std::is_base_of::value, "T must derive from KObject"); + if(handles.find(handle) == handles.end()) + LOG_ERROR(Ctu, "Could not find handle with ID 0x%x !", handle); + auto obj = handles[handle]; + auto faux = dynamic_pointer_cast(obj); + if(faux != nullptr) + LOG_ERROR(Ctu, "Accessing faux handle! 0x%x", faux->val); + auto temp = dynamic_pointer_cast(obj); + if(temp == nullptr) + LOG_ERROR(Ctu, "Got null pointer after cast. Before: 0x%p", (void *) obj.get()); + return temp; + } + ghandle duplicateHandle(KObject *ptr); + void deleteHandle(ghandle handle); + + Mmio mmiohandler; + Cpu cpu; + Svc svc; + Ipc ipc; + ThreadManager tm; + IpcBridge bridge; + GdbStub gdbStub; + + guint heapsize; + gptr loadbase, loadsize; + +private: + ghandle handleId; + unordered_map> handles; +}; + +#include "IpcStubs.h" diff --git a/GdbStub.cpp b/GdbStub.cpp new file mode 100644 index 0000000..874d664 --- /dev/null +++ b/GdbStub.cpp @@ -0,0 +1,720 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +// Originally written by Sven Peter for anergistic. +// Integrated into Mephisto/CTUv2 by Cody Brocious + +#include "Ctu.h" + +const char GDB_STUB_START = '$'; +const char GDB_STUB_END = '#'; +const char GDB_STUB_ACK = '+'; +const char GDB_STUB_NACK = '-'; + +#ifndef SIGTRAP +const uint32_t SIGTRAP = 5; +#endif + +#ifndef SIGTERM +const uint32_t SIGTERM = 15; +#endif + +#ifndef MSG_WAITALL +const uint32_t MSG_WAITALL = 8; +#endif + +// For sample XML files see the GDB source /gdb/features +// GDB also wants the l character at the start +// This XML defines what the registers are for this specific ARM device +static const char* target_xml = + R"( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +)"; + +uint8_t hexCharToValue(uint8_t hex) { + if(hex >= '0' && hex <= '9') + return hex - '0'; + else if(hex >= 'a' && hex <= 'f') + return hex - 'a' + 0xA; + else if(hex >= 'A' && hex <= 'F') + return hex - 'A' + 0xA; + + LOG_ERROR(GdbStub, "Invalid nibble: %c (%02x)", hex, hex); +} + +uint8_t nibbleToHex(uint8_t n) { + n &= 0xF; + if(n < 0xA) + return '0' + n; + else + return 'A' + n - 0xA; +} + +uint64_t hexToInt(const uint8_t* src, size_t len) { + uint64_t output = 0; + while(len-- > 0) { + output = (output << 4) | hexCharToValue(src[0]); + src++; + } + return output; +} + +void memToGdbHex(uint8_t* dest, const uint8_t* src, size_t len) { + while(len-- > 0) { + auto tmp = *src++; + *dest++ = nibbleToHex(tmp >> 4); + *dest++ = nibbleToHex(tmp); + } +} + +void gdbHexToMem(uint8_t* dest, const uint8_t* src, size_t len) { + while(len-- > 0) { + *dest++ = (uint8_t) ((hexCharToValue(src[0]) << 4) | hexCharToValue(src[1])); + src += 2; + } +} + +void intToGdbHex(uint8_t* dest, uint64_t v) { + for(auto i = 0; i < 16; i += 2) { + dest[i + 1] = nibbleToHex((uint8_t) (v >> (4 * i))); + dest[i] = nibbleToHex((uint8_t) (v >> (4 * (i + 1)))); + } +} + +uint64_t gdbHexToInt(const uint8_t* src) { + uint64_t output = 0; + + for(int i = 0; i < 16; i += 2) { + output = (output << 4) | hexCharToValue(src[15 - i - 1]); + output = (output << 4) | hexCharToValue(src[15 - i]); + } + + return output; +} + +uint8_t calculateChecksum(const uint8_t* buffer, size_t length) { + return static_cast(accumulate(buffer, buffer + length, 0, plus())); +} + +GdbStub::GdbStub(Ctu *_ctu) : ctu(_ctu) { + memoryBreak = false; + haltLoop = stepLoop = false; + enabled = false; + latestSignal = 0; +} + +void GdbStub::enable(uint16_t port) { + LOG_INFO(GdbStub, "Starting GDB server on port %d...", port); + + sockaddr_in saddr_server = {}; + saddr_server.sin_family = AF_INET; + saddr_server.sin_port = htons(port); + saddr_server.sin_addr.s_addr = INADDR_ANY; + + auto tmpsock = socket(PF_INET, SOCK_STREAM, 0); + if(tmpsock == -1) + LOG_ERROR(GdbStub, "Failed to create gdb socket"); + + auto reuse_enabled = 1; + if(setsockopt(tmpsock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse_enabled, sizeof(reuse_enabled)) < 0) + LOG_ERROR(GdbStub, "Failed to set gdb socket option"); + + auto server_addr = reinterpret_cast(&saddr_server); + socklen_t server_addrlen = sizeof(saddr_server); + if(bind(tmpsock, server_addr, server_addrlen) < 0) + LOG_ERROR(GdbStub, "Failed to bind gdb socket"); + + if(listen(tmpsock, 1) < 0) + LOG_ERROR(GdbStub, "Failed to listen to gdb socket"); + + LOG_INFO(GdbStub, "Waiting for gdb to connect..."); + sockaddr_in saddr_client; + sockaddr* client_addr = reinterpret_cast(&saddr_client); + socklen_t client_addrlen = sizeof(saddr_client); + client = accept(tmpsock, client_addr, &client_addrlen); + if(client < 0) + LOG_ERROR(GdbStub, "Failed to accept gdb client"); + else + LOG_INFO(GdbStub, "Client connected."); + + enabled = true; + haltLoop = true; +} + +uint8_t GdbStub::readByte() { + uint8_t c; + auto size = recv(client, reinterpret_cast(&c), 1, MSG_WAITALL); + if(size != 1) + LOG_ERROR(GdbStub, "recv failed : %ld", size); + + return c; +} + +guint GdbStub::reg(int x) { + auto thread = ctu->tm.current(); + if(thread == nullptr) + thread = ctu->tm.last(); + if(thread == nullptr) + return 0; + switch(x) { + case 31: + return thread->regs.SP; + case 32: + return thread->regs.PC; + default: + assert(x < 31); + return thread->regs.gprs[x]; + } +} + +void GdbStub::reg(int x, guint v) { + auto thread = ctu->tm.current(); + if(thread == nullptr) + thread = ctu->tm.last(); + if(thread == nullptr) + return; + switch(x) { + case 31: + thread->regs.SP = v; + break; + case 32: + thread->regs.PC = v; + break; + default: + assert(x < 31); + thread->regs.gprs[x] = v; + } +} + +auto& GdbStub::getBreakpointList(BreakpointType type) { + switch(type) { + case BreakpointType::Execute: + return breakpointsExecute; + case BreakpointType::Write: + return breakpointsWrite; + case BreakpointType::Read: + case BreakpointType::Access: + case BreakpointType::None: // Should never happen + return breakpointsRead; + } +} + +void GdbStub::removeBreakpoint(BreakpointType type, gptr addr) { + auto& p = getBreakpointList(type); + + auto bp = p.find(addr); + if(bp != p.end()) { + LOG_DEBUG(GdbStub, "gdb: removed a breakpoint: %016lx bytes at %016lx of type %d", + bp->second.len, bp->second.addr, type); + ctu->cpu.removeCodeBreakpoint(bp->second.hook); + p.erase(addr); + } +} + +auto GdbStub::getNextBreakpointFromAddress(gptr addr, BreakpointType type) { + auto& p = getBreakpointList(type); + auto next_breakpoint = p.lower_bound(addr); + BreakpointAddress breakpoint; + + if(next_breakpoint != p.end()) { + breakpoint.address = next_breakpoint->first; + breakpoint.type = type; + } else { + breakpoint.address = 0; + breakpoint.type = BreakpointType::None; + } + + return breakpoint; +} + +bool GdbStub::checkBreakpoint(gptr addr, BreakpointType type) { + auto& p = getBreakpointList(type); + + auto bp = p.find(addr); + if(bp != p.end()) { + guint len = bp->second.len; + + if(bp->second.active && (addr >= bp->second.addr && addr < bp->second.addr + len)) { + LOG_DEBUG(GdbStub, + "Found breakpoint type %d @ %016lx, range: %016lx - %016lx (%d bytes)", type, + addr, bp->second.addr, bp->second.addr + len, (uint32_t) len); + return true; + } + } + + return false; +} + +void GdbStub::sendPacket(const char packet) { + if(send(client, &packet, 1, 0) != 1) + LOG_ERROR(GdbStub, "send failed"); +} + +void GdbStub::sendReply(const char* reply) { + memset(commandBuffer, 0, sizeof(commandBuffer)); + + commandLength = static_cast(strlen(reply)); + if(commandLength + 4 > sizeof(commandBuffer)) { + LOG_DEBUG(GdbStub, "commandBuffer overflow in sendReply"); + return; + } + + memcpy(commandBuffer + 1, reply, commandLength); + + auto checksum = calculateChecksum(commandBuffer, commandLength + 1); + commandBuffer[0] = GDB_STUB_START; + commandBuffer[commandLength + 1] = GDB_STUB_END; + commandBuffer[commandLength + 2] = nibbleToHex(checksum >> 4); + commandBuffer[commandLength + 3] = nibbleToHex(checksum); + + auto ptr = commandBuffer; + auto left = commandLength + 4; + while(left > 0) { + auto sent_size = send(client, reinterpret_cast(ptr), left, 0); + if(sent_size < 0) + LOG_ERROR(GdbStub, "gdb: send failed"); + + left -= sent_size; + ptr += sent_size; + } +} + +void GdbStub::handleQuery() { + LOG_DEBUG(GdbStub, "gdb: query '%s'", commandBuffer + 1); + + auto query = reinterpret_cast(commandBuffer + 1); + + if(strcmp(query, "TStatus") == 0) + sendReply("T0"); + else if(strncmp(query, "Supported", strlen("Supported")) == 0) + sendReply("PacketSize=1600"); + else if(strncmp(query, "Xfer:features:read:target.xml:", + strlen("Xfer:features:read:target.xml:")) == 0) + sendReply(target_xml); + else + sendReply(""); +} + +void GdbStub::handleSetThread() { + if(memcmp(commandBuffer, "Hg0", 3) == 0 || memcmp(commandBuffer, "Hc-1", 4) == 0 || + memcmp(commandBuffer, "Hc0", 4) == 0 || memcmp(commandBuffer, "Hc1", 4) == 0) + return sendReply("OK"); + + sendReply("E01"); +} + +auto stringFromFormat(const char* format, ...) { + char *buf; + va_list args; + va_start(args, format); + if(vasprintf(&buf, format, args) < 0) + LOG_ERROR(GdbStub, "Unable to allocate memory for string"); + va_end(args); + + string ret = buf; + free(buf); + return ret; +} + +void GdbStub::sendSignal(uint32_t signal) { + latestSignal = signal; + + string buffer = stringFromFormat("T%02x%02x:%016lx;%02x:%016lx;", latestSignal, 32, + bswap_64(reg(32)), 31, bswap_64(reg(31))); + LOG_DEBUG(GdbStub, "Response: %s", buffer.c_str()); + sendReply(buffer.c_str()); +} + +void GdbStub::readCommand() { + commandLength = 0; + memset(commandBuffer, 0, sizeof(commandBuffer)); + + uint8_t c = readByte(); + if(c == '+') { + // ignore ack + return; + } else if(c == 0x03) { + LOG_INFO(GdbStub, "gdb: found break command"); + haltLoop = true; + sendSignal(SIGTRAP); + return; + } else if(c != GDB_STUB_START) { + LOG_DEBUG(GdbStub, "gdb: read invalid byte %02x", c); + return; + } + + while((c = readByte()) != GDB_STUB_END) { + if(commandLength >= sizeof(commandBuffer)) { + LOG_ERROR(GdbStub, "gdb: commandBuffer overflow"); + sendPacket(GDB_STUB_NACK); + return; + } + commandBuffer[commandLength++] = c; + } + + auto checksum_received = hexCharToValue(readByte()) << 4; + checksum_received |= hexCharToValue(readByte()); + + auto checksum_calculated = calculateChecksum(commandBuffer, commandLength); + + if(checksum_received != checksum_calculated) + LOG_ERROR(GdbStub, + "gdb: invalid checksum: calculated %02x and read %02x for $%s# (length: %d)", + checksum_calculated, checksum_received, commandBuffer, commandLength); + + sendPacket(GDB_STUB_ACK); +} + +bool GdbStub::isDataAvailable() { + fd_set fd_socket; + + FD_ZERO(&fd_socket); + FD_SET(client, &fd_socket); + + struct timeval t; + t.tv_sec = 0; + t.tv_usec = 0; + + if(select(client + 1, &fd_socket, nullptr, nullptr, &t) < 0) { + LOG_ERROR(GdbStub, "select failed"); + return false; + } + + return FD_ISSET(client, &fd_socket) != 0; +} + +void GdbStub::readRegister() { + uint8_t reply[64]; + memset(reply, 0, sizeof(reply)); + + uint32_t id = hexCharToValue(commandBuffer[1]); + if(commandBuffer[2] != '\0') { + id <<= 4; + id |= hexCharToValue(commandBuffer[2]); + } + + if(id <= 32) + intToGdbHex(reply, reg(id)); + else if(id == 33) + memset(reply, '0', 8); + else + return sendReply("E01"); + + sendReply(reinterpret_cast(reply)); +} + +void GdbStub::readRegisters() { + uint8_t buffer[GDB_BUFFER_SIZE - 4]; + memset(buffer, 0, sizeof(buffer)); + + uint8_t* bufptr = buffer; + for(int i = 0; i <= 32; i++) { + intToGdbHex(bufptr + i * 16, reg(i)); + } + + bufptr += (33 * 16); + + memset(bufptr, '0', 8); + + sendReply(reinterpret_cast(buffer)); +} + +void GdbStub::writeRegister() { + const uint8_t* buffer_ptr = commandBuffer + 3; + + uint32_t id = hexCharToValue(commandBuffer[1]); + if(commandBuffer[2] != '=') { + ++buffer_ptr; + id <<= 4; + id |= hexCharToValue(commandBuffer[2]); + } + + auto val = gdbHexToInt(buffer_ptr); + + if(id <= 32) + reg(id, val); + else if(id == 33) { + } + else + return sendReply("E01"); + + sendReply("OK"); +} + +void GdbStub::writeRegisters() { + const uint8_t* buffer_ptr = commandBuffer + 1; + + if(commandBuffer[0] != 'G') + return sendReply("E01"); + for(auto i = 0; i < 33; ++i) + if(i <= 32) + reg(i, gdbHexToInt(buffer_ptr + i * 16)); + + sendReply("OK"); +} + +void GdbStub::readMemory() { + uint8_t reply[GDB_BUFFER_SIZE - 4]; + + auto start_offset = commandBuffer + 1; + auto addr_pos = find(start_offset, commandBuffer + commandLength, ','); + auto addr = hexToInt(start_offset, static_cast(addr_pos - start_offset)); + + start_offset = addr_pos + 1; + auto len = hexToInt(start_offset, static_cast((commandBuffer + commandLength) - start_offset)); + + LOG_DEBUG(GdbStub, "gdb: addr: %016lx len: %016lx", addr, len); + + if(len * 2 > sizeof(reply)) { + sendReply("E01"); + } + + auto data = new uint8_t[len]; + if(ctu->cpu.readmem(addr, data, len)) { + memToGdbHex(reply, data, len); + reply[len * 2] = '\0'; + sendReply(reinterpret_cast(reply)); + } else + sendReply("E00"); + + delete[] data; +} + +void GdbStub::writeMemory() { + auto start_offset = commandBuffer + 1; + auto addr_pos = find(start_offset, commandBuffer + commandLength, ','); + gptr addr = hexToInt(start_offset, static_cast(addr_pos - start_offset)); + + start_offset = addr_pos + 1; + auto len_pos = find(start_offset, commandBuffer + commandLength, ':'); + auto len = hexToInt(start_offset, static_cast(len_pos - start_offset)); + + auto dst = new uint8_t[len]; + gdbHexToMem(dst, len_pos + 1, len); + + if(ctu->cpu.writemem(addr, dst, len)) + sendReply("OK"); + else + sendReply("E00"); + + delete[] dst; +} + +void GdbStub::_break(bool is_memoryBreak) { + if(!haltLoop) { + haltLoop = true; + sendSignal(SIGTRAP); + } + + memoryBreak = is_memoryBreak; +} + +void GdbStub::step() { + stepLoop = true; + haltLoop = true; +} + +void GdbStub::_continue() { + memoryBreak = false; + stepLoop = false; + haltLoop = false; +} + +bool GdbStub::commitBreakpoint(BreakpointType type, gptr addr, uint32_t len) { + auto& p = getBreakpointList(type); + + Breakpoint breakpoint; + breakpoint.active = true; + breakpoint.addr = addr; + breakpoint.len = len; + + if(type == BreakpointType::Execute) + breakpoint.hook = ctu->cpu.addCodeBreakpoint(addr); + + p.insert({addr, breakpoint}); + + LOG_DEBUG(GdbStub, "gdb: added %d breakpoint: %016lx bytes at %016lx", type, breakpoint.len, + breakpoint.addr); + + return true; +} + +void GdbStub::addBreakpoint() { + BreakpointType type; + + uint8_t type_id = hexCharToValue(commandBuffer[1]); + switch (type_id) { + case 0: + case 1: + type = BreakpointType::Execute; + break; + case 2: + type = BreakpointType::Write; + break; + case 3: + type = BreakpointType::Read; + break; + case 4: + type = BreakpointType::Access; + break; + default: + return sendReply("E01"); + } + + auto start_offset = commandBuffer + 3; + auto addr_pos = find(start_offset, commandBuffer + commandLength, ','); + gptr addr = hexToInt(start_offset, static_cast(addr_pos - start_offset)); + + start_offset = addr_pos + 1; + auto len = (uint32_t) hexToInt(start_offset, static_cast((commandBuffer + commandLength) - start_offset)); + + if(type == BreakpointType::Access) { + type = BreakpointType::Read; + + if(!commitBreakpoint(type, addr, len)) { + return sendReply("E02"); + } + + type = BreakpointType::Write; + } + + if(!commitBreakpoint(type, addr, len)) { + return sendReply("E02"); + } + + sendReply("OK"); +} + +void GdbStub::removeBreakpoint() { + BreakpointType type; + + uint8_t type_id = hexCharToValue(commandBuffer[1]); + switch (type_id) { + case 0: + case 1: + type = BreakpointType::Execute; + break; + case 2: + type = BreakpointType::Write; + break; + case 3: + type = BreakpointType::Read; + break; + case 4: + type = BreakpointType::Access; + break; + default: + return sendReply("E01"); + } + + auto start_offset = commandBuffer + 3; + auto addr_pos = find(start_offset, commandBuffer + commandLength, ','); + gptr addr = hexToInt(start_offset, static_cast(addr_pos - start_offset)); + + if(type == BreakpointType::Access) { + type = BreakpointType::Read; + removeBreakpoint(type, addr); + + type = BreakpointType::Write; + } + + removeBreakpoint(type, addr); + sendReply("OK"); +} + +void GdbStub::handlePacket() { + if(!isDataAvailable()) + return; + + readCommand(); + if(commandLength == 0) + return; + + LOG_DEBUG(GdbStub, "Packet: %s", commandBuffer); + + switch(commandBuffer[0]) { + case 'q': + handleQuery(); + break; + case 'H': + handleSetThread(); + break; + case '?': + sendSignal(latestSignal); + break; + case 'k': + LOG_ERROR(GdbStub, "killed by gdb"); + case 'g': + readRegisters(); + break; + case 'G': + writeRegisters(); + break; + case 'p': + readRegister(); + break; + case 'P': + writeRegister(); + break; + case 'm': + readMemory(); + break; + case 'M': + writeMemory(); + break; + case 's': + step(); + return; + case 'C': + case 'c': + _continue(); + return; + case 'z': + removeBreakpoint(); + break; + case 'Z': + addBreakpoint(); + break; + default: + sendReply(""); + break; + } +} diff --git a/GdbStub.h b/GdbStub.h new file mode 100644 index 0000000..dde8e50 --- /dev/null +++ b/GdbStub.h @@ -0,0 +1,85 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +// Originally written by Sven Peter for anergistic. +// Integrated into Mephisto/CTUv2 by Cody Brocious + +#pragma once + +#include "Ctu.h" + +#define GDB_BUFFER_SIZE 10000 + +/// Breakpoint Method +enum class BreakpointType { + None, + Execute, + Read, + Write, + Access +}; + +struct BreakpointAddress { + gptr address; + BreakpointType type; +}; + +struct Breakpoint { + bool active; + gptr addr; + guint len; + hook_t hook; +}; + +class GdbStub { +public: + GdbStub(Ctu *_ctu); + void enable(uint16_t port); + void _break(bool is_memory_break = false); + bool isMemoryBreak(); + void handlePacket(); + auto getNextBreakpointFromAddress(gptr addr, BreakpointType type); + bool checkBreakpoint(gptr addr, BreakpointType type); + + bool memoryBreak, haltLoop, stepLoop, enabled; + +private: + auto& getBreakpointList(BreakpointType type); + void removeBreakpoint(BreakpointType type, gptr addr); + uint8_t readByte(); + void sendPacket(const char packet); + void sendReply(const char* reply); + void handleQuery(); + void handleSetThread(); + void sendSignal(uint32_t signal); + void readCommand(); + bool isDataAvailable(); + void readRegister(); + void readRegisters(); + void writeRegister(); + void writeRegisters(); + void readMemory(); + void writeMemory(); + void step(); + void _continue(); + bool commitBreakpoint(BreakpointType type, gptr addr, uint32_t len); + void addBreakpoint(); + void removeBreakpoint(); + + guint reg(int x); + void reg(int x, guint v); + + Ctu *ctu; + + map breakpointsExecute; + map breakpointsRead; + map breakpointsWrite; + + int client; + + uint8_t commandBuffer[GDB_BUFFER_SIZE]; + uint32_t commandLength; + + uint32_t latestSignal; +}; diff --git a/Ipc.cpp b/Ipc.cpp new file mode 100644 index 0000000..818818c --- /dev/null +++ b/Ipc.cpp @@ -0,0 +1,235 @@ +#define DEFINE_STUBS +#include "Ctu.h" + +string bufferToString(uint8_t *buf, uint size) { + std::stringstream ss; + auto allValid = true; + auto hitNull = false; + for(auto i = 0; i < size; ++i) + if(hitNull && buf[i] != 0) { + allValid = false; + break; + } else if(buf[i] == 0) + hitNull = true; + else if(buf[i] < 0x20 || buf[i] > 0x7E) { + allValid = false; + break; + } + if(allValid) { + ss << '"'; + for(auto i = 0; i < size && buf[i] != 0; ++i) + ss << (char) buf[i]; + ss << '"'; + } else { + ss << "["; + for(auto i = 0; i < size; ++i) { + if(i != 0) + ss << ", "; + ss << "0x" << hex << setw(2) << setfill('0') << (int) buf[i]; + } + ss << "]"; + } + return ss.str(); +} + +void NPipe::messageAsync(shared_ptr> buf, function cb) { + acquire(); + client.wait([=] { + auto obuf = client.pop(); + memcpy(buf->data(), obuf->data(), 0x100); + cb(0, false); // XXX: HANDLE RETCODES AND CLOSE + return 1; + }); + server.push(buf); + signal(true); + release(); +} + +shared_ptr NPort::connectSync() { + acquire(); + auto pipe = make_shared(ctu, name); + available.push(pipe); + signal(true); + release(); + return pipe; +} + +shared_ptr NPort::accept() { + acquire(); + assert(available.size() > 0); + auto val = available.front(); + available.pop(); + release(); + return val; +} + +IncomingIpcMessage::IncomingIpcMessage(uint8_t *_ptr, bool isDomainObject) : ptr(_ptr) { + auto buf = (uint32_t *) ptr; + type = buf[0] & 0xFFFF; + xCount = (buf[0] >> 16) & 0xF; + aCount = (buf[0] >> 20) & 0xF; + bCount = (buf[0] >> 24) & 0xF; + wlen = buf[1] & 0x3FF; + hasC = ((buf[1] >> 10) & 0x3) != 0; + domainHandle = 0; + domainCommand = 0; + auto hasHD = (buf[1] >> 31) == 1; + auto pos = 2; + + if(hasHD) { + auto hd = buf[pos++]; + hasPid = hd & 1; + copyCount = (hd >> 1) & 0xF; + moveCount = hd >> 5; + if(hasPid) { + pid = *((uint64_t *) &buf[pos]); + pos += 2; + } + copyOffset = pos * 4; + pos += copyCount; + moveOffset = pos * 4; + pos += moveCount; + } + + descOffset = pos * 4; + + pos += xCount * 2; + pos += aCount * 3; + pos += bCount * 3; + rawOffset = pos * 4; + if(pos & 3) + pos += 4 - (pos & 3); + if(isDomainObject && type == 4) { + domainHandle = buf[pos + 1]; + domainCommand = buf[pos] & 0xFF; + pos += 4; + } + + assert(type == 2 || (isDomainObject && domainCommand == 2) || buf[pos] == FOURCC('S', 'F', 'C', 'I')); + sfciOffset = pos * 4; + + cmdId = getData(0); +} + +OutgoingIpcMessage::OutgoingIpcMessage(uint8_t *_ptr, bool _isDomainObject) : ptr(_ptr), isDomainObject(_isDomainObject) { +} + +void OutgoingIpcMessage::initialize(uint _moveCount, uint _copyCount, uint dataBytes) { + moveCount = _moveCount; + copyCount = _copyCount; + + auto buf = (uint32_t *) ptr; + buf[0] = 0; + if(moveCount != 0 || copyCount != 0) { + buf[1] = ((moveCount != 0 && !isDomainObject) || copyCount != 0) ? (1U << 31) : 0; + buf[2] = (copyCount << 1) | ((isDomainObject ? 0 : moveCount) << 5); + } + + auto pos = 2 + (((moveCount != 0 && !isDomainObject) || copyCount != 0) ? (1 + moveCount + copyCount) : 0); + auto start = pos; + if(pos & 3) + pos += 4 - (pos & 3); + if(isDomainObject) + pos += 4; + realDataOffset = isDomainObject ? moveCount << 2 : 0; + auto dataWords = (realDataOffset >> 2) + (dataBytes & 3) ? (dataBytes >> 2) + 1 : (dataBytes >> 2); + + buf[1] |= pos - start + 4 + dataWords; + + sfcoOffset = pos * 4; + buf[pos] = FOURCC('S', 'F', 'C', 'O'); +} + +void OutgoingIpcMessage::commit() { + auto buf = (uint32_t *) ptr; + buf[(sfcoOffset >> 2) + 2] = errCode; +} + +uint32_t IpcService::messageSync(shared_ptr> buf, bool& closeHandle) { + uint8_t obuf[0x100]; + memset(obuf, 0, 0x100); + //hexdump(buf, 0x50); + IncomingIpcMessage msg(buf->data(), isDomainObject); + OutgoingIpcMessage resp(obuf, isDomainObject); + auto ret = 0xf601; + IpcService *target = this; + if(isDomainObject && msg.domainHandle != thisHandle && msg.type == 4) { + if(domainHandles.find(msg.domainHandle) != domainHandles.end()) + target = dynamic_pointer_cast(domainHandles[msg.domainHandle]).get(); + else + LOG_ERROR(Ipc, "Unknown domain handle! 0x%x", msg.domainHandle); + } + if(!isDomainObject || msg.domainCommand == 1 || msg.type == 2 || msg.type == 5) + switch(msg.type) { + case 2: // Close + closeHandle = true; + resp.initialize(0, 0, 0); + resp.errCode = 0; + ret = 0; + break; + case 4: // Normal + ret = target->dispatch(msg, resp); + break; + case 5: // Control + switch(msg.cmdId) { + case 0: // ConvertSessionToDomain + LOG_DEBUG(Ipc, "ConvertSessionToDomain"); + resp.initialize(0, 0, 4); + isDomainObject = true; + *resp.getDataPointer(8) = thisHandle; + resp.errCode = 0; + ret = 0; + break; + case 2: // DuplicateSession + LOG_DEBUG(Ipc, "DuplicateSession"); + resp.isDomainObject = false; + resp.initialize(1, 0, 0); + resp.move(0, ctu->duplicateHandle(dynamic_cast(this))); + resp.errCode = 0; + ret = 0; + break; + case 3: // QueryPointerBufferSize + LOG_DEBUG(Ipc, "QueryPointerBufferSize"); + resp.initialize(0, 0, 4); + *resp.getDataPointer(8) = 0x500; + resp.errCode = 0; + ret = 0; + break; + default: + LOG_ERROR(Ipc, "Unknown cmdId to control %u", msg.cmdId); + } + break; + } + else + switch(msg.domainCommand) { + case 2: + domainHandles.erase(msg.domainHandle); + resp.initialize(0, 0, 0); + resp.errCode = 0; + ret = 0; + break; + default: + LOG_ERROR(Ipc, "Unknown cmdId to domain %u", msg.domainCommand); + } + + if(ret == 0) { + resp.commit(); + memcpy(buf->data(), obuf, 0x100); + //hexdump(buf, 0x50); + } + return ret; +} + +ghandle IpcService::fauxNewHandle(shared_ptr obj) { + return ctu->newHandle(obj); +} + +Ipc::Ipc(Ctu *_ctu) : ctu(_ctu) { + sm = make_shared(ctu); +} + +ghandle Ipc::ConnectToPort(string name) { + if(name != "sm:") + LOG_ERROR(Ipc, "Attempt to connect to unknown port: \"%s\"", name.c_str()); + return ctu->newHandle(sm); +} diff --git a/Ipc.h b/Ipc.h new file mode 100644 index 0000000..a4cd3ff --- /dev/null +++ b/Ipc.h @@ -0,0 +1,249 @@ +#pragma once + +#include "Ctu.h" + +// Used to clarify IPC stubs +#define IN +#define OUT + +#define buildInterface(cls, ...) make_shared(ctu, ##__VA_ARGS__) + +string bufferToString(uint8_t *buf, uint size); + +class IPipe : public Waitable { +public: + virtual ~IPipe() {} + virtual bool isAsync() = 0; + virtual uint32_t messageSync(shared_ptr> buf, bool& closeHandle) { return 0; } + virtual void messageAsync(shared_ptr> buf, function cb) {} +}; + +class IPort : public Waitable { +public: + virtual ~IPort() {} + virtual bool isAsync() = 0; + virtual shared_ptr connectSync() { return nullptr; } + virtual void connectAsync(function)> cb) {} +}; + +class PipeEnd : public Waitable { +public: + PipeEnd() : closed(false) {} + void close() override { + if(closed) + return; + closed = true; + signal(); + } + + void push(shared_ptr> message) { + acquire(); + messages.push(message); + release(); + } + shared_ptr> pop() { + acquire(); + if(closed) { + release(); + return nullptr; + } + auto temp = messages.front(); + messages.pop(); + release(); + return temp; + } + bool closed; + +private: + queue>> messages; +}; + +class NPipe : public IPipe { +public: + NPipe(Ctu *_ctu, string _name) : ctu(_ctu), name(_name), closed(false) {} + bool isAsync() override { return true; } + + void messageAsync(shared_ptr> buf, function cb) override; + void close() override { + if(closed) + return; + closed = true; + server.close(); + client.close(); + signal(); + } + + string name; + PipeEnd server, client; + bool closed; + +private: + Ctu *ctu; +}; + +class NPort : public IPort { +public: + NPort(Ctu *_ctu, string _name) : ctu(_ctu), name(_name) {} + ~NPort() override {} + bool isAsync() override { return false; } + shared_ptr connectSync() override; + + shared_ptr accept(); + + string name; + +private: + Ctu *ctu; + queue> available; +}; + +class IncomingIpcMessage { +public: + IncomingIpcMessage(uint8_t *_ptr, bool isDomainObject); + template + T getData(uint offset) { + return *((T *) (ptr + sfciOffset + 8 + offset)); + } + template + T getDataPointer(uint offset) { + return (T) (ptr + sfciOffset + 8 + offset); + } + gptr getBuffer(int btype, int num, guint& size) { + size = 0; + auto ax = (btype & 3) == 1; + auto flags_ = btype & 0xC0; + auto flags = flags_ == 0x80 ? 3 : (flags_ == 0x40 ? 1 : 0); + auto cx = (btype & 0xC) == 8; + switch((ax << 1) | cx) { + case 0: { // B + auto t = (uint32_t *) (ptr + descOffset + xCount * 8 + aCount * 12 + num * 12); + gptr a = t[0], b = t[1], c = t[2]; + size = (guint) (a | (((c >> 24) & 0xF) << 32)); + if((c & 0x3) != flags) + LOG_ERROR(Ipc, "B descriptor flags don't match: %u vs expected %u", (uint) (c & 0x3), flags); + return b | (((((c >> 2) << 4) & 0x70) | ((c >> 28) & 0xF)) << 32); + } + case 1: { // C + assert(num == 0); + auto t = (uint32_t *) (ptr + rawOffset + wlen * 4); + gptr a = t[0], b = t[1]; + size = b >> 16; + return a | ((b & 0xFFFF) << 32); + } + case 2: { // A + auto t = (uint32_t *) (ptr + descOffset + xCount * 8 + num * 12); + gptr a = t[0], b = t[1], c = t[2]; + size = (guint) (a | (((c >> 24) & 0xF) << 32)); + if((c & 0x3) != flags) + LOG_ERROR(Ipc, "A descriptor flags don't match: %u vs expected %u", (uint) (c & 0x3), flags); + return b | (((((c >> 2) << 4) & 0x70) | ((c >> 28) & 0xF)) << 32); + } + case 3: { // X + auto t = (uint32_t *) (ptr + descOffset + num * 8); + gptr a = t[0], b = t[1]; + size = (guint) (a >> 16); + return b | ((((a >> 12) & 0xF) | ((a >> 2) & 0x70)) << 32); + } + } + return 0; + } + ghandle getMoved(int off) { + return *(ghandle *) (ptr + moveOffset + off * 4); + } + ghandle getCopied(int off) { + return *(ghandle *) (ptr + copyOffset + off * 4); + } + + uint cmdId, type; + uint aCount, bCount, cCount, hasC, xCount, hasPid, moveCount, copyCount; + gpid pid; + + ghandle domainHandle; + uint domainCommand; + +private: + uint wlen, rawOffset, sfciOffset, descOffset, copyOffset, moveOffset; + uint8_t *ptr; +}; + +class OutgoingIpcMessage { +public: + OutgoingIpcMessage(uint8_t *_ptr, bool _isDomainObject); + void initialize(uint _moveCount, uint _copyCount, uint dataBytes); + void commit(); + template + T getDataPointer(uint offset) { + return (T) (ptr + sfcoOffset + 8 + offset + (offset < 8 ? 0 : realDataOffset)); + } + void copy(int offset, ghandle hnd) { + auto buf = (uint32_t *) ptr; + buf[3 + offset] = hnd; + } + void move(int offset, ghandle hnd) { + auto buf = (uint32_t *) ptr; + if(isDomainObject) + buf[(sfcoOffset >> 2) + 4 + offset] = hnd; + else + buf[3 + copyCount + offset] = hnd; + } + + uint32_t errCode; + uint moveCount, copyCount; + bool isDomainObject; + +private: + uint sfcoOffset; + uint realDataOffset; + uint8_t *ptr; +}; + +class IpcService : public IPipe { +public: + IpcService(Ctu *_ctu) : ctu(_ctu), domainOwner(nullptr), isDomainObject(false), domainHandleIter(0xf001), thisHandle(0xf000) {} + ~IpcService() override {} + bool isAsync() override { return false; } + uint32_t messageSync(shared_ptr> buf, bool& closeHandle) override; + virtual uint32_t dispatch(IncomingIpcMessage &req, OutgoingIpcMessage &resp) { return 0xF601; } + +protected: + Ctu *ctu; + + IpcService *domainOwner; + bool isDomainObject; + int domainHandleIter, thisHandle; + unordered_map> domainHandles; + + template + ghandle createHandle(shared_ptr obj) { + static_assert(std::is_base_of::value, "T must derive from KObject"); + if(domainOwner) + return domainOwner->createHandle(obj); + else if(isDomainObject) { + auto hnd = domainHandleIter++; + + auto temp = dynamic_pointer_cast(obj); + if(temp != nullptr) + temp->domainOwner = this; + + domainHandles[hnd] = dynamic_pointer_cast(obj); + return hnd; + } else + return fauxNewHandle(dynamic_pointer_cast(obj)); + } + + ghandle fauxNewHandle(shared_ptr obj); +}; + +class IUnknown : public IpcService { +}; + +class SmService; + +class Ipc { +public: + Ipc(Ctu *_ctu); + ghandle ConnectToPort(string name); + shared_ptr sm; +private: + Ctu *ctu; +}; diff --git a/IpcBridge.cpp b/IpcBridge.cpp new file mode 100644 index 0000000..a0e409c --- /dev/null +++ b/IpcBridge.cpp @@ -0,0 +1,218 @@ +#include "Ctu.h" + +#include "IpcStubs.h" + +#define BRIDGE_PORT 31337 + +IpcBridge::IpcBridge(Ctu *_ctu) : ctu(_ctu) { + struct sockaddr_in addr; + serv = socket(AF_INET, SOCK_STREAM, 0); + auto enable = 1; + setsockopt(serv, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)); + addr.sin_family = AF_INET; + addr.sin_port = htons(BRIDGE_PORT); + addr.sin_addr.s_addr = INADDR_ANY; + memset(addr.sin_zero, '\0', sizeof addr.sin_zero); + bind(serv, (struct sockaddr *) &addr, sizeof addr); + listen(serv, 10); + client = -1; + waitingForAsync = false; +} + +void IpcBridge::start() { + LOG_INFO(IpcBridge, "Starting"); + + for(auto i = 0; i < 24; ++i) { + auto addr = (i + 1) * (1 << 20) + (1 << 28); + ctu->cpu.map(addr, 1024 * 1024); + buffers[i] = addr; + } + + auto thread = ctu->tm.createNative([this] { run(); }); + thread->resume(); +} + +bool isReadable(int fd) { + struct timeval tv; + fd_set rfds; + FD_ZERO(&rfds); + FD_SET(fd, &rfds); + + tv.tv_sec = tv.tv_usec = 0; + return select(fd + 1, &rfds, nullptr, nullptr, &tv) != -1 && FD_ISSET(fd, &rfds); +} + +uint64_t IpcBridge::readint() { + uint64_t val = 0; + recv(client, &val, 8, 0); + return val; +} + +uint64_t IpcBridge::readint(bool &closed) { + uint64_t val = 0; + if(recv(client, &val, 8, 0) == 0) + closed = true; + return val; +} + +string IpcBridge::readstring() { + auto size = readint(); + auto buf = new char[size]; + recv(client, buf, size, 0); + string ret(buf, size); + delete[] buf; + return ret; +} + +IpcData IpcBridge::readdata() { + auto size = readint(); + auto buf = new uint8_t[size]; + recv(client, buf, size, 0); + auto bufptr = buffers[bufferOff++]; + ctu->cpu.writemem(bufptr, buf, size); + delete[] buf; + return IpcData(bufptr, size); +} + +void IpcBridge::writeint(uint64_t val) { + send(client, &val, 8, 0); +} + +void IpcBridge::writedesc(vector> descs) { + writeint(descs.size()); + for(auto [data, flag] : descs) { + writeint(data.size); + auto buf = new uint8_t[data.size]; + ctu->cpu.readmem(data.ptr, buf, data.size); + send(client, buf, data.size, 0); + writeint(flag); + } +} + +void IpcBridge::writedesc(vector descs) { + writeint(descs.size()); + if(descs.size() > 0) + LOG_ERROR(IpcBridge, "C descriptors unsupported"); +} + +void IpcBridge::sendResponse(ghandle hnd, uint32_t res, bool close, shared_ptr> buf, const OutgoingBridgeMessage &orig) { + if(close) { + openHandles.erase(hnd); + ctu->deleteHandle(hnd); + writeint(0xf601); + return; + } + if(res != 0) { + writeint(res); + return; + } + + hexdump(buf); + + IncomingBridgeMessage msg(buf); + + writeint(0); + writeint(msg.data.size()); for(auto v : msg.data) writeint(v); + writeint(msg.copiedHandles.size()); for(auto v : msg.copiedHandles) writeint(v); + writeint(msg.movedHandles.size()); + for(auto v : msg.movedHandles) { + openHandles[v] = ctu->getHandle(v); + writeint(v); + } + + writedesc(orig.a); + writedesc(orig.b); + writedesc(orig.c); + writedesc(orig.x); + + writeint(msg.type); +} + +void IpcBridge::run() { + if(waitingForAsync) + return; + + if(client == -1) { + if(!isReadable(serv)) + return; + struct sockaddr_storage client_addr; + socklen_t addr_size = sizeof client_addr; + client = accept(serv, (struct sockaddr *) &client_addr, &addr_size); + LOG_INFO(IpcBridge, "IPC bridge got connection"); + } else { + if(!isReadable(client)) + return; + auto closed = false; + auto cmd = readint(closed); + if(closed) { + LOG_INFO(IpcBridge, "Client disconnected"); + client = -1; + for(auto [hnd, _] : openHandles) + ctu->deleteHandle(hnd); + openHandles.clear(); + return; + } + switch(cmd) { + case 0: { // Open service + auto name = readstring(); + LOG_DEBUG(IpcBridge, "Attempting to open service %s", name.c_str()); + auto sm = ctu->ipc.sm; + if(sm->ports.find(name) == sm->ports.end()) { + LOG_DEBUG(IpcBridge, "Unknown service!"); + writeint(0); + return; + } + auto obj = sm->ports[name]->connectSync(); + auto hnd = ctu->newHandle(obj); + openHandles[hnd] = obj; + writeint(hnd); + break; + } + case 1: { // Close handle + auto hnd = (ghandle) readint(); + openHandles.erase(hnd); + ctu->deleteHandle(hnd); + break; + } + case 2: { // Message + OutgoingBridgeMessage msg; + bufferOff = 0; + msg.type = readint(); + msg.data = readarray([this] { return readint(); }); + msg.pid = readint(); + msg.copiedHandles = readarray([this] { return (ghandle) readint(); }); + msg.movedHandles = readarray([this] { return (ghandle) readint(); }); + msg.a = readarray([this] { return tuple{readdata(), (int) readint()}; }); + msg.b = readarray([this] { return tuple{readdata(), (int) readint()}; }); + msg.c = readarray([this] { return readdata(); }); + msg.x = readarray([this] { return tuple{readdata(), (int) readint()}; }); + auto hnd = (ghandle) readint(); + + auto packed = msg.pack(); + + if(openHandles.find(hnd) == openHandles.end()) { + writeint(0xe401); // Bad handle + break; + } + + auto obj = dynamic_pointer_cast(openHandles[hnd]); + if(obj->isAsync()) { + waitingForAsync = true; + obj->messageAsync(packed, [=](auto res, auto close) { + sendResponse(hnd, res, close, packed, msg); + waitingForAsync = false; + }); + } else { + auto close = false; + auto ret = obj->messageSync(packed, close); + sendResponse(hnd, ret, close, packed, msg); + } + break; + } + default: + close(client); + client = -1; + break; + } + } +} diff --git a/IpcBridge.h b/IpcBridge.h new file mode 100644 index 0000000..e9eba1e --- /dev/null +++ b/IpcBridge.h @@ -0,0 +1,169 @@ +#pragma once + +#include "Ctu.h" + +class IpcData { +public: + IpcData(gptr _ptr, uint64_t _size) : ptr(_ptr), size(_size) {} + + gptr ptr; + uint64_t size; +}; + +class OutgoingBridgeMessage { +public: + auto pack() { + auto ret = make_shared>(); + + auto pos = 0; + auto buf = (uint32_t *) ret->data(); + buf[0] = (uint32_t) (type | (x.size() << 16) | (a.size() << 20) | (b.size() << 24)); + buf[1] = (pid != (uint64_t) -1 || copiedHandles.size() > 0 || movedHandles.size() > 0) ? 1U << 31 : 0; + buf[1] |= c.size() > 0 ? 2 << 10 : 0; + pos = 2; + if(pid != (uint64_t) -1 || copiedHandles.size() > 0 || movedHandles.size() > 0) { + buf[pos] = pid != (uint64_t) -1 ? 1 : 0; + buf[pos] |= copiedHandles.size() << 1; + buf[pos++] |= movedHandles.size() << 5; + if(pid != (uint64_t) -1) { + buf[pos++] = pid & 0xFFFFFFFF; + buf[pos++] = pid >> 32; + } + for(auto hnd : copiedHandles) + buf[pos++] = hnd; + for(auto hnd : movedHandles) + buf[pos++] = hnd; + } + + for(auto [ed, ec] : x) { + auto laddr = ed.ptr & 0xFFFFFFFF, haddr = ed.ptr >> 32; + buf[pos++] = (uint32_t) ( + (ec & 0x3F) | + (((haddr & 0x70) >> 4) << 6) | + (ec & 0xE00) | + ((haddr & 0xF) << 12) | + (ed.size << 16) + ); + buf[pos++] = (uint32_t) laddr; + } + + vector> ab; + ab.insert(ab.end(), a.begin(), a.end()); + ab.insert(ab.end(), b.begin(), b.end()); + for(auto [ad, af] : ab) { + auto laddr = ad.ptr & 0xFFFFFFFF, haddr = ad.ptr >> 32; + auto lsize = ad.size & 0xFFFFFFFF, hsize = ad.size >> 32; + buf[pos++] = (uint32_t) lsize; + buf[pos++] = (uint32_t) laddr; + buf[pos++] = (uint32_t) ( + af | + (((haddr & 0x70) >> 4) << 2) | + ((hsize & 0xF) << 24) | + ((haddr & 0xF) << 28) + ); + } + + auto epos = pos; + while(pos & 3) + buf[pos++] = 0; + buf[pos++] = FOURCC('S', 'F', 'C', 'I'); + buf[pos++] = 0; + for(auto elem : data) { + buf[pos++] = (uint32_t) elem; + buf[pos++] = (uint32_t) (elem >> 32); + } + + assert(c.size() == 0); // XXX: Add c descriptor packing eventually. One day. + + buf[1] |= pos - epos + 2; + + return ret; + } + + uint64_t type, pid; + vector data; + vector copiedHandles, movedHandles; + vector> a, b, x; + vector c; +}; + +class IncomingBridgeMessage { +public: + IncomingBridgeMessage(shared_ptr> _buf) { + auto buf = (uint32_t *) _buf->data(); + type = buf[0] & 0xFFFF; + auto nx = (buf[0] >> 16) & 0xF, na = (buf[0] >> 20) & 0xF, nb = (buf[0] >> 24) & 0xF; + auto hasHD = buf[1] >> 31; + auto hasC = (buf[1] >> 10) & 3; + + if(nx || na || nb || hasC) + LOG_DEBUG(IpcBridge, "Warning! Message coming back from IPC bridge has descriptors. This is unhandled and may lose data."); + + auto pos = 2; + + if(hasHD) { + auto hasPid = buf[pos] & 1, nc = (buf[pos] >> 1) & 0xF, nm = (buf[pos++] >> 5) & 0xF; + if(hasPid) { + pid = buf[pos] | (((uint64_t) buf[pos+1]) << 32); + pos += 2; + } + for(auto i = 0; i < nc; ++i) + copiedHandles.push_back((ghandle) buf[pos++]); + for(auto i = 0; i < nm; ++i) + movedHandles.push_back((ghandle) buf[pos++]); + } + + pos += nx * 2 + na * 3 + nb * 3; + + auto epos = pos + (buf[1] & 0x3FF) - 2; + while(pos & 3) + pos++; + assert(buf[pos++] == FOURCC('S', 'F', 'C', 'O')); + pos++; + + for( ; pos < epos; pos += 2) + data.push_back(buf[pos] | (((uint64_t) buf[pos+1]) << 32)); + } + + uint64_t type, pid; + vector data; + vector copiedHandles, movedHandles; +}; + +class IpcBridge { +public: + IpcBridge(Ctu *_ctu); + + void start(); + +private: + void run(); + + uint64_t readint(); + uint64_t readint(bool &closed); + template + auto readarray(T &&cb) { + vector vec; + auto count = readint(); + vec.reserve(count); + for(auto i = 0; i < count; ++i) + vec.push_back(cb()); + return vec; + } + string readstring(); + IpcData readdata(); + void writeint(uint64_t val); + void writedesc(vector> descs); + void writedesc(vector descs); + + void sendResponse(ghandle hnd, uint32_t res, bool closed, shared_ptr> buf, const OutgoingBridgeMessage &orig); + + Ctu *ctu; + int serv; + int client; + + unordered_map> openHandles; + gptr buffers[24]; + int bufferOff; + bool waitingForAsync; +}; diff --git a/KObject.h b/KObject.h new file mode 100644 index 0000000..5f86a71 --- /dev/null +++ b/KObject.h @@ -0,0 +1,24 @@ +#pragma once + +#include "Ctu.h" + +class KObject { +public: + virtual ~KObject() {} + virtual void close() {} +}; + +class Process : public KObject { +public: + Process(Ctu *_ctu) : ctu(_ctu) {} + +private: + Ctu *ctu; +}; + +class FauxHandle : public KObject { +public: + FauxHandle(uint32_t _val) : val(_val) {} + + uint32_t val; +}; diff --git a/Lisparser.cpp b/Lisparser.cpp new file mode 100644 index 0000000..d5700dd --- /dev/null +++ b/Lisparser.cpp @@ -0,0 +1,86 @@ +#include "Ctu.h" + +#define BETWEEN(x, a, b) (((x) >= (a)) && ((x) <= (b))) + +string nextToken(string &code, int &off) { + auto clen = code.length(); + while(off < clen && (code[off] == ' ' || code[off] == '\n' || code[off] == '\t' || code[off] == '\r')) + ++off; + auto rlen = clen - off; + auto orig = off; + if(rlen <= 0) + return ""; + if(code[off] == '(') { + off++; + return "("; + } else if(code[off] == ')') { + off++; + return ")"; + } else if(rlen >= 3 && code[off] == '0' && code[off+1] == 'x') { + int te; + for(te = off + 2; te < clen; ++te) { + if(code[te] == ' ' || code[te] == '\n' || code[te] == '\r' || code[te] == '\t' || code[te] == ')') + break; + assert(BETWEEN(code[te], '0', '9') || BETWEEN(code[te], 'a', 'f') || BETWEEN(code[te], 'A', 'F')); + } + off = te; + return code.substr(orig, off - orig); + } else if(BETWEEN(code[off], '0', '9')) { + int te; + for(te = off + 1; te < clen; ++te) { + if(code[te] == ' ' || code[te] == '\n' || code[te] == '\r' || code[te] == '\t' || code[te] == ')') + break; + assert(BETWEEN(code[te], '0', '9')); + } + off = te; + return code.substr(orig, off - orig); + } else if(code[off] == '"') { + string out = "\""; // Signal to the parser that this should be a String rather than Symbol + for(++off ; off < clen && code[off] != '"'; ++off) { + if(code[off] == '\\') { + } else + out += code[off]; + } + assert(code[off++] == '"'); + return out; + } else if(BETWEEN(code[off], '!', '\'') || BETWEEN(code[off], '*', '~')) { + int te; + for(te = off + 1; te < clen; ++te) { + if(code[te] == ' ' || code[te] == '\n' || code[te] == '\r' || code[te] == '\t' || code[te] == ')') + break; + assert(BETWEEN(code[off], '!', '\'') || BETWEEN(code[off], '*', '~')); + } + off = te; + return code.substr(orig, off - orig); + } + LOG_ERROR(Lisparser, "Unknown token at offset %i", off); +} + +shared_ptr parseLisp(string code) { + auto off = 0; + auto cur = make_shared(); + forward_list> stack; + while(true) { + auto token = nextToken(code, off); + if(token == "") + break; + else if(token == "(") { + auto ne = make_shared(); + cur->children.push_back(ne); + stack.push_front(cur); + cur = ne; + } else if(token == ")") { + cur = stack.front(); + stack.pop_front(); + } else if(token[0] == '"') + cur->children.push_back(make_shared(String, token.substr(1))); + else if(token.length() >= 3 && token[0] == '0' && token[1] == 'x') + cur->children.push_back(make_shared(stoull(token.substr(2), nullptr, 16))); + else if(BETWEEN(token[0], '0', '9')) + cur->children.push_back(make_shared(stoull(token, nullptr, 10))); + else + cur->children.push_back(make_shared(Symbol, token)); + } + assert(stack.empty()); + return cur; +} diff --git a/Lisparser.h b/Lisparser.h new file mode 100644 index 0000000..e1abd67 --- /dev/null +++ b/Lisparser.h @@ -0,0 +1,29 @@ +#pragma once + +#include "Ctu.h" + +enum AtomType { + Number, String, Symbol, List +}; + +class Atom { +public: + Atom() { + type = List; + } + Atom(AtomType _type, string val) { + assert(_type == String || _type == Symbol); + type = _type; + strVal = val; + } + Atom(guint val) { + type = Number; + numVal = val; + } + AtomType type; + guint numVal; + string strVal; + vector> children; +}; + +shared_ptr parseLisp(string code); diff --git a/Mmio.cpp b/Mmio.cpp new file mode 100644 index 0000000..5a30489 --- /dev/null +++ b/Mmio.cpp @@ -0,0 +1,64 @@ +#include "Ctu.h" + +Mmio::Mmio(Ctu *_ctu) { + MMIORegister(0x70000000, 0x1000, new ApbMmio()); + + MMIORegister(0x702ec000, 0x2000, new ApbMmio()); + MMIORegister(0x70030000, 0x8000, new ApbMmio()); + MMIORegister(0x702ef700, 0x40, new ApbMmio()); + MMIORegister(0x702f9000, 0x1000, new ApbMmio()); + + //MMIORegister(0x70030000, 0x8000, new ApbMmio()); + ctu = _ctu; + //MMIOInitialize(); +} + +void Mmio::MMIORegister(gptr base, guint size, MmioBase *mmioBase) { + LOG_DEBUG(Mmio, "Registered MMIO " ADDRFMT, base); + mmioBase->setSize(size); + mmioBases[base] = mmioBase; +} + +void Mmio::MMIOInitialize() { + for(auto item : mmioBases) { + item.second->setOffset(mmioBaseSize); + mmioBaseSize += item.second->mmioSize; + } + if(mmioBaseSize & 0xFFF) + mmioBaseSize = (mmioBaseSize & ~0xFFF) + 0x1000; + + LOG_DEBUG(Mmio, "Mapping 0x" ADDRFMT " size 0x%x", mmioBaseAddr, (uint) mmioBaseSize); + ctu->cpu.map(mmioBaseAddr, mmioBaseSize); +} + +gptr Mmio::getVirtualAddressFromAddr(gptr addr) { + for(auto item : mmioBases) { + if(addr >= item.first && addr <= (item.first+item.second->mmioSize)) { + return mmioBaseAddr+item.second->offsetFromMMIO; + } + } + return 0x0; +} + +gptr Mmio::getPhysicalAddressFromVirtual(gptr addr) { + if(addr < mmioBaseAddr) return 0x0; + gptr offset = addr - mmioBaseAddr; + for(auto item : mmioBases) { + if(item.second->offsetFromMMIO >= offset && offset <= item.second->offsetFromMMIO+item.second->mmioSize) { + return item.first+offset; + } + } + return 0x0; +} + + +MmioBase *Mmio::getMMIOFromPhysicalAddress(gptr addr) { + if(addr < mmioBaseAddr) return nullptr; + gptr offset = addr - mmioBaseAddr; + for(auto item : mmioBases) { + if(item.second->offsetFromMMIO >= offset && offset <= item.second->offsetFromMMIO+item.second->mmioSize) { + return item.second; + } + } + return nullptr; +} diff --git a/Mmio.h b/Mmio.h new file mode 100644 index 0000000..cbd7ced --- /dev/null +++ b/Mmio.h @@ -0,0 +1,71 @@ +#pragma once + +#include "Ctu.h" + +class MmioBase { +public: + MmioBase() {} + virtual ~MmioBase() { + for(auto entry : storedValues) { + free(entry.second); + } + } + void Setup(); + + virtual bool sread(gptr addr, guint size, void *out) { + return false; + } + virtual bool swrite(gptr addr, guint size, void *value) { + cout << "no" << endl; + return false; + } + + void setSize(guint _size) { + mmioSize = _size; + } + + void setOffset(guint _offset) { + offsetFromMMIO = _offset; + } + guint offsetFromMMIO; + guint mmioSize; + +private: + + unordered_map storedValues; +}; + +class Mmio { +public: + Mmio(Ctu *ctu); + virtual ~Mmio() {} + gptr getVirtualAddressFromAddr(gptr addr); + gptr getPhysicalAddressFromVirtual(gptr addr); + MmioBase *getMMIOFromPhysicalAddress(gptr addr); + void MMIOInitialize(); + + gptr GetBase() { + return mmioBaseAddr; + } + + guint GetSize() { + return mmioBaseSize; + } +private: + Ctu *ctu; + void MMIORegister(gptr base, guint size, MmioBase *mmioBase); + gptr mmioBaseAddr = 0x4000000;//1 << 58; + guint mmioBaseSize = 0; + unordered_map mmioBases; +}; + +class ApbMmio : public MmioBase { +public: + bool sread(gptr addr, guint size, void *out) { + return false; + } + bool swrite(gptr addr, guint size, void *value) { + //*value = 0xdeadbeef; + return false; + } +}; diff --git a/Nxo.cpp b/Nxo.cpp new file mode 100644 index 0000000..6eb1b9e --- /dev/null +++ b/Nxo.cpp @@ -0,0 +1,54 @@ +#include "Ctu.h" +#include + +Nxo::Nxo(string fn) { + fp.open(fn, ios::in | ios::binary); + fp.seekg(0, ios_base::end); + length = (uint32_t) fp.tellg(); + fp.seekg(0); +} + +typedef struct { + uint32_t magic, pad0, pad1, pad2; + uint32_t textOff, textLoc, textSize, pad3; + uint32_t rdataOff, rdataLoc, rdataSize, pad4; + uint32_t dataOff, dataLoc, dataSize; + uint32_t bssSize; +} NsoHeader; + +char *decompress(ifstream &fp, uint32_t offset, uint32_t csize, uint32_t usize) { + fp.seekg(offset); + char *buf = new char[csize]; + char *obuf = new char[usize]; + fp.read(buf, csize); + assert(LZ4_decompress_safe(buf, obuf, csize, usize) == usize); + delete[] buf; + return obuf; +} + +guint Nso::load(Ctu &ctu, gptr base, bool relocate) { + NsoHeader hdr; + fp.read((char *) &hdr, sizeof(NsoHeader)); + if(hdr.magic != FOURCC('N', 'S', 'O', '0')) + return 0; + + gptr tsize = hdr.dataLoc + hdr.dataSize + hdr.bssSize; + if(tsize & 0xFFF) + tsize = (tsize & ~0xFFF) + 0x1000; + + ctu.cpu.map(base, tsize); + + char *text = decompress(fp, hdr.textOff, hdr.rdataOff - hdr.textOff, hdr.textSize); + ctu.cpu.writemem(base + hdr.textLoc, text, hdr.textSize); + delete[] text; + + char *rdata = decompress(fp, hdr.rdataOff, hdr.dataOff - hdr.rdataOff, hdr.rdataSize); + ctu.cpu.writemem(base + hdr.rdataLoc, rdata, hdr.rdataSize); + delete[] rdata; + + char *data = decompress(fp, hdr.dataOff, length - hdr.dataOff, hdr.dataSize); + ctu.cpu.writemem(base + hdr.dataLoc, data, hdr.dataSize); + delete[] data; + + return tsize; +} diff --git a/Nxo.h b/Nxo.h new file mode 100644 index 0000000..3eb61ab --- /dev/null +++ b/Nxo.h @@ -0,0 +1,23 @@ +#pragma once + +#include "Ctu.h" + +class Nxo { +public: + Nxo(string fn); + virtual ~Nxo() {} + + virtual guint load(Ctu &ctu, gptr base, bool relocate=false) = 0; + +protected: + ifstream fp; + uint32_t length; +}; + +class Nso : Nxo { +public: + Nso(string fn) : Nxo(fn) {} + virtual ~Nso() override {} + + guint load(Ctu &ctu, gptr base, bool relocate=false) override; +}; diff --git a/Svc.cpp b/Svc.cpp new file mode 100644 index 0000000..3e3cb4b --- /dev/null +++ b/Svc.cpp @@ -0,0 +1,627 @@ +#include "Ctu.h" + +#define IX0 (ctu->cpu.reg(0)) +#define IX1 (ctu->cpu.reg(1)) +#define IX2 (ctu->cpu.reg(2)) +#define IX3 (ctu->cpu.reg(3)) +#define IX4 (ctu->cpu.reg(4)) +#define IX5 (ctu->cpu.reg(5)) + +#define registerSvc(num, func, ...) do { \ + ctu->cpu.registerSvcHandler((num), [&] { \ + (func)(__VA_ARGS__); \ + }); \ +} while(0) + +#define registerSvc_ret_X0_X1_X2(num, func, ...) do { \ + ctu->cpu.registerSvcHandler((num), [&] { \ + ctu->tm.switched = false; \ + auto [_0, _1, _2] = (func)(__VA_ARGS__); \ + if(ctu->tm.switched) { \ + ctu->tm.switched = false; \ + return; \ + } \ + ctu->cpu.reg(0, _0); \ + ctu->cpu.reg(1, _1); \ + ctu->cpu.reg(2, _2); \ + }); \ +} while(0) + +#define registerSvc_ret_X0(num, func, ...) do { \ + ctu->cpu.registerSvcHandler((num), [&] { \ + ctu->tm.switched = false; \ + auto v = (func)(__VA_ARGS__); \ + if(ctu->tm.switched) { \ + ctu->tm.switched = false; \ + return; \ + } \ + ctu->cpu.reg(0, v); \ + }); \ +} while(0) + +#define registerSvc_ret_X1(num, func, ...) do { \ + ctu->cpu.registerSvcHandler((num), [&] { \ + ctu->tm.switched = false; \ + auto v = (func)(__VA_ARGS__); \ + if(ctu->tm.switched) { \ + ctu->tm.switched = false; \ + return; \ + } \ + ctu->cpu.reg(1, v); \ + }); \ +} while(0) + +#define registerSvc_ret_X0_X1(num, func, ...) do { \ + ctu->cpu.registerSvcHandler((num), [&] { \ + ctu->tm.switched = false; \ + auto [_0, _1] = (func)(__VA_ARGS__); \ + if(ctu->tm.switched) { \ + ctu->tm.switched = false; \ + return; \ + } \ + ctu->cpu.reg(0, _0); \ + ctu->cpu.reg(1, _1); \ + }); \ +} while(0) + +Svc::Svc(Ctu *_ctu) : ctu(_ctu) { + registerSvc_ret_X0_X1( 0x01, SetHeapSize, IX1); + registerSvc_ret_X0( 0x03, SetMemoryAttribute, IX0, IX1, IX2, IX3); + registerSvc_ret_X0( 0x04, MirrorStack, IX0, IX1, IX2); + registerSvc_ret_X0( 0x05, UnmapMemory, IX0, IX1, IX2); + registerSvc_ret_X0_X1( 0x06, QueryMemory, IX0, IX1, IX2); + registerSvc( 0x07, ExitProcess); + registerSvc_ret_X0_X1( 0x08, CreateThread, IX1, IX2, IX3, IX4, IX5); + registerSvc_ret_X0( 0x09, StartThread, (ghandle) IX0); + registerSvc( 0x0A, ExitThread); + registerSvc_ret_X0( 0x0B, SleepThread, IX0); + registerSvc_ret_X0_X1( 0x0C, GetThreadPriority, (ghandle) IX0); + registerSvc_ret_X0( 0x0D, SetThreadPriority, (ghandle) IX0, IX1); + registerSvc_ret_X0_X1_X2( 0x0E, GetThreadCoreMask, IX0); + registerSvc_ret_X0( 0x0F, SetThreadCoreMask, IX0); + registerSvc_ret_X0( 0x10, GetCurrentProcessorNumber, IX0); + registerSvc_ret_X0( 0x11, SignalEvent, (ghandle) IX0); + registerSvc_ret_X0( 0x12, ClearEvent, (ghandle) IX0); + registerSvc_ret_X0( 0x13, MapMemoryBlock, (ghandle) IX0, IX1, IX2, IX3); + registerSvc_ret_X0_X1( 0x15, CreateTransferMemory, IX0, IX1, IX2); + registerSvc_ret_X0( 0x16, CloseHandle, (ghandle) IX0); + registerSvc_ret_X0( 0x17, ResetSignal, (ghandle) IX0); + registerSvc_ret_X0_X1( 0x18, WaitSynchronization, IX1, IX2, IX3); + registerSvc_ret_X0( 0x19, CancelSynchronization, (ghandle) IX0); + registerSvc_ret_X0( 0x1A, LockMutex, (ghandle) IX0, IX1, (ghandle) IX2); + registerSvc( 0x1B, UnlockMutex, IX0); + registerSvc( 0x1C, WaitProcessWideKeyAtomic, IX0, IX1, (ghandle) IX2, IX3); + registerSvc_ret_X0( 0x1D, SignalProcessWideKey, IX0, IX1); + registerSvc_ret_X0_X1( 0x1F, ConnectToPort, IX1); + registerSvc_ret_X0( 0x21, SendSyncRequest, (ghandle) IX0); + registerSvc_ret_X0( 0x22, SendSyncRequestEx, IX0, IX1, (ghandle) IX2); + registerSvc_ret_X0_X1( 0x24, GetProcessID, (ghandle) IX1); + registerSvc_ret_X0_X1( 0x25, GetThreadId); + registerSvc_ret_X0( 0x26, Break, IX0, IX1, IX2); + registerSvc_ret_X0( 0x27, OutputDebugString, IX0, IX1); + registerSvc_ret_X0_X1( 0x29, GetInfo, IX1, (ghandle) IX2, IX3); + registerSvc_ret_X0_X1_X2( 0x40, CreateSession, (ghandle) IX0, (ghandle) IX1, IX2); + registerSvc_ret_X0_X1( 0x41, AcceptSession, (ghandle) IX1); + registerSvc_ret_X0_X1( 0x43, ReplyAndReceive, IX1, IX2, (ghandle) IX3, IX4); + registerSvc_ret_X0_X1_X2( 0x45, CreateEvent, (ghandle) IX0, (ghandle) IX1, IX2); + registerSvc_ret_X0_X1( 0x4E, ReadWriteRegister, IX1, IX2, IX3); + registerSvc_ret_X0_X1( 0x50, CreateMemoryBlock, IX1, IX2); + registerSvc_ret_X0( 0x51, MapTransferMemory, (ghandle) IX0, IX1, IX2, IX3); + registerSvc_ret_X0( 0x52, UnmapTransferMemory, (ghandle) IX0, IX1, IX2); + registerSvc_ret_X0_X1( 0x53, CreateInterruptEvent, IX1); + registerSvc_ret_X0_X1( 0x55, QueryIoMapping, IX1, IX2); + registerSvc_ret_X0_X1( 0x56, CreateDeviceAddressSpace, IX1, IX2); + registerSvc_ret_X0_X1( 0x57, AttachDeviceAddressSpace, (ghandle) IX0, IX1, IX2); + registerSvc_ret_X0_X1( 0x59, MapDeviceAddressSpaceByForce, (ghandle) IX0, (ghandle) IX1, IX2, IX3, IX4, IX5); + registerSvc_ret_X0( 0x5c, UnmapDeviceAddressSpace, IX0, (ghandle) IX1, IX2, IX3); + registerSvc_ret_X0( 0x74, MapProcessMemory, IX0, (ghandle) IX1, IX2, IX3); + registerSvc_ret_X0( 0x75, UnmapProcessMemory, IX0, (ghandle) IX1, IX2, IX3); + registerSvc_ret_X0( 0x77, MapProcessCodeMemory, (ghandle) IX0, IX1, IX2, IX3); + registerSvc_ret_X0( 0x78, UnmapProcessCodeMemory, (ghandle) IX0, IX1, IX2, IX3); +} + +tuple Svc::SetHeapSize(guint size) { + LOG_DEBUG(Svc[0x01], "SetHeapSize 0x" LONGFMT, size); + ctu->heapsize = size; + ctu->cpu.map(0xaa0000000, size); + return make_tuple(0, 0xaa0000000); +} + +guint Svc::SetMemoryAttribute(gptr addr, guint size, guint state0, guint state1) { + LOG_DEBUG(Svc[0x03], "SetMemoryAttribute 0x" ADDRFMT " 0x" LONGFMT " -> 0x" LONGFMT " 0x" LONGFMT, addr, size, state0, state1); + return 0; +} + +guint Svc::MirrorStack(gptr dest, gptr src, guint size) { + LOG_DEBUG(Svc[0x04], "MirrorStack 0x" ADDRFMT " 0x" ADDRFMT " - 0x" LONGFMT, dest, src, size); + ctu->cpu.map(dest, size); + auto temp = new uint8_t[size]; + ctu->cpu.readmem(src, temp, size); + ctu->cpu.writemem(dest, temp, size); + delete[] temp; + return 0; +} + +guint Svc::UnmapMemory(gptr dest, gptr src, guint size) { + LOG_DEBUG(Svc[0x05], "UnmapMemory 0x" ADDRFMT " 0x" ADDRFMT " - 0x" LONGFMT, dest, src, size); + return 0; +} + +typedef struct { + gptr begin; + gptr size; + gptr perms; + guint cperm; +} MemInfo; + +tuple Svc::QueryMemory(gptr meminfo, gptr pageinfo, gptr addr) { + LOG_DEBUG(Svc[0x06], "QueryMemory 0x" ADDRFMT, addr); + for(auto [begin, end, perm] : ctu->cpu.regions()) { + if(begin <= addr && addr <= end) { + LOG_DEBUG(Svc[0x06], "Found region at 0x" ADDRFMT "-0x" ADDRFMT, begin, end); + MemInfo minfo; + minfo.begin = begin; + minfo.size = end - begin + 1; + minfo.perms = perm == -1 ? 0 : 3; // FREE or CODE + minfo.cperm = 0; + + if(perm != -1) { + auto offset = *ctu->cpu.guestptr(begin + 4); + if(begin + offset + 4 < end && *ctu->cpu.guestptr(begin + offset) == FOURCC('M', 'O', 'D', '0')) + minfo.cperm = 5; + else + minfo.cperm = 3; + } + ctu->cpu.guestptr(meminfo) = minfo; + break; + } + } + return make_tuple(0, 0); +} + +void Svc::ExitProcess() { + LOG_DEBUG(Svc[0x07], "ExitProcess"); + exit(0); +} + +tuple Svc::CreateThread(guint pc, guint x0, guint sp, guint prio, guint proc) { + LOG_DEBUG(Svc[0x08], "CreateThread pc=0x" LONGFMT " X0=0x" LONGFMT " SP=0x" LONGFMT, pc, x0, sp); + auto thread = ctu->tm.create(pc, sp); + thread->regs.X0 = x0; + return make_tuple(0, thread->handle); +} + +guint Svc::StartThread(ghandle handle) { + LOG_DEBUG(Svc[0x09], "StartThread 0x%x", handle); + auto thread = ctu->getHandle(handle); + thread->resume(); + return 0; +} + +void Svc::ExitThread() { + LOG_DEBUG(Svc[0x0A], "ExitThread"); + ctu->tm.current()->terminate(); +} + +guint Svc::SleepThread(guint ns) { + LOG_DEBUG(Svc[0x0B], "SleepThread 0x" LONGFMT " ns", ns); + return 0; +} + +tuple Svc::GetThreadPriority(ghandle handle) { + LOG_DEBUG(Svc[0x0C], "GetThreadPriority 0x%x", handle); + return make_tuple(0, 0); +} + +guint Svc::SetThreadPriority(ghandle handle, guint priority) { + LOG_DEBUG(Svc[0x0D], "SetThreadPriority 0x%x -> 0x" LONGFMT, handle, priority); + return 0; +} + +tuple Svc::GetThreadCoreMask(guint tmp) { + LOG_DEBUG(Svc[0x0E], "GetThreadCoreMask"); + return make_tuple(0, 0xFF, 0xFF); +} + +guint Svc::SetThreadCoreMask(guint tmp) { + LOG_DEBUG(Svc[0x0F], "GetThreadCoreMask"); + return 0; +} + +guint Svc::GetCurrentProcessorNumber(guint tmp) { + LOG_DEBUG(Svc[0x10], "GetCurrentProcessorNumber"); + return 0; +} + +guint Svc::SignalEvent(ghandle handle) { + LOG_DEBUG(Svc[0x11], "SignalEvent 0x%x", handle); + return 0; +} + +guint Svc::ClearEvent(ghandle handle) { + LOG_DEBUG(Svc[0x12], "ClearEvent 0x%x", handle); + return 0; +} + +guint Svc::MapMemoryBlock(ghandle handle, gptr addr, guint size, guint perm) { + LOG_DEBUG(Svc[0x13], "MapMemoryBlock 0x%x 0x" LONGFMT " 0x" LONGFMT " 0x" LONGFMT, handle, addr, size, perm); + auto obj = ctu->getHandle(handle); + assert(obj->size == size); + assert(obj->addr == 0); + ctu->cpu.map(addr, size); + obj->addr = addr; + return 0; +} + +tuple Svc::CreateTransferMemory(gptr addr, guint size, guint perm) { + LOG_DEBUG(Svc[0x15], "CreateTransferMemory 0x" LONGFMT " 0x" LONGFMT " 0x" LONGFMT, addr, size, perm); + return make_tuple(0, 0); +} + +guint Svc::CloseHandle(ghandle handle) { + LOG_DEBUG(Svc[0x16], "CloseHandle 0x%x", handle); + ctu->deleteHandle(handle); + return 0; +} + +guint Svc::ResetSignal(ghandle handle) { + LOG_DEBUG(Svc[0x17], "ResetSignal 0x%x", handle); + return 0; +} + +tuple Svc::WaitSynchronization(gptr handles, guint numHandles, guint timeout) { + LOG_DEBUG(Svc[0x18], "WaitSynchronization %u", (uint) numHandles); + + auto thread = ctu->tm.current(); + thread->suspend([=] { + auto triggered = make_shared(false); + auto cb = [=](int i, bool canceled) { + if(*triggered) + return -1; + *triggered = true; + thread->resume([=] { + if(canceled) { + thread->regs.X0 = 0xec01; + thread->regs.X1 = 0; + } else { + thread->regs.X0 = 0; + thread->regs.X1 = i; + } + }); + return 1; + }; + auto hdls = ctu->cpu.guestptr(handles); + for(auto i = 0; i < numHandles; ++i) { + auto hnd = ctu->getHandle(hdls[i]); + auto port = dynamic_pointer_cast(hnd); + if(port != nullptr) + LOG_DEBUG(Svc[0x18], "Waiting on port %s", port->name.c_str()); + hnd->wait([=](auto canceled) { return cb(i, canceled); }); + } + }); + + return make_tuple(0, 0); +} + +guint Svc::CancelSynchronization(ghandle handle) { + LOG_DEBUG(Svc[0x19], "CancelSynchronization 0x%x", handle); + return 0; +} + +shared_ptr Svc::ensureMutex(gptr mutexAddr) { + if(mutexes.find(mutexAddr) == mutexes.end()) { + LOG_DEBUG(Svc, "Making new mutex for 0x" LONGFMT, mutexAddr); + mutexes[mutexAddr] = make_shared(ctu->cpu.guestptr(mutexAddr)); + } + return mutexes[mutexAddr]; +} + +guint Svc::LockMutex(ghandle curthread, gptr mutexAddr, ghandle reqthread) { + LOG_DEBUG(Svc[0x1A], "LockMutex 0x%x 0x" LONGFMT " 0x%x", curthread, mutexAddr, reqthread); + + auto mutex = ensureMutex(mutexAddr); + auto owner = mutex->owner(); + + auto thread = ctu->getHandle(reqthread); + + if(owner != 0 && owner != reqthread) { + LOG_DEBUG(Svc[0x1A], "Could not get mutex lock. Waiting."); + mutex->hasWaiters(true); + thread->suspend([=] { + mutex->wait([=] { + if(mutex->owner() == 0) { + mutex->owner(reqthread); + thread->resume([=] { + thread->regs.X0 = 0; + }); + return 1; + } else + return 0; + }); + }); + } else { + mutex->owner(reqthread); + if(!thread->active) { + thread->regs.X0 = 0; + thread->resume(); + } + } + return 0; +} + +void Svc::UnlockMutex(gptr mutexAddr) { + LOG_DEBUG(Svc[0x1B], "UnlockMutex 0x" ADDRFMT, mutexAddr); + + auto mutex = ensureMutex(mutexAddr); + auto owner = mutex->owner(); + assert(owner == 0 || owner == ctu->tm.current()->handle); + + mutex->guestRelease(); +} + +shared_ptr Svc::ensureSemaphore(gptr semaAddr) { + if(semaphores.find(semaAddr) == semaphores.end()) { + LOG_DEBUG(Svc, "Making new semaphore for 0x" LONGFMT, semaAddr); + semaphores[semaAddr] = make_shared(ctu->cpu.guestptr(semaAddr)); + } + return semaphores[semaAddr]; +} + +void Svc::WaitProcessWideKeyAtomic(gptr mutexAddr, gptr semaAddr, ghandle threadHandle, guint timeout) { + LOG_DEBUG(Svc[0x1C], "WaitProcessWideKeyAtomic 0x" LONGFMT " 0x" LONGFMT " 0x%x 0x" LONGFMT, mutexAddr, semaAddr, threadHandle, timeout); + + auto mutex = ensureMutex(mutexAddr); + auto semaphore = ensureSemaphore(semaAddr); + + assert(mutex->owner() == threadHandle); + + if(semaphore->value() > 0) { + semaphore->decrement(); + return; + } + + auto thread = ctu->getHandle(threadHandle); + thread->suspend([=] { + semaphore->wait([=] { + semaphore->decrement(); + thread->resume([=] { + LockMutex(0, mutexAddr, threadHandle); + }); + return 1; + }); + }); + + mutex->guestRelease(); +} + +guint Svc::SignalProcessWideKey(gptr semaAddr, guint target) { + LOG_DEBUG(Svc[0x1D], "SignalProcessWideKey 0x" LONGFMT " 0x" LONGFMT, semaAddr, target); + auto semaphore = ensureSemaphore(semaAddr); + semaphore->increment(); + if(target == 1) + semaphore->signal(true); + else if(target == 0xffffffff) + semaphore->signal(); + return 0; +} + +tuple Svc::ConnectToPort(guint name) { + LOG_DEBUG(Svc[0x1F], "ConnectToPort"); + return make_tuple(0, ctu->ipc.ConnectToPort(ctu->cpu.readstring(name))); +} + +guint Svc::SendSyncRequest(ghandle handle) { + LOG_DEBUG(Svc[0x21], "SendSyncRequest 0x%x", handle); + auto thread = ctu->tm.current(); + auto hnd = ctu->getHandle(handle); + auto buf = make_shared>(); + ctu->cpu.readmem(thread->tlsBase, buf->data(), 0x100); + if(hnd->isAsync()) { + thread->suspend([=] { + hnd->messageAsync(buf, [=](auto res, auto close) { + ctu->cpu.writemem(thread->tlsBase, buf->data(), 0x100); + if(close) + ctu->deleteHandle(handle); + thread->resume([=] { + thread->regs.X0 = res; + }); + }); + }); + return 0; + } else { + auto close = false; + auto ret = hnd->messageSync(buf, close); + if(close) + ctu->deleteHandle(handle); + ctu->cpu.writemem(thread->tlsBase, buf->data(), 0x100); + return ret; + } +} + +guint Svc::SendSyncRequestEx(gptr buf, guint size, ghandle handle) { + LOG_ERROR(Svc[0x22], "SendSyncRequestEx not implemented"); + return 0xf601; +} + +tuple Svc::GetProcessID(ghandle handle) { + LOG_DEBUG(Svc[0x24], "GetProcessID 0x%x", handle); + return make_tuple(0, 0); +} + +tuple Svc::GetThreadId() { + LOG_DEBUG(Svc[0x25], "GetThreadId"); + return make_tuple(0, ctu->tm.current()->id); +} + +guint Svc::Break(guint X0, guint X1, guint info) { + LOG_DEBUG(Svc[0x26], "Break"); + exit(1); +} + +guint Svc::OutputDebugString(guint ptr, guint size) { + LOG_DEBUG(Svc[0x27], "OutputDebugString"); + char *debugStr = (char*) malloc(size + 1); + memset(debugStr, 0, size+1); + ctu->cpu.readmem(ptr, debugStr, size); + LOG_DEBUG(Svc[0x27], "Debug String: %s", debugStr); + free(debugStr); + return 0; +} + +#define matchone(a, v) do { if(id1 == (a)) return make_tuple(0, (v)); } while(0) +#define matchpair(a, b, v) do { if(id1 == (a) && id2 == (b)) return make_tuple(0, (v)); } while(0) + +tuple Svc::GetInfo(guint id1, ghandle handle, guint id2) { + LOG_DEBUG(Svc[0x29], "GetInfo handle=0x%x id1=0x" LONGFMT " id2=" LONGFMT, handle, id1, id2); + matchpair(0, 0, 0xF); + matchpair(1, 0, 0xFFFFFFFF00000000); + matchpair(2, 0, 0x7100000000); + matchpair(3, 0, 0x1000000000); + matchpair(4, 0, 0xaa0000000); + matchpair(5, 0, ctu->heapsize); // Heap region size + matchpair(6, 0, 0x100000); + matchpair(7, 0, 0x10000); + matchpair(12, 0, 0x8000000); + matchpair(13, 0, 0x7ff8000000); + matchpair(14, 0, ctu->loadbase); + matchpair(15, 0, ctu->loadsize); + matchpair(18, 0, 0x0100000000000036); // Title ID + matchone(11, 0); + + LOG_ERROR(Svc[0x29], "Unknown getinfo"); +} + +tuple Svc::CreateSession(ghandle clientOut, ghandle serverOut, guint unk) { + LOG_DEBUG(Svc[0x40], "CreateSession"); + auto pipe = make_shared(ctu, "Session"); + return make_tuple(0, ctu->newHandle(pipe), ctu->newHandle(pipe)); +} + +tuple Svc::AcceptSession(ghandle hnd) { + LOG_DEBUG(Svc[0x41], "AcceptSession 0x%x", hnd); + auto pipe = ctu->getHandle(hnd)->accept(); + return make_tuple(0, ctu->newHandle(pipe)); +} + +tuple Svc::ReplyAndReceive(gptr handles, guint numHandles, ghandle replySession, guint timeout) { + LOG_DEBUG(Svc[0x43], "ReplyAndReceive"); + + auto thread = ctu->tm.current(); + if(replySession != 0) { + LOG_DEBUG(Svc[0x43], "Sending message back from native service"); + auto hnd = ctu->getHandle(replySession); + auto buf = make_shared>(); + ctu->cpu.readmem(thread->tlsBase, buf->data(), 0x100); + hnd->client.push(buf); + hnd->client.signal(true); + } + + if(numHandles == 0) + return make_tuple(0xf601, 0); + + assert(numHandles == 1); + auto handle = *ctu->cpu.guestptr(handles); + auto hnd = ctu->getHandle(handle); + + auto buf = hnd->server.pop(); + if(buf == nullptr) { + ctu->deleteHandle(handle); + return make_tuple(0xf601, 0); + } + LOG_DEBUG(Svc[0x43], "Got message for native service"); + hexdump(buf); + ctu->cpu.writemem(thread->tlsBase, buf->data(), 0x100); + + return make_tuple(0, 0); +} + +tuple Svc::CreateEvent(ghandle clientOut, ghandle serverOut, guint unk) { + LOG_DEBUG(Svc[0x45], "CreateEvent"); + return make_tuple(0, 0, 0); +} + +tuple Svc::ReadWriteRegister(guint reg, guint rwm, guint val) { + LOG_DEBUG(Svc[0x4E], "ReadWriteRegister"); + return make_tuple(0, 0); +} + +tuple Svc::CreateMemoryBlock(guint size, guint perm) { + LOG_DEBUG(Svc[0x50], "CreateMemoryBlock"); + return make_tuple(0, ctu->newHandle(make_shared(size, perm))); +} + +guint Svc::MapTransferMemory(ghandle handle, gptr addr, guint size, guint perm) { + LOG_DEBUG(Svc[0x51], "MapTransferMemory"); + ctu->cpu.map(addr, size); + return 0; +} + +guint Svc::UnmapTransferMemory(ghandle handle, gptr addr, guint size) { + LOG_DEBUG(Svc[0x52], "UnmapTransferMemory"); + ctu->cpu.unmap(addr, size); + return 0; +} + +tuple Svc::CreateInterruptEvent(guint irq) { + LOG_DEBUG(Svc[0x53], "CreateInterruptEvent"); + return make_tuple(0, 0); +} + +tuple Svc::QueryIoMapping(gptr physaddr, guint size) { + LOG_DEBUG(Svc[0x55], "QueryIoMapping"); + gptr addr = ctu->mmiohandler.getVirtualAddressFromAddr(physaddr); + if(addr == 0x0) { // force exit for now + cout << "!Unknown physical address!" << endl; + exit(1); + } + return make_tuple(0x0, addr); +} + +tuple Svc::CreateDeviceAddressSpace(guint base, guint size) { + LOG_DEBUG(Svc[0x56], "CreateDeviceAddressSpace"); + return make_tuple(0, 0); +} + +tuple Svc::AttachDeviceAddressSpace(ghandle handle, guint dev, gptr addr) { + LOG_DEBUG(Svc[0x57], "AttachDeviceAddressSpace"); + return make_tuple(0, 0); +} + +tuple Svc::MapDeviceAddressSpaceByForce(ghandle handle, ghandle phandle, gptr paddr, guint size, gptr maddr, guint perm) { + LOG_DEBUG(Svc[0x59], "MapDeviceAddressSpaceByForce"); + return make_tuple(0, 0); +} + +guint Svc::UnmapDeviceAddressSpace(guint unk0, ghandle phandle, gptr maddr, guint size) { + LOG_DEBUG(Svc[0x5c], "UnmapDeviceAddressSpace"); + return 0; +} + +guint Svc::MapProcessMemory(gptr dstaddr, ghandle handle, gptr srcaddr, guint size) { + LOG_DEBUG(Svc[0x74], "MapProcessMemory"); + ctu->cpu.map(dstaddr, size); + char *mem = (char *) malloc(size); + memset(mem, 0, size); + ctu->cpu.readmem(srcaddr, mem, size); + ctu->cpu.writemem(dstaddr, mem, size); + free(mem); + return 0; +} + +guint Svc::UnmapProcessMemory(gptr dstaddr, ghandle handle, gptr srcaddr, guint size) { + LOG_DEBUG(Svc[0x75], "UnmapProcessMemory"); + ctu->cpu.unmap(dstaddr, size); + return 0; +} + +guint Svc::MapProcessCodeMemory(ghandle handle, gptr dstaddr, gptr srcaddr, guint size) { + LOG_DEBUG(Svc[0x77], "MapProcessCodeMemory"); + ctu->cpu.map(dstaddr, size); + return 0; +} + +guint Svc::UnmapProcessCodeMemory(ghandle handle, gptr dstaddr, gptr srcaddr, guint size) { + LOG_DEBUG(Svc[0x78], "UnmapProcessCodeMemory"); + ctu->cpu.unmap(dstaddr, size); + return 0; +} diff --git a/Svc.h b/Svc.h new file mode 100644 index 0000000..bc60d49 --- /dev/null +++ b/Svc.h @@ -0,0 +1,78 @@ +#pragma once + +#include "Ctu.h" + +class MemoryBlock : public KObject { +public: + MemoryBlock(guint _size, guint _perms) : size(_size), perms(_perms), addr(0) {} + + guint size, perms; + gptr addr; +}; + +class Svc { +public: + Svc(Ctu *ctu); + +private: + Ctu *ctu; + unordered_map> semaphores; + unordered_map> mutexes; + + shared_ptr ensureMutex(gptr mutexAddr); + shared_ptr ensureSemaphore(gptr semaAddr); + + tuple SetHeapSize(guint size); // 0x01 + guint SetMemoryAttribute(gptr addr, guint size, guint state0, guint state1); // 0x03 + guint MirrorStack(gptr dest, gptr src, guint size); // 0x04 + guint UnmapMemory(gptr dest, gptr src, guint size); // 0x05 + tuple QueryMemory(gptr meminfo, gptr pageinfo, gptr addr); // 0x06 + void ExitProcess(); // 0x07 + tuple CreateThread(guint pc, guint x0, guint sp, guint prio, guint proc); // 0x08 + guint StartThread(ghandle handle); // 0x09 + void ExitThread(); // 0x0A + guint SleepThread(guint ns); // 0x0B + tuple GetThreadPriority(ghandle handle); // 0x0C + guint SetThreadPriority(ghandle handle, guint priority); // 0x0D + tuple GetThreadCoreMask(guint); // 0x0E + guint SetThreadCoreMask(guint); // 0x0F + guint GetCurrentProcessorNumber(guint); // 0x10 + guint SignalEvent(ghandle handle); // 0x11 + guint ClearEvent(ghandle handle); // 0x12 + guint MapMemoryBlock(ghandle handle, gptr addr, guint size, guint perm); // 0x13 + tuple CreateTransferMemory(gptr addr, guint size, guint perm); // 0x15 + guint CloseHandle(ghandle handle); // 0x16 + guint ResetSignal(ghandle handle); // 0x17 + tuple WaitSynchronization(gptr handles, guint numHandles, guint timeout); // 0x18 + guint CancelSynchronization(ghandle handle); // 0x19 + guint LockMutex(ghandle curthread, gptr mutexAddr, ghandle reqthread); // 0x1A + void UnlockMutex(gptr mutexAddr); // 0x1B + void WaitProcessWideKeyAtomic(gptr mutexAddr, gptr semaAddr, ghandle threadHandle, guint timeout); // 0x1C + guint SignalProcessWideKey(gptr semaAddr, guint target); // 0x1D + tuple ConnectToPort(guint name); // 0x1F + guint SendSyncRequest(ghandle handle); // 0x21 + guint SendSyncRequestEx(gptr buf, guint size, ghandle handle); // 0x22 + tuple GetProcessID(ghandle handle); // 0x24 + tuple GetThreadId(); // 0x25 + guint Break(guint X0, guint X1, guint info); // 0x26 + guint OutputDebugString(guint ptr, guint size); // 0x27 + tuple GetInfo(guint id1, ghandle handle, guint id2); // 0x29 + tuple CreateSession(ghandle clientOut, ghandle serverOut, guint unk); // 0x40 + tuple AcceptSession(ghandle port); // 0x41 + tuple ReplyAndReceive(gptr handles, guint numHandles, ghandle replySession, guint timeout); // 0x43 + tuple CreateEvent(ghandle clientOut, ghandle serverOut, guint unk); // 0x45 + tuple ReadWriteRegister(guint reg, guint rwm, guint val); // 0x4E + tuple CreateMemoryBlock(guint size, guint perm); // 0x50 + guint MapTransferMemory(ghandle handle, gptr addr, guint size, guint perm); // 0x51 + guint UnmapTransferMemory(ghandle handle, gptr addr, guint size); // 0x52 + tuple CreateInterruptEvent(guint irq); // 0x53 + tuple QueryIoMapping(gptr physaddr, guint size); // 0x55 + tuple CreateDeviceAddressSpace(guint base, guint size); // 0x56 + tuple AttachDeviceAddressSpace(ghandle handle, guint dev, gptr addr); // 0x57 + tuple MapDeviceAddressSpaceByForce(ghandle handle, ghandle phandle, gptr paddr, guint size, gptr maddr, guint perm); // 0x59 + guint UnmapDeviceAddressSpace(guint unk0, ghandle phandle, gptr maddr, guint size); // 0x5c + guint MapProcessMemory(gptr dstaddr, ghandle handle, gptr srcaddr, guint size); // 0x74 + guint UnmapProcessMemory(gptr dstaddr, ghandle handle, gptr srcaddr, guint size); // 0x75 + guint MapProcessCodeMemory(ghandle handle, gptr dstaddr, gptr srcaddr, guint size); // 0x77 + guint UnmapProcessCodeMemory(ghandle handle, gptr dstaddr, gptr srcaddr, guint size); // 0x78 +}; diff --git a/Sync.cpp b/Sync.cpp new file mode 100644 index 0000000..167ad22 --- /dev/null +++ b/Sync.cpp @@ -0,0 +1,105 @@ +#include "Ctu.h" + +Waitable::Waitable() : presignaled(false), canceled(false) { +} + +void Waitable::acquire() { + lock.lock(); +} + +void Waitable::release() { + lock.unlock(); +} + +void Waitable::wait(function cb) { + wait([cb](auto _) { return cb(); }); +} + +void Waitable::wait(function cb) { + acquire(); + if(!presignaled || (presignaled && cb(canceled) == 0)) + waiters.push_back(cb); + presignaled = false; + canceled = false; + release(); +} + +void Waitable::signal(bool one) { + acquire(); + if(waiters.size() == 0 && presignalable()) + presignaled = true; + else { + auto realhit = false; + for(auto iter = waiters.begin(); iter != waiters.end();) { + auto res = (*iter)(canceled); + if(res != 0) { + iter = waiters.erase(iter); + } else { + iter++; + } + if(res != -1) { + realhit = true; + if(one) + break; + } + } + if(!realhit && presignalable()) + presignaled = true; + } + release(); +} + +void Waitable::cancel() { + acquire(); + canceled = true; + signal(); + release(); +} + +Semaphore::Semaphore(Guest _vptr) : vptr(_vptr) { +} + +void Semaphore::increment() { + acquire(); + vptr = *vptr + 1; + release(); +} + +void Semaphore::decrement() { + acquire(); + vptr = *vptr - 1; + release(); +} + +uint32_t Semaphore::value() { + return *vptr; +} + +Mutex::Mutex(Guest _vptr) : vptr(_vptr) { +} + +uint32_t Mutex::value() { + return *vptr; +} +void Mutex::value(uint32_t val) { + vptr = val; +} + +ghandle Mutex::owner() { + return value() & 0xBFFFFFFF; +} +void Mutex::owner(ghandle val) { + value((value() & 0x40000000) | val); +} + +bool Mutex::hasWaiters() { + return (value() >> 28) != 0; +} +void Mutex::hasWaiters(bool val) { + value((value() & 0xBFFFFFFF) | ((int) val << 30)); +} + +void Mutex::guestRelease() { + owner(0); + signal(); +} diff --git a/Sync.h b/Sync.h new file mode 100644 index 0000000..2f92aa4 --- /dev/null +++ b/Sync.h @@ -0,0 +1,65 @@ +#pragma once + +#include "Ctu.h" + +class Waitable : public KObject { +public: + Waitable(); + + void acquire(); + void release(); + + void wait(function cb); + void wait(function cb); + + void signal(bool one=false); + void cancel(); + + virtual void close() override {} + +protected: + virtual bool presignalable() { return true; } + +private: + recursive_mutex lock; + list> waiters; + bool presignaled, canceled; +}; + +class Semaphore : public Waitable { +public: + Semaphore(Guest _vptr); + + void increment(); + void decrement(); + + uint32_t value(); + +protected: + bool presignalable() override { return false; } + +private: + Guest vptr; +}; + +class Mutex : public Waitable { +public: + Mutex(Guest _vptr); + + uint32_t value(); + void value(uint32_t val); + + ghandle owner(); + void owner(ghandle val); + + bool hasWaiters(); + void hasWaiters(bool val); + + void guestRelease(); + +protected: + bool presignalable() override { return false; } + +private: + Guest vptr; +}; diff --git a/ThreadManager.cpp b/ThreadManager.cpp new file mode 100644 index 0000000..03831d1 --- /dev/null +++ b/ThreadManager.cpp @@ -0,0 +1,265 @@ +#include "Ctu.h" + +#define INSN_PER_SLICE 1000000 + +Thread::Thread(Ctu *_ctu, int _id) : ctu(_ctu), id(_id) { + active = false; + memset(®s, 0, sizeof(ThreadRegisters)); + + auto tlsSize = 1024 * 1024; + tlsBase = (1 << 24) + tlsSize * _id; + ctu->cpu.map(tlsBase, tlsSize); + ctu->cpu.guestptr(tlsBase + 0x1F8) = tlsBase + 0x200; +} + +void Thread::assignHandle(uint32_t _handle) { + handle = _handle; + ctu->cpu.guestptr(tlsBase + 0x3B8) = _handle; +} + +void Thread::terminate() { + ctu->tm.terminate(id); +} + +void Thread::suspend(function cb) { + if(!active) + return; + + active = false; + if(id == ctu->tm.current()->id) { + freeze(); + if(cb != nullptr) + cb(); + ctu->tm.next(true); + } else if(cb != nullptr) + cb(); +} + +void Thread::resume(function cb) { + if(active) + return; + + if(cb != nullptr) + onWake(cb); + active = true; + ctu->tm.enqueue(id); +} + +void Thread::freeze() { + ctu->cpu.storeRegs(regs); + LOG_DEBUG(Thread, "Froze thread 0x%x with PC 0x" ADDRFMT, id, regs.PC); +} + +void Thread::thaw() { + ctu->cpu.tlsBase(tlsBase); + if(wakeCallbacks.size()) { + for(auto cb : wakeCallbacks) + cb(); + wakeCallbacks.clear(); + } + ctu->cpu.loadRegs(regs); + LOG_DEBUG(Thread, "Thawed thread 0x%x with PC 0x" ADDRFMT, id, regs.PC); +} + +void Thread::onWake(function cb) { + wakeCallbacks.push_back(cb); +} + +NativeThread::NativeThread(Ctu *_ctu, function _runner, int _id) : ctu(_ctu), runner(_runner), id(_id), active(false) { +} + +void NativeThread::terminate() { + ctu->tm.terminate(id); +} + +void NativeThread::suspend() { + active = false; +} + +void NativeThread::resume() { + if(active) + return; + + active = true; + ctu->tm.enqueue(id); +} + +void NativeThread::run() { + runner(); +} + +ThreadManager::ThreadManager(Ctu *_ctu) : ctu(_ctu) { + threadId = 0; + _current = nullptr; + _last = nullptr; + switched = false; + first = true; + wasNativeLast = false; +} + +void ThreadManager::start() { + next(); + while(true) { + if(ctu->gdbStub.enabled) { + ctu->gdbStub.handlePacket(); + if(ctu->gdbStub.haltLoop && !ctu->gdbStub.stepLoop) + continue; + auto wasStep = ctu->gdbStub.stepLoop; + ctu->gdbStub.haltLoop = ctu->gdbStub.stepLoop = false; + if(_current == nullptr) { + next(); + continue; + } + ctu->cpu.exec(ctu->gdbStub.stepLoop ? 1 : INSN_PER_SLICE); + if(wasStep) { + ctu->gdbStub._break(); + ctu->gdbStub.haltLoop = ctu->gdbStub.stepLoop = false; + } + } else { + next(); + ctu->cpu.exec(INSN_PER_SLICE); + } + } +} + +shared_ptr ThreadManager::create(gptr pc, gptr sp) { + auto thread = make_shared(ctu, ++threadId); + thread->assignHandle(ctu->newHandle(thread)); + threads[thread->id] = thread; + thread->regs.PC = pc; + thread->regs.SP = sp; + thread->regs.X30 = TERMADDR; + return thread; +} + +shared_ptr ThreadManager::createNative(function runner) { + auto thread = make_shared(ctu, runner, ++threadId); + nativeThreads[thread->id] = thread; + return thread; +} + +void ThreadManager::requeue() { + if(_current == nullptr) + return; + + _current->freeze(); + running.push_back(_current); + _last = _current; + _current = nullptr; +} + +void ThreadManager::enqueue(int id) { + if(isNative(id)) { + for(auto other : runningNative) + if(other->id == id) + return; + runningNative.push_back(nativeThreads[id]); + return; + } + if(threads.find(id) == threads.end()) + return; + enqueue(threads[id]); +} + +void ThreadManager::enqueue(shared_ptr thread) { + for(auto other : running) + if(other->id == thread->id) + return; + running.push_back(thread); +} + +void ThreadManager::tryRunNative() { + if(wasNativeLast) + wasNativeLast = false; + else { + while(runningNative.size() > 0) { + auto native = runningNative.front(); + runningNative.pop_front(); + if(!native->active) + continue; + native->run(); + if(native->active) + runningNative.push_back(native); + break; + } + wasNativeLast = true; + } +} + +void ThreadManager::next(bool force) { + tryRunNative(); + + if(force) { + if(_current != nullptr) + _last = _current; + _current = nullptr; + } + + shared_ptr nt = nullptr; + while(true) { + if(running.size() == 0) { + tryRunNative(); + if(ctu->gdbStub.enabled) { + if(ctu->gdbStub.haltLoop) { + ctu->cpu.stop(); + return; + } + ctu->gdbStub.handlePacket(); + if(ctu->gdbStub.haltLoop) { + ctu->cpu.stop(); + return; + } + } + if(_current == nullptr) { + if(first) { + LOG_DEBUG(Thread, "No threads left to run!"); + ctu->bridge.start(); + } + first = false; + } else + return; + usleep(50); + continue; + } + nt = running.front(); + running.pop_front(); + if(nt->active) + break; + } + + switched = true; + + if(_current != nullptr) { + _current->freeze(); + if(_current->active) + enqueue(_current); + _last = _current; + } + nt->thaw(); + _current = nt; +} + +void ThreadManager::terminate(int id) { + if(threads.find(id) == threads.end()) { + if(isNative(id)) { + nativeThreads[id]->active = false; + nativeThreads.erase(id); + } + return; + } + threads[id]->active = false; + threads.erase(id); + next(true); +} + +shared_ptr ThreadManager::current() { + return _current; +} + +shared_ptr ThreadManager::last() { + return _last; +} + +bool ThreadManager::isNative(int id) { + return nativeThreads.find(id) != nativeThreads.end(); +} diff --git a/ThreadManager.h b/ThreadManager.h new file mode 100644 index 0000000..739b4a6 --- /dev/null +++ b/ThreadManager.h @@ -0,0 +1,106 @@ +#pragma once +#include "Ctu.h" + +typedef struct { + float64_t low; + float64_t high; +} float128; + +typedef struct { + guint SP, PC, NZCV; + union { + struct { + guint gprs[31]; + float128 fprs[32]; + }; + struct { + guint X0, X1, X2, X3, + X4, X5, X6, X7, + X8, X9, X10, X11, + X12, X13, X14, X15, + X16, X17, X18, X19, + X20, X21, X22, X23, + X24, X25, X26, X27, + X28, X29, X30; + float128 Q0, Q1, Q2, Q3, + Q4, Q5, Q6, Q7, + Q8, Q9, Q10, Q11, + Q12, Q13, Q14, Q15, + Q16, Q17, Q18, Q19, + Q20, Q21, Q22, Q23, + Q24, Q25, Q26, Q27, + Q28, Q29, Q30, Q31; + }; + }; +} ThreadRegisters; + +class Thread : public KObject { +public: + Thread(Ctu *_ctu, int _id); + void assignHandle(ghandle handle); + void terminate(); + void suspend(function cb=nullptr); + void resume(function cb=nullptr); + void freeze(); + void thaw(); + + void onWake(function cb); + + int id; + ghandle handle; + bool active; + ThreadRegisters regs; + gptr tlsBase; + +private: + Ctu *ctu; + list> wakeCallbacks; +}; + +class NativeThread { +public: + NativeThread(Ctu *_ctu, function _runner, int _id); + void terminate(); + void suspend(); + void resume(); + + void run(); + + int id; + bool active; + +private: + Ctu *ctu; + function runner; +}; + +class ThreadManager { +public: + ThreadManager(Ctu *_ctu); + void start(); + shared_ptr create(gptr pc=0, gptr sp=0); + shared_ptr createNative(function runner); + void requeue(); + void enqueue(int id); + void enqueue(shared_ptr thread); + void next(bool force=false); + void terminate(int id); + shared_ptr current(); + shared_ptr last(); + + bool switched; + +private: + void tryRunNative(); + bool isNative(int id); + + Ctu *ctu; + unordered_map> threads; + unordered_map> nativeThreads; + int threadId; + list> running; + list> runningNative; + shared_ptr _current, _last; + bool wasNativeLast; + bool first; +}; diff --git a/genallipc.py b/genallipc.py new file mode 100644 index 0000000..f8ad771 --- /dev/null +++ b/genallipc.py @@ -0,0 +1,2548 @@ +info = [ + ('nn::spl::detail::IRandomInterface', 0, '', '0 bytes in - 0 bytes out - Buffer<0,6,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 2, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 7, '', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 8, '', '0x10 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x301>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 9, '', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 11, '', '4 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x301>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 12, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 13, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFileSystemProxy', 17, '', '0 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 18, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 19, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFileSystemProxy', 21, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 22, '', '0x90 bytes in - 0 bytes out - InRaw<0x40,8,0>, InRaw<0x40,8,0x40>, InRaw<0x10,4,0x80>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 23, '', '0x80 bytes in - 0 bytes out - InRaw<0x40,8,0>, InRaw<0x40,8,0x40>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 24, '', '0 bytes in - 0 bytes out - Buffer<0,5,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 25, '', '0x10 bytes in - 0 bytes out - InRaw<1,1,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 26, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFileSystemProxy', 27, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 30, '', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 31, '', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 32, '', '0x20 bytes in - 0 bytes out - InRaw<1,1,0>, InRaw<8,8,8>, InRaw<8,8,0x10>, InRaw<8,8,0x18>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 51, '', '0x48 bytes in - 0 bytes out - OutObject<0,0>, InRaw<1,1,0>, InRaw<0x40,8,8>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 52, '', '0x48 bytes in - 0 bytes out - OutObject<0,0>, InRaw<1,1,0>, InRaw<0x40,8,8>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 53, '', '0x48 bytes in - 0 bytes out - OutObject<0,0>, InRaw<1,1,0>, InRaw<0x40,8,8>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 57, '', '0x10 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<1,1,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 58, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 59, '', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>, Buffer<0,5,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 60, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 61, '', '1 bytes in - 0 bytes out - OutObject<0,0>, InRaw<1,1,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 80, '', '0x48 bytes in - 0 bytes out - OutObject<0,0>, InRaw<1,1,0>, InRaw<0x40,8,8>, InRaw<4,4,4>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 100, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 110, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 200, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 201, '', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 202, '', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,8>, InRaw<1,1,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 203, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 400, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 500, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 501, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 600, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 601, '', '0x10 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 602, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,6,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 603, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 604, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 605, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFileSystemProxy', 606, '', '0x10 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<8,8,8>, InRaw<1,1,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 607, '', '0x20 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<0x10,1,0x10>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 608, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFileSystemProxy', 609, '', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 610, '', '0 bytes in - 0x18 bytes out - OutRaw<0x10,8,8>, OutRaw<1,1,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 620, '', '0x10 bytes in - 0 bytes out - InRaw<0x10,1,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 800, '', '0 bytes in - 0x80 bytes out - OutRaw<0x80,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1000, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1001, '', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1002, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1003, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1004, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1005, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystemProxy', 1006, '', '0 bytes in - 0 bytes out - Buffer<0,5,0>', ''), + ('nn::fssrv::sf::IFileSystem', 0, '', '0x10 bytes in - 0 bytes out - Buffer<0,0x19,0x301>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystem', 1, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 2, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 3, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 4, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 5, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>, Buffer<1,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 6, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>, Buffer<1,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 7, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 8, '', '4 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x301>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystem', 9, '', '4 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x301>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFileSystem', 10, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFileSystem', 11, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 12, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 13, '', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFileSystem', 14, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>, Buffer<0,0x19,0x301>', ''), + ('nn::fssrv::sf::IFile', 0, '', '0x18 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,0x46,0>, InRaw<8,8,0x10>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFile', 1, '', '0x18 bytes in - 0 bytes out - InRaw<8,8,8>, Buffer<0,0x45,0>, InRaw<8,8,0x10>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IFile', 2, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IFile', 3, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFile', 4, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDirectory', 0, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>', ''), + ('nn::fssrv::sf::IDirectory', 1, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::fssrv::sf::IStorage', 0, '', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,0x46,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IStorage', 1, '', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,0x45,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IStorage', 2, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IStorage', 3, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IStorage', 4, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::fssrv::sf::ISaveDataInfoReader', 0, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 0, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 1, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 2, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 3, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 4, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 5, '', '8 bytes in - 0x18 bytes out - OutRaw<0x10,4,0>, OutRaw<8,8,0x10>, Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 100, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 101, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 110, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 111, '', '4 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 112, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 113, '', '8 bytes in - 0x18 bytes out - OutRaw<0x10,4,0>, OutRaw<8,8,0x10>, Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 114, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 200, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 201, '', '0x10 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IDeviceOperator', 202, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 203, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 204, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IDeviceOperator', 205, '', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 206, '', '0x10 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 207, '', '0x10 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>, Buffer<1,5,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IDeviceOperator', 208, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 209, '', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,6,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IDeviceOperator', 210, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 211, '', '0x10 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 212, '', '0x10 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>, Buffer<1,5,0>, InRaw<8,8,8>', ''), + ('nn::fssrv::sf::IDeviceOperator', 213, '', '8 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 214, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 215, '', '0 bytes in - 0 bytes out', ''), + ('nn::fssrv::sf::IDeviceOperator', 216, '', '0 bytes in - 0x10 bytes out - OutRaw<0x10,2,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 217, '', '0 bytes in - 0x40 bytes out - OutRaw<0x40,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 218, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 300, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::fssrv::sf::IDeviceOperator', 301, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::fssrv::sf::IEventNotifier', 0, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::fssrv::sf::IFileSystemProxyForLoader', 0, '', '8 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x301>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IFileSystemProxyForLoader', 1, '', '8 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IProgramRegistry', 0, '', '0x28 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<8,8,0x10>, InRaw<1,1,0>, Buffer<0,5,0>, InRaw<8,8,0x18>, Buffer<1,5,0>, InRaw<8,8,0x20>', ''), + ('nn::fssrv::sf::IProgramRegistry', 1, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::fssrv::sf::IProgramRegistry', 256, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::tma::IHtcManager', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, Buffer<1,5,0>', ''), + ('nn::tma::IHtcManager', 1, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,5,0>', ''), + ('nn::tma::IHtcManager', 2, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::tma::IHtcManager', 3, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::tma::IHtcManager', 4, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::tma::IHtcManager', 5, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::tma::IHtcManager', 6, '', '0 bytes in - 0 bytes out - Buffer<0,6,0>', ''), + ('nn::tma::IHtcManager', 7, '', '0 bytes in - 0 bytes out - Buffer<0,6,0>', ''), + ('nn::tma::IHtcManager', 8, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::htc::tenv::IServiceManager', 0, '', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', ''), + ('nn::htc::tenv::IService', 0, '', '0x40 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>, InRaw<0x40,1,0>', ''), + ('nn::htc::tenv::IService', 1, '', '0x40 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<0x40,1,0>', ''), + ('nn::htc::tenv::IService', 2, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::ro::detail::IRoInterface', 0, '', '0x28 bytes in - 8 bytes out - takes pid - OutRaw<8,8,0>, InRaw<8,8,0>, InRaw<8,8,8>, InRaw<8,8,0x10>, InRaw<8,8,0x18>, InRaw<8,8,0x20>', ''), + ('nn::ro::detail::IRoInterface', 1, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::ro::detail::IRoInterface', 2, '', '0x18 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, InRaw<8,8,0x10>', ''), + ('nn::ro::detail::IRoInterface', 3, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::ro::detail::IRoInterface', 4, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InHandle<0,1>', ''), + ('nn::sm::detail::IUserInterface', 0, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::sm::detail::IUserInterface', 1, '', '8 bytes in - 0 bytes out - OutHandle<0,2>, InRaw<8,1,0>', ''), + ('nn::sm::detail::IUserInterface', 2, '', '0x10 bytes in - 0 bytes out - OutHandle<0,2>, InRaw<8,1,0>, InRaw<4,4,0xC>, InRaw<1,1,8>', ''), + ('nn::sm::detail::IUserInterface', 3, '', '8 bytes in - 0 bytes out - InRaw<8,1,0>', ''), + ('nn::sm::detail::IManagerInterface', 0, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,5,0>, Buffer<1,5,0>', ''), + ('nn::sm::detail::IManagerInterface', 1, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::socket::sf::IClient', 0, '', '0x30 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, InRaw<8,8,0x20>, InHandle<0,1>, InRaw<8,8,0x28>, InRaw<0x20,4,0>', ''), + ('nn::socket::sf::IClient', 1, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::socket::sf::IClient', 2, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 3, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 4, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::socket::sf::IClient', 5, '', '0x20 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, Buffer<1,0x21,0>, Buffer<2,0x21,0>, Buffer<3,0x22,0>, Buffer<4,0x22,0>, Buffer<5,0x22,0>, InRaw<0x18,8,8>', ''), + ('nn::socket::sf::IClient', 6, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,0x21,0>, Buffer<1,0x22,0>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 7, '', '0 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,0x21,0>, Buffer<1,0x22,0>, OutRaw<4,4,8>, Buffer<2,0x21,0>', ''), + ('nn::socket::sf::IClient', 8, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 9, '', '8 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, InRaw<4,4,4>, Buffer<1,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 10, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 11, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, InRaw<4,4,4>, Buffer<1,0x21,0>', ''), + ('nn::socket::sf::IClient', 12, '', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 13, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 14, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 15, '', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 16, '', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 17, '', '0xC bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 18, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 19, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, Buffer<0,0x21,0>, Buffer<1,0x21,0>, Buffer<2,0x21,0>, Buffer<3,0x21,0>, Buffer<4,0x22,0>, Buffer<5,0x22,0>, Buffer<6,0x22,0>, Buffer<7,0x22,0>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 20, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 21, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 22, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 23, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::socket::sf::IClient', 24, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 25, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>', ''), + ('nn::socket::sf::IClient', 26, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::socket::sf::IClient', 27, '', '0x10 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<8,8,8>', ''), + ('nn::socket::sf::IClient', 28, '', '8 bytes in - 8 bytes out - takes pid - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<8,8,0>, Buffer<0,0x22,0>', ''), + ('nn::socket::sf::IClient', 29, '', '0x20 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, InRaw<4,4,4>, InRaw<4,4,8>, InRaw<0x10,8,0x10>', ''), + ('nn::socket::sf::IClient', 30, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, InRaw<4,4,4>, Buffer<1,0x21,0>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 0, '', '0x30 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, InRaw<8,8,0x20>, InHandle<0,1>, InRaw<8,8,0x28>, InRaw<0x20,4,0>', ''), + ('nn::socket::sf::IClient', 1, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::socket::sf::IClient', 2, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 3, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 4, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::socket::sf::IClient', 5, '', '0x20 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, Buffer<1,0x21,0>, Buffer<2,0x21,0>, Buffer<3,0x22,0>, Buffer<4,0x22,0>, Buffer<5,0x22,0>, InRaw<0x18,8,8>', ''), + ('nn::socket::sf::IClient', 6, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,0x21,0>, Buffer<1,0x22,0>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 7, '', '0 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,0x21,0>, Buffer<1,0x22,0>, OutRaw<4,4,8>, Buffer<2,0x21,0>', ''), + ('nn::socket::sf::IClient', 8, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 9, '', '8 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, InRaw<4,4,4>, Buffer<1,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 10, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 11, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, InRaw<4,4,4>, Buffer<1,0x21,0>', ''), + ('nn::socket::sf::IClient', 12, '', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 13, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 14, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 15, '', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 16, '', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 17, '', '0xC bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>, Buffer<0,0x22,0>, OutRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 18, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 19, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, Buffer<0,0x21,0>, Buffer<1,0x21,0>, Buffer<2,0x21,0>, Buffer<3,0x21,0>, Buffer<4,0x22,0>, Buffer<5,0x22,0>, Buffer<6,0x22,0>, Buffer<7,0x22,0>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 20, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::socket::sf::IClient', 21, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 22, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::socket::sf::IClient', 23, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::socket::sf::IClient', 24, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>', ''), + ('nn::socket::sf::IClient', 25, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>', ''), + ('nn::socket::sf::IClient', 26, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::socket::sf::IClient', 27, '', '0x10 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<8,8,8>', ''), + ('nn::socket::sf::IClient', 28, '', '8 bytes in - 8 bytes out - takes pid - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<8,8,0>, Buffer<0,0x22,0>', ''), + ('nn::socket::sf::IClient', 29, '', '0x20 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x22,0>, InRaw<4,4,4>, InRaw<4,4,8>, InRaw<0x10,8,0x10>', ''), + ('nn::socket::sf::IClient', 30, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, Buffer<0,0x21,0>, InRaw<4,4,4>, Buffer<1,0x21,0>, InRaw<4,4,8>', ''), + ('nn::socket::resolver::IResolver', 0, '', '4 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<4,4,0>', ''), + ('nn::socket::resolver::IResolver', 1, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>, Buffer<0,6,0>', ''), + ('nn::socket::resolver::IResolver', 2, '', '0x10 bytes in - 0xC bytes out - takes pid - InRaw<4,4,4>, InRaw<8,8,8>, InRaw<1,1,0>, Buffer<0,5,0>, OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<1,6,0>, OutRaw<4,4,8>', ''), + ('nn::socket::resolver::IResolver', 3, '', '0x18 bytes in - 0xC bytes out - takes pid - InRaw<4,4,0>, InRaw<8,8,0x10>, Buffer<0,5,0>, InRaw<4,4,4>, InRaw<4,4,8>, OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<1,6,0>, OutRaw<4,4,8>', ''), + ('nn::socket::resolver::IResolver', 4, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>, Buffer<0,6,0>', ''), + ('nn::socket::resolver::IResolver', 5, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>, Buffer<0,6,0>', ''), + ('nn::socket::resolver::IResolver', 6, '', '0x10 bytes in - 0xC bytes out - takes pid - InRaw<4,4,4>, InRaw<8,8,8>, InRaw<1,1,0>, Buffer<0,5,0>, Buffer<1,5,0>, Buffer<2,5,0>, Buffer<3,6,0>, OutRaw<4,4,0>, OutRaw<4,4,4>, OutRaw<4,4,8>', ''), + ('nn::socket::resolver::IResolver', 7, '', '0x10 bytes in - 8 bytes out - takes pid - InRaw<4,4,0>, InRaw<8,8,8>, Buffer<0,5,0>, Buffer<1,6,0>, Buffer<2,6,0>, InRaw<4,4,4>, OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::socket::resolver::IResolver', 8, '', '8 bytes in - 4 bytes out - takes pid - InRaw<8,8,0>, OutRaw<4,4,0>', ''), + ('nn::socket::resolver::IResolver', 9, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::account::IAccountServiceForApplication', 0, 'GetUserCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::account::IAccountServiceForApplication', 1, 'GetUserExistence', '0x10 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForApplication', 2, 'ListAllUsers', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::IAccountServiceForApplication', 3, 'ListOpenUsers', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::IAccountServiceForApplication', 4, 'GetLastOpenedUser', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::account::IAccountServiceForApplication', 5, 'GetProfile', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForApplication', 6, 'GetProfileDigest', '0x10 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForApplication', 50, 'IsUserRegistrationRequestPermitted', '8 bytes in - 1 bytes out - takes pid - OutRaw<1,1,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::account::IAccountServiceForApplication', 51, 'TrySelectUserWithoutInteraction', '1 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<1,1,0>', '(nn::sf::Out,bool)'), + ('nn::account::IAccountServiceForApplication', 100, 'InitializeApplicationInfo', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(unsigned long)'), + ('nn::account::IAccountServiceForApplication', 101, 'GetBaasAccountManagerForApplication', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForApplication', 102, 'AuthenticateApplicationAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForApplication', 110, 'StoreSaveDataThumbnail', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>, Buffer<0,5,0>', '(nn::account::Uid const&,nn::sf::InBuffer const&)'), + ('nn::account::IAccountServiceForApplication', 111, 'ClearSaveDataThumbnail', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForApplication', 120, 'CreateGuestLoginRequest', '4 bytes in - 0 bytes out - OutObject<0,0>, InHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,void>,nn::sf::NativeHandle &&,unsigned int)'), + ('nn::account::profile::IProfile', 0, 'Get', '0 bytes in - 0x38 bytes out - OutRaw<0x38,8,0>, Buffer<0,0x1A,0x80>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::account::profile::IProfile', 1, 'GetBase', '0 bytes in - 0x38 bytes out - OutRaw<0x38,8,0>', '(nn::sf::Out)'), + ('nn::account::profile::IProfile', 10, 'GetImageSize', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::account::profile::IProfile', 11, 'LoadImage', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IManagerForApplication', 0, 'CheckAvailability', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::baas::IManagerForApplication', 1, 'GetAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IManagerForApplication', 2, 'EnsureIdTokenCacheAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IManagerForApplication', 3, 'LoadIdTokenCache', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IManagerForApplication', 130, 'GetNintendoAccountUserResourceCacheForApplication', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0x1A,0x68>, Buffer<1,6,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IManagerForApplication', 150, 'CreateAuthorizationRequest', '4 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x200>, InHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,void>,nn::account::NintendoAccountAuthorizationRequestParameters const&,nn::sf::NativeHandle &&,unsigned int)'), + ('nn::account::detail::IAsyncContext', 0, 'GetSystemEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::account::detail::IAsyncContext', 1, 'Cancel', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::detail::IAsyncContext', 2, 'HasDone', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::account::detail::IAsyncContext', 3, 'GetResult', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::nas::IAuthorizationRequest', 0, 'GetSessionId', '0 bytes in - 0x10 bytes out - OutRaw<0x10,4,0>', '(nn::sf::Out)'), + ('nn::account::nas::IAuthorizationRequest', 10, 'InvokeWithoutInteractionAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::nas::IAuthorizationRequest', 19, 'IsAuthorized', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::account::nas::IAuthorizationRequest', 20, 'GetAuthorizationCode', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::nas::IAuthorizationRequest', 21, 'GetIdToken', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::nas::IAuthorizationRequest', 22, 'GetState', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x80>', '(nn::sf::Out)'), + ('nn::account::baas::IGuestLoginRequest', 0, 'GetSessionId', '0 bytes in - 0x10 bytes out - OutRaw<0x10,4,0>', '(nn::sf::Out)'), + ('nn::account::baas::IGuestLoginRequest', 12, 'GetAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IGuestLoginRequest', 13, 'GetLinkedNintendoAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IGuestLoginRequest', 14, 'GetNickname', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::baas::IGuestLoginRequest', 15, 'GetProfileImage', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IGuestLoginRequest', 21, 'LoadIdTokenCache', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::IAccountServiceForSystemService', 0, 'GetUserCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::account::IAccountServiceForSystemService', 1, 'GetUserExistence', '0x10 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForSystemService', 2, 'ListAllUsers', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::IAccountServiceForSystemService', 3, 'ListOpenUsers', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::IAccountServiceForSystemService', 4, 'GetLastOpenedUser', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::account::IAccountServiceForSystemService', 5, 'GetProfile', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForSystemService', 6, 'GetProfileDigest', '0x10 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForSystemService', 50, 'IsUserRegistrationRequestPermitted', '8 bytes in - 1 bytes out - takes pid - OutRaw<1,1,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::account::IAccountServiceForSystemService', 51, 'TrySelectUserWithoutInteraction', '1 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<1,1,0>', '(nn::sf::Out,bool)'), + ('nn::account::IAccountServiceForSystemService', 100, 'GetUserRegistrationNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForSystemService', 101, 'GetUserStateChangeNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForSystemService', 102, 'GetBaasAccountManagerForSystemService', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForSystemService', 103, 'GetBaasUserAvailabilityChangeNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForSystemService', 104, 'GetProfileUpdateNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForSystemService', 110, 'StoreSaveDataThumbnail', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>, Buffer<0,5,0>', '(nn::account::Uid const&,nn::ApplicationId,nn::sf::InBuffer const&)'), + ('nn::account::IAccountServiceForSystemService', 111, 'ClearSaveDataThumbnail', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::ApplicationId)'), + ('nn::account::IAccountServiceForSystemService', 112, 'LoadSaveDataThumbnail', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::sf::Out,nn::sf::OutBuffer const&,nn::account::Uid const&,nn::ApplicationId)'), + ('nn::account::IAccountServiceForSystemService', 190, 'GetUserLastOpenedApplication', '0x10 bytes in - 0x10 bytes out - OutRaw<8,8,8>, OutRaw<4,4,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForSystemService', 997, 'DebugInvalidateTokenCacheForUser', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForSystemService', 998, 'DebugSetUserStateClose', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForSystemService', 999, 'DebugSetUserStateOpen', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::detail::INotifier', 0, 'GetSystemEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::account::baas::IManagerForSystemService', 0, 'CheckAvailability', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::baas::IManagerForSystemService', 1, 'GetAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IManagerForSystemService', 2, 'EnsureIdTokenCacheAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IManagerForSystemService', 3, 'LoadIdTokenCache', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IManagerForSystemService', 100, 'SetSystemProgramIdentification', '8 bytes in - 0 bytes out - takes pid - Buffer<0,0x19,0x10>, InRaw<8,8,0>', '(nn::account::SystemProgramIdentification const&,unsigned long)'), + ('nn::account::baas::IManagerForSystemService', 120, 'GetNintendoAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IManagerForSystemService', 130, 'GetNintendoAccountUserResourceCache', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0x1A,0x24F>, Buffer<1,6,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IManagerForSystemService', 131, 'RefreshNintendoAccountUserResourceCacheAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IManagerForSystemService', 132, 'RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,void>,unsigned int)'), + ('nn::account::baas::IManagerForSystemService', 150, 'CreateAuthorizationRequest', '4 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x108>, Buffer<1,0x19,0x200>, InHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,void>,nn::account::nas::NasClientInfo const&,nn::account::NintendoAccountAuthorizationRequestParameters const&,nn::sf::NativeHandle &&,unsigned int)'), + ('nn::account::IAccountServiceForAdministrator', 0, 'GetUserCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::account::IAccountServiceForAdministrator', 1, 'GetUserExistence', '0x10 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 2, 'ListAllUsers', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::IAccountServiceForAdministrator', 3, 'ListOpenUsers', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::IAccountServiceForAdministrator', 4, 'GetLastOpenedUser', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::account::IAccountServiceForAdministrator', 5, 'GetProfile', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 6, 'GetProfileDigest', '0x10 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 50, 'IsUserRegistrationRequestPermitted', '8 bytes in - 1 bytes out - takes pid - OutRaw<1,1,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::account::IAccountServiceForAdministrator', 51, 'TrySelectUserWithoutInteraction', '1 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<1,1,0>', '(nn::sf::Out,bool)'), + ('nn::account::IAccountServiceForAdministrator', 100, 'GetUserRegistrationNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForAdministrator', 101, 'GetUserStateChangeNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForAdministrator', 102, 'GetBaasAccountManagerForSystemService', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 103, 'GetBaasUserAvailabilityChangeNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForAdministrator', 104, 'GetProfileUpdateNotifier', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForAdministrator', 110, 'StoreSaveDataThumbnail', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>, Buffer<0,5,0>', '(nn::account::Uid const&,nn::ApplicationId,nn::sf::InBuffer const&)'), + ('nn::account::IAccountServiceForAdministrator', 111, 'ClearSaveDataThumbnail', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::ApplicationId)'), + ('nn::account::IAccountServiceForAdministrator', 112, 'LoadSaveDataThumbnail', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::sf::Out,nn::sf::OutBuffer const&,nn::account::Uid const&,nn::ApplicationId)'), + ('nn::account::IAccountServiceForAdministrator', 190, 'GetUserLastOpenedApplication', '0x10 bytes in - 0x10 bytes out - OutRaw<8,8,8>, OutRaw<4,4,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 997, 'DebugInvalidateTokenCacheForUser', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 998, 'DebugSetUserStateClose', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 999, 'DebugSetUserStateOpen', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 200, 'BeginUserRegistration', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::account::IAccountServiceForAdministrator', 201, 'CompleteUserRegistration', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 202, 'CancelUserRegistration', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 203, 'DeleteUser', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 204, 'SetUserPosition', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::account::Uid const&,int)'), + ('nn::account::IAccountServiceForAdministrator', 205, 'GetProfileEditor', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 206, 'CompleteUserRegistrationForcibly', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 210, 'CreateFloatingRegistrationRequest', '4 bytes in - 0 bytes out - OutObject<0,0>, InHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,void>,nn::sf::NativeHandle &&,unsigned int)'), + ('nn::account::IAccountServiceForAdministrator', 230, 'AuthenticateServiceAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::IAccountServiceForAdministrator', 250, 'GetBaasAccountAdministrator', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IAccountServiceForAdministrator', 290, 'ProxyProcedureForGuestLoginWithNintendoAccount', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,4,0>', '(nn::sf::Out,void>,nn::account::detail::Uuid const&)'), + ('nn::account::IAccountServiceForAdministrator', 291, 'ProxyProcedureForFloatingRegistrationWithNintendoAccount', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,4,0>', '(nn::sf::Out,void>,nn::account::detail::Uuid const&)'), + ('nn::account::IAccountServiceForAdministrator', 299, 'SuspendBackgroundDaemon', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::profile::IProfileEditor', 0, 'Get', '0 bytes in - 0x38 bytes out - OutRaw<0x38,8,0>, Buffer<0,0x1A,0x80>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::account::profile::IProfileEditor', 1, 'GetBase', '0 bytes in - 0x38 bytes out - OutRaw<0x38,8,0>', '(nn::sf::Out)'), + ('nn::account::profile::IProfileEditor', 10, 'GetImageSize', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::account::profile::IProfileEditor', 11, 'LoadImage', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::profile::IProfileEditor', 100, 'Store', '0x38 bytes in - 0 bytes out - InRaw<0x38,8,0>, Buffer<0,0x19,0x80>', '(nn::account::profile::ProfileBase const&,nn::account::profile::UserData const&)'), + ('nn::account::profile::IProfileEditor', 101, 'StoreWithImage', '0x38 bytes in - 0 bytes out - InRaw<0x38,8,0>, Buffer<0,0x19,0x80>, Buffer<1,5,0>', '(nn::account::profile::ProfileBase const&,nn::account::profile::UserData const&,nn::sf::InBuffer const&)'), + ('nn::account::baas::IFloatingRegistrationRequest', 0, 'GetSessionId', '0 bytes in - 0x10 bytes out - OutRaw<0x10,4,0>', '(nn::sf::Out)'), + ('nn::account::baas::IFloatingRegistrationRequest', 12, 'GetAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IFloatingRegistrationRequest', 13, 'GetLinkedNintendoAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IFloatingRegistrationRequest', 14, 'GetNickname', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::baas::IFloatingRegistrationRequest', 15, 'GetProfileImage', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IFloatingRegistrationRequest', 21, 'LoadIdTokenCache', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IFloatingRegistrationRequest', 100, 'RegisterAsync', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, OutObject<0,0>', '(nn::sf::Out,nn::sf::Out,void>)'), + ('nn::account::baas::IFloatingRegistrationRequest', 101, 'RegisterWithUidAsync', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::baas::IFloatingRegistrationRequest', 110, 'SetSystemProgramIdentification', '8 bytes in - 0 bytes out - takes pid - Buffer<0,0x19,0x10>, InRaw<8,8,0>', '(nn::account::SystemProgramIdentification const&,unsigned long)'), + ('nn::account::baas::IFloatingRegistrationRequest', 111, 'EnsureIdTokenCacheAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 0, 'CheckAvailability', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::baas::IAdministrator', 1, 'GetAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IAdministrator', 2, 'EnsureIdTokenCacheAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 3, 'LoadIdTokenCache', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IAdministrator', 100, 'SetSystemProgramIdentification', '8 bytes in - 0 bytes out - takes pid - Buffer<0,0x19,0x10>, InRaw<8,8,0>', '(nn::account::SystemProgramIdentification const&,unsigned long)'), + ('nn::account::baas::IAdministrator', 120, 'GetNintendoAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::baas::IAdministrator', 130, 'GetNintendoAccountUserResourceCache', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0x1A,0x24F>, Buffer<1,6,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::baas::IAdministrator', 131, 'RefreshNintendoAccountUserResourceCacheAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 132, 'RefreshNintendoAccountUserResourceCacheAsyncIfSecondsElapsed', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,void>,unsigned int)'), + ('nn::account::baas::IAdministrator', 150, 'CreateAuthorizationRequest', '4 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x108>, Buffer<1,0x19,0x200>, InHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,void>,nn::account::nas::NasClientInfo const&,nn::account::NintendoAccountAuthorizationRequestParameters const&,nn::sf::NativeHandle &&,unsigned int)'), + ('nn::account::baas::IAdministrator', 200, 'IsRegistered', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::account::baas::IAdministrator', 201, 'RegisterAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 202, 'UnregisterAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 203, 'DeleteRegistrationInfoLocally', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::baas::IAdministrator', 220, 'SynchronizeProfileAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 221, 'UploadProfileAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 222, 'SynchronizeProfileAsyncIfSecondsElapsed', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,void>,unsigned int)'), + ('nn::account::baas::IAdministrator', 250, 'IsLinkedWithNintendoAccount', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::account::baas::IAdministrator', 251, 'CreateProcedureToLinkWithNintendoAccount', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 252, 'ResumeProcedureToLinkWithNintendoAccount', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,4,0>', '(nn::sf::Out,void>,nn::account::detail::Uuid const&)'), + ('nn::account::baas::IAdministrator', 255, 'CreateProcedureToUpdateLinkageStateOfNintendoAccount', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 256, 'ResumeProcedureToUpdateLinkageStateOfNintendoAccount', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,4,0>', '(nn::sf::Out,void>,nn::account::detail::Uuid const&)'), + ('nn::account::baas::IAdministrator', 260, 'CreateProcedureToLinkNnidWithNintendoAccount', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 261, 'ResumeProcedureToLinkNnidWithNintendoAccount', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,4,0>', '(nn::sf::Out,void>,nn::account::detail::Uuid const&)'), + ('nn::account::baas::IAdministrator', 280, 'ProxyProcedureToAcquireApplicationAuthorizationForNintendoAccount', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,4,0>', '(nn::sf::Out,void>,nn::account::detail::Uuid const&)'), + ('nn::account::baas::IAdministrator', 997, 'DebugUnlinkNintendoAccountAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::baas::IAdministrator', 998, 'DebugSetAvailabilityErrorDetail', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 0, 'PrepareAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 1, 'GetRequest', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x1000>, Buffer<1,0x1A,0x100>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 2, 'ApplyResponse', '0 bytes in - 0 bytes out - Buffer<0,9,0>', '(nn::sf::InArray const&)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 3, 'ApplyResponseAsync', '0 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,9,0>', '(nn::sf::Out,void>,nn::sf::InArray const&)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 10, 'Suspend', '0 bytes in - 0x10 bytes out - OutRaw<0x10,4,0>', '(nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 100, 'GetRequestWithTheme', '4 bytes in - 0 bytes out - Buffer<0,0x1A,0x1000>, Buffer<1,0x1A,0x100>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,int)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 101, 'IsNetworkServiceAccountReplaced', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForNintendoAccountLinkage', 199, 'GetUrlForIntroductionOfExtraMembership', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x1000>', '(nn::sf::Out)'), + ('nn::account::http::IOAuthProcedure', 0, 'PrepareAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::http::IOAuthProcedure', 1, 'GetRequest', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x1000>, Buffer<1,0x1A,0x100>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::account::http::IOAuthProcedure', 2, 'ApplyResponse', '0 bytes in - 0 bytes out - Buffer<0,9,0>', '(nn::sf::InArray const&)'), + ('nn::account::http::IOAuthProcedure', 3, 'ApplyResponseAsync', '0 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,9,0>', '(nn::sf::Out,void>,nn::sf::InArray const&)'), + ('nn::account::http::IOAuthProcedure', 10, 'Suspend', '0 bytes in - 0x10 bytes out - OutRaw<0x10,4,0>', '(nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 0, 'PrepareAsync', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 1, 'GetRequest', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x1000>, Buffer<1,0x1A,0x100>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 2, 'ApplyResponse', '0 bytes in - 0 bytes out - Buffer<0,9,0>', '(nn::sf::InArray const&)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 3, 'ApplyResponseAsync', '0 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,9,0>', '(nn::sf::Out,void>,nn::sf::InArray const&)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 10, 'Suspend', '0 bytes in - 0x10 bytes out - OutRaw<0x10,4,0>', '(nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 100, 'GetAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 101, 'GetLinkedNintendoAccountId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 102, 'GetNickname', '0 bytes in - 0 bytes out - Buffer<0,0xA,0>', '(nn::sf::OutArray const&)'), + ('nn::account::nas::IOAuthProcedureForExternalNsa', 103, 'GetProfileImage', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::account::detail::ISessionObject', 999, 'Dummy', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::IBaasAccessTokenAccessor', 0, 'EnsureCacheAsync', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::IBaasAccessTokenAccessor', 1, 'LoadCache', '0x10 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::OutBuffer const&,nn::account::Uid const&)'), + ('nn::account::IBaasAccessTokenAccessor', 2, 'GetDeviceAccountId', '0x10 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::account::IBaasAccessTokenAccessor', 50, 'RegisterNotificationTokenAsync', '0x38 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0x28>, InRaw<0x28,1,0>', '(nn::sf::Out,void>,nn::account::Uid const&,nn::npns::NotificationToken const&)'), + ('nn::account::IBaasAccessTokenAccessor', 51, 'UnregisterNotificationTokenAsync', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::account::detail::IAsyncContext', 0, 'GetSystemEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::account::detail::IAsyncContext', 1, 'Cancel', '0 bytes in - 0 bytes out', '(void)'), + ('nn::account::detail::IAsyncContext', 2, 'HasDone', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::account::detail::IAsyncContext', 3, 'GetResult', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IAllSystemAppletProxiesService', 100, 'OpenSystemAppletProxy', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>, InHandle<0,1>', '(nn::sf::Out,void>,unsigned long,nn::sf::NativeHandle &&)'), + ('nn::am::service::IAllSystemAppletProxiesService', 200, 'OpenLibraryAppletProxyOld', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>, InHandle<0,1>', '(nn::sf::Out,void>,unsigned long,nn::sf::NativeHandle &&)'), + ('nn::am::service::IAllSystemAppletProxiesService', 201, 'OpenLibraryAppletProxy', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>, InHandle<0,1>, Buffer<0,0x15,0x80>', '(nn::sf::Out,void>,unsigned long,nn::sf::NativeHandle &&,nn::am::AppletAttribute const&)'), + ('nn::am::service::IAllSystemAppletProxiesService', 300, 'OpenOverlayAppletProxy', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>, InHandle<0,1>', '(nn::sf::Out,void>,unsigned long,nn::sf::NativeHandle &&)'), + ('nn::am::service::IAllSystemAppletProxiesService', 350, 'OpenSystemApplicationProxy', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>, InHandle<0,1>', '(nn::sf::Out,void>,unsigned long,nn::sf::NativeHandle &&)'), + ('nn::am::service::IAllSystemAppletProxiesService', 400, 'CreateSelfLibraryAppletCreatorForDevelop', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,unsigned long)'), + ('nn::am::service::ISystemAppletProxy', 0, 'GetCommonStateGetter', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 1, 'GetSelfController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 2, 'GetWindowController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 3, 'GetAudioController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 4, 'GetDisplayController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 1000, 'GetDebugFunctions', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 10, 'GetProcessWindingController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 11, 'GetLibraryAppletCreator', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 20, 'GetHomeMenuFunctions', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 21, 'GetGlobalStateController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ISystemAppletProxy', 22, 'GetApplicationCreator', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ICommonStateGetter', 0, 'GetEventHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 1, 'ReceiveMessage', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 2, 'GetThisAppletKind', '0 bytes in - 8 bytes out - OutRaw<8,4,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 3, 'AllowToEnterSleep', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ICommonStateGetter', 4, 'DisallowToEnterSleep', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ICommonStateGetter', 5, 'GetOperationMode', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 6, 'GetPerformanceMode', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 7, 'GetCradleStatus', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 8, 'GetBootMode', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 9, 'GetCurrentFocusState', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 10, 'RequestToAcquireSleepLock', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ICommonStateGetter', 11, 'ReleaseSleepLock', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ICommonStateGetter', 12, 'ReleaseSleepLockTransiently', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ICommonStateGetter', 13, 'GetAcquiredSleepLockEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 20, 'PushToGeneralChannel', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ICommonStateGetter', 30, 'GetHomeButtonReaderLockAccessor', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ICommonStateGetter', 31, 'GetReaderLockAccessorEx', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,int)'), + ('nn::am::service::ICommonStateGetter', 40, 'GetCradleFwVersion', '0 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, OutRaw<4,4,8>, OutRaw<4,4,0xC>', '(nn::sf::Out,nn::sf::Out,nn::sf::Out,nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 50, 'IsVrModeEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 51, 'SetVrModeEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ICommonStateGetter', 55, 'IsInControllerFirmwareUpdateSection', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 60, 'GetDefaultDisplayResolution', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::am::service::ICommonStateGetter', 61, 'GetDefaultDisplayResolutionChangeEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ILockAccessor', 1, 'TryLock', '1 bytes in - 1 bytes out - OutRaw<1,1,0>, OutHandle<0,1>, InRaw<1,1,0>', '(nn::sf::Out,nn::sf::Out,bool)'), + ('nn::am::service::ILockAccessor', 2, 'Unlock', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILockAccessor', 3, 'GetEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ISelfController', 0, 'Exit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ISelfController', 1, 'LockExit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ISelfController', 2, 'UnlockExit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ISelfController', 3, 'EnterFatalSection', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ISelfController', 4, 'LeaveFatalSection', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ISelfController', 9, 'GetLibraryAppletLaunchableEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ISelfController', 10, 'SetScreenShotPermission', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::am::service::ISelfController', 11, 'SetOperationModeChangedNotification', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 12, 'SetPerformanceModeChangedNotification', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 13, 'SetFocusHandlingMode', '3 bytes in - 0 bytes out - InRaw<1,1,0>, InRaw<1,1,1>, InRaw<1,1,2>', '(bool,bool,bool)'), + ('nn::am::service::ISelfController', 14, 'SetRestartMessageEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 15, 'SetScreenShotAppletIdentityInfo', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::am::service::AppletIdentityInfo const&)'), + ('nn::am::service::ISelfController', 16, 'SetOutOfFocusSuspendingEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 17, 'SetControllerFirmwareUpdateSection', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 18, 'SetRequiresCaptureButtonShortPressedMessage', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 19, 'SetScreenShotImageOrientation', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::am::service::ISelfController', 40, 'CreateManagedDisplayLayer', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::am::service::ISelfController', 50, 'SetHandlesRequestToDisplay', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 51, 'ApproveToDisplay', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ISelfController', 60, 'OverrideAutoSleepTimeAndDimmingTime', '0x10 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>, InRaw<4,4,0xC>', '(int,int,int,int)'), + ('nn::am::service::ISelfController', 61, 'SetMediaPlaybackState', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ISelfController', 62, 'SetIdleTimeDetectionExtension', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::am::service::ISelfController', 63, 'GetIdleTimeDetectionExtension', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::am::service::ISelfController', 64, 'SetInputDetectionSourceSet', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::am::service::ISelfController', 65, 'ReportUserIsActive', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ISelfController', 66, 'GetCurrentIlluminance', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::am::service::ISelfController', 67, 'IsIlluminanceAvailable', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IWindowController', 0, 'CreateWindow', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,nn::am::service::WindowCreationOption)'), + ('nn::am::service::IWindowController', 1, 'GetAppletResourceUserId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::am::service::IWindowController', 10, 'AcquireForegroundRights', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IWindowController', 11, 'ReleaseForegroundRights', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IWindowController', 12, 'RejectToChangeIntoBackground', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IAudioController', 0, 'SetExpectedMasterVolume', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(float,float)'), + ('nn::am::service::IAudioController', 1, 'GetMainAppletExpectedMasterVolume', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::am::service::IAudioController', 2, 'GetLibraryAppletExpectedMasterVolume', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::am::service::IAudioController', 3, 'ChangeMainAppletMasterVolume', '0x10 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<8,8,8>', '(float,long)'), + ('nn::am::service::IAudioController', 4, 'SetTransparentVolumeRate', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(float)'), + ('nn::am::service::IDisplayController', 0, 'GetLastForegroundCaptureImage', '0 bytes in - 0 bytes out - Buffer<0,6,0>', '(nn::sf::OutBuffer const&)'), + ('nn::am::service::IDisplayController', 1, 'UpdateLastForegroundCaptureImage', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IDisplayController', 2, 'GetLastApplicationCaptureImage', '0 bytes in - 0 bytes out - Buffer<0,6,0>', '(nn::sf::OutBuffer const&)'), + ('nn::am::service::IDisplayController', 3, 'GetCallerAppletCaptureImage', '0 bytes in - 0 bytes out - Buffer<0,6,0>', '(nn::sf::OutBuffer const&)'), + ('nn::am::service::IDisplayController', 4, 'UpdateCallerAppletCaptureImage', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IDisplayController', 5, 'GetLastForegroundCaptureImageEx', '0 bytes in - 1 bytes out - OutRaw<1,1,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::am::service::IDisplayController', 6, 'GetLastApplicationCaptureImageEx', '0 bytes in - 1 bytes out - OutRaw<1,1,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::am::service::IDisplayController', 7, 'GetCallerAppletCaptureImageEx', '0 bytes in - 1 bytes out - OutRaw<1,1,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::am::service::IDisplayController', 8, 'TakeScreenShotOfOwnLayer', '8 bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>', '(int,bool)'), + ('nn::am::service::IDisplayController', 10, 'AcquireLastApplicationCaptureBuffer', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::IDisplayController', 11, 'ReleaseLastApplicationCaptureBuffer', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IDisplayController', 12, 'AcquireLastForegroundCaptureBuffer', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::IDisplayController', 13, 'ReleaseLastForegroundCaptureBuffer', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IDisplayController', 14, 'AcquireCallerAppletCaptureBuffer', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::IDisplayController', 15, 'ReleaseCallerAppletCaptureBuffer', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IDisplayController', 16, 'AcquireLastApplicationCaptureBufferEx', '0 bytes in - 1 bytes out - OutRaw<1,1,0>, OutHandle<0,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::am::service::IDisplayController', 17, 'AcquireLastForegroundCaptureBufferEx', '0 bytes in - 1 bytes out - OutRaw<1,1,0>, OutHandle<0,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::am::service::IDisplayController', 18, 'AcquireCallerAppletCaptureBufferEx', '0 bytes in - 1 bytes out - OutRaw<1,1,0>, OutHandle<0,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::am::service::IDisplayController', 20, 'ClearCaptureBuffer', '0xC bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>, InRaw<4,4,8>', '(int,bool,unsigned int)'), + ('nn::am::service::IDisplayController', 21, 'ClearAppletTransitionBuffer', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::am::service::IDebugFunctions', 0, 'NotifyMessageToHomeMenuForDebug', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::am::AppletMessage)'), + ('nn::am::service::IDebugFunctions', 1, 'OpenMainApplication', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IDebugFunctions', 10, 'EmulateButtonEvent', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::am::service::EmulatedButtonEvent)'), + ('nn::am::service::IDebugFunctions', 20, 'InvalidateTransitionLayer', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationAccessor', 0, 'GetAppletStateChangedEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationAccessor', 1, 'IsCompleted', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationAccessor', 10, 'Start', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationAccessor', 20, 'RequestExit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationAccessor', 25, 'Terminate', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationAccessor', 30, 'GetResult', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationAccessor', 101, 'RequestForApplicationToGetForeground', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationAccessor', 110, 'TerminateAllLibraryApplets', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationAccessor', 111, 'AreAnyLibraryAppletsLeft', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationAccessor', 112, 'GetCurrentLibraryApplet', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationAccessor', 120, 'GetApplicationId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationAccessor', 121, 'PushLaunchParameter', '4 bytes in - 0 bytes out - InRaw<4,4,0>, InObject<0,0>', '(unsigned int,nn::sf::SharedPointer)'), + ('nn::am::service::IApplicationAccessor', 122, 'GetApplicationControlProperty', '0 bytes in - 0 bytes out - Buffer<0,6,0>', '(nn::sf::OutBuffer const&)'), + ('nn::am::service::IApplicationAccessor', 123, 'GetApplicationLaunchProperty', '0 bytes in - 0 bytes out - Buffer<0,6,0>', '(nn::sf::OutBuffer const&)'), + ('nn::am::service::IAppletAccessor', 0, 'GetAppletStateChangedEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::IAppletAccessor', 1, 'IsCompleted', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IAppletAccessor', 10, 'Start', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IAppletAccessor', 20, 'RequestExit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IAppletAccessor', 25, 'Terminate', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IAppletAccessor', 30, 'GetResult', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IProcessWindingController', 0, 'GetLaunchReason', '0 bytes in - 4 bytes out - OutRaw<4,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IProcessWindingController', 11, 'OpenCallingLibraryApplet', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IProcessWindingController', 21, 'PushContext', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::IProcessWindingController', 22, 'PopContext', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IProcessWindingController', 23, 'CancelWindingReservation', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IProcessWindingController', 30, 'WindAndDoReserved', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IProcessWindingController', 40, 'ReserveToStartAndWaitAndUnwindThis', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletAccessor', 0, 'GetAppletStateChangedEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletAccessor', 1, 'IsCompleted', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletAccessor', 10, 'Start', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILibraryAppletAccessor', 20, 'RequestExit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILibraryAppletAccessor', 25, 'Terminate', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILibraryAppletAccessor', 30, 'GetResult', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILibraryAppletAccessor', 50, 'SetOutOfFocusApplicationSuspendingEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::ILibraryAppletAccessor', 100, 'PushInData', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletAccessor', 101, 'PopOutData', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletAccessor', 102, 'PushExtraStorage', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletAccessor', 103, 'PushInteractiveInData', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletAccessor', 104, 'PopInteractiveOutData', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletAccessor', 105, 'GetPopOutDataEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletAccessor', 106, 'GetPopInteractiveOutDataEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletAccessor', 110, 'NeedsToExitProcess', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletAccessor', 120, 'GetLibraryAppletInfo', '0 bytes in - 8 bytes out - OutRaw<8,4,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletAccessor', 150, 'RequestForAppletToGetForeground', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILibraryAppletAccessor', 160, 'GetIndirectLayerConsumerHandle', '8 bytes in - 8 bytes out - takes pid - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::am::service::IStorage', 0, 'Open', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IStorage', 1, 'OpenTransferStorage', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IStorageAccessor', 0, 'GetSize', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::am::service::IStorageAccessor', 10, 'Write', '8 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,0x21,0>', '(long,nn::sf::InBuffer const&)'), + ('nn::am::service::IStorageAccessor', 11, 'Read', '8 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,0x22,0>', '(long,nn::sf::OutBuffer const&)'), + ('nn::am::service::ITransferStorageAccessor', 0, 'GetSize', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::am::service::ITransferStorageAccessor', 1, 'GetHandle', '0 bytes in - 8 bytes out - OutHandle<0,1>, OutRaw<8,8,0>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::am::service::ILibraryAppletCreator', 0, 'CreateLibraryApplet', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::Out,void>,unsigned int,unsigned int)'), + ('nn::am::service::ILibraryAppletCreator', 1, 'TerminateAllLibraryApplets', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILibraryAppletCreator', 2, 'AreAnyLibraryAppletsLeft', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletCreator', 10, 'CreateStorage', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,long)'), + ('nn::am::service::ILibraryAppletCreator', 11, 'CreateTransferMemoryStorage', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InHandle<0,1>, InRaw<8,8,8>, InRaw<1,1,0>', '(nn::sf::Out,void>,nn::sf::NativeHandle &&,long,bool)'), + ('nn::am::service::ILibraryAppletCreator', 12, 'CreateHandleStorage', '8 bytes in - 0 bytes out - OutObject<0,0>, InHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,void>,nn::sf::NativeHandle &&,long)'), + ('nn::am::service::IHomeMenuFunctions', 10, 'RequestToGetForeground', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IHomeMenuFunctions', 11, 'LockForeground', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IHomeMenuFunctions', 12, 'UnlockForeground', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IHomeMenuFunctions', 20, 'PopFromGeneralChannel', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IHomeMenuFunctions', 21, 'GetPopFromGeneralChannelEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::IHomeMenuFunctions', 30, 'GetHomeButtonWriterLockAccessor', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IHomeMenuFunctions', 31, 'GetWriterLockAccessorEx', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,int)'), + ('nn::am::service::IGlobalStateController', 0, 'RequestToEnterSleep', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IGlobalStateController', 1, 'EnterSleep', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IGlobalStateController', 2, 'StartSleepSequence', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::IGlobalStateController', 3, 'StartShutdownSequence', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IGlobalStateController', 4, 'StartRebootSequence', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IGlobalStateController', 10, 'LoadAndApplyIdlePolicySettings', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IGlobalStateController', 11, 'NotifyCecSettingsChanged', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IGlobalStateController', 12, 'SetDefaultHomeButtonLongPressTime', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(long)'), + ('nn::am::service::IGlobalStateController', 13, 'UpdateDefaultDisplayResolution', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IGlobalStateController', 14, 'ShouldSleepOnBoot', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationCreator', 0, 'CreateApplication', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,nn::ncm::ApplicationId)'), + ('nn::am::service::IApplicationCreator', 1, 'PopLaunchRequestedApplication', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationCreator', 10, 'CreateSystemApplication', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,nn::ncm::SystemApplicationId)'), + ('nn::am::service::IApplicationCreator', 100, 'PopFloatingApplicationForDevelopment', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 0, 'GetCommonStateGetter', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 1, 'GetSelfController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 2, 'GetWindowController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 3, 'GetAudioController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 4, 'GetDisplayController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 1000, 'GetDebugFunctions', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 10, 'GetProcessWindingController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 11, 'GetLibraryAppletCreator', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletProxy', 20, 'OpenLibraryAppletSelfAccessor', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 0, 'PopInData', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 1, 'PushOutData', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 2, 'PopInteractiveInData', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 3, 'PushInteractiveOutData', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 5, 'GetPopInDataEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 6, 'GetPopInteractiveInDataEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 10, 'ExitProcessAndReturn', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 11, 'GetLibraryAppletInfo', '0 bytes in - 8 bytes out - OutRaw<8,4,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 12, 'GetMainAppletIdentityInfo', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 13, 'CanUseApplicationCore', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 14, 'GetCallerAppletIdentityInfo', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 15, 'GetMainAppletApplicationControlProperty', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x4000>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 16, 'GetMainAppletStorageId', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 17, 'GetCallerAppletIdentityInfoStack', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 20, 'PopExtraStorage', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 25, 'GetPopExtraStorageEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 30, 'UnpopInData', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 31, 'UnpopExtraStorage', '0 bytes in - 0 bytes out - InObject<0,0>', '(nn::sf::SharedPointer)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 40, 'GetIndirectLayerProducerHandle', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::am::service::ILibraryAppletSelfAccessor', 50, 'ReportVisibleError', '8 bytes in - 0 bytes out - InRaw<8,4,0>', '(nn::err::ErrorCode)'), + ('nn::am::service::IOverlayAppletProxy', 0, 'GetCommonStateGetter', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 1, 'GetSelfController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 2, 'GetWindowController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 3, 'GetAudioController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 4, 'GetDisplayController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 1000, 'GetDebugFunctions', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 10, 'GetProcessWindingController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 11, 'GetLibraryAppletCreator', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayAppletProxy', 20, 'GetOverlayFunctions', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IOverlayFunctions', 0, 'BeginToWatchShortHomeButtonMessage', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IOverlayFunctions', 1, 'EndToWatchShortHomeButtonMessage', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IOverlayFunctions', 2, 'GetApplicationIdForLogo', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::am::service::IOverlayFunctions', 3, 'SetGpuTimeSliceBoost', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::am::service::IOverlayFunctions', 4, 'SetAutoSleepTimeAndDimmingTimeEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::IOverlayFunctions', 5, 'TerminateApplicationAndSetReason', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::am::service::IOverlayFunctions', 6, 'SetScreenShotPermissionGlobally', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::IApplicationProxy', 0, 'GetCommonStateGetter', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 1, 'GetSelfController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 2, 'GetWindowController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 3, 'GetAudioController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 4, 'GetDisplayController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 1000, 'GetDebugFunctions', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 10, 'GetProcessWindingController', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 11, 'GetLibraryAppletCreator', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationProxy', 20, 'GetApplicationFunctions', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::am::service::IApplicationFunctions', 1, 'PopLaunchParameter', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,unsigned int)'), + ('nn::am::service::IApplicationFunctions', 10, 'CreateApplicationAndPushAndRequestToStart', '8 bytes in - 0 bytes out - InRaw<8,8,0>, InObject<0,0>', '(nn::ncm::ApplicationId,nn::sf::SharedPointer)'), + ('nn::am::service::IApplicationFunctions', 11, 'CreateApplicationAndPushAndRequestToStartForQuest', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InObject<0,0>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::ncm::ApplicationId,nn::sf::SharedPointer,unsigned int,unsigned int)'), + ('nn::am::service::IApplicationFunctions', 20, 'EnsureSaveData', '0x10 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::am::service::IApplicationFunctions', 21, 'GetDesiredLanguage', '0 bytes in - 8 bytes out - OutRaw<8,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationFunctions', 22, 'SetTerminateResult', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::am::service::IApplicationFunctions', 23, 'GetDisplayVersion', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationFunctions', 24, 'GetLaunchStorageInfoForDebug', '0 bytes in - 2 bytes out - OutRaw<1,1,0>, OutRaw<1,1,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::am::service::IApplicationFunctions', 25, 'ExtendSaveData', '0x28 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<1,1,0>, InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<8,8,0x20>', '(nn::sf::Out,unsigned char,nn::account::Uid const&,long,long)'), + ('nn::am::service::IApplicationFunctions', 26, 'GetSaveDataSize', '0x18 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>, InRaw<1,1,0>, InRaw<0x10,8,8>', '(nn::sf::Out,nn::sf::Out,unsigned char,nn::account::Uid const&)'), + ('nn::am::service::IApplicationFunctions', 30, 'BeginBlockingHomeButtonShortAndLongPressed', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(long)'), + ('nn::am::service::IApplicationFunctions', 31, 'EndBlockingHomeButtonShortAndLongPressed', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationFunctions', 32, 'BeginBlockingHomeButton', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(long)'), + ('nn::am::service::IApplicationFunctions', 33, 'EndBlockingHomeButton', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationFunctions', 40, 'NotifyRunning', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationFunctions', 50, 'GetPseudoDeviceId', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationFunctions', 60, 'SetMediaPlaybackStateForApplication', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::am::service::IApplicationFunctions', 65, 'IsGamePlayRecordingSupported', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::am::service::IApplicationFunctions', 66, 'InitializeGamePlayRecording', '8 bytes in - 0 bytes out - InHandle<0,1>, InRaw<8,8,0>', '(nn::sf::NativeHandle &&,unsigned long)'), + ('nn::am::service::IApplicationFunctions', 67, 'SetGamePlayRecordingState', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::am::service::IApplicationFunctions', 70, 'RequestToShutdown', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationFunctions', 71, 'RequestToReboot', '0 bytes in - 0 bytes out', '(void)'), + ('nn::am::service::IApplicationProxyService', 0, 'OpenApplicationProxy', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>, InHandle<0,1>', '(nn::sf::Out,void>,unsigned long,nn::sf::NativeHandle &&)'), + ('nn::apm::IManager', 0, 'OpenSession', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::apm::IManager', 1, 'GetPerformanceMode', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::apm::ISession', 0, 'SetPerformanceConfiguration', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(nn::apm::PerformanceMode,nn::apm::PerformanceConfiguration)'), + ('nn::apm::ISession', 1, 'GetPerformanceConfiguration', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::apm::PerformanceMode)'), + ('nn::apm::ISystemManager', 0, 'RequestPerformanceMode', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::apm::PerformanceMode)'), + ('nn::apm::ISystemManager', 1, 'GetPerformanceEvent', '4 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,nn::apm::EventTarget)'), + ('nn::apm::ISystemManager', 2, 'GetThrottlingState', '0 bytes in - 0x28 bytes out - OutRaw<0x28,8,0>', '(nn::sf::Out)'), + ('nn::apm::ISystemManager', 3, 'GetLastThrottlingState', '0 bytes in - 0x28 bytes out - OutRaw<0x28,8,0>', '(nn::sf::Out)'), + ('nn::apm::ISystemManager', 4, 'ClearLastThrottlingState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::apm::IManagerPrivileged', 0, 'OpenSession', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::bcat::detail::ipc::IServiceCreator', 0, 'CreateBcatService', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,unsigned long)'), + ('nn::bcat::detail::ipc::IServiceCreator', 1, 'CreateDeliveryCacheStorageService', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,unsigned long)'), + ('nn::bcat::detail::ipc::IServiceCreator', 2, 'CreateDeliveryCacheStorageServiceWithApplicationId', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,nn::ApplicationId)'), + ('nn::bcat::detail::ipc::IBcatService', 10100, 'RequestSyncDeliveryCache', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::bcat::detail::ipc::IBcatService', 20100, 'RequestSyncDeliveryCacheWithApplicationId', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,void>,nn::ApplicationId,unsigned int)'), + ('nn::bcat::detail::ipc::IBcatService', 30100, 'SetPassphrase', '8 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,9,0>', '(nn::ApplicationId,nn::sf::InArray const&)'), + ('nn::bcat::detail::ipc::IBcatService', 30200, 'RegisterBackgroundDeliveryTask', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::ApplicationId,unsigned int)'), + ('nn::bcat::detail::ipc::IBcatService', 30201, 'UnregisterBackgroundDeliveryTask', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ApplicationId)'), + ('nn::bcat::detail::ipc::IBcatService', 30202, 'BlockDeliveryTask', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ApplicationId)'), + ('nn::bcat::detail::ipc::IBcatService', 30203, 'UnblockDeliveryTask', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ApplicationId)'), + ('nn::bcat::detail::ipc::IBcatService', 90100, 'EnumerateBackgroundDeliveryTask', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::bcat::detail::ipc::IBcatService', 90200, 'GetDeliveryList', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::OutBuffer const&,nn::ApplicationId)'), + ('nn::bcat::detail::ipc::IBcatService', 90201, 'ClearDeliveryCacheStorage', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ApplicationId)'), + ('nn::bcat::detail::ipc::IBcatService', 90300, 'GetPushNotificationLog', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::bcat::detail::ipc::IDeliveryCacheProgressService', 0, 'GetEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::bcat::detail::ipc::IDeliveryCacheProgressService', 1, 'GetImpl', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x200>', '(nn::sf::Out)'), + ('nn::bcat::detail::ipc::IDeliveryCacheStorageService', 0, 'CreateFileService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::bcat::detail::ipc::IDeliveryCacheStorageService', 1, 'CreateDirectoryService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::bcat::detail::ipc::IDeliveryCacheStorageService', 10, 'EnumerateDeliveryCacheDirectory', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::bcat::detail::ipc::IDeliveryCacheFileService', 0, 'Open', '0x40 bytes in - 0 bytes out - InRaw<0x20,1,0>, InRaw<0x20,1,0x20>', '(nn::bcat::DirectoryName const&,nn::bcat::FileName const&)'), + ('nn::bcat::detail::ipc::IDeliveryCacheFileService', 1, 'Read', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>, Buffer<0,6,0>', '(nn::sf::Out,long,nn::sf::OutBuffer const&)'), + ('nn::bcat::detail::ipc::IDeliveryCacheFileService', 2, 'GetSize', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::bcat::detail::ipc::IDeliveryCacheFileService', 3, 'GetDigest', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::bcat::detail::ipc::IDeliveryCacheDirectoryService', 0, 'Open', '0x20 bytes in - 0 bytes out - InRaw<0x20,1,0>', '(nn::bcat::DirectoryName const&)'), + ('nn::bcat::detail::ipc::IDeliveryCacheDirectoryService', 1, 'Read', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::bcat::detail::ipc::IDeliveryCacheDirectoryService', 2, 'GetCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::codec::detail::IHardwareOpusDecoderManager', 0, '', '0xC bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,4,0>, InHandle<0,1>, InRaw<4,4,8>', ''), + ('nn::codec::detail::IHardwareOpusDecoderManager', 1, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::codec::detail::IHardwareOpusDecoderManager', 2, '', '4 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x110>, InHandle<0,1>, InRaw<4,4,0>', ''), + ('nn::codec::detail::IHardwareOpusDecoderManager', 3, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0x19,0x110>', ''), + ('nn::codec::detail::IHardwareOpusDecoder', 0, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,6,0>, Buffer<1,5,0>', ''), + ('nn::codec::detail::IHardwareOpusDecoder', 1, '', '0 bytes in - 0 bytes out - Buffer<0,5,0>', ''), + ('nn::codec::detail::IHardwareOpusDecoder', 2, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,6,0>, Buffer<1,5,0>', ''), + ('nn::codec::detail::IHardwareOpusDecoder', 3, '', '0 bytes in - 0 bytes out - Buffer<0,5,0>', ''), + ('nn::friends::detail::ipc::IServiceCreator', 0, 'CreateFriendService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::friends::detail::ipc::IServiceCreator', 1, 'CreateNotificationService', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<0x10,8,0>', '(nn::sf::Out,void>,nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 0, 'GetCompletionEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::friends::detail::ipc::IFriendService', 1, 'Cancel', '0 bytes in - 0 bytes out', '(void)'), + ('nn::friends::detail::ipc::IFriendService', 10100, 'GetFriendListIds', '0x30 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, Buffer<0,0xA,0>, InRaw<0x10,8,8>, InRaw<4,4,0>, InRaw<0x10,8,0x18>, InRaw<8,8,0x28>', '(nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int,nn::friends::detail::ipc::SizedFriendFilter const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 10101, 'GetFriendList', '0x30 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,8>, InRaw<4,4,0>, InRaw<0x10,8,0x18>, InRaw<8,8,0x28>', '(nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int,nn::friends::detail::ipc::SizedFriendFilter const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 10102, 'UpdateFriendInfo', '0x18 bytes in - 0 bytes out - takes pid - Buffer<0,6,0>, InRaw<0x10,8,0>, Buffer<1,9,0>, InRaw<8,8,0x10>', '(nn::sf::OutArray const&,nn::account::Uid const&,nn::sf::InArray const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 10110, 'GetFriendProfileImage', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<0x10,8,0>, InRaw<8,8,0x10>, Buffer<0,6,0>', '(nn::sf::Out,nn::account::Uid const&,nn::account::NetworkServiceAccountId,nn::sf::OutBuffer const&)'), + ('nn::friends::detail::ipc::IFriendService', 10200, 'SendFriendRequestForApplication', '0x20 bytes in - 0 bytes out - takes pid - InRaw<0x10,8,0>, InRaw<8,8,0x10>, Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>, InRaw<8,8,0x18>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,nn::friends::InAppScreenName const&,nn::friends::InAppScreenName const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 10211, 'AddFacedFriendRequestForApplication', '0x80 bytes in - 0 bytes out - takes pid - InRaw<0x10,8,0x68>, InRaw<0x40,1,0>, InRaw<0x21,1,0x40>, Buffer<2,5,0>, Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>, InRaw<8,8,0x78>', '(nn::account::Uid const&,nn::friends::FacedFriendRequestRegistrationKey const&,nn::account::Nickname const&,nn::sf::InBuffer const&,nn::friends::InAppScreenName const&,nn::friends::InAppScreenName const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 10400, 'GetBlockedUserListIds', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0xA,0>, InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 10500, 'GetProfileList', '0x10 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<0x10,8,0>, Buffer<1,9,0>', '(nn::sf::OutArray const&,nn::account::Uid const&,nn::sf::InArray const&)'), + ('nn::friends::detail::ipc::IFriendService', 10600, 'DeclareOpenOnlinePlaySession', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 10601, 'DeclareCloseOnlinePlaySession', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 10610, 'UpdateUserPresence', '0x18 bytes in - 0 bytes out - takes pid - InRaw<0x10,8,0>, Buffer<0,0x19,0xE0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::friends::detail::UserPresenceImpl const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 10700, 'GetPlayHistoryRegistrationKey', '0x18 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<0x10,8,8>, InRaw<1,1,0>', '(nn::sf::Out,nn::account::Uid const&,bool)'), + ('nn::friends::detail::ipc::IFriendService', 10701, 'GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId', '0x10 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,8,8>, InRaw<1,1,0>', '(nn::sf::Out,nn::account::NetworkServiceAccountId,bool)'), + ('nn::friends::detail::ipc::IFriendService', 10702, 'AddPlayHistory', '0x18 bytes in - 0 bytes out - takes pid - InRaw<0x10,8,0>, Buffer<0,0x19,0x40>, Buffer<1,0x19,0x48>, Buffer<2,0x19,0x48>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::friends::PlayHistoryRegistrationKey const&,nn::friends::InAppScreenName const&,nn::friends::InAppScreenName const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 11000, 'GetProfileImageUrl', '0xA4 bytes in - 0xA0 bytes out - OutRaw<0xA0,1,0>, InRaw<0xA0,1,0>, InRaw<4,4,0xA0>', '(nn::sf::Out,nn::friends::Url const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 20100, 'GetFriendCount', '0x28 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, InRaw<0x10,8,0>, InRaw<0x10,8,0x10>, InRaw<8,8,0x20>', '(nn::sf::Out,nn::account::Uid const&,nn::friends::detail::ipc::SizedFriendFilter const&,unsigned long)'), + ('nn::friends::detail::ipc::IFriendService', 20101, 'GetNewlyFriendCount', '0x10 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20102, 'GetFriendDetailedInfo', '0x18 bytes in - 0 bytes out - Buffer<0,0x1A,0x800>, InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::sf::Out,nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 20103, 'SyncFriendList', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20104, 'RequestSyncFriendList', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20110, 'LoadFriendSetting', '0x18 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::sf::Out,nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 20200, 'GetReceivedFriendRequestCount', '0x10 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::Out,nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20201, 'GetFriendRequestList', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int,int)'), + ('nn::friends::detail::ipc::IFriendService', 20300, 'GetFriendCandidateList', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 20301, 'GetNintendoNetworkIdInfo', '0x18 bytes in - 4 bytes out - Buffer<0,0x1A,0x38>, OutRaw<4,4,0>, Buffer<1,6,0>, InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 20400, 'GetBlockedUserList', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 20401, 'SyncBlockedUserList', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20500, 'GetProfileExtraList', '0x10 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<0x10,8,0>, Buffer<1,9,0>', '(nn::sf::OutArray const&,nn::account::Uid const&,nn::sf::InArray const&)'), + ('nn::friends::detail::ipc::IFriendService', 20501, 'GetRelationship', '0x18 bytes in - 8 bytes out - OutRaw<8,1,0>, InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::sf::Out,nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 20600, 'GetUserPresenceView', '0x10 bytes in - 0 bytes out - Buffer<0,0x1A,0xE0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20700, 'GetPlayHistoryList', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::account::Uid const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 20701, 'GetPlayHistoryStatistics', '0x10 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20800, 'LoadUserSetting', '0x10 bytes in - 0 bytes out - Buffer<0,0x1A,0x800>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20801, 'SyncUserSetting', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 20900, 'RequestListSummaryOverlayNotification', '0 bytes in - 0 bytes out', '(void)'), + ('nn::friends::detail::ipc::IFriendService', 21000, 'GetExternalApplicationCatalog', '0x18 bytes in - 0 bytes out - Buffer<0,0x1A,0x4B8>, InRaw<0x10,8,8>, InRaw<8,1,0>', '(nn::sf::Out,nn::friends::ExternalApplicationCatalogId const&,nn::settings::LanguageCode)'), + ('nn::friends::detail::ipc::IFriendService', 30100, 'DropFriendNewlyFlags', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 30101, 'DeleteFriend', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 30110, 'DropFriendNewlyFlag', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 30120, 'ChangeFriendFavoriteFlag', '0x20 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<1,1,0>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,bool)'), + ('nn::friends::detail::ipc::IFriendService', 30121, 'ChangeFriendOnlineNotificationFlag', '0x20 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<1,1,0>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,bool)'), + ('nn::friends::detail::ipc::IFriendService', 30200, 'SendFriendRequest', '0x20 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<4,4,0>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,int)'), + ('nn::friends::detail::ipc::IFriendService', 30201, 'SendFriendRequestWithApplicationInfo', '0x30 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<4,4,0>, InRaw<0x10,8,0x20>, Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,int,nn::friends::ApplicationInfo const&,nn::friends::InAppScreenName const&,nn::friends::InAppScreenName const&)'), + ('nn::friends::detail::ipc::IFriendService', 30202, 'CancelFriendRequest', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::friends::RequestId)'), + ('nn::friends::detail::ipc::IFriendService', 30203, 'AcceptFriendRequest', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::friends::RequestId)'), + ('nn::friends::detail::ipc::IFriendService', 30204, 'RejectFriendRequest', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::friends::RequestId)'), + ('nn::friends::detail::ipc::IFriendService', 30205, 'ReadFriendRequest', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::friends::RequestId)'), + ('nn::friends::detail::ipc::IFriendService', 30210, 'GetFacedFriendRequestRegistrationKey', '0x10 bytes in - 0x40 bytes out - OutRaw<0x40,1,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 30211, 'AddFacedFriendRequest', '0x78 bytes in - 0 bytes out - InRaw<0x10,8,0x68>, InRaw<0x40,1,0>, InRaw<0x21,1,0x40>, Buffer<0,5,0>', '(nn::account::Uid const&,nn::friends::FacedFriendRequestRegistrationKey const&,nn::account::Nickname const&,nn::sf::InBuffer const&)'), + ('nn::friends::detail::ipc::IFriendService', 30212, 'CancelFacedFriendRequest', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 30213, 'GetFacedFriendRequestProfileImage', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<0x10,8,0>, InRaw<8,8,0x10>, Buffer<0,6,0>', '(nn::sf::Out,nn::account::Uid const&,nn::account::NetworkServiceAccountId,nn::sf::OutBuffer const&)'), + ('nn::friends::detail::ipc::IFriendService', 30214, 'GetFacedFriendRequestProfileImageFromPath', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,9,0>, Buffer<1,6,0>', '(nn::sf::Out,nn::sf::InArray const&,nn::sf::OutBuffer const&)'), + ('nn::friends::detail::ipc::IFriendService', 30215, 'SendFriendRequestWithExternalApplicationCatalogId', '0x30 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<4,4,0>, InRaw<0x10,8,0x20>, Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,int,nn::friends::ExternalApplicationCatalogId const&,nn::friends::InAppScreenName const&,nn::friends::InAppScreenName const&)'), + ('nn::friends::detail::ipc::IFriendService', 30216, 'ResendFacedFriendRequest', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 30217, 'SendFriendRequestWithNintendoNetworkIdInfo', '0x80 bytes in - 0 bytes out - InRaw<0x10,8,0x68>, InRaw<8,8,0x78>, InRaw<4,4,0x60>, InRaw<0x20,1,0>, InRaw<0x10,1,0x20>, InRaw<0x20,1,0x30>, InRaw<0x10,1,0x50>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,int,nn::friends::MiiName const&,nn::friends::MiiImageUrlParam const&,nn::friends::MiiName const&,nn::friends::MiiImageUrlParam const&)'), + ('nn::friends::detail::ipc::IFriendService', 30400, 'BlockUser', '0x20 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<4,4,0>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,int)'), + ('nn::friends::detail::ipc::IFriendService', 30401, 'BlockUserWithApplicationInfo', '0x30 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<8,8,0x18>, InRaw<4,4,0>, InRaw<0x10,8,0x20>, Buffer<0,0x19,0x48>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId,int,nn::friends::ApplicationInfo const&,nn::friends::InAppScreenName const&)'), + ('nn::friends::detail::ipc::IFriendService', 30402, 'UnblockUser', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::account::NetworkServiceAccountId)'), + ('nn::friends::detail::ipc::IFriendService', 30500, 'GetProfileExtraFromFriendCode', '0x30 bytes in - 0 bytes out - Buffer<0,0x1A,0x400>, InRaw<0x10,8,0x20>, InRaw<0x20,1,0>', '(nn::sf::Out,nn::account::Uid const&,nn::friends::FriendCode const&)'), + ('nn::friends::detail::ipc::IFriendService', 30700, 'DeletePlayHistory', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 30810, 'ChangePresencePermission', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::account::Uid const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 30811, 'ChangeFriendRequestReception', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<1,1,0>', '(nn::account::Uid const&,bool)'), + ('nn::friends::detail::ipc::IFriendService', 30812, 'ChangePlayLogPermission', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,8>, InRaw<4,4,0>', '(nn::account::Uid const&,int)'), + ('nn::friends::detail::ipc::IFriendService', 30820, 'IssueFriendCode', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 30830, 'ClearPlayLog', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::IFriendService', 49900, 'DeleteNetworkServiceAccountCache', '0x10 bytes in - 0 bytes out - InRaw<0x10,8,0>', '(nn::account::Uid const&)'), + ('nn::friends::detail::ipc::INotificationService', 0, 'GetEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::friends::detail::ipc::INotificationService', 1, 'Clear', '0 bytes in - 0 bytes out', '(void)'), + ('nn::friends::detail::ipc::INotificationService', 2, 'Pop', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out)'), + ('nn::tma::IHtcsManager', 0, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 1, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::tma::IHtcsManager', 2, '', '0x48 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0x44>, InRaw<0x42,2,0>', ''), + ('nn::tma::IHtcsManager', 3, '', '0x48 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0x44>, InRaw<0x42,2,0>', ''), + ('nn::tma::IHtcsManager', 4, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 5, '', '4 bytes in - 0x4C bytes out - OutRaw<4,4,0x44>, OutRaw<4,4,0x48>, OutRaw<0x42,2,0>, InRaw<4,4,0>', ''), + ('nn::tma::IHtcsManager', 6, '', '8 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,6,0>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 7, '', '8 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, InRaw<4,4,0>, Buffer<0,5,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 8, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 9, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::tma::IHtcsManager', 10, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', ''), + ('nn::tma::IHtcsManager', 11, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', ''), + ('nn::tma::IHtcsManager', 12, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, OutObject<0,0>', ''), + ('nn::tma::IHtcsManager', 13, '', '1 bytes in - 4 bytes out - OutRaw<4,4,0>, OutObject<0,0>, InRaw<1,1,0>', ''), + ('nn::tma::IHtcsManager', 100, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::tma::IHtcsManager', 101, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::tma::ISocket', 0, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::tma::ISocket', 1, '', '0x42 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<0x42,2,0>', ''), + ('nn::tma::ISocket', 2, '', '0x42 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<0x42,2,0>', ''), + ('nn::tma::ISocket', 3, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 4, '', '0 bytes in - 0x48 bytes out - OutRaw<4,4,0x44>, OutObject<0,0>, OutRaw<0x42,2,0>', ''), + ('nn::tma::ISocket', 5, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,0x22,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 6, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 7, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 8, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::ISocket', 9, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>', ''), + ('nn::tma::ISocket', 10, '', '4 bytes in - 0x48 bytes out - OutRaw<4,4,0x44>, OutObject<0,0>, OutRaw<0x42,2,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 11, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::ISocket', 12, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,0x22,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 13, '', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<8,8,0x10>, InHandle<0,1>, InRaw<4,4,8>', ''), + ('nn::tma::ISocket', 14, '', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 15, '', '0x10 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, Buffer<0,0x21,0>, Buffer<1,0x21,0>, InHandle<0,1>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 16, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::tma::IHtcsManager', 0, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 1, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::tma::IHtcsManager', 2, '', '0x48 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0x44>, InRaw<0x42,2,0>', ''), + ('nn::tma::IHtcsManager', 3, '', '0x48 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0x44>, InRaw<0x42,2,0>', ''), + ('nn::tma::IHtcsManager', 4, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 5, '', '4 bytes in - 0x4C bytes out - OutRaw<4,4,0x44>, OutRaw<4,4,0x48>, OutRaw<0x42,2,0>, InRaw<4,4,0>', ''), + ('nn::tma::IHtcsManager', 6, '', '8 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,6,0>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 7, '', '8 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, InRaw<4,4,0>, Buffer<0,5,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 8, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::IHtcsManager', 9, '', '0xC bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', ''), + ('nn::tma::IHtcsManager', 10, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', ''), + ('nn::tma::IHtcsManager', 11, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', ''), + ('nn::tma::IHtcsManager', 12, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, OutObject<0,0>', ''), + ('nn::tma::IHtcsManager', 13, '', '1 bytes in - 4 bytes out - OutRaw<4,4,0>, OutObject<0,0>, InRaw<1,1,0>', ''), + ('nn::tma::IHtcsManager', 100, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::tma::IHtcsManager', 101, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::tma::ISocket', 0, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::tma::ISocket', 1, '', '0x42 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<0x42,2,0>', ''), + ('nn::tma::ISocket', 2, '', '0x42 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<0x42,2,0>', ''), + ('nn::tma::ISocket', 3, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 4, '', '0 bytes in - 0x48 bytes out - OutRaw<4,4,0x44>, OutObject<0,0>, OutRaw<0x42,2,0>', ''), + ('nn::tma::ISocket', 5, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,0x22,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 6, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 7, '', '4 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 8, '', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::ISocket', 9, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>', ''), + ('nn::tma::ISocket', 10, '', '4 bytes in - 0x48 bytes out - OutRaw<4,4,0x44>, OutObject<0,0>, OutRaw<0x42,2,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 11, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::tma::ISocket', 12, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, Buffer<0,0x22,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 13, '', '0x18 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<8,8,0x10>, InHandle<0,1>, InRaw<4,4,8>', ''), + ('nn::tma::ISocket', 14, '', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 15, '', '0x10 bytes in - 4 bytes out - OutRaw<4,4,0>, OutHandle<0,1>, Buffer<0,0x21,0>, Buffer<1,0x21,0>, InHandle<0,1>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::tma::ISocket', 16, '', '4 bytes in - 0x10 bytes out - OutRaw<4,4,0>, OutRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::lm::ILogService', 0, '', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', ''), + ('nn::lm::ILogger', 0, '', '0 bytes in - 0 bytes out - Buffer<0,0x21,0>', ''), + ('nn::lm::ILogger', 1, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::nfc::detail::ISystemManager', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::nfc::detail::ISystem', 0, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,5,0>', ''), + ('nn::nfc::detail::ISystem', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::nfc::detail::ISystem', 2, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::nfc::detail::ISystem', 3, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::nfc::detail::ISystem', 100, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::nfc::detail::IUserManager', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::nfc::detail::IUser', 0, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,5,0>', ''), + ('nn::nfc::detail::IUser', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::nfc::detail::IUser', 2, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::nfc::detail::IUser', 3, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::nfc::mifare::detail::IUserManager', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::nfc::mifare::detail::IUser', 0, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,5,0>', ''), + ('nn::nfc::mifare::detail::IUser', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::nfc::mifare::detail::IUser', 2, '', '0 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 3, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 4, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 5, '', '8 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<8,4,0>, Buffer<1,5,0>', ''), + ('nn::nfc::mifare::detail::IUser', 6, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>, Buffer<0,5,0>', ''), + ('nn::nfc::mifare::detail::IUser', 7, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x58>, InRaw<8,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 8, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 9, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 10, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 11, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 12, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfc::mifare::detail::IUser', 13, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::nfp::detail::IDebugManager', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::nfp::detail::IDebug', 0, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IDebug', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::nfp::detail::IDebug', 2, '', '0 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>', ''), + ('nn::nfp::detail::IDebug', 3, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 4, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 5, '', '0x10 bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>, InRaw<4,4,0xC>', ''), + ('nn::nfp::detail::IDebug', 6, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 7, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>', ''), + ('nn::nfp::detail::IDebug', 8, '', '8 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 9, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IDebug', 10, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 11, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 12, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IDebug', 13, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x58>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 14, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 15, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 16, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 17, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 18, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 19, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::nfp::detail::IDebug', 20, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 21, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 22, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 23, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::nfp::detail::IDebug', 24, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IDebug', 100, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 101, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 102, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 103, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>, Buffer<0,0x19,0x100>', ''), + ('nn::nfp::detail::IDebug', 104, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 105, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 106, '', '8 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 200, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x298>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 201, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>, Buffer<0,0x19,0x298>', ''), + ('nn::nfp::detail::IDebug', 202, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 203, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>', ''), + ('nn::nfp::detail::IDebug', 204, '', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', ''), + ('nn::nfp::detail::IDebug', 205, '', '0 bytes in - 0 bytes out - Buffer<0,5,0>', ''), + ('nn::nfp::detail::IDebug', 206, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, Buffer<0,5,0>, InRaw<4,4,8>', ''), + ('nn::nfp::detail::IDebug', 300, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IDebug', 301, '', '0 bytes in - 0 bytes out', ''), + ('nn::nfp::detail::IDebug', 302, '', '0 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>', ''), + ('nn::nfp::detail::IDebug', 303, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>', ''), + ('nn::nfp::detail::IDebug', 304, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 305, '', '0x10 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, InRaw<8,4,0>, Buffer<1,5,0>, InRaw<8,8,8>', ''), + ('nn::nfp::detail::IDebug', 306, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x58>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 307, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 308, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 309, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::nfp::detail::IDebug', 310, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 311, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 312, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 313, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IDebug', 314, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::nfp::detail::ISystemManager', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::nfp::detail::ISystem', 0, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::ISystem', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::nfp::detail::ISystem', 2, '', '0 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>', ''), + ('nn::nfp::detail::ISystem', 3, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 4, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 5, '', '0x10 bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>, InRaw<4,4,0xC>', ''), + ('nn::nfp::detail::ISystem', 6, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 10, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 11, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 13, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x58>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 14, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 15, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 16, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 17, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 18, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 19, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::nfp::detail::ISystem', 20, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 21, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 23, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::nfp::detail::ISystem', 100, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 101, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 102, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 103, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>, Buffer<0,0x19,0x100>', ''), + ('nn::nfp::detail::ISystem', 104, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 105, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::ISystem', 106, '', '8 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUserManager', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::nfp::detail::IUser', 0, '', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IUser', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::nfp::detail::IUser', 2, '', '0 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>', ''), + ('nn::nfp::detail::IUser', 3, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 4, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 5, '', '0x10 bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>, InRaw<4,4,0xC>', ''), + ('nn::nfp::detail::IUser', 6, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 7, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>', ''), + ('nn::nfp::detail::IUser', 8, '', '8 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 9, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IUser', 10, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 11, '', '8 bytes in - 0 bytes out - InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 12, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>, Buffer<0,5,0>', ''), + ('nn::nfp::detail::IUser', 13, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x58>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 14, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 15, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 16, '', '8 bytes in - 0 bytes out - Buffer<0,0x1A,0x40>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 17, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 18, '', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 19, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::nfp::detail::IUser', 20, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 21, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 22, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,4,0>', ''), + ('nn::nfp::detail::IUser', 23, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::nfp::detail::IUser', 24, '', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>, Buffer<0,5,0>', ''), + ('nn::nifm::detail::IStaticService', 4, 'CreateGeneralServiceOld', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::nifm::detail::IStaticService', 5, 'CreateGeneralService', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,unsigned long)'), + ('nn::nifm::detail::IGeneralService', 1, 'GetClientId', '0 bytes in - 0 bytes out - Buffer<0,0x1A,4>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 2, 'CreateScanRequest', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::nifm::detail::IGeneralService', 4, 'CreateRequest', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,int)'), + ('nn::nifm::detail::IGeneralService', 5, 'GetCurrentNetworkProfile', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x17C>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 6, 'EnumerateNetworkInterfaces', '4 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::OutArray const&,nn::sf::Out,unsigned int)'), + ('nn::nifm::detail::IGeneralService', 7, 'EnumerateNetworkProfiles', '1 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, InRaw<1,1,0>', '(nn::sf::OutArray const&,nn::sf::Out,unsigned char)'), + ('nn::nifm::detail::IGeneralService', 8, 'GetNetworkProfile', '0x10 bytes in - 0 bytes out - Buffer<0,0x1A,0x17C>, InRaw<0x10,1,0>', '(nn::sf::Out,nn::util::Uuid const&)'), + ('nn::nifm::detail::IGeneralService', 9, 'SetNetworkProfile', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, Buffer<0,0x19,0x17C>', '(nn::sf::Out,nn::nifm::detail::sf::NetworkProfileData const&)'), + ('nn::nifm::detail::IGeneralService', 10, 'RemoveNetworkProfile', '0x10 bytes in - 0 bytes out - InRaw<0x10,1,0>', '(nn::util::Uuid const&)'), + ('nn::nifm::detail::IGeneralService', 11, 'GetScanData', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', '(nn::sf::OutArray const&,nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 12, 'GetCurrentIpAddress', '0 bytes in - 4 bytes out - OutRaw<4,1,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 13, 'GetCurrentAccessPoint', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x34>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 14, 'CreateTemporaryNetworkProfile', '0 bytes in - 0x10 bytes out - OutObject<0,0>, OutRaw<0x10,1,0>, Buffer<0,0x19,0x17C>', '(nn::sf::Out,void>,nn::sf::Out,nn::nifm::detail::sf::NetworkProfileData const&)'), + ('nn::nifm::detail::IGeneralService', 15, 'GetCurrentIpConfigInfo', '0 bytes in - 0x16 bytes out - OutRaw<0xD,1,0>, OutRaw<9,1,0xD>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 16, 'SetWirelessCommunicationEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IGeneralService', 17, 'IsWirelessCommunicationEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 18, 'GetInternetConnectionStatus', '0 bytes in - 3 bytes out - OutRaw<3,1,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 19, 'SetEthernetCommunicationEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IGeneralService', 20, 'IsEthernetCommunicationEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 21, 'IsAnyInternetRequestAccepted', '0 bytes in - 1 bytes out - OutRaw<1,1,0>, Buffer<0,0x19,4>', '(nn::sf::Out,nn::nifm::ClientId)'), + ('nn::nifm::detail::IGeneralService', 22, 'IsAnyForegroundRequestAccepted', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 23, 'PutToSleep', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IGeneralService', 24, 'WakeUp', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IGeneralService', 25, 'GetSsidListVersion', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 26, 'SetExclusiveClient', '0 bytes in - 0 bytes out - Buffer<0,0x19,4>', '(nn::nifm::ClientId)'), + ('nn::nifm::detail::IGeneralService', 27, 'GetDefaultIpSetting', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0xC2>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 28, 'SetDefaultIpSetting', '0 bytes in - 0 bytes out - Buffer<0,0x19,0xC2>', '(nn::nifm::IpSettingData const&)'), + ('nn::nifm::detail::IGeneralService', 29, 'SetWirelessCommunicationEnabledForTest', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IGeneralService', 30, 'SetEthernetCommunicationEnabledForTest', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IGeneralService', 31, 'GetTelemetorySystemEventReadableHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 32, 'GetTelemetryInfo', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x20C>', '(nn::sf::Out)'), + ('nn::nifm::detail::IGeneralService', 33, 'ConfirmSystemAvailability', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IScanRequest', 0, 'Submit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IScanRequest', 1, 'IsProcessing', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IScanRequest', 2, 'GetResult', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IScanRequest', 3, 'GetSystemEventReadableHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::nifm::detail::IRequest', 0, 'GetRequestState', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IRequest', 1, 'GetResult', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IRequest', 2, 'GetSystemEventReadableHandles', '0 bytes in - 0 bytes out - OutHandle<0,1>, OutHandle<1,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::nifm::detail::IRequest', 3, 'Cancel', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IRequest', 4, 'Submit', '0 bytes in - 0 bytes out', '(void)'), + ('nn::nifm::detail::IRequest', 5, 'SetRequirement', '0x24 bytes in - 0 bytes out - InRaw<0x24,4,0>', '(nn::nifm::Requirement const&)'), + ('nn::nifm::detail::IRequest', 6, 'SetRequirementPreset', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::nifm::detail::IRequest', 8, 'SetPriority', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(unsigned char)'), + ('nn::nifm::detail::IRequest', 9, 'SetNetworkProfileId', '0x10 bytes in - 0 bytes out - InRaw<0x10,1,0>', '(nn::util::Uuid const&)'), + ('nn::nifm::detail::IRequest', 10, 'SetRejectable', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IRequest', 11, 'SetConnectionConfirmationOption', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(signed char)'), + ('nn::nifm::detail::IRequest', 12, 'SetPersistent', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IRequest', 13, 'SetInstant', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IRequest', 14, 'SetSustainable', '2 bytes in - 0 bytes out - InRaw<1,1,0>, InRaw<1,1,1>', '(bool,unsigned char)'), + ('nn::nifm::detail::IRequest', 15, 'SetRawPriority', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(unsigned char)'), + ('nn::nifm::detail::IRequest', 16, 'SetGreedy', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IRequest', 17, 'SetSharable', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IRequest', 18, 'SetRequirementByRevision', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::nifm::detail::IRequest', 19, 'GetRequirement', '0 bytes in - 0x24 bytes out - OutRaw<0x24,4,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IRequest', 20, 'GetRevision', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::nifm::detail::IRequest', 21, 'GetAppletInfo', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, OutRaw<4,4,8>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&,unsigned int)'), + ('nn::nifm::detail::IRequest', 22, 'GetAdditionalInfo', '0 bytes in - 4 bytes out - Buffer<0,0x16,0x410>, OutRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::nifm::detail::IRequest', 23, 'SetKeptInSleep', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::nifm::detail::IRequest', 24, 'RegisterSocketDescriptor', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::nifm::detail::IRequest', 25, 'UnregisterSocketDescriptor', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::nifm::detail::INetworkProfile', 0, 'Update', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, Buffer<0,0x19,0x17C>', '(nn::sf::Out,nn::nifm::detail::sf::NetworkProfileData const&)'), + ('nn::nifm::detail::INetworkProfile', 1, 'PersistOld', '0x10 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<0x10,1,0>', '(nn::sf::Out,nn::util::Uuid const&)'), + ('nn::nifm::detail::INetworkProfile', 2, 'Persist', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', '(nn::sf::Out)'), + ('nn::nsd::detail::IManager', 10, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x100>', ''), + ('nn::nsd::detail::IManager', 11, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,8>', ''), + ('nn::nsd::detail::IManager', 12, '', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', ''), + ('nn::nsd::detail::IManager', 13, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::nsd::detail::IManager', 14, '', '4 bytes in - 0 bytes out - Buffer<0,5,0>, Buffer<1,6,0>, InRaw<4,4,0>', ''), + ('nn::nsd::detail::IManager', 20, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x100>, Buffer<1,0x15,0x100>', ''), + ('nn::nsd::detail::IManager', 21, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0x16,0x100>, Buffer<1,0x15,0x100>', ''), + ('nn::nsd::detail::IManager', 30, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x108>, Buffer<1,0x15,0x10>', ''), + ('nn::nsd::detail::IManager', 31, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0x16,0x108>, Buffer<1,0x15,0x10>', ''), + ('nn::nsd::detail::IManager', 40, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x100>', ''), + ('nn::nsd::detail::IManager', 41, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0x16,0x100>', ''), + ('nn::nsd::detail::IManager', 42, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x100>', ''), + ('nn::nsd::detail::IManager', 43, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0x16,0x100>', ''), + ('nn::nsd::detail::IManager', 50, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x12BF0>', ''), + ('nn::nsd::detail::IManager', 60, '', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x12BF0>', ''), + ('nn::nsd::detail::IManager', 61, '', '0 bytes in - 0 bytes out - Buffer<0,0x15,0x12BF0>', ''), + ('nn::nsd::detail::IManager', 62, '', '0 bytes in - 0 bytes out', ''), + ('nn::pctl::detail::ipc::IParentalControlServiceFactory', 0, 'CreateService', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,unsigned long)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1001, 'CheckFreeCommunicationPermission', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1002, 'ConfirmLaunchApplicationPermission', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, Buffer<0,9,0>, InRaw<1,1,0>', '(nn::ncm::ApplicationId,nn::sf::InArray const&,bool)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1003, 'ConfirmResumeApplicationPermission', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, Buffer<0,9,0>, InRaw<1,1,0>', '(nn::ncm::ApplicationId,nn::sf::InArray const&,bool)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1004, 'ConfirmSnsPostPermission', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1005, 'ConfirmSystemSettingsPermission', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1006, 'IsRestrictionTemporaryUnlocked', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1007, 'RevertRestrictionTemporaryUnlocked', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1008, 'EnterRestrictedSystemSettings', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1009, 'LeaveRestrictedSystemSettings', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1010, 'IsRestrictedSystemSettingsEntered', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1011, 'RevertRestrictedSystemSettingsEntered', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1012, 'GetRestrictedFeatures', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1031, 'IsRestrictionEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1032, 'GetSafetyLevel', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1033, 'SetSafetyLevel', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1034, 'GetSafetyLevelSettings', '4 bytes in - 3 bytes out - OutRaw<3,1,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1035, 'GetCurrentSettings', '0 bytes in - 3 bytes out - OutRaw<3,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1036, 'SetCustomSafetyLevelSettings', '3 bytes in - 0 bytes out - InRaw<3,1,0>', '(nn::pctl::SafetyLevelSettings)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1037, 'GetDefaultRatingOrganization', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1038, 'SetDefaultRatingOrganization', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1039, 'GetFreeCommunicationApplicationListCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1042, 'AddToFreeCommunicationApplicationList', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ncm::ApplicationId)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1043, 'DeleteSettings', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1044, 'GetFreeCommunicationApplicationList', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,int)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1045, 'UpdateFreeCommunicationApplicationList', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InArray const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1046, 'DisableFeaturesForReset', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1047, 'NotifyApplicationDownloadStarted', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ncm::ApplicationId)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1201, 'UnlockRestrictionTemporarily', '0 bytes in - 0 bytes out - Buffer<0,9,0>', '(nn::sf::InArray const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1202, 'UnlockSystemSettingsRestriction', '0 bytes in - 0 bytes out - Buffer<0,9,0>', '(nn::sf::InArray const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1203, 'SetPinCode', '0 bytes in - 0 bytes out - Buffer<0,9,0>', '(nn::sf::InArray const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1204, 'GenerateInquiryCode', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1205, 'CheckMasterKey', '0x20 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<0x20,1,0>, Buffer<0,9,0>', '(nn::sf::Out,nn::pctl::InquiryCode const&,nn::sf::InArray const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1206, 'GetPinCodeLength', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1207, 'GetPinCodeChangedEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1403, 'IsPairingActive', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1406, 'GetSettingsLastUpdated', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1411, 'GetPairingAccountInfo', '0x10 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::pctl::detail::PairingInfoBase const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1421, 'GetAccountNickname', '0x10 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0xA,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::pctl::detail::PairingAccountInfoBase const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1424, 'GetAccountState', '0x10 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::pctl::detail::PairingAccountInfoBase const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1432, 'GetSynchronizationEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1451, 'StartPlayTimer', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1452, 'StopPlayTimer', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1453, 'IsPlayTimerEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1454, 'GetPlayTimerRemainingTime', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1455, 'IsRestrictedByPlayTimer', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1456, 'GetPlayTimerSettings', '0 bytes in - 0x34 bytes out - OutRaw<0x34,2,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1457, 'GetPlayTimerEventToRequestSuspension', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1471, 'NotifyWrongPinCodeInputManyTimes', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1472, 'CancelNetworkRequest', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1473, 'GetUnlinkedEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1474, 'ClearUnlinkedEvent', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1601, 'DisableAllFeatures', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1602, 'PostEnableAllFeatures', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1603, 'IsAllFeaturesDisabled', '0 bytes in - 2 bytes out - OutRaw<1,1,0>, OutRaw<1,1,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1901, 'DeleteFromFreeCommunicationApplicationListForDebug', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ncm::ApplicationId)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1902, 'ClearFreeCommunicationApplicationListForDebug', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1941, 'DeletePairing', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1951, 'SetPlayTimerSettingsForDebug', '0x34 bytes in - 0 bytes out - InRaw<0x34,2,0>', '(nn::pctl::PlayTimerSettings const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 1952, 'GetPlayTimerSpentTimeForTest', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2001, 'RequestPairingAsync', '0 bytes in - 8 bytes out - OutRaw<8,4,0>, OutHandle<0,1>, Buffer<0,9,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::InArray const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2002, 'FinishRequestPairing', '8 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<8,4,0>', '(nn::sf::Out,nn::pctl::detail::AsyncData)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2003, 'AuthorizePairingAsync', '0x10 bytes in - 8 bytes out - OutRaw<8,4,0>, OutHandle<0,1>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::Out,nn::pctl::detail::PairingInfoBase const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2004, 'FinishAuthorizePairing', '8 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<8,4,0>', '(nn::sf::Out,nn::pctl::detail::AsyncData)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2005, 'RetrievePairingInfoAsync', '0 bytes in - 8 bytes out - OutRaw<8,4,0>, OutHandle<0,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2006, 'FinishRetrievePairingInfo', '8 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>, InRaw<8,4,0>', '(nn::sf::Out,nn::pctl::detail::AsyncData)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2007, 'UnlinkPairingAsync', '1 bytes in - 8 bytes out - OutRaw<8,4,0>, OutHandle<0,1>, InRaw<1,1,0>', '(nn::sf::Out,nn::sf::Out,bool)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2008, 'FinishUnlinkPairing', '0xC bytes in - 0 bytes out - InRaw<8,4,4>, InRaw<1,1,0>', '(nn::pctl::detail::AsyncData,bool)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2009, 'GetAccountMiiImageAsync', '0x10 bytes in - 0xC bytes out - OutRaw<8,4,0>, OutHandle<0,1>, OutRaw<4,4,8>, Buffer<0,6,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&,nn::pctl::detail::PairingAccountInfoBase const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2010, 'FinishGetAccountMiiImage', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<8,4,0>', '(nn::sf::Out,nn::sf::OutBuffer const&,nn::pctl::detail::AsyncData)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2011, 'GetAccountMiiImageContentTypeAsync', '0x10 bytes in - 0xC bytes out - OutRaw<8,4,0>, OutHandle<0,1>, OutRaw<4,4,8>, Buffer<0,0xA,0>, InRaw<0x10,8,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::Out,nn::sf::OutArray const&,nn::pctl::detail::PairingAccountInfoBase const&)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2012, 'FinishGetAccountMiiImageContentType', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0xA,0>, InRaw<8,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::pctl::detail::AsyncData)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2013, 'SynchronizeParentalControlSettingsAsync', '0 bytes in - 8 bytes out - OutRaw<8,4,0>, OutHandle<0,1>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2014, 'FinishSynchronizeParentalControlSettings', '8 bytes in - 0 bytes out - InRaw<8,4,0>', '(nn::pctl::detail::AsyncData)'), + ('nn::pctl::detail::ipc::IParentalControlService', 2015, 'FinishSynchronizeParentalControlSettingsWithLastUpdated', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,4,0>', '(nn::sf::Out,nn::pctl::detail::AsyncData)'), + ('nn::prepo::detail::ipc::IPrepoService', 10100, 'SaveReport', '8 bytes in - 0 bytes out - takes pid - Buffer<0,9,0>, Buffer<1,5,0>, InRaw<8,8,0>', '(nn::sf::InArray const&,nn::sf::InBuffer const&,unsigned long)'), + ('nn::prepo::detail::ipc::IPrepoService', 10101, 'SaveReportWithUser', '0x18 bytes in - 0 bytes out - takes pid - InRaw<0x10,8,0>, Buffer<0,9,0>, Buffer<1,5,0>, InRaw<8,8,0x10>', '(nn::account::Uid const&,nn::sf::InArray const&,nn::sf::InBuffer const&,unsigned long)'), + ('nn::prepo::detail::ipc::IPrepoService', 10200, 'RequestImmediateTransmission', '0 bytes in - 0 bytes out', '(void)'), + ('nn::prepo::detail::ipc::IPrepoService', 10300, 'GetTransmissionStatus', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::prepo::detail::ipc::IPrepoService', 20100, 'SaveSystemReport', '8 bytes in - 0 bytes out - Buffer<0,9,0>, InRaw<8,8,0>, Buffer<1,5,0>', '(nn::sf::InArray const&,nn::ApplicationId,nn::sf::InBuffer const&)'), + ('nn::prepo::detail::ipc::IPrepoService', 20101, 'SaveSystemReportWithUser', '0x18 bytes in - 0 bytes out - InRaw<0x10,8,0>, Buffer<0,9,0>, InRaw<8,8,0x10>, Buffer<1,5,0>', '(nn::account::Uid const&,nn::sf::InArray const&,nn::ApplicationId,nn::sf::InBuffer const&)'), + ('nn::prepo::detail::ipc::IPrepoService', 30100, 'ClearStorage', '0 bytes in - 0 bytes out', '(void)'), + ('nn::prepo::detail::ipc::IPrepoService', 40100, 'IsUserAgreementCheckEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::prepo::detail::ipc::IPrepoService', 40101, 'SetUserAgreementCheckEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::prepo::detail::ipc::IPrepoService', 90100, 'GetStorageUsage', '0 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 0, 'GetBluetoothBdAddress', '0 bytes in - 6 bytes out - OutRaw<6,1,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 1, 'GetConfigurationId1', '0 bytes in - 0x1E bytes out - OutRaw<0x1E,1,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 2, 'GetAccelerometerOffset', '0 bytes in - 6 bytes out - OutRaw<6,2,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 3, 'GetAccelerometerScale', '0 bytes in - 6 bytes out - OutRaw<6,2,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 4, 'GetGyroscopeOffset', '0 bytes in - 6 bytes out - OutRaw<6,2,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 5, 'GetGyroscopeScale', '0 bytes in - 6 bytes out - OutRaw<6,2,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 6, 'GetWirelessLanMacAddress', '0 bytes in - 6 bytes out - OutRaw<6,1,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 7, 'GetWirelessLanCountryCodeCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 8, 'GetWirelessLanCountryCodes', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::settings::IFactorySettingsServer', 9, 'GetSerialNumber', '0 bytes in - 0x18 bytes out - OutRaw<0x18,1,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 10, 'SetInitialSystemAppletProgramId', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ncm::ProgramId)'), + ('nn::settings::IFactorySettingsServer', 11, 'SetOverlayDispProgramId', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::ncm::ProgramId)'), + ('nn::settings::IFactorySettingsServer', 12, 'GetBatteryLot', '0 bytes in - 0x18 bytes out - OutRaw<0x18,1,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 14, 'GetEciDeviceCertificate', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x180>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 15, 'GetEticketDeviceCertificate', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x240>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 16, 'GetSslKey', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x134>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 17, 'GetSslCertificate', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x804>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 18, 'GetGameCardKey', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x134>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 19, 'GetGameCardCertificate', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x400>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 20, 'GetEciDeviceKey', '0 bytes in - 0x54 bytes out - OutRaw<0x54,4,0>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 21, 'GetEticketDeviceKey', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x244>', '(nn::sf::Out)'), + ('nn::settings::IFactorySettingsServer', 22, 'GetSpeakerParameter', '0 bytes in - 0x5A bytes out - OutRaw<0x5A,2,0>', '(nn::sf::Out)'), + ('nn::settings::IFirmwareDebugSettingsServer', 2, 'SetSettingsItemValue', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>, Buffer<2,5,0>', '(nn::settings::SettingsName const&,nn::settings::SettingsItemKey const&,nn::sf::InBuffer const&)'), + ('nn::settings::IFirmwareDebugSettingsServer', 3, 'ResetSettingsItemValue', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>', '(nn::settings::SettingsName const&,nn::settings::SettingsItemKey const&)'), + ('nn::settings::IFirmwareDebugSettingsServer', 4, 'CreateSettingsItemKeyIterator', '0 bytes in - 0 bytes out - OutObject<0,0>, Buffer<0,0x19,0x48>', '(nn::sf::Out,void>,nn::settings::SettingsName const&)'), + ('nn::settings::ISettingsItemKeyIterator', 0, 'GoNext', '0 bytes in - 0 bytes out', '(void)'), + ('nn::settings::ISettingsItemKeyIterator', 1, 'GetKeySize', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISettingsItemKeyIterator', 2, 'GetKey', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::settings::ISettingsServer', 0, 'GetLanguageCode', '0 bytes in - 8 bytes out - OutRaw<8,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISettingsServer', 1, 'GetAvailableLanguageCodes', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::settings::ISettingsServer', 3, 'GetAvailableLanguageCodeCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISettingsServer', 4, 'GetRegionCode', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 0, 'SetLanguageCode', '8 bytes in - 0 bytes out - InRaw<8,1,0>', '(nn::settings::LanguageCode)'), + ('nn::settings::ISystemSettingsServer', 1, 'SetNetworkSettings', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InArray const&)'), + ('nn::settings::ISystemSettingsServer', 2, 'GetNetworkSettings', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::settings::ISystemSettingsServer', 3, 'GetFirmwareVersion', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 4, 'GetFirmwareVersion2', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 7, 'GetLockScreenFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 8, 'SetLockScreenFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 9, 'GetBacklightSettings', '0 bytes in - 0x28 bytes out - OutRaw<0x28,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 10, 'SetBacklightSettings', '0x28 bytes in - 0 bytes out - InRaw<0x28,4,0>', '(nn::settings::system::BacklightSettings const&)'), + ('nn::settings::ISystemSettingsServer', 11, 'SetBluetoothDevicesSettings', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InArray const&)'), + ('nn::settings::ISystemSettingsServer', 12, 'GetBluetoothDevicesSettings', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::settings::ISystemSettingsServer', 13, 'GetExternalSteadyClockSourceId', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 14, 'SetExternalSteadyClockSourceId', '0x10 bytes in - 0 bytes out - InRaw<0x10,1,0>', '(nn::util::Uuid const&)'), + ('nn::settings::ISystemSettingsServer', 15, 'GetUserSystemClockContext', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 16, 'SetUserSystemClockContext', '0x20 bytes in - 0 bytes out - InRaw<0x20,8,0>', '(nn::time::SystemClockContext const&)'), + ('nn::settings::ISystemSettingsServer', 17, 'GetAccountSettings', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 18, 'SetAccountSettings', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::settings::system::AccountSettings)'), + ('nn::settings::ISystemSettingsServer', 19, 'GetAudioVolume', '4 bytes in - 8 bytes out - OutRaw<8,4,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::settings::ISystemSettingsServer', 20, 'SetAudioVolume', '0xC bytes in - 0 bytes out - InRaw<8,4,0>, InRaw<4,4,8>', '(nn::settings::system::AudioVolume,int)'), + ('nn::settings::ISystemSettingsServer', 21, 'GetEulaVersions', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::settings::ISystemSettingsServer', 22, 'SetEulaVersions', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InArray const&)'), + ('nn::settings::ISystemSettingsServer', 23, 'GetColorSetId', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 24, 'SetColorSetId', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::settings::ISystemSettingsServer', 25, 'GetConsoleInformationUploadFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 26, 'SetConsoleInformationUploadFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 27, 'GetAutomaticApplicationDownloadFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 28, 'SetAutomaticApplicationDownloadFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 29, 'GetNotificationSettings', '0 bytes in - 0x18 bytes out - OutRaw<0x18,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 30, 'SetNotificationSettings', '0x18 bytes in - 0 bytes out - InRaw<0x18,4,0>', '(nn::settings::system::NotificationSettings const&)'), + ('nn::settings::ISystemSettingsServer', 31, 'GetAccountNotificationSettings', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::settings::ISystemSettingsServer', 32, 'SetAccountNotificationSettings', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InArray const&)'), + ('nn::settings::ISystemSettingsServer', 35, 'GetVibrationMasterVolume', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 36, 'SetVibrationMasterVolume', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(float)'), + ('nn::settings::ISystemSettingsServer', 37, 'GetSettingsItemValueSize', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>', '(nn::sf::Out,nn::settings::SettingsName const&,nn::settings::SettingsItemKey const&)'), + ('nn::settings::ISystemSettingsServer', 38, 'GetSettingsItemValue', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<2,6,0>, Buffer<0,0x19,0x48>, Buffer<1,0x19,0x48>', '(nn::sf::Out,nn::sf::OutBuffer const&,nn::settings::SettingsName const&,nn::settings::SettingsItemKey const&)'), + ('nn::settings::ISystemSettingsServer', 39, 'GetTvSettings', '0 bytes in - 0x20 bytes out - OutRaw<0x20,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 40, 'SetTvSettings', '0x20 bytes in - 0 bytes out - InRaw<0x20,4,0>', '(nn::settings::system::TvSettings const&)'), + ('nn::settings::ISystemSettingsServer', 41, 'GetEdid', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x100>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 42, 'SetEdid', '0 bytes in - 0 bytes out - Buffer<0,0x19,0x100>', '(nn::settings::system::Edid const&)'), + ('nn::settings::ISystemSettingsServer', 43, 'GetAudioOutputMode', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::settings::ISystemSettingsServer', 44, 'SetAudioOutputMode', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(int,int)'), + ('nn::settings::ISystemSettingsServer', 45, 'IsForceMuteOnHeadphoneRemoved', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 46, 'SetForceMuteOnHeadphoneRemoved', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 47, 'GetQuestFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 48, 'SetQuestFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 49, 'GetDataDeletionSettings', '0 bytes in - 8 bytes out - OutRaw<8,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 50, 'SetDataDeletionSettings', '8 bytes in - 0 bytes out - InRaw<8,4,0>', '(nn::settings::system::DataDeletionSettings)'), + ('nn::settings::ISystemSettingsServer', 51, 'GetInitialSystemAppletProgramId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 52, 'GetOverlayDispProgramId', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 53, 'GetDeviceTimeZoneLocationName', '0 bytes in - 0x24 bytes out - OutRaw<0x24,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 54, 'SetDeviceTimeZoneLocationName', '0x24 bytes in - 0 bytes out - InRaw<0x24,1,0>', '(nn::time::LocationName const&)'), + ('nn::settings::ISystemSettingsServer', 55, 'GetWirelessCertificationFileSize', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 56, 'GetWirelessCertificationFile', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::settings::ISystemSettingsServer', 57, 'SetRegionCode', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::settings::ISystemSettingsServer', 58, 'GetNetworkSystemClockContext', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 59, 'SetNetworkSystemClockContext', '0x20 bytes in - 0 bytes out - InRaw<0x20,8,0>', '(nn::time::SystemClockContext const&)'), + ('nn::settings::ISystemSettingsServer', 60, 'IsUserSystemClockAutomaticCorrectionEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 61, 'SetUserSystemClockAutomaticCorrectionEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 62, 'GetDebugModeFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 63, 'GetPrimaryAlbumStorage', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 64, 'SetPrimaryAlbumStorage', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::settings::ISystemSettingsServer', 65, 'GetUsb30EnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 66, 'SetUsb30EnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 67, 'GetBatteryLot', '0 bytes in - 0x18 bytes out - OutRaw<0x18,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 68, 'GetSerialNumber', '0 bytes in - 0x18 bytes out - OutRaw<0x18,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 69, 'GetNfcEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 70, 'SetNfcEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 71, 'GetSleepSettings', '0 bytes in - 0xC bytes out - OutRaw<0xC,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 72, 'SetSleepSettings', '0xC bytes in - 0 bytes out - InRaw<0xC,4,0>', '(nn::settings::system::SleepSettings const&)'), + ('nn::settings::ISystemSettingsServer', 73, 'GetWirelessLanEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 74, 'SetWirelessLanEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 75, 'GetInitialLaunchSettings', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 76, 'SetInitialLaunchSettings', '0x20 bytes in - 0 bytes out - InRaw<0x20,8,0>', '(nn::settings::system::InitialLaunchSettings const&)'), + ('nn::settings::ISystemSettingsServer', 77, 'GetDeviceNickName', '0 bytes in - 0 bytes out - Buffer<0,0x16,0x80>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 78, 'SetDeviceNickName', '0 bytes in - 0 bytes out - Buffer<0,0x15,0x80>', '(nn::settings::system::DeviceNickName const&)'), + ('nn::settings::ISystemSettingsServer', 79, 'GetProductModel', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 80, 'GetLdnChannel', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 81, 'SetLdnChannel', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::settings::ISystemSettingsServer', 82, 'AcquireTelemetryDirtyFlagEventHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 83, 'GetTelemetryDirtyFlags', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out,void>)'), + ('nn::settings::ISystemSettingsServer', 84, 'GetPtmBatteryLot', '0 bytes in - 0x18 bytes out - OutRaw<0x18,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 85, 'SetPtmBatteryLot', '0x18 bytes in - 0 bytes out - InRaw<0x18,1,0>', '(nn::settings::factory::BatteryLot const&)'), + ('nn::settings::ISystemSettingsServer', 86, 'GetPtmFuelGaugeParameter', '0 bytes in - 0x18 bytes out - OutRaw<0x18,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 87, 'SetPtmFuelGaugeParameter', '0x18 bytes in - 0 bytes out - InRaw<0x18,4,0>', '(nn::settings::system::PtmFuelGaugeParameter const&)'), + ('nn::settings::ISystemSettingsServer', 88, 'GetBluetoothEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 89, 'SetBluetoothEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 90, 'GetMiiAuthorId', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 91, 'SetShutdownRtcValue', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(long)'), + ('nn::settings::ISystemSettingsServer', 92, 'GetShutdownRtcValue', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 93, 'AcquireFatalDirtyFlagEventHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 94, 'GetFatalDirtyFlags', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', '(nn::sf::Out,void>)'), + ('nn::settings::ISystemSettingsServer', 95, 'GetAutoUpdateEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 96, 'SetAutoUpdateEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 97, 'GetNxControllerSettings', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::settings::ISystemSettingsServer', 98, 'SetNxControllerSettings', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InArray const&)'), + ('nn::settings::ISystemSettingsServer', 99, 'GetBatteryPercentageFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 100, 'SetBatteryPercentageFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 101, 'GetExternalRtcResetFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 102, 'SetExternalRtcResetFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 103, 'GetUsbFullKeyEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 104, 'SetUsbFullKeyEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 105, 'SetExternalSteadyClockInternalOffset', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(long)'), + ('nn::settings::ISystemSettingsServer', 106, 'GetExternalSteadyClockInternalOffset', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 107, 'GetBacklightSettingsEx', '0 bytes in - 0x2C bytes out - OutRaw<0x2C,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 108, 'SetBacklightSettingsEx', '0x2C bytes in - 0 bytes out - InRaw<0x2C,4,0>', '(nn::settings::system::BacklightSettingsEx const&)'), + ('nn::settings::ISystemSettingsServer', 109, 'GetHeadphoneVolumeWarningCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 110, 'SetHeadphoneVolumeWarningCount', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::settings::ISystemSettingsServer', 111, 'GetBluetoothAfhEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 112, 'SetBluetoothAfhEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 113, 'GetBluetoothBoostEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 114, 'SetBluetoothBoostEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 115, 'GetInRepairProcessEnableFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 116, 'SetInRepairProcessEnableFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 117, 'GetHeadphoneVolumeUpdateFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 118, 'SetHeadphoneVolumeUpdateFlag', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::settings::ISystemSettingsServer', 119, 'NeedsToUpdateHeadphoneVolume', '1 bytes in - 3 bytes out - OutRaw<1,1,0>, OutRaw<1,1,1>, OutRaw<1,1,2>, InRaw<1,1,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::Out,bool)'), + ('nn::settings::ISystemSettingsServer', 120, 'GetPushNotificationActivityModeOnSleep', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::settings::ISystemSettingsServer', 121, 'SetPushNotificationActivityModeOnSleep', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::ssl::sf::ISslService', 0, 'CreateContext', '0x10 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<4,4,0>, InRaw<8,8,8>', '(nn::sf::Out,void>,nn::ssl::sf::SslVersion,unsigned long)'), + ('nn::ssl::sf::ISslService', 1, 'GetContextCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslService', 2, 'GetCertificates', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, Buffer<1,5,0>', '(nn::sf::OutBuffer const&,nn::sf::Out,nn::sf::InBuffer const&)'), + ('nn::ssl::sf::ISslService', 3, 'GetCertificateBufSize', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,5,0>', '(nn::sf::Out,nn::sf::InBuffer const&)'), + ('nn::ssl::sf::ISslService', 4, 'DebugIoctl', '8 bytes in - 0 bytes out - Buffer<0,6,0>, Buffer<1,5,0>, InRaw<8,8,0>', '(nn::sf::OutBuffer const&,nn::sf::InBuffer const&,unsigned long)'), + ('nn::ssl::sf::ISslService', 5, 'SetInterfaceVersion', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::ssl::sf::ISslContext', 0, 'SetOption', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(nn::ssl::sf::ContextOption,int)'), + ('nn::ssl::sf::ISslContext', 1, 'GetOption', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::ssl::sf::ContextOption)'), + ('nn::ssl::sf::ISslContext', 2, 'CreateConnection', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::ssl::sf::ISslContext', 3, 'GetConnectionCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslContext', 4, 'ImportServerPki', '4 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,5,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::InBuffer const&,nn::ssl::sf::CertificateFormat)'), + ('nn::ssl::sf::ISslContext', 5, 'ImportClientPki', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,5,0>, Buffer<1,5,0>', '(nn::sf::Out,nn::sf::InBuffer const&,nn::sf::InBuffer const&)'), + ('nn::ssl::sf::ISslContext', 6, 'RemoveServerPki', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::ssl::sf::ISslContext', 7, 'RemoveClientPki', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::ssl::sf::ISslContext', 8, 'RegisterInternalPki', '4 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::ssl::sf::InternalPki)'), + ('nn::ssl::sf::ISslContext', 9, 'AddPolicyOid', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InBuffer const&)'), + ('nn::ssl::sf::ISslContext', 10, 'ImportCrl', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,5,0>', '(nn::sf::Out,nn::sf::InBuffer const&)'), + ('nn::ssl::sf::ISslContext', 11, 'RemoveCrl', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::ssl::sf::ISslConnection', 0, 'SetSocketDescriptor', '4 bytes in - 4 bytes out - InRaw<4,4,0>, OutRaw<4,4,0>', '(int,nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 1, 'SetHostName', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InBuffer const&)'), + ('nn::ssl::sf::ISslConnection', 2, 'SetVerifyOption', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::ssl::sf::VerifyOption)'), + ('nn::ssl::sf::ISslConnection', 3, 'SetIoMode', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::ssl::sf::IoMode)'), + ('nn::ssl::sf::ISslConnection', 4, 'GetSocketDescriptor', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 5, 'GetHostName', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', '(nn::sf::OutBuffer const&,nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 6, 'GetVerifyOption', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 7, 'GetIoMode', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 8, 'DoHandshake', '0 bytes in - 0 bytes out', '(void)'), + ('nn::ssl::sf::ISslConnection', 9, 'DoHandshakeGetServerCert', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::ssl::sf::ISslConnection', 10, 'Read', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::ssl::sf::ISslConnection', 11, 'Write', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,5,0>', '(nn::sf::Out,nn::sf::InBuffer const&)'), + ('nn::ssl::sf::ISslConnection', 12, 'Pending', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 13, 'Peek', '0 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutBuffer const&)'), + ('nn::ssl::sf::ISslConnection', 14, 'Poll', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::Out,nn::ssl::sf::PollEvent,unsigned int)'), + ('nn::ssl::sf::ISslConnection', 15, 'GetVerifyCertError', '0 bytes in - 0 bytes out', '(void)'), + ('nn::ssl::sf::ISslConnection', 16, 'GetNeededServerCertBufferSize', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 17, 'SetSessionCacheMode', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::ssl::sf::SessionCacheMode)'), + ('nn::ssl::sf::ISslConnection', 18, 'GetSessionCacheMode', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 19, 'FlushSessionCache', '0 bytes in - 0 bytes out', '(void)'), + ('nn::ssl::sf::ISslConnection', 20, 'SetRenegotiationMode', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::ssl::sf::RenegotiationMode)'), + ('nn::ssl::sf::ISslConnection', 21, 'GetRenegotiationMode', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::ssl::sf::ISslConnection', 22, 'SetOption', '8 bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>', '(nn::ssl::sf::OptionType,bool)'), + ('nn::ssl::sf::ISslConnection', 23, 'GetOption', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::ssl::sf::OptionType)'), + ('nn::ssl::sf::ISslConnection', 24, 'GetVerifyCertErrors', '0 bytes in - 8 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, OutRaw<4,4,4>', '(nn::sf::OutBuffer const&,nn::sf::Out,nn::sf::Out)'), + ('nn::timesrv::detail::service::IStaticService', 0, 'GetStandardUserSystemClock', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::timesrv::detail::service::IStaticService', 1, 'GetStandardNetworkSystemClock', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::timesrv::detail::service::IStaticService', 2, 'GetStandardSteadyClock', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::timesrv::detail::service::IStaticService', 3, 'GetTimeZoneService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::timesrv::detail::service::IStaticService', 4, 'GetStandardLocalSystemClock', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::timesrv::detail::service::IStaticService', 100, 'IsStandardUserSystemClockAutomaticCorrectionEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::IStaticService', 101, 'SetStandardUserSystemClockAutomaticCorrectionEnabled', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::timesrv::detail::service::IStaticService', 200, 'IsStandardNetworkSystemClockAccuracySufficient', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISystemClock', 0, 'GetCurrentTime', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISystemClock', 1, 'SetCurrentTime', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::time::PosixTime)'), + ('nn::timesrv::detail::service::ISystemClock', 2, 'GetSystemClockContext', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISystemClock', 3, 'SetSystemClockContext', '0x20 bytes in - 0 bytes out - InRaw<0x20,8,0>', '(nn::time::SystemClockContext const&)'), + ('nn::timesrv::detail::service::ISteadyClock', 0, 'GetCurrentTimePoint', '0 bytes in - 0x18 bytes out - OutRaw<0x18,8,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISteadyClock', 2, 'GetTestOffset', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISteadyClock', 3, 'SetTestOffset', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::TimeSpanType)'), + ('nn::timesrv::detail::service::ISteadyClock', 100, 'GetRtcValue', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISteadyClock', 101, 'IsRtcResetDetected', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISteadyClock', 102, 'GetSetupResutltValue', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISteadyClock', 200, 'GetInternalOffset', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ISteadyClock', 201, 'SetInternalOffset', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::TimeSpanType)'), + ('nn::timesrv::detail::service::ITimeZoneService', 0, 'GetDeviceLocationName', '0 bytes in - 0x24 bytes out - OutRaw<0x24,1,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ITimeZoneService', 1, 'SetDeviceLocationName', '0x24 bytes in - 0 bytes out - InRaw<0x24,1,0>', '(nn::time::LocationName const&)'), + ('nn::timesrv::detail::service::ITimeZoneService', 2, 'GetTotalLocationNameCount', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ITimeZoneService', 3, 'LoadLocationNameList', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,int)'), + ('nn::timesrv::detail::service::ITimeZoneService', 4, 'LoadTimeZoneRule', '0x24 bytes in - 0 bytes out - Buffer<0,0x16,0x4000>, InRaw<0x24,1,0>', '(nn::sf::Out,nn::time::LocationName const&)'), + ('nn::timesrv::detail::service::ITimeZoneService', 5, 'GetTimeZoneRuleVersion', '0 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>', '(nn::sf::Out)'), + ('nn::timesrv::detail::service::ITimeZoneService', 100, 'ToCalendarTime', '8 bytes in - 0x20 bytes out - OutRaw<8,2,0>, OutRaw<0x18,4,8>, InRaw<8,8,0>, Buffer<0,0x15,0x4000>', '(nn::sf::Out,nn::sf::Out,nn::time::PosixTime,nn::time::TimeZoneRule const&)'), + ('nn::timesrv::detail::service::ITimeZoneService', 101, 'ToCalendarTimeWithMyRule', '8 bytes in - 0x20 bytes out - OutRaw<8,2,0>, OutRaw<0x18,4,8>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::Out,nn::time::PosixTime)'), + ('nn::timesrv::detail::service::ITimeZoneService', 201, 'ToPosixTime', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<1,0xA,0>, InRaw<8,2,0>, Buffer<0,0x15,0x4000>', '(nn::sf::Out,nn::sf::OutArray const&,nn::time::CalendarTime,nn::time::TimeZoneRule const&)'), + ('nn::timesrv::detail::service::ITimeZoneService', 202, 'ToPosixTimeWithMyRule', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,0xA,0>, InRaw<8,2,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::time::CalendarTime)'), + ('nn::ntc::detail::service::IStaticService', 0, '', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>, InRaw<4,4,4>', ''), + ('nn::ntc::detail::service::IStaticService', 100, '', '0 bytes in - 0 bytes out', ''), + ('nn::ntc::detail::service::IStaticService', 101, '', '0 bytes in - 0 bytes out', ''), + ('nn::ntc::detail::service::IEnsureNetworkClockAvailabilityService', 0, '', '0 bytes in - 0 bytes out', ''), + ('nn::ntc::detail::service::IEnsureNetworkClockAvailabilityService', 1, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::ntc::detail::service::IEnsureNetworkClockAvailabilityService', 2, '', '0 bytes in - 0 bytes out', ''), + ('nn::ntc::detail::service::IEnsureNetworkClockAvailabilityService', 3, '', '0 bytes in - 0 bytes out', ''), + ('nn::ntc::detail::service::IEnsureNetworkClockAvailabilityService', 4, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::ntc::detail::service::IEnsureNetworkClockAvailabilityService', 5, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::aocsrv::detail::IAddOnContentManager', 0, 'CountAddOnContentByApplicationId', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::ncm::ApplicationId)'), + ('nn::aocsrv::detail::IAddOnContentManager', 1, 'ListAddOnContentByApplicationId', '0x10 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<8,8,8>', '(nn::sf::Out,nn::sf::OutArray const&,int,int,nn::ncm::ApplicationId)'), + ('nn::aocsrv::detail::IAddOnContentManager', 2, 'CountAddOnContent', '8 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::aocsrv::detail::IAddOnContentManager', 3, 'ListAddOnContent', '0x10 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::Out,nn::sf::OutArray const&,unsigned long,int,int)'), + ('nn::aocsrv::detail::IAddOnContentManager', 4, 'GetAddOnContentBaseIdByApplicationId', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::ncm::ApplicationId)'), + ('nn::aocsrv::detail::IAddOnContentManager', 5, 'GetAddOnContentBaseId', '8 bytes in - 8 bytes out - takes pid - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::aocsrv::detail::IAddOnContentManager', 6, 'PrepareAddOnContentByApplicationId', '0x10 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<8,8,8>', '(int,nn::ncm::ApplicationId)'), + ('nn::aocsrv::detail::IAddOnContentManager', 7, 'PrepareAddOnContent', '0x10 bytes in - 0 bytes out - takes pid - InRaw<4,4,0>, InRaw<8,8,8>', '(int,unsigned long)'), + ('nn::audio::detail::IAudioDebugManager', 0, '', '0x10 bytes in - 0 bytes out - InHandle<0,1>, InRaw<8,8,8>, InRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDebugManager', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioDebugManager', 2, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioDebugManager', 3, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioInManager', 0, '', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioInManager', 1, '', '0x10 bytes in - 0x10 bytes out - takes pid - OutObject<0,0>, Buffer<0,5,0>, InRaw<8,4,0>, InHandle<0,1>, OutRaw<0x10,4,0>, Buffer<1,6,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioInManager', 2, '', '0 bytes in - 4 bytes out - Buffer<0,0x22,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioInManager', 3, '', '0x10 bytes in - 0x10 bytes out - takes pid - OutObject<0,0>, Buffer<0,0x21,0>, InRaw<8,4,0>, InHandle<0,1>, OutRaw<0x10,4,0>, Buffer<1,0x22,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioInManager', 4, '', '0 bytes in - 4 bytes out - Buffer<0,0x22,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioIn', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioIn', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioIn', 2, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioIn', 3, '', '8 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioIn', 4, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::audio::detail::IAudioIn', 5, '', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioIn', 6, '', '8 bytes in - 1 bytes out - InRaw<8,8,0>, OutRaw<1,1,0>', ''), + ('nn::audio::detail::IAudioIn', 7, '', '8 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<8,8,0>, InHandle<0,1>', ''), + ('nn::audio::detail::IAudioIn', 8, '', '8 bytes in - 0 bytes out - Buffer<0,0x21,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioIn', 9, '', '0 bytes in - 4 bytes out - Buffer<0,0x22,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioIn', 10, '', '8 bytes in - 0 bytes out - Buffer<0,0x21,0>, InRaw<8,8,0>, InHandle<0,1>', ''), + ('nn::audio::detail::IAudioInManagerForApplet', 0, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioInManagerForApplet', 1, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioInManagerForApplet', 2, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioInManagerForApplet', 3, '', '0x18 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<8,8,0x10>', ''), + ('nn::audio::detail::IAudioInManagerForDebugger', 0, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioInManagerForDebugger', 1, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioOutManager', 0, '', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioOutManager', 1, '', '0x10 bytes in - 0x10 bytes out - takes pid - OutObject<0,0>, Buffer<0,5,0>, InRaw<8,4,0>, InHandle<0,1>, OutRaw<0x10,4,0>, Buffer<1,6,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioOutManager', 2, '', '0 bytes in - 4 bytes out - Buffer<0,0x22,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioOutManager', 3, '', '0x10 bytes in - 0x10 bytes out - takes pid - OutObject<0,0>, Buffer<0,0x21,0>, InRaw<8,4,0>, InHandle<0,1>, OutRaw<0x10,4,0>, Buffer<1,0x22,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioOut', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioOut', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioOut', 2, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioOut', 3, '', '8 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioOut', 4, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::audio::detail::IAudioOut', 5, '', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioOut', 6, '', '8 bytes in - 1 bytes out - InRaw<8,8,0>, OutRaw<1,1,0>', ''), + ('nn::audio::detail::IAudioOut', 7, '', '8 bytes in - 0 bytes out - Buffer<0,0x21,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioOut', 8, '', '0 bytes in - 4 bytes out - Buffer<0,0x22,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioOutManagerForApplet', 0, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioOutManagerForApplet', 1, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioOutManagerForApplet', 2, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioOutManagerForApplet', 3, '', '0x18 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<8,8,0x10>', ''), + ('nn::audio::detail::IAudioOutManagerForDebugger', 0, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioOutManagerForDebugger', 1, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioRendererManager', 0, '', '0x48 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<0x34,4,0>, InHandle<0,1>, InHandle<1,1>, InRaw<8,8,0x38>, InRaw<8,8,0x40>', ''), + ('nn::audio::detail::IAudioRendererManager', 1, '', '0x34 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<0x34,4,0>', ''), + ('nn::audio::detail::IAudioRendererManager', 2, '', '8 bytes in - 0 bytes out - OutObject<0,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioRendererManager', 3, '', '0x50 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<0x34,4,0>, InRaw<8,8,0x38>, InHandle<0,1>, InRaw<8,8,0x40>, InRaw<8,8,0x48>', ''), + ('nn::audio::detail::IAudioRenderer', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioRenderer', 1, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioRenderer', 2, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioRenderer', 3, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioRenderer', 4, '', '0 bytes in - 0 bytes out - Buffer<0,6,0>, Buffer<1,6,0>, Buffer<2,5,0>', ''), + ('nn::audio::detail::IAudioRenderer', 5, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioRenderer', 6, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioRenderer', 7, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::audio::detail::IAudioRenderer', 8, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioRenderer', 9, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioRenderer', 10, '', '0 bytes in - 0 bytes out - Buffer<0,0x22,0>, Buffer<1,0x22,0>, Buffer<2,0x21,0>', ''), + ('nn::audio::detail::IAudioRenderer', 11, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IAudioDevice', 0, '', '0 bytes in - 4 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDevice', 1, '', '4 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDevice', 2, '', '0 bytes in - 4 bytes out - Buffer<0,5,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDevice', 3, '', '0 bytes in - 0 bytes out - Buffer<0,6,0>', ''), + ('nn::audio::detail::IAudioDevice', 4, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::audio::detail::IAudioDevice', 5, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDevice', 6, '', '0 bytes in - 4 bytes out - Buffer<0,0x22,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDevice', 7, '', '4 bytes in - 0 bytes out - Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDevice', 8, '', '0 bytes in - 4 bytes out - Buffer<0,0x21,0>, OutRaw<4,4,0>', ''), + ('nn::audio::detail::IAudioDevice', 10, '', '0 bytes in - 0 bytes out - Buffer<0,0x22,0>', ''), + ('nn::audio::detail::IAudioDevice', 11, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::audio::detail::IAudioDevice', 12, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::audio::detail::IAudioRendererManagerForApplet', 0, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioRendererManagerForApplet', 1, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IAudioRendererManagerForApplet', 2, '', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioRendererManagerForApplet', 3, '', '0x18 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<8,8,0x10>', ''), + ('nn::audio::detail::IAudioRendererManagerForApplet', 4, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioRendererManagerForApplet', 5, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioRendererManagerForDebugger', 0, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IAudioRendererManagerForDebugger', 1, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IFinalOutputRecorderManager', 0, '', '0x10 bytes in - 0x10 bytes out - OutObject<0,0>, InRaw<8,4,0>, InHandle<0,1>, OutRaw<0x10,4,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 1, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IFinalOutputRecorder', 2, '', '0 bytes in - 0 bytes out', ''), + ('nn::audio::detail::IFinalOutputRecorder', 3, '', '8 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 4, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 5, '', '0 bytes in - 0x10 bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, OutRaw<8,8,8>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 6, '', '8 bytes in - 1 bytes out - InRaw<8,8,0>, OutRaw<1,1,0>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 7, '', '8 bytes in - 8 bytes out - InRaw<8,8,0>, OutRaw<8,8,0>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 8, '', '8 bytes in - 0 bytes out - Buffer<0,0x21,0>, InRaw<8,8,0>', ''), + ('nn::audio::detail::IFinalOutputRecorder', 9, '', '0 bytes in - 0x10 bytes out - Buffer<0,0x22,0>, OutRaw<4,4,0>, OutRaw<8,8,8>', ''), + ('nn::audio::detail::IFinalOutputRecorderManagerForDebugger', 0, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IFinalOutputRecorderManagerForDebugger', 1, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::audio::detail::IFinalOutputRecorderManagerForApplet', 0, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::audio::detail::IFinalOutputRecorderManagerForApplet', 1, '', '0x10 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>, InRaw<8,8,8>', ''), + ('nn::mii::detail::IStaticService', 0, 'GetDatabaseService', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,int)'), + ('nn::mii::detail::IDatabaseService', 0, 'IsUpdated', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::mii::detail::IDatabaseService', 1, 'IsFullDatabase', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::mii::detail::IDatabaseService', 2, 'GetCount', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::mii::detail::IDatabaseService', 3, 'Get', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,int)'), + ('nn::mii::detail::IDatabaseService', 4, 'Get1', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,int)'), + ('nn::mii::detail::IDatabaseService', 5, 'UpdateLatest', '0x5C bytes in - 0x58 bytes out - OutRaw<0x58,4,0>, InRaw<0x58,4,0>, InRaw<4,4,0x58>', '(nn::sf::Out,nn::mii::CharInfo const&,int)'), + ('nn::mii::detail::IDatabaseService', 6, 'BuildRandom', '0xC bytes in - 0x58 bytes out - OutRaw<0x58,4,0>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', '(nn::sf::Out,int,int,int)'), + ('nn::mii::detail::IDatabaseService', 7, 'BuildDefault', '4 bytes in - 0x58 bytes out - OutRaw<0x58,4,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::mii::detail::IDatabaseService', 8, 'Get2', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,int)'), + ('nn::mii::detail::IDatabaseService', 9, 'Get3', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,int)'), + ('nn::mii::detail::IDatabaseService', 10, 'UpdateLatest1', '0x48 bytes in - 0x44 bytes out - OutRaw<0x44,4,0>, InRaw<0x44,4,0>, InRaw<4,4,0x44>', '(nn::sf::Out,nn::mii::StoreData const&,int)'), + ('nn::mii::detail::IDatabaseService', 11, 'FindIndex', '0x11 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<0x10,1,0>, InRaw<1,1,0x10>', '(nn::sf::Out,nn::mii::CreateId const&,bool)'), + ('nn::mii::detail::IDatabaseService', 12, 'Move', '0x14 bytes in - 0 bytes out - InRaw<4,4,0x10>, InRaw<0x10,1,0>', '(int,nn::mii::CreateId const&)'), + ('nn::mii::detail::IDatabaseService', 13, 'AddOrReplace', '0x44 bytes in - 0 bytes out - InRaw<0x44,4,0>', '(nn::mii::StoreData const&)'), + ('nn::mii::detail::IDatabaseService', 14, 'Delete', '0x10 bytes in - 0 bytes out - InRaw<0x10,1,0>', '(nn::mii::CreateId const&)'), + ('nn::mii::detail::IDatabaseService', 15, 'DestroyFile', '0 bytes in - 0 bytes out', '(void)'), + ('nn::mii::detail::IDatabaseService', 16, 'DeleteFile', '0 bytes in - 0 bytes out', '(void)'), + ('nn::mii::detail::IDatabaseService', 17, 'Format', '0 bytes in - 0 bytes out', '(void)'), + ('nn::mii::detail::IDatabaseService', 18, 'Import', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InBuffer const&)'), + ('nn::mii::detail::IDatabaseService', 19, 'Export', '0 bytes in - 0 bytes out - Buffer<0,6,0>', '(nn::sf::OutBuffer const&)'), + ('nn::mii::detail::IDatabaseService', 20, 'IsBrokenDatabaseWithClearFlag', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::mii::detail::IDatabaseService', 21, 'GetIndex', '0x58 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<0x58,4,0>', '(nn::sf::Out,nn::mii::CharInfo const&)'), + ('nn::pl::detail::ISharedFontManager', 0, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::pl::detail::ISharedFontManager', 1, '', '4 bytes in - 4 bytes out - InRaw<4,4,0>, OutRaw<4,4,0>', ''), + ('nn::pl::detail::ISharedFontManager', 2, '', '4 bytes in - 4 bytes out - InRaw<4,4,0>, OutRaw<4,4,0>', ''), + ('nn::pl::detail::ISharedFontManager', 3, '', '4 bytes in - 4 bytes out - InRaw<4,4,0>, OutRaw<4,4,0>', ''), + ('nn::pl::detail::ISharedFontManager', 4, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::pl::detail::ISharedFontManager', 5, '', '8 bytes in - 8 bytes out - OutRaw<1,1,0>, OutRaw<4,4,4>, Buffer<0,6,0>, Buffer<1,6,0>, Buffer<2,6,0>, InRaw<8,1,0>', ''), + ('nn::visrv::sf::IManagerRootService', 2, 'GetDisplayService', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,unsigned int)'), + ('nn::visrv::sf::IManagerRootService', 3, 'GetDisplayServiceWithProxyNameExchange', '0xC bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,8>, InRaw<8,1,0>', '(nn::sf::Out,void>,unsigned int,nn::vi::ProxyName)'), + ('nn::visrv::sf::IApplicationDisplayService', 100, 'GetRelayService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::visrv::sf::IApplicationDisplayService', 101, 'GetSystemDisplayService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::visrv::sf::IApplicationDisplayService', 102, 'GetManagerDisplayService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::visrv::sf::IApplicationDisplayService', 103, 'GetIndirectDisplayTransactionService', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::visrv::sf::IApplicationDisplayService', 1000, 'ListDisplays', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::visrv::sf::IApplicationDisplayService', 1010, 'OpenDisplay', '0x40 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<0x40,1,0>', '(nn::sf::Out,nn::vi::DisplayName const&)'), + ('nn::visrv::sf::IApplicationDisplayService', 1011, 'OpenDefaultDisplay', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::visrv::sf::IApplicationDisplayService', 1020, 'CloseDisplay', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IApplicationDisplayService', 1101, 'SetDisplayEnabled', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(unsigned long,bool)'), + ('nn::visrv::sf::IApplicationDisplayService', 1102, 'GetDisplayResolution', '8 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::IApplicationDisplayService', 2020, 'OpenLayer', '0x50 bytes in - 8 bytes out - takes pid - OutRaw<8,8,0>, Buffer<0,6,0>, InRaw<8,8,0x40>, InRaw<0x40,1,0>, InRaw<8,8,0x48>', '(nn::sf::Out,nn::sf::OutBuffer const&,unsigned long,nn::vi::DisplayName const&,nn::applet::AppletResourceUserId)'), + ('nn::visrv::sf::IApplicationDisplayService', 2021, 'CloseLayer', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IApplicationDisplayService', 2030, 'CreateStrayLayer', '0x10 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>, Buffer<0,6,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&,unsigned long,unsigned int)'), + ('nn::visrv::sf::IApplicationDisplayService', 2031, 'DestroyStrayLayer', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IApplicationDisplayService', 2101, 'SetLayerScalingMode', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::IApplicationDisplayService', 2450, 'GetIndirectLayerImageMap', '0x20 bytes in - 0x10 bytes out - takes pid - OutRaw<8,8,0>, OutRaw<8,8,8>, Buffer<0,0x46,0>, InRaw<8,8,0>, InRaw<8,8,8>, InRaw<8,8,0x10>, InRaw<8,8,0x18>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&,long,long,unsigned long,nn::applet::AppletResourceUserId)'), + ('nn::visrv::sf::IApplicationDisplayService', 2451, 'GetIndirectLayerImageCropMap', '0x30 bytes in - 0x10 bytes out - takes pid - OutRaw<8,8,0>, OutRaw<8,8,8>, Buffer<0,0x46,0>, InRaw<8,8,0x10>, InRaw<8,8,0x18>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>, InRaw<4,4,0xC>, InRaw<8,8,0x20>, InRaw<8,8,0x28>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&,long,long,float,float,float,float,unsigned long,nn::applet::AppletResourceUserId)'), + ('nn::visrv::sf::IApplicationDisplayService', 2460, 'GetIndirectLayerImageRequiredMemoryInfo', '0x10 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>, InRaw<8,8,0>, InRaw<8,8,8>', '(nn::sf::Out,nn::sf::Out,long,long)'), + ('nn::visrv::sf::IApplicationDisplayService', 5202, 'GetDisplayVsyncEvent', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::IApplicationDisplayService', 5203, 'GetDisplayVsyncEventForDebug', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nns::hosbinder::IHOSBinderDriver', 0, 'TransactParcel', '0xC bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>, Buffer<0,5,0>, Buffer<1,6,0>, InRaw<4,4,8>', '(int,unsigned int,nn::sf::InBuffer const&,nn::sf::OutBuffer const&,unsigned int)'), + ('nns::hosbinder::IHOSBinderDriver', 1, 'AdjustRefcount', '0xC bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', '(int,int,int)'), + ('nns::hosbinder::IHOSBinderDriver', 2, 'GetNativeHandle', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>, OutHandle<0,1>', '(int,unsigned int,nn::sf::Out)'), + ('nns::hosbinder::IHOSBinderDriver', 3, 'TransactParcelAuto', '0xC bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>, Buffer<0,0x21,0>, Buffer<1,0x22,0>, InRaw<4,4,8>', '(int,unsigned int,nn::sf::InBuffer const&,nn::sf::OutBuffer const&,unsigned int)'), + ('nn::visrv::sf::ISystemDisplayService', 1200, 'GetZOrderCountMin', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 1202, 'GetZOrderCountMax', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 1203, 'GetDisplayLogicalResolution', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 1204, 'SetDisplayMagnification', '0x18 bytes in - 0 bytes out - InRaw<8,8,0x10>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>, InRaw<4,4,0xC>', '(unsigned long,int,int,int,int)'), + ('nn::visrv::sf::ISystemDisplayService', 2201, 'SetLayerPosition', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(unsigned long,float,float)'), + ('nn::visrv::sf::ISystemDisplayService', 2203, 'SetLayerSize', '0x18 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>, InRaw<8,8,0x10>', '(unsigned long,long,long)'), + ('nn::visrv::sf::ISystemDisplayService', 2204, 'GetLayerZ', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 2205, 'SetLayerZ', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>', '(unsigned long,long)'), + ('nn::visrv::sf::ISystemDisplayService', 2207, 'SetLayerVisibility', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(unsigned long,bool)'), + ('nn::visrv::sf::ISystemDisplayService', 2209, 'SetLayerAlpha', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,float)'), + ('nn::visrv::sf::ISystemDisplayService', 2312, 'CreateStrayLayer', '0x10 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>, Buffer<0,6,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::OutBuffer const&,unsigned long,unsigned int)'), + ('nn::visrv::sf::ISystemDisplayService', 2400, 'OpenIndirectLayer', '0x10 bytes in - 8 bytes out - takes pid - OutRaw<8,8,0>, Buffer<0,6,0>, InRaw<8,8,0>, InRaw<8,8,8>', '(nn::sf::Out,nn::sf::OutBuffer const&,unsigned long,nn::applet::AppletResourceUserId)'), + ('nn::visrv::sf::ISystemDisplayService', 2401, 'CloseIndirectLayer', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 2402, 'FlipIndirectLayer', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3000, 'ListDisplayModes', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::OutArray const&,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3001, 'ListDisplayRgbRanges', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::OutArray const&,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3002, 'ListDisplayContentTypes', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,6,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::OutArray const&,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3200, 'GetDisplayMode', '8 bytes in - 0x10 bytes out - OutRaw<0x10,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3201, 'SetDisplayMode', '0x18 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<0x10,4,8>', '(unsigned long,nn::vi::DisplayModeInfo const&)'), + ('nn::visrv::sf::ISystemDisplayService', 3202, 'GetDisplayUnderscan', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3203, 'SetDisplayUnderscan', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>', '(unsigned long,long)'), + ('nn::visrv::sf::ISystemDisplayService', 3204, 'GetDisplayContentType', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3205, 'SetDisplayContentType', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::ISystemDisplayService', 3206, 'GetDisplayRgbRange', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3207, 'SetDisplayRgbRange', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::ISystemDisplayService', 3208, 'GetDisplayCmuMode', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3209, 'SetDisplayCmuMode', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::ISystemDisplayService', 3210, 'GetDisplayContrastRatio', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3211, 'SetDisplayContrastRatio', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,float)'), + ('nn::visrv::sf::ISystemDisplayService', 3214, 'GetDisplayGamma', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3215, 'SetDisplayGamma', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,float)'), + ('nn::visrv::sf::ISystemDisplayService', 3216, 'GetDisplayCmuLuma', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::ISystemDisplayService', 3217, 'SetDisplayCmuLuma', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,float)'), + ('nn::visrv::sf::IManagerDisplayService', 1102, 'GetDisplayResolution', '8 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2010, 'CreateManagedLayer', '0x18 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,8>, InRaw<4,4,0>, InRaw<8,8,0x10>', '(nn::sf::Out,unsigned long,unsigned int,nn::applet::AppletResourceUserId)'), + ('nn::visrv::sf::IManagerDisplayService', 2011, 'DestroyManagedLayer', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2050, 'CreateIndirectLayer', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::visrv::sf::IManagerDisplayService', 2051, 'DestroyIndirectLayer', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2052, 'CreateIndirectProducerEndPoint', '0x10 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>, InRaw<8,8,8>', '(nn::sf::Out,unsigned long,nn::applet::AppletResourceUserId)'), + ('nn::visrv::sf::IManagerDisplayService', 2053, 'DestroyIndirectProducerEndPoint', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2054, 'CreateIndirectConsumerEndPoint', '0x10 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>, InRaw<8,8,8>', '(nn::sf::Out,unsigned long,nn::applet::AppletResourceUserId)'), + ('nn::visrv::sf::IManagerDisplayService', 2055, 'DestroyIndirectConsumerEndPoint', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2300, 'AcquireLayerTexturePresentingEvent', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2301, 'ReleaseLayerTexturePresentingEvent', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2302, 'GetDisplayHotplugEvent', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 2402, 'GetDisplayHotplugState', '8 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::visrv::sf::IManagerDisplayService', 4201, 'SetDisplayAlpha', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,float)'), + ('nn::visrv::sf::IManagerDisplayService', 4203, 'SetDisplayLayerStack', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::IManagerDisplayService', 4205, 'SetDisplayPowerState', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::IManagerDisplayService', 6000, 'AddToLayerStack', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::IManagerDisplayService', 6001, 'RemoveFromLayerStack', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<4,4,0>', '(unsigned long,unsigned int)'), + ('nn::visrv::sf::IManagerDisplayService', 6002, 'SetLayerVisibility', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(unsigned long,bool)'), + ('nn::visrv::sf::IManagerDisplayService', 7000, 'SetContentVisibility', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::visrv::sf::IManagerDisplayService', 8000, 'SetConductorLayer', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(unsigned long,bool)'), + ('nn::visrv::sf::IManagerDisplayService', 8100, 'SetIndirectProducerFlipOffset', '0x18 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>, InRaw<8,8,0x10>', '(unsigned long,unsigned long,nn::TimeSpan)'), + ('nn::visrv::sf::ISystemRootService', 1, 'GetDisplayService', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,unsigned int)'), + ('nn::visrv::sf::ISystemRootService', 3, 'GetDisplayServiceWithProxyNameExchange', '0xC bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,8>, InRaw<8,1,0>', '(nn::sf::Out,void>,unsigned int,nn::vi::ProxyName)'), + ('nn::visrv::sf::IApplicationRootService', 0, 'GetDisplayService', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', '(nn::sf::Out,void>,unsigned int)'), + ('nn::hid::IHidDebugServer', 0, 'DeactivateDebugPad', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 1, 'SetDebugPadAutoPilotState', '0x18 bytes in - 0 bytes out - InRaw<0x18,4,0>', '(nn::hid::debug::DebugPadAutoPilotState const&)'), + ('nn::hid::IHidDebugServer', 2, 'UnsetDebugPadAutoPilotState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 10, 'DeactivateTouchScreen', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 11, 'SetTouchScreenAutoPilotState', '0 bytes in - 0 bytes out - Buffer<0,5,0>', '(nn::sf::InArray const&)'), + ('nn::hid::IHidDebugServer', 12, 'UnsetTouchScreenAutoPilotState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 20, 'DeactivateMouse', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 21, 'SetMouseAutoPilotState', '0x1C bytes in - 0 bytes out - InRaw<0x1C,4,0>', '(nn::hid::debug::MouseAutoPilotState const&)'), + ('nn::hid::IHidDebugServer', 22, 'UnsetMouseAutoPilotState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 30, 'DeactivateKeyboard', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 31, 'SetKeyboardAutoPilotState', '0x28 bytes in - 0 bytes out - InRaw<0x28,8,0>', '(nn::hid::debug::KeyboardAutoPilotState const&)'), + ('nn::hid::IHidDebugServer', 32, 'UnsetKeyboardAutoPilotState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 50, 'DeactivateXpad', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::BasicXpadId)'), + ('nn::hid::IHidDebugServer', 51, 'SetXpadAutoPilotState', '0x20 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<0x1C,4,4>', '(nn::hid::BasicXpadId,nn::hid::debug::BasicXpadAutoPilotState const&)'), + ('nn::hid::IHidDebugServer', 52, 'UnsetXpadAutoPilotState', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::BasicXpadId)'), + ('nn::hid::IHidDebugServer', 60, 'DeactivateJoyXpad', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::JoyXpadId)'), + ('nn::hid::IHidDebugServer', 91, 'DeactivateGesture', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 110, 'DeactivateHomeButton', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 111, 'SetHomeButtonAutoPilotState', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::hid::debug::HomeButtonAutoPilotState)'), + ('nn::hid::IHidDebugServer', 112, 'UnsetHomeButtonAutoPilotState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 120, 'DeactivateSleepButton', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 121, 'SetSleepButtonAutoPilotState', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::hid::debug::SleepButtonAutoPilotState)'), + ('nn::hid::IHidDebugServer', 122, 'UnsetSleepButtonAutoPilotState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 123, 'DeactivateInputDetector', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 130, 'DeactivateCaptureButton', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 131, 'SetCaptureButtonAutoPilotState', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::hid::debug::CaptureButtonAutoPilotState)'), + ('nn::hid::IHidDebugServer', 132, 'UnsetCaptureButtonAutoPilotState', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 133, 'SetShiftAccelerometerCalibrationValue', '0x18 bytes in - 0 bytes out - takes pid - InRaw<4,4,0>, InRaw<8,8,0x10>, InRaw<4,4,4>, InRaw<4,4,8>', '(nn::hid::SixAxisSensorHandle,nn::applet::AppletResourceUserId,float,float)'), + ('nn::hid::IHidDebugServer', 134, 'GetShiftAccelerometerCalibrationValue', '0x10 bytes in - 8 bytes out - takes pid - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<8,8,8>', '(nn::sf::Out,nn::sf::Out,nn::hid::SixAxisSensorHandle,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidDebugServer', 135, 'SetShiftGyroscopeCalibrationValue', '0x18 bytes in - 0 bytes out - takes pid - InRaw<4,4,0>, InRaw<8,8,0x10>, InRaw<4,4,4>, InRaw<4,4,8>', '(nn::hid::SixAxisSensorHandle,nn::applet::AppletResourceUserId,float,float)'), + ('nn::hid::IHidDebugServer', 136, 'GetShiftGyroscopeCalibrationValue', '0x10 bytes in - 8 bytes out - takes pid - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<8,8,8>', '(nn::sf::Out,nn::sf::Out,nn::hid::SixAxisSensorHandle,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidDebugServer', 140, 'DeactivateConsoleSixAxisSensor', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 201, 'ActivateFirmwareUpdate', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 202, 'DeactivateFirmwareUpdate', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 203, 'StartFirmwareUpdate', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::hid::system::UniquePadId)'), + ('nn::hid::IHidDebugServer', 204, 'GetFirmwareUpdateStage', '0 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>', '(nn::sf::Out,nn::sf::Out)'), + ('nn::hid::IHidDebugServer', 205, 'GetFirmwareVersion', '8 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::Out,unsigned int,nn::util::BitFlagSet<32,nn::hid::system::DeviceType>)'), + ('nn::hid::IHidDebugServer', 206, 'GetDestinationFirmwareVersion', '8 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::Out,unsigned int,nn::util::BitFlagSet<32,nn::hid::system::DeviceType>)'), + ('nn::hid::IHidDebugServer', 207, 'DiscardFirmwareInfoCacheForRevert', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidDebugServer', 208, 'StartFirmwareUpdateForRevert', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::hid::system::UniquePadId)'), + ('nn::hid::IHidDebugServer', 209, 'GetAvailableFirmwareVersionForRevert', '8 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidDebugServer', 221, 'UpdateControllerColor', '0x10 bytes in - 0 bytes out - InRaw<4,1,0>, InRaw<4,1,4>, InRaw<8,8,8>', '(nn::util::Unorm8x4,nn::util::Unorm8x4,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidServer', 0, 'CreateAppletResource', '8 bytes in - 0 bytes out - takes pid - OutObject<0,0>, InRaw<8,8,0>', '(nn::sf::Out,void>,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 1, 'ActivateDebugPad', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 11, 'ActivateTouchScreen', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 21, 'ActivateMouse', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 31, 'ActivateKeyboard', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 40, 'AcquireXpadIdEventHandle', '8 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,unsigned long)'), + ('nn::hid::IHidServer', 41, 'ReleaseXpadIdEventHandle', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(unsigned long)'), + ('nn::hid::IHidServer', 51, 'ActivateXpad', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::BasicXpadId)'), + ('nn::hid::IHidServer', 55, 'GetXpadIds', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::hid::IHidServer', 56, 'ActivateJoyXpad', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::JoyXpadId)'), + ('nn::hid::IHidServer', 58, 'GetJoyXpadLifoHandle', '4 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,nn::hid::JoyXpadId)'), + ('nn::hid::IHidServer', 59, 'GetJoyXpadIds', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::hid::IHidServer', 60, 'ActivateSixAxisSensor', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::BasicXpadId)'), + ('nn::hid::IHidServer', 61, 'DeactivateSixAxisSensor', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::BasicXpadId)'), + ('nn::hid::IHidServer', 62, 'GetSixAxisSensorLifoHandle', '4 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,nn::hid::BasicXpadId)'), + ('nn::hid::IHidServer', 63, 'ActivateJoySixAxisSensor', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::JoyXpadId)'), + ('nn::hid::IHidServer', 64, 'DeactivateJoySixAxisSensor', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::JoyXpadId)'), + ('nn::hid::IHidServer', 65, 'GetJoySixAxisSensorLifoHandle', '4 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,nn::hid::JoyXpadId)'), + ('nn::hid::IHidServer', 66, 'StartSixAxisSensor', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 67, 'StopSixAxisSensor', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 68, 'IsSixAxisSensorFusionEnabled', '0x10 bytes in - 1 bytes out - takes pid - OutRaw<1,1,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 69, 'EnableSixAxisSensorFusion', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,4>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle,bool)'), + ('nn::hid::IHidServer', 70, 'SetSixAxisSensorFusionParameters', '0x18 bytes in - 0 bytes out - takes pid - InRaw<8,8,0x10>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle,float,float)'), + ('nn::hid::IHidServer', 71, 'GetSixAxisSensorFusionParameters', '0x10 bytes in - 8 bytes out - takes pid - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 72, 'ResetSixAxisSensorFusionParameters', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 73, 'SetAccelerometerParameters', '0x18 bytes in - 0 bytes out - takes pid - InRaw<8,8,0x10>, InRaw<4,4,0>, InRaw<4,4,4>, InRaw<4,4,8>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle,float,float)'), + ('nn::hid::IHidServer', 74, 'GetAccelerometerParameters', '0x10 bytes in - 8 bytes out - takes pid - OutRaw<4,4,0>, OutRaw<4,4,4>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 75, 'ResetAccelerometerParameters', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 76, 'SetAccelerometerPlayMode', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle,unsigned int)'), + ('nn::hid::IHidServer', 77, 'GetAccelerometerPlayMode', '0x10 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 78, 'ResetAccelerometerPlayMode', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 79, 'SetGyroscopeZeroDriftMode', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle,unsigned int)'), + ('nn::hid::IHidServer', 80, 'GetGyroscopeZeroDriftMode', '0x10 bytes in - 4 bytes out - takes pid - OutRaw<4,4,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 81, 'ResetGyroscopeZeroDriftMode', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 82, 'IsSixAxisSensorAtRest', '0x10 bytes in - 1 bytes out - takes pid - OutRaw<1,1,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::SixAxisSensorHandle)'), + ('nn::hid::IHidServer', 91, 'ActivateGesture', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,int)'), + ('nn::hid::IHidServer', 100, 'SetSupportedNpadStyleSet', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::util::BitFlagSet<32,nn::hid::NpadStyleTag>)'), + ('nn::hid::IHidServer', 101, 'GetSupportedNpadStyleSet', '8 bytes in - 4 bytes out - takes pid - InRaw<8,8,0>, OutRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::sf::Out,void>)'), + ('nn::hid::IHidServer', 102, 'SetSupportedNpadIdType', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, Buffer<0,9,0>', '(nn::applet::AppletResourceUserId,nn::sf::InArray const&)'), + ('nn::hid::IHidServer', 103, 'ActivateNpad', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 104, 'DeactivateNpad', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 106, 'AcquireNpadStyleSetUpdateEventHandle', '0x18 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, OutHandle<0,1>, InRaw<4,4,0>, InRaw<8,8,0x10>', '(nn::applet::AppletResourceUserId,nn::sf::Out,unsigned int,unsigned long)'), + ('nn::hid::IHidServer', 107, 'DisconnectNpad', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,unsigned int)'), + ('nn::hid::IHidServer', 108, 'GetPlayerLedPattern', '4 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<4,4,0>', '(nn::sf::Out,unsigned int)'), + ('nn::hid::IHidServer', 120, 'SetNpadJoyHoldType', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::applet::AppletResourceUserId,long)'), + ('nn::hid::IHidServer', 121, 'GetNpadJoyHoldType', '8 bytes in - 8 bytes out - takes pid - InRaw<8,8,0>, OutRaw<8,8,0>', '(nn::applet::AppletResourceUserId,nn::sf::Out)'), + ('nn::hid::IHidServer', 122, 'SetNpadJoyAssignmentModeSingleByDefault', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,unsigned int)'), + ('nn::hid::IHidServer', 123, 'SetNpadJoyAssignmentModeSingle', '0x18 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<8,8,0x10>', '(nn::applet::AppletResourceUserId,unsigned int,long)'), + ('nn::hid::IHidServer', 124, 'SetNpadJoyAssignmentModeDual', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,unsigned int)'), + ('nn::hid::IHidServer', 125, 'MergeSingleJoyAsDualJoy', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::applet::AppletResourceUserId,unsigned int,unsigned int)'), + ('nn::hid::IHidServer', 126, 'StartLrAssignmentMode', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 127, 'StopLrAssignmentMode', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 128, 'SetNpadHandheldActivationMode', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::applet::AppletResourceUserId,long)'), + ('nn::hid::IHidServer', 129, 'GetNpadHandheldActivationMode', '8 bytes in - 8 bytes out - takes pid - InRaw<8,8,0>, OutRaw<8,8,0>', '(nn::applet::AppletResourceUserId,nn::sf::Out)'), + ('nn::hid::IHidServer', 130, 'SwapNpadAssignment', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::applet::AppletResourceUserId,unsigned int,unsigned int)'), + ('nn::hid::IHidServer', 131, 'IsUnintendedHomeButtonInputProtectionEnabled', '0x10 bytes in - 1 bytes out - takes pid - OutRaw<1,1,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId,unsigned int)'), + ('nn::hid::IHidServer', 132, 'EnableUnintendedHomeButtonInputProtection', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,4>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,unsigned int,bool)'), + ('nn::hid::IHidServer', 200, 'GetVibrationDeviceInfo', '4 bytes in - 8 bytes out - OutRaw<8,4,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::hid::VibrationDeviceHandle)'), + ('nn::hid::IHidServer', 201, 'SendVibrationValue', '0x20 bytes in - 0 bytes out - takes pid - InRaw<8,8,0x18>, InRaw<4,4,0>, InRaw<0x10,4,4>', '(nn::applet::AppletResourceUserId,nn::hid::VibrationDeviceHandle,nn::hid::VibrationValue const&)'), + ('nn::hid::IHidServer', 202, 'GetActualVibrationValue', '0x10 bytes in - 0x10 bytes out - takes pid - OutRaw<0x10,4,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::VibrationDeviceHandle)'), + ('nn::hid::IHidServer', 203, 'CreateActiveVibrationDeviceList', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::hid::IHidServer', 204, 'PermitVibration', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::hid::IHidServer', 205, 'IsVibrationPermitted', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::hid::IHidServer', 206, 'SendVibrationValues', '8 bytes in - 0 bytes out - InRaw<8,8,0>, Buffer<0,9,0>, Buffer<1,9,0>', '(nn::applet::AppletResourceUserId,nn::sf::InArray const&,nn::sf::InArray const&)'), + ('nn::hid::IHidServer', 300, 'ActivateConsoleSixAxisSensor', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidServer', 301, 'StartConsoleSixAxisSensor', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::ConsoleSixAxisSensorHandle)'), + ('nn::hid::IHidServer', 302, 'StopConsoleSixAxisSensor', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::hid::ConsoleSixAxisSensorHandle)'), + ('nn::hid::IHidServer', 400, 'IsUsbFullKeyControllerEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::hid::IHidServer', 401, 'EnableUsbFullKeyController', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::hid::IHidServer', 402, 'IsUsbFullKeyControllerConnected', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', '(nn::sf::Out,unsigned int)'), + ('nn::hid::IHidServer', 1000, 'SetNpadCommunicationMode', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::applet::AppletResourceUserId,long)'), + ('nn::hid::IHidServer', 1001, 'GetNpadCommunicationMode', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::hid::IAppletResource', 0, 'GetSharedMemoryHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::hid::IActiveVibrationDeviceList', 0, 'ActivateVibrationDevice', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::VibrationDeviceHandle)'), + ('nn::hid::IHidSystemServer', 31, 'SendKeyboardLockKeyEvent', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::util::BitFlagSet<32,nn::hid::system::KeyboardLockKeyEvent>)'), + ('nn::hid::IHidSystemServer', 101, 'AcquireHomeButtonEventHandle', '8 bytes in - 0 bytes out - takes pid - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 111, 'ActivateHomeButton', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 121, 'AcquireSleepButtonEventHandle', '8 bytes in - 0 bytes out - takes pid - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 131, 'ActivateSleepButton', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 141, 'AcquireCaptureButtonEventHandle', '8 bytes in - 0 bytes out - takes pid - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 151, 'ActivateCaptureButton', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 210, 'AcquireNfcDeviceUpdateEventHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 211, 'GetNpadsWithNfc', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::hid::IHidSystemServer', 212, 'AcquireNfcActivateEventHandle', '4 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,unsigned int)'), + ('nn::hid::IHidSystemServer', 213, 'ActivateNfc', '0x10 bytes in - 0 bytes out - takes pid - InRaw<4,4,4>, InRaw<1,1,0>, InRaw<8,8,8>', '(unsigned int,bool,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 230, 'AcquireIrSensorEventHandle', '4 bytes in - 0 bytes out - OutHandle<0,1>, InRaw<4,4,0>', '(nn::sf::Out,unsigned int)'), + ('nn::hid::IHidSystemServer', 231, 'ActivateIrSensor', '0x10 bytes in - 0 bytes out - takes pid - InRaw<4,4,4>, InRaw<1,1,0>, InRaw<8,8,8>', '(unsigned int,bool,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 301, 'ActivateNpadSystem', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(unsigned int)'), + ('nn::hid::IHidSystemServer', 303, 'ApplyNpadSystemCommonPolicy', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 304, 'EnableAssigningSingleOnSlSrPress', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 305, 'DisableAssigningSingleOnSlSrPress', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 306, 'GetLastActiveNpad', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 307, 'GetNpadSystemExtStyle', '4 bytes in - 0x10 bytes out - OutRaw<8,8,0>, OutRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,unsigned int)'), + ('nn::hid::IHidSystemServer', 311, 'SetNpadPlayerLedBlinkingDevice', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::applet::AppletResourceUserId,unsigned int,nn::util::BitFlagSet<32,nn::hid::system::DeviceType>)'), + ('nn::hid::IHidSystemServer', 321, 'GetUniquePadsFromNpad', '4 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::OutArray const&,unsigned int)'), + ('nn::hid::IHidSystemServer', 322, 'GetIrSensorState', '0x10 bytes in - 8 bytes out - takes pid - InRaw<4,4,0>, OutRaw<8,8,0>, InRaw<8,8,8>', '(unsigned int,nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 323, 'GetXcdHandleForNpadWithIrSensor', '0x10 bytes in - 8 bytes out - takes pid - InRaw<4,4,0>, OutRaw<8,8,0>, InRaw<8,8,8>', '(unsigned int,nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 500, 'SetAppletResourceUserId', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 501, 'RegisterAppletResourceUserId', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,bool)'), + ('nn::hid::IHidSystemServer', 502, 'UnregisterAppletResourceUserId', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 503, 'EnableAppletToGetInput', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,bool)'), + ('nn::hid::IHidSystemServer', 504, 'SetAruidValidForVibration', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,bool)'), + ('nn::hid::IHidSystemServer', 505, 'EnableAppletToGetSixAxisSensor', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,bool)'), + ('nn::hid::IHidSystemServer', 510, 'SetVibrationMasterVolume', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(float)'), + ('nn::hid::IHidSystemServer', 511, 'GetVibrationMasterVolume', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 512, 'BeginPermitVibrationSession', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 513, 'EndPermitVibrationSession', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidSystemServer', 520, 'EnableHandheldHids', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidSystemServer', 521, 'DisableHandheldHids', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidSystemServer', 540, 'AcquirePlayReportControllerUsageUpdateEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 541, 'GetPlayReportControllerUsages', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::hid::IHidSystemServer', 542, 'AcquirePlayReportRegisteredDeviceUpdateEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 543, 'GetRegisteredDevices', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::hid::IHidSystemServer', 544, 'AcquireConnectionTriggerTimeoutEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 545, 'SendConnectionTrigger', '6 bytes in - 0 bytes out - InRaw<6,1,0>', '(nn::bluetooth::Address)'), + ('nn::hid::IHidSystemServer', 546, 'AcquireDeviceRegisteredEventForControllerSupport', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 547, 'GetAllowedBluetoothLinksCount', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 700, 'ActivateUniquePad', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::applet::AppletResourceUserId,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 702, 'AcquireUniquePadConnectionEventHandle', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 703, 'GetUniquePadIds', '0 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>', '(nn::sf::Out,nn::sf::OutArray const&)'), + ('nn::hid::IHidSystemServer', 751, 'AcquireJoyDetachOnBluetoothOffEventHandle', '8 bytes in - 0 bytes out - takes pid - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 800, 'ListSixAxisSensorHandles', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, Buffer<0,0xA,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::OutArray const&,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 801, 'IsSixAxisSensorUserCalibrationSupported', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', '(nn::sf::Out,nn::hid::system::UniqueSixAxisSensorHandle)'), + ('nn::hid::IHidSystemServer', 802, 'ResetSixAxisSensorCalibrationValues', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::system::UniqueSixAxisSensorHandle)'), + ('nn::hid::IHidSystemServer', 803, 'StartSixAxisSensorUserCalibration', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::system::UniqueSixAxisSensorHandle)'), + ('nn::hid::IHidSystemServer', 804, 'CancelSixAxisSensorUserCalibration', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::hid::system::UniqueSixAxisSensorHandle)'), + ('nn::hid::IHidSystemServer', 805, 'GetUniquePadBluetoothAddress', '8 bytes in - 6 bytes out - OutRaw<6,1,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 806, 'DisconnectUniquePad', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 821, 'StartAnalogStickManualCalibration', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::hid::system::UniquePadId,long)'), + ('nn::hid::IHidSystemServer', 822, 'RetryCurrentAnalogStickManualCalibrationStage', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::hid::system::UniquePadId,long)'), + ('nn::hid::IHidSystemServer', 823, 'CancelAnalogStickManualCalibration', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::hid::system::UniquePadId,long)'), + ('nn::hid::IHidSystemServer', 824, 'ResetAnalogStickManualCalibration', '0x10 bytes in - 0 bytes out - InRaw<8,8,0>, InRaw<8,8,8>', '(nn::hid::system::UniquePadId,long)'), + ('nn::hid::IHidSystemServer', 850, 'IsUsbFullKeyControllerEnabled', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::hid::IHidSystemServer', 851, 'EnableUsbFullKeyController', '1 bytes in - 0 bytes out - InRaw<1,1,0>', '(bool)'), + ('nn::hid::IHidSystemServer', 852, 'IsUsbConnected', '8 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 900, 'ActivateInputDetector', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::hid::IHidSystemServer', 901, 'NotifyInputDetector', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::util::BitFlagSet<32,nn::hid::system::InputSourceId>)'), + ('nn::hid::IHidSystemServer', 1000, 'InitializeFirmwareUpdate', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidSystemServer', 1001, 'GetFirmwareVersion', '8 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 1002, 'GetAvailableFirmwareVersion', '8 bytes in - 0x10 bytes out - OutRaw<0x10,1,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 1003, 'IsFirmwareUpdateAvailable', '8 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 1004, 'CheckFirmwareUpdateRequired', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 1005, 'StartFirmwareUpdate', '8 bytes in - 8 bytes out - OutRaw<8,8,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::UniquePadId)'), + ('nn::hid::IHidSystemServer', 1006, 'AbortFirmwareUpdate', '0 bytes in - 0 bytes out', '(void)'), + ('nn::hid::IHidSystemServer', 1007, 'GetFirmwareUpdateState', '8 bytes in - 4 bytes out - OutRaw<4,1,0>, InRaw<8,8,0>', '(nn::sf::Out,nn::hid::system::FirmwareUpdateDeviceHandle)'), + ('nn::hid::IHidTemporaryServer', 0, 'GetConsoleSixAxisSensorCalibrationValues', '0x10 bytes in - 0x18 bytes out - takes pid - OutRaw<0x18,2,0>, InRaw<8,8,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId,nn::hid::ConsoleSixAxisSensorHandle)'), + ('nn::irsensor::IIrSensorServer', 302, 'ActivateIrsensor', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::irsensor::IIrSensorServer', 303, 'DeactivateIrsensor', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::irsensor::IIrSensorServer', 304, 'GetIrsensorSharedMemoryHandle', '8 bytes in - 0 bytes out - takes pid - OutHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,nn::applet::AppletResourceUserId)'), + ('nn::irsensor::IIrSensorServer', 305, 'StopImageProcessor', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle)'), + ('nn::irsensor::IIrSensorServer', 306, 'RunMomentProcessor', '0x30 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<0x20,8,0x10>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle,nn::irsensor::PackedMomentProcessorConfig const&)'), + ('nn::irsensor::IIrSensorServer', 307, 'RunClusteringProcessor', '0x38 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<0x28,8,0x10>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle,nn::irsensor::PackedClusteringProcessorConfig const&)'), + ('nn::irsensor::IIrSensorServer', 308, 'RunImageTransferProcessor', '0x30 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<0x18,8,0x10>, InHandle<0,1>, InRaw<8,8,0x28>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle,nn::irsensor::PackedImageTransferProcessorConfig const&,nn::sf::NativeHandle &&,unsigned long)'), + ('nn::irsensor::IIrSensorServer', 309, 'GetImageTransferProcessorState', '0x10 bytes in - 0x10 bytes out - takes pid - InRaw<8,8,8>, OutRaw<0x10,8,0>, Buffer<0,6,0>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::sf::Out,nn::sf::OutBuffer const&,nn::irsensor::IrCameraHandle)'), + ('nn::irsensor::IIrSensorServer', 310, 'RunTeraPluginProcessor', '0x18 bytes in - 0 bytes out - takes pid - InRaw<8,8,0x10>, InRaw<4,4,0>, InRaw<8,2,4>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle,nn::irsensor::PackedTeraPluginProcessorConfig)'), + ('nn::irsensor::IIrSensorServer', 311, 'GetNpadIrCameraHandle', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::Out,unsigned int)'), + ('nn::irsensor::IIrSensorServer', 312, 'RunDpdProcessor', '0x18 bytes in - 0 bytes out - takes pid - InRaw<8,8,0x10>, InRaw<4,4,0>, InRaw<0xC,2,4>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle,nn::irsensor::PackedDpdProcessorConfig const&)'), + ('nn::irsensor::IIrSensorServer', 313, 'SuspendImageProcessor', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle)'), + ('nn::irsensor::IIrSensorServer', 314, 'CheckFirmwareVersion', '0x10 bytes in - 0 bytes out - takes pid - InRaw<8,8,8>, InRaw<4,4,0>, InRaw<4,2,4>', '(nn::applet::AppletResourceUserId,nn::irsensor::IrCameraHandle,nn::irsensor::PackedMcuVersion)'), + ('nn::irsensor::IIrSensorSystemServer', 500, 'SetAppletResourceUserId', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::irsensor::IIrSensorSystemServer', 501, 'RegisterAppletResourceUserId', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,bool)'), + ('nn::irsensor::IIrSensorSystemServer', 502, 'UnregisterAppletResourceUserId', '8 bytes in - 0 bytes out - InRaw<8,8,0>', '(nn::applet::AppletResourceUserId)'), + ('nn::irsensor::IIrSensorSystemServer', 503, 'EnableAppletToGetInput', '0x10 bytes in - 0 bytes out - InRaw<8,8,8>, InRaw<1,1,0>', '(nn::applet::AppletResourceUserId,bool)'), + ('nn::capsrv::sf::IScreenShotApplicationService', 201, 'SaveScreenShot', '0x10 bytes in - 0x20 bytes out - takes pid - OutRaw<0x20,1,0>, Buffer<0,0x45,0>, InRaw<4,4,0>, InRaw<8,8,8>, InRaw<4,4,4>', '(nn::sf::Out,nn::sf::InBuffer const&,unsigned int,nn::applet::AppletResourceUserId,unsigned int)'), + ('nn::capsrv::sf::IScreenShotApplicationService', 203, 'SaveScreenShotEx0', '0x50 bytes in - 0x20 bytes out - takes pid - OutRaw<0x20,1,0>, Buffer<0,0x45,0>, InRaw<0x40,4,0>, InRaw<8,8,0x48>, InRaw<4,4,0x40>', '(nn::sf::Out,nn::sf::InBuffer const&,nn::capsrv::detail::ScreenShotAttributeEx0 const&,nn::applet::AppletResourceUserId,unsigned int)'), + ('nn::ldn::detail::IUserServiceCreator', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 1, '', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x480>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 2, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 3, '', '0 bytes in - 2 bytes out - OutRaw<2,2,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 4, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 5, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 100, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 101, '', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x480>, Buffer<1,0xA,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 102, '', '0x68 bytes in - 2 bytes out - Buffer<0,0x22,0>, OutRaw<2,2,0>, InRaw<0x60,8,8>, InRaw<2,2,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 103, '', '0x68 bytes in - 2 bytes out - Buffer<0,0x22,0>, OutRaw<2,2,0>, InRaw<0x60,8,8>, InRaw<2,2,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 200, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 201, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 202, '', '0x98 bytes in - 0 bytes out - InRaw<0x20,8,0x78>, InRaw<0x44,2,0>, InRaw<0x30,1,0x44>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 203, '', '0xB8 bytes in - 0 bytes out - InRaw<0x20,8,0x98>, InRaw<0x44,2,0>, InRaw<0x20,1,0x44>, InRaw<0x30,1,0x64>, Buffer<0,9,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 204, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 205, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 206, '', '0 bytes in - 0 bytes out - Buffer<0,0x21,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 207, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 208, '', '6 bytes in - 0 bytes out - InRaw<6,1,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 209, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 300, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 301, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 302, '', '0x7C bytes in - 0 bytes out - Buffer<0,0x19,0x480>, InRaw<0x44,2,0>, InRaw<0x30,1,0x44>, InRaw<4,4,0x74>, InRaw<4,4,0x78>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 303, '', '0xC0 bytes in - 0 bytes out - InRaw<0x20,8,0xA0>, InRaw<0x44,2,0>, InRaw<0x20,1,0x44>, InRaw<0x30,1,0x64>, InRaw<4,4,0x94>, InRaw<4,4,0x98>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 304, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 400, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::ldn::detail::IUserLocalCommunicationService', 401, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IMonitorServiceCreator', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::ldn::detail::IMonitorService', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::ldn::detail::IMonitorService', 1, '', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x480>', ''), + ('nn::ldn::detail::IMonitorService', 2, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::ldn::detail::IMonitorService', 3, '', '0 bytes in - 2 bytes out - OutRaw<2,2,0>', ''), + ('nn::ldn::detail::IMonitorService', 4, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', ''), + ('nn::ldn::detail::IMonitorService', 5, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>', ''), + ('nn::ldn::detail::IMonitorService', 100, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::IMonitorService', 101, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemServiceCreator', 0, '', '0 bytes in - 0 bytes out - OutObject<0,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 0, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 1, '', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x480>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 2, '', '0 bytes in - 8 bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 3, '', '0 bytes in - 2 bytes out - OutRaw<2,2,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 4, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,1,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 5, '', '0 bytes in - 0x20 bytes out - OutRaw<0x20,8,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 100, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 101, '', '0 bytes in - 0 bytes out - Buffer<0,0x1A,0x480>, Buffer<1,0xA,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 102, '', '0x68 bytes in - 2 bytes out - Buffer<0,0x22,0>, OutRaw<2,2,0>, InRaw<0x60,8,8>, InRaw<2,2,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 103, '', '0x68 bytes in - 2 bytes out - Buffer<0,0x22,0>, OutRaw<2,2,0>, InRaw<0x60,8,8>, InRaw<2,2,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 200, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 201, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 202, '', '0x98 bytes in - 0 bytes out - InRaw<0x20,8,0x78>, InRaw<0x44,2,0>, InRaw<0x30,1,0x44>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 203, '', '0xB8 bytes in - 0 bytes out - InRaw<0x20,8,0x98>, InRaw<0x44,2,0>, InRaw<0x20,1,0x44>, InRaw<0x30,1,0x64>, Buffer<0,9,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 204, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 205, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 206, '', '0 bytes in - 0 bytes out - Buffer<0,0x21,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 207, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 208, '', '6 bytes in - 0 bytes out - InRaw<6,1,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 209, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 300, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 301, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 302, '', '0x7C bytes in - 0 bytes out - Buffer<0,0x19,0x480>, InRaw<0x44,2,0>, InRaw<0x30,1,0x44>, InRaw<4,4,0x74>, InRaw<4,4,0x78>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 303, '', '0xC0 bytes in - 0 bytes out - InRaw<0x20,8,0xA0>, InRaw<0x44,2,0>, InRaw<0x20,1,0x44>, InRaw<0x30,1,0x64>, InRaw<4,4,0x94>, InRaw<4,4,0x98>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 304, '', '0 bytes in - 0 bytes out', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 400, '', '8 bytes in - 0 bytes out - takes pid - InRaw<8,8,0>', ''), + ('nn::ldn::detail::ISystemLocalCommunicationService', 401, '', '0 bytes in - 0 bytes out', ''), + ('nn::fgm::sf::ISession', 0, 'Initialize', '0 bytes in - 0 bytes out - OutObject<0,0>', '(nn::sf::Out,void>)'), + ('nn::fgm::sf::IRequest', 0, 'Initialize', '0x10 bytes in - 0 bytes out - takes pid - OutHandle<0,1>, InRaw<4,4,0>, InRaw<8,8,8>', '(nn::sf::Out,nn::fgm::Module,unsigned long)'), + ('nn::fgm::sf::IRequest', 1, 'Set', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(unsigned int,unsigned int)'), + ('nn::fgm::sf::IRequest', 2, 'Get', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::fgm::sf::IRequest', 3, 'Cancel', '0 bytes in - 0 bytes out', '(void)'), + ('nn::fgm::sf::IDebugger', 0, 'Initialize', '8 bytes in - 0 bytes out - OutHandle<0,1>, InHandle<0,1>, InRaw<8,8,0>', '(nn::sf::Out,nn::sf::NativeHandle&&,unsigned long)'), + ('nn::fgm::sf::IDebugger', 1, 'Read', '0 bytes in - 0xC bytes out - Buffer<0,6,0>, OutRaw<4,4,0>, OutRaw<4,4,4>, OutRaw<4,4,8>', '(nn::sf::OutBuffer const&,nn::sf::Out,nn::sf::Out,nn::sf::Out)'), + ('nn::fgm::sf::IDebugger', 2, 'Cancel', '0 bytes in - 0 bytes out', '(void)'), + ('nn::gpio::IManager', 0, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::gpio::IManager', 1, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::gpio::IManager', 2, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::gpio::IManager', 3, '', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', ''), + ('nn::gpio::IManager', 4, '', '0 bytes in - 0x10 bytes out - OutRaw<0x10,8,0>', ''), + ('nn::gpio::IManager', 5, '', '8 bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>', ''), + ('nn::gpio::IManager', 6, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::gpio::IPadSession', 0, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 1, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 2, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 3, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 4, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::gpio::IPadSession', 5, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::gpio::IPadSession', 6, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 7, '', '0 bytes in - 0 bytes out', ''), + ('nn::gpio::IPadSession', 8, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 9, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 10, '', '0 bytes in - 0 bytes out - OutHandle<0,1>', ''), + ('nn::gpio::IPadSession', 11, '', '0 bytes in - 0 bytes out', ''), + ('nn::gpio::IPadSession', 12, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::gpio::IPadSession', 13, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::gpio::IPadSession', 14, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::gpio::IPadSession', 15, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::i2c::IManager', 0, '', '0x10 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,4>, InRaw<2,2,0>, InRaw<4,4,8>, InRaw<4,4,0xC>', ''), + ('nn::i2c::IManager', 1, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::i2c::IManager', 2, '', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', ''), + ('nn::i2c::IManager', 3, '', '0x10 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,4>, InRaw<2,2,0>, InRaw<4,4,8>, InRaw<4,4,0xC>', ''), + ('nn::i2c::ISession', 0, '', '4 bytes in - 0 bytes out - Buffer<0,5,0>, InRaw<4,4,0>', ''), + ('nn::i2c::ISession', 1, '', '4 bytes in - 0 bytes out - Buffer<0,6,0>, InRaw<4,4,0>', ''), + ('nn::i2c::ISession', 2, '', '0 bytes in - 0 bytes out - Buffer<0,6,0>, Buffer<1,9,0>', ''), + ('nn::i2c::ISession', 10, '', '4 bytes in - 0 bytes out - Buffer<0,0x21,0>, InRaw<4,4,0>', ''), + ('nn::i2c::ISession', 11, '', '4 bytes in - 0 bytes out - Buffer<0,0x22,0>, InRaw<4,4,0>', ''), + ('nn::i2c::ISession', 12, '', '0 bytes in - 0 bytes out - Buffer<0,0x22,0>, Buffer<1,9,0>', ''), + ('nn::pcv::detail::IPcvService', 0, 'SetPowerEnabled', '8 bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>', '(int,bool)'), + ('nn::pcv::detail::IPcvService', 1, 'SetClockEnabled', '8 bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>', '(int,bool)'), + ('nn::pcv::detail::IPcvService', 2, 'SetClockRate', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(int,unsigned int)'), + ('nn::pcv::detail::IPcvService', 3, 'GetClockRate', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 4, 'GetState', '4 bytes in - 0xC bytes out - OutRaw<0xC,4,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 5, 'GetPossibleClockRates', '8 bytes in - 8 bytes out - OutRaw<4,4,0>, Buffer<0,0xA,0>, OutRaw<4,4,4>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::Out,nn::sf::OutArray const&,nn::sf::Out,int,int)'), + ('nn::pcv::detail::IPcvService', 6, 'SetMinVClockRate', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(int,unsigned int)'), + ('nn::pcv::detail::IPcvService', 7, 'SetReset', '8 bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>', '(int,bool)'), + ('nn::pcv::detail::IPcvService', 8, 'SetVoltageEnabled', '8 bytes in - 0 bytes out - InRaw<4,4,4>, InRaw<1,1,0>', '(int,bool)'), + ('nn::pcv::detail::IPcvService', 9, 'GetVoltageEnabled', '4 bytes in - 1 bytes out - OutRaw<1,1,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 10, 'GetVoltageRange', '4 bytes in - 0xC bytes out - OutRaw<4,4,0>, OutRaw<4,4,4>, OutRaw<4,4,8>, InRaw<4,4,0>', '(nn::sf::Out,nn::sf::Out,nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 11, 'SetVoltageValue', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(int,int)'), + ('nn::pcv::detail::IPcvService', 12, 'GetVoltageValue', '4 bytes in - 4 bytes out - OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 13, 'GetTemperatureThresholds', '4 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::OutArray const&,nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 14, 'SetTemperature', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::pcv::detail::IPcvService', 15, 'Initialize', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pcv::detail::IPcvService', 16, 'IsInitialized', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', '(nn::sf::Out)'), + ('nn::pcv::detail::IPcvService', 17, 'Finalize', '0 bytes in - 0 bytes out', '(void)'), + ('nn::pcv::detail::IPcvService', 18, 'PowerOn', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(nn::pcv::PowerControlTarget,int)'), + ('nn::pcv::detail::IPcvService', 19, 'PowerOff', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(nn::pcv::PowerControlTarget)'), + ('nn::pcv::detail::IPcvService', 20, 'ChangeVoltage', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(nn::pcv::PowerControlTarget,int)'), + ('nn::pcv::detail::IPcvService', 21, 'GetPowerClockInfoEvent', '0 bytes in - 0 bytes out - OutHandle<0,1>', '(nn::sf::Out)'), + ('nn::pcv::detail::IPcvService', 22, 'GetOscillatorClock', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', '(nn::sf::Out)'), + ('nn::pcv::detail::IPcvService', 23, 'GetDvfsTable', '8 bytes in - 4 bytes out - Buffer<0,0xA,0>, Buffer<1,0xA,0>, OutRaw<4,4,0>, InRaw<4,4,0>, InRaw<4,4,4>', '(nn::sf::OutArray const&,nn::sf::OutArray const&,nn::sf::Out,int,int)'), + ('nn::pcv::detail::IPcvService', 24, 'GetModuleStateTable', '4 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::OutArray const&,nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 25, 'GetPowerDomainStateTable', '4 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::OutArray const&,nn::sf::Out,int)'), + ('nn::pcv::detail::IPcvService', 26, 'GetFuseInfo', '4 bytes in - 4 bytes out - Buffer<0,0xA,0>, OutRaw<4,4,0>, InRaw<4,4,0>', '(nn::sf::OutArray const&,nn::sf::Out,int)'), + ('nn::pcv::IImmediateManager', 0, 'SetClockRate', '8 bytes in - 0 bytes out - InRaw<4,4,0>, InRaw<4,4,4>', '(int,unsigned int)'), + ('nn::pcv::IArbitrationManager', 0, 'ReleaseControl', '4 bytes in - 0 bytes out - InRaw<4,4,0>', '(int)'), + ('nn::pwm::IManager', 0, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::pwm::IManager', 1, '', '4 bytes in - 0 bytes out - OutObject<0,0>, InRaw<4,4,0>', ''), + ('nn::pwm::IChannelSession', 0, '', '8 bytes in - 0 bytes out - InRaw<8,8,0>', ''), + ('nn::pwm::IChannelSession', 1, '', '0 bytes in - 8 bytes out - OutRaw<8,8,0>', ''), + ('nn::pwm::IChannelSession', 2, '', '4 bytes in - 0 bytes out - InRaw<4,4,0>', ''), + ('nn::pwm::IChannelSession', 3, '', '0 bytes in - 4 bytes out - OutRaw<4,4,0>', ''), + ('nn::pwm::IChannelSession', 4, '', '1 bytes in - 0 bytes out - InRaw<1,1,0>', ''), + ('nn::pwm::IChannelSession', 5, '', '0 bytes in - 1 bytes out - OutRaw<1,1,0>', ''), + ('nn::am::service::IWindow', 12345, '', '0 bytes in - 0 bytes out', ''), # BS entry to make this interface exist. +] + +smapping = { + '0100000000000006': { # usb + 'usb:ds': 'nn::usb::ds::IDsService', + 'usb:hs': 'nn::usb::hs::IClientRootSession', + 'usb:pd': 'nn::usb::pd::detail::IPdManager', + 'usb:pd:c': 'nn::usb::pd::detail::IPdCradleManager', + 'usb:pm': 'nn::usb::pm::IPmService', + }, + '0100000000000009': { # settings + 'set': 'nn::settings::ISettingsServer', + 'set:cal': 'nn::settings::IFactorySettingsServer', + 'set:fd': 'nn::settings::IFirmwareDebugSettingsServer', + 'set:sys': 'nn::settings::ISystemSettingsServer', + }, + '010000000000000A': { # Bus + 'gpio': 'nn::gpio::IManager', + 'i2c': 'nn::i2c::IManager', + 'i2c:pcv': 'nn::i2c::IManager', + 'pinmux': 'nn::pinmux::IManager', + 'pwm': 'nn::pwm::IManager', + 'sasbus': 'nn::sasbus::IManager', + 'uart': 'nn::uart::IManager', + }, + '010000000000000B': { # bluetooth + 'btdrv': 'nn::bluetooth::IBluetoothDriver', + }, + '010000000000000C': { # bcat + 'bcat:a': 'nn::bcat::detail::ipc::IServiceCreator', + 'bcat:m': 'nn::bcat::detail::ipc::IServiceCreator', + 'bcat:s': 'nn::bcat::detail::ipc::IServiceCreator', + 'bcat:u': 'nn::bcat::detail::ipc::IServiceCreator', + 'news:a': 'nn::news::detail::ipc::IServiceCreator', + 'news:c': 'nn::news::detail::ipc::IServiceCreator', + 'news:m': 'nn::news::detail::ipc::IServiceCreator', + 'news:p': 'nn::news::detail::ipc::IServiceCreator', + 'news:v': 'nn::news::detail::ipc::IServiceCreator', + 'prepo:a': 'nn::prepo::detail::ipc::IPrepoService', + 'prepo:m': 'nn::prepo::detail::ipc::IPrepoService', + 'prepo:s': 'nn::prepo::detail::ipc::IPrepoService', + 'prepo:u': 'nn::prepo::detail::ipc::IPrepoService', + }, + '010000000000000E': { # friends + 'friend:a': 'nn::friends::detail::ipc::IServiceCreator', + 'friend:m': 'nn::friends::detail::ipc::IServiceCreator', + 'friend:s': 'nn::friends::detail::ipc::IServiceCreator', + 'friend:u': 'nn::friends::detail::ipc::IServiceCreator', + 'friend:v': 'nn::friends::detail::ipc::IServiceCreator', + }, + '010000000000000F': { # nifm + 'nifm:a': 'nn::nifm::detail::IStaticService', + 'nifm:s': 'nn::nifm::detail::IStaticService', + 'nifm:u': 'nn::nifm::detail::IStaticService', + }, + '0100000000000010': { # ptm + 'fan': 'nn::fan::detail::IManager', + 'psm': 'nn::psm::IPsmServer', + 'tc': 'nn::tc::IManager', + 'ts': 'nn::ts::server::IMeasurementServer', + }, + '0100000000000012': { # bsdsocket + 'bsd:s': 'nn::socket::sf::IClient', # ? + 'bsd:u': 'nn::socket::sf::IClient', # ? + 'bsdcfg': 'nn::bsdsocket::cfg::ServerInterface', + 'ethc:c': 'nn::eth::sf::IEthInterfaceGroup', + 'ethc:i': 'nn::eth::sf::IEthInterfaceGroup', + 'nsd:a': 'nn::nsd::detail::IManager', # ? + 'nsd:u': 'nn::nsd::detail::IManager', # ? + 'sfdnsres': 'nn::socket::resolver::IResolver', + }, + '0100000000000013': { # hid + 'ahid:cd': 'nn::ahid::IServerSession', # ? + 'ahid:hdr': 'nn::ahid::hdr::ISession', # ? + 'hid': 'nn::hid::IHidServer', + 'hid:dbg': 'nn::hid::IHidDebugServer', + 'hid:sys': 'nn::hid::IHidSystemServer', + 'hid:tmp': 'nn::hid::IHidTemporaryServer', + 'irs': 'nn::irsensor::IIrSensorServer', + 'irs:sys': 'nn::irsensor::IIrSensorSystemServer', + 'xcd:sys': 'nn::xcd::detail::ISystemServer', + }, + '0100000000000014': { # audio + 'audctl': 'nn::audioctrl::detail::IAudioController', + 'audin:a': 'nn::audio::detail::IAudioInManagerForApplet', + 'audin:d': 'nn::audio::detail::IAudioInManager', + 'audin:u': 'nn::audio::detail::IAudioInManagerForDebugger', + 'audout:a': 'nn::audio::detail::IAudioOutManagerForApplet', + 'audout:d': 'nn::audio::detail::IAudioOutManagerForDebugger', + 'audout:u': 'nn::audio::detail::IAudioOutManager', + 'audrec:a': 'nn::audio::detail::IFinalOutputRecorderManagerForApplet', + 'audrec:d': 'nn::audio::detail::IFinalOutputRecorderManagerForDebugger', + 'audrec:u': 'nn::audio::detail::IAudioRendererManager', + 'audren:a': 'nn::audio::detail::IAudioRendererManagerForApplet', + 'audren:d': 'nn::audio::detail::IAudioRendererManagerForDebugger', + 'audren:u': 'nn::audio::detail::IFinalOutputRecorderManager', + 'hwopus': 'nn::codec::detail::IHardwareOpusDecoderManager', + }, + '0100000000000015': { # LogManager.Prod + 'lm': 'nn::lm::ILogService', + }, + '0100000000000016': { # wlan + 'wlan:inf': 'nn::wlan::detail::IInfraManager', + 'wlan:lcl': 'nn::wlan::detail::ILocalManager', + 'wlan:lg': 'nn::wlan::detail::ILocalGetFrame', + 'wlan:lga': 'nn::wlan::detail::ILocalGetActionFrame', + 'wlan:soc': 'nn::wlan::detail::ISocketManager', + 'wlan:sg': 'nn::wlan::detail::ISocketGetFrame', + }, + '0100000000000018': { # ldn + 'ldn:m': 'nn::ldn::detail::IMonitorServiceCreator', + 'ldn:s': 'nn::ldn::detail::ISystemServiceCreator', + 'ldn:u': 'nn::ldn::detail::IUserServiceCreator', + }, + '0100000000000019': { # nvservices + 'nvdrv': 'nns::nvdrv::INvDrvServices', + 'nvdrv:a': 'nns::nvdrv::INvDrvServices', + 'nvdrv:s': 'nns::nvdrv::INvDrvServices', + 'nvdrv:t': 'nns::nvdrv::INvDrvServices', + 'nvdrvdbg': 'nns::nvdrv::INvDrvDebugFSServices', + 'nvgem:c': 'nv::gemcontrol::INvGemControl', + 'nvgem:cd': 'nv::gemcoredump::INvGemCoreDump', + }, + '010000000000001A': { # pcv + 'bpc': 'nn::bpc::IBoardPowerControlManager', + 'bpc:r': 'nn::bpc::IRtcManager', + 'pcv': 'nn::pcv::detail::IPcvService', + 'pcv:arb': 'nn::pcv::IArbitrationManager', + 'pcv:imm': 'nn::pcv::IImmediateManager', + 'time:u': 'nn::timesrv::detail::service::IStaticService', + 'time:a': 'nn::timesrv::detail::service::IStaticService', + 'time:s': 'nn::timesrv::detail::service::IStaticService', + 'time:r': 'nn::timesrv::detail::service::IStaticService', + }, + '010000000000001B': { # ppc + 'apm': 'nn::apm::IManager', + 'apm:p': 'nn::apm::IManagerPrivileged', + 'apm:sys': 'nn::apm::ISystemManager', + 'fgm:0': 'nn::fgm::sf::ISession', + 'fgm': 'nn::fgm::sf::ISession', + 'fgm:9': 'nn::fgm::sf::ISession', # no nn::fgm::sf::IDebugger ? + }, + '010000000000001D': { # pcie.withoutHb + 'pcie': 'nn::pcie::detail::IManager', + }, + '010000000000001E': { # account + 'acc:aa': 'nn::account::IBaasAccessTokenAccessor', # ? + 'acc:su': 'nn::account::IAccountServiceForAdministrator', # ? + 'acc:u1': 'nn::account::IAccountServiceForSystemService', # ? + 'acc:u0': 'nn::account::IAccountServiceForApplication', # ? + }, + '010000000000001F': { # ns + 'aoc:u': 'nn::aocsrv::detail::IAddOnContentManager', + 'ns:am2': 'nn::ns::detail::IServiceGetterInterface', + 'ns:dev': 'nn::ns::detail::IDevelopInterface', + 'ns:ec': 'nn::ns::detail::IServiceGetterInterface', + 'ns:rid': 'nn::ns::detail::IServiceGetterInterface', + 'ns:rt': 'nn::ns::detail::IServiceGetterInterface', + 'ns:su': 'nn::ns::detail::ISystemUpdateInterface', + 'ns:vm': 'nn::ns::detail::IVulnerabilityManagerInterface', + 'ns:web': 'nn::ns::detail::IServiceGetterInterface', + 'ovln:rcv': 'nn::ovln::IReceiverService', + 'ovln:snd': 'nn::ovln::ISenderService', + }, + '0100000000000020': { # nfc + 'nfc:am': 'nn::nfc::am::detail::IAmManager', + 'nfc:mf:u': 'nn::nfc::mifare::detail::IUserManager', + 'nfc:sys': 'nn::nfc::detail::ISystemManager', + 'nfc:user': 'nn::nfc::detail::IUserManager', + 'nfp:dbg': 'nn::nfp::detail::IDebugManager', + 'nfp:sys': 'nn::nfp::detail::ISystemManager', + 'nfp:user': 'nn::nfp::detail::IUserManager', + }, + '0100000000000021': { # psc + 'psc:c': 'nn::psc::sf::IPmControl', # ? + 'psc:m': 'nn::psc::sf::IPmService', # ? + }, + '0100000000000022': { # capsrv + 'caps:a': 'nn::capsrv::sf::IAlbumAccessorService', + 'caps:c': 'nn::capsrv::sf::IAlbumControlService', + }, + '0100000000000023': { # am + 'appletAE': 'nn::am::service::IAllSystemAppletProxiesService', + 'appletOE': 'nn::am::service::IApplicationProxyService', + 'idle:sys': 'nn::idle::detail::IPolicyManagerSystem', + 'omm': 'nn::omm::detail::IOperationModeManager', + 'spsm': 'nn::spsm::detail::IPowerStateInterface', + }, + '0100000000000024': { # ssl + 'ssl': 'nn::ssl::sf::ISslService', # ? + }, + '0100000000000025': { # nim + 'nim': 'nn::nim::detail::INetworkInstallManager', + 'nim:shp': 'nn::nim::detail::IShopServiceManager', + 'ntc': 'nn::ntc::detail::service::IStaticService', + }, + '0100000000000029': { # lbl + 'lbl': 'nn::lbl::detail::ILblController', + }, + '010000000000002A': { # btm + 'btm': 'nn::btm::IBtm', + 'btm:dbg': 'nn::btm::IBtmDebug', + 'btm:sys': 'nn::btm::IBtmSystem', + }, + '010000000000002B': { # erpt + 'erpt:c': 'nn::erpt::sf::IContext', + 'erpt:r': 'nn::erpt::sf::ISession', + }, + '010000000000002D': { # vi + 'caps:sc': 'nn::capsrv::sf::IScreenShotControlService', + 'caps:ss': 'nn::capsrv::sf::IScreenShotService', + 'caps:su': 'nn::capsrv::sf::IScreenShotApplicationService', + 'cec-mgr': 'nn::cec::ICecManagerx', + 'mm:u': 'nn::mmnv::IRequest', # ? + 'vi:m': 'nn::visrv::sf::IManagerRootService', + 'vi:s': 'nn::visrv::sf::ISystemRootService', + 'vi:u': 'nn::visrv::sf::IApplicationRootService', + }, + '010000000000002E': { # pctl + 'pctl': 'nn::pctl::detail::ipc::IParentalControlServiceFactory', + 'pctl:a': 'nn::pctl::detail::ipc::IParentalControlServiceFactory', + 'pctl:r': 'nn::pctl::detail::ipc::IParentalControlServiceFactory', + 'pctl:s': 'nn::pctl::detail::ipc::IParentalControlServiceFactory', + }, + '010000000000002F': { # npns + 'npns:s': 'nn::npns::INpnsSystem', + 'npns:u': 'nn::npns::INpnsUser', + }, + '0100000000000030': { # eupld + 'eupld:c': 'nn::eupld::sf::IControl', + 'eupld:r': 'nn::eupld::sf::IRequest', + }, + '0100000000000031': { # glue + 'arp:r': 'nn::arp::detail::IReader', + 'arp:w': 'nn::arp::detail::IWriter', + 'bgtc:sc': 'nn::bgtc::IStateControlService', + 'bgtc:t': 'nn::bgtc::ITaskService', + }, + '0100000000000033': { # es + 'es': 'nn::es::IETicketService', + }, + '0100000000000034': { # fatal + 'fatal:p': 'nn::fatalsrv::IPrivateService', + 'fatal:u': 'nn::fatalsrv::IService', + }, + '0100000000000037': { # ro + 'ldr:ro': 'nn::ro::detail::IRoInterface', + 'ro:dmnt': 'nn::ro::detail::IDebugMonitorInterface', # ? + }, + '0100000000000039': { # sdb + 'mii:e': 'nn::mii::detail::IStaticService', + 'mii:u': 'nn::mii::detail::IStaticService', + 'pdm:ntfy': 'nn::pdm::detail::INotifyService', + 'pdm:qry': 'nn::pdm::detail::IQueryService', + 'pl:u': 'nn::pl::detail::ISharedFontManager', + }, +} + +import hashlib, random, re + +clsToInterface = {} +for x in smapping.values(): + for k, v in x.items(): + if v not in clsToInterface: + clsToInterface[v] = [] + clsToInterface[v].append(k) + +clses = {} +for cname, cmdid, name, io, params in info: + if cname not in clses: + clses[cname] = {} + #if params != '': + clses[cname][cmdid] = name, io, params + +def parseAnyInt(x): + return int(x[2:], 16) if x.startswith('0x') else int(x) + +def emitInt(x): + return '0x%x' % x if x > 9 else str(x) + +def csplit(inp): + def findMatch(i, ch): + while i < len(inp): + mch = inp[i] + if mch == ch: + return i + elif mch == '<': + i = findMatch(i + 1, '>') + elif mch == '(': + i = findMatch(i + 1, ')') + elif mch == '[': + i = findMatch(i + 1, ']') + i += 1 + out = [] + i = 0 + last = 0 + while i < len(inp): + mch = inp[i] + if mch == ',': + if i != last: + out.append(inp[last:i].strip(' ,')) + last = i + elif mch == '<': + i = findMatch(i + 1, '>') + elif mch == '(': + i = findMatch(i + 1, ')') + elif mch == '[': + i = findMatch(i + 1, ']') + i += 1 + if last != i: + out.append(inp[last:i].strip(' ,')) + return out + +def splitIOSpec(cs): + ins, outs = [], [] + + for elem in cs: + if elem.startswith('InRaw<'): + ins.append(elem) + elif elem.startswith('OutRaw<'): + outs.append(elem) + elif elem.startswith('Buffer<'): + btype = parseAnyInt(elem.split(',')[1]) + if btype & 1: + ins.append(elem) + else: + assert btype & 2 + outs.append(elem) + elif elem.startswith('InObject<'): + ins.append(elem) + elif elem.startswith('OutObject<'): + outs.append(elem) + elif elem.startswith('InHandle<'): + ins.append(elem) + elif elem.startswith('OutHandle<'): + outs.append(elem) + else: + print elem + assert False + + return ins, outs + +def splitIOParams(params): + ins, outs = [], [] + + for elem in params: + if elem.startswith('nn::sf::Out', 1)[0] + '[]' + elif type.startswith('nn::sf::InArray<'): + type = type.split('nn::sf::InArray<', 1)[1].split('>', 1)[0] + '[]' + elif type.startswith('nn::sf::InBuffer'): + type = 'unknown' + + type = type.strip() + + if type.startswith('nn::sf::SharedPointer<'): + type = type.split('nn::sf::SharedPointer<', 1)[1].split('>', 1)[0] + elif type.startswith('nn::sf::NativeHandle'): + type = 'KObject' + elif type.startswith('nn::util::BitFlagSet<'): + type = csplit(type.split('nn::util::BitFlagSet<', 1)[1][:-1])[1] + + type = type.strip() + + if type in intTypes: + type = intTypes[type] + elif type.endswith('[]') and type[:-2] in intTypes: + type = intTypes[type[:-2]] + '[]' + + stype = parseSpecType(stype) + + if stype[0] == 'OutObject' or stype[0] == 'InObject': + return 'object', type + elif stype[0] == 'InRaw' or stype[0] == 'OutRaw': + _, size, alignment, offset = stype + return 'data', type, size, alignment, offset + elif stype[0] == 'Buffer': + if type.endswith('[]'): + type = type[:-2] + assert stype[3] == 0 + return 'array', type, stype[2] + else: + type = 'unknown' if type == 'nn::sf::OutBuffer' else type + return 'buffer', type, stype[2], stype[3] + elif stype[0] == 'InHandle' or stype[0] == 'OutHandle': + assert type == 'KObject' + return 'handle', + +defaultTypes = { + -1: 'unknown', + 1: 'u8', + 2: 'u16', + 4: 'u32', + 8: 'u64', + 16: 'u128' +} + +def emitDefaultOrBytes(size): + if size in defaultTypes: + return defaultTypes[size] + return 'bytes<%s>' % emitInt(size) + +def generateType(stype): + stype = parseSpecType(stype) + + if stype[0] == 'InHandle' or stype[0] == 'OutHandle': + return 'handle', + elif stype[0] == 'InObject' or stype[0] == 'OutObject': + return 'object', None + elif stype[0] == 'InRaw' or stype[0] == 'OutRaw': + _, size, alignment, offset = stype + return 'data', emitDefaultOrBytes(size), size, alignment, offset + elif stype[0] == 'Buffer': + return 'buffer', None, stype[2], stype[3] + +dataSizes = {} +bufferTypes = set() +def defineSizes(types): + for elem in types: + if (elem[0] == 'buffer' or elem[0] == 'array') and elem[1] is not None: + bufferTypes.add(elem[1]) + continue + elif elem[0] != 'data': + continue + elif elem[1] in dataSizes: + assert dataSizes[elem[1]] == elem[2] + continue + dataSizes[elem[1]] = elem[2] + +def sortTyped(typed): + return sorted(typed, key=lambda x: dict(data=0, pid=1, handle=2, object=3, buffer=4, array=4)[x[0]]) + +def sortData(elems): + data = [elem for elem in elems if elem[0] == 'data'] + data.sort(key=lambda x: x[4]) + + return data + elems[len(data):] + +def filterAlignment(elems): + cur = 0 + for i, elem in enumerate(elems): + if elem[0] != 'data': + break + + _, type, size, alignment, offset = elem + + calcAlign = min(size, 8) + + before = cur + while cur % calcAlign: + cur += 1 + + if offset != cur: + cur = before + while cur % alignment: + cur += 1 + elems[i] = 'data', type, size, alignment + else: + elems[i] = 'data', type, size, None + #assert offset == cur + cur += size + return elems + +def parseFunc(cs, params, pid): + cs, params = csplit(cs), csplit(params[1:-1]) if params else [] + + assert not params or len(cs) == len(params) + + si, so = splitIOSpec(cs) + if params: + pi, po = splitIOParams(params) + assert len(si) == len(pi) and len(so) == len(po) + pi, po = [remapProtoType(x, si[i]) for i, x in enumerate(pi)], [remapProtoType(x, so[i]) for i, x in enumerate(po)] + + defineSizes(pi + po) + else: + pi, po = map(generateType, si), map(generateType, so) + + if pid: + pi = [('pid', )] + pi + + return filterAlignment(sortData(sortTyped(pi))), filterAlignment(sortData(sortTyped(po))) + +ifaces = {} +for cname, functions in clses.items(): + assert cname not in ifaces + ifaces[cname] = iface = {} + for cmdId, func in functions.items(): + fname, spec, params = func + if fname == '': + fname = 'Unknown%i' % cmdId + spec = spec.split(' - ') + if len(spec) == 2 or (len(spec) == 3 and spec[2] == 'takes pid'): + assert spec[0] == '0 bytes in' and spec[1] == '0 bytes out' + iface[cmdId] = (fname, (['pid'], ) if len(spec) == 3 else (), ()) + elif len(spec) == 3 or (len(spec) == 4 and spec[2] == 'takes pid'): + if spec[2] == 'takes pid': + pid = True + cs = spec[3] + else: + pid = False + cs = spec[2] + + ins, outs = parseFunc(cs, params, pid) + iface[cmdId] = fname, ins, outs + +for elem in bufferTypes: + if elem not in dataSizes: + dataSizes[elem] = -1 + +with file('ipcdefs/auto.id', 'w') as fp: + lastNs = -1 + for name, size in sorted(dataSizes.items(), key=lambda x: x[0]): + if name not in intTypes.values() and name != 'void' and name != 'unknown': + ns = name.rsplit('::', 1)[0] if '::' in name else None + if ns != lastNs and lastNs != -1: + print >>fp + print >>fp, 'type %s = %s;' % (name, emitDefaultOrBytes(size)) + lastNs = ns + + print >>fp + print >>fp + + def emitType(type): + if type[0] == 'data': + if type[3] is not None: + return 'align<%i, %s>' % (type[3], type[1]) + return type[1] # XXX: Add alignment setup + elif type[0] == 'object': + return 'object<%s>' % (type[1] if type[1] else 'IUnknown') + elif type[0] == 'handle': + return 'KObject' + elif type[0] == 'array': + return 'array<%s, %s>' % (type[1], emitInt(type[2])) + elif type[0] == 'buffer': + return 'buffer<%s, %s, %s>' % (type[1] or 'unknown', emitInt(type[2]), emitInt(type[3])) + elif type[0] == 'pid': + return 'pid' + else: + print 'wtf?', type + + def emitFunction(cmdId, fname, ins, outs): + outstr = '' + if len(outs) == 1: + outstr = ' -> %s' % emitType(outs[0]) + elif len(outs): + outstr = ' -> (%s)' % ', '.join(emitType(x) for x in outs) + return '[%i] %s(%s)%s;' % (cmdId, fname, ', '.join(emitType(x) for x in ins), outstr) + + for cname, cmds in sorted(ifaces.items(), key=lambda x: x[0]): + print >>fp, 'interface %s%s {' % (cname, ' is ' + ', '.join(clsToInterface[cname]) if cname in clsToInterface else '') + for cmdId, (fname, ins, outs) in sorted(cmds.items(), key=lambda x: x[0]): + print >>fp, '\t' + emitFunction(cmdId, fname, ins, outs) + print >>fp, '}' + print >>fp diff --git a/generateIpcStubs.py b/generateIpcStubs.py new file mode 100644 index 0000000..89c643d --- /dev/null +++ b/generateIpcStubs.py @@ -0,0 +1,394 @@ +import glob, hashlib, json, os, os.path, re, sys +from pprint import pprint +import idparser, partialparser + +def emitInt(x): + return '0x%x' % x if x > 9 else str(x) + +typemap = dict( + i8='int8_t', + i16='int16_t', + i32='int32_t', + i64='int64_t', + i128='int128_t', + u8='uint8_t', + u16='uint16_t', + u32='uint32_t', + u64='uint64_t', + u128='uint128_t', + f32='float32_t', + pid='gpid', + bool='bool', +) + +typesizes = dict( + i8=1, + i16=2, + i32=4, + i64=8, + i128=16, + u8=1, + u16=2, + u32=4, + u64=8, + u128=16, + f32=4, + pid=8, + bool=1, +) + +allTypes = None + +def typeSize(type): + if type[0] in ('unknown', 'i8', 'u8'): + return 1 + elif type[0] == 'bytes': + return type[1] + elif type[0] in allTypes: + return typeSize(allTypes[type[0]]) + elif type[0] in typesizes: + return typesizes[type[0]] + return 1 + +def splitByNs(obj): + ons = {} + for type, x in obj.items(): + ns = type.rsplit('::', 1)[0] if '::' in type else None + name = type.rsplit('::', 1)[-1] + if ns not in ons: + ons[ns] = {} + ons[ns][name] = x + return ons + +def retype(spec, noIndex=False): + if spec[0] == 'unknown': + return 'uint8_t' + elif spec[0] == 'bytes': + return 'uint8_t%s' % ('[%s]' % emitInt(spec[1]) if not noIndex else ' *') + else: + return typemap[spec[0]] if spec[0] in typemap else spec[0]; + +def formatParam(param, input, i): + name, spec = param + if name is None: + name = '_%i' % i + + hasSize = False + + if spec[0] == 'align': + return formatParam((name, spec[2]), input, i) + + if spec[0] == 'bytes': + type = 'uint8_t *' + elif spec[0] == 'unknown': + assert False + elif spec[0] == 'buffer': + type = '%s *' % retype(spec[1]) + hasSize = True + elif spec[0] == 'array': + type = retype(spec[1]) + ' *' + hasSize = True + elif spec[0] == 'object': + type = 'shared_ptr<%s>' % spec[1][0] + elif spec[0] == 'KObject': + type = 'shared_ptr' + else: + type = typemap[spec[0]] if spec[0] in typemap else spec[0] + + if type.endswith(']'): + arrspec = type[type.index('['):] + type = type[:-len(arrspec)] + else: + arrspec = '' + + return '%s %s%s %s%s%s' % ('IN' if input else 'OUT', type, '&' if not input and (not type.endswith('*') and not arrspec) else '', name, arrspec, ', guint %s_size' % name if hasSize else '') + +def generatePrototype(func): + return ', '.join([formatParam(x, True, i) for i, x in enumerate(func['inputs'])] + [formatParam(x, False, i + len(func['inputs'])) for i, x in enumerate(func['outputs'])]) + +def isPointerType(type): + if type[0] in typesizes: + return False + elif type[0] == 'bytes': + return True + elif type[0] in allTypes: + return isPointerType(allTypes[type[0]]) + return True + +AFTER = 'AFTER' + +def generateCaller(qname, fname, func): + def tempname(): + tempI[0] += 1 + return 'temp%i' % tempI[0] + params = [] + logFmt, logElems = [], [] + tempI = [0] + inpOffset = 8 + bufOffs = {} + hndOff = 0 + objOff = 0 + bufSizes = 0 + for name, elem in func['inputs']: + type, rest = elem[0], elem[1:] + if type in ('array', 'buffer'): + if rest[1] not in bufOffs: + bufOffs[rest[1]] = 0 + cbo = bufOffs[rest[1]] + bufOffs[rest[1]] += 1 + an, sn, bn = tempname(), tempname(), tempname() + yield 'guint %s;' % sn + yield 'auto %s = req.getBuffer(%s, %i, %s);' % (an, emitInt(rest[1]), cbo, sn) + yield 'auto %s = new uint8_t[%s];' % (bn, sn) + yield 'ctu->cpu.readmem(%s, %s, %s);' % (an, bn, sn) + params.append('(%s *) %s' % (retype(rest[0]), bn)) + params.append(sn) + logFmt.append('%s *%s= buffer<0x" ADDRFMT ">' % (retype(rest[0]), '%s ' % name if name else '')) + logElems.append(sn) + bufSizes += 1 + yield AFTER, 'delete[] %s;' % bn + elif type == 'object': + params.append('ctu->getHandle<%s>(req.getMoved(%i))' % (rest[0][0], objOff)) + logFmt.append('%s %s= 0x%%x' % (rest[0][0], '%s ' % name if name else '')) + logElems.append('req.getMoved(%i)' % objOff) + objOff += 1 + elif type == 'KObject': + params.append('ctu->getHandle(req.getCopied(%i))' % hndOff) + logFmt.append('KObject %s= 0x%%x' % ('%s ' % name if name else '')) + logElems.append('req.getCopied(%i)' % objOff) + hndOff += 1 + elif type == 'pid': + params.append('req.pid') + else: + if elem[0] == 'align': + alignment = elem[1] + elem = elem[2] + else: + alignment = min(8, typeSize(elem)) + while inpOffset % alignment: + inpOffset += 1 + if isPointerType(elem): + params.append('req.getDataPointer<%s>(%s)' % (retype(elem, noIndex=True), emitInt(inpOffset))) + logFmt.append('%s %s= %%s' % (retype(elem), '%s ' % name if name else '')) + logElems.append('bufferToString(req.getDataPointer(%s), %s).c_str()' % (emitInt(inpOffset), emitInt(typeSize(elem)))) + else: + params.append('req.getData<%s>(%s)' % (retype(elem), emitInt(inpOffset))) + if typeSize(elem) == 16: + logFmt.append('%s %s= %%s' % (retype(elem), '%s ' % name if name else '')) + logElems.append('bufferToString(req.getDataPointer(%s), %s).c_str()' % (emitInt(inpOffset), emitInt(typeSize(elem)))) + else: + type = retype(elem) + ct = '0x%x' + if type == 'float32_t': + ct = '%f' + elif typeSize(elem) == 8: + ct = '0x" ADDRFMT "' + logFmt.append('%s %s= %s' % (type, '%s ' % name if name else '', ct)) + logElems.append('%sreq.getData<%s>(%s)' % ('(double) ' if type == 'float32_t' else '', type, emitInt(inpOffset))) + inpOffset += typeSize(elem) + + outOffset = 8 + hndOff = 0 + objOff = 0 + for _, elem in func['outputs']: + type, rest = elem[0], elem[1:] + if type in ('array', 'buffer'): + if rest[1] not in bufOffs: + bufOffs[rest[1]] = 0 + cbo = bufOffs[rest[1]] + bufOffs[rest[1]] += 1 + an, sn, bn = tempname(), tempname(), tempname() + yield 'guint %s;' % sn + yield 'auto %s = req.getBuffer(%s, %i, %s);' % (an, emitInt(rest[1]), cbo, sn) + yield 'auto %s = new uint8_t[%s];' % (bn, sn) + params.append('(%s *) %s' % (retype(rest[0]), bn)) + params.append(sn) + bufSizes += 1 + yield AFTER, 'ctu->cpu.writemem(%s, %s, %s);' % (an, bn, sn) + yield AFTER, 'delete[] %s;' % bn + elif type == 'object': + tn = tempname() + yield 'shared_ptr<%s> %s;' % (rest[0][0], tn) + params.append(tn) + yield AFTER, 'if(%s != nullptr)' % tn + yield AFTER, '\tresp.move(%i, createHandle(%s));' % (objOff, tn) + objOff += 1 + elif type == 'KObject': + tn = tempname() + yield 'shared_ptr %s;' % tn + params.append(tn) + yield AFTER, 'if(%s != nullptr)' % tn + yield AFTER, '\tresp.copy(%i, ctu->newHandle(%s));' % (hndOff, tn) + hndOff += 1 + elif type == 'pid': + assert False + else: + if elem[0] == 'align': + alignment = elem[1] + elem = elem[2] + else: + alignment = min(8, typeSize(elem)) + while outOffset % alignment: + outOffset += 1 + if isPointerType(elem): + tn = tempname() + yield 'auto %s = resp.getDataPointer<%s>(%s);' % (tn, retype(elem, noIndex=True), emitInt(outOffset)) + params.append(tn) + else: + params.append('*resp.getDataPointer<%s *>(%s)' % (retype(elem), emitInt(outOffset))) + outOffset += typeSize(elem) + + if len(func['outputs']) + len(func['inputs']) + bufSizes != len(params): + yield 'return 0xf601;' + return + + yield 'resp.initialize(%i, %i, %i);' % (objOff, hndOff, outOffset - 8) + if len(logFmt): + yield 'LOG_DEBUG(IpcStubs, "IPC message to %s: %s"%s);' % (qname + '::' + fname, ', '.join(logFmt), (', ' + ', '.join(logElems)) if logElems else '') + else: + yield 'LOG_DEBUG(IpcStubs, "IPC message to %s");' % (qname + '::' + fname) + yield 'resp.errCode = %s(%s);' % (fname, ', '.join(params)) + yield AFTER + yield 'return 0;' + +def reorder(gen): + after = [] + for x in gen: + if x == AFTER: + for elem in after: + yield elem + elif isinstance(x, tuple) and x[0] == AFTER: + after.append(x[1]) + else: + yield x + +def parsePartials(code): + code = '\n'.join(re.findall(r'/\*\$IPC\$(.*?)\*/', code, re.M|re.S)) + return partialparser.parse(code) + +usedInts = [] +def uniqInt(*args): + args = ''.join(map(str, args)) + i = int(hashlib.md5(args).hexdigest()[:8], 16) + while True: + if i not in usedInts: + usedInts.append(i) + return i + i += 1 + +def main(): + global allTypes + + fns = ['ipcdefs/auto.id'] + [x for x in glob.glob('ipcdefs/*.id') if x != 'ipcdefs/auto.id'] + + if os.path.exists('ipcdefs/cache') and all(os.path.getmtime('ipcdefs/cache') > os.path.getmtime(x) for x in fns): + res = json.load(file('ipcdefs/cache')) + else: + res = idparser.parse('\n'.join(file(fn).read() for fn in fns)) + with file('ipcdefs/cache', 'w') as fp: + json.dump(res, fp) + types, ifaces, services = res + + allTypes = types + + typesByNs = splitByNs(types) + ifacesByNs = splitByNs(ifaces) + + namespaces = {x : [] for x in typesByNs.keys() + ifacesByNs.keys()} + + for ns, types in typesByNs.items(): + for name, spec in sorted(types.items(), key=lambda x: x[0]): + retyped, plain = retype(spec, noIndex=True), retype(spec) + namespaces[ns].append('using %s = %s;%s' % (name, retyped, ' // ' + plain if retyped != plain else '')) + + for ns, ifaces in ifacesByNs.items(): + for name in sorted(ifaces.keys()): + namespaces[ns].append('class %s;' % name) + + with file('IpcStubs.h', 'w') as fp: + print >>fp, '#pragma once' + print >>fp, '#include "Ctu.h"' + print >>fp + + print >>fp, '#define SERVICE_MAPPING() do { \\' + for iname, snames in sorted(services.items(), key=lambda x: x[0]): + for sname in snames: + print >>fp, '\tSERVICE("%s", %s); \\' % (sname, iname) + print >>fp, '} while(0)' + print >>fp + + for ns, elems in sorted(namespaces.items(), key=lambda x: x[0]): + if ns is not None: + print >>fp, 'namespace %s {' % ns + hasUsing = False + for elem in elems: + if not hasUsing and elem.startswith('using'): + hasUsing = True + elif hasUsing and elem.startswith('class'): + print >>fp + hasUsing = False + print >>fp, ('\t' if ns is not None else '') + elem + if ns is not None: + print >>fp, '}' + + print >>fp + + allcode = '\n'.join(file(fn, 'r').read() for fn in glob.glob('ipcimpl/*.cpp')) + + partials = parsePartials(allcode) + + for ns, ifaces in sorted(ifacesByNs.items(), key=lambda x: x[0]): + print >>fp, '%snamespace %s {' % ('//// ' if ns is None else '', ns) + for name, funcs in sorted(ifaces.items(), key=lambda x: x[0]): + qname = '%s::%s' % (ns, name) if ns else name + partial = partials[qname] if qname in partials else None + print >>fp, '\tclass %s : public IpcService {' % name + print >>fp, '\tpublic:' + if re.search('(^|[^a-zA-Z0-9:])%s::%s[^a-zA-Z0-9:]' % (qname, name), allcode): + print >>fp, '\t\t%s(Ctu *_ctu%s);' % (name, ', ' + ', '.join('%s _%s' % (k, v) for k, v in partial[1]) if partial and partial[1] else '') + else: + print >>fp, '\t\t%s(Ctu *_ctu%s) : IpcService(_ctu)%s {}' % (name, ', ' + ', '.join('%s _%s' % (k, v) for k, v in partial[1]) if partial and partial[1] else '', ', ' + ', '.join('%s(_%s)' % (v, v) for k, v in partial[1]) if partial and partial[1] else '') + print >>fp, '\t\tuint32_t dispatch(IncomingIpcMessage &req, OutgoingIpcMessage &resp) {' + print >>fp, '\t\t\tswitch(req.cmdId) {' + for fname, func in sorted(funcs.items(), key=lambda x: x[1]['cmdId']): + print >>fp, '\t\t\tcase %i: {' % func['cmdId']; + print >>fp, '\n'.join('\t\t\t\t' + x for x in reorder(generateCaller(qname, fname, func))) + print >>fp, '\t\t\t}' + print >>fp, '\t\t\tdefault:' + print >>fp, '\t\t\t\tLOG_ERROR(IpcStubs, "Unknown message cmdId %%u to interface %s", req.cmdId);' % ('%s::%s' % (ns, name) if ns else name) + print >>fp, '\t\t\t}' + print >>fp, '\t\t}' + for fname, func in sorted(funcs.items(), key=lambda x: x[0]): + implemented = re.search('[^a-zA-Z0-9:]%s::%s[^a-zA-Z0-9:]' % (qname, fname), allcode) + print >>fp, '\t\tuint32_t %s(%s);' % (fname, generatePrototype(func)) + if partial: + for x in partial[0]: + print >>fp, '\t\t%s' % x + print >>fp, '\t};' + print >>fp, '%s}' % ('//// ' if ns is None else '') + + print >>fp, '#ifdef DEFINE_STUBS' + for name, funcs in sorted(ifaces.items(), key=lambda x: x[0]): + qname = '%s::%s' % (ns, name) if ns else name + partial = partials[qname] if qname in partials else None + for fname, func in sorted(funcs.items(), key=lambda x: x[0]): + implemented = re.search('[^a-zA-Z0-9:]%s::%s[^a-zA-Z0-9:]' % (qname, fname), allcode) + if not implemented: + print >>fp, 'uint32_t %s::%s(%s) {' % (qname, fname, generatePrototype(func)) + print >>fp, '\tLOG_DEBUG(IpcStubs, "Stub implementation for %s::%s");' % (qname, fname) + for i, (name, elem) in enumerate(func['outputs']): + if elem[0] == 'object' and elem[1][0] != 'IUnknown': + name = name if name else '_%i' % (len(func['inputs']) + i) + print >>fp, '\t%s = buildInterface(%s);' % (name, elem[1][0]) + if elem[1][0] in partials and partials[elem[1][0]][1]: + print 'Bare construction of interface %s requiring parameters. Created in %s::%s for parameter %s' % (elem[1][0], qname, fname, name) + sys.exit(1) + elif elem[0] == 'KObject': + name = name if name else '_%i' % (len(func['inputs']) + i) + print >>fp, '\t%s = make_shared(0x%x);' % (name, uniqInt(qname, fname, name)) + print >>fp, '\treturn 0;' + print >>fp, '}' + print >>fp, '#endif // DEFINE_STUBS' + +if __name__=='__main__': + main(*sys.argv[1:]) diff --git a/idparser.py b/idparser.py new file mode 100644 index 0000000..0d8e083 --- /dev/null +++ b/idparser.py @@ -0,0 +1,95 @@ +import sys, tatsu + +grammar = ''' +start = { def }+ $ ; + +number + = + | /0x[0-9a-fA-F]+/ + | /[0-9]+/ + ; + +def + = + | typeDef + | interface + ; + +expression + = + | type + | number + ; + +name = /[a-zA-Z_][a-zA-Z0-9_:]*/ ; +sname = /[a-zA-Z_][a-zA-Z0-9_:\-]*/ ; +serviceNameList = @:','.{ sname } ; +template = '<' @:','.{ expression } '>' ; +type = name:name template:[ template ] ; + +typeDef = 'type' name:name '=' type:type ';' ; + +interface = 'interface' name:name [ 'is' serviceNames:serviceNameList ] '{' functions:{ funcDef }* '}' ; +namedTuple = '(' @:','.{ type [ name ] } ')' ; +namedType = type [ name ] ; +funcDef = '[' cmdId:number ']' name:name inputs:namedTuple [ '->' outputs:( namedType | namedTuple ) ] ';' ; +''' + +class Semantics(object): + def number(self, ast): + if ast.startswith('0x'): + return int(ast[2:], 16) + return int(ast) + + def namedTuple(self, ast): + return [elem if isinstance(elem, list) else [elem, None] for elem in ast] + + def namedType(self, ast): + return [ast if isinstance(ast, list) else [ast, None]] + +def parseType(type): + if not isinstance(type, tatsu.ast.AST) or 'template' not in type: + return type + name, template = type['name'], type['template'] + if template is None: + return [name] + else: + return [name] + map(parseType, template) + +def parse(data): + ast = tatsu.parse(grammar, data, semantics=Semantics(), eol_comments_re=r'\/\/.*?$') + + types = {} + for elem in ast: + if 'type' not in elem: + continue + #assert elem['name'] not in types + types[elem['name']] = parseType(elem['type']) + + ifaces = {} + services = {} + for elem in ast: + if 'functions' not in elem: + continue + #assert elem['name'] not in ifaces + ifaces[elem['name']] = iface = {} + if elem['serviceNames']: + services[elem['name']] = list(elem['serviceNames']) + + for func in elem['functions']: + if func['name'] in iface: + print >>sys.stderr, 'Duplicate function %s in %s' % (func['name'], elem['name']) + sys.exit(1) + + assert func['name'] not in iface + iface[func['name']] = fdef = {} + fdef['cmdId'] = func['cmdId'] + fdef['inputs'] = [(name, parseType(type)) for type, name in func['inputs']] + if func['outputs'] is None: + fdef['outputs'] = [] + elif isinstance(func['outputs'], tatsu.ast.AST): + fdef['outputs'] = [(None, parseType(func['outputs']))] + else: + fdef['outputs'] = [(name, parseType(type)) for type, name in func['outputs']] + + return types, ifaces, services diff --git a/ipcdefs/bgtc.id b/ipcdefs/bgtc.id new file mode 100644 index 0000000..6b4ade3 --- /dev/null +++ b/ipcdefs/bgtc.id @@ -0,0 +1,8 @@ +interface nn::bgtc::IStateControlService is bgtc:sc { +} + +interface nn::bgtc::ITaskService is bgtc:t { + [3] Unknown3() -> KObject; + [5] Unknown5(buffer); + [14] Unknown14() -> KObject; +} diff --git a/ipcdefs/capsrv.id b/ipcdefs/capsrv.id new file mode 100644 index 0000000..52baeb3 --- /dev/null +++ b/ipcdefs/capsrv.id @@ -0,0 +1,7 @@ +interface nn::capsrv::sf::IAlbumControlService is caps:c { + +} + +interface nn::capsrv::sf::IAlbumAccessorService is caps:a { + +} diff --git a/ipcdefs/es.id b/ipcdefs/es.id new file mode 100644 index 0000000..e264e8c --- /dev/null +++ b/ipcdefs/es.id @@ -0,0 +1,2 @@ +interface nn::es::IETicketService is es { +} diff --git a/ipcdefs/fatal.id b/ipcdefs/fatal.id new file mode 100644 index 0000000..49c7f7e --- /dev/null +++ b/ipcdefs/fatal.id @@ -0,0 +1,5 @@ +interface nn::fatalsrv::IService is fatal:u { + [0] Unknown0(u64, u64, pid); + [1] Unknown1(u64, u64, pid); + [2] TransitionToFatalError(u64 errorCode, u64, buffer errorBuf, pid); +} \ No newline at end of file diff --git a/ipcdefs/fspsrv.id b/ipcdefs/fspsrv.id new file mode 100644 index 0000000..f6114de --- /dev/null +++ b/ipcdefs/fspsrv.id @@ -0,0 +1,156 @@ +type nn::fssrv::sf::SaveStruct = bytes<0x40>; +type nn::fssrv::sf::SaveCreateStruct = bytes<0x40>; +type nn::fssrv::sf::Partition = u32; + +// --------------------------------------------- FSP-SRV --------------------------------------------- + +interface nn::fssrv::sf::IFileSystemProxy is fsp-srv { + [1] Initialize(u64, pid); + [2] OpenDataFileSystemByCurrentProcess() -> object; + [7] MountContent7(nn::ApplicationId tid, u32 ncaType) -> object; + [8] MountContent(nn::ApplicationId tid, u32 flag, buffer path) -> object contentFs; + [9] OpenDataFileSystemByApplicationId(nn::ApplicationId tid) -> object dataFiles; + [11] MountBis(nn::fssrv::sf::Partition partitionID, buffer path) -> object Bis; + [12] OpenBisPartition(nn::fssrv::sf::Partition partitionID) -> object BisPartition; + [13] InvalidateBisCache(); + [17] OpenHostFileSystemImpl(buffer path) -> object; + [18] MountSdCard() -> object sdCard; + [19] FormatSdCard(); + [21] DeleteSaveData(nn::ApplicationId tid); + [22] CreateSaveData(nn::fssrv::sf::SaveStruct saveStruct, nn::fssrv::sf::SaveCreateStruct saveCreate, u128 input); + [23] CreateSystemSaveData(nn::fssrv::sf::SaveStruct saveStruct, nn::fssrv::sf::SaveCreateStruct saveCreate); + [24] RegisterSaveDataAtomicDeletion(buffer); + [25] DeleteSaveDataWithSpaceId(u8, u64); + [26] FormatSdCardDryRun(); + [27] IsExFatSupported() -> u8 isSupported; + [30] OpenGameCardPartition(nn::fssrv::sf::Partition partitionID, u32) -> object gameCardFs; + [31] MountGameCardPartition(u32, u32) -> object gameCardPartitionFs; + [32] ExtendSaveData(u8, u64, u64, u64); + [51] MountSaveData(u8 input, nn::fssrv::sf::SaveStruct saveStruct) -> object saveDataFs; + [52] MountSystemSaveData(u8 input, nn::fssrv::sf::SaveStruct saveStruct) -> object systemSaveDataFs; + [53] MountSaveDataReadOnly(u8 input, nn::fssrv::sf::SaveStruct saveStruct) -> object saveDataFs; + [57] ReadSaveDataFileSystemExtraDataWithSpaceId (u8, u64) -> buffer; + [58] ReadSaveDataFileSystemExtraData(u64) -> buffer; + [59] WriteSaveDataFileSystemExtraData(u64, u8, buffer); + [60] OpenSaveDataInfoReader() -> object; + [61] OpenSaveDataIterator(u8) -> object; + [80] OpenSaveDataThumbnailFile(u8, bytes<0x40>, u32) -> object thumbnail; + [100] MountImageDirectory(u32) -> object imageFs; + [110] MountContentStorage(u32 contentStorageID) -> object contentFs; + [200] OpenDataStorageByCurrentProcess() -> object dataStorage; + [201] OpenDataStorageByApplicationId(nn::ApplicationId tid) -> object dataStorage; + [202] OpenDataStorageByDataId(nn::ApplicationId tid, u8 storageId) -> object dataStorage; + [203] OpenRomStorage() -> object; + [400] OpenDeviceOperator() -> object; + [500] OpenSdCardDetectionEventNotifier() -> object SdEventNotify; + [501] OpenGameCardDetectionEventNotifier() -> object GameCardEventNotify; + [600] SetCurrentPosixTime(u64 time); + [601] QuerySaveDataTotalSize(u64, u64) -> u64 saveDataSize; + [602] VerifySaveData(nn::ApplicationId tid) -> buffer; + [603] CorruptSaveDataForDebug(nn::ApplicationId tid); + [604] CreatePaddingFile(u64 size); + [605] DeleteAllPaddingFiles(); + [606] GetRightsId(u64, u8) -> u128 rights; + [607] RegisterExternalKey(u128, u128); + [608] UnregisterExternalKey(); + [609] GetRightsIdByPath(buffer path) -> u128 rights; + [610] GetRightsIdByPath2(buffer path) -> (u128 rights, u8); + [620] SetSdCardEncryptionSeed(u128 seedmaybe); + [800] GetAndClearFileSystemProxyErrorInfo() -> bytes<0x80> errorInfo; + [1000] SetBisRootForHost(u32, buffer path); + [1001] SetSaveDataSize(u64, u64); + [1002] SetSaveDataRootPath(buffer path); + [1003] DisableAutoSaveDataCreation(); + [1004] SetGlobalAccessLogMode(u32 mode); + [1005] GetGlobalAccessLogMode() -> u32 logMode; + [1006] OutputAccessLogToSdCard(buffer logText); +} + +interface nn::fssrv::sf::IStorage { + [0] Read(u64 offset, u64 length) -> buffer buffer; + [1] Write(u64 offset, u64 length, buffer data); + [2] Flush(); + [3] SetSize(u64 size); + [4] GetSize() -> u64 size; +} + +interface nn::fssrv::sf::IFileSystem { + [0] CreateFile(u64 mode, u32 size, buffer path); + [1] DeleteFile(buffer path); + [2] CreateDirectory(buffer path); + [3] DeleteDirectory(buffer path); + [4] DeleteDirectoryRecursively(buffer path); + [5] RenameFile(buffer oldPath, buffer newPath); + [6] RenameDirectory(buffer oldPath, buffer newPath); + [7] GetEntryType(buffer path) -> u32; + [8] OpenFile(u32 mode, buffer path) -> object file; + [9] OpenDirectory(u32, buffer path) -> object directory; + [10] Commit(); + [11] GetFreeSpaceSize(buffer path) -> u64 totalFreeSpace; + [12] GetTotalSpaceSize(buffer path) -> u64 totalSize; + [13] CleanDirectoryRecursively(buffer path); + [14] GetFileTimeStampRaw(buffer path) -> bytes<0x20> timestamp; +} + +interface nn::fssrv::sf::IDeviceOperator { + [0] IsSdCardInserted() -> u8 isSdInserted; + [1] GetSdCardSpeedMode() -> u64 sdSpeed; + [2] GetSdCardCid(u64) -> buffer cid; + [3] GetSdCardUserAreaSize() -> u64 size; + [4] GetSdCardProtectedAreaSize() -> u64 protectedSize; + [5] GetAndClearSdCardErrorInfo(u64) -> (u128, u64, buffer); + [100] GetMmcCid(u64) -> buffer cid; + [101] GetMmcSpeedMode() -> u64 speedMode; + [110] EraseMmc(u32); + [111] GetMmcPartitionSize(u32) -> u64 paritionSize; + [112] GetMmcPatrolCount() -> u32 patrolCount; + [113] GetAndClearMmcErrorInfo(u64) -> (u128, u64, buffer); + [114] GetMmcExtendedCsd(u64) -> buffer; + [200] IsGameCardInserted() -> u8 isGameInserted; + [201] EraseGameCard(u32, u64); + [202] GetGameCardHandle() -> u32 gamecardHandle; + [203] GetGameCardUpdatePartitionInfo(u32) -> (u32 version, nn::ApplicationId TID); + [204] FinalizeGameCardDriver(); + [205] GetGameCardAttribute(u32) -> u8 attribute; + [206] GetGameCardDeviceCertificate(u64, u32) -> buffer certificate; + [207] GetGameCardAsicInfo(u64, u64, buffer) -> buffer; + [208] GetGameCardIdSet(u64) -> buffer; + [209] WriteToGameCard(u64, u64) -> buffer; + [210] SetVerifyWriteEnalbleFlag(u8 flag); + [211] GetGameCardImageHash(u64, u32) -> buffer imageHash; + [212] GetGameCardDeviceIdForProdCard(u64, u64, buffer) -> buffer errorInfo; + [213] EraseAndWriteParamDirectly(u64, buffer); + [214] GetGameCardCid(u64) -> buffer cid; + [215] ForceEraseGameCard(); + [216] GetGameCardErrorInfo() -> u128 errorInfo; + [217] GetGameCardErrorReportInfo() -> bytes<0x40> errorReportInfo; + [218] GetGameCardDeviceId(u64) -> buffer deviceID; + [300] SetSpeedEmulationMode(u32 mode); + [301] GetSpeedEmulationMode() -> u32 emuMode; +} + +interface nn::fssrv::sf::IDirectory { + [0] Read() -> (u64, buffer); + [1] GetEntryCount() -> u64; +} + +interface nn::fssrv::sf::IFile { + [0] Read(u64, u64 offset, u32 size) -> (u64 out_size, buffer out_buf); + [1] Write(u64, u64 offset, u32 size, buffer buf); + [2] Flush(); + [3] SetSize(u64 size); + [4] GetSize() -> u64 fileSize; +} + +// --------------------------------------------- FSP-PR --------------------------------------------- +interface nn::fssrv::sf::IProgramRegistry { + [0] SetFsPermissions(u64, u64, u8, u64, u64, buffer, buffer); + [1] ClearFsPermissions(u64 pid); + [256] SetEnabledProgramVerification(u8 enabled); +} + +// --------------------------------------------- FSP-LDR --------------------------------------------- +interface nn::fssrv::sf::IFileSystemProxyForLoader { + [0] MountCode(nn::ApplicationId TID, buffer contentPath) -> object contentFs; + [1] IsCodeMounted(nn::ApplicationId TID) -> u8 isMounted; +} \ No newline at end of file diff --git a/ipcdefs/general.id b/ipcdefs/general.id new file mode 100644 index 0000000..e69de29 diff --git a/ipcdefs/gpio.id b/ipcdefs/gpio.id new file mode 100644 index 0000000..27b1988 --- /dev/null +++ b/ipcdefs/gpio.id @@ -0,0 +1,28 @@ +interface nn::gpio::IManager is gpio { + [0] Unknown0(u32) -> object; + [1] GetPadSession(u32) -> object; + [2] Unknown2(u32) -> object; + [3] Unknown3(u32) -> u8; + [4] Unknown4() -> u128; + [5] Unknown5(u32, u8); + [6] Unknown6(u8); +} + +interface nn::gpio::IPadSession { + [0] Unknown0(u32); + [1] Unknown1() -> u32; + [2] Unknown2(u32); + [3] Unknown3() -> u32; + [4] Unknown4(u8); + [5] Unknown5() -> u8; + [6] Unknown6() -> u32; + [7] Unknown7(); + [8] Unknown8(u32); + [9] Unknown9() -> u32; + [10] Unknown10() -> KObject; + [11] Unknown11(); + [12] Unknown12(u8); + [13] Unknown13() -> u8; + [14] Unknown14(u32); + [15] Unknown15() -> u32; +} diff --git a/ipcdefs/ldr.id b/ipcdefs/ldr.id new file mode 100644 index 0000000..3a76d31 --- /dev/null +++ b/ipcdefs/ldr.id @@ -0,0 +1,4 @@ +interface nn::ro::detail::ILdrShellInterface is ldr:shel { + [0] AddProcessToLaunchQueue(buffer, u32 size, nn::ncm::ApplicationId appID); + [1] ClearLaunchQueue(); +} diff --git a/ipcdefs/lm.id b/ipcdefs/lm.id new file mode 100644 index 0000000..26a7deb --- /dev/null +++ b/ipcdefs/lm.id @@ -0,0 +1,8 @@ +interface nn::lm::ILogService is lm { + [0] Initialize(u64, pid) -> object Log; +} + +interface nn::lm::ILogger { + [0] Unknown0(buffer); + [1] Unknown1(u32); +} \ No newline at end of file diff --git a/ipcdefs/ncm.id b/ipcdefs/ncm.id new file mode 100644 index 0000000..5b911cc --- /dev/null +++ b/ipcdefs/ncm.id @@ -0,0 +1,24 @@ +interface nn::ncm::detail::INcmInterface4Unknown { + [10] Unknown10(); + [13] Unknown13() -> u64; +} + +interface nn::ncm::detail::INcmInterface5Unknown { + [5] Unknown5() -> u64; + [7] Unknown7() -> u64; + [8] Unknown8(); + + [15] Unknown15(); +} + +interface nn::ncm::detail::INcmInterface is ncm { + [2] Unknown2() -> u64; + [3] Unknown3() -> u64; + [4] Unknown4() -> object; + [5] Unknown5() -> object; + [9] Unknown9() -> u64; + [11] Unknown11() -> u64; +} + +interface nn::ncm::detail::LocationResolverInterface is lr { +} diff --git a/ipcdefs/nim.id b/ipcdefs/nim.id new file mode 100644 index 0000000..9b91f68 --- /dev/null +++ b/ipcdefs/nim.id @@ -0,0 +1,9 @@ +interface nn::nim::detail::INetworkInstallManager is nim { + [2] Unknown2(buffer) -> (u64, u64); + [8] Unknown8() -> (u64, u64); + [40] Unknown40(buffer) -> (u64, u64); +} + +interface nn::nim::detail::IShopServiceManager is nim:shp { + +} diff --git a/ipcdefs/npns.id b/ipcdefs/npns.id new file mode 100644 index 0000000..4104e3d --- /dev/null +++ b/ipcdefs/npns.id @@ -0,0 +1,8 @@ +interface nn::npns::Weird { + +} +interface nn::npns::INpnsSystem is npns:s { + [5] SetInterfaceVersion() -> KObject; + [7] Unknown7() -> KObject; + [103] Unknown103() -> KObject; +} diff --git a/ipcdefs/ovln.id b/ipcdefs/ovln.id new file mode 100644 index 0000000..accb4bf --- /dev/null +++ b/ipcdefs/ovln.id @@ -0,0 +1,3 @@ +interface nn::ovln::ISender is ovln:snd { + [0] Unknown0(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6, u64 unk7, u64 unk8, u64 unk9, u64 unk10, u64 unk11, u64 unk12, u64 unk13, u64 unk14, u64 unk15, u64 unk16, u64 unk17); +} diff --git a/ipcdefs/pm.id b/ipcdefs/pm.id new file mode 100644 index 0000000..e1da2be --- /dev/null +++ b/ipcdefs/pm.id @@ -0,0 +1,9 @@ +interface Pm::Shell is pm:shell { + [0] LaunchTitle(u64, nn::ApplicationId tid); + [3] GetProcessEventWaiter() -> KObject; +} + +interface Pm::Bm is pm:bm { + [0] Init() -> (u64); + [1] EnableMaintenanceMode(); +} diff --git a/ipcdefs/psc.id b/ipcdefs/psc.id new file mode 100644 index 0000000..74914a6 --- /dev/null +++ b/ipcdefs/psc.id @@ -0,0 +1,10 @@ +interface nn::psc::sf::IPmControl is psc:c { +} + +interface nn::psc::sf::IPmModule { + [0] Unknown0(u32, buffer) -> KObject; +} + +interface nn::psc::sf::IPmService is psc:m { + [0] GetIPmModule() -> object; +} diff --git a/ipcdefs/sm.id b/ipcdefs/sm.id new file mode 100644 index 0000000..c01c5f9 --- /dev/null +++ b/ipcdefs/sm.id @@ -0,0 +1,8 @@ +type ServiceName = bytes<8>; + +interface SmService { + [0] Initialize(); + [1] GetService(ServiceName name) -> object; + [2] RegisterService(ServiceName name) -> object; + [3] UnregisterService(ServiceName name); +} diff --git a/ipcimpl/account.cpp b/ipcimpl/account.cpp new file mode 100644 index 0000000..06b2592 --- /dev/null +++ b/ipcimpl/account.cpp @@ -0,0 +1,7 @@ +#include "Ctu.h" + +uint32_t nn::account::detail::INotifier::GetSystemEvent(OUT shared_ptr& _0) { + LOG_INFO(Account, "Stub implementation for nn::account::detail::INotifier::GetSystemEvent"); + _0 = make_shared(); + return 0; +} diff --git a/ipcimpl/bgtc.cpp b/ipcimpl/bgtc.cpp new file mode 100644 index 0000000..49eb291 --- /dev/null +++ b/ipcimpl/bgtc.cpp @@ -0,0 +1,7 @@ +#include "Ctu.h" + +uint32_t nn::bgtc::ITaskService::Unknown14(OUT shared_ptr& _0) { + LOG_DEBUG(IpcStubs, "Stub implementation for nn::bgtc::ITaskService::Unknown14"); + _0 = make_shared(); + return 0; +} diff --git a/ipcimpl/fatal.cpp b/ipcimpl/fatal.cpp new file mode 100644 index 0000000..acc9796 --- /dev/null +++ b/ipcimpl/fatal.cpp @@ -0,0 +1,14 @@ +#include "Ctu.h" + +uint32_t nn::fatalsrv::IService::TransitionToFatalError(IN uint64_t errorCode, IN uint64_t _1, IN uint8_t * errorBuf, guint errorBuf_size, IN gpid _3) { + LOG_DEBUG(Fatal, "!!! FATAL ERROR !!! ERROR CODE: " ADDRFMT, errorCode); + uint64_t stackSize = *(uint64_t *)(&errorBuf[0x240]); + LOG_DEBUG(Fatal, "Stack trace"); + LOG_DEBUG(Fatal, "----------------------------"); + for(uint64_t i = 0; i < stackSize; i++) { + uint64_t addr = *(uint64_t *)(&errorBuf[0x130 + (i*8)]); + LOG_DEBUG(Fatal, "\t[%x] " ADDRFMT, (uint) i, addr); + } + LOG_DEBUG(Fatal, "----------------------------"); + return 0; +} diff --git a/ipcimpl/fsp.cpp b/ipcimpl/fsp.cpp new file mode 100644 index 0000000..f960590 --- /dev/null +++ b/ipcimpl/fsp.cpp @@ -0,0 +1,371 @@ +#include "Ctu.h" + +/*$IPC$ +partial nn::fssrv::sf::IFile { + [ctor] string fn; + [ctor] uint32_t mode; + void *fp; + bool isOpen; + long bufferOffset; +} + +partial nn::fssrv::sf::IFileSystem { + [ctor] string fnPath; +} + +partial nn::fssrv::sf::IStorage { + [ctor] string fn; + void *fp; + bool isOpen; + long bufferOffset; +} +*/ + +/* ---------------------------------------- Start of IFileSystem ---------------------------------------- */ +// Interface +nn::fssrv::sf::IStorage::IStorage(Ctu *_ctu, string _fn) : IpcService(_ctu), fn(_fn) { + fn = "SwitchFS/" + _fn; + LOG_DEBUG(Fsp, "Open IStorage \"%s\"", fn.c_str()); + fp = fopen(fn.c_str(), "r+"); + if(fp) { + isOpen = true; + } else { + LOG_DEBUG(Fsp, "FILE NOT FOUND!"); + isOpen = false; + } + +} + +uint32_t nn::fssrv::sf::IStorage::Flush() { + if(isOpen && fp != nullptr) + fflush((FILE *)fp); + return 0; +} +uint32_t nn::fssrv::sf::IStorage::GetSize(OUT uint64_t& size) { + if(isOpen && fp != nullptr) { + bufferOffset = ftell((FILE *)fp); + fseek((FILE *)fp, 0, SEEK_END); + long fSize = ftell((FILE *)fp); + fseek((FILE *)fp, bufferOffset, SEEK_SET); + size = fSize; + return 0; + } + LOG_DEBUG(Fsp, "Failed to get file size!"); + return 0; +} +uint32_t nn::fssrv::sf::IStorage::Read(IN uint64_t offset, IN uint64_t length, OUT int8_t * buffer, guint buffer_size) { + if(isOpen && fp != nullptr) { + uint32_t s = ((uint32_t)buffer_size < (uint32_t)length ? (uint32_t)buffer_size : (uint32_t)length); + bufferOffset = offset; + fseek((FILE *)fp, offset, SEEK_SET); + fread(buffer, 1, s, (FILE *)fp); + bufferOffset = ftell((FILE *)fp); + } + return 0; +} +uint32_t nn::fssrv::sf::IStorage::SetSize(IN uint64_t size) { + if(isOpen && fp != nullptr) { + fseek((FILE *)fp, 0, SEEK_END); + uint32_t curSize = (uint32_t)ftell((FILE *)fp); + + if(curSize < (uint32_t)size) { + uint32_t remaining = (uint32_t)size-curSize; + char *buf = (char*)malloc(remaining); + memset(buf, 0, remaining); + fwrite(buf, 1, remaining, (FILE *)fp); + free(buf); + } + + fseek((FILE *)fp, bufferOffset, SEEK_SET); + } + return 0; +} +uint32_t nn::fssrv::sf::IStorage::Write(IN uint64_t offset, IN uint64_t length, IN int8_t * data, guint data_size) { + if(isOpen && fp != nullptr) { + bufferOffset = offset; + uint32_t s = ((uint32_t)data_size < (uint32_t)length ? (uint32_t)data_size : (uint32_t)length); + fseek((FILE *)fp, offset, SEEK_SET); + fwrite(data, 1, s, (FILE *)fp); + if(length-s > 0) { + char *buf2 = (char*)malloc(length-s); + memset(buf2, 0, length-s); + fwrite(buf2, 1, length-s, (FILE *)fp); + free(buf2); + } + bufferOffset = ftell((FILE *)fp); + + } + return 0; +} + +// Funcs +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenBisPartition(IN nn::fssrv::sf::Partition partitionID, OUT shared_ptr& BisPartition) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenBisPartition"); + BisPartition = buildInterface(nn::fssrv::sf::IStorage, "bis.istorage"); + return 0x0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByApplicationId(IN nn::ApplicationId tid, OUT shared_ptr& dataStorage) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByApplicationId 0x" ADDRFMT, tid); + std::stringstream ss; + ss << "tid_archives_" << hex << tid << ".istorage"; + dataStorage = buildInterface(nn::fssrv::sf::IStorage, ss.str()); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByCurrentProcess(OUT shared_ptr& dataStorage) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByCurrentProcess"); + LOG_ERROR(Fsp, "UNIMPLEMENTED!!!"); + dataStorage = buildInterface(nn::fssrv::sf::IStorage, ""); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByDataId(IN nn::ApplicationId tid, IN uint8_t storageId, OUT shared_ptr& dataStorage) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataStorageByDataId 0x" ADDRFMT, 0x0100000000000800+(uint64_t)storageId); + std::stringstream ss; + ss << "archives/" << hex << setw(16) << setfill('0') << 0x0100000000000800+(uint64_t)storageId << ".istorage"; + dataStorage = buildInterface(nn::fssrv::sf::IStorage, ss.str()); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenGameCardPartition(IN nn::fssrv::sf::Partition partitionID, IN uint32_t _1, OUT shared_ptr& gameCardFs) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenGameCardPartition"); + gameCardFs = buildInterface(nn::fssrv::sf::IStorage, "GamePartition.istorage"); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenRomStorage(OUT shared_ptr& _0) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenRomStorage"); + _0 = buildInterface(nn::fssrv::sf::IStorage, "RomStorage.istorage"); + return 0; +} + +/* ---------------------------------------- End of IStorage ---------------------------------------- */ + +/* ---------------------------------------- Start of IFileSystem ---------------------------------------- */ +// Interface +nn::fssrv::sf::IFileSystem::IFileSystem(Ctu *_ctu, string _fnPath) : IpcService(_ctu), fnPath(_fnPath) { + fnPath = "SwitchFS/" + _fnPath; + LOG_DEBUG(Fsp, "Open path %s", fnPath.c_str()); +} + +uint32_t nn::fssrv::sf::IFileSystem::DeleteFile(IN int8_t * path, guint path_size) { + LOG_DEBUG(Fsp, "Delete file %s", (fnPath+string((char*)path)).c_str()); + remove((fnPath+string((char*)path)).c_str()); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystem::CreateFile(IN uint64_t mode, IN uint32_t size, IN int8_t * path, guint path_size) { + LOG_DEBUG(Fsp, "Create file %s", (fnPath+string((char*)path)).c_str()); + FILE *fp = fopen((fnPath+string((char*)path)).c_str(), "wb"); + if(!fp) + return 0x7d402; + fclose(fp); + return 0; +} + +// Funcs +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByCurrentProcess(OUT shared_ptr& _0) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByCurrentProcess"); + _0 = buildInterface(nn::fssrv::sf::IFileSystem, ""); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountContent7(IN nn::ApplicationId tid, IN uint32_t ncaType, OUT shared_ptr& _2) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountContent7"); + _2 = buildInterface(nn::fssrv::sf::IFileSystem, ""); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountContent(IN nn::ApplicationId tid, IN uint32_t flag, IN int8_t * path, guint path_size, OUT shared_ptr& contentFs) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountContent"); + contentFs = buildInterface(nn::fssrv::sf::IFileSystem, ""); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByApplicationId(IN nn::ApplicationId tid, OUT shared_ptr& dataFiles) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenDataFileSystemByApplicationId"); + dataFiles = buildInterface(nn::fssrv::sf::IFileSystem, ""); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountBis(IN nn::fssrv::sf::Partition partitionID, IN int8_t * path, guint path_size, OUT shared_ptr& Bis) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountBis"); + Bis = buildInterface(nn::fssrv::sf::IFileSystem, string("BIS/") + to_string(partitionID)); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenHostFileSystemImpl(IN int8_t * path, guint path_size, OUT shared_ptr& _1) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenHostFileSystemImpl"); + _1 = buildInterface(nn::fssrv::sf::IFileSystem, ""); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountSdCard(OUT shared_ptr& sdCard) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSdCard"); + sdCard = buildInterface(nn::fssrv::sf::IFileSystem, "SDCard"); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountGameCardPartition(IN uint32_t _0, IN uint32_t _1, OUT shared_ptr& gameCardPartitionFs) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountGameCardPartition"); + gameCardPartitionFs = buildInterface(nn::fssrv::sf::IFileSystem, "GameCard"); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountSaveData(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr& saveDataFs) { + uint64_t tid = *(uint64_t *)(&saveStruct[0x18]); + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSaveData 0x" ADDRFMT, tid); + std::stringstream ss; + ss << "save_" << hex << tid; + saveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str()); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountSystemSaveData(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr& systemSaveDataFs) { + uint64_t tid = *(uint64_t *)(&saveStruct[0x18]); + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSystemSaveData 0x" ADDRFMT, tid); + std::stringstream ss; + ss << "syssave_" << hex << tid; + systemSaveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str()); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountSaveDataReadOnly(IN uint8_t input, IN nn::fssrv::sf::SaveStruct saveStruct, OUT shared_ptr& saveDataFs) { + uint64_t tid = *(uint64_t *)(&saveStruct[0x18]); + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountSaveDataReadOnly 0x" ADDRFMT, tid); + std::stringstream ss; + ss << "save_" << hex << tid; + saveDataFs = buildInterface(nn::fssrv::sf::IFileSystem, ss.str()); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountImageDirectory(IN uint32_t _0, OUT shared_ptr& imageFs) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountImageDirectory"); + imageFs = buildInterface(nn::fssrv::sf::IFileSystem, string("Image_") + to_string(_0)); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::MountContentStorage(IN uint32_t contentStorageID, OUT shared_ptr& contentFs) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::MountContentStorage"); + contentFs = buildInterface(nn::fssrv::sf::IFileSystem, string("CS_") + to_string(contentStorageID)); + return 0; +} + +uint32_t nn::fssrv::sf::IFileSystemProxyForLoader::MountCode(IN nn::ApplicationId TID, IN int8_t * contentPath, guint contentPath_size, OUT shared_ptr& contentFs) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxyForLoader::MountCode"); + contentFs = buildInterface(nn::fssrv::sf::IFileSystem, ""); + return 0; +} + +/* ---------------------------------------- End of IFileSystem ---------------------------------------- */ + + +/* ---------------------------------------- Start of IFile ---------------------------------------- */ +// Interface +nn::fssrv::sf::IFile::IFile(Ctu *_ctu, string _fn, uint32_t _mode) : IpcService(_ctu), fn(_fn), mode(_mode) { + LOG_DEBUG(Fsp, "IFile: File path \"%s\"", fn.c_str()); + string openModes[] = {"", "rb", "wb+", "wb+", "ab+", "ab+", "ab+", "ab+"}; + fp = fopen(fn.c_str(), openModes[_mode].c_str()); + if(fp) { + isOpen = true; + } else { + LOG_DEBUG(Fsp, "FILE NOT FOUND!"); + isOpen = false; + } +} + +uint32_t nn::fssrv::sf::IFile::GetSize(OUT uint64_t& fileSize) { + if(isOpen && fp != nullptr) { + bufferOffset = ftell((FILE *)fp); + fseek((FILE *)fp, 0, SEEK_END); + long fSize = ftell((FILE *)fp); + fseek((FILE *)fp, bufferOffset, SEEK_SET); + fileSize = fSize; + return 0; + } + LOG_DEBUG(Fsp, "Failed to get file size!"); + return 0; +} + +uint32_t nn::fssrv::sf::IFile::Read(IN uint64_t _0, IN uint64_t offset, IN uint32_t size, OUT uint64_t& out_size, OUT int8_t * out_buf, guint out_buf_size) { + if(isOpen && fp != nullptr) { + uint32_t s = ((uint32_t)out_buf_size < size ? (uint32_t)out_buf_size : size); + bufferOffset = offset; + fseek((FILE *)fp, offset, SEEK_SET); + fread(out_buf, 1, s, (FILE *)fp); + bufferOffset = ftell((FILE *)fp); + out_size = (uint32_t)s; + } + return 0x0; +} + +uint32_t nn::fssrv::sf::IFile::Write(IN uint64_t _0, IN uint64_t offset, IN uint32_t size, IN int8_t * buf, guint buf_size) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFile::Write"); + if(isOpen && fp != nullptr) { + bufferOffset = offset; + uint32_t s = ((uint32_t)buf_size < size ? (uint32_t)buf_size : size); + fseek((FILE *)fp, offset, SEEK_SET); + fwrite(buf, 1, s, (FILE *)fp); + if(size-s > 0) { + char *buf2 = (char*)malloc(size-s); + memset(buf2, 0, size-s); + fwrite(buf2, 1, size-s, (FILE *)fp); + free(buf2); + } + bufferOffset = ftell((FILE *)fp); + + } + return 0; +} + +uint32_t nn::fssrv::sf::IFile::Flush() { + if(isOpen && fp != nullptr) + fflush((FILE *)fp); + return 0; +} + +uint32_t nn::fssrv::sf::IFile::SetSize(IN uint64_t size) { + if(isOpen && fp != nullptr) { + fseek((FILE *)fp, 0, SEEK_END); + uint32_t curSize = (uint32_t)ftell((FILE *)fp); + + if(curSize < (uint32_t)size) { + uint32_t remaining = (uint32_t)size-curSize; + char *buf = (char*)malloc(remaining); + memset(buf, 0, remaining); + fwrite(buf, 1, remaining, (FILE *)fp); + free(buf); + } + + fseek((FILE *)fp, bufferOffset, SEEK_SET); + } + return 0; +} + +// Funcs +uint32_t nn::fssrv::sf::IFileSystem::OpenFile(IN uint32_t mode, IN int8_t * path, guint path_size, OUT shared_ptr& file) { + LOG_DEBUG(Fsp, "OpenFile %s", path); + auto tempi = buildInterface(nn::fssrv::sf::IFile, fnPath + "/" + string((char*)path), mode); + if(tempi->isOpen) { + file = tempi; + return 0; + } else + return 0x7d402; +} + +uint32_t nn::fssrv::sf::IFileSystemProxy::OpenSaveDataThumbnailFile(IN uint8_t _0, IN uint8_t * _1, IN uint32_t _2, OUT shared_ptr& thumbnail) { + LOG_DEBUG(Fsp, "Stub implementation for nn::fssrv::sf::IFileSystemProxy::OpenSaveDataThumbnailFile"); + thumbnail = buildInterface(nn::fssrv::sf::IFile, string((char*)_1), _0); + return 0; +} + + +/* ---------------------------------------- End of IFile ---------------------------------------- */ + + +uint32_t nn::fssrv::sf::IEventNotifier::Unknown0(OUT shared_ptr& _0) { + LOG_DEBUG(IpcStubs, "Stub implementation for nn::fssrv::sf::IEventNotifier::Unknown0"); + _0 = make_shared(); + return 0; +} diff --git a/ipcimpl/nim.cpp b/ipcimpl/nim.cpp new file mode 100644 index 0000000..8e03556 --- /dev/null +++ b/ipcimpl/nim.cpp @@ -0,0 +1,9 @@ +#include "Ctu.h" + +uint32_t nn::nim::detail::INetworkInstallManager::Unknown40(IN uint8_t * _0, guint _0_size, OUT uint64_t& _1, OUT uint64_t& _2) { + LOG_DEBUG(IpcStubs, "Stub implementation for nn::nim::detail::INetworkInstallManager::Unknown40"); + memset(_0, 0xDE, _0_size); + _1 = 0; + _2 = 0; + return 0; +} diff --git a/ipcimpl/pm.cpp b/ipcimpl/pm.cpp new file mode 100644 index 0000000..76f5fa4 --- /dev/null +++ b/ipcimpl/pm.cpp @@ -0,0 +1,12 @@ +#include "Ctu.h" + +uint32_t Pm::Shell::LaunchTitle(IN uint64_t _0, IN nn::ApplicationId tid) { + LOG_DEBUG(Pm::Shell, "Attempted to launch title " ADDRFMT, tid); + return 0; +} + +uint32_t Pm::Shell::GetProcessEventWaiter(OUT shared_ptr& _0) { + LOG_DEBUG(IpcStubs, "Stub implementation for Pm::Shell::GetProcessEventWaiter"); + _0 = make_shared(); + return 0; +} diff --git a/ipcimpl/psc.cpp b/ipcimpl/psc.cpp new file mode 100644 index 0000000..6d20e8b --- /dev/null +++ b/ipcimpl/psc.cpp @@ -0,0 +1,7 @@ +#include "Ctu.h" + +uint32_t nn::psc::sf::IPmModule::Unknown0(IN uint32_t _0, IN uint8_t * _1, guint _1_size, OUT shared_ptr& _2) { + LOG_DEBUG(IpcStubs, "Stub implementation for nn::psc::sf::IPmModule::Unknown0"); + _2 = make_shared(); + return 0; +} diff --git a/ipcimpl/set.cpp b/ipcimpl/set.cpp new file mode 100644 index 0000000..f62982b --- /dev/null +++ b/ipcimpl/set.cpp @@ -0,0 +1,15 @@ +#include "Ctu.h" + +uint32_t nn::settings::ISystemSettingsServer::GetSettingsItemValue(IN nn::settings::SettingsName* cls, guint cls_size, IN nn::settings::SettingsItemKey* key, guint key_size, OUT uint64_t& size, OUT uint8_t* data, guint data_size) { + LOG_DEBUG(Settings, "Attempting to read setting %s!%s", cls, key); + memset(data, 0, data_size); + size = data_size; + return 0; +} + +uint32_t nn::settings::ISystemSettingsServer::GetMiiAuthorId(OUT nn::util::Uuid& _0) { + auto buf = (uint64_t *) &_0; + buf[0] = 0xdeadbeefcafebabe; + buf[1] = 0x000000d00db3c001; + return 0; +} diff --git a/ipcimpl/sm.cpp b/ipcimpl/sm.cpp new file mode 100644 index 0000000..7681162 --- /dev/null +++ b/ipcimpl/sm.cpp @@ -0,0 +1,34 @@ +#include "Ctu.h" + +/*$IPC$ +partial SmService { + unordered_map> ports; +} +*/ + +uint32_t SmService::Initialize() { + return 0; +} + +#define SERVICE(str, iface) do { if(name == (str)) { svc = buildInterface(iface); return 0; } } while(0) + +uint32_t SmService::GetService(IN ServiceName _name, OUT shared_ptr& svc) { + string name((char *) _name, strnlen((char *) _name, 8)); + + if(ports.find(name) != ports.end()) { + LOG_DEBUG(Sm, "Connecting to native IPC service!"); + svc = ports[name]->connectSync(); + return 0; + } + SERVICE_MAPPING(); + + LOG_ERROR(Sm, "Unknown service name %s", name.c_str()); +} + +uint32_t SmService::RegisterService(IN ServiceName _name, OUT shared_ptr& port) { + string name((char *) _name, strnlen((char *) _name, 8)); + LOG_DEBUG(Sm, "Registering service %s", name.c_str()); + port = buildInterface(NPort, name); + ports[name] = port; + return 0; +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..69e9c8a --- /dev/null +++ b/main.cpp @@ -0,0 +1,128 @@ +#include "Ctu.h" + +struct Arg: public option::Arg +{ + static void printError(const char* msg1, const option::Option& opt, const char* msg2) + { + fprintf(stderr, "%s", msg1); + fwrite(opt.name, opt.namelen, 1, stderr); + fprintf(stderr, "%s", msg2); + } + static option::ArgStatus Unknown(const option::Option& option, bool msg) + { + if (msg) printError("Unknown option '", option, "'\n"); + return option::ARG_ILLEGAL; + } + static option::ArgStatus Required(const option::Option& option, bool msg) + { + if (option.arg != nullptr) + return option::ARG_OK; + if (msg) printError("Option '", option, "' requires an argument\n"); + return option::ARG_ILLEGAL; + } + static option::ArgStatus NonEmpty(const option::Option& option, bool msg) + { + if (option.arg != nullptr && option.arg[0] != 0) + return option::ARG_OK; + if (msg) printError("Option '", option, "' requires a non-empty argument\n"); + return option::ARG_ILLEGAL; + } + static option::ArgStatus Numeric(const option::Option& option, bool msg) + { + char* endptr = nullptr; + if (option.arg != nullptr && strtol(option.arg, &endptr, 10)){}; + if (endptr != option.arg && *endptr == 0) + return option::ARG_OK; + if (msg) printError("Option '", option, "' requires a numeric argument\n"); + return option::ARG_ILLEGAL; + } +}; + +enum optionIndex { UNKNOWN, HELP, ENABLE_GDB, PORT, NSO }; +const option::Descriptor usage[] = +{ + {UNKNOWN, 0, "", "",Arg::None, "USAGE: ctu [options] \n\n" + "Options:" }, + {HELP, 0,"","help",Arg::None, " --help \tUnsurprisingly, print this message." }, + {ENABLE_GDB, 0,"g","enable-gdb",Arg::None, " --enable-gdb, -g \tEnable GDB stub." }, + {PORT, 0,"p","gdb-port",Arg::Numeric, " --gdb-port, -p \tSet port for GDB; default 24689." }, + {NSO, 0,"","load-nso",Arg::NonEmpty, " --load-nso \tLoad an NSO without load directory"}, + {0,0,nullptr,nullptr,nullptr,nullptr} +}; + +bool exists(string fn) { + struct stat buffer; + return stat(fn.c_str(), &buffer) == 0; +} + +void loadNso(Ctu &ctu, const string &lfn, gptr raddr) { + assert(exists(lfn)); + Nso file(lfn); + file.load(ctu, raddr, false); + ctu.loadbase = min(raddr, ctu.loadbase); + auto top = raddr + 0x100000000; + ctu.loadsize = max(top - ctu.loadbase, ctu.loadsize); +} + +void runLisp(Ctu &ctu, const string &dir, shared_ptr code) { + assert(code->type == List && code->children.size() >= 1); + auto head = code->children[0]; + assert(head->type == Symbol); + if(head->strVal == "load-nso") { + assert(code->children.size() == 3); + auto fn = code->children[1], addr = code->children[2]; + assert(fn->type == String && addr->type == Number); + auto raddr = addr->numVal; + auto lfn = dir + "/" + fn->strVal; + loadNso(ctu, lfn, raddr); + } else if(head->strVal == "run-from") { + assert(code->children.size() == 2 && code->children[1]->type == Number); + ctu.execProgram(code->children[1]->numVal); + } else + LOG_ERROR(Main, "Unknown function in load script: '%s'", head->strVal.c_str()); +} + +int main(int argc, char **argv) { + argc -= argc > 0; + argv += argc > 0; + + option::Stats stats(usage, argc, argv); + vector options(stats.options_max); + vector buffer(stats.buffer_max); + option::Parser parse(usage, argc, argv, &options[0], &buffer[0]); + + if(parse.error()) + return 1; + else if(options[HELP].count() || options[UNKNOWN].count() || (options[NSO].count() == 0 && parse.nonOptionsCount() != 1) || (options[NSO].count() == 1 && parse.nonOptionsCount() != 0)) { + option::printUsage(cout, usage); + return 0; + } + + Ctu ctu; + ctu.loadbase = 0xFFFFFFFFFFFFFFFF; + ctu.loadsize = 0; + + if(options[ENABLE_GDB].count()) { + ctu.gdbStub.enable(options[PORT].count() == 0 ? 24689 : (uint16_t) atoi(options[PORT][0].arg)); + } else + assert(options[PORT].count() == 0); + + if(options[NSO].count()) { + loadNso(ctu, options[NSO][0].arg, 0x7100000000); + ctu.execProgram(0x7100000000); + } else { + string dir = parse.nonOption(0); + auto lfn = dir + "/load.meph"; + if(!exists(lfn)) + LOG_ERROR(Main, "File does not exist: %s", lfn.c_str()); + auto fp = ifstream(lfn); + auto code = string(istreambuf_iterator(fp), istreambuf_iterator()); + + auto atom = parseLisp(code); + assert(atom->type == List); + for(auto elem : atom->children) + runLisp(ctu, dir, elem); + } + + return 0; +} diff --git a/optionparser.h b/optionparser.h new file mode 100644 index 0000000..924a1d3 --- /dev/null +++ b/optionparser.h @@ -0,0 +1,2832 @@ +/* + * The Lean Mean C++ Option Parser + * + * Copyright (C) 2012-2017 Matthias S. Benkmann + * + * The "Software" in the following 2 paragraphs refers to this file containing + * the code to The Lean Mean C++ Option Parser. + * The "Software" does NOT refer to any other files which you + * may have received alongside this file (e.g. as part of a larger project that + * incorporates The Lean Mean C++ Option Parser). + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software, to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the following + * conditions: + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * NOTE: It is recommended that you read the processed HTML doxygen documentation + * rather than this source. If you don't know doxygen, it's like javadoc for C++. + * If you don't want to install doxygen you can find a copy of the processed + * documentation at + * + * http://optionparser.sourceforge.net/ + * + */ + +/** + * @file + * + * @brief This is the only file required to use The Lean Mean C++ Option Parser. + * Just \#include it and you're set. + * + * The Lean Mean C++ Option Parser handles the program's command line arguments + * (argc, argv). + * It supports the short and long option formats of getopt(), getopt_long() + * and getopt_long_only() but has a more convenient interface. + * + * @par Feedback: + * Send questions, bug reports, feature requests etc. to: optionparser-feedback(a)lists.sourceforge.net + * + * @par Highlights: + *
    + *
  • It is a header-only library. Just \#include "optionparser.h" and you're set. + *
  • It is freestanding. There are no dependencies whatsoever, not even the + * C or C++ standard library. + *
  • It has a usage message formatter that supports column alignment and + * line wrapping. This aids localization because it adapts to + * translated strings that are shorter or longer (even if they contain + * Asian wide characters). + *
  • Unlike getopt() and derivatives it doesn't force you to loop through + * options sequentially. Instead you can access options directly like this: + *
      + *
    • Test for presence of a switch in the argument vector: + * @code if ( options[QUIET] ) ... @endcode + *
    • Evaluate --enable-foo/--disable-foo pair where the last one used wins: + * @code if ( options[FOO].last()->type() == DISABLE ) ... @endcode + *
    • Cumulative option (-v verbose, -vv more verbose, -vvv even more verbose): + * @code int verbosity = options[VERBOSE].count(); @endcode + *
    • Iterate over all --file=<fname> arguments: + * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) + * fname = opt->arg; ... @endcode + *
    • If you really want to, you can still process all arguments in order: + * @code + * for (int i = 0; i < p.optionsCount(); ++i) { + * Option& opt = buffer[i]; + * switch(opt.index()) { + * case HELP: ... + * case VERBOSE: ... + * case FILE: fname = opt.arg; ... + * case UNKNOWN: ... + * @endcode + *
    + *
@n + * Despite these features the code size remains tiny. + * It is smaller than uClibc's GNU getopt() and just a + * couple 100 bytes larger than uClibc's SUSv3 getopt(). @n + * (This does not include the usage formatter, of course. But you don't have to use that.) + * + * @par Download: + * Tarball with examples and test programs: + * optionparser-1.6.tar.gz @n + * Just the header (this is all you really need): + * optionparser.h + * + * @par Changelog: + * Version 1.6: Fix for MSC compiler. @n + * Version 1.5: Fixed 2 warnings about potentially uninitialized variables. @n + * Added const version of Option::next(). @n + * Version 1.4: Fixed 2 printUsage() bugs that messed up output with small COLUMNS values. @n + * Version 1.3: Compatible with Microsoft Visual C++. @n + * Version 1.2: Added @ref option::Option::namelen "Option::namelen" and removed the extraction + * of short option characters into a special buffer. @n + * Changed @ref option::Arg::Optional "Arg::Optional" to accept arguments if they are attached + * rather than separate. This is what GNU getopt() does and how POSIX recommends + * utilities should interpret their arguments.@n + * Version 1.1: Optional mode with argument reordering as done by GNU getopt(), so that + * options and non-options can be mixed. See + * @ref option::Parser::parse() "Parser::parse()". + * + * + * @par Example program: + * (Note: @c option::* identifiers are links that take you to their documentation.) + * @code + * #error EXAMPLE SHORTENED FOR READABILITY. BETTER EXAMPLES ARE IN THE .TAR.GZ! + * #include + * #include "optionparser.h" + * + * enum optionIndex { UNKNOWN, HELP, PLUS }; + * const option::Descriptor usage[] = + * { + * {UNKNOWN, 0,"" , "" ,option::Arg::None, "USAGE: example [options]\n\n" + * "Options:" }, + * {HELP, 0,"" , "help",option::Arg::None, " --help \tPrint usage and exit." }, + * {PLUS, 0,"p", "plus",option::Arg::None, " --plus, -p \tIncrement count." }, + * {UNKNOWN, 0,"" , "" ,option::Arg::None, "\nExamples:\n" + * " example --unknown -- --this_is_no_option\n" + * " example -unk --plus -ppp file1 file2\n" }, + * {0,0,0,0,0,0} + * }; + * + * int main(int argc, char* argv[]) + * { + * argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present + * option::Stats stats(usage, argc, argv); + * option::Option options[stats.options_max], buffer[stats.buffer_max]; + * option::Parser parse(usage, argc, argv, options, buffer); + * + * if (parse.error()) + * return 1; + * + * if (options[HELP] || argc == 0) { + * option::printUsage(std::cout, usage); + * return 0; + * } + * + * std::cout << "--plus count: " << + * options[PLUS].count() << "\n"; + * + * for (option::Option* opt = options[UNKNOWN]; opt; opt = opt->next()) + * std::cout << "Unknown option: " << opt->name << "\n"; + * + * for (int i = 0; i < parse.nonOptionsCount(); ++i) + * std::cout << "Non-option #" << i << ": " << parse.nonOption(i) << "\n"; + * } + * @endcode + * + * @par Option syntax: + * @li The Lean Mean C++ Option Parser follows POSIX getopt() conventions and supports + * GNU-style getopt_long() long options as well as Perl-style single-minus + * long options (getopt_long_only()). + * @li short options have the format @c -X where @c X is any character that fits in a char. + * @li short options can be grouped, i.e. -X -Y is equivalent to @c -XY. + * @li a short option may take an argument either separate (-X foo) or + * attached (@c -Xfoo). You can make the parser accept the additional format @c -X=foo by + * registering @c X as a long option (in addition to being a short option) and + * enabling single-minus long options. + * @li an argument-taking short option may be grouped if it is the last in the group, e.g. + * @c -ABCXfoo or -ABCX foo (@c foo is the argument to the @c -X option). + * @li a lone minus character @c '-' is not treated as an option. It is customarily used where + * a file name is expected to refer to stdin or stdout. + * @li long options have the format @c --option-name. + * @li the option-name of a long option can be anything and include any characters. + * Even @c = characters will work, but don't do that. + * @li [optional] long options may be abbreviated as long as the abbreviation is unambiguous. + * You can set a minimum length for abbreviations. + * @li [optional] long options may begin with a single minus. The double minus form is always + * accepted, too. + * @li a long option may take an argument either separate ( --option arg ) or + * attached ( --option=arg ). In the attached form the equals sign is mandatory. + * @li an empty string can be passed as an attached long option argument: --option-name= . + * Note the distinction between an empty string as argument and no argument at all. + * @li an empty string is permitted as separate argument to both long and short options. + * @li Arguments to both short and long options may start with a @c '-' character. E.g. + * -X-X , -X -X or --long-X=-X . If @c -X + * and @c --long-X take an argument, that argument will be @c "-X" in all 3 cases. + * @li If using the built-in @ref option::Arg::Optional "Arg::Optional", optional arguments must + * be attached. + * @li the special option @c -- (i.e. without a name) terminates the list of + * options. Everything that follows is a non-option argument, even if it starts with + * a @c '-' character. The @c -- itself will not appear in the parse results. + * @li the first argument that doesn't start with @c '-' or @c '--' and does not belong to + * a preceding argument-taking option, will terminate the option list and is the + * first non-option argument. All following command line arguments are treated as + * non-option arguments, even if they start with @c '-' . @n + * NOTE: This behaviour is mandated by POSIX, but GNU getopt() only honours this if it is + * explicitly requested (e.g. by setting POSIXLY_CORRECT). @n + * You can enable the GNU behaviour by passing @c true as first argument to + * e.g. @ref option::Parser::parse() "Parser::parse()". + * @li Arguments that look like options (i.e. @c '-' followed by at least 1 character) but + * aren't, are NOT treated as non-option arguments. They are treated as unknown options and + * are collected into a list of unknown options for error reporting. @n + * This means that in order to pass a first non-option + * argument beginning with the minus character it is required to use the + * @c -- special option, e.g. + * @code + * program -x -- --strange-filename + * @endcode + * In this example, @c --strange-filename is a non-option argument. If the @c -- + * were omitted, it would be treated as an unknown option. @n + * See @ref option::Descriptor::longopt for information on how to collect unknown options. + * + */ + +#ifndef OPTIONPARSER_H_ +#define OPTIONPARSER_H_ + +#ifdef _MSC_VER +#include +#pragma intrinsic(_BitScanReverse) +#endif + +/** @brief The namespace of The Lean Mean C++ Option Parser. */ +namespace option +{ + +#ifdef _MSC_VER +struct MSC_Builtin_CLZ +{ + static int builtin_clz(unsigned x) + { + unsigned long index; + _BitScanReverse(&index, x); + return 32-index; // int is always 32bit on Windows, even for target x64 + } +}; +#define __builtin_clz(x) MSC_Builtin_CLZ::builtin_clz(x) +#endif + +class Option; + +/** + * @brief Possible results when checking if an argument is valid for a certain option. + * + * In the case that no argument is provided for an option that takes an + * optional argument, return codes @c ARG_OK and @c ARG_IGNORE are equivalent. + */ +enum ArgStatus +{ + //! The option does not take an argument. + ARG_NONE, + //! The argument is acceptable for the option. + ARG_OK, + //! The argument is not acceptable but that's non-fatal because the option's argument is optional. + ARG_IGNORE, + //! The argument is not acceptable and that's fatal. + ARG_ILLEGAL +}; + +/** + * @brief Signature of functions that check if an argument is valid for a certain type of option. + * + * Every Option has such a function assigned in its Descriptor. + * @code + * Descriptor usage[] = { {UNKNOWN, 0, "", "", Arg::None, ""}, ... }; + * @endcode + * + * A CheckArg function has the following signature: + * @code ArgStatus CheckArg(const Option& option, bool msg); @endcode + * + * It is used to check if a potential argument would be acceptable for the option. + * It will even be called if there is no argument. In that case @c option.arg will be @c NULL. + * + * If @c msg is @c true and the function determines that an argument is not acceptable and + * that this is a fatal error, it should output a message to the user before + * returning @ref ARG_ILLEGAL. If @c msg is @c false the function should remain silent (or you + * will get duplicate messages). + * + * See @ref ArgStatus for the meaning of the return values. + * + * While you can provide your own functions, + * often the following pre-defined checks (which never return @ref ARG_ILLEGAL) will suffice: + * + * @li @c Arg::None @copybrief Arg::None + * @li @c Arg::Optional @copybrief Arg::Optional + * + */ +typedef ArgStatus (*CheckArg)(const Option& option, bool msg); + +/** + * @brief Describes an option, its help text (usage) and how it should be parsed. + * + * The main input when constructing an option::Parser is an array of Descriptors. + + * @par Example: + * @code + * enum OptionIndex {CREATE, ...}; + * enum OptionType {DISABLE, ENABLE, OTHER}; + * + * const option::Descriptor usage[] = { + * { CREATE, // index + * OTHER, // type + * "c", // shortopt + * "create", // longopt + * Arg::None, // check_arg + * "--create Tells the program to create something." // help + * } + * , ... + * }; + * @endcode + */ +struct Descriptor +{ + /** + * @brief Index of this option's linked list in the array filled in by the parser. + * + * Command line options whose Descriptors have the same index will end up in the same + * linked list in the order in which they appear on the command line. If you have + * multiple long option aliases that refer to the same option, give their descriptors + * the same @c index. + * + * If you have options that mean exactly opposite things + * (e.g. @c --enable-foo and @c --disable-foo ), you should also give them the same + * @c index, but distinguish them through different values for @ref type. + * That way they end up in the same list and you can just take the last element of the + * list and use its type. This way you get the usual behaviour where switches later + * on the command line override earlier ones without having to code it manually. + * + * @par Tip: + * Use an enum rather than plain ints for better readability, as shown in the example + * at Descriptor. + */ + const unsigned index; + + /** + * @brief Used to distinguish between options with the same @ref index. + * See @ref index for details. + * + * It is recommended that you use an enum rather than a plain int to make your + * code more readable. + */ + const int type; + + /** + * @brief Each char in this string will be accepted as a short option character. + * + * The string must not include the minus character @c '-' or you'll get undefined + * behaviour. + * + * If this Descriptor should not have short option characters, use the empty + * string "". NULL is not permitted here! + * + * See @ref longopt for more information. + */ + const char* const shortopt; + + /** + * @brief The long option name (without the leading @c -- ). + * + * If this Descriptor should not have a long option name, use the empty + * string "". NULL is not permitted here! + * + * While @ref shortopt allows multiple short option characters, each + * Descriptor can have only a single long option name. If you have multiple + * long option names referring to the same option use separate Descriptors + * that have the same @ref index and @ref type. You may repeat + * short option characters in such an alias Descriptor but there's no need to. + * + * @par Dummy Descriptors: + * You can use dummy Descriptors with an + * empty string for both @ref shortopt and @ref longopt to add text to + * the usage that is not related to a specific option. See @ref help. + * The first dummy Descriptor will be used for unknown options (see below). + * + * @par Unknown Option Descriptor: + * The first dummy Descriptor in the list of Descriptors, + * whose @ref shortopt and @ref longopt are both the empty string, will be used + * as the Descriptor for unknown options. An unknown option is a string in + * the argument vector that is not a lone minus @c '-' but starts with a minus + * character and does not match any Descriptor's @ref shortopt or @ref longopt. @n + * Note that the dummy descriptor's @ref check_arg function @e will be called and + * its return value will be evaluated as usual. I.e. if it returns @ref ARG_ILLEGAL + * the parsing will be aborted with Parser::error()==true. @n + * if @c check_arg does not return @ref ARG_ILLEGAL the descriptor's + * @ref index @e will be used to pick the linked list into which + * to put the unknown option. @n + * If there is no dummy descriptor, unknown options will be dropped silently. + * + */ + const char* const longopt; + + /** + * @brief For each option that matches @ref shortopt or @ref longopt this function + * will be called to check a potential argument to the option. + * + * This function will be called even if there is no potential argument. In that case + * it will be passed @c NULL as @c arg parameter. Do not confuse this with the empty + * string. + * + * See @ref CheckArg for more information. + */ + const CheckArg check_arg; + + /** + * @brief The usage text associated with the options in this Descriptor. + * + * You can use option::printUsage() to format your usage message based on + * the @c help texts. You can use dummy Descriptors where + * @ref shortopt and @ref longopt are both the empty string to add text to + * the usage that is not related to a specific option. + * + * See option::printUsage() for special formatting characters you can use in + * @c help to get a column layout. + * + * @attention + * Must be UTF-8-encoded. If your compiler supports C++11 you can use the "u8" + * prefix to make sure string literals are properly encoded. + */ + const char* help; +}; + +/** + * @brief A parsed option from the command line together with its argument if it has one. + * + * The Parser chains all parsed options with the same Descriptor::index together + * to form a linked list. This allows you to easily implement all of the common ways + * of handling repeated options and enable/disable pairs. + * + * @li Test for presence of a switch in the argument vector: + * @code if ( options[QUIET] ) ... @endcode + * @li Evaluate --enable-foo/--disable-foo pair where the last one used wins: + * @code if ( options[FOO].last()->type() == DISABLE ) ... @endcode + * @li Cumulative option (-v verbose, -vv more verbose, -vvv even more verbose): + * @code int verbosity = options[VERBOSE].count(); @endcode + * @li Iterate over all --file=<fname> arguments: + * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) + * fname = opt->arg; ... @endcode + */ +class Option +{ + Option* next_; + Option* prev_; +public: + /** + * @brief Pointer to this Option's Descriptor. + * + * Remember that the first dummy descriptor (see @ref Descriptor::longopt) is used + * for unknown options. + * + * @attention + * @c desc==NULL signals that this Option is unused. This is the default state of + * elements in the result array. You don't need to test @c desc explicitly. You + * can simply write something like this: + * @code + * if (options[CREATE]) + * { + * ... + * } + * @endcode + * This works because of operator const Option*() . + */ + const Descriptor* desc; + + /** + * @brief The name of the option as used on the command line. + * + * The main purpose of this string is to be presented to the user in messages. + * + * In the case of a long option, this is the actual @c argv pointer, i.e. the first + * character is a '-'. In the case of a short option this points to the option + * character within the @c argv string. + * + * Note that in the case of a short option group or an attached option argument, this + * string will contain additional characters following the actual name. Use @ref namelen + * to filter out the actual option name only. + * + */ + const char* name; + + /** + * @brief Pointer to this Option's argument (if any). + * + * NULL if this option has no argument. Do not confuse this with the empty string which + * is a valid argument. + */ + const char* arg; + + /** + * @brief The length of the option @ref name. + * + * Because @ref name points into the actual @c argv string, the option name may be + * followed by more characters (e.g. other short options in the same short option group). + * This value is the number of bytes (not characters!) that are part of the actual name. + * + * For a short option, this length is always 1. For a long option this length is always + * at least 2 if single minus long options are permitted and at least 3 if they are disabled. + * + * @note + * In the pathological case of a minus within a short option group (e.g. @c -xf-z), this + * length is incorrect, because this case will be misinterpreted as a long option and the + * name will therefore extend to the string's 0-terminator or a following '=" character + * if there is one. This is irrelevant for most uses of @ref name and @c namelen. If you + * really need to distinguish the case of a long and a short option, compare @ref name to + * the @c argv pointers. A long option's @c name is always identical to one of them, + * whereas a short option's is never. + */ + int namelen; + + /** + * @brief Returns Descriptor::type of this Option's Descriptor, or 0 if this Option + * is invalid (unused). + * + * Because this method (and last(), too) can be used even on unused Options with desc==0, you can (provided + * you arrange your types properly) switch on type() without testing validity first. + * @code + * enum OptionType { UNUSED=0, DISABLED=0, ENABLED=1 }; + * enum OptionIndex { FOO }; + * const Descriptor usage[] = { + * { FOO, ENABLED, "", "enable-foo", Arg::None, 0 }, + * { FOO, DISABLED, "", "disable-foo", Arg::None, 0 }, + * { 0, 0, 0, 0, 0, 0 } }; + * ... + * switch(options[FOO].last()->type()) // no validity check required! + * { + * case ENABLED: ... + * case DISABLED: ... // UNUSED==DISABLED ! + * } + * @endcode + */ + int type() const + { + return desc == nullptr ? 0 : desc->type; + } + + /** + * @brief Returns Descriptor::index of this Option's Descriptor, or -1 if this Option + * is invalid (unused). + */ + int index() const + { + return desc == nullptr ? -1 : (int)desc->index; + } + + /** + * @brief Returns the number of times this Option (or others with the same Descriptor::index) + * occurs in the argument vector. + * + * This corresponds to the number of elements in the linked list this Option is part of. + * It doesn't matter on which element you call count(). The return value is always the same. + * + * Use this to implement cumulative options, such as -v, -vv, -vvv for + * different verbosity levels. + * + * Returns 0 when called for an unused/invalid option. + */ + int count() + { + int c = (desc == nullptr ? 0 : 1); + Option* p = first(); + while (!p->isLast()) + { + ++c; + p = p->next_; + }; + return c; + } + + /** + * @brief Returns true iff this is the first element of the linked list. + * + * The first element in the linked list is the first option on the command line + * that has the respective Descriptor::index value. + * + * Returns true for an unused/invalid option. + */ + bool isFirst() const + { + return isTagged(prev_); + } + + /** + * @brief Returns true iff this is the last element of the linked list. + * + * The last element in the linked list is the last option on the command line + * that has the respective Descriptor::index value. + * + * Returns true for an unused/invalid option. + */ + bool isLast() const + { + return isTagged(next_); + } + + /** + * @brief Returns a pointer to the first element of the linked list. + * + * Use this when you want the first occurrence of an option on the command line to + * take precedence. Note that this is not the way most programs handle options. + * You should probably be using last() instead. + * + * @note + * This method may be called on an unused/invalid option and will return a pointer to the + * option itself. + */ + Option* first() + { + Option* p = this; + while (!p->isFirst()) + p = p->prev_; + return p; + } + + /** + * @brief Returns a pointer to the last element of the linked list. + * + * Use this when you want the last occurrence of an option on the command line to + * take precedence. This is the most common way of handling conflicting options. + * + * @note + * This method may be called on an unused/invalid option and will return a pointer to the + * option itself. + * + * @par Tip: + * If you have options with opposite meanings (e.g. @c --enable-foo and @c --disable-foo), you + * can assign them the same Descriptor::index to get them into the same list. Distinguish them by + * Descriptor::type and all you have to do is check last()->type() to get + * the state listed last on the command line. + */ + Option* last() + { + return first()->prevwrap(); + } + + /** + * @brief Returns a pointer to the previous element of the linked list or NULL if + * called on first(). + * + * If called on first() this method returns NULL. Otherwise it will return the + * option with the same Descriptor::index that precedes this option on the command + * line. + */ + Option* prev() + { + return isFirst() ? nullptr : prev_; + } + + /** + * @brief Returns a pointer to the previous element of the linked list with wrap-around from + * first() to last(). + * + * If called on first() this method returns last(). Otherwise it will return the + * option with the same Descriptor::index that precedes this option on the command + * line. + */ + Option* prevwrap() + { + return untag(prev_); + } + + /** + * @brief Returns a pointer to the next element of the linked list or NULL if called + * on last(). + * + * If called on last() this method returns NULL. Otherwise it will return the + * option with the same Descriptor::index that follows this option on the command + * line. + */ + Option* next() + { + return isLast() ? nullptr : next_; + } + + /** + * const version of Option::next(). + */ + const Option* next() const + { + return isLast() ? nullptr : next_; + } + + /** + * @brief Returns a pointer to the next element of the linked list with wrap-around from + * last() to first(). + * + * If called on last() this method returns first(). Otherwise it will return the + * option with the same Descriptor::index that follows this option on the command + * line. + */ + Option* nextwrap() + { + return untag(next_); + } + + /** + * @brief Makes @c new_last the new last() by chaining it into the list after last(). + * + * It doesn't matter which element you call append() on. The new element will always + * be appended to last(). + * + * @attention + * @c new_last must not yet be part of a list, or that list will become corrupted, because + * this method does not unchain @c new_last from an existing list. + */ + void append(Option* new_last) + { + Option* p = last(); + Option* f = first(); + p->next_ = new_last; + new_last->prev_ = p; + new_last->next_ = tag(f); + f->prev_ = tag(new_last); + } + + /** + * @brief Casts from Option to const Option* but only if this Option is valid. + * + * If this Option is valid (i.e. @c desc!=NULL), returns this. + * Otherwise returns NULL. This allows testing an Option directly + * in an if-clause to see if it is used: + * @code + * if (options[CREATE]) + * { + * ... + * } + * @endcode + * It also allows you to write loops like this: + * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) + * fname = opt->arg; ... @endcode + */ + operator const Option*() const + { + return desc ? this : nullptr; + } + + /** + * @brief Casts from Option to Option* but only if this Option is valid. + * + * If this Option is valid (i.e. @c desc!=NULL), returns this. + * Otherwise returns NULL. This allows testing an Option directly + * in an if-clause to see if it is used: + * @code + * if (options[CREATE]) + * { + * ... + * } + * @endcode + * It also allows you to write loops like this: + * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) + * fname = opt->arg; ... @endcode + */ + operator Option*() + { + return desc ? this : nullptr; + } + + /** + * @brief Creates a new Option that is a one-element linked list and has NULL + * @ref desc, @ref name, @ref arg and @ref namelen. + */ + Option() : + desc(nullptr), name(nullptr), arg(nullptr), namelen(0) + { + prev_ = tag(this); + next_ = tag(this); + } + + /** + * @brief Creates a new Option that is a one-element linked list and has the given + * values for @ref desc, @ref name and @ref arg. + * + * If @c name_ points at a character other than '-' it will be assumed to refer to a + * short option and @ref namelen will be set to 1. Otherwise the length will extend to + * the first '=' character or the string's 0-terminator. + */ + Option(const Descriptor* desc_, const char* name_, const char* arg_) + { + init(desc_, name_, arg_); + } + + /** + * @brief Makes @c *this a copy of @c orig except for the linked list pointers. + * + * After this operation @c *this will be a one-element linked list. + */ + void operator=(const Option& orig) + { + init(orig.desc, orig.name, orig.arg); + } + + /** + * @brief Makes @c *this a copy of @c orig except for the linked list pointers. + * + * After this operation @c *this will be a one-element linked list. + */ + Option(const Option& orig) + { + init(orig.desc, orig.name, orig.arg); + } + +private: + /** + * @internal + * @brief Sets the fields of this Option to the given values (extracting @c name if necessary). + * + * If @c name_ points at a character other than '-' it will be assumed to refer to a + * short option and @ref namelen will be set to 1. Otherwise the length will extend to + * the first '=' character or the string's 0-terminator. + */ + void init(const Descriptor* desc_, const char* name_, const char* arg_) + { + desc = desc_; + name = name_; + arg = arg_; + prev_ = tag(this); + next_ = tag(this); + namelen = 0; + if (name == nullptr) + return; + namelen = 1; + if (name[0] != '-') + return; + while (name[namelen] != 0 && name[namelen] != '=') + ++namelen; + } + + static Option* tag(Option* ptr) + { + return (Option*) ((unsigned long long) ptr | 1); + } + + static Option* untag(Option* ptr) + { + return (Option*) ((unsigned long long) ptr & ~1ull); + } + + static bool isTagged(Option* ptr) + { + return ((unsigned long long) ptr & 1); + } +}; + +/** + * @brief Functions for checking the validity of option arguments. + * + * @copydetails CheckArg + * + * The following example code + * can serve as starting place for writing your own more complex CheckArg functions: + * @code + * struct Arg: public option::Arg + * { + * static void printError(const char* msg1, const option::Option& opt, const char* msg2) + * { + * fprintf(stderr, "ERROR: %s", msg1); + * fwrite(opt.name, opt.namelen, 1, stderr); + * fprintf(stderr, "%s", msg2); + * } + * + * static option::ArgStatus Unknown(const option::Option& option, bool msg) + * { + * if (msg) printError("Unknown option '", option, "'\n"); + * return option::ARG_ILLEGAL; + * } + * + * static option::ArgStatus Required(const option::Option& option, bool msg) + * { + * if (option.arg != 0) + * return option::ARG_OK; + * + * if (msg) printError("Option '", option, "' requires an argument\n"); + * return option::ARG_ILLEGAL; + * } + * + * static option::ArgStatus NonEmpty(const option::Option& option, bool msg) + * { + * if (option.arg != 0 && option.arg[0] != 0) + * return option::ARG_OK; + * + * if (msg) printError("Option '", option, "' requires a non-empty argument\n"); + * return option::ARG_ILLEGAL; + * } + * + * static option::ArgStatus Numeric(const option::Option& option, bool msg) + * { + * char* endptr = 0; + * if (option.arg != 0 && strtol(option.arg, &endptr, 10)){}; + * if (endptr != option.arg && *endptr == 0) + * return option::ARG_OK; + * + * if (msg) printError("Option '", option, "' requires a numeric argument\n"); + * return option::ARG_ILLEGAL; + * } + * }; + * @endcode + */ +struct Arg +{ + //! @brief For options that don't take an argument: Returns ARG_NONE. + static ArgStatus None(const Option&, bool) + { + return ARG_NONE; + } + + //! @brief Returns ARG_OK if the argument is attached and ARG_IGNORE otherwise. + static ArgStatus Optional(const Option& option, bool) + { + if (option.arg && option.name[option.namelen] != 0) + return ARG_OK; + else + return ARG_IGNORE; + } +}; + +/** + * @brief Determines the minimum lengths of the buffer and options arrays used for Parser. + * + * Because Parser doesn't use dynamic memory its output arrays have to be pre-allocated. + * If you don't want to use fixed size arrays (which may turn out too small, causing + * command line arguments to be dropped), you can use Stats to determine the correct sizes. + * Stats work cumulative. You can first pass in your default options and then the real + * options and afterwards the counts will reflect the union. + */ +struct Stats +{ + /** + * @brief Number of elements needed for a @c buffer[] array to be used for + * @ref Parser::parse() "parsing" the same argument vectors that were fed + * into this Stats object. + * + * @note + * This number is always 1 greater than the actual number needed, to give + * you a sentinel element. + */ + unsigned buffer_max; + + /** + * @brief Number of elements needed for an @c options[] array to be used for + * @ref Parser::parse() "parsing" the same argument vectors that were fed + * into this Stats object. + * + * @li This number is always 1 greater than the actual number needed, to give + * you a sentinel element. + * @li This number depends only on the @c usage, not the argument vectors, because + * the @c options array needs exactly one slot for each possible Descriptor::index. + */ + unsigned options_max; + + /** + * @brief Creates a Stats object with counts set to 1 (for the sentinel element). + */ + Stats() : + buffer_max(1), options_max(1) // 1 more than necessary as sentinel + { + } + + /** + * @brief Creates a new Stats object and immediately updates it for the + * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, + * if you just want to update @ref options_max. + * + * @note + * The calls to Stats methods must match the later calls to Parser methods. + * See Parser::parse() for the meaning of the arguments. + */ + Stats(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false) : + buffer_max(1), options_max(1) // 1 more than necessary as sentinel + { + add(gnu, usage, argc, argv, min_abbr_len, single_minus_longopt); + } + + //! @brief Stats(...) with non-const argv. + Stats(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false) : + buffer_max(1), options_max(1) // 1 more than necessary as sentinel + { + add(gnu, usage, argc, const_cast(argv), min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX Stats(...) (gnu==false). + Stats(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false) : + buffer_max(1), options_max(1) // 1 more than necessary as sentinel + { + add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX Stats(...) (gnu==false) with non-const argv. + Stats(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false) : + buffer_max(1), options_max(1) // 1 more than necessary as sentinel + { + add(false, usage, argc, const_cast(argv), min_abbr_len, single_minus_longopt); + } + + /** + * @brief Updates this Stats object for the + * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, + * if you just want to update @ref options_max. + * + * @note + * The calls to Stats methods must match the later calls to Parser methods. + * See Parser::parse() for the meaning of the arguments. + */ + void add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false); + + //! @brief add() with non-const argv. + void add(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false) + { + add(gnu, usage, argc, const_cast(argv), min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX add() (gnu==false). + void add(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false) + { + add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX add() (gnu==false) with non-const argv. + void add(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // + bool single_minus_longopt = false) + { + add(false, usage, argc, const_cast(argv), min_abbr_len, single_minus_longopt); + } +private: + class CountOptionsAction; +}; + +/** + * @brief Checks argument vectors for validity and parses them into data + * structures that are easier to work with. + * + * @par Example: + * @code + * int main(int argc, char* argv[]) + * { + * argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present + * option::Stats stats(usage, argc, argv); + * option::Option options[stats.options_max], buffer[stats.buffer_max]; + * option::Parser parse(usage, argc, argv, options, buffer); + * + * if (parse.error()) + * return 1; + * + * if (options[HELP]) + * ... + * @endcode + */ +class Parser +{ + int op_count; //!< @internal @brief see optionsCount() + int nonop_count; //!< @internal @brief see nonOptionsCount() + const char** nonop_args; //!< @internal @brief see nonOptions() + bool err; //!< @internal @brief see error() +public: + + /** + * @brief Creates a new Parser. + */ + Parser() : + op_count(0), nonop_count(0), nonop_args(nullptr), err(false) + { + } + + /** + * @brief Creates a new Parser and immediately parses the given argument vector. + * @copydetails parse() + */ + Parser(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], + int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : + op_count(0), nonop_count(0), nonop_args(nullptr), err(false) + { + parse(gnu, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief Parser(...) with non-const argv. + Parser(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], + int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : + op_count(0), nonop_count(0), nonop_args(nullptr), err(false) + { + parse(gnu, usage, argc, const_cast(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX Parser(...) (gnu==false). + Parser(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len = 0, + bool single_minus_longopt = false, int bufmax = -1) : + op_count(0), nonop_count(0), nonop_args(nullptr), err(false) + { + parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX Parser(...) (gnu==false) with non-const argv. + Parser(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, + bool single_minus_longopt = false, int bufmax = -1) : + op_count(0), nonop_count(0), nonop_args(nullptr), err(false) + { + parse(false, usage, argc, const_cast(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + /** + * @brief Parses the given argument vector. + * + * @param gnu if true, parse() will not stop at the first non-option argument. Instead it will + * reorder arguments so that all non-options are at the end. This is the default behaviour + * of GNU getopt() but is not conforming to POSIX. @n + * Note, that once the argument vector has been reordered, the @c gnu flag will have + * no further effect on this argument vector. So it is enough to pass @c gnu==true when + * creating Stats. + * @param usage Array of Descriptor objects that describe the options to support. The last entry + * of this array must have 0 in all fields. + * @param argc The number of elements from @c argv that are to be parsed. If you pass -1, the number + * will be determined automatically. In that case the @c argv list must end with a NULL + * pointer. + * @param argv The arguments to be parsed. If you pass -1 as @c argc the last pointer in the @c argv + * list must be NULL to mark the end. + * @param options Each entry is the first element of a linked list of Options. Each new option + * that is parsed will be appended to the list specified by that Option's + * Descriptor::index. If an entry is not yet used (i.e. the Option is invalid), + * it will be replaced rather than appended to. @n + * The minimum length of this array is the greatest Descriptor::index value that + * occurs in @c usage @e PLUS ONE. + * @param buffer Each argument that is successfully parsed (including unknown arguments, if they + * have a Descriptor whose CheckArg does not return @ref ARG_ILLEGAL) will be stored in this + * array. parse() scans the array for the first invalid entry and begins writing at that + * index. You can pass @c bufmax to limit the number of options stored. + * @param min_abbr_len Passing a value min_abbr_len > 0 enables abbreviated long + * options. The parser will match a prefix of a long option as if it was + * the full long option (e.g. @c --foob=10 will be interpreted as if it was + * @c --foobar=10 ), as long as the prefix has at least @c min_abbr_len characters + * (not counting the @c -- ) and is unambiguous. + * @n Be careful if combining @c min_abbr_len=1 with @c single_minus_longopt=true + * because the ambiguity check does not consider short options and abbreviated + * single minus long options will take precedence over short options. + * @param single_minus_longopt Passing @c true for this option allows long options to begin with + * a single minus. The double minus form will still be recognized. Note that + * single minus long options take precedence over short options and short option + * groups. E.g. @c -file would be interpreted as @c --file and not as + * -f -i -l -e (assuming a long option named @c "file" exists). + * @param bufmax The greatest index in the @c buffer[] array that parse() will write to is + * @c bufmax-1. If there are more options, they will be processed (in particular + * their CheckArg will be called) but not stored. @n + * If you used Stats::buffer_max to dimension this array, you can pass + * -1 (or not pass @c bufmax at all) which tells parse() that the buffer is + * "large enough". + * @attention + * Remember that @c options and @c buffer store Option @e objects, not pointers. Therefore it + * is not possible for the same object to be in both arrays. For those options that are found in + * both @c buffer[] and @c options[] the respective objects are independent copies. And only the + * objects in @c options[] are properly linked via Option::next() and Option::prev(). + * You can iterate over @c buffer[] to + * process all options in the order they appear in the argument vector, but if you want access to + * the other Options with the same Descriptor::index, then you @e must access the linked list via + * @c options[]. You can get the linked list in options from a buffer object via something like + * @c options[buffer[i].index()]. + */ + void parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], + int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1); + + //! @brief parse() with non-const argv. + void parse(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], + int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) + { + parse(gnu, usage, argc, const_cast(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX parse() (gnu==false). + void parse(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], + int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) + { + parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX parse() (gnu==false) with non-const argv. + void parse(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, + bool single_minus_longopt = false, int bufmax = -1) + { + parse(false, usage, argc, const_cast(argv), options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + /** + * @brief Returns the number of valid Option objects in @c buffer[]. + * + * @li The returned value always reflects the number of Options in the buffer[] array used for + * the most recent call to parse(). + * @li The count (and the buffer[]) includes unknown options if they are collected + * (see Descriptor::longopt). + */ + int optionsCount() + { + return op_count; + } + + /** + * @brief Returns the number of non-option arguments that remained at the end of the + * most recent parse() that actually encountered non-option arguments. + * + * @note + * A parse() that does not encounter non-option arguments will leave this value + * as well as nonOptions() undisturbed. This means you can feed the Parser a + * default argument vector that contains non-option arguments (e.g. a default filename). + * Then you feed it the actual arguments from the user. If the user has supplied at + * least one non-option argument, all of the non-option arguments from the default + * disappear and are replaced by the user's non-option arguments. However, if the + * user does not supply any non-option arguments the defaults will still be in + * effect. + */ + int nonOptionsCount() + { + return nonop_count; + } + + /** + * @brief Returns a pointer to an array of non-option arguments (only valid + * if nonOptionsCount() >0 ). + * + * @li parse() does not copy arguments, so this pointer points into the actual argument + * vector as passed to parse(). + * @li As explained at nonOptionsCount() this pointer is only changed by parse() calls + * that actually encounter non-option arguments. A parse() call that encounters only + * options, will not change nonOptions(). + */ + const char** nonOptions() + { + return nonop_args; + } + + /** + * @brief Returns nonOptions()[i] (@e without checking if i is in range!). + */ + const char* nonOption(int i) + { + return nonOptions()[i]; + } + + /** + * @brief Returns @c true if an unrecoverable error occurred while parsing options. + * + * An illegal argument to an option (i.e. CheckArg returns @ref ARG_ILLEGAL) is an + * unrecoverable error that aborts the parse. Unknown options are only an error if + * their CheckArg function returns @ref ARG_ILLEGAL. Otherwise they are collected. + * In that case if you want to exit the program if either an illegal argument + * or an unknown option has been passed, use code like this + * + * @code + * if (parser.error() || options[UNKNOWN]) + * exit(1); + * @endcode + * + */ + bool error() + { + return err; + } + +private: + friend struct Stats; + class StoreOptionAction; + struct Action; + + /** + * @internal + * @brief This is the core function that does all the parsing. + * @retval false iff an unrecoverable error occurred. + */ + static bool workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action, + bool single_minus_longopt, bool print_errors, int min_abbr_len); + + /** + * @internal + * @brief Returns true iff @c st1 is a prefix of @c st2 and + * in case @c st2 is longer than @c st1, then + * the first additional character is '='. + * + * @par Examples: + * @code + * streq("foo", "foo=bar") == true + * streq("foo", "foobar") == false + * streq("foo", "foo") == true + * streq("foo=bar", "foo") == false + * @endcode + */ + static bool streq(const char* st1, const char* st2) + { + while (*st1 != 0) + if (*st1++ != *st2++) + return false; + return (*st2 == 0 || *st2 == '='); + } + + /** + * @internal + * @brief Like streq() but handles abbreviations. + * + * Returns true iff @c st1 and @c st2 have a common + * prefix with the following properties: + * @li (if min > 0) its length is at least @c min characters or the same length as @c st1 (whichever is smaller). + * @li (if min <= 0) its length is the same as that of @c st1 + * @li within @c st2 the character following the common prefix is either '=' or end-of-string. + * + * Examples: + * @code + * streqabbr("foo", "foo=bar",) == true + * streqabbr("foo", "fo=bar" , 2) == true + * streqabbr("foo", "fo" , 2) == true + * streqabbr("foo", "fo" , 0) == false + * streqabbr("foo", "f=bar" , 2) == false + * streqabbr("foo", "f" , 2) == false + * streqabbr("fo" , "foo=bar",) == false + * streqabbr("foo", "foobar" ,) == false + * streqabbr("foo", "fobar" ,) == false + * streqabbr("foo", "foo" ,) == true + * @endcode + */ + static bool streqabbr(const char* st1, const char* st2, long long min) + { + const char* st1start = st1; + while (*st1 != 0 && (*st1 == *st2)) + { + ++st1; + ++st2; + } + + return (*st1 == 0 || (min > 0 && (st1 - st1start) >= min)) && (*st2 == 0 || *st2 == '='); + } + + /** + * @internal + * @brief Returns true iff character @c ch is contained in the string @c st. + * + * Returns @c true for @c ch==0 . + */ + static bool instr(char ch, const char* st) + { + while (*st != 0 && *st != ch) + ++st; + return *st == ch; + } + + /** + * @internal + * @brief Rotates args[-count],...,args[-1],args[0] to become + * args[0],args[-count],...,args[-1]. + */ + static void shift(const char** args, int count) + { + for (int i = 0; i > -count; --i) + { + const char* temp = args[i]; + args[i] = args[i - 1]; + args[i - 1] = temp; + } + } +}; + +/** + * @internal + * @brief Interface for actions Parser::workhorse() should perform for each Option it + * parses. + */ +struct Parser::Action +{ + virtual ~Action() {} + /** + * @brief Called by Parser::workhorse() for each Option that has been successfully + * parsed (including unknown + * options if they have a Descriptor whose Descriptor::check_arg does not return + * @ref ARG_ILLEGAL. + * + * Returns @c false iff a fatal error has occured and the parse should be aborted. + */ + virtual bool perform(Option&) + { + return true; + } + + /** + * @brief Called by Parser::workhorse() after finishing the parse. + * @param numargs the number of non-option arguments remaining + * @param args pointer to the first remaining non-option argument (if numargs > 0). + * + * @return + * @c false iff a fatal error has occurred. + */ + virtual bool finished(int numargs, const char** args) + { + (void) numargs; + (void) args; + return true; + } +}; + +/** + * @internal + * @brief An Action to pass to Parser::workhorse() that will increment a counter for + * each parsed Option. + */ +class Stats::CountOptionsAction: public Parser::Action +{ + unsigned* buffer_max; +public: + /** + * Creates a new CountOptionsAction that will increase @c *buffer_max_ for each + * parsed Option. + */ + CountOptionsAction(unsigned* buffer_max_) : + buffer_max(buffer_max_) + { + } + + bool perform(Option&) + { + if (*buffer_max == 0x7fffffff) + return false; // overflow protection: don't accept number of options that doesn't fit signed int + ++*buffer_max; + return true; + } +}; + +/** + * @internal + * @brief An Action to pass to Parser::workhorse() that will store each parsed Option in + * appropriate arrays (see Parser::parse()). + */ +class Parser::StoreOptionAction: public Parser::Action +{ + Parser& parser; + Option* options; + Option* buffer; + int bufmax; //! Number of slots in @c buffer. @c -1 means "large enough". +public: + /** + * @brief Creates a new StoreOption action. + * @param parser_ the parser whose op_count should be updated. + * @param options_ each Option @c o is chained into the linked list @c options_[o.desc->index] + * @param buffer_ each Option is appended to this array as long as there's a free slot. + * @param bufmax_ number of slots in @c buffer_. @c -1 means "large enough". + */ + StoreOptionAction(Parser& parser_, Option options_[], Option buffer_[], int bufmax_) : + parser(parser_), options(options_), buffer(buffer_), bufmax(bufmax_) + { + // find first empty slot in buffer (if any) + int bufidx = 0; + while ((bufmax < 0 || bufidx < bufmax) && buffer[bufidx]) + ++bufidx; + + // set parser's optionCount + parser.op_count = bufidx; + } + + bool perform(Option& option) + { + if (bufmax < 0 || parser.op_count < bufmax) + { + if (parser.op_count == 0x7fffffff) + return false; // overflow protection: don't accept number of options that doesn't fit signed int + + buffer[parser.op_count] = option; + int idx = buffer[parser.op_count].desc->index; + if (options[idx]) + options[idx].append(buffer[parser.op_count]); + else + options[idx] = buffer[parser.op_count]; + ++parser.op_count; + } + return true; // NOTE: an option that is discarded because of a full buffer is not fatal + } + + bool finished(int numargs, const char** args) + { + // only overwrite non-option argument list if there's at least 1 + // new non-option argument. Otherwise we keep the old list. This + // makes it easy to use default non-option arguments. + if (numargs > 0) + { + parser.nonop_count = numargs; + parser.nonop_args = args; + } + + return true; + } +}; + +inline void Parser::parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], + Option buffer[], int min_abbr_len, bool single_minus_longopt, int bufmax) +{ + StoreOptionAction action(*this, options, buffer, bufmax); + err = !workhorse(gnu, usage, argc, argv, action, single_minus_longopt, true, min_abbr_len); +} + +inline void Stats::add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len, + bool single_minus_longopt) +{ + // determine size of options array. This is the greatest index used in the usage + 1 + int i = 0; + while (usage[i].shortopt != nullptr) + { + if (usage[i].index + 1 >= options_max) + options_max = (usage[i].index + 1) + 1; // 1 more than necessary as sentinel + + ++i; + } + + CountOptionsAction action(&buffer_max); + Parser::workhorse(gnu, usage, argc, argv, action, single_minus_longopt, false, min_abbr_len); +} + +inline bool Parser::workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action, + bool single_minus_longopt, bool print_errors, int min_abbr_len) +{ + // protect against NULL pointer + if (args == nullptr) + numargs = 0; + + int nonops = 0; + + while (numargs != 0 && *args != nullptr) + { + const char* param = *args; // param can be --long-option, -srto or non-option argument + + // in POSIX mode the first non-option argument terminates the option list + // a lone minus character is a non-option argument + if (param[0] != '-' || param[1] == 0) + { + if (gnu) + { + ++nonops; + ++args; + if (numargs > 0) + --numargs; + continue; + } + else + break; + } + + // -- terminates the option list. The -- itself is skipped. + if (param[1] == '-' && param[2] == 0) + { + shift(args, nonops); + ++args; + if (numargs > 0) + --numargs; + break; + } + + bool handle_short_options; + const char* longopt_name; + if (param[1] == '-') // if --long-option + { + handle_short_options = false; + longopt_name = param + 2; + } + else + { + handle_short_options = true; + longopt_name = param + 1; //for testing a potential -long-option + } + + bool try_single_minus_longopt = single_minus_longopt; + bool have_more_args = (numargs > 1 || numargs < 0); // is referencing argv[1] valid? + + do // loop over short options in group, for long options the body is executed only once + { + int idx = 0; + + const char* optarg = nullptr; + + /******************** long option **********************/ + if (handle_short_options == false || try_single_minus_longopt) + { + idx = 0; + while (usage[idx].longopt != nullptr && !streq(usage[idx].longopt, longopt_name)) + ++idx; + + if (usage[idx].longopt == nullptr && min_abbr_len > 0) // if we should try to match abbreviated long options + { + int i1 = 0; + while (usage[i1].longopt != nullptr && !streqabbr(usage[i1].longopt, longopt_name, min_abbr_len)) + ++i1; + if (usage[i1].longopt != nullptr) + { // now test if the match is unambiguous by checking for another match + int i2 = i1 + 1; + while (usage[i2].longopt != nullptr && !streqabbr(usage[i2].longopt, longopt_name, min_abbr_len)) + ++i2; + + if (usage[i2].longopt == nullptr) // if there was no second match it's unambiguous, so accept i1 as idx + idx = i1; + } + } + + // if we found something, disable handle_short_options (only relevant if single_minus_longopt) + if (usage[idx].longopt != nullptr) + handle_short_options = false; + + try_single_minus_longopt = false; // prevent looking for longopt in the middle of shortopt group + + optarg = longopt_name; + while (*optarg != 0 && *optarg != '=') + ++optarg; + if (*optarg == '=') // attached argument + ++optarg; + else + // possibly detached argument + optarg = (have_more_args ? args[1] : nullptr); + } + + /************************ short option ***********************************/ + if (handle_short_options) + { + if (*++param == 0) // point at the 1st/next option character + break; // end of short option group + + idx = 0; + while (usage[idx].shortopt != nullptr && !instr(*param, usage[idx].shortopt)) + ++idx; + + if (param[1] == 0) // if the potential argument is separate + optarg = (have_more_args ? args[1] : nullptr); + else + // if the potential argument is attached + optarg = param + 1; + } + + const Descriptor* descriptor = &usage[idx]; + + if (descriptor->shortopt == nullptr) /************** unknown option ********************/ + { + // look for dummy entry (shortopt == "" and longopt == "") to use as Descriptor for unknown options + idx = 0; + while (usage[idx].shortopt != nullptr && (usage[idx].shortopt[0] != 0 || usage[idx].longopt[0] != 0)) + ++idx; + descriptor = (usage[idx].shortopt == nullptr ? nullptr : &usage[idx]); + } + + if (descriptor != nullptr) + { + Option option(descriptor, param, optarg); + switch (descriptor->check_arg(option, print_errors)) + { + case ARG_ILLEGAL: + return false; // fatal + case ARG_OK: + // skip one element of the argument vector, if it's a separated argument + if (optarg != nullptr && have_more_args && optarg == args[1]) + { + shift(args, nonops); + if (numargs > 0) + --numargs; + ++args; + } + + // No further short options are possible after an argument + handle_short_options = false; + + break; + case ARG_IGNORE: + case ARG_NONE: + option.arg = nullptr; + break; + } + + if (!action.perform(option)) + return false; + } + + } while (handle_short_options); + + shift(args, nonops); + ++args; + if (numargs > 0) + --numargs; + + } // while + + if (numargs > 0 && *args == nullptr) // It's a bug in the caller if numargs is greater than the actual number + numargs = 0; // of arguments, but as a service to the user we fix this if we spot it. + + if (numargs < 0) // if we don't know the number of remaining non-option arguments + { // we need to count them + numargs = 0; + while (args[numargs] != nullptr) + ++numargs; + } + + return action.finished(numargs + nonops, args - nonops); +} + +/** + * @internal + * @brief The implementation of option::printUsage(). + */ +struct PrintUsageImplementation +{ + /** + * @internal + * @brief Interface for Functors that write (part of) a string somewhere. + */ + struct IStringWriter + { + virtual ~IStringWriter() {} + /** + * @brief Writes the given number of chars beginning at the given pointer somewhere. + */ + virtual void operator()(const char*, int) + { + } + }; + + /** + * @internal + * @brief Encapsulates a function with signature func(string, size) where + * string can be initialized with a const char* and size with an int. + */ + template + struct FunctionWriter: public IStringWriter + { + Function* write; + + virtual void operator()(const char* str, int size) + { + (*write)(str, size); + } + + FunctionWriter(Function* w) : + write(w) + { + } + }; + + /** + * @internal + * @brief Encapsulates a reference to an object with a write(string, size) + * method like that of @c std::ostream. + */ + template + struct OStreamWriter: public IStringWriter + { + OStream& ostream; + + virtual void operator()(const char* str, int size) + { + ostream.write(str, size); + } + + OStreamWriter(OStream& o) : + ostream(o) + { + } + }; + + /** + * @internal + * @brief Like OStreamWriter but encapsulates a @c const reference, which is + * typically a temporary object of a user class. + */ + template + struct TemporaryWriter: public IStringWriter + { + const Temporary& userstream; + + virtual void operator()(const char* str, int size) + { + userstream.write(str, size); + } + + TemporaryWriter(const Temporary& u) : + userstream(u) + { + } + }; + + /** + * @internal + * @brief Encapsulates a function with the signature func(fd, string, size) (the + * signature of the @c write() system call) + * where fd can be initialized from an int, string from a const char* and size from an int. + */ + template + struct SyscallWriter: public IStringWriter + { + Syscall* write; + int fd; + + virtual void operator()(const char* str, int size) + { + (*write)(fd, str, size); + } + + SyscallWriter(Syscall* w, int f) : + write(w), fd(f) + { + } + }; + + /** + * @internal + * @brief Encapsulates a function with the same signature as @c std::fwrite(). + */ + template + struct StreamWriter: public IStringWriter + { + Function* fwrite; + Stream* stream; + + virtual void operator()(const char* str, int size) + { + (*fwrite)(str, size, 1, stream); + } + + StreamWriter(Function* w, Stream* s) : + fwrite(w), stream(s) + { + } + }; + + /** + * @internal + * @brief Sets i1 = max(i1, i2) + */ + static void upmax(int& i1, int i2) + { + i1 = (i1 >= i2 ? i1 : i2); + } + + /** + * @internal + * @brief Moves the "cursor" to column @c want_x assuming it is currently at column @c x + * and sets @c x=want_x . + * If x > want_x , a line break is output before indenting. + * + * @param write Spaces and possibly a line break are written via this functor to get + * the desired indentation @c want_x . + * @param[in,out] x the current indentation. Set to @c want_x by this method. + * @param want_x the desired indentation. + */ + static void indent(IStringWriter& write, int& x, int want_x) + { + int indent = want_x - x; + if (indent < 0) + { + write("\n", 1); + indent = want_x; + } + + if (indent > 0) + { + char space = ' '; + for (int i = 0; i < indent; ++i) + write(&space, 1); + x = want_x; + } + } + + /** + * @brief Returns true if ch is the unicode code point of a wide character. + * + * @note + * The following character ranges are treated as wide + * @code + * 1100..115F + * 2329..232A (just 2 characters!) + * 2E80..A4C6 except for 303F + * A960..A97C + * AC00..D7FB + * F900..FAFF + * FE10..FE6B + * FF01..FF60 + * FFE0..FFE6 + * 1B000...... + * @endcode + */ + static bool isWideChar(unsigned ch) + { + if (ch == 0x303F) + return false; + + return ((0x1100 <= ch && ch <= 0x115F) || (0x2329 <= ch && ch <= 0x232A) || (0x2E80 <= ch && ch <= 0xA4C6) + || (0xA960 <= ch && ch <= 0xA97C) || (0xAC00 <= ch && ch <= 0xD7FB) || (0xF900 <= ch && ch <= 0xFAFF) + || (0xFE10 <= ch && ch <= 0xFE6B) || (0xFF01 <= ch && ch <= 0xFF60) || (0xFFE0 <= ch && ch <= 0xFFE6) + || (0x1B000 <= ch)); + } + + /** + * @internal + * @brief Splits a @c Descriptor[] array into tables, rows, lines and columns and + * iterates over these components. + * + * The top-level organizational unit is the @e table. + * A table begins at a Descriptor with @c help!=NULL and extends up to + * a Descriptor with @c help==NULL. + * + * A table consists of @e rows. Due to line-wrapping and explicit breaks + * a row may take multiple lines on screen. Rows within the table are separated + * by \\n. They never cross Descriptor boundaries. This means a row ends either + * at \\n or the 0 at the end of the help string. + * + * A row consists of columns/cells. Columns/cells within a row are separated by \\t. + * Line breaks within a cell are marked by \\v. + * + * Rows in the same table need not have the same number of columns/cells. The + * extreme case are interjections, which are rows that contain neither \\t nor \\v. + * These are NOT treated specially by LinePartIterator, but they are treated + * specially by printUsage(). + * + * LinePartIterator iterates through the usage at 3 levels: table, row and part. + * Tables and rows are as described above. A @e part is a line within a cell. + * LinePartIterator iterates through 1st parts of all cells, then through the 2nd + * parts of all cells (if any),... @n + * Example: The row "1 \v 3 \t 2 \v 4" has 2 cells/columns and 4 parts. + * The parts will be returned in the order 1, 2, 3, 4. + * + * It is possible that some cells have fewer parts than others. In this case + * LinePartIterator will "fill up" these cells with 0-length parts. IOW, LinePartIterator + * always returns the same number of parts for each column. Note that this is different + * from the way rows and columns are handled. LinePartIterator does @e not guarantee that + * the same number of columns will be returned for each row. + * + */ + class LinePartIterator + { + const Descriptor* tablestart; //!< The 1st descriptor of the current table. + const Descriptor* rowdesc; //!< The Descriptor that contains the current row. + const char* rowstart; //!< Ptr to 1st character of current row within rowdesc->help. + const char* ptr; //!< Ptr to current part within the current row. + int col; //!< Index of current column. + int len; //!< Length of the current part (that ptr points at) in BYTES + int screenlen; //!< Length of the current part in screen columns (taking narrow/wide chars into account). + int max_line_in_block; //!< Greatest index of a line within the block. This is the number of \\v within the cell with the most \\vs. + int line_in_block; //!< Line index within the current cell of the current part. + int target_line_in_block; //!< Line index of the parts we should return to the user on this iteration. + bool hit_target_line; //!< Flag whether we encountered a part with line index target_line_in_block in the current cell. + + /** + * @brief Determines the byte and character lengths of the part at @ref ptr and + * stores them in @ref len and @ref screenlen respectively. + */ + void update_length() + { + screenlen = 0; + for (len = 0; ptr[len] != 0 && ptr[len] != '\v' && ptr[len] != '\t' && ptr[len] != '\n'; ++len) + { + ++screenlen; + unsigned ch = (unsigned char) ptr[len]; + if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte + { + // int __builtin_clz (unsigned int x) + // Returns the number of leading 0-bits in x, starting at the most significant bit + unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); + ch = ch & mask; // mask out length bits, we don't verify their correctness + while (((unsigned char) ptr[len + 1] ^ 0x80) <= 0x3F) // while next byte is continuation byte + { + ch = (ch << 6) ^ (unsigned char) ptr[len + 1] ^ 0x80; // add continuation to char code + ++len; + } + // ch is the decoded unicode code point + if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case + ++screenlen; + } + } + } + + public: + //! @brief Creates an iterator for @c usage. + LinePartIterator(const Descriptor usage[]) : + tablestart(usage), rowdesc(nullptr), rowstart(nullptr), ptr(nullptr), col(-1), len(0), max_line_in_block(0), line_in_block(0), + target_line_in_block(0), hit_target_line(true) + { + } + + /** + * @brief Moves iteration to the next table (if any). Has to be called once on a new + * LinePartIterator to move to the 1st table. + * @retval false if moving to next table failed because no further table exists. + */ + bool nextTable() + { + // If this is NOT the first time nextTable() is called after the constructor, + // then skip to the next table break (i.e. a Descriptor with help == 0) + if (rowdesc != nullptr) + { + while (tablestart->help != nullptr && tablestart->shortopt != nullptr) + ++tablestart; + } + + // Find the next table after the break (if any) + while (tablestart->help == nullptr && tablestart->shortopt != nullptr) + ++tablestart; + + restartTable(); + return rowstart != nullptr; + } + + /** + * @brief Reset iteration to the beginning of the current table. + */ + void restartTable() + { + rowdesc = tablestart; + rowstart = tablestart->help; + ptr = nullptr; + } + + /** + * @brief Moves iteration to the next row (if any). Has to be called once after each call to + * @ref nextTable() to move to the 1st row of the table. + * @retval false if moving to next row failed because no further row exists. + */ + bool nextRow() + { + if (ptr == nullptr) + { + restartRow(); + return rowstart != nullptr; + } + + while (*ptr != 0 && *ptr != '\n') + ++ptr; + + if (*ptr == 0) + { + if ((rowdesc + 1)->help == nullptr) // table break + return false; + + ++rowdesc; + rowstart = rowdesc->help; + } + else // if (*ptr == '\n') + { + rowstart = ptr + 1; + } + + restartRow(); + return true; + } + + /** + * @brief Reset iteration to the beginning of the current row. + */ + void restartRow() + { + ptr = rowstart; + col = -1; + len = 0; + screenlen = 0; + max_line_in_block = 0; + line_in_block = 0; + target_line_in_block = 0; + hit_target_line = true; + } + + /** + * @brief Moves iteration to the next part (if any). Has to be called once after each call to + * @ref nextRow() to move to the 1st part of the row. + * @retval false if moving to next part failed because no further part exists. + * + * See @ref LinePartIterator for details about the iteration. + */ + bool next() + { + if (ptr == nullptr) + return false; + + if (col == -1) + { + col = 0; + update_length(); + return true; + } + + ptr += len; + while (true) + { + switch (*ptr) + { + case '\v': + upmax(max_line_in_block, ++line_in_block); + ++ptr; + break; + case '\t': + if (!hit_target_line) // if previous column did not have the targetline + { // then "insert" a 0-length part + update_length(); + hit_target_line = true; + return true; + } + + hit_target_line = false; + line_in_block = 0; + ++col; + ++ptr; + break; + case 0: + case '\n': + if (!hit_target_line) // if previous column did not have the targetline + { // then "insert" a 0-length part + update_length(); + hit_target_line = true; + return true; + } + + if (++target_line_in_block > max_line_in_block) + { + update_length(); + return false; + } + + hit_target_line = false; + line_in_block = 0; + col = 0; + ptr = rowstart; + continue; + default: + ++ptr; + continue; + } // switch + + if (line_in_block == target_line_in_block) + { + update_length(); + hit_target_line = true; + return true; + } + } // while + } + + /** + * @brief Returns the index (counting from 0) of the column in which + * the part pointed to by @ref data() is located. + */ + int column() + { + return col; + } + + /** + * @brief Returns the index (counting from 0) of the line within the current column + * this part belongs to. + */ + int line() + { + return target_line_in_block; // NOT line_in_block !!! It would be wrong if !hit_target_line + } + + /** + * @brief Returns the length of the part pointed to by @ref data() in raw chars (not UTF-8 characters). + */ + int length() + { + return len; + } + + /** + * @brief Returns the width in screen columns of the part pointed to by @ref data(). + * Takes multi-byte UTF-8 sequences and wide characters into account. + */ + int screenLength() + { + return screenlen; + } + + /** + * @brief Returns the current part of the iteration. + */ + const char* data() + { + return ptr; + } + }; + + /** + * @internal + * @brief Takes input and line wraps it, writing out one line at a time so that + * it can be interleaved with output from other columns. + * + * The LineWrapper is used to handle the last column of each table as well as interjections. + * The LineWrapper is called once for each line of output. If the data given to it fits + * into the designated width of the last column it is simply written out. If there + * is too much data, an appropriate split point is located and only the data up to this + * split point is written out. The rest of the data is queued for the next line. + * That way the last column can be line wrapped and interleaved with data from + * other columns. The following example makes this clearer: + * @code + * Column 1,1 Column 2,1 This is a long text + * Column 1,2 Column 2,2 that does not fit into + * a single line. + * @endcode + * + * The difficulty in producing this output is that the whole string + * "This is a long text that does not fit into a single line" is the + * 1st and only part of column 3. In order to produce the above + * output the string must be output piecemeal, interleaved with + * the data from the other columns. + */ + class LineWrapper + { + static const int bufmask = 15; //!< Must be a power of 2 minus 1. + /** + * @brief Ring buffer for length component of pair (data, length). + */ + int lenbuf[bufmask + 1]; + /** + * @brief Ring buffer for data component of pair (data, length). + */ + const char* datbuf[bufmask + 1]; + /** + * @brief The indentation of the column to which the LineBuffer outputs. LineBuffer + * assumes that the indentation has already been written when @ref process() + * is called, so this value is only used when a buffer flush requires writing + * additional lines of output. + */ + int x; + /** + * @brief The width of the column to line wrap. + */ + int width; + int head; //!< @brief index for next write + int tail; //!< @brief index for next read - 1 (i.e. increment tail BEFORE read) + + /** + * @brief Multiple methods of LineWrapper may decide to flush part of the buffer to + * free up space. The contract of process() says that only 1 line is output. So + * this variable is used to track whether something has output a line. It is + * reset at the beginning of process() and checked at the end to decide if + * output has already occurred or is still needed. + */ + bool wrote_something; + + bool buf_empty() + { + return ((tail + 1) & bufmask) == head; + } + + bool buf_full() + { + return tail == head; + } + + void buf_store(const char* data, int len) + { + lenbuf[head] = len; + datbuf[head] = data; + head = (head + 1) & bufmask; + } + + //! @brief Call BEFORE reading ...buf[tail]. + void buf_next() + { + tail = (tail + 1) & bufmask; + } + + /** + * @brief Writes (data,len) into the ring buffer. If the buffer is full, a single line + * is flushed out of the buffer into @c write. + */ + void output(IStringWriter& write, const char* data, int len) + { + if (buf_full()) + write_one_line(write); + + buf_store(data, len); + } + + /** + * @brief Writes a single line of output from the buffer to @c write. + */ + void write_one_line(IStringWriter& write) + { + if (wrote_something) // if we already wrote something, we need to start a new line + { + write("\n", 1); + int _ = 0; + indent(write, _, x); + } + + if (!buf_empty()) + { + buf_next(); + write(datbuf[tail], lenbuf[tail]); + } + + wrote_something = true; + } + public: + + /** + * @brief Writes out all remaining data from the LineWrapper using @c write. + * Unlike @ref process() this method indents all lines including the first and + * will output a \\n at the end (but only if something has been written). + */ + void flush(IStringWriter& write) + { + if (buf_empty()) + return; + int _ = 0; + indent(write, _, x); + wrote_something = false; + while (!buf_empty()) + write_one_line(write); + write("\n", 1); + } + + /** + * @brief Process, wrap and output the next piece of data. + * + * process() will output at least one line of output. This is not necessarily + * the @c data passed in. It may be data queued from a prior call to process(). + * If the internal buffer is full, more than 1 line will be output. + * + * process() assumes that the a proper amount of indentation has already been + * output. It won't write any further indentation before the 1st line. If + * more than 1 line is written due to buffer constraints, the lines following + * the first will be indented by this method, though. + * + * No \\n is written by this method after the last line that is written. + * + * @param write where to write the data. + * @param data the new chunk of data to write. + * @param len the length of the chunk of data to write. + */ + void process(IStringWriter& write, const char* data, int len) + { + wrote_something = false; + + while (len > 0) + { + if (len <= width) // quick test that works because utf8width <= len (all wide chars have at least 2 bytes) + { + output(write, data, len); + len = 0; + } + else // if (len > width) it's possible (but not guaranteed) that utf8len > width + { + int utf8width = 0; + int maxi = 0; + while (maxi < len && utf8width < width) + { + int charbytes = 1; + unsigned ch = (unsigned char) data[maxi]; + if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte + { + // int __builtin_clz (unsigned int x) + // Returns the number of leading 0-bits in x, starting at the most significant bit + unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); + ch = ch & mask; // mask out length bits, we don't verify their correctness + while ((maxi + charbytes < len) && // + (((unsigned char) data[maxi + charbytes] ^ 0x80) <= 0x3F)) // while next byte is continuation byte + { + ch = (ch << 6) ^ (unsigned char) data[maxi + charbytes] ^ 0x80; // add continuation to char code + ++charbytes; + } + // ch is the decoded unicode code point + if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case + { + if (utf8width + 2 > width) + break; + ++utf8width; + } + } + ++utf8width; + maxi += charbytes; + } + + // data[maxi-1] is the last byte of the UTF-8 sequence of the last character that fits + // onto the 1st line. If maxi == len, all characters fit on the line. + + if (maxi == len) + { + output(write, data, len); + len = 0; + } + else // if (maxi < len) at least 1 character (data[maxi] that is) doesn't fit on the line + { + int i; + for (i = maxi; i >= 0; --i) + if (data[i] == ' ') + break; + + if (i >= 0) + { + output(write, data, i); + data += i + 1; + len -= i + 1; + } + else // did not find a space to split at => split before data[maxi] + { // data[maxi] is always the beginning of a character, never a continuation byte + output(write, data, maxi); + data += maxi; + len -= maxi; + } + } + } + } + if (!wrote_something) // if we didn't already write something to make space in the buffer + write_one_line(write); // write at most one line of actual output + } + + /** + * @brief Constructs a LineWrapper that wraps its output to fit into + * screen columns @c x1 (incl.) to @c x2 (excl.). + * + * @c x1 gives the indentation LineWrapper uses if it needs to indent. + */ + LineWrapper(int x1, int x2) : + x(x1), width(x2 - x1), head(0), tail(bufmask) + { + if (width < 2) // because of wide characters we need at least width 2 or the code breaks + width = 2; + } + }; + + /** + * @internal + * @brief This is the implementation that is shared between all printUsage() templates. + * Because all printUsage() templates share this implementation, there is no template bloat. + */ + static void printUsage(IStringWriter& write, const Descriptor usage[], int width = 80, // + int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) + { + if (width < 1) // protect against nonsense values + width = 80; + + if (width > 10000) // protect against overflow in the following computation + width = 10000; + + int last_column_min_width = ((width * last_column_min_percent) + 50) / 100; + int last_column_own_line_max_width = ((width * last_column_own_line_max_percent) + 50) / 100; + if (last_column_own_line_max_width == 0) + last_column_own_line_max_width = 1; + + LinePartIterator part(usage); + while (part.nextTable()) + { + + /***************** Determine column widths *******************************/ + + const int maxcolumns = 8; // 8 columns are enough for everyone + int col_width[maxcolumns]; + int lastcolumn; + int leftwidth; + int overlong_column_threshold = 10000; + do + { + lastcolumn = 0; + for (int i = 0; i < maxcolumns; ++i) + col_width[i] = 0; + + part.restartTable(); + while (part.nextRow()) + { + while (part.next()) + { + if (part.column() < maxcolumns) + { + upmax(lastcolumn, part.column()); + if (part.screenLength() < overlong_column_threshold) + // We don't let rows that don't use table separators (\t or \v) influence + // the width of column 0. This allows the user to interject section headers + // or explanatory paragraphs that do not participate in the table layout. + if (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' + || part.data()[part.length()] == '\v') + upmax(col_width[part.column()], part.screenLength()); + } + } + } + + /* + * If the last column doesn't fit on the same + * line as the other columns, we can fix that by starting it on its own line. + * However we can't do this for any of the columns 0..lastcolumn-1. + * If their sum exceeds the maximum width we try to fix this by iteratively + * ignoring the widest line parts in the width determination until + * we arrive at a series of column widths that fit into one line. + * The result is a layout where everything is nicely formatted + * except for a few overlong fragments. + * */ + + leftwidth = 0; + overlong_column_threshold = 0; + for (int i = 0; i < lastcolumn; ++i) + { + leftwidth += col_width[i]; + upmax(overlong_column_threshold, col_width[i]); + } + + } while (leftwidth > width); + + /**************** Determine tab stops and last column handling **********************/ + + int tabstop[maxcolumns]; + tabstop[0] = 0; + for (int i = 1; i < maxcolumns; ++i) + tabstop[i] = tabstop[i - 1] + col_width[i - 1]; + + int rightwidth = width - tabstop[lastcolumn]; + bool print_last_column_on_own_line = false; + if (rightwidth < last_column_min_width && // if we don't have the minimum requested width for the last column + ( col_width[lastcolumn] == 0 || // and all last columns are > overlong_column_threshold + rightwidth < col_width[lastcolumn] // or there is at least one last column that requires more than the space available + ) + ) + { + print_last_column_on_own_line = true; + rightwidth = last_column_own_line_max_width; + } + + // If lastcolumn == 0 we must disable print_last_column_on_own_line because + // otherwise 2 copies of the last (and only) column would be output. + // Actually this is just defensive programming. It is currently not + // possible that lastcolumn==0 and print_last_column_on_own_line==true + // at the same time, because lastcolumn==0 => tabstop[lastcolumn] == 0 => + // rightwidth==width => rightwidth>=last_column_min_width (unless someone passes + // a bullshit value >100 for last_column_min_percent) => the above if condition + // is false => print_last_column_on_own_line==false + if (lastcolumn == 0) + print_last_column_on_own_line = false; + + LineWrapper lastColumnLineWrapper(width - rightwidth, width); + LineWrapper interjectionLineWrapper(0, width); + + part.restartTable(); + + /***************** Print out all rows of the table *************************************/ + + while (part.nextRow()) + { + int x = -1; + while (part.next()) + { + if (part.column() > lastcolumn) + continue; // drop excess columns (can happen if lastcolumn == maxcolumns-1) + + if (part.column() == 0) + { + if (x >= 0) + write("\n", 1); + x = 0; + } + + indent(write, x, tabstop[part.column()]); + + if ((part.column() < lastcolumn) + && (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' + || part.data()[part.length()] == '\v')) + { + write(part.data(), part.length()); + x += part.screenLength(); + } + else // either part.column() == lastcolumn or we are in the special case of + // an interjection that doesn't contain \v or \t + { + // NOTE: This code block is not necessarily executed for + // each line, because some rows may have fewer columns. + + LineWrapper& lineWrapper = (part.column() == 0) ? interjectionLineWrapper : lastColumnLineWrapper; + + if (!print_last_column_on_own_line || part.column() != lastcolumn) + lineWrapper.process(write, part.data(), part.length()); + } + } // while + + if (print_last_column_on_own_line) + { + part.restartRow(); + while (part.next()) + { + if (part.column() == lastcolumn) + { + write("\n", 1); + int _ = 0; + indent(write, _, width - rightwidth); + lastColumnLineWrapper.process(write, part.data(), part.length()); + } + } + } + + write("\n", 1); + lastColumnLineWrapper.flush(write); + interjectionLineWrapper.flush(write); + } + } + } + +} +; + +/** + * @brief Outputs a nicely formatted usage string with support for multi-column formatting + * and line-wrapping. + * + * printUsage() takes the @c help texts of a Descriptor[] array and formats them into + * a usage message, wrapping lines to achieve the desired output width. + * + * Table formatting: + * + * Aside from plain strings which are simply line-wrapped, the usage may contain tables. Tables + * are used to align elements in the output. + * + * @code + * // Without a table. The explanatory texts are not aligned. + * -c, --create |Creates something. + * -k, --kill |Destroys something. + * + * // With table formatting. The explanatory texts are aligned. + * -c, --create |Creates something. + * -k, --kill |Destroys something. + * @endcode + * + * Table formatting removes the need to pad help texts manually with spaces to achieve + * alignment. To create a table, simply insert \\t (tab) characters to separate the cells + * within a row. + * + * @code + * const option::Descriptor usage[] = { + * {..., "-c, --create \tCreates something." }, + * {..., "-k, --kill \tDestroys something." }, ... + * @endcode + * + * Note that you must include the minimum amount of space desired between cells yourself. + * Table formatting will insert further spaces as needed to achieve alignment. + * + * You can insert line breaks within cells by using \\v (vertical tab). + * + * @code + * const option::Descriptor usage[] = { + * {..., "-c,\v--create \tCreates\vsomething." }, + * {..., "-k,\v--kill \tDestroys\vsomething." }, ... + * + * // results in + * + * -c, Creates + * --create something. + * -k, Destroys + * --kill something. + * @endcode + * + * You can mix lines that do not use \\t or \\v with those that do. The plain + * lines will not mess up the table layout. Alignment of the table columns will + * be maintained even across these interjections. + * + * @code + * const option::Descriptor usage[] = { + * {..., "-c, --create \tCreates something." }, + * {..., "----------------------------------" }, + * {..., "-k, --kill \tDestroys something." }, ... + * + * // results in + * + * -c, --create Creates something. + * ---------------------------------- + * -k, --kill Destroys something. + * @endcode + * + * You can have multiple tables within the same usage whose columns are + * aligned independently. Simply insert a dummy Descriptor with @c help==0. + * + * @code + * const option::Descriptor usage[] = { + * {..., "Long options:" }, + * {..., "--very-long-option \tDoes something long." }, + * {..., "--ultra-super-mega-long-option \tTakes forever to complete." }, + * {..., 0 }, // ---------- table break ----------- + * {..., "Short options:" }, + * {..., "-s \tShort." }, + * {..., "-q \tQuick." }, ... + * + * // results in + * + * Long options: + * --very-long-option Does something long. + * --ultra-super-mega-long-option Takes forever to complete. + * Short options: + * -s Short. + * -q Quick. + * + * // Without the table break it would be + * + * Long options: + * --very-long-option Does something long. + * --ultra-super-mega-long-option Takes forever to complete. + * Short options: + * -s Short. + * -q Quick. + * @endcode + * + * Output methods: + * + * Because TheLeanMeanC++Option parser is freestanding, you have to provide the means for + * output in the first argument(s) to printUsage(). Because printUsage() is implemented as + * a set of template functions, you have great flexibility in your choice of output + * method. The following example demonstrates typical uses. Anything that's similar enough + * will work. + * + * @code + * #include // write() + * #include // cout + * #include // ostringstream + * #include // fwrite() + * using namespace std; + * + * void my_write(const char* str, int size) { + * fwrite(str, size, 1, stdout); + * } + * + * struct MyWriter { + * void write(const char* buf, size_t size) const { + * fwrite(str, size, 1, stdout); + * } + * }; + * + * struct MyWriteFunctor { + * void operator()(const char* buf, size_t size) { + * fwrite(str, size, 1, stdout); + * } + * }; + * ... + * printUsage(my_write, usage); // custom write function + * printUsage(MyWriter(), usage); // temporary of a custom class + * MyWriter writer; + * printUsage(writer, usage); // custom class object + * MyWriteFunctor wfunctor; + * printUsage(&wfunctor, usage); // custom functor + * printUsage(write, 1, usage); // write() to file descriptor 1 + * printUsage(cout, usage); // an ostream& + * printUsage(fwrite, stdout, usage); // fwrite() to stdout + * ostringstream sstr; + * printUsage(sstr, usage); // an ostringstream& + * + * @endcode + * + * @par Notes: + * @li the @c write() method of a class that is to be passed as a temporary + * as @c MyWriter() is in the example, must be a @c const method, because + * temporary objects are passed as const reference. This only applies to + * temporary objects that are created and destroyed in the same statement. + * If you create an object like @c writer in the example, this restriction + * does not apply. + * @li a functor like @c MyWriteFunctor in the example must be passed as a pointer. + * This differs from the way functors are passed to e.g. the STL algorithms. + * @li All printUsage() templates are tiny wrappers around a shared non-template implementation. + * So there's no penalty for using different versions in the same program. + * @li printUsage() always interprets Descriptor::help as UTF-8 and always produces UTF-8-encoded + * output. If your system uses a different charset, you must do your own conversion. You + * may also need to change the font of the console to see non-ASCII characters properly. + * This is particularly true for Windows. + * @li @b Security @b warning: Do not insert untrusted strings (such as user-supplied arguments) + * into the usage. printUsage() has no protection against malicious UTF-8 sequences. + * + * @param prn The output method to use. See the examples above. + * @param usage the Descriptor[] array whose @c help texts will be formatted. + * @param width the maximum number of characters per output line. Note that this number is + * in actual characters, not bytes. printUsage() supports UTF-8 in @c help and will + * count multi-byte UTF-8 sequences properly. Asian wide characters are counted + * as 2 characters. + * @param last_column_min_percent (0-100) The minimum percentage of @c width that should be available + * for the last column (which typically contains the textual explanation of an option). + * If less space is available, the last column will be printed on its own line, indented + * according to @c last_column_own_line_max_percent. + * @param last_column_own_line_max_percent (0-100) If the last column is printed on its own line due to + * less than @c last_column_min_percent of the width being available, then only + * @c last_column_own_line_max_percent of the extra line(s) will be used for the + * last column's text. This ensures an indentation. See example below. + * + * @code + * // width=20, last_column_min_percent=50 (i.e. last col. min. width=10) + * --3456789 1234567890 + * 1234567890 + * + * // width=20, last_column_min_percent=75 (i.e. last col. min. width=15) + * // last_column_own_line_max_percent=75 + * --3456789 + * 123456789012345 + * 67890 + * + * // width=20, last_column_min_percent=75 (i.e. last col. min. width=15) + * // last_column_own_line_max_percent=33 (i.e. max. 5) + * --3456789 + * 12345 + * 67890 + * 12345 + * 67890 + * @endcode + */ +template +void printUsage(OStream& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) +{ + PrintUsageImplementation::OStreamWriter write(prn); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); +} + +template +void printUsage(Function* prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) +{ + PrintUsageImplementation::FunctionWriter write(prn); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); +} + +template +void printUsage(const Temporary& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) +{ + PrintUsageImplementation::TemporaryWriter write(prn); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); +} + +template +void printUsage(Syscall* prn, int fd, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) +{ + PrintUsageImplementation::SyscallWriter write(prn, fd); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); +} + +template +void printUsage(Function* prn, Stream* stream, const Descriptor usage[], int width = 80, int last_column_min_percent = + 50, + int last_column_own_line_max_percent = 75) +{ + PrintUsageImplementation::StreamWriter write(prn, stream); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); +} + +} +// namespace option + +#endif /* OPTIONPARSER_H_ */ diff --git a/partialparser.py b/partialparser.py new file mode 100644 index 0000000..a8d9f3e --- /dev/null +++ b/partialparser.py @@ -0,0 +1,20 @@ +import re + +def parse(data): + partials = {} + for name, body in re.findall('^\s*partial (.*?)\s*{(.*?)}', data, re.M|re.S): + if name not in partials: + partials[name] = [], [] + members, params = partials[name] + for elem in body.split(';'): + elem = elem.strip() + if not elem: + continue + if elem.startswith('[ctor]'): + elem = elem[6:].strip() + type, name = re.match('^(.*?)([_a-zA-Z][_a-zA-Z0-9]+)$', elem).groups() + params.append((type, name)) + + members.append(elem + ';') + + return partials