refactor/rpl: Treat HLE libs more like RPL modules

HLE modules now have a unified interface via which they can get notified when mapped into the process or when loaded/unloaded.

We also always call the unload functions when stopping emulation to give the module implementations a chance to reset all state (although many of them are still missing proper cleanup code for now)
This commit is contained in:
Exzap 2025-12-02 14:42:49 +01:00
parent df52fd69b7
commit c5913fe8cb
105 changed files with 3628 additions and 2401 deletions

View File

@ -515,6 +515,8 @@ add_library(CemuCafe
OS/libs/zlib125
OS/libs/zlib125/zlib125.cpp
OS/libs/zlib125/zlib125.h
OS/RPL/COSModule.cpp
OS/RPL/COSModule.h
OS/RPL/elf.cpp
OS/RPL/rpl.cpp
OS/RPL/rpl_debug_symbols.cpp

View File

@ -386,8 +386,9 @@ void cemu_initForGame()
ppcCyclesSince2000 = theTime * (uint64)ESPRESSO_CORE_CLOCK;
ppcCyclesSince2000TimerClock = ppcCyclesSince2000 / 20ULL;
PPCTimer_start();
// this must happen after the RPX/RPL files are mapped to memory (coreinit sets up heaps so that they don't overwrite RPX/RPL data)
osLib_load();
// coreinit is bootstrapped first and then the main game executable is loaded
RPLLoader_LoadCoreinit();
LoadMainExecutable();
// link all modules
uint32 linkTimeStart = GetTickCount();
RPLLoader_UpdateDependencies();
@ -604,21 +605,6 @@ namespace CafeSystem
iosu::iosuAcp_init();
iosu::nim::Initialize();
iosu::odm::Initialize();
// init Cafe OS
avm::Initialize();
drmapp::Initialize();
TCL::Initialize();
nn::cmpt::Initialize();
nn::ccr::Initialize();
nn::temp::Initialize();
nn::aoc::Initialize();
nn::pdm::Initialize();
snd::user::Initialize();
H264::Initialize();
snd_core::Initialize();
mic::Initialize();
nfc::Initialize();
ntag::Initialize();
// init hardware register interfaces
HW_SI::Initialize();
}
@ -749,7 +735,7 @@ namespace CafeSystem
}
}
PREPARE_STATUS_CODE SetupExecutable()
PREPARE_STATUS_CODE PrepareExecutable()
{
// set rpx path from cos.xml if available
_pathToBaseExecutable = _pathToExecutable;
@ -780,7 +766,6 @@ namespace CafeSystem
}
}
}
LoadMainExecutable();
return PREPARE_STATUS_CODE::SUCCESS;
}
@ -813,7 +798,7 @@ namespace CafeSystem
// setup memory space and PPC recompiler
SetupMemorySpace();
PPCRecompiler_init();
r = SetupExecutable(); // load RPX
r = PrepareExecutable(); // load RPX
if (r != PREPARE_STATUS_CODE::SUCCESS)
return r;
InitVirtualMlcStorage();
@ -858,7 +843,7 @@ namespace CafeSystem
SetupMemorySpace();
PPCRecompiler_init();
// load executable
SetupExecutable();
PrepareExecutable();
InitVirtualMlcStorage();
return PREPARE_STATUS_CODE::SUCCESS;
}
@ -1020,7 +1005,7 @@ namespace CafeSystem
GX2::_GX2DriverReset();
nn::save::ResetToDefaultState();
coreinit::__OSDeleteAllActivePPCThreads();
RPLLoader_ResetState();
RPLLoader_UnloadAll();
for(auto it = s_iosuModules.rbegin(); it != s_iosuModules.rend(); ++it)
(*it)->TitleStop();
// reset Cemu subsystems

View File

@ -0,0 +1,104 @@
#include "COSModule.h"
#include "Cafe/OS/libs/coreinit/coreinit.h"
#include "Cafe/OS/libs/zlib125/zlib125.h"
#include "OS/libs/gx2/GX2.h"
#include "OS/libs/dmae/dmae.h"
#include "OS/libs/padscore/padscore.h"
#include "OS/libs/vpad/vpad.h"
#include "OS/libs/snd_core/ax.h"
#include "OS/libs/snd_user/snd_user.h"
#include "OS/libs/mic/mic.h"
#include "OS/libs/erreula/erreula.h"
#include "OS/libs/nlibnss/nlibnss.h"
#include "OS/libs/nn_acp/nn_acp.h"
#include "OS/libs/nn_act/nn_act.h"
#include "OS/libs/nn_acp/nn_acp.h"
#include "OS/libs/nn_ac/nn_ac.h"
#include "OS/libs/nn_boss/nn_boss.h"
#include "OS/libs/nn_ec/nn_ec.h"
#include "OS/libs/nn_boss/nn_boss.h"
#include "OS/libs/nn_nfp/nn_nfp.h"
#include "OS/libs/nn_uds/nn_uds.h"
#include "OS/libs/nn_nim/nn_nim.h"
#include "OS/libs/nn_ndm/nn_ndm.h"
#include "OS/libs/nn_spm/nn_spm.h"
#include "OS/libs/nn_save/nn_save.h"
#include "OS/libs/nsysnet/nsysnet.h"
#include "OS/libs/nn_fp/nn_fp.h"
#include "OS/libs/nn_idbe/nn_idbe.h"
#include "OS/libs/nn_olv/nn_olv.h"
#include "OS/libs/nn_idbe/nn_idbe.h"
#include "OS/libs/nlibnss/nlibnss.h"
#include "OS/libs/nlibcurl/nlibcurl.h"
#include "OS/libs/sysapp/sysapp.h"
#include "OS/libs/nsyshid/nsyshid.h"
#include "OS/libs/nsyskbd/nsyskbd.h"
#include "OS/libs/swkbd/swkbd.h"
#include "OS/libs/camera/camera.h"
#include "OS/libs/proc_ui/proc_ui.h"
#include "OS/libs/avm/avm.h"
#include "OS/libs/drmapp/drmapp.h"
#include "OS/libs/TCL/TCL.h"
#include "OS/libs/nn_cmpt/nn_cmpt.h"
#include "OS/libs/nn_ccr/nn_ccr.h"
#include "OS/libs/nn_temp/nn_temp.h"
#include "OS/libs/nn_aoc/nn_aoc.h"
#include "OS/libs/nn_pdm/nn_pdm.h"
#include "OS/libs/h264_avc/h264dec.h"
#include "OS/libs/ntag/ntag.h"
#include "OS/libs/nfc/nfc.h"
std::span<COSModule*> GetCOSModules()
{
static std::vector<COSModule*> s_cosModules =
{
coreinit::GetModule(),
zlib::GetModule(),
GX2::GetModule(),
dmae::GetModule(),
padscore::GetModule(),
vpad::GetModule(),
snd_core::GetModuleSndCore1(),
snd_core::GetModuleSndCore2(),
snd_user::GetModuleSndUser1(),
snd_user::GetModuleSndUser2(),
mic::GetModule(),
nn::erreula::GetModule(),
nn::act::GetModule(),
nn::acp::GetModule(),
nn::ac::GetModule(),
nn::ec::GetModule(),
nn::boss::GetModule(),
nn::nfp::GetModule(),
nn::uds::GetModule(),
nn::nim::GetModule(),
nn::ndm::GetModule(),
nn::spm::GetModule(),
nn::save::GetModule(),
nsysnet::GetModule(),
nn::fp::GetModule(),
nn::olv::GetModule(),
nn::idbe::GetModule(),
nlibnss::GetModule(),
nlibcurl::GetModule(),
sysapp::GetModule(),
nsyshid::GetModule(),
nsyskbd::GetModule(),
swkbd::GetModule(),
camera::GetModule(),
proc_ui::GetModule(),
avm::GetModule(),
drmapp::GetModule(),
TCL::GetModule(),
nn::cmpt::GetModule(),
nn::ccr::GetModule(),
nn::temp::GetModule(),
nn::aoc::GetModule(),
nn::pdm::GetModule(),
H264::GetModule(),
ntag::GetModule(),
nfc::GetModule(),
};
return s_cosModules;
}

View File

@ -0,0 +1,23 @@
#pragma once
namespace coreinit
{
enum class RplEntryReason;
};
// base class for HLE RPL implementations
class COSModule
{
public:
virtual std::string_view GetName() = 0;
virtual std::vector<std::string_view> GetDependencies() { return {}; };
virtual void RPLMapped() {}; // RPL mapped into process
virtual void RPLUnmapped() {}; // RPL unmapped
virtual void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) {};
// note: to simplify cleanup, both RPLUnmapped() and rpl_entry(unload) are always called even if the process is shutdown via "Close game"
};
std::span<COSModule*> GetCOSModules();

View File

@ -1,3 +1,5 @@
#include <zlib.h>
#include "Cafe/OS/common/OSCommon.h"
#include "Cafe/Filesystem/fsc.h"
#include "Cafe/OS/RPL/rpl.h"
@ -9,12 +11,10 @@
#include "Cafe/GraphicPack/GraphicPack2.h"
#include "util/ChunkedHeap/ChunkedHeap.h"
#include <zlib.h>
#include "util/crypto/crc32.h"
#include "config/ActiveSettings.h"
#include "Cafe/OS/libs/coreinit/coreinit_DynLoad.h"
#include "WindowSystem.h"
#include "COSModule.h"
class PPCCodeHeap : public VHeap
{
@ -75,8 +75,8 @@ struct RPLRegionMappingTable
#define RPL_MAPPING_REGION_TEXT 2
#define RPL_MAPPING_REGION_TEMP 3
void RPLLoader_UnloadModule(RPLModule* rpl);
void RPLLoader_RemoveDependency(const char* name);
void RPLLoader_UnloadModule(RPLDependency* rplDependency, bool skipPPCCalls);
void RPLLoader_RemoveDependency(std::string_view name);
uint8* RPLLoader_AllocateTrampolineCodeSpace(RPLModule* rplLoaderContext, sint32 size)
{
@ -1418,7 +1418,7 @@ void RPLLoader_InitState()
rplLoaderHeap_codeArea2.setHeapBase(memory_getPointerFromVirtualOffset(MEMORY_CODEAREA_ADDR));
rplLoaderHeap_workarea.setHeapBase(memory_getPointerFromVirtualOffset(MEMORY_RPLLOADER_AREA_ADDR));
g_heapTrampolineArea.setBaseAllocator(&rplLoaderHeap_lowerAreaCodeMem2);
RPLLoader_ResetState();
RPLLoader_UnloadAll();
}
void RPLLoader_BeginCemuhookCRC(RPLModule* rpl)
@ -1578,7 +1578,7 @@ void RPLLoader_InitModuleAllocator(RPLModule* rpl)
}
// map rpl into memory, but do not resolve relocs and imports yet
RPLModule* RPLLoader_LoadFromMemory(uint8* rplData, sint32 size, char* name)
RPLModule* RPLLoader_LoadFromMemory(uint8* rplData, sint32 size, std::string_view name)
{
char moduleName[RPL_MODULE_NAME_LENGTH];
_RPLLoader_ExtractModuleNameFromPath(moduleName, name);
@ -1783,30 +1783,45 @@ void RPLLoader_LoadDebugSymbols(RPLModule* rplLoaderContext)
}
}
void RPLLoader_UnloadModule(RPLModule* rpl)
void RPLLoader_UnloadModule(RPLDependency* rplDependency, bool skipPPCCalls)
{
/*
A note:
Mario Party 10's mg0480.rpl (minigame Spike Ball Scramble) has a bug where it keeps running code (function 0x02086BCC for example) after RPL unload
Mario Party 10's mg0408.rpl (minigame Spike Ball Scramble) has a bug where it keeps running code (function 0x02086BCC for example) after RPL unload
It seems to rely on the RPL loader not zeroing released memory
*/
if (rplDependency->rplHLEModule)
{
// HLE module unload logic is handled by parent functions for now
return;
}
RPLModule* rpl = rplDependency->rplLoaderContext;
// decrease reference counters of all dependencies
RPLLoader_decrementModuleDependencyRefs(rpl);
// save module config for this module in the debugger
g_debuggerDispatcher.NotifyModuleUnloaded(rpl);
// call rpl_entry with reason unload
if (!skipPPCCalls)
{
cemu_assert_debug(PPCInterpreter_getCurrentInstance()); // must be running on a CPU emulation thread
if (rpl->entrypoint)
{
PPCCoreCallback(rpl->entrypoint, rplDependency->coreinitHandle, 2); // 2 -> unload
}
}
// release memory
rplLoaderHeap_codeArea2.free(rpl->regionMappingBase_text.GetPtr());
rpl->regionMappingBase_text = nullptr;
// for some reason freeing the data allocations causes a crash in MP10 on boot
//RPLLoader_FreeData(rpl, MEMPTR<void>(rpl->regionMappingBase_data).GetPtr());
//rpl->regionMappingBase_data = 0;
//RPLLoader_FreeData(rpl, MEMPTR<void>(rpl->regionMappingBase_loaderInfo).GetPtr());
//rpl->regionMappingBase_loaderInfo = 0;
if (!skipPPCCalls)
{
RPLLoader_FreeData(rpl, MEMPTR<void>(rpl->regionMappingBase_data).GetPtr());
rpl->regionMappingBase_data = 0;
RPLLoader_FreeData(rpl, MEMPTR<void>(rpl->regionMappingBase_loaderInfo).GetPtr());
rpl->regionMappingBase_loaderInfo = 0;
}
rpl->heapTrampolineArea.releaseAll();
// todo - remove from rplSymbolStorage_store
@ -1906,22 +1921,21 @@ bool RPLLoader_IsKnownCafeOSModule(std::string_view name)
return s_systemModules556.contains(nameLower);
}
// increment reference counter for module
void RPLLoader_AddDependency(const char* name)
COSModule* RPLLoader_GetHLECafeOSModule(std::string_view moduleName)
{
cemu_assert(name[0] != '\0');
// if name includes a path, cut it off
const char* namePtr = name + strlen(name) - 1;
while (namePtr > name)
std::span<COSModule*> cosModules = GetCOSModules();
for (auto& module : cosModules)
{
if (*namePtr == '/')
{
namePtr++;
break;
}
namePtr--;
if (boost::iequals(module->GetName(), moduleName))
return module;
}
name = namePtr;
return nullptr;
}
// increment reference counter for module
void RPLLoader_AddDependency(std::string_view name)
{
cemu_assert(!name.empty());
// get module name from path
char moduleName[RPL_MODULE_NAME_LENGTH];
_RPLLoader_ExtractModuleNameFromPath(moduleName, name);
@ -1941,40 +1955,30 @@ void RPLLoader_AddDependency(const char* name)
newDependency->coreinitHandle = rplLoader_currentHandleCounter;
newDependency->tlsModuleIndex = rplLoader_currentTlsModuleIndex;
newDependency->isCafeOSModule = RPLLoader_IsKnownCafeOSModule(moduleName);
newDependency->rplHLEModule = RPLLoader_GetHLECafeOSModule(moduleName);
rplLoader_currentTlsModuleIndex++; // todo - delay handle and tls allocation until the module is actually loaded. It may not exist
rplLoader_currentHandleCounter++;
if (rplLoader_currentTlsModuleIndex == 0x7FFF)
cemuLog_log(LogType::Force, "RPLLoader: Exhausted TLS module indices pool");
// convert name to path/filename if it isn't already one
if (strchr(name, '.'))
if (name.find_first_of('.') != std::string_view::npos)
{
strcpy_s(newDependency->filepath, name);
newDependency->filepath = name;
}
else
{
strcpy_s(newDependency->filepath, name);
strcat_s(newDependency->filepath, ".rpl");
newDependency->filepath = name;
newDependency->filepath.append(".rpl");
}
newDependency->filepath[RPL_MODULE_PATH_LENGTH - 1] = '\0';
if (newDependency->filepath.size() >= RPL_MODULE_PATH_LENGTH)
cemuLog_log(LogType::Force, "RPLLoader_AddDependency(): RPL path too long \"{}\"", newDependency->filepath);
rplDependencyList.push_back(newDependency);
}
// decrement reference counter for dependency by module path
void RPLLoader_RemoveDependency(const char* name)
void RPLLoader_RemoveDependency(std::string_view name)
{
cemu_assert(*name != '\0');
// if name includes a path, cut it off
const char* namePtr = name + strlen(name) - 1;
while (namePtr > name)
{
if (*namePtr == '/')
{
namePtr++;
break;
}
namePtr--;
}
name = namePtr;
cemu_assert(!name.empty());
// get module name from path
char moduleName[RPL_MODULE_NAME_LENGTH];
_RPLLoader_ExtractModuleNameFromPath(moduleName, name);
@ -2016,6 +2020,18 @@ void RPLLoader_RemoveDependency(uint32 handle)
}
}
RPLDependency* RPLLoader_GetDependencyByRPLModule(RPLModule* rpl)
{
cemu_assert_debug(rpl);
for (auto& dep : rplDependencyList)
{
if (dep->rplLoaderContext == rpl)
return dep;
}
cemu_assert_suspicious(); // should never happen. Modules get loaded via dependency tracking so a dependency entry needs to exist
return nullptr;
}
uint32 RPLLoader_GetHandleByModuleName(const char* name)
{
// get module name from path
@ -2061,10 +2077,10 @@ bool RPLLoader_GetTLSDataByTLSIndex(sint16 tlsModuleIndex, uint8** tlsData, sint
return true;
}
bool RPLLoader_LoadFromVirtualPath(RPLDependency* dependency, char* filePath)
bool RPLLoader_LoadFromVirtualPath(RPLDependency* dependency, std::string_view filePath)
{
uint32 rplSize = 0;
uint8* rplData = fsc_extractFile(filePath, &rplSize);
uint8* rplData = fsc_extractFile(std::string(filePath).c_str(), &rplSize);
if (rplData)
{
cemuLog_logDebug(LogType::Force, "Loading: {}", filePath);
@ -2075,9 +2091,21 @@ bool RPLLoader_LoadFromVirtualPath(RPLDependency* dependency, char* filePath)
return false;
}
std::span<COSModule*> GetCOSModules();
void RPLLoader_LoadDependency(RPLDependency* dependency)
{
dependency->loadAttempted = true;
// if its a HLE module then notify that it has been mapped
if (dependency->rplHLEModule)
{
dependency->rplHLEModule->RPLMapped();
// load chained dependencies
// this is necessary for something like GX2.rpl which uses TCL.rpl functions
auto depList = dependency->rplHLEModule->GetDependencies();
for (const auto& dep : depList)
RPLLoader_AddDependency(dep);
return;
}
// check if module is already loaded
for (sint32 i = 0; i < rplModuleCount; i++)
{
@ -2086,27 +2114,28 @@ void RPLLoader_LoadDependency(RPLDependency* dependency)
dependency->rplLoaderContext = rplModuleList[i];
return;
}
char filePath[RPL_MODULE_PATH_LENGTH];
//char filePath[RPL_MODULE_PATH_LENGTH];
std::string rplPath;
// check if path is absolute
if (dependency->filepath[0] == '/')
if (!dependency->filepath.empty() && dependency->filepath.front() == '/')
{
strcpy_s(filePath, dependency->filepath);
RPLLoader_LoadFromVirtualPath(dependency, filePath);
rplPath = dependency->filepath;
RPLLoader_LoadFromVirtualPath(dependency, rplPath);
return;
}
// attempt to load rpl from code directory of current title
strcpy_s(filePath, "/internal/current_title/code/");
strcat_s(filePath, dependency->filepath);
rplPath = "/internal/current_title/code/";
rplPath.append(dependency->filepath);
// except if it is blacklisted
bool isBlacklisted = false;
if (boost::iequals(dependency->filepath, "erreula.rpl"))
{
if (fsc_doesFileExist(filePath))
if (fsc_doesFileExist(rplPath.c_str()))
isBlacklisted = true;
}
if (isBlacklisted)
cemuLog_log(LogType::Force, fmt::format("Game tried to load \"{}\" but it is blacklisted (using Cemu's implementation instead)", filePath));
else if (RPLLoader_LoadFromVirtualPath(dependency, filePath))
cemuLog_log(LogType::Force, fmt::format("Game tried to load \"{}\" but it is blacklisted (using Cemu's implementation instead)", rplPath));
else if (RPLLoader_LoadFromVirtualPath(dependency, rplPath))
return;
// attempt to load rpl from Cemu's /cafeLibs/ directory
if (ActiveSettings::LoadSharedLibrariesEnabled())
@ -2116,8 +2145,7 @@ void RPLLoader_LoadDependency(RPLDependency* dependency)
if (fileData)
{
cemuLog_log(LogType::Force, "Loading RPL: /cafeLibs/{}", dependency->filepath);
dependency->rplLoaderContext = RPLLoader_LoadFromMemory(fileData->data(), fileData->size(),
dependency->filepath);
dependency->rplLoaderContext = RPLLoader_LoadFromMemory(fileData->data(), fileData->size(), dependency->filepath);
return;
}
}
@ -2140,9 +2168,18 @@ void RPLLoader_UpdateDependencies()
// todo - should we let HLE modules know if they are being unloaded?
if (dependency->rplLoaderContext)
{
RPLLoader_UnloadModule(dependency->rplLoaderContext);
RPLLoader_UnloadModule(dependency, false);
dependency->rplLoaderContext = nullptr;
}
else if (dependency->rplHLEModule)
{
dependency->rplHLEModule->rpl_entry(dependency->coreinitHandle, coreinit::RplEntryReason::Unloaded);
dependency->rplHLEModule->RPLUnmapped();
// untrack chained dependencies
auto depList = dependency->rplHLEModule->GetDependencies();
for (const auto& dep : depList)
RPLLoader_RemoveDependency(dep);
}
// remove from dependency list
rplDependencyList.erase(rplDependencyList.begin()+idx);
idx--;
@ -2152,13 +2189,11 @@ void RPLLoader_UpdateDependencies()
else if (!dependency->loadAttempted)
{
// load
if (dependency->rplLoaderContext == nullptr)
{
RPLLoader_LoadDependency(dependency);
repeat = true;
idx++;
break;
}
dependency->loadAttempted = true;
RPLLoader_LoadDependency(dependency);
repeat = true;
idx++;
break;
}
idx++;
}
@ -2166,6 +2201,21 @@ void RPLLoader_UpdateDependencies()
RPLLoader_Link();
}
void RPLLoader_LoadCoreinit()
{
RPLLoader_AddDependency("coreinit");
for (auto& dep : rplDependencyList)
{
if (strcmp(dep->modulename, "coreinit") == 0)
{
dep->loadAttempted = true;
RPLLoader_LoadDependency(dep);
return;
}
}
cemu_assert_suspicious();
}
void RPLLoader_SetMainModule(RPLModule* rplLoaderContext)
{
rplLoaderContext->entrypointCalled = true;
@ -2226,9 +2276,20 @@ RPLModule* RPLLoader_FindModuleByName(std::string module)
void RPLLoader_CallEntrypoints()
{
// for HLE modules we need to check the dependency list
for (auto& dependency : rplDependencyList)
{
if (!dependency->rplHLEModule)
continue;
if (dependency->hleEntrypointCalled)
continue;
dependency->rplHLEModule->rpl_entry(dependency->coreinitHandle, coreinit::RplEntryReason::Loaded);
dependency->hleEntrypointCalled = true;
}
// iterate loaded RPL modules
for (sint32 i = 0; i < rplModuleCount; i++)
{
if( rplModuleList[i]->entrypointCalled )
if (rplModuleList[i]->entrypointCalled)
continue;
uint32 moduleHandle = RPLLoader_GetHandleByModuleName(rplModuleList[i]->moduleName2.c_str());
MPTR entryPoint = RPLLoader_GetModuleEntrypoint(rplModuleList[i]);
@ -2376,11 +2437,29 @@ void RPLLoader_ReleaseCodeCaveMem(MEMPTR<void> addr)
heapCodeCaveArea.free(addr.GetMPTR());
}
void RPLLoader_ResetState()
void RPLLoader_UnloadAll()
{
// unload all RPL modules
while (rplModuleCount > 0)
RPLLoader_UnloadModule(rplModuleList[0]);
{
RPLDependency* dep = RPLLoader_GetDependencyByRPLModule(rplModuleList[0]);
RPLLoader_UnloadModule(dep, true);
}
// notify every remaining HLE module its unloaded and unmapped
// and do it in reverse order so that coreinit comes last
RPLLoader_RemoveDependency("coreinit"); // undo manual ref count from RPLLoader_LoadCoreinit()
for (sint32 i = (sint32)rplDependencyList.size()-1; i>=0; i--)
{
RPLDependency* dependency = rplDependencyList[i];
cemu_assert_debug(dependency->referenceCount >= 0); // sanity check for ref count
if (!dependency->rplHLEModule)
continue;
if (dependency->referenceCount <= 0)
continue;
cemu_assert_debug(dependency->hleEntrypointCalled); // entrypoint should have been called
dependency->rplHLEModule->rpl_entry(dependency->coreinitHandle, coreinit::RplEntryReason::Unloaded);
dependency->rplHLEModule->RPLUnmapped();
}
rplDependencyList.clear();
// unload all remaining symbols
rplSymbolStorage_unloadAll();

View File

@ -5,7 +5,7 @@ struct RPLModule;
#define RPL_INVALID_HANDLE 0xFFFFFFFF
void RPLLoader_InitState();
void RPLLoader_ResetState();
void RPLLoader_UnloadAll();
uint8* RPLLoader_AllocateTrampolineCodeSpace(sint32 size);
@ -14,7 +14,7 @@ MPTR RPLLoader_AllocateCodeSpace(uint32 size, uint32 alignment);
uint32 RPLLoader_GetMaxCodeOffset();
uint32 RPLLoader_GetDataAllocatorAddr();
RPLModule* RPLLoader_LoadFromMemory(uint8* rplData, sint32 size, char* name);
RPLModule* RPLLoader_LoadFromMemory(uint8* rplData, sint32 size, std::string_view name);
uint32 rpl_mapHLEImport(RPLModule* rplLoaderContext, const char* rplName, const char* funcName, bool functionMustExist);
void RPLLoader_Link();
@ -27,11 +27,13 @@ uint32 RPLLoader_GetMainModuleHandle();
void RPLLoader_CallEntrypoints();
void RPLLoader_NotifyControlPassedToApplication();
void RPLLoader_AddDependency(const char* name);
void RPLLoader_AddDependency(std::string_view name);
void RPLLoader_RemoveDependency(uint32 handle);
bool RPLLoader_HasDependency(std::string_view name);
void RPLLoader_UpdateDependencies();
void RPLLoader_LoadCoreinit();
uint32 RPLLoader_GetHandleByModuleName(const char* name);
uint32 RPLLoader_GetMaxTLSModuleIndex();
bool RPLLoader_GetTLSDataByTLSIndex(sint16 tlsModuleIndex, uint8** tlsData, sint32* tlsSize);

View File

@ -228,10 +228,12 @@ struct RPLModule
struct RPLDependency
{
char modulename[RPL_MODULE_NAME_LENGTH];
char filepath[RPL_MODULE_PATH_LENGTH];
std::string filepath;
bool loadAttempted;
bool isCafeOSModule; // name is a known Cafe OS RPL
RPLModule* rplLoaderContext; // context of loaded module, can be nullptr for HLE COS modules
bool hleEntrypointCalled{false};
bool isCafeOSModule; // name is a known Cafe OS system RPL
RPLModule* rplLoaderContext{}; // context of loaded module, can be nullptr for HLE COS modules
class COSModule* rplHLEModule{}; // set if this is a HLE module
sint32 referenceCount;
uint32 coreinitHandle; // fake handle for coreinit
sint16 tlsModuleIndex; // tls module index assigned to this dependency

View File

@ -186,40 +186,3 @@ void osLib_returnFromFunction64(PPCInterpreter_t* hCPU, uint64 returnValue64)
hCPU->gpr[4] = (returnValue64>>0)&0xFFFFFFFF;
hCPU->instructionPointer = hCPU->spr.LR;
}
void osLib_load()
{
// load HLE modules
coreinit_load();
zlib::load();
gx2_load();
dmae_load();
padscore::load();
vpad::load();
snd_core::loadExports();
nn::erreula::load();
nnAct_load();
nn::acp::load();
nnAc_load();
nnEc_load();
nnBoss_load();
nn::nfp::load();
nnUds_load();
nn::nim::load();
nn::ndm::load();
nn::spm::load();
nn::save::load();
nnSL_load();
nsysnet_load();
nn::fp::load();
nn::olv::load();
nn::idbe::load();
nlibnss::load();
nlibcurl::load();
sysapp_load();
nsyshid::load();
nsyskbd::nsyskbd_load();
swkbd::load();
camera::load();
proc_ui::load();
}

View File

@ -2,11 +2,9 @@
struct PPCInterpreter_t;
#define OSLIB_FUNCTIONTABLE_TYPE_FUNCTION (1)
#define OSLIB_FUNCTIONTABLE_TYPE_POINTER (2)
void osLib_load();
void osLib_generateHashFromName(const char* name, uint32* hashA, uint32* hashB);
sint32 osLib_getFunctionIndex(const char* libraryName, const char* functionName);
uint32 osLib_getPointer(const char* libraryName, const char* functionName);
@ -21,6 +19,16 @@ void osLib_returnFromFunction64(PPCInterpreter_t* hCPU, uint64 returnValue64);
// libs
#include "Cafe/OS/libs/coreinit/coreinit.h"
// from coreinit but more convenient to have this in the common header
namespace coreinit
{
enum class RplEntryReason
{
Loaded = 1,
Unloaded = 2,
};
}
// utility functions
#include "Cafe/OS/common/OSUtil.h"

View File

@ -156,14 +156,39 @@ namespace TCL
return 0;
}
void Initialize()
class : public COSModule
{
cafeExportRegister("TCL", TCLSubmitToRing, LogType::Placeholder);
cafeExportRegister("TCL", TCLTimestamp, LogType::Placeholder);
cafeExportRegister("TCL", TCLWaitTimestamp, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "tcl";
}
s_currentRetireMarker = 0;
s_tclStatePPC->gpuRetireMarker = 0;
coreinit::OSInitEvent(s_updateRetirementEvent.GetPtr(), coreinit::OSEvent::EVENT_STATE::STATE_NOT_SIGNALED, coreinit::OSEvent::EVENT_MODE::MODE_AUTO);
void RPLMapped() override
{
cafeExportRegister("TCL", TCLSubmitToRing, LogType::Placeholder);
cafeExportRegister("TCL", TCLTimestamp, LogType::Placeholder);
cafeExportRegister("TCL", TCLWaitTimestamp, LogType::Placeholder);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
s_currentRetireMarker = 0;
s_tclStatePPC->gpuRetireMarker = 0;
coreinit::OSInitEvent(s_updateRetirementEvent.GetPtr(), coreinit::OSEvent::EVENT_STATE::STATE_NOT_SIGNALED, coreinit::OSEvent::EVENT_MODE::MODE_AUTO);
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
s_currentRetireMarker = 0;
s_tclStatePPC->gpuRetireMarker = 0;
}
}
}s_COStclModule;
COSModule* GetModule()
{
return &s_COStclModule;
}
}

View File

@ -1,3 +1,5 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace TCL
{
enum class TCLTimestampId
@ -20,6 +22,6 @@ namespace TCL
bool TCLGPUReadRBWord(uint32& cmdWord);
void TCLGPUNotifyNewRetirementTimestamp();
void Initialize();
COSModule* GetModule();
}
ENABLE_BITMASK_OPERATORS(TCL::TCLSubmissionFlag);

View File

@ -29,12 +29,26 @@ namespace avm
return true; // returns 1 (true) if new state was applied successfully?
}
void Initialize()
class : public COSModule
{
cafeExportRegister("avm", AVMIsHDCPAvailable, LogType::Placeholder);
cafeExportRegister("avm", AVMIsHDCPOn, LogType::Placeholder);
cafeExportRegister("avm", AVMGetAnalogContentsProtectionEnable, LogType::Placeholder);
cafeExportRegister("avm", AVMIsAnalogContentsProtectionOn, LogType::Placeholder);
cafeExportRegister("avm", AVMSetAnalogContentsProtectionEnable, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "avm";
}
void RPLMapped() override
{
cafeExportRegister("avm", AVMIsHDCPAvailable, LogType::Placeholder);
cafeExportRegister("avm", AVMIsHDCPOn, LogType::Placeholder);
cafeExportRegister("avm", AVMGetAnalogContentsProtectionEnable, LogType::Placeholder);
cafeExportRegister("avm", AVMIsAnalogContentsProtectionOn, LogType::Placeholder);
cafeExportRegister("avm", AVMSetAnalogContentsProtectionEnable, LogType::Placeholder);
};
}s_COSavmModule;
COSModule* GetModule()
{
return &s_COSavmModule;
}
}

View File

@ -1,5 +1,6 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace avm
{
void Initialize();
COSModule* GetModule();
}

View File

@ -242,16 +242,41 @@ namespace camera
g_cameraCounter = 0;
}
void load()
class : public COSModule
{
reset();
cafeExportRegister("camera", CAMGetMemReq, LogType::Placeholder);
cafeExportRegister("camera", CAMCheckMemSegmentation, LogType::Placeholder);
cafeExportRegister("camera", CAMInit, LogType::Placeholder);
cafeExportRegister("camera", CAMExit, LogType::Placeholder);
cafeExportRegister("camera", CAMOpen, LogType::Placeholder);
cafeExportRegister("camera", CAMClose, LogType::Placeholder);
cafeExportRegister("camera", CAMSubmitTargetSurface, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "camera";
}
void RPLMapped() override
{
cafeExportRegister("camera", CAMGetMemReq, LogType::Placeholder);
cafeExportRegister("camera", CAMCheckMemSegmentation, LogType::Placeholder);
cafeExportRegister("camera", CAMInit, LogType::Placeholder);
cafeExportRegister("camera", CAMExit, LogType::Placeholder);
cafeExportRegister("camera", CAMOpen, LogType::Placeholder);
cafeExportRegister("camera", CAMClose, LogType::Placeholder);
cafeExportRegister("camera", CAMSubmitTargetSurface, LogType::Placeholder);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
reset();
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
// todo
}
}
}s_COScameraModule;
COSModule* GetModule()
{
return &s_COScameraModule;
}
}

View File

@ -1,10 +1,10 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace camera
{
sint32 CAMOpen(sint32 camHandle);
sint32 CAMClose(sint32 camHandle);
void load();
COSModule* GetModule();
};

View File

@ -301,72 +301,98 @@ namespace coreinit
cafeExportRegister("coreinit", OSPanic, LogType::Placeholder);
}
};
void coreinit_load()
{
coreinit::InitializeCore();
coreinit::InitializeSchedulerLock();
coreinit::InitializeSysHeap();
class : public COSModule
{
public:
std::string_view GetName() override
{
return "coreinit";
}
// allocate coreinit global data
gCoreinitData = (CoreinitSharedData*)memory_getPointerFromVirtualOffset(coreinit_allocFromSysArea(sizeof(CoreinitSharedData), 32));
memset(gCoreinitData, 0x00, sizeof(CoreinitSharedData));
void RPLMapped() override
{
coreinit::InitializeCore();
coreinit::InitializeSchedulerLock();
coreinit::InitializeSysHeap();
// coreinit weak links
osLib_addVirtualPointer("coreinit", "MEMAllocFromDefaultHeap", memory_getVirtualOffsetFromPointer(&gCoreinitData->MEMAllocFromDefaultHeap));
osLib_addVirtualPointer("coreinit", "MEMAllocFromDefaultHeapEx", memory_getVirtualOffsetFromPointer(&gCoreinitData->MEMAllocFromDefaultHeapEx));
osLib_addVirtualPointer("coreinit", "MEMFreeToDefaultHeap", memory_getVirtualOffsetFromPointer(&gCoreinitData->MEMFreeToDefaultHeap));
osLib_addVirtualPointer("coreinit", "__atexit_cleanup", memory_getVirtualOffsetFromPointer(&gCoreinitData->__atexit_cleanup));
osLib_addVirtualPointer("coreinit", "__stdio_cleanup", memory_getVirtualOffsetFromPointer(&gCoreinitData->__stdio_cleanup));
osLib_addVirtualPointer("coreinit", "__cpp_exception_cleanup_ptr", memory_getVirtualOffsetFromPointer(&gCoreinitData->__cpp_exception_cleanup_ptr));
osLib_addVirtualPointer("coreinit", "__cpp_exception_init_ptr", memory_getVirtualOffsetFromPointer(&gCoreinitData->__cpp_exception_init_ptr));
// allocate coreinit global data
gCoreinitData = (CoreinitSharedData*)memory_getPointerFromVirtualOffset(coreinit_allocFromSysArea(sizeof(CoreinitSharedData), 32));
memset(gCoreinitData, 0x00, sizeof(CoreinitSharedData));
// init GHS and threads
coreinit::PrepareGHSRuntime();
coreinit::InitializeThread();
// coreinit weak links
osLib_addVirtualPointer("coreinit", "MEMAllocFromDefaultHeap", memory_getVirtualOffsetFromPointer(&gCoreinitData->MEMAllocFromDefaultHeap));
osLib_addVirtualPointer("coreinit", "MEMAllocFromDefaultHeapEx", memory_getVirtualOffsetFromPointer(&gCoreinitData->MEMAllocFromDefaultHeapEx));
osLib_addVirtualPointer("coreinit", "MEMFreeToDefaultHeap", memory_getVirtualOffsetFromPointer(&gCoreinitData->MEMFreeToDefaultHeap));
osLib_addVirtualPointer("coreinit", "__atexit_cleanup", memory_getVirtualOffsetFromPointer(&gCoreinitData->__atexit_cleanup));
osLib_addVirtualPointer("coreinit", "__stdio_cleanup", memory_getVirtualOffsetFromPointer(&gCoreinitData->__stdio_cleanup));
osLib_addVirtualPointer("coreinit", "__cpp_exception_cleanup_ptr", memory_getVirtualOffsetFromPointer(&gCoreinitData->__cpp_exception_cleanup_ptr));
osLib_addVirtualPointer("coreinit", "__cpp_exception_init_ptr", memory_getVirtualOffsetFromPointer(&gCoreinitData->__cpp_exception_init_ptr));
// reset threads
activeThreadCount = 0;
// init submodules
coreinit::InitializeMEM();
coreinit::InitializeMEMFrmHeap();
coreinit::InitializeMEMUnitHeap();
coreinit::InitializeMEMBlockHeap();
coreinit::InitializeFG();
coreinit::InitializeBSP();
coreinit::InitializeMCP();
coreinit::InitializeOverlayArena();
coreinit::InitializeDynLoad();
coreinit::InitializeGHS();
coreinit::InitializeHWInterface();
coreinit::InitializeAtomic();
coreinit::InitializeMemory();
coreinit::InitializeIM();
coreinit::InitializeLC();
coreinit::InitializeMP();
coreinit::InitializeTimeAndCalendar();
coreinit::InitializeAlarm();
coreinit::InitializeFS();
coreinit::InitializeSystemInfo();
coreinit::InitializeConcurrency();
coreinit::InitializeSpinlock();
coreinit::InitializeMessageQueue();
coreinit::InitializeIPC();
coreinit::InitializeIPCBuf();
coreinit::InitializeMemoryMapping();
coreinit::InitializeCodeGen();
coreinit::InitializeCoroutine();
coreinit::InitializeOSScreen();
// legacy mem stuff
coreinit::expheap_load();
// init GHS and threads
coreinit::PrepareGHSRuntime();
coreinit::InitializeThread();
// misc exports
coreinit::miscInit();
osLib_addFunction("coreinit", "OSGetSharedData", coreinitExport_OSGetSharedData);
osLib_addFunction("coreinit", "UCReadSysConfig", coreinitExport_UCReadSysConfig);
// reset threads
activeThreadCount = 0;
// init submodules
coreinit::InitializeMEM();
coreinit::InitializeMEMFrmHeap();
coreinit::InitializeMEMUnitHeap();
coreinit::InitializeMEMBlockHeap();
coreinit::InitializeFG();
coreinit::InitializeBSP();
coreinit::InitializeMCP();
coreinit::InitializeOverlayArena();
coreinit::InitializeDynLoad();
coreinit::InitializeGHS();
coreinit::InitializeHWInterface();
coreinit::InitializeAtomic();
coreinit::InitializeMemory();
coreinit::InitializeIM();
coreinit::InitializeLC();
coreinit::InitializeMP();
coreinit::InitializeTimeAndCalendar();
coreinit::InitializeAlarm();
coreinit::InitializeFS();
coreinit::InitializeSystemInfo();
coreinit::InitializeConcurrency();
coreinit::InitializeSpinlock();
coreinit::InitializeMessageQueue();
coreinit::InitializeIPC();
coreinit::InitializeIPCBuf();
coreinit::InitializeMemoryMapping();
coreinit::InitializeCodeGen();
coreinit::InitializeCoroutine();
coreinit::InitializeOSScreen();
// async callbacks
InitializeAsyncCallback();
// legacy mem stuff
coreinit::expheap_load();
// misc exports
coreinit::miscInit();
osLib_addFunction("coreinit", "OSGetSharedData", coreinitExport_OSGetSharedData);
osLib_addFunction("coreinit", "UCReadSysConfig", coreinitExport_UCReadSysConfig);
// async callbacks
InitializeAsyncCallback();
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
// todo
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
// todo
}
}
}s_COSCoreinitModule;
COSModule* GetModule()
{
return &s_COSCoreinitModule;
}
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "Cafe/HW/Espresso/Const.h"
#include "Cafe/OS/RPL/COSModule.h"
#define PPC_CORE_COUNT (Espresso::CORE_COUNT)
@ -11,10 +12,6 @@ void InitializeAsyncCallback();
void coreinitAsyncCallback_add(MPTR functionMPTR, uint32 numParameters, uint32 r3 = 0, uint32 r4 = 0, uint32 r5 = 0, uint32 r6 = 0, uint32 r7 = 0, uint32 r8 = 0, uint32 r9 = 0, uint32 r10 = 0);
void coreinitAsyncCallback_addWithLock(MPTR functionMPTR, uint32 numParameters, uint32 r3 = 0, uint32 r4 = 0, uint32 r5 = 0, uint32 r6 = 0, uint32 r7 = 0, uint32 r8 = 0, uint32 r9 = 0, uint32 r10 = 0);
// misc
void coreinit_load();
// coreinit shared memory
struct CoreinitSharedData
{
@ -42,4 +39,6 @@ namespace coreinit
sint32 OSGetCoreId();
uint32 OSGetCoreCount();
uint32 OSGetStackPointer();
COSModule* GetModule();
};

View File

@ -2,12 +2,6 @@
namespace coreinit
{
enum class RplEntryReason
{
Loaded = 1,
Unloaded = 2,
};
uint32 OSDynLoad_SetAllocator(MPTR allocFunc, MPTR freeFunc);
void OSDynLoad_SetTLSAllocator(MPTR allocFunc, MPTR freeFunc);
uint32 OSDynLoad_GetAllocator(betype<MPTR>* funcAlloc, betype<MPTR>* funcFree);

View File

@ -118,12 +118,28 @@ void dmaeExport_DMAEGetRetiredTimeStamp(PPCInterpreter_t* hCPU)
osLib_returnFromFunction64(hCPU, dmaeRetiredTimestamp);
}
void dmae_load()
namespace dmae
{
osLib_addFunction("dmae", "DMAECopyMem", dmaeExport_DMAECopyMem);
osLib_addFunction("dmae", "DMAEFillMem", dmaeExport_DMAEFillMem);
osLib_addFunction("dmae", "DMAEWaitDone", dmaeExport_DMAEWaitDone);
osLib_addFunction("dmae", "DMAESemaphore", dmaeExport_DMAESemaphore);
osLib_addFunction("dmae", "DMAEGetRetiredTimeStamp", dmaeExport_DMAEGetRetiredTimeStamp);
}
class : public COSModule
{
public:
std::string_view GetName() override
{
return "dmae";
}
void RPLMapped() override
{
osLib_addFunction("dmae", "DMAECopyMem", dmaeExport_DMAECopyMem);
osLib_addFunction("dmae", "DMAEFillMem", dmaeExport_DMAEFillMem);
osLib_addFunction("dmae", "DMAEWaitDone", dmaeExport_DMAEWaitDone);
osLib_addFunction("dmae", "DMAESemaphore", dmaeExport_DMAESemaphore);
osLib_addFunction("dmae", "DMAEGetRetiredTimeStamp", dmaeExport_DMAEGetRetiredTimeStamp);
}
}s_COSDMAEModule;
COSModule* GetModule()
{
return &s_COSDMAEModule;
}
}

View File

@ -1 +1,6 @@
void dmae_load();
#include "Cafe/OS/RPL/COSModule.h"
namespace dmae
{
COSModule* GetModule();
}

View File

@ -27,11 +27,26 @@ namespace drmapp
return 1;
}
void Initialize()
class : public COSModule
{
cafeExportRegisterFunc(NupChkIsFinished, "drmapp", "NupChkIsFinished__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(PatchChkIsFinished, "drmapp", "PatchChkIsFinished__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(AocChkIsFinished, "drmapp", "AocChkIsFinished__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(TicketChkIsFinished, "drmapp", "TicketChkIsFinished__3RplFv", LogType::Placeholder);
public:
std::string_view GetName() override
{
return "drmapp";
}
void RPLMapped() override
{
cafeExportRegisterFunc(NupChkIsFinished, "drmapp", "NupChkIsFinished__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(PatchChkIsFinished, "drmapp", "PatchChkIsFinished__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(AocChkIsFinished, "drmapp", "AocChkIsFinished__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(TicketChkIsFinished, "drmapp", "TicketChkIsFinished__3RplFv", LogType::Placeholder);
}
}s_COSdrmappModule;
COSModule* GetModule()
{
return &s_COSdrmappModule;
}
} // namespace drmapp

View File

@ -1,5 +1,6 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace drmapp
{
void Initialize();
COSModule* GetModule();
}

View File

@ -9,6 +9,7 @@
#include "Cafe/OS/libs/coreinit/coreinit_FS.h"
#include "Cafe/OS/libs/coreinit/coreinit_Time.h"
#include "Cafe/OS/libs/vpad/vpad.h"
#include "OS/libs/coreinit/coreinit_DynLoad.h"
namespace nn
{
@ -222,14 +223,12 @@ namespace erreula
struct ErrEula_t
{
SysAllocator<coreinit::OSMutex> mutex;
uint32 regionType;
uint32 langType;
uint32 regionType{0};
uint32 langType{0};
MEMPTR<coreinit::FSClient_t> fsClient;
std::unique_ptr<ErrEulaInstance> errEulaInstance;
AppearError currentDialog;
bool homeNixSignVisible;
bool homeNixSignVisible{false};
} g_errEula = {};
std::wstring GetText(uint16be* text)
@ -487,32 +486,62 @@ namespace erreula
ImGui::GetStyle().Alpha = originalAlpha;
}
void load()
class : public COSModule
{
g_errEula.errEulaInstance.reset();
public:
std::string_view GetName() override
{
return "erreula";
}
OSInitMutexEx(&g_errEula.mutex, nullptr);
void RPLMapped() override
{
cafeExportRegisterFunc(ErrEulaCreate, "erreula", "ErrEulaCreate__3RplFPUcQ3_2nn7erreula10RegionTypeQ3_2nn7erreula8LangTypeP8FSClient", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaDestroy, "erreula", "ErrEulaDestroy__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaCreate, "erreula", "ErrEulaCreate__3RplFPUcQ3_2nn7erreula10RegionTypeQ3_2nn7erreula8LangTypeP8FSClient", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaDestroy, "erreula", "ErrEulaDestroy__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(IsDecideSelectButtonError, "erreula", "ErrEulaIsDecideSelectButtonError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(IsDecideSelectLeftButtonError, "erreula", "ErrEulaIsDecideSelectLeftButtonError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(IsDecideSelectRightButtonError, "erreula", "ErrEulaIsDecideSelectRightButtonError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(IsDecideSelectButtonError, "erreula", "ErrEulaIsDecideSelectButtonError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(IsDecideSelectLeftButtonError, "erreula", "ErrEulaIsDecideSelectLeftButtonError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(IsDecideSelectRightButtonError, "erreula", "ErrEulaIsDecideSelectRightButtonError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(GetResultCode, "erreula", "ErrEulaGetResultCode__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(GetResultType, "erreula", "ErrEulaGetResultType__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(GetResultCode, "erreula", "ErrEulaGetResultCode__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(GetResultType, "erreula", "ErrEulaGetResultType__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaAppearError, "erreula", "ErrEulaAppearError__3RplFRCQ3_2nn7erreula9AppearArg", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaDisappearError, "erreula", "ErrEulaDisappearError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaGetStateErrorViewer, "erreula", "ErrEulaGetStateErrorViewer__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaAppearError, "erreula", "ErrEulaAppearError__3RplFRCQ3_2nn7erreula9AppearArg", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaDisappearError, "erreula", "ErrEulaDisappearError__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaGetStateErrorViewer, "erreula", "ErrEulaGetStateErrorViewer__3RplFv", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaCalc, "erreula", "ErrEulaCalc__3RplFRCQ3_2nn7erreula14ControllerInfo", LogType::Placeholder);
cafeExportRegisterFunc(ErrEulaCalc, "erreula", "ErrEulaCalc__3RplFRCQ3_2nn7erreula14ControllerInfo", LogType::Placeholder);
osLib_addFunction("erreula", "ErrEulaAppearHomeNixSign__3RplFRCQ3_2nn7erreula14HomeNixSignArg", export_AppearHomeNixSign);
osLib_addFunction("erreula", "ErrEulaChangeLang__3RplFQ3_2nn7erreula8LangType", export_ChangeLang);
osLib_addFunction("erreula", "ErrEulaIsAppearHomeNixSign__3RplFv", export_IsAppearHomeNixSign);
osLib_addFunction("erreula", "ErrEulaDisappearHomeNixSign__3RplFv", export_DisappearHomeNixSign);
}
osLib_addFunction("erreula", "ErrEulaAppearHomeNixSign__3RplFRCQ3_2nn7erreula14HomeNixSignArg", export_AppearHomeNixSign);
osLib_addFunction("erreula", "ErrEulaChangeLang__3RplFQ3_2nn7erreula8LangType", export_ChangeLang);
osLib_addFunction("erreula", "ErrEulaIsAppearHomeNixSign__3RplFv", export_IsAppearHomeNixSign);
osLib_addFunction("erreula", "ErrEulaDisappearHomeNixSign__3RplFv", export_DisappearHomeNixSign);
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
g_errEula.errEulaInstance.reset();
OSInitMutexEx(&g_errEula.mutex, nullptr);
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
g_errEula.errEulaInstance.reset();
// todo - refactor and clean up these variables to be part of errEulaInstance
g_errEula.regionType = 0;
g_errEula.langType = 0;
g_errEula.fsClient = nullptr;
g_errEula.currentDialog = {};
g_errEula.homeNixSignVisible = {};
g_errEula.currentDialog = {};
}
}
}s_COSErreulaModule;
COSModule* GetModule()
{
return &s_COSErreulaModule;
}
}
}

View File

@ -1,4 +1,5 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nn
{
@ -6,7 +7,6 @@ namespace nn
{
void render(bool mainWindow);
void load();
COSModule* GetModule();
}
}

View File

@ -301,79 +301,101 @@ void gx2Export_GX2SetSemaphore(PPCInterpreter_t* hCPU)
osLib_returnFromFunction(hCPU, 0);
}
void gx2_load()
namespace GX2
{
osLib_addFunction("gx2", "GX2GetContextStateDisplayList", gx2Export_GX2GetContextStateDisplayList);
class : public COSModule
{
public:
std::vector<std::string_view> GetDependencies() override
{
return {"avm", "coreinit", "tcl"};
}
// swap, vsync & timing
osLib_addFunction("gx2", "GX2SwapScanBuffers", gx2Export_GX2SwapScanBuffers);
osLib_addFunction("gx2", "GX2GetSwapStatus", gx2Export_GX2GetSwapStatus);
osLib_addFunction("gx2", "GX2CopyColorBufferToScanBuffer", gx2Export_GX2CopyColorBufferToScanBuffer);
osLib_addFunction("gx2", "GX2WaitForFreeScanBuffer", gx2Export_GX2WaitForFreeScanBuffer);
osLib_addFunction("gx2", "GX2GetCurrentScanBuffer", gx2Export_GX2GetCurrentScanBuffer);
std::string_view GetName() override
{
return "gx2";
}
// shader stuff
osLib_addFunction("gx2", "GX2SetPixelShader", gx2Export_GX2SetPixelShader);
osLib_addFunction("gx2", "GX2SetGeometryShader", gx2Export_GX2SetGeometryShader);
osLib_addFunction("gx2", "GX2SetComputeShader", gx2Export_GX2SetComputeShader);
osLib_addFunction("gx2", "GX2SetVertexUniformBlock", gx2Export_GX2SetVertexUniformBlock);
osLib_addFunction("gx2", "GX2RSetVertexUniformBlock", gx2Export_GX2RSetVertexUniformBlock);
void RPLMapped() override
{
osLib_addFunction("gx2", "GX2GetContextStateDisplayList", gx2Export_GX2GetContextStateDisplayList);
osLib_addFunction("gx2", "GX2SetPixelUniformBlock", gx2Export_GX2SetPixelUniformBlock);
osLib_addFunction("gx2", "GX2SetGeometryUniformBlock", gx2Export_GX2SetGeometryUniformBlock);
osLib_addFunction("gx2", "GX2SetShaderModeEx", gx2Export_GX2SetShaderModeEx);
// swap, vsync & timing
osLib_addFunction("gx2", "GX2SwapScanBuffers", gx2Export_GX2SwapScanBuffers);
osLib_addFunction("gx2", "GX2GetSwapStatus", gx2Export_GX2GetSwapStatus);
osLib_addFunction("gx2", "GX2CopyColorBufferToScanBuffer", gx2Export_GX2CopyColorBufferToScanBuffer);
osLib_addFunction("gx2", "GX2WaitForFreeScanBuffer", gx2Export_GX2WaitForFreeScanBuffer);
osLib_addFunction("gx2", "GX2GetCurrentScanBuffer", gx2Export_GX2GetCurrentScanBuffer);
osLib_addFunction("gx2", "GX2CalcGeometryShaderInputRingBufferSize", gx2Export_GX2CalcGeometryShaderInputRingBufferSize);
osLib_addFunction("gx2", "GX2CalcGeometryShaderOutputRingBufferSize", gx2Export_GX2CalcGeometryShaderOutputRingBufferSize);
// shader stuff
osLib_addFunction("gx2", "GX2SetPixelShader", gx2Export_GX2SetPixelShader);
osLib_addFunction("gx2", "GX2SetGeometryShader", gx2Export_GX2SetGeometryShader);
osLib_addFunction("gx2", "GX2SetComputeShader", gx2Export_GX2SetComputeShader);
osLib_addFunction("gx2", "GX2SetVertexUniformBlock", gx2Export_GX2SetVertexUniformBlock);
osLib_addFunction("gx2", "GX2RSetVertexUniformBlock", gx2Export_GX2RSetVertexUniformBlock);
// color/depth buffers
osLib_addFunction("gx2", "GX2InitColorBufferRegs", gx2Export_GX2InitColorBufferRegs);
osLib_addFunction("gx2", "GX2InitDepthBufferRegs", gx2Export_GX2InitDepthBufferRegs);
osLib_addFunction("gx2", "GX2SetColorBuffer", gx2Export_GX2SetColorBuffer);
osLib_addFunction("gx2", "GX2SetDepthBuffer", gx2Export_GX2SetDepthBuffer);
osLib_addFunction("gx2", "GX2SetPixelUniformBlock", gx2Export_GX2SetPixelUniformBlock);
osLib_addFunction("gx2", "GX2SetGeometryUniformBlock", gx2Export_GX2SetGeometryUniformBlock);
osLib_addFunction("gx2", "GX2SetShaderModeEx", gx2Export_GX2SetShaderModeEx);
osLib_addFunction("gx2", "GX2SetDRCBuffer", gx2Export_GX2SetDRCBuffer);
osLib_addFunction("gx2", "GX2MarkScanBufferCopied", gx2Export_GX2MarkScanBufferCopied);
osLib_addFunction("gx2", "GX2CalcGeometryShaderInputRingBufferSize", gx2Export_GX2CalcGeometryShaderInputRingBufferSize);
osLib_addFunction("gx2", "GX2CalcGeometryShaderOutputRingBufferSize", gx2Export_GX2CalcGeometryShaderOutputRingBufferSize);
// misc
osLib_addFunction("gx2", "GX2TempGetGPUVersion", gx2Export_GX2TempGetGPUVersion);
osLib_addFunction("gx2", "GX2CalcTVSize", gx2Export_GX2CalcTVSize);
osLib_addFunction("gx2", "GX2CalcDRCSize", gx2Export_GX2CalcDRCSize);
osLib_addFunction("gx2", "GX2SetDRCScale", gx2Export_GX2SetDRCScale);
osLib_addFunction("gx2", "GX2SetDRCConnectCallback", gx2Export_GX2SetDRCConnectCallback);
// color/depth buffers
osLib_addFunction("gx2", "GX2InitColorBufferRegs", gx2Export_GX2InitColorBufferRegs);
osLib_addFunction("gx2", "GX2InitDepthBufferRegs", gx2Export_GX2InitDepthBufferRegs);
osLib_addFunction("gx2", "GX2SetColorBuffer", gx2Export_GX2SetColorBuffer);
osLib_addFunction("gx2", "GX2SetDepthBuffer", gx2Export_GX2SetDepthBuffer);
osLib_addFunction("gx2", "GX2GetSystemTVScanMode", coreinitExport_GX2GetSystemTVScanMode);
osLib_addFunction("gx2", "GX2GetSystemTVAspectRatio", coreinitExport_GX2GetSystemTVAspectRatio);
osLib_addFunction("gx2", "GX2SetSwapInterval", gx2Export_GX2SetSwapInterval);
osLib_addFunction("gx2", "GX2GetSwapInterval", gx2Export_GX2GetSwapInterval);
osLib_addFunction("gx2", "GX2GetGPUTimeout", gx2Export_GX2GetGPUTimeout);
osLib_addFunction("gx2", "GX2SampleTopGPUCycle", gx2Export_GX2SampleTopGPUCycle);
osLib_addFunction("gx2", "GX2SampleBottomGPUCycle", gx2Export_GX2SampleBottomGPUCycle);
osLib_addFunction("gx2", "GX2SetDRCBuffer", gx2Export_GX2SetDRCBuffer);
osLib_addFunction("gx2", "GX2MarkScanBufferCopied", gx2Export_GX2MarkScanBufferCopied);
osLib_addFunction("gx2", "GX2AllocateTilingApertureEx", gx2Export_GX2AllocateTilingApertureEx);
osLib_addFunction("gx2", "GX2FreeTilingAperture", gx2Export_GX2FreeTilingAperture);
// misc
osLib_addFunction("gx2", "GX2TempGetGPUVersion", gx2Export_GX2TempGetGPUVersion);
osLib_addFunction("gx2", "GX2CalcTVSize", gx2Export_GX2CalcTVSize);
osLib_addFunction("gx2", "GX2CalcDRCSize", gx2Export_GX2CalcDRCSize);
osLib_addFunction("gx2", "GX2SetDRCScale", gx2Export_GX2SetDRCScale);
osLib_addFunction("gx2", "GX2SetDRCConnectCallback", gx2Export_GX2SetDRCConnectCallback);
// context state
osLib_addFunction("gx2", "GX2SetDefaultState", gx2Export_GX2SetDefaultState);
osLib_addFunction("gx2", "GX2SetupContextStateEx", gx2Export_GX2SetupContextStateEx);
osLib_addFunction("gx2", "GX2SetContextState", gx2Export_GX2SetContextState);
osLib_addFunction("gx2", "GX2GetSystemTVScanMode", coreinitExport_GX2GetSystemTVScanMode);
osLib_addFunction("gx2", "GX2GetSystemTVAspectRatio", coreinitExport_GX2GetSystemTVAspectRatio);
// semaphore
osLib_addFunction("gx2", "GX2SetSemaphore", gx2Export_GX2SetSemaphore);
osLib_addFunction("gx2", "GX2SetSwapInterval", gx2Export_GX2SetSwapInterval);
osLib_addFunction("gx2", "GX2GetSwapInterval", gx2Export_GX2GetSwapInterval);
osLib_addFunction("gx2", "GX2GetGPUTimeout", gx2Export_GX2GetGPUTimeout);
osLib_addFunction("gx2", "GX2SampleTopGPUCycle", gx2Export_GX2SampleTopGPUCycle);
osLib_addFunction("gx2", "GX2SampleBottomGPUCycle", gx2Export_GX2SampleBottomGPUCycle);
GX2::GX2MemInit();
GX2::GX2ResourceInit();
GX2::GX2CommandInit();
GX2::GX2SurfaceInit();
GX2::GX2SurfaceCopyInit();
GX2::GX2TextureInit();
GX2::GX2StateInit();
GX2::GX2ShaderInit();
GX2::GX2EventInit();
GX2::GX2BlitInit();
GX2::GX2DrawInit();
GX2::GX2StreamoutInit();
GX2::GX2QueryInit();
GX2::GX2MiscInit();
osLib_addFunction("gx2", "GX2AllocateTilingApertureEx", gx2Export_GX2AllocateTilingApertureEx);
osLib_addFunction("gx2", "GX2FreeTilingAperture", gx2Export_GX2FreeTilingAperture);
// context state
osLib_addFunction("gx2", "GX2SetDefaultState", gx2Export_GX2SetDefaultState);
osLib_addFunction("gx2", "GX2SetupContextStateEx", gx2Export_GX2SetupContextStateEx);
osLib_addFunction("gx2", "GX2SetContextState", gx2Export_GX2SetContextState);
// semaphore
osLib_addFunction("gx2", "GX2SetSemaphore", gx2Export_GX2SetSemaphore);
GX2::GX2MemInit();
GX2::GX2ResourceInit();
GX2::GX2CommandInit();
GX2::GX2SurfaceInit();
GX2::GX2SurfaceCopyInit();
GX2::GX2TextureInit();
GX2::GX2StateInit();
GX2::GX2ShaderInit();
GX2::GX2EventInit();
GX2::GX2BlitInit();
GX2::GX2DrawInit();
GX2::GX2StreamoutInit();
GX2::GX2QueryInit();
GX2::GX2MiscInit();
};
}s_COSGX2Module;
COSModule* GetModule()
{
return &s_COSGX2Module;
}
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "Cafe/HW/Latte/Core/LatteConst.h"
#include "Cafe/OS/RPL/COSModule.h"
// base defines for GX2
#define GX2_TRUE 1
@ -11,7 +12,10 @@
// general
void gx2_load();
namespace GX2
{
COSModule* GetModule();
}
// shader

View File

@ -617,28 +617,42 @@ namespace H264
return H264DEC_STATUS::BAD_STREAM;
}
void Initialize()
class : public COSModule
{
cafeExportRegister("h264", H264DECCheckMemSegmentation, LogType::H264);
cafeExportRegister("h264", H264DECMemoryRequirement, LogType::H264);
cafeExportRegister("h264", H264DECFindDecstartpoint, LogType::H264);
cafeExportRegister("h264", H264DECFindIdrpoint, LogType::H264);
cafeExportRegister("h264", H264DECGetImageSize, LogType::H264);
public:
std::string_view GetName() override
{
return "h264";
}
cafeExportRegister("h264", H264DECInitParam, LogType::H264);
cafeExportRegister("h264", H264DECOpen, LogType::H264);
cafeExportRegister("h264", H264DECClose, LogType::H264);
cafeExportRegister("h264", H264DECBegin, LogType::H264);
cafeExportRegister("h264", H264DECEnd, LogType::H264);
void RPLMapped() override
{
cafeExportRegister("h264", H264DECCheckMemSegmentation, LogType::H264);
cafeExportRegister("h264", H264DECMemoryRequirement, LogType::H264);
cafeExportRegister("h264", H264DECFindDecstartpoint, LogType::H264);
cafeExportRegister("h264", H264DECFindIdrpoint, LogType::H264);
cafeExportRegister("h264", H264DECGetImageSize, LogType::H264);
cafeExportRegister("h264", H264DECSetParam_FPTR_OUTPUT, LogType::H264);
cafeExportRegister("h264", H264DECSetParam_OUTPUT_PER_FRAME, LogType::H264);
cafeExportRegister("h264", H264DECSetParam_USER_MEMORY, LogType::H264);
cafeExportRegister("h264", H264DECSetParam, LogType::H264);
cafeExportRegister("h264", H264DECInitParam, LogType::H264);
cafeExportRegister("h264", H264DECOpen, LogType::H264);
cafeExportRegister("h264", H264DECClose, LogType::H264);
cafeExportRegister("h264", H264DECBegin, LogType::H264);
cafeExportRegister("h264", H264DECEnd, LogType::H264);
cafeExportRegister("h264", H264DECSetBitstream, LogType::H264);
cafeExportRegister("h264", H264DECExecute, LogType::H264);
cafeExportRegister("h264", H264DECSetParam_FPTR_OUTPUT, LogType::H264);
cafeExportRegister("h264", H264DECSetParam_OUTPUT_PER_FRAME, LogType::H264);
cafeExportRegister("h264", H264DECSetParam_USER_MEMORY, LogType::H264);
cafeExportRegister("h264", H264DECSetParam, LogType::H264);
cafeExportRegister("h264", H264DECCheckDecunitLength, LogType::H264);
cafeExportRegister("h264", H264DECSetBitstream, LogType::H264);
cafeExportRegister("h264", H264DECExecute, LogType::H264);
cafeExportRegister("h264", H264DECCheckDecunitLength, LogType::H264);
};
}s_COSh264Module;
COSModule* GetModule()
{
return &s_COSh264Module;
}
}

View File

@ -1,4 +1,6 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace H264
{
void Initialize();
COSModule* GetModule();
}

View File

@ -457,14 +457,29 @@ void mic_updateOnAXFrame()
namespace mic
{
void Initialize()
class : public COSModule
{
osLib_addFunction("mic", "MICInit", micExport_MICInit);
osLib_addFunction("mic", "MICOpen", micExport_MICOpen);
osLib_addFunction("mic", "MICClose", micExport_MICClose);
osLib_addFunction("mic", "MICGetStatus", micExport_MICGetStatus);
osLib_addFunction("mic", "MICGetState", micExport_MICGetState);
osLib_addFunction("mic", "MICSetState", micExport_MICSetState);
osLib_addFunction("mic", "MICSetDataConsumed", micExport_MICSetDataConsumed);
public:
std::string_view GetName() override
{
return "mic";
}
void RPLMapped() override
{
osLib_addFunction("mic", "MICInit", micExport_MICInit);
osLib_addFunction("mic", "MICOpen", micExport_MICOpen);
osLib_addFunction("mic", "MICClose", micExport_MICClose);
osLib_addFunction("mic", "MICGetStatus", micExport_MICGetStatus);
osLib_addFunction("mic", "MICGetState", micExport_MICGetState);
osLib_addFunction("mic", "MICSetState", micExport_MICSetState);
osLib_addFunction("mic", "MICSetDataConsumed", micExport_MICSetDataConsumed);
}
}s_COSmicModule;
COSModule* GetModule()
{
return &s_COSmicModule;
}
};

View File

@ -1,7 +1,9 @@
#include "Cafe/OS/RPL/COSModule.h"
bool mic_isActive(uint32 drcIndex);
void mic_updateOnAXFrame();
namespace mic
{
void Initialize();
COSModule* GetModule();
};

View File

@ -638,21 +638,35 @@ namespace nfc
return NFC_RESULT_SUCCESS;
}
void Initialize()
class : public COSModule
{
cafeExportRegister("nfc", NFCInit, LogType::NFC);
cafeExportRegister("nfc", NFCInitEx, LogType::NFC);
cafeExportRegister("nfc", NFCShutdown, LogType::NFC);
cafeExportRegister("nfc", NFCIsInit, LogType::NFC);
cafeExportRegister("nfc", NFCProc, LogType::NFC);
cafeExportRegister("nfc", NFCGetMode, LogType::NFC);
cafeExportRegister("nfc", NFCSetMode, LogType::NFC);
cafeExportRegister("nfc", NFCSetTagDetectCallback, LogType::NFC);
cafeExportRegister("nfc", NFCGetTagInfo, LogType::NFC);
cafeExportRegister("nfc", NFCSendRawData, LogType::NFC);
cafeExportRegister("nfc", NFCAbort, LogType::NFC);
cafeExportRegister("nfc", NFCRead, LogType::NFC);
cafeExportRegister("nfc", NFCWrite, LogType::NFC);
public:
std::string_view GetName() override
{
return "nfc";
}
void RPLMapped() override
{
cafeExportRegister("nfc", NFCInit, LogType::NFC);
cafeExportRegister("nfc", NFCInitEx, LogType::NFC);
cafeExportRegister("nfc", NFCShutdown, LogType::NFC);
cafeExportRegister("nfc", NFCIsInit, LogType::NFC);
cafeExportRegister("nfc", NFCProc, LogType::NFC);
cafeExportRegister("nfc", NFCGetMode, LogType::NFC);
cafeExportRegister("nfc", NFCSetMode, LogType::NFC);
cafeExportRegister("nfc", NFCSetTagDetectCallback, LogType::NFC);
cafeExportRegister("nfc", NFCGetTagInfo, LogType::NFC);
cafeExportRegister("nfc", NFCSendRawData, LogType::NFC);
cafeExportRegister("nfc", NFCAbort, LogType::NFC);
cafeExportRegister("nfc", NFCRead, LogType::NFC);
cafeExportRegister("nfc", NFCWrite, LogType::NFC);
};
}s_COSnfcModule;
COSModule* GetModule()
{
return &s_COSnfcModule;
}
bool TouchTagFromFile(const fs::path& filePath, uint32* nfcError)

View File

@ -1,5 +1,7 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
// CEMU NFC error codes
#define NFC_TOUCH_TAG_ERROR_NONE (0)
#define NFC_TOUCH_TAG_ERROR_NO_ACCESS (1)
@ -86,7 +88,7 @@ namespace nfc
sint32 NFCWrite(uint32 chan, uint32 discoveryTimeout, NFCUid* uid, NFCUid* uidMask, uint32 size, void* data, MPTR callback, void* context);
void Initialize();
COSModule* GetModule();
bool TouchTagFromFile(const fs::path& filePath, uint32* nfcError);
}

View File

@ -1503,39 +1503,64 @@ CURLcode curl_global_init_mem(uint32 flags, MEMPTR<curl_malloc_callback> malloc_
return result;
}
void load()
{
cafeExportRegister("nlibcurl", curl_global_init_mem, LogType::nlibcurl);
cafeExportRegister("nlibcurl", curl_global_init, LogType::nlibcurl);
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nlibcurl";
}
cafeExportRegister("nlibcurl", curl_slist_append, LogType::nlibcurl);
cafeExportRegister("nlibcurl", curl_slist_free_all, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_easy_strerror", export_curl_easy_strerror);
void RPLMapped() override
{
cafeExportRegister("nlibcurl", curl_global_init_mem, LogType::nlibcurl);
cafeExportRegister("nlibcurl", curl_global_init, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_share_init", export_curl_share_init);
osLib_addFunction("nlibcurl", "curl_share_setopt", export_curl_share_setopt);
osLib_addFunction("nlibcurl", "curl_share_cleanup", export_curl_share_cleanup);
cafeExportRegister("nlibcurl", curl_slist_append, LogType::nlibcurl);
cafeExportRegister("nlibcurl", curl_slist_free_all, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_easy_strerror", export_curl_easy_strerror);
cafeExportRegister("nlibcurl", mw_curl_easy_init, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_multi_init", export_curl_multi_init);
osLib_addFunction("nlibcurl", "curl_multi_add_handle", export_curl_multi_add_handle);
osLib_addFunction("nlibcurl", "curl_multi_perform", export_curl_multi_perform);
osLib_addFunction("nlibcurl", "curl_multi_info_read", export_curl_multi_info_read);
osLib_addFunction("nlibcurl", "curl_multi_remove_handle", export_curl_multi_remove_handle);
osLib_addFunction("nlibcurl", "curl_multi_setopt", export_curl_multi_setopt);
osLib_addFunction("nlibcurl", "curl_multi_fdset", export_curl_multi_fdset);
osLib_addFunction("nlibcurl", "curl_multi_cleanup", export_curl_multi_cleanup);
osLib_addFunction("nlibcurl", "curl_multi_timeout", export_curl_multi_timeout);
osLib_addFunction("nlibcurl", "curl_share_init", export_curl_share_init);
osLib_addFunction("nlibcurl", "curl_share_setopt", export_curl_share_setopt);
osLib_addFunction("nlibcurl", "curl_share_cleanup", export_curl_share_cleanup);
cafeExportRegister("nlibcurl", curl_easy_init, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_easy_reset", export_curl_easy_reset);
osLib_addFunction("nlibcurl", "curl_easy_setopt", export_curl_easy_setopt);
osLib_addFunction("nlibcurl", "curl_easy_getinfo", export_curl_easy_getinfo);
cafeExportRegister("nlibcurl", curl_easy_perform, LogType::nlibcurl);
cafeExportRegister("nlibcurl", mw_curl_easy_init, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_multi_init", export_curl_multi_init);
osLib_addFunction("nlibcurl", "curl_multi_add_handle", export_curl_multi_add_handle);
osLib_addFunction("nlibcurl", "curl_multi_perform", export_curl_multi_perform);
osLib_addFunction("nlibcurl", "curl_multi_info_read", export_curl_multi_info_read);
osLib_addFunction("nlibcurl", "curl_multi_remove_handle", export_curl_multi_remove_handle);
osLib_addFunction("nlibcurl", "curl_multi_setopt", export_curl_multi_setopt);
osLib_addFunction("nlibcurl", "curl_multi_fdset", export_curl_multi_fdset);
osLib_addFunction("nlibcurl", "curl_multi_cleanup", export_curl_multi_cleanup);
osLib_addFunction("nlibcurl", "curl_multi_timeout", export_curl_multi_timeout);
cafeExportRegister("nlibcurl", curl_easy_init, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_easy_reset", export_curl_easy_reset);
osLib_addFunction("nlibcurl", "curl_easy_setopt", export_curl_easy_setopt);
osLib_addFunction("nlibcurl", "curl_easy_getinfo", export_curl_easy_getinfo);
cafeExportRegister("nlibcurl", curl_easy_perform, LogType::nlibcurl);
osLib_addFunction("nlibcurl", "curl_easy_cleanup", export_curl_easy_cleanup);
osLib_addFunction("nlibcurl", "curl_easy_pause", export_curl_easy_pause);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
// todo
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
// todo
}
}
}s_COSnlibcurlModule;
COSModule* GetModule()
{
return &s_COSnlibcurlModule;
}
osLib_addFunction("nlibcurl", "curl_easy_cleanup", export_curl_easy_cleanup);
osLib_addFunction("nlibcurl", "curl_easy_pause", export_curl_easy_pause);
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nlibcurl
{
void load();
COSModule* GetModule();
}

View File

@ -29,9 +29,24 @@ namespace nlibnss
return 0x1C; // signature length
}
void load()
class : public COSModule
{
cafeExportRegister("nlibnss", NSSSignatureGetSignatureLength, LogType::Placeholder);
cafeExportRegister("nlibnss", NSSExportDeviceCertChain, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "nlibnss";
}
void RPLMapped() override
{
cafeExportRegister("nlibnss", NSSSignatureGetSignatureLength, LogType::Placeholder);
cafeExportRegister("nlibnss", NSSExportDeviceCertChain, LogType::Placeholder);
};
}s_COSnlibnssModule;
COSModule* GetModule()
{
return &s_COSnlibnssModule;
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nlibnss
{
void load();
COSModule* GetModule();
}

View File

@ -279,14 +279,36 @@ namespace nn_ac
void nnAc_load()
{
osLib_addFunction("nn_ac", "GetAssignedAddress__Q2_2nn2acFPUl", nnAcExport_GetAssignedAddress);
osLib_addFunction("nn_ac", "GetAssignedSubnet__Q2_2nn2acFPUl", nnAcExport_GetAssignedSubnet);
osLib_addFunction("nn_ac", "IsSystemConnected__Q2_2nn2acFPbPQ3_2nn2ac6ApType", nnAcExport_IsSystemConnected);
osLib_addFunction("nn_ac", "IsConfigExisting__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumPb", nnAcExport_IsConfigExisting);
osLib_addFunction("nn_ac", "ACGetAssignedAddress", nnAcExport_ACGetAssignedAddress);
nn_ac::load();
}
namespace nn::ac
{
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_ac";
}
void RPLMapped() override
{
osLib_addFunction("nn_ac", "GetAssignedAddress__Q2_2nn2acFPUl", nnAcExport_GetAssignedAddress);
osLib_addFunction("nn_ac", "GetAssignedSubnet__Q2_2nn2acFPUl", nnAcExport_GetAssignedSubnet);
osLib_addFunction("nn_ac", "IsSystemConnected__Q2_2nn2acFPbPQ3_2nn2ac6ApType", nnAcExport_IsSystemConnected);
osLib_addFunction("nn_ac", "IsConfigExisting__Q2_2nn2acFQ3_2nn2ac11ConfigIdNumPb", nnAcExport_IsConfigExisting);
osLib_addFunction("nn_ac", "ACGetAssignedAddress", nnAcExport_ACGetAssignedAddress);
nn_ac::load();
};
}s_COSnnAcModule;
COSModule* GetModule()
{
return &s_COSnnAcModule;
}
}

View File

@ -1,6 +1,12 @@
void nnAc_load();
#include "Cafe/OS/RPL/COSModule.h"
namespace nn_ac
{
nnResult IsApplicationConnected(uint8be* connected);
}
namespace nn::ac
{
COSModule* GetModule();
}

View File

@ -335,34 +335,49 @@ namespace acp
osLib_returnFromFunction(hCPU, 0);
}
void load()
class : public COSModule
{
cafeExportRegister("nn_acp", ACPCheckApplicationDeviceEmulation, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "nn_acp";
}
osLib_addFunction("nn_acp", "ACPCreateSaveDirEx", nnACPExport_ACPCreateSaveDirEx);
cafeExportRegister("nn_acp", ACPUpdateSaveTimeStamp, LogType::Placeholder);
void RPLMapped() override
{
cafeExportRegister("nn_acp", ACPCheckApplicationDeviceEmulation, LogType::Placeholder);
osLib_addFunction("nn_acp", "ACPGetSaveDataTitleIdList", export_ACPGetSaveDataTitleIdList);
osLib_addFunction("nn_acp", "ACPGetTitleSaveMetaXml", export_ACPGetTitleSaveMetaXml);
osLib_addFunction("nn_acp", "ACPGetTitleSaveDirEx", export_ACPGetTitleSaveDirEx);
osLib_addFunction("nn_acp", "ACPCreateSaveDirEx", nnACPExport_ACPCreateSaveDirEx);
cafeExportRegister("nn_acp", ACPUpdateSaveTimeStamp, LogType::Placeholder);
osLib_addFunction("nn_acp", "ACPCheckTitleNotReferAccountLaunch", export_ACPCheckTitleNotReferAccountLaunch);
osLib_addFunction("nn_acp", "ACPGetLaunchMetaData", export_ACPGetLaunchMetaData);
osLib_addFunction("nn_acp", "ACPGetLaunchMetaXml", export_ACPGetLaunchMetaXml);
osLib_addFunction("nn_acp", "ACPGetTitleIdOfMainApplication", export_ACPGetTitleIdOfMainApplication);
osLib_addFunction("nn_acp", "ACPGetSaveDataTitleIdList", export_ACPGetSaveDataTitleIdList);
osLib_addFunction("nn_acp", "ACPGetTitleSaveMetaXml", export_ACPGetTitleSaveMetaXml);
osLib_addFunction("nn_acp", "ACPGetTitleSaveDirEx", export_ACPGetTitleSaveDirEx);
osLib_addFunction("nn_acp", "ACPGetTitleMetaDirByDevice", export_ACPGetTitleMetaDirByDevice);
osLib_addFunction("nn_acp", "ACPGetTitleMetaXmlByDevice", export_ACPGetTitleMetaXmlByDevice);
cafeExportRegister("nn_acp", ACPGetTitleMetaXml, LogType::Placeholder);
osLib_addFunction("nn_acp", "ACPCheckTitleNotReferAccountLaunch", export_ACPCheckTitleNotReferAccountLaunch);
osLib_addFunction("nn_acp", "ACPGetLaunchMetaData", export_ACPGetLaunchMetaData);
osLib_addFunction("nn_acp", "ACPGetLaunchMetaXml", export_ACPGetLaunchMetaXml);
osLib_addFunction("nn_acp", "ACPGetTitleIdOfMainApplication", export_ACPGetTitleIdOfMainApplication);
cafeExportRegister("nn_acp", ACPGetApplicationBox, LogType::Placeholder);
osLib_addFunction("nn_acp", "ACPGetTitleMetaDirByDevice", export_ACPGetTitleMetaDirByDevice);
osLib_addFunction("nn_acp", "ACPGetTitleMetaXmlByDevice", export_ACPGetTitleMetaXmlByDevice);
cafeExportRegister("nn_acp", ACPGetTitleMetaXml, LogType::Placeholder);
cafeExportRegister("nn_acp", ACPGetOlvAccesskey, LogType::Placeholder);
cafeExportRegister("nn_acp", ACPGetApplicationBox, LogType::Placeholder);
osLib_addFunction("nn_acp", "ACPIsOverAgeEx", export_ACPIsOverAgeEx);
cafeExportRegister("nn_acp", ACPGetOlvAccesskey, LogType::Placeholder);
osLib_addFunction("nn_acp", "ACPGetNetworkTime", export_ACPGetNetworkTime);
osLib_addFunction("nn_acp", "ACPConvertNetworkTimeToOSCalendarTime", export_ACPConvertNetworkTimeToOSCalendarTime);
osLib_addFunction("nn_acp", "ACPIsOverAgeEx", export_ACPIsOverAgeEx);
osLib_addFunction("nn_acp", "ACPGetNetworkTime", export_ACPGetNetworkTime);
osLib_addFunction("nn_acp", "ACPConvertNetworkTimeToOSCalendarTime", export_ACPConvertNetworkTimeToOSCalendarTime);
};
}s_COSnnAcpModule;
COSModule* GetModule()
{
return &s_COSnnAcpModule;
}
}
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "Cafe/IOSU/legacy/iosu_acp.h"
#include "Cafe/OS/RPL/COSModule.h"
namespace nn
{
@ -18,6 +19,6 @@ namespace acp
ACPStatus ACPCreateSaveDir(uint32 persistentId, iosu::acp::ACPDeviceType type);
ACPStatus ACPUpdateSaveTimeStamp(uint32 persistentId, uint64 titleId, iosu::acp::ACPDeviceType deviceType);
void load();
COSModule* GetModule();
}
}

View File

@ -683,76 +683,92 @@ void nnActExport_AcquirePrincipalIdByAccountId(PPCInterpreter_t* hCPU)
osLib_returnFromFunction(hCPU, result);
}
// register account functions
void nnAct_load()
namespace nn::act
{
osLib_addFunction("nn_act", "Initialize__Q2_2nn3actFv", nnActExport_Initialize);
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_act";
}
osLib_addFunction("nn_act", "CreateConsoleAccount__Q2_2nn3actFv", nnActExport_CreateConsoleAccount);
void RPLMapped() override
{
osLib_addFunction("nn_act", "Initialize__Q2_2nn3actFv", nnActExport_Initialize);
osLib_addFunction("nn_act", "GetNumOfAccounts__Q2_2nn3actFv", nnActExport_GetNumOfAccounts);
osLib_addFunction("nn_act", "IsSlotOccupied__Q2_2nn3actFUc", nnActExport_IsSlotOccupied);
osLib_addFunction("nn_act", "GetSlotNo__Q2_2nn3actFv", nnActExport_GetSlotNo);
osLib_addFunction("nn_act", "GetSlotNoEx__Q2_2nn3actFRC7ACTUuid", nnActExport_GetSlotNoEx);
osLib_addFunction("nn_act", "IsNetworkAccount__Q2_2nn3actFv", nnActExport_IsNetworkAccount);
osLib_addFunction("nn_act", "IsNetworkAccountEx__Q2_2nn3actFUc", nnActExport_IsNetworkAccountEx);
// account id
osLib_addFunction("nn_act", "GetAccountId__Q2_2nn3actFPc", nnActExport_GetAccountId);
osLib_addFunction("nn_act", "GetAccountIdEx__Q2_2nn3actFPcUc", nnActExport_GetAccountIdEx);
// simple address
osLib_addFunction("nn_act", "GetSimpleAddressId__Q2_2nn3actFv", nnActExport_GetSimpleAddressId);
osLib_addFunction("nn_act", "GetSimpleAddressIdEx__Q2_2nn3actFPUiUc", nnActExport_GetSimpleAddressIdEx);
// principal id
osLib_addFunction("nn_act", "GetPrincipalId__Q2_2nn3actFv", nnActExport_GetPrincipalId);
osLib_addFunction("nn_act", "GetPrincipalIdEx__Q2_2nn3actFPUiUc", nnActExport_GetPrincipalIdEx);
// transferable id
osLib_addFunction("nn_act", "GetTransferableId__Q2_2nn3actFUi", nnActExport_GetTransferableId);
osLib_addFunction("nn_act", "GetTransferableIdEx__Q2_2nn3actFPULUiUc", nnActExport_GetTransferableIdEx);
// persistent id
osLib_addFunction("nn_act", "GetPersistentId__Q2_2nn3actFv", nnActExport_GetPersistentId);
osLib_addFunction("nn_act", "GetPersistentIdEx__Q2_2nn3actFUc", nnActExport_GetPersistentIdEx);
// country
osLib_addFunction("nn_act", "GetCountry__Q2_2nn3actFPc", nnActExport_GetCountry);
// timezone
cafeExportRegisterFunc(nn::act::GetTimeZoneId, "nn_act", "GetTimeZoneId__Q2_2nn3actFPc", LogType::Placeholder);
osLib_addFunction("nn_act", "CreateConsoleAccount__Q2_2nn3actFv", nnActExport_CreateConsoleAccount);
// parental
osLib_addFunction("nn_act", "EnableParentalControlCheck__Q2_2nn3actFb", nnActExport_EnableParentalControlCheck);
osLib_addFunction("nn_act", "IsParentalControlCheckEnabled__Q2_2nn3actFv", nnActExport_IsParentalControlCheckEnabled);
osLib_addFunction("nn_act", "GetNumOfAccounts__Q2_2nn3actFv", nnActExport_GetNumOfAccounts);
osLib_addFunction("nn_act", "IsSlotOccupied__Q2_2nn3actFUc", nnActExport_IsSlotOccupied);
osLib_addFunction("nn_act", "GetSlotNo__Q2_2nn3actFv", nnActExport_GetSlotNo);
osLib_addFunction("nn_act", "GetSlotNoEx__Q2_2nn3actFRC7ACTUuid", nnActExport_GetSlotNoEx);
osLib_addFunction("nn_act", "IsNetworkAccount__Q2_2nn3actFv", nnActExport_IsNetworkAccount);
osLib_addFunction("nn_act", "IsNetworkAccountEx__Q2_2nn3actFUc", nnActExport_IsNetworkAccountEx);
// account id
osLib_addFunction("nn_act", "GetAccountId__Q2_2nn3actFPc", nnActExport_GetAccountId);
osLib_addFunction("nn_act", "GetAccountIdEx__Q2_2nn3actFPcUc", nnActExport_GetAccountIdEx);
// simple address
osLib_addFunction("nn_act", "GetSimpleAddressId__Q2_2nn3actFv", nnActExport_GetSimpleAddressId);
osLib_addFunction("nn_act", "GetSimpleAddressIdEx__Q2_2nn3actFPUiUc", nnActExport_GetSimpleAddressIdEx);
// principal id
osLib_addFunction("nn_act", "GetPrincipalId__Q2_2nn3actFv", nnActExport_GetPrincipalId);
osLib_addFunction("nn_act", "GetPrincipalIdEx__Q2_2nn3actFPUiUc", nnActExport_GetPrincipalIdEx);
// transferable id
osLib_addFunction("nn_act", "GetTransferableId__Q2_2nn3actFUi", nnActExport_GetTransferableId);
osLib_addFunction("nn_act", "GetTransferableIdEx__Q2_2nn3actFPULUiUc", nnActExport_GetTransferableIdEx);
// persistent id
osLib_addFunction("nn_act", "GetPersistentId__Q2_2nn3actFv", nnActExport_GetPersistentId);
osLib_addFunction("nn_act", "GetPersistentIdEx__Q2_2nn3actFUc", nnActExport_GetPersistentIdEx);
// country
osLib_addFunction("nn_act", "GetCountry__Q2_2nn3actFPc", nnActExport_GetCountry);
// timezone
cafeExportRegisterFunc(nn::act::GetTimeZoneId, "nn_act", "GetTimeZoneId__Q2_2nn3actFPc", LogType::Placeholder);
osLib_addFunction("nn_act", "GetMii__Q2_2nn3actFP12FFLStoreData", nnActExport_GetMii);
osLib_addFunction("nn_act", "GetMiiEx__Q2_2nn3actFP12FFLStoreDataUc", nnActExport_GetMiiEx);
osLib_addFunction("nn_act", "GetMiiImageEx__Q2_2nn3actFPUiPvUi15ACTMiiImageTypeUc", nnActExport_GetMiiImageEx);
osLib_addFunction("nn_act", "GetMiiName__Q2_2nn3actFPw", nnActExport_GetMiiName);
osLib_addFunction("nn_act", "GetMiiNameEx__Q2_2nn3actFPwUc", nnActExport_GetMiiNameEx);
// parental
osLib_addFunction("nn_act", "EnableParentalControlCheck__Q2_2nn3actFb", nnActExport_EnableParentalControlCheck);
osLib_addFunction("nn_act", "IsParentalControlCheckEnabled__Q2_2nn3actFv", nnActExport_IsParentalControlCheckEnabled);
osLib_addFunction("nn_act", "UpdateMii__Q2_2nn3actFUcRC12FFLStoreDataPCwPCvUiT4T5T4T5T4T5T4T5T4T5T4T5T4T5T4T5", nnActExport_UpdateMii);
osLib_addFunction("nn_act", "GetMii__Q2_2nn3actFP12FFLStoreData", nnActExport_GetMii);
osLib_addFunction("nn_act", "GetMiiEx__Q2_2nn3actFP12FFLStoreDataUc", nnActExport_GetMiiEx);
osLib_addFunction("nn_act", "GetMiiImageEx__Q2_2nn3actFPUiPvUi15ACTMiiImageTypeUc", nnActExport_GetMiiImageEx);
osLib_addFunction("nn_act", "GetMiiName__Q2_2nn3actFPw", nnActExport_GetMiiName);
osLib_addFunction("nn_act", "GetMiiNameEx__Q2_2nn3actFPwUc", nnActExport_GetMiiNameEx);
osLib_addFunction("nn_act", "GetUuid__Q2_2nn3actFP7ACTUuid", nnActExport_GetUuid);
osLib_addFunction("nn_act", "GetUuidEx__Q2_2nn3actFP7ACTUuidUc", nnActExport_GetUuidEx);
osLib_addFunction("nn_act", "GetUuidEx__Q2_2nn3actFP7ACTUuidUcUi", nnActExport_GetUuidEx2);
osLib_addFunction("nn_act", "UpdateMii__Q2_2nn3actFUcRC12FFLStoreDataPCwPCvUiT4T5T4T5T4T5T4T5T4T5T4T5T4T5T4T5", nnActExport_UpdateMii);
osLib_addFunction("nn_act", "GetParentalControlSlotNoEx__Q2_2nn3actFPUcUc", nnActExport_GetParentalControlSlotNoEx);
osLib_addFunction("nn_act", "GetUuid__Q2_2nn3actFP7ACTUuid", nnActExport_GetUuid);
osLib_addFunction("nn_act", "GetUuidEx__Q2_2nn3actFP7ACTUuidUc", nnActExport_GetUuidEx);
osLib_addFunction("nn_act", "GetUuidEx__Q2_2nn3actFP7ACTUuidUcUi", nnActExport_GetUuidEx2);
osLib_addFunction("nn_act", "GetDefaultAccount__Q2_2nn3actFv", nnActExport_GetDefaultAccount);
osLib_addFunction("nn_act", "GetParentalControlSlotNoEx__Q2_2nn3actFPUcUc", nnActExport_GetParentalControlSlotNoEx);
osLib_addFunction("nn_act", "AcquireEcServiceToken__Q2_2nn3actFPc", nnActExport_AcquireEcServiceToken);
osLib_addFunction("nn_act", "AcquireNexServiceToken__Q2_2nn3actFP26ACTNexAuthenticationResultUi", nnActExport_AcquireNexServiceToken);
osLib_addFunction("nn_act", "AcquireIndependentServiceToken__Q2_2nn3actFPcPCc", nnActExport_AcquireIndependentServiceToken);
osLib_addFunction("nn_act", "AcquireIndependentServiceToken__Q2_2nn3actFPcPCcUibT4", nnActExport_AcquireIndependentServiceToken2);
osLib_addFunction("nn_act", "AcquireIndependentServiceToken__Q2_2nn3actFPcPCcUi", nnActExport_AcquireIndependentServiceToken2);
osLib_addFunction("nn_act", "AcquirePrincipalIdByAccountId__Q2_2nn3actFPUiPA17_CcUi", nnActExport_AcquirePrincipalIdByAccountId);
osLib_addFunction("nn_act", "GetDefaultAccount__Q2_2nn3actFv", nnActExport_GetDefaultAccount);
cafeExportRegisterFunc(nn::act::GetErrorCode, "nn_act", "GetErrorCode__Q2_2nn3actFRCQ2_2nn6Result", LogType::Placeholder);
osLib_addFunction("nn_act", "AcquireEcServiceToken__Q2_2nn3actFPc", nnActExport_AcquireEcServiceToken);
osLib_addFunction("nn_act", "AcquireNexServiceToken__Q2_2nn3actFP26ACTNexAuthenticationResultUi", nnActExport_AcquireNexServiceToken);
osLib_addFunction("nn_act", "AcquireIndependentServiceToken__Q2_2nn3actFPcPCc", nnActExport_AcquireIndependentServiceToken);
osLib_addFunction("nn_act", "AcquireIndependentServiceToken__Q2_2nn3actFPcPCcUibT4", nnActExport_AcquireIndependentServiceToken2);
osLib_addFunction("nn_act", "AcquireIndependentServiceToken__Q2_2nn3actFPcPCcUi", nnActExport_AcquireIndependentServiceToken2);
// placeholders / incomplete implementations
osLib_addFunction("nn_act", "HasNfsAccount__Q2_2nn3actFv", nnActExport_HasNfsAccount);
osLib_addFunction("nn_act", "GetHostServerSettings__Q2_2nn3actFPcT1Uc", nnActExport_GetHostServerSettings);
cafeExportRegisterFunc(nn::act::GetUtcOffset, "nn_act", "GetUtcOffset__Q2_2nn3actFv", LogType::Placeholder);
cafeExportRegisterFunc(nn::act::GetUtcOffsetEx, "nn_act", "GetUtcOffsetEx__Q2_2nn3actFPLUc", LogType::Placeholder);
osLib_addFunction("nn_act", "AcquirePrincipalIdByAccountId__Q2_2nn3actFPUiPA17_CcUi", nnActExport_AcquirePrincipalIdByAccountId);
cafeExportRegisterFunc(nn::act::GetErrorCode, "nn_act", "GetErrorCode__Q2_2nn3actFRCQ2_2nn6Result", LogType::Placeholder);
// placeholders / incomplete implementations
osLib_addFunction("nn_act", "HasNfsAccount__Q2_2nn3actFv", nnActExport_HasNfsAccount);
osLib_addFunction("nn_act", "GetHostServerSettings__Q2_2nn3actFPcT1Uc", nnActExport_GetHostServerSettings);
cafeExportRegisterFunc(nn::act::GetUtcOffset, "nn_act", "GetUtcOffset__Q2_2nn3actFv", LogType::Placeholder);
cafeExportRegisterFunc(nn::act::GetUtcOffsetEx, "nn_act", "GetUtcOffsetEx__Q2_2nn3actFPLUc", LogType::Placeholder);
};
}s_COSnnActModule;
COSModule* GetModule()
{
return &s_COSnnActModule;
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include "Cafe/IOSU/legacy/iosu_act.h"
#include "Cafe/OS/RPL/COSModule.h"
struct independentServiceToken_t
{
@ -30,7 +31,7 @@ namespace act
}
const uint8 ACT_SLOT_CURRENT = 0xFE;
}
}
void nnAct_load();
COSModule* GetModule();
}
}

View File

@ -149,14 +149,28 @@ namespace nn
return AOC_RESULT::ERROR_OK;
}
void Initialize()
class : public COSModule
{
cafeExportRegister("nn_aoc", AOC_CalculateWorkBufferSize, LogType::NN_AOC);
cafeExportRegister("nn_aoc", AOC_ListTitle, LogType::NN_AOC);
public:
std::string_view GetName() override
{
return "nn_aoc";
}
cafeExportRegister("nn_aoc", AOC_OpenTitle, LogType::NN_AOC);
cafeExportRegister("nn_aoc", AOC_CloseTitle, LogType::NN_AOC);
cafeExportRegister("nn_aoc", AOC_GetPurchaseInfo, LogType::NN_AOC);
void RPLMapped() override
{
cafeExportRegister("nn_aoc", AOC_CalculateWorkBufferSize, LogType::NN_AOC);
cafeExportRegister("nn_aoc", AOC_ListTitle, LogType::NN_AOC);
cafeExportRegister("nn_aoc", AOC_OpenTitle, LogType::NN_AOC);
cafeExportRegister("nn_aoc", AOC_CloseTitle, LogType::NN_AOC);
cafeExportRegister("nn_aoc", AOC_GetPurchaseInfo, LogType::NN_AOC);
};
}s_COSnnAocModule;
COSModule* GetModule()
{
return &s_COSnnAocModule;
}
}
}

View File

@ -1,7 +1,6 @@
namespace nn
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::aoc
{
namespace aoc
{
void Initialize();
}
COSModule* GetModule();
}

View File

@ -1191,138 +1191,164 @@ namespace boss
}
}
void nnBoss_load()
namespace nn::boss
{
OSInitMutexEx(&nn::boss::g_mutex, nullptr);
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_boss";
}
nn::boss::g_initCounter = 0;
nn::boss::g_isInitialized = false;
void RPLMapped() override
{
cafeExportRegisterFunc(nn::boss::GetBossState, "nn_boss", "GetBossState__Q2_2nn4bossFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::GetBossState, "nn_boss", "GetBossState__Q2_2nn4bossFv", LogType::NN_BOSS);
// boss lib
cafeExportRegisterFunc(nn::boss::Initialize, "nn_boss", "Initialize__Q2_2nn4bossFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::IsInitialized, "nn_boss", "IsInitialized__Q2_2nn4bossFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Finalize, "nn_boss", "Finalize__Q2_2nn4bossFv", LogType::NN_BOSS);
// boss lib
cafeExportRegisterFunc(nn::boss::Initialize, "nn_boss", "Initialize__Q2_2nn4bossFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::IsInitialized, "nn_boss", "IsInitialized__Q2_2nn4bossFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Finalize, "nn_boss", "Finalize__Q2_2nn4bossFv", LogType::NN_BOSS);
// taskId
cafeExportRegisterFunc(nn::boss::TaskId::ctorDefault, "nn_boss", "__ct__Q3_2nn4boss6TaskIDFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TaskId::ctorFromString, "nn_boss", "__ct__Q3_2nn4boss6TaskIDFPCc", LogType::NN_BOSS);
// taskId
cafeExportRegisterFunc(nn::boss::TaskId::ctorDefault, "nn_boss", "__ct__Q3_2nn4boss6TaskIDFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TaskId::ctorFromString, "nn_boss", "__ct__Q3_2nn4boss6TaskIDFPCc", LogType::NN_BOSS);
// task
nn::boss::Task::InitVTable();
cafeExportRegisterFunc(nn::boss::Task::ctor1, "nn_boss", "__ct__Q3_2nn4boss4TaskFUcPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::ctor2, "nn_boss", "__ct__Q3_2nn4boss4TaskFPCcUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::ctor3, "nn_boss", "__ct__Q3_2nn4boss4TaskFPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::ctor4, "nn_boss", "__ct__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::dtor, "nn_boss", "__dt__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Initialize1, "nn_boss", "Initialize__Q3_2nn4boss4TaskFPCcUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Initialize2, "nn_boss", "Initialize__Q3_2nn4boss4TaskFUcPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Initialize3, "nn_boss", "Initialize__Q3_2nn4boss4TaskFPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Run, "nn_boss", "Run__Q3_2nn4boss4TaskFb", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Wait, "nn_boss", "Wait__Q3_2nn4boss4TaskFUiQ3_2nn4boss13TaskWaitState", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetTurnState, "nn_boss", "GetTurnState__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetHttpStatusCode, "nn_boss", "GetHttpStatusCode__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetContentLength, "nn_boss", "GetContentLength__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetProcessedLength, "nn_boss", "GetProcessedLength__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Register, "nn_boss", "Register__Q3_2nn4boss4TaskFRQ3_2nn4boss11TaskSetting", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Unregister, "nn_boss", "Unregister__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::IsRegistered, "nn_boss", "IsRegistered__Q3_2nn4boss4TaskCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::RegisterForImmediateRun, "nn_boss", "RegisterForImmediateRun__Q3_2nn4boss4TaskFRCQ3_2nn4boss11TaskSetting", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::StartScheduling, "nn_boss", "StartScheduling__Q3_2nn4boss4TaskFb", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::StopScheduling, "nn_boss", "StopScheduling__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
// task
nn::boss::Task::InitVTable();
cafeExportRegisterFunc(nn::boss::Task::ctor1, "nn_boss", "__ct__Q3_2nn4boss4TaskFUcPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::ctor2, "nn_boss", "__ct__Q3_2nn4boss4TaskFPCcUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::ctor3, "nn_boss", "__ct__Q3_2nn4boss4TaskFPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::ctor4, "nn_boss", "__ct__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::dtor, "nn_boss", "__dt__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Initialize1, "nn_boss", "Initialize__Q3_2nn4boss4TaskFPCcUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Initialize2, "nn_boss", "Initialize__Q3_2nn4boss4TaskFUcPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Initialize3, "nn_boss", "Initialize__Q3_2nn4boss4TaskFPCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Run, "nn_boss", "Run__Q3_2nn4boss4TaskFb", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Wait, "nn_boss", "Wait__Q3_2nn4boss4TaskFUiQ3_2nn4boss13TaskWaitState", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetTurnState, "nn_boss", "GetTurnState__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetHttpStatusCode, "nn_boss", "GetHttpStatusCode__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetContentLength, "nn_boss", "GetContentLength__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::GetProcessedLength, "nn_boss", "GetProcessedLength__Q3_2nn4boss4TaskCFPUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Register, "nn_boss", "Register__Q3_2nn4boss4TaskFRQ3_2nn4boss11TaskSetting", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::Unregister, "nn_boss", "Unregister__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::IsRegistered, "nn_boss", "IsRegistered__Q3_2nn4boss4TaskCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::RegisterForImmediateRun, "nn_boss", "RegisterForImmediateRun__Q3_2nn4boss4TaskFRCQ3_2nn4boss11TaskSetting", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::StartScheduling, "nn_boss", "StartScheduling__Q3_2nn4boss4TaskFb", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Task::StopScheduling, "nn_boss", "StopScheduling__Q3_2nn4boss4TaskFv", LogType::NN_BOSS);
// TaskSetting
nn::boss::TaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::TaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss11TaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss11TaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TaskSetting::IsPrivileged, "nn_boss", "Initialize__Q3_2nn4boss11TaskSettingFPCcUi", LogType::NN_BOSS);
// TaskSetting
nn::boss::TaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::TaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss11TaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss11TaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TaskSetting::IsPrivileged, "nn_boss", "Initialize__Q3_2nn4boss11TaskSettingFPCcUi", LogType::NN_BOSS);
// NbdlTaskSetting
nn::boss::NbdlTaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss15NbdlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss15NbdlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::Initialize, "nn_boss", "Initialize__Q3_2nn4boss15NbdlTaskSettingFPCcLT1", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::SetFileName, "nn_boss", "SetFileName__Q3_2nn4boss15NbdlTaskSettingFPCc", LogType::NN_BOSS);
// NbdlTaskSetting
nn::boss::NbdlTaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss15NbdlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss15NbdlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::Initialize, "nn_boss", "Initialize__Q3_2nn4boss15NbdlTaskSettingFPCcLT1", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NbdlTaskSetting::SetFileName, "nn_boss", "SetFileName__Q3_2nn4boss15NbdlTaskSettingFPCc", LogType::NN_BOSS);
// PlayReportSetting
nn::boss::PlayReportSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::PlayReportSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss17PlayReportSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::PlayReportSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss17PlayReportSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::PlayReportSetting::Initialize, "nn_boss", "Initialize__Q3_2nn4boss17PlayReportSettingFPvUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::PlayReportSetting::Set, "nn_boss", "Set__Q3_2nn4boss17PlayReportSettingFPCcUi", LogType::NN_BOSS);
// PlayReportSetting
nn::boss::PlayReportSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::PlayReportSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss17PlayReportSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::PlayReportSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss17PlayReportSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::PlayReportSetting::Initialize, "nn_boss", "Initialize__Q3_2nn4boss17PlayReportSettingFPvUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::PlayReportSetting::Set, "nn_boss", "Set__Q3_2nn4boss17PlayReportSettingFPCcUi", LogType::NN_BOSS);
// RawDlTaskSetting
nn::boss::RawDlTaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::RawDlTaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss16RawDlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::RawDlTaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss16RawDlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::RawDlTaskSetting::Initialize, "nn_boss", "Initialize__Q3_2nn4boss16RawDlTaskSettingFPCcbT2N21", LogType::NN_BOSS);
// RawDlTaskSetting
nn::boss::RawDlTaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::RawDlTaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss16RawDlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::RawDlTaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss16RawDlTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::RawDlTaskSetting::Initialize, "nn_boss", "Initialize__Q3_2nn4boss16RawDlTaskSettingFPCcbT2N21", LogType::NN_BOSS);
// NetTaskSetting
nn::boss::NetTaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::NetTaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss14NetTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss14NetTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::SetServiceToken, "nn_boss", "SetServiceToken__Q3_2nn4boss14NetTaskSettingFPCUc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::AddInternalCaCert, "nn_boss", "AddInternalCaCert__Q3_2nn4boss14NetTaskSettingFSc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::SetInternalClientCert, "nn_boss", "SetInternalClientCert__Q3_2nn4boss14NetTaskSettingFSc", LogType::NN_BOSS);
// NetTaskSetting
nn::boss::NetTaskSetting::InitVTable();
cafeExportRegisterFunc(nn::boss::NetTaskSetting::ctor, "nn_boss", "__ct__Q3_2nn4boss14NetTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::dtor, "nn_boss", "__dt__Q3_2nn4boss14NetTaskSettingFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::SetServiceToken, "nn_boss", "SetServiceToken__Q3_2nn4boss14NetTaskSettingFPCUc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::AddInternalCaCert, "nn_boss", "AddInternalCaCert__Q3_2nn4boss14NetTaskSettingFSc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NetTaskSetting::SetInternalClientCert, "nn_boss", "SetInternalClientCert__Q3_2nn4boss14NetTaskSettingFSc", LogType::NN_BOSS);
// Title
nn::boss::Title::InitVTable();
cafeExportRegisterFunc(nn::boss::Title::ctor, "nn_boss", "__ct__Q3_2nn4boss5TitleFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Title::dtor, "nn_boss", "__dt__Q3_2nn4boss5TitleFv", LogType::NN_BOSS);
// cafeExportMakeWrapper<nn::boss::Title::SetNewArrivalFlagOff>("nn_boss", "SetNewArrivalFlagOff__Q3_2nn4boss5TitleFv"); SMM bookmarks
// Title
nn::boss::Title::InitVTable();
cafeExportRegisterFunc(nn::boss::Title::ctor, "nn_boss", "__ct__Q3_2nn4boss5TitleFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Title::dtor, "nn_boss", "__dt__Q3_2nn4boss5TitleFv", LogType::NN_BOSS);
// cafeExportMakeWrapper<nn::boss::Title::SetNewArrivalFlagOff>("nn_boss", "SetNewArrivalFlagOff__Q3_2nn4boss5TitleFv"); SMM bookmarks
// TitleId
cafeExportRegisterFunc(nn::boss::TitleId::ctorDefault, "nn_boss", "__ct__Q3_2nn4boss7TitleIDFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TitleId::ctorFromTitleId, "nn_boss", "__ct__Q3_2nn4boss7TitleIDFUL", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TitleId::ctorCopy, "nn_boss", "__ct__Q3_2nn4boss7TitleIDFRCQ3_2nn4boss7TitleID", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TitleId::operator_ne, "nn_boss", "__ne__Q3_2nn4boss7TitleIDCFRCQ3_2nn4boss7TitleID", LogType::NN_BOSS);
// TitleId
cafeExportRegisterFunc(nn::boss::TitleId::ctorDefault, "nn_boss", "__ct__Q3_2nn4boss7TitleIDFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TitleId::ctorFromTitleId, "nn_boss", "__ct__Q3_2nn4boss7TitleIDFUL", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TitleId::ctorCopy, "nn_boss", "__ct__Q3_2nn4boss7TitleIDFRCQ3_2nn4boss7TitleID", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::TitleId::operator_ne, "nn_boss", "__ne__Q3_2nn4boss7TitleIDCFRCQ3_2nn4boss7TitleID", LogType::NN_BOSS);
// DataName
cafeExportRegisterFunc(nn::boss::DataName::ctor, "nn_boss", "__ct__Q3_2nn4boss8DataNameFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::DataName::operator_const_char, "nn_boss", "__opPCc__Q3_2nn4boss8DataNameCFv", LogType::NN_BOSS);
// DataName
cafeExportRegisterFunc(nn::boss::DataName::ctor, "nn_boss", "__ct__Q3_2nn4boss8DataNameFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::DataName::operator_const_char, "nn_boss", "__opPCc__Q3_2nn4boss8DataNameCFv", LogType::NN_BOSS);
// DirectoryName
cafeExportRegisterFunc(nn::boss::DirectoryName::ctor, "nn_boss", "__ct__Q3_2nn4boss13DirectoryNameFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::DirectoryName::operator_const_char, "nn_boss", "__opPCc__Q3_2nn4boss13DirectoryNameCFv", LogType::NN_BOSS);
// DirectoryName
cafeExportRegisterFunc(nn::boss::DirectoryName::ctor, "nn_boss", "__ct__Q3_2nn4boss13DirectoryNameFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::DirectoryName::operator_const_char, "nn_boss", "__opPCc__Q3_2nn4boss13DirectoryNameCFv", LogType::NN_BOSS);
// Account
nn::boss::BossAccount::InitVTable();
cafeExportRegisterFunc(nn::boss::BossAccount::ctor, "nn_boss", "__ct__Q3_2nn4boss7AccountFUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::BossAccount::dtor, "nn_boss", "__dt__Q3_2nn4boss7AccountFv", LogType::NN_BOSS);
// Account
nn::boss::BossAccount::InitVTable();
cafeExportRegisterFunc(nn::boss::BossAccount::ctor, "nn_boss", "__ct__Q3_2nn4boss7AccountFUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::BossAccount::dtor, "nn_boss", "__dt__Q3_2nn4boss7AccountFv", LogType::NN_BOSS);
// AlmightyTask
nn::boss::AlmightyTask::InitVTable();
cafeExportRegisterFunc(nn::boss::AlmightyTask::ctor, "nn_boss", "__ct__Q3_2nn4boss12AlmightyTaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::AlmightyTask::Initialize, "nn_boss", "Initialize__Q3_2nn4boss12AlmightyTaskFQ3_2nn4boss7TitleIDPCcUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::AlmightyTask::dtor, "nn_boss", "__dt__Q3_2nn4boss12AlmightyTaskFv", LogType::NN_BOSS);
// AlmightyTask
nn::boss::AlmightyTask::InitVTable();
cafeExportRegisterFunc(nn::boss::AlmightyTask::ctor, "nn_boss", "__ct__Q3_2nn4boss12AlmightyTaskFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::AlmightyTask::Initialize, "nn_boss", "Initialize__Q3_2nn4boss12AlmightyTaskFQ3_2nn4boss7TitleIDPCcUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::AlmightyTask::dtor, "nn_boss", "__dt__Q3_2nn4boss12AlmightyTaskFv", LogType::NN_BOSS);
// Storage
nn::boss::Storage::InitVTable();
cafeExportRegisterFunc(nn::boss::Storage::ctor1, "nn_boss", "__ct__Q3_2nn4boss7StorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::dtor, "nn_boss", "__dt__Q3_2nn4boss7StorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Finalize, "nn_boss", "Finalize__Q3_2nn4boss7StorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Exist, "nn_boss", "Exist__Q3_2nn4boss7StorageCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::GetDataList, "nn_boss", "GetDataList__Q3_2nn4boss7StorageCFPQ3_2nn4boss8DataNameUiPUiT2", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Initialize, "nn_boss", "Initialize__Q3_2nn4boss7StorageFPCcUiQ3_2nn4boss11StorageKind", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Initialize2, "nn_boss", "Initialize__Q3_2nn4boss7StorageFPCcQ3_2nn4boss11StorageKind", LogType::NN_BOSS);
// Storage
nn::boss::Storage::InitVTable();
cafeExportRegisterFunc(nn::boss::Storage::ctor1, "nn_boss", "__ct__Q3_2nn4boss7StorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::dtor, "nn_boss", "__dt__Q3_2nn4boss7StorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Finalize, "nn_boss", "Finalize__Q3_2nn4boss7StorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Exist, "nn_boss", "Exist__Q3_2nn4boss7StorageCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::GetDataList, "nn_boss", "GetDataList__Q3_2nn4boss7StorageCFPQ3_2nn4boss8DataNameUiPUiT2", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Initialize, "nn_boss", "Initialize__Q3_2nn4boss7StorageFPCcUiQ3_2nn4boss11StorageKind", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::Storage::Initialize2, "nn_boss", "Initialize__Q3_2nn4boss7StorageFPCcQ3_2nn4boss11StorageKind", LogType::NN_BOSS);
// AlmightyStorage
nn::boss::AlmightyStorage::InitVTable();
cafeExportRegisterFunc(nn::boss::AlmightyStorage::ctor, "nn_boss", "__ct__Q3_2nn4boss15AlmightyStorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::AlmightyStorage::Initialize, "nn_boss", "Initialize__Q3_2nn4boss15AlmightyStorageFQ3_2nn4boss7TitleIDPCcUiQ3_2nn4boss11StorageKind", LogType::NN_BOSS);
// AlmightyStorage
nn::boss::AlmightyStorage::InitVTable();
cafeExportRegisterFunc(nn::boss::AlmightyStorage::ctor, "nn_boss", "__ct__Q3_2nn4boss15AlmightyStorageFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::AlmightyStorage::Initialize, "nn_boss", "Initialize__Q3_2nn4boss15AlmightyStorageFQ3_2nn4boss7TitleIDPCcUiQ3_2nn4boss11StorageKind", LogType::NN_BOSS);
// NsData
nn::boss::NsData::InitVTable();
cafeExportRegisterFunc(nn::boss::NsData::ctor, "nn_boss", "__ct__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::dtor, "nn_boss", "__dt__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Initialize, "nn_boss", "Initialize__Q3_2nn4boss6NsDataFRCQ3_2nn4boss7StoragePCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::DeleteRealFile, "nn_boss", "DeleteRealFile__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::DeleteRealFileWithHistory, "nn_boss", "DeleteRealFileWithHistory__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Exist, "nn_boss", "Exist__Q3_2nn4boss6NsDataCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::GetSize, "nn_boss", "GetSize__Q3_2nn4boss6NsDataCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::GetCreatedTime, "nn_boss", "GetCreatedTime__Q3_2nn4boss6NsDataCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Read, "nn_boss", "Read__Q3_2nn4boss6NsDataFPvUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::ReadWithSizeOut, "nn_boss", "Read__Q3_2nn4boss6NsDataFPLPvUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Seek, "nn_boss", "Seek__Q3_2nn4boss6NsDataFLQ3_2nn4boss12PositionBase", LogType::NN_BOSS);
};
// NsData
nn::boss::NsData::InitVTable();
cafeExportRegisterFunc(nn::boss::NsData::ctor, "nn_boss", "__ct__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::dtor, "nn_boss", "__dt__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Initialize, "nn_boss", "Initialize__Q3_2nn4boss6NsDataFRCQ3_2nn4boss7StoragePCc", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::DeleteRealFile, "nn_boss", "DeleteRealFile__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::DeleteRealFileWithHistory, "nn_boss", "DeleteRealFileWithHistory__Q3_2nn4boss6NsDataFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Exist, "nn_boss", "Exist__Q3_2nn4boss6NsDataCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::GetSize, "nn_boss", "GetSize__Q3_2nn4boss6NsDataCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::GetCreatedTime, "nn_boss", "GetCreatedTime__Q3_2nn4boss6NsDataCFv", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Read, "nn_boss", "Read__Q3_2nn4boss6NsDataFPvUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::ReadWithSizeOut, "nn_boss", "Read__Q3_2nn4boss6NsDataFPLPvUi", LogType::NN_BOSS);
cafeExportRegisterFunc(nn::boss::NsData::Seek, "nn_boss", "Seek__Q3_2nn4boss6NsDataFLQ3_2nn4boss12PositionBase", LogType::NN_BOSS);
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
OSInitMutexEx(&nn::boss::g_mutex, nullptr);
nn::boss::g_initCounter = 0;
nn::boss::g_isInitialized = false;
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
}
}
}s_COSnnBossModule;
COSModule* GetModule()
{
return &s_COSnnBossModule;
}
}

View File

@ -1 +1,6 @@
void nnBoss_load();
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::boss
{
COSModule* GetModule();
}

View File

@ -9,8 +9,23 @@ namespace nn::ccr
return -1;
}
void Initialize()
class : public COSModule
{
cafeExportRegister("nn_ccr", CCRSysCaffeineBootCheck, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "nn_ccr";
}
void RPLMapped() override
{
cafeExportRegister("nn_ccr", CCRSysCaffeineBootCheck, LogType::Placeholder);
};
}s_COSnnccrModule;
COSModule* GetModule()
{
return &s_COSnnccrModule;
}
}

View File

@ -1,5 +1,6 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::ccr
{
void Initialize();
COSModule* GetModule();
}

View File

@ -18,9 +18,25 @@ namespace nn::cmpt
return 0;
}
void Initialize()
class : public COSModule
{
cafeExportRegister("nn_cmpt", CMPTAcctGetPcConf, LogType::Placeholder);
cafeExportRegister("nn_cmpt", CMPTGetDataSize, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "nn_cmpt";
}
void RPLMapped() override
{
cafeExportRegister("nn_cmpt", CMPTAcctGetPcConf, LogType::Placeholder);
cafeExportRegister("nn_cmpt", CMPTGetDataSize, LogType::Placeholder);
};
}s_COSnnCmptModule;
COSModule* GetModule()
{
return &s_COSnnCmptModule;
}
}

View File

@ -1,5 +1,6 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::cmpt
{
void Initialize();
COSModule* GetModule();
}

View File

@ -1,4 +1,5 @@
#include "Cafe/OS/common/OSCommon.h"
#include "nn_ec.h"
typedef struct
{
@ -17,10 +18,25 @@ void nnEcExport___ct__Q3_2nn2ec5MoneyFPCcN21(PPCInterpreter_t* hCPU)
osLib_returnFromFunction(hCPU, memory_getVirtualOffsetFromPointer(moneyStruct));
}
/*
* Load E commerce functions (E-Shop stuff)
*/
void nnEc_load()
namespace nn::ec
{
osLib_addFunction("nn_ec", "__ct__Q3_2nn2ec5MoneyFPCcN21", nnEcExport___ct__Q3_2nn2ec5MoneyFPCcN21);
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_ec";
}
void RPLMapped() override
{
osLib_addFunction("nn_ec", "__ct__Q3_2nn2ec5MoneyFPCcN21", nnEcExport___ct__Q3_2nn2ec5MoneyFPCcN21);
};
}s_COSnnEcModule;
COSModule* GetModule()
{
return &s_COSnnEcModule;
}
}

View File

@ -1 +1,8 @@
void nnEc_load();
#include "Cafe/OS/RPL/COSModule.h"
void nnEc_load();
namespace nn::ec
{
COSModule* GetModule();
}

View File

@ -758,70 +758,86 @@ namespace nn
return ipcCtx->SubmitAsync(std::move(ipcCtx), funcPtr, customParam);
}
void load()
class : public COSModule
{
g_fp.initCounter = 0;
g_fp.isAdminMode = false;
g_fp.isLoggedIn = false;
g_fp.getNotificationCalled = false;
g_fp.notificationHandler = nullptr;
g_fp.notificationHandlerParam = nullptr;
public:
std::string_view GetName() override
{
return "nn_fp";
}
coreinit::OSInitMutex(&g_fp.fpMutex);
FPIpcBufferAllocator.Init();
void RPLMapped() override
{
g_fp.initCounter = 0;
g_fp.isAdminMode = false;
g_fp.isLoggedIn = false;
g_fp.getNotificationCalled = false;
g_fp.notificationHandler = nullptr;
g_fp.notificationHandlerParam = nullptr;
cafeExportRegisterFunc(Initialize, "nn_fp", "Initialize__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(InitializeAdmin, "nn_fp", "InitializeAdmin__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(IsInitialized, "nn_fp", "IsInitialized__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(IsInitializedAdmin, "nn_fp", "IsInitializedAdmin__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(Finalize, "nn_fp", "Finalize__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(FinalizeAdmin, "nn_fp", "FinalizeAdmin__Q2_2nn2fpFv", LogType::NN_FP);
coreinit::OSInitMutex(&g_fp.fpMutex);
FPIpcBufferAllocator.Init();
cafeExportRegisterFunc(SetNotificationHandler, "nn_fp", "SetNotificationHandler__Q2_2nn2fpFUiPFQ3_2nn2fp16NotificationTypeUiPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(Initialize, "nn_fp", "Initialize__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(InitializeAdmin, "nn_fp", "InitializeAdmin__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(IsInitialized, "nn_fp", "IsInitialized__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(IsInitializedAdmin, "nn_fp", "IsInitializedAdmin__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(Finalize, "nn_fp", "Finalize__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(FinalizeAdmin, "nn_fp", "FinalizeAdmin__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(LoginAsync, "nn_fp", "LoginAsync__Q2_2nn2fpFPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(HasLoggedIn, "nn_fp", "HasLoggedIn__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(IsOnline, "nn_fp", "IsOnline__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendList, "nn_fp", "GetFriendList__Q2_2nn2fpFPUiT1UiT3", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendRequestList, "nn_fp", "GetFriendRequestList__Q2_2nn2fpFPUiT1UiT3", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendListAll, "nn_fp", "GetFriendListAll__Q2_2nn2fpFPUiT1UiT3", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendListEx, "nn_fp", "GetFriendListEx__Q2_2nn2fpFPQ3_2nn2fp10FriendDataPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendRequestListEx, "nn_fp", "GetFriendRequestListEx__Q2_2nn2fpFPQ3_2nn2fp13FriendRequestPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetBasicInfoAsync, "nn_fp", "GetBasicInfoAsync__Q2_2nn2fpFPQ3_2nn2fp9BasicInfoPCUiUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(SetNotificationHandler, "nn_fp", "SetNotificationHandler__Q2_2nn2fpFUiPFQ3_2nn2fp16NotificationTypeUiPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(GetMyPrincipalId, "nn_fp", "GetMyPrincipalId__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(GetMyAccountId, "nn_fp", "GetMyAccountId__Q2_2nn2fpFPc", LogType::NN_FP);
cafeExportRegisterFunc(GetMyScreenName, "nn_fp", "GetMyScreenName__Q2_2nn2fpFPw", LogType::NN_FP);
cafeExportRegisterFunc(GetMyMii, "nn_fp", "GetMyMii__Q2_2nn2fpFP12FFLStoreData", LogType::NN_FP);
cafeExportRegisterFunc(GetMyPlayingGame, "nn_fp", "GetMyPlayingGame__Q2_2nn2fpFPQ3_2nn2fp7GameKey", LogType::NN_FP);
cafeExportRegisterFunc(GetMyPreference, "nn_fp", "GetMyPreference__Q2_2nn2fpFPQ3_2nn2fp10Preference", LogType::NN_FP);
cafeExportRegisterFunc(GetMyComment, "nn_fp", "GetMyComment__Q2_2nn2fpFPQ3_2nn2fp7Comment", LogType::NN_FP);
cafeExportRegisterFunc(LoginAsync, "nn_fp", "LoginAsync__Q2_2nn2fpFPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(HasLoggedIn, "nn_fp", "HasLoggedIn__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(IsOnline, "nn_fp", "IsOnline__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendList, "nn_fp", "GetFriendList__Q2_2nn2fpFPUiT1UiT3", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendRequestList, "nn_fp", "GetFriendRequestList__Q2_2nn2fpFPUiT1UiT3", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendListAll, "nn_fp", "GetFriendListAll__Q2_2nn2fpFPUiT1UiT3", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendListEx, "nn_fp", "GetFriendListEx__Q2_2nn2fpFPQ3_2nn2fp10FriendDataPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendRequestListEx, "nn_fp", "GetFriendRequestListEx__Q2_2nn2fpFPQ3_2nn2fp13FriendRequestPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetBasicInfoAsync, "nn_fp", "GetBasicInfoAsync__Q2_2nn2fpFPQ3_2nn2fp9BasicInfoPCUiUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendAccountId, "nn_fp", "GetFriendAccountId__Q2_2nn2fpFPA17_cPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendScreenName, "nn_fp", "GetFriendScreenName__Q2_2nn2fpFPA11_wPCUiUibPUc", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendMii, "nn_fp", "GetFriendMii__Q2_2nn2fpFP12FFLStoreDataPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendPresence, "nn_fp", "GetFriendPresence__Q2_2nn2fpFPQ3_2nn2fp14FriendPresencePCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendRelationship, "nn_fp", "GetFriendRelationship__Q2_2nn2fpFPUcPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(IsJoinable, "nn_fp", "IsJoinable__Q2_2nn2fpFPCQ3_2nn2fp14FriendPresenceUL", LogType::NN_FP);
cafeExportRegisterFunc(GetMyPrincipalId, "nn_fp", "GetMyPrincipalId__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(GetMyAccountId, "nn_fp", "GetMyAccountId__Q2_2nn2fpFPc", LogType::NN_FP);
cafeExportRegisterFunc(GetMyScreenName, "nn_fp", "GetMyScreenName__Q2_2nn2fpFPw", LogType::NN_FP);
cafeExportRegisterFunc(GetMyMii, "nn_fp", "GetMyMii__Q2_2nn2fpFP12FFLStoreData", LogType::NN_FP);
cafeExportRegisterFunc(GetMyPlayingGame, "nn_fp", "GetMyPlayingGame__Q2_2nn2fpFPQ3_2nn2fp7GameKey", LogType::NN_FP);
cafeExportRegisterFunc(GetMyPreference, "nn_fp", "GetMyPreference__Q2_2nn2fpFPQ3_2nn2fp10Preference", LogType::NN_FP);
cafeExportRegisterFunc(GetMyComment, "nn_fp", "GetMyComment__Q2_2nn2fpFPQ3_2nn2fp7Comment", LogType::NN_FP);
cafeExportRegisterFunc(CheckSettingStatusAsync, "nn_fp", "CheckSettingStatusAsync__Q2_2nn2fpFPUcPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(IsPreferenceValid, "nn_fp", "IsPreferenceValid__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(UpdateCommentAsync, "nn_fp", "UpdateCommentAsync__Q2_2nn2fpFPCwPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(UpdatePreferenceAsync, "nn_fp", "UpdatePreferenceAsync__Q2_2nn2fpFPCQ3_2nn2fp10PreferencePFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(GetRequestBlockSettingAsync, "nn_fp", "GetRequestBlockSettingAsync__Q2_2nn2fpFPUcPCUiUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendAccountId, "nn_fp", "GetFriendAccountId__Q2_2nn2fpFPA17_cPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendScreenName, "nn_fp", "GetFriendScreenName__Q2_2nn2fpFPA11_wPCUiUibPUc", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendMii, "nn_fp", "GetFriendMii__Q2_2nn2fpFP12FFLStoreDataPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendPresence, "nn_fp", "GetFriendPresence__Q2_2nn2fpFPQ3_2nn2fp14FriendPresencePCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(GetFriendRelationship, "nn_fp", "GetFriendRelationship__Q2_2nn2fpFPUcPCUiUi", LogType::NN_FP);
cafeExportRegisterFunc(IsJoinable, "nn_fp", "IsJoinable__Q2_2nn2fpFPCQ3_2nn2fp14FriendPresenceUL", LogType::NN_FP);
cafeExportRegisterFunc(UpdateGameModeWithUnusedParam, "nn_fp", "UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCwUi", LogType::NN_FP);
cafeExportRegisterFunc(UpdateGameMode, "nn_fp", "UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw", LogType::NN_FP);
cafeExportRegisterFunc(CheckSettingStatusAsync, "nn_fp", "CheckSettingStatusAsync__Q2_2nn2fpFPUcPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(IsPreferenceValid, "nn_fp", "IsPreferenceValid__Q2_2nn2fpFv", LogType::NN_FP);
cafeExportRegisterFunc(UpdateCommentAsync, "nn_fp", "UpdateCommentAsync__Q2_2nn2fpFPCwPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(UpdatePreferenceAsync, "nn_fp", "UpdatePreferenceAsync__Q2_2nn2fpFPCQ3_2nn2fp10PreferencePFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(GetRequestBlockSettingAsync, "nn_fp", "GetRequestBlockSettingAsync__Q2_2nn2fpFPUcPCUiUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(AddFriendAsyncByPid, "nn_fp", "AddFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(AddFriendRequestByPlayRecordAsync, "nn_fp", "AddFriendRequestAsync__Q2_2nn2fpFPCQ3_2nn2fp18RecentPlayRecordExPCwPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(DeleteFriendFlagsAsync, "nn_fp", "DeleteFriendFlagsAsync__Q2_2nn2fpFPCUiUiT2PFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(RemoveFriendAsync, "nn_fp", "RemoveFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(MarkFriendRequestsAsReceivedAsync, "nn_fp", "MarkFriendRequestsAsReceivedAsync__Q2_2nn2fpFPCULUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(CancelFriendRequestAsync, "nn_fp", "CancelFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(DeleteFriendRequestAsync, "nn_fp", "DeleteFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(AcceptFriendRequestAsync, "nn_fp", "AcceptFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(UpdateGameModeWithUnusedParam, "nn_fp", "UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCwUi", LogType::NN_FP);
cafeExportRegisterFunc(UpdateGameMode, "nn_fp", "UpdateGameMode__Q2_2nn2fpFPCQ3_2nn2fp8GameModePCw", LogType::NN_FP);
cafeExportRegisterFunc(AddFriendAsyncByPid, "nn_fp", "AddFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(AddFriendRequestByPlayRecordAsync, "nn_fp", "AddFriendRequestAsync__Q2_2nn2fpFPCQ3_2nn2fp18RecentPlayRecordExPCwPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(DeleteFriendFlagsAsync, "nn_fp", "DeleteFriendFlagsAsync__Q2_2nn2fpFPCUiUiT2PFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(RemoveFriendAsync, "nn_fp", "RemoveFriendAsync__Q2_2nn2fpFUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(MarkFriendRequestsAsReceivedAsync, "nn_fp", "MarkFriendRequestsAsReceivedAsync__Q2_2nn2fpFPCULUiPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(CancelFriendRequestAsync, "nn_fp", "CancelFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(DeleteFriendRequestAsync, "nn_fp", "DeleteFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
cafeExportRegisterFunc(AcceptFriendRequestAsync, "nn_fp", "AcceptFriendRequestAsync__Q2_2nn2fpFULPFQ2_2nn6ResultPv_vPv", LogType::NN_FP);
};
}s_COSnnFpModule;
COSModule* GetModule()
{
return &s_COSnnFpModule;
}
}
}

View File

@ -1,8 +1,6 @@
#pragma once
namespace nn
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::fp
{
namespace fp
{
void load();
}
COSModule* GetModule();
}

View File

@ -164,15 +164,30 @@ namespace nn
osLib_returnFromFunction(hCPU, 1);
}
void load()
{
// this module is used by:
// Daily Log app
// Download Manager app
// and possibly other system titles?
// this module is used by:
// Daily Log app
// Download Manager app
// and possibly other system titles?
osLib_addFunction("nn_idbe", "DownloadIconFile__Q2_2nn4idbeFPvULUsb", export_DownloadIconFile);
osLib_addFunction("nn_idbe", "DecryptIconFile__Q2_2nn4idbeFPvPCv", export_DecryptIconFile);
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_idbe";
}
void RPLMapped() override
{
osLib_addFunction("nn_idbe", "DownloadIconFile__Q2_2nn4idbeFPvULUsb", export_DownloadIconFile);
osLib_addFunction("nn_idbe", "DecryptIconFile__Q2_2nn4idbeFPvPCv", export_DecryptIconFile);
};
}s_COSnnIdbeModule;
COSModule* GetModule()
{
return &s_COSnnIdbeModule;
}
}

View File

@ -1,8 +1,6 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace nn
namespace nn::idbe
{
namespace idbe
{
void load();
}
COSModule* GetModule();
}

View File

@ -74,18 +74,33 @@ namespace nn
return BUILD_NN_RESULT(NN_RESULT_LEVEL_SUCCESS, NN_RESULT_MODULE_NN_NDM, 0);
}
void load()
class : public COSModule
{
for(size_t i=0; i<NUM_DAEMONS; i++)
s_daemonStatus[i] = DAEMON_STATUS::RUNNING;
s_initializeRefCount = 0;
public:
std::string_view GetName() override
{
return "nn_ndm";
}
cafeExportRegisterFunc(Initialize, "nn_ndm", "Initialize__Q2_2nn3ndmFv", LogType::Placeholder);
cafeExportRegisterFunc(Finalize, "nn_ndm", "Finalize__Q2_2nn3ndmFv", LogType::Placeholder);
cafeExportRegisterFunc(IsInitialized, "nn_ndm", "IsInitialized__Q2_2nn3ndmFv", LogType::Placeholder);
cafeExportRegisterFunc(GetDaemonStatus, "nn_ndm", "GetDaemonStatus__Q2_2nn3ndmFPQ4_2nn3ndm7IDaemon6StatusQ4_2nn3ndm4Cafe10DaemonName", LogType::Placeholder);
cafeExportRegisterFunc(SuspendDaemons, "nn_ndm", "SuspendDaemons__Q2_2nn3ndmFUi", LogType::Placeholder);
cafeExportRegisterFunc(ResumeDaemons, "nn_ndm", "ResumeDaemons__Q2_2nn3ndmFUi", LogType::Placeholder);
void RPLMapped() override
{
for(size_t i=0; i<NUM_DAEMONS; i++)
s_daemonStatus[i] = DAEMON_STATUS::RUNNING;
s_initializeRefCount = 0;
cafeExportRegisterFunc(Initialize, "nn_ndm", "Initialize__Q2_2nn3ndmFv", LogType::Placeholder);
cafeExportRegisterFunc(Finalize, "nn_ndm", "Finalize__Q2_2nn3ndmFv", LogType::Placeholder);
cafeExportRegisterFunc(IsInitialized, "nn_ndm", "IsInitialized__Q2_2nn3ndmFv", LogType::Placeholder);
cafeExportRegisterFunc(GetDaemonStatus, "nn_ndm", "GetDaemonStatus__Q2_2nn3ndmFPQ4_2nn3ndm7IDaemon6StatusQ4_2nn3ndm4Cafe10DaemonName", LogType::Placeholder);
cafeExportRegisterFunc(SuspendDaemons, "nn_ndm", "SuspendDaemons__Q2_2nn3ndmFUi", LogType::Placeholder);
cafeExportRegisterFunc(ResumeDaemons, "nn_ndm", "ResumeDaemons__Q2_2nn3ndmFUi", LogType::Placeholder);
};
}s_COSnnNdmModule;
COSModule* GetModule()
{
return &s_COSnnNdmModule;
}
}
}

View File

@ -1,7 +1,9 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace nn
{
namespace ndm
{
void load();
COSModule* GetModule();
}
}

View File

@ -1040,13 +1040,27 @@ namespace nn::nfp
osLib_addFunction("nn_nfp", "GetAmiiboSettingsArgs__Q2_2nn3nfpFPQ3_2nn3nfp18AmiiboSettingsArgs", nnNfpExport_GetAmiiboSettingsArgs);
}
void load()
class : public COSModule
{
nnNfp_load(); // legacy interface, update these to use cafeExportRegister / cafeExportRegisterFunc
public:
std::string_view GetName() override
{
return "nn_nfp";
}
cafeExportRegisterFunc(nn::nfp::GetErrorCode, "nn_nfp", "GetErrorCode__Q2_2nn3nfpFRCQ2_2nn6Result", LogType::NN_NFP);
cafeExportRegisterFunc(nn::nfp::GetNfpRomInfo, "nn_nfp", "GetNfpRomInfo__Q2_2nn3nfpFPQ3_2nn3nfp7RomInfo", LogType::NN_NFP);
cafeExportRegisterFunc(nn::nfp::GetNfpReadOnlyInfo, "nn_nfp", "GetNfpReadOnlyInfo__Q2_2nn3nfpFPQ3_2nn3nfp12ReadOnlyInfo", LogType::NN_NFP);
void RPLMapped() override
{
nnNfp_load(); // legacy interface, update these to use cafeExportRegister / cafeExportRegisterFunc
cafeExportRegisterFunc(nn::nfp::GetErrorCode, "nn_nfp", "GetErrorCode__Q2_2nn3nfpFRCQ2_2nn6Result", LogType::NN_NFP);
cafeExportRegisterFunc(nn::nfp::GetNfpRomInfo, "nn_nfp", "GetNfpRomInfo__Q2_2nn3nfpFPQ3_2nn3nfp7RomInfo", LogType::NN_NFP);
cafeExportRegisterFunc(nn::nfp::GetNfpReadOnlyInfo, "nn_nfp", "GetNfpReadOnlyInfo__Q2_2nn3nfpFPQ3_2nn3nfp12ReadOnlyInfo", LogType::NN_NFP);
};
}s_COSnnNfpModule;
COSModule* GetModule()
{
return &s_COSnnNfpModule;
}
}

View File

@ -1,10 +1,11 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::nfp
{
uint32 NFCGetTagInfo(uint32 index, uint32 timeout, MPTR functionPtr, void* userParam);
void load();
COSModule* GetModule();
}
void nnNfp_load();

View File

@ -273,30 +273,45 @@ namespace nn
osLib_returnFromFunction(hCPU, 0);
}
void load()
class : public COSModule
{
osLib_addFunction("nn_nim", "NeedsNetworkUpdate__Q2_2nn3nimFPb", export_NeedsNetworkUpdate);
osLib_addFunction("nn_nim", "GetUpdatePackageProgress__Q2_2nn3nimFPQ3_2nn3nim21UpdatePackageProgress", export_GetUpdatePackageProgress);
osLib_addFunction("nn_nim", "NeedsNotifyToUsers__Q3_2nn3nim4utilFPCQ3_2nn3nim21UpdatePackageProgress", export_NeedsNotifyToUsers);
osLib_addFunction("nn_nim", "GetNumTitlePackages__Q2_2nn3nimFv", export_GetNumTitlePackages);
public:
std::string_view GetName() override
{
return "nn_nim";
}
osLib_addFunction("nn_nim", "GetTitlePackageInfos__Q2_2nn3nimFPQ3_2nn3nim16TitlePackageInfoPCULUi", export_GetTitlePackageInfos);
osLib_addFunction("nn_nim", "NeedsNotifyToUsers__Q3_2nn3nim4utilFPCQ3_2nn3nim16TitlePackageInfoPCQ3_2nn3nim11ResultError", export_NeedsNotifyToUsersTitlePackage);
void RPLMapped() override
{
osLib_addFunction("nn_nim", "NeedsNetworkUpdate__Q2_2nn3nimFPb", export_NeedsNetworkUpdate);
osLib_addFunction("nn_nim", "GetUpdatePackageProgress__Q2_2nn3nimFPQ3_2nn3nim21UpdatePackageProgress", export_GetUpdatePackageProgress);
osLib_addFunction("nn_nim", "NeedsNotifyToUsers__Q3_2nn3nim4utilFPCQ3_2nn3nim21UpdatePackageProgress", export_NeedsNotifyToUsers);
osLib_addFunction("nn_nim", "GetNumTitlePackages__Q2_2nn3nimFv", export_GetNumTitlePackages);
osLib_addFunction("nn_nim", "ListTitlePackagesStatically__Q2_2nn3nimFPULUi", export_ListTitlePackagesStatically);
osLib_addFunction("nn_nim", "GetTitlePackageInfos__Q2_2nn3nimFPQ3_2nn3nim16TitlePackageInfoPCULUi", export_GetTitlePackageInfos);
osLib_addFunction("nn_nim", "NeedsNotifyToUsers__Q3_2nn3nim4utilFPCQ3_2nn3nim16TitlePackageInfoPCQ3_2nn3nim11ResultError", export_NeedsNotifyToUsersTitlePackage);
osLib_addFunction("nn_nim", "GetECommerceInfrastructureCountry__Q2_2nn3nimFPQ3_2nn3nim7Country", export_GetECommerceInfrastructureCountry);
osLib_addFunction("nn_nim", "ListTitlePackagesStatically__Q2_2nn3nimFPULUi", export_ListTitlePackagesStatically);
osLib_addFunction("nn_nim", "GetECommerceInfrastructureCountry__Q2_2nn3nimFPQ3_2nn3nim7Country", export_GetECommerceInfrastructureCountry);
osLib_addFunction("nn_nim", "QuerySchedulerStatus__Q2_2nn3nimFPQ3_2nn3nim15SchedulerStatus", export_QuerySchedulerStatus);
osLib_addFunction("nn_nim", "QuerySchedulerStatus__Q2_2nn3nimFPQ3_2nn3nim15SchedulerStatus", export_QuerySchedulerStatus);
osLib_addFunction("nn_nim", "GetIconDatabaseEntries__Q2_2nn3nimFPQ3_2nn3nim17IconDatabaseEntryPCULUi", export_GetIconDatabaseEntries);
osLib_addFunction("nn_nim", "GetIconDatabaseEntries__Q2_2nn3nimFPQ3_2nn3nim17IconDatabaseEntryPCULUi", export_GetIconDatabaseEntries);
cafeExportRegisterFunc(ConstructResultError, "nn_nim", "Construct__Q3_2nn3nim11ResultErrorFQ2_2nn6Resulti", LogType::Placeholder);
cafeExportRegisterFunc(ConstructResultError, "nn_nim", "Construct__Q3_2nn3nim11ResultErrorFQ2_2nn6Resulti", LogType::Placeholder);
osLib_addFunction("nn_nim", "MakeTitlePackageTaskConfigAutoUsingBgInstallPolicy__Q3_2nn3nim4utilFULiQ3_2nn4Cafe9TitleType", export_MakeTitlePackageTaskConfigAutoUsingBgInstallPolicy);
osLib_addFunction("nn_nim", "CalculateTitleInstallSize__Q2_2nn3nimFPLRCQ3_2nn3nim22TitlePackageTaskConfigPCUsUi", export_CalculateTitleInstallSize);
osLib_addFunction("nn_nim", "MakeTitlePackageTaskConfigAutoUsingBgInstallPolicy__Q3_2nn3nim4utilFULiQ3_2nn4Cafe9TitleType", export_MakeTitlePackageTaskConfigAutoUsingBgInstallPolicy);
osLib_addFunction("nn_nim", "CalculateTitleInstallSize__Q2_2nn3nimFPLRCQ3_2nn3nim22TitlePackageTaskConfigPCUsUi", export_CalculateTitleInstallSize);
};
}s_COSnnNimModule;
COSModule* GetModule()
{
return &s_COSnnNimModule;
}
}
}

View File

@ -1,9 +1,10 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nn
{
namespace nim
{
void load();
COSModule* GetModule();
}
}

View File

@ -95,36 +95,55 @@ namespace nn
static_assert(GetErrorCodeImpl(0xa119c600) == 1155004);
void load()
class : public COSModule
{
g_ReportTypes = 0;
g_IsOnlineMode = false;
g_IsInitialized = false;
g_IsOfflineDBMode = false;
public:
std::string_view GetName() override
{
return "nn_olv";
}
loadOliveInitializeTypes();
loadOliveUploadCommunityTypes();
loadOliveDownloadCommunityTypes();
loadOliveUploadFavoriteTypes();
loadOlivePostAndTopicTypes();
void RPLMapped() override
{
loadOliveInitializeTypes();
loadOliveUploadCommunityTypes();
loadOliveDownloadCommunityTypes();
loadOliveUploadFavoriteTypes();
loadOlivePostAndTopicTypes();
cafeExportRegisterFunc(GetErrorCode, "nn_olv", "GetErrorCode__Q2_2nn3olvFRCQ2_2nn6Result", LogType::NN_OLV);
cafeExportRegisterFunc(GetErrorCode, "nn_olv", "GetErrorCode__Q2_2nn3olvFRCQ2_2nn6Result", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostApp, "nn_olv", "UploadPostDataByPostApp__Q2_2nn3olvFPCQ3_2nn3olv28UploadPostDataByPostAppParam", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostApp, "nn_olv", "UploadCommentDataByPostApp__Q2_2nn3olvFPCQ3_2nn3olv31UploadCommentDataByPostAppParam", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostApp, "nn_olv", "UploadDirectMessageDataByPostApp__Q2_2nn3olvFPCQ3_2nn3olv37UploadDirectMessageDataByPostAppParam", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostApp, "nn_olv", "UploadPostDataByPostApp__Q2_2nn3olvFPCQ3_2nn3olv28UploadPostDataByPostAppParam", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostApp, "nn_olv", "UploadCommentDataByPostApp__Q2_2nn3olvFPCQ3_2nn3olv31UploadCommentDataByPostAppParam", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostApp, "nn_olv", "UploadDirectMessageDataByPostApp__Q2_2nn3olvFPCQ3_2nn3olv37UploadDirectMessageDataByPostAppParam", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultByPostApp__Q2_2nn3olvFv", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultWithUploadedPostDataByPostApp__Q2_2nn3olvFPQ3_2nn3olv16UploadedPostData", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultWithUploadedDirectMessageDataByPostApp__Q2_2nn3olvFPQ3_2nn3olv25UploadedDirectMessageData", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultWithUploadedCommentDataByPostApp__Q2_2nn3olvFPQ3_2nn3olv19UploadedCommentData", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultByPostApp__Q2_2nn3olvFv", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultWithUploadedPostDataByPostApp__Q2_2nn3olvFPQ3_2nn3olv16UploadedPostData", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultWithUploadedDirectMessageDataByPostApp__Q2_2nn3olvFPQ3_2nn3olv25UploadedDirectMessageData", LogType::NN_OLV);
cafeExportRegisterFunc(StubPostAppResult, "nn_olv", "GetResultWithUploadedCommentDataByPostApp__Q2_2nn3olvFPQ3_2nn3olv19UploadedCommentData", LogType::NN_OLV);
cafeExportRegisterFunc(UploadedPostData_GetPostId, "nn_olv", "GetPostId__Q3_2nn3olv16UploadedPostDataCFv", LogType::NN_OLV);
}
cafeExportRegisterFunc(UploadedPostData_GetPostId, "nn_olv", "GetPostId__Q3_2nn3olv16UploadedPostDataCFv", LogType::NN_OLV);
};
void unload() // not called yet
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
g_ReportTypes = 0;
g_IsOnlineMode = false;
g_IsInitialized = false;
g_IsOfflineDBMode = false;
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
OfflineDB_Shutdown();
}
}
}s_COSnnOlvModule;
COSModule* GetModule()
{
OfflineDB_Shutdown();
return &s_COSnnOlvModule;
}
}

View File

@ -5,20 +5,16 @@
#include "Cafe/OS/libs/nn_act/nn_act.h"
#include "Cafe/CafeSystem.h"
#include "Cemu/napi/napi.h"
#include "Cafe/OS/RPL/COSModule.h"
#include "nn_olv_Common.h"
namespace nn
namespace nn::olv
{
namespace olv
{
extern ParamPackStorage g_ParamPack;
extern DiscoveryResultStorage g_DiscoveryResults;
extern ParamPackStorage g_ParamPack;
extern DiscoveryResultStorage g_DiscoveryResults;
sint32 GetOlvAccessKey(uint32* pOutKey);
sint32 GetOlvAccessKey(uint32_t* pOutKey);
void load();
void unload();
}
COSModule* GetModule();
}

View File

@ -14,10 +14,10 @@ namespace nn
ParamPackStorage g_ParamPack;
DiscoveryResultStorage g_DiscoveryResults;
sint32 GetOlvAccessKey(uint32_t* pOutKey)
sint32 GetOlvAccessKey(uint32* pOutKey)
{
*pOutKey = 0;
uint32_t accessKey = CafeSystem::GetForegroundTitleOlvAccesskey();
uint32 accessKey = CafeSystem::GetForegroundTitleOlvAccesskey();
if (accessKey == -1)
return OLV_RESULT_STATUS(1102);

View File

@ -31,12 +31,28 @@ namespace nn
return 0;
}
void Initialize()
class : public COSModule
{
cafeExportRegisterFunc(GetPlayDiaryMaxLength, "nn_pdm", "GetPlayDiaryMaxLength__Q2_2nn3pdmFPi", LogType::NN_PDM);
cafeExportRegisterFunc(GetPlayStatsMaxLength, "nn_pdm", "GetPlayStatsMaxLength__Q2_2nn3pdmFPi", LogType::NN_PDM);
public:
std::string_view GetName() override
{
return "nn_pdm";
}
cafeExportRegisterFunc(GetPlayDiary, "nn_pdm", "GetPlayDiary__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayDiaryiT3", LogType::NN_PDM);
void RPLMapped() override
{
cafeExportRegisterFunc(GetPlayDiaryMaxLength, "nn_pdm", "GetPlayDiaryMaxLength__Q2_2nn3pdmFPi", LogType::NN_PDM);
cafeExportRegisterFunc(GetPlayStatsMaxLength, "nn_pdm", "GetPlayStatsMaxLength__Q2_2nn3pdmFPi", LogType::NN_PDM);
cafeExportRegisterFunc(GetPlayDiary, "nn_pdm", "GetPlayDiary__Q2_2nn3pdmFPiPQ3_2nn3pdm9PlayDiaryiT3", LogType::NN_PDM);
};
}s_COSnnPdmModule;
COSModule* GetModule()
{
return &s_COSnnPdmModule;
}
}
}

View File

@ -1,7 +1,6 @@
namespace nn
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::pdm
{
namespace pdm
{
void Initialize();
};
COSModule* GetModule();
};

View File

@ -765,55 +765,6 @@ namespace save
return asyncData->GetResult();
}
void load()
{
cafeExportRegister("nn_save", SAVEInit, LogType::Save);
cafeExportRegister("nn_save", SAVEInitSaveDir, LogType::Save);
cafeExportRegister("nn_save", SAVEGetSharedDataTitlePath, LogType::Save);
cafeExportRegister("nn_save", SAVEGetSharedSaveDataPath, LogType::Save);
cafeExportRegister("nn_save", SAVEGetFreeSpaceSize, LogType::Save);
cafeExportRegister("nn_save", SAVEGetFreeSpaceSizeAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEMakeDir, LogType::Save);
cafeExportRegister("nn_save", SAVEMakeDirAsync, LogType::Save);
cafeExportRegister("nn_save", SAVERemove, LogType::Save);
cafeExportRegister("nn_save", SAVERemoveAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEChangeDir, LogType::Save);
cafeExportRegister("nn_save", SAVEChangeDirAsync, LogType::Save);
cafeExportRegister("nn_save", SAVERename, LogType::Save);
cafeExportRegister("nn_save", SAVERenameAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEFlushQuota, LogType::Save);
cafeExportRegister("nn_save", SAVEFlushQuotaAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStat, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplicationVariation, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplicationVariationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFile, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationVariation, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationVariationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDir, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplicationVariation, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplicationVariationAsync, LogType::Save);
}
void ResetToDefaultState()
{
if(g_nn_save->initialized)
@ -823,5 +774,80 @@ namespace save
}
}
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_save";
}
void RPLMapped() override
{
cafeExportRegister("nn_save", SAVEInit, LogType::Save);
cafeExportRegister("nn_save", SAVEInitSaveDir, LogType::Save);
cafeExportRegister("nn_save", SAVEGetSharedDataTitlePath, LogType::Save);
cafeExportRegister("nn_save", SAVEGetSharedSaveDataPath, LogType::Save);
cafeExportRegister("nn_save", SAVEGetFreeSpaceSize, LogType::Save);
cafeExportRegister("nn_save", SAVEGetFreeSpaceSizeAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEMakeDir, LogType::Save);
cafeExportRegister("nn_save", SAVEMakeDirAsync, LogType::Save);
cafeExportRegister("nn_save", SAVERemove, LogType::Save);
cafeExportRegister("nn_save", SAVERemoveAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEChangeDir, LogType::Save);
cafeExportRegister("nn_save", SAVEChangeDirAsync, LogType::Save);
cafeExportRegister("nn_save", SAVERename, LogType::Save);
cafeExportRegister("nn_save", SAVERenameAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEFlushQuota, LogType::Save);
cafeExportRegister("nn_save", SAVEFlushQuotaAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStat, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplicationVariation, LogType::Save);
cafeExportRegister("nn_save", SAVEGetStatOtherNormalApplicationVariationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFile, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationVariation, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenFileOtherNormalApplicationVariationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDir, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplication, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplicationVariation, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplicationAsync, LogType::Save);
cafeExportRegister("nn_save", SAVEOpenDirOtherNormalApplicationVariationAsync, LogType::Save);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
ResetToDefaultState();
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
ResetToDefaultState();
}
}
}s_COSnnSaveModule;
COSModule* GetModule()
{
return &s_COSnnSaveModule;
}
}
}

View File

@ -1,12 +1,11 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nn
namespace nn::save
{
namespace save
{
void load();
void ResetToDefaultState();
bool GetPersistentIdEx(uint8 accountSlot, uint32* persistentId);
}
COSModule* GetModule();
}

View File

@ -103,13 +103,37 @@ namespace nn
{
return s_defaultWhiteListAccessor;
}
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_sl";
}
void RPLMapped() override
{
cafeExportRegisterFunc(nn::sl::GetDefaultWhiteListAccessor, "nn_sl", "GetDefaultWhiteListAccessor__Q2_2nn2slFv", LogType::NN_SL);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
nn::sl::WhiteListAccessor::InitVTable();
nn::sl::WhiteListAccessor::ctor(nn::sl::s_defaultWhiteListAccessor);
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
// nothing to clean up
}
}
}s_COSnnSlModule;
COSModule* GetModule()
{
return &s_COSnnSlModule;
}
} // namespace sl
} // namespace nn
void nnSL_load()
{
nn::sl::WhiteListAccessor::InitVTable();
nn::sl::WhiteListAccessor::ctor(nn::sl::s_defaultWhiteListAccessor);
cafeExportRegisterFunc(nn::sl::GetDefaultWhiteListAccessor, "nn_sl", "GetDefaultWhiteListAccessor__Q2_2nn2slFv", LogType::NN_SL);
}

View File

@ -1 +1,6 @@
void nnSL_load();
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::sl
{
COSModule* GetModule();
}

View File

@ -132,19 +132,32 @@ namespace nn
return 0;
}
void load()
class : public COSModule
{
cafeExportRegisterFunc(GetDefaultExtendedStorageVolumeId, "nn_spm", "GetDefaultExtendedStorageVolumeId__Q2_2nn3spmFv", LogType::Placeholder);
cafeExportRegisterFunc(GetExtendedStorageIndex, "nn_spm", "GetExtendedStorageIndex__Q2_2nn3spmFPQ3_2nn3spm12StorageIndex", LogType::Placeholder);
cafeExportRegisterFunc(GetStorageList, "nn_spm", "GetStorageList__Q2_2nn3spmFPQ3_2nn3spm15StorageListItemUi", LogType::Placeholder);
public:
std::string_view GetName() override
{
return "nn_spm";
}
cafeExportRegisterFunc(GetStorageInfo, "nn_spm", "GetStorageInfo__Q2_2nn3spmFPQ3_2nn3spm11StorageInfoQ3_2nn3spm12StorageIndex", LogType::Placeholder);
void RPLMapped() override
{
cafeExportRegisterFunc(GetDefaultExtendedStorageVolumeId, "nn_spm", "GetDefaultExtendedStorageVolumeId__Q2_2nn3spmFv", LogType::Placeholder);
cafeExportRegisterFunc(GetExtendedStorageIndex, "nn_spm", "GetExtendedStorageIndex__Q2_2nn3spmFPQ3_2nn3spm12StorageIndex", LogType::Placeholder);
cafeExportRegisterFunc(GetStorageList, "nn_spm", "GetStorageList__Q2_2nn3spmFPQ3_2nn3spm15StorageListItemUi", LogType::Placeholder);
cafeExportRegisterFunc(GetStorageInfo, "nn_spm", "GetStorageInfo__Q2_2nn3spmFPQ3_2nn3spm11StorageInfoQ3_2nn3spm12StorageIndex", LogType::Placeholder);
cafeExportRegisterFunc(VolumeId_Compare, "nn_spm", "Compare__Q3_2nn3spm8VolumeIdCFRCQ3_2nn3spm8VolumeId", LogType::Placeholder);
cafeExportRegisterFunc(VolumeId_Compare, "nn_spm", "Compare__Q3_2nn3spm8VolumeIdCFRCQ3_2nn3spm8VolumeId", LogType::Placeholder);
cafeExportRegisterFunc(WaitStateUpdated, "nn_spm", "WaitStateUpdated__Q2_2nn3spmFPUL", LogType::Placeholder);
};
cafeExportRegisterFunc(WaitStateUpdated, "nn_spm", "WaitStateUpdated__Q2_2nn3spmFPUL", LogType::Placeholder);
}s_COSnnSpmModule;
COSModule* GetModule()
{
return &s_COSnnSpmModule;
}
}
}

View File

@ -1,9 +1,10 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nn
{
namespace spm
{
void load();
COSModule* GetModule();
}
}

View File

@ -16,9 +16,24 @@ namespace nn::temp
osLib_returnFromFunction(hCPU, 0);
}
void Initialize()
class : public COSModule
{
osLib_addFunction("nn_temp", "TEMPCreateAndInitTempDir", nnTempExport_TEMPCreateAndInitTempDir);
public:
std::string_view GetName() override
{
return "nn_temp";
}
void RPLMapped() override
{
osLib_addFunction("nn_temp", "TEMPCreateAndInitTempDir", nnTempExport_TEMPCreateAndInitTempDir);
};
}s_COSnnTempModule;
COSModule* GetModule()
{
return &s_COSnnTempModule;
}
};

View File

@ -1,6 +1,7 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::temp
{
void Initialize();
COSModule* GetModule();
};

View File

@ -5,7 +5,7 @@ typedef struct
uint32 reserved;
}udsWorkspace_t;
udsWorkspace_t* udsWorkspace = NULL;
udsWorkspace_t* udsWorkspace = nullptr;
void nnUdsExport___sti___11_uds_Api_cpp_f5d9abb2(PPCInterpreter_t* hCPU)
{
@ -15,10 +15,36 @@ void nnUdsExport___sti___11_uds_Api_cpp_f5d9abb2(PPCInterpreter_t* hCPU)
osLib_returnFromFunction(hCPU, memory_getVirtualOffsetFromPointer(udsWorkspace));
}
/*
* Load UDS functions
*/
void nnUds_load()
namespace nn::uds
{
osLib_addFunction("nn_uds", "__sti___11_uds_Api_cpp_f5d9abb2", nnUdsExport___sti___11_uds_Api_cpp_f5d9abb2);
}
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nn_uds";
}
void RPLMapped() override
{
osLib_addFunction("nn_uds", "__sti___11_uds_Api_cpp_f5d9abb2", nnUdsExport___sti___11_uds_Api_cpp_f5d9abb2);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
udsWorkspace = nullptr;
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
udsWorkspace = nullptr;
}
}
}s_COSnnUdsModule;
COSModule* GetModule()
{
return &s_COSnnUdsModule;
}
}

View File

@ -1 +1,6 @@
void nnUds_load();
#include "Cafe/OS/RPL/COSModule.h"
namespace nn::uds
{
COSModule* GetModule();
}

View File

@ -944,23 +944,46 @@ namespace nsyshid
this->m_hid = hid;
}
void load()
class : public COSModule
{
osLib_addFunction("nsyshid", "HIDAddClient", export_HIDAddClient);
osLib_addFunction("nsyshid", "HIDDelClient", export_HIDDelClient);
osLib_addFunction("nsyshid", "HIDGetDescriptor", export_HIDGetDescriptor);
osLib_addFunction("nsyshid", "HIDSetIdle", export_HIDSetIdle);
osLib_addFunction("nsyshid", "HIDSetProtocol", export_HIDSetProtocol);
osLib_addFunction("nsyshid", "HIDSetReport", export_HIDSetReport);
public:
std::string_view GetName() override
{
return "nsyshid";
}
osLib_addFunction("nsyshid", "HIDRead", export_HIDRead);
osLib_addFunction("nsyshid", "HIDWrite", export_HIDWrite);
void RPLMapped() override
{
osLib_addFunction("nsyshid", "HIDAddClient", export_HIDAddClient);
osLib_addFunction("nsyshid", "HIDDelClient", export_HIDDelClient);
osLib_addFunction("nsyshid", "HIDGetDescriptor", export_HIDGetDescriptor);
osLib_addFunction("nsyshid", "HIDSetIdle", export_HIDSetIdle);
osLib_addFunction("nsyshid", "HIDSetProtocol", export_HIDSetProtocol);
osLib_addFunction("nsyshid", "HIDSetReport", export_HIDSetReport);
osLib_addFunction("nsyshid", "HIDDecodeError", export_HIDDecodeError);
osLib_addFunction("nsyshid", "HIDRead", export_HIDRead);
osLib_addFunction("nsyshid", "HIDWrite", export_HIDWrite);
// initialise whitelist
Whitelist::GetInstance();
osLib_addFunction("nsyshid", "HIDDecodeError", export_HIDDecodeError);
AttachDefaultBackends();
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
// initialise whitelist
Whitelist::GetInstance();
AttachDefaultBackends();
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
}
}
}s_COSnsyshidModule;
COSModule* GetModule()
{
return &s_COSnsyshidModule;
}
} // namespace nsyshid

View File

@ -1,12 +1,12 @@
#pragma once
#include "Cafe/OS/RPL/COSModule.h"
namespace nsyshid
{
class Backend;
void AttachBackend(const std::shared_ptr<Backend>& backend);
void DetachBackend(const std::shared_ptr<Backend>& backend);
void load();
COSModule* GetModule();
} // namespace nsyshid

View File

@ -50,9 +50,28 @@ namespace nsyskbd
return 0;
}
void nsyskbd_load()
class : public COSModule
{
cafeExportRegister("nsyskbd", KBDGetChannelStatus, LogType::Placeholder);
cafeExportRegister("nsyskbd", KBDGetKey, LogType::Placeholder);
public:
std::string_view GetName() override
{
return "nsyskbd";
}
void RPLMapped() override
{
cafeExportRegister("nsyskbd", KBDGetChannelStatus, LogType::Placeholder);
cafeExportRegister("nsyskbd", KBDGetKey, LogType::Placeholder);
};
void RPLUnmapped() override
{
}
}s_COSnsyskbdModule;
COSModule* GetModule()
{
return &s_COSnsyskbdModule;
}
}

View File

@ -1,5 +1,7 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace nsyskbd
{
void nsyskbd_load();
COSModule* GetModule();
}

View File

@ -2217,69 +2217,78 @@ namespace nsysnet
namespace nsysnet
{
void Initialize()
{
cafeExportRegister("nsysnet", inet_ntop, LogType::Socket);
}
}
// register nsysnet functions
void nsysnet_load()
{
nsysnet::Initialize();
// the below code is the old way of registering API which is deprecated
osLib_addFunction("nsysnet", "socket_lib_init", nsysnetExport_socket_lib_init);
osLib_addFunction("nsysnet", "socket_lib_finish", nsysnetExport_socket_lib_finish);
// socket API
osLib_addFunction("nsysnet", "socket", nsysnetExport_socket);
osLib_addFunction("nsysnet", "mw_socket", nsysnetExport_mw_socket);
osLib_addFunction("nsysnet", "shutdown", nsysnetExport_shutdown);
osLib_addFunction("nsysnet", "socketclose", nsysnetExport_socketclose);
osLib_addFunction("nsysnet", "setsockopt", nsysnetExport_setsockopt);
osLib_addFunction("nsysnet", "getsockopt", nsysnetExport_getsockopt);
osLib_addFunction("nsysnet", "bind", nsysnetExport_bind);
osLib_addFunction("nsysnet", "listen", nsysnetExport_listen);
osLib_addFunction("nsysnet", "accept", nsysnetExport_accept);
osLib_addFunction("nsysnet", "connect", nsysnetExport_connect);
osLib_addFunction("nsysnet", "send", nsysnetExport_send);
osLib_addFunction("nsysnet", "recv", nsysnetExport_recv);
osLib_addFunction("nsysnet", "select", nsysnetExport_select);
osLib_addFunction("nsysnet", "getsockname", nsysnetExport_getsockname);
osLib_addFunction("nsysnet", "getpeername", nsysnetExport_getpeername);
osLib_addFunction("nsysnet", "inet_aton", nsysnetExport_inet_aton);
osLib_addFunction("nsysnet", "inet_pton", nsysnetExport_inet_pton);
osLib_addFunction("nsysnet", "inet_ntoa", nsysnetExport_inet_ntoa);
osLib_addFunction("nsysnet", "htons", nsysnetExport_htons);
osLib_addFunction("nsysnet", "htonl", nsysnetExport_htonl);
osLib_addFunction("nsysnet", "ntohs", nsysnetExport_ntohs);
osLib_addFunction("nsysnet", "ntohl", nsysnetExport_ntohl);
osLib_addFunction("nsysnet", "gethostbyname", nsysnetExport_gethostbyname);
osLib_addFunction("nsysnet", "gethostbyaddr", nsysnetExport_gethostbyaddr);
osLib_addFunction("nsysnet", "getaddrinfo", nsysnetExport_getaddrinfo);
osLib_addFunction("nsysnet", "socketlasterr", nsysnetExport_socketlasterr);
// unfinished implementations
osLib_addFunction("nsysnet", "recvfrom", nsysnetExport_recvfrom);
osLib_addFunction("nsysnet", "recvfrom_ex", nsysnetExport_recvfrom_ex);
osLib_addFunction("nsysnet", "sendto", nsysnetExport_sendto);
osLib_addFunction("nsysnet", "sendto_multi", nsysnetExport_sendto_multi);
osLib_addFunction("nsysnet", "sendto_multi_ex", nsysnetExport_sendto_multi_ex);
// NSSL API
osLib_addFunction("nsysnet", "NSSLCreateContext", nsysnet::export_NSSLCreateContext);
osLib_addFunction("nsysnet", "NSSLSetClientPKI", nsysnet::export_NSSLSetClientPKI);
osLib_addFunction("nsysnet", "NSSLAddServerPKI", nsysnet::export_NSSLAddServerPKI);
osLib_addFunction("nsysnet", "NSSLAddServerPKIExternal", nsysnet::export_NSSLAddServerPKIExternal);
osLib_addFunction("nsysnet", "NSSLAddServerPKIGroups", nsysnet::export_NSSLAddServerPKIGroups);
osLib_addFunction("nsysnet", "NSSLDestroyContext", nsysnet::export_NSSLDestroyContext);
osLib_addFunction("nsysnet", "NSSLExportInternalServerCertificate", nsysnet::export_NSSLExportInternalServerCertificate);
osLib_addFunction("nsysnet", "NSSLExportInternalClientCertificate", nsysnet::export_NSSLExportInternalClientCertificate);
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nsysnet";
}
void RPLMapped() override
{
cafeExportRegister("nsysnet", inet_ntop, LogType::Socket);
// the below code is the old way of registering API which is deprecated
osLib_addFunction("nsysnet", "socket_lib_init", nsysnetExport_socket_lib_init);
osLib_addFunction("nsysnet", "socket_lib_finish", nsysnetExport_socket_lib_finish);
// socket API
osLib_addFunction("nsysnet", "socket", nsysnetExport_socket);
osLib_addFunction("nsysnet", "mw_socket", nsysnetExport_mw_socket);
osLib_addFunction("nsysnet", "shutdown", nsysnetExport_shutdown);
osLib_addFunction("nsysnet", "socketclose", nsysnetExport_socketclose);
osLib_addFunction("nsysnet", "setsockopt", nsysnetExport_setsockopt);
osLib_addFunction("nsysnet", "getsockopt", nsysnetExport_getsockopt);
osLib_addFunction("nsysnet", "bind", nsysnetExport_bind);
osLib_addFunction("nsysnet", "listen", nsysnetExport_listen);
osLib_addFunction("nsysnet", "accept", nsysnetExport_accept);
osLib_addFunction("nsysnet", "connect", nsysnetExport_connect);
osLib_addFunction("nsysnet", "send", nsysnetExport_send);
osLib_addFunction("nsysnet", "recv", nsysnetExport_recv);
osLib_addFunction("nsysnet", "select", nsysnetExport_select);
osLib_addFunction("nsysnet", "getsockname", nsysnetExport_getsockname);
osLib_addFunction("nsysnet", "getpeername", nsysnetExport_getpeername);
osLib_addFunction("nsysnet", "inet_aton", nsysnetExport_inet_aton);
osLib_addFunction("nsysnet", "inet_pton", nsysnetExport_inet_pton);
osLib_addFunction("nsysnet", "inet_ntoa", nsysnetExport_inet_ntoa);
osLib_addFunction("nsysnet", "htons", nsysnetExport_htons);
osLib_addFunction("nsysnet", "htonl", nsysnetExport_htonl);
osLib_addFunction("nsysnet", "ntohs", nsysnetExport_ntohs);
osLib_addFunction("nsysnet", "ntohl", nsysnetExport_ntohl);
osLib_addFunction("nsysnet", "gethostbyname", nsysnetExport_gethostbyname);
osLib_addFunction("nsysnet", "gethostbyaddr", nsysnetExport_gethostbyaddr);
osLib_addFunction("nsysnet", "getaddrinfo", nsysnetExport_getaddrinfo);
osLib_addFunction("nsysnet", "socketlasterr", nsysnetExport_socketlasterr);
// unfinished implementations
osLib_addFunction("nsysnet", "recvfrom", nsysnetExport_recvfrom);
osLib_addFunction("nsysnet", "recvfrom_ex", nsysnetExport_recvfrom_ex);
osLib_addFunction("nsysnet", "sendto", nsysnetExport_sendto);
osLib_addFunction("nsysnet", "sendto_multi", nsysnetExport_sendto_multi);
osLib_addFunction("nsysnet", "sendto_multi_ex", nsysnetExport_sendto_multi_ex);
// NSSL API
osLib_addFunction("nsysnet", "NSSLCreateContext", nsysnet::export_NSSLCreateContext);
osLib_addFunction("nsysnet", "NSSLSetClientPKI", nsysnet::export_NSSLSetClientPKI);
osLib_addFunction("nsysnet", "NSSLAddServerPKI", nsysnet::export_NSSLAddServerPKI);
osLib_addFunction("nsysnet", "NSSLAddServerPKIExternal", nsysnet::export_NSSLAddServerPKIExternal);
osLib_addFunction("nsysnet", "NSSLAddServerPKIGroups", nsysnet::export_NSSLAddServerPKIGroups);
osLib_addFunction("nsysnet", "NSSLDestroyContext", nsysnet::export_NSSLDestroyContext);
osLib_addFunction("nsysnet", "NSSLExportInternalServerCertificate", nsysnet::export_NSSLExportInternalServerCertificate);
osLib_addFunction("nsysnet", "NSSLExportInternalClientCertificate", nsysnet::export_NSSLExportInternalClientCertificate);
};
}s_COSnsysnetModule;
COSModule* GetModule()
{
return &s_COSnsysnetModule;
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include <set>
#include <vector>
#include "Cafe/OS/RPL/COSModule.h"
#if BOOST_OS_WINDOWS
#include <WinSock2.h>
@ -12,7 +13,6 @@
typedef signed int WUSOCKET;
void nsysnet_load();
WUSOCKET nsysnet_createVirtualSocketFromExistingSocket(SOCKET existingSocket);
void nsysnet_notifyCloseSharedSocket(SOCKET existingSocket);
@ -45,4 +45,6 @@ namespace nsysnet
void wuResetFD(struct wu_fd_set* fdset);
void wuSetFD(struct wu_fd_set* fdset, sint32 fd);
COSModule* GetModule();
}

View File

@ -630,18 +630,32 @@ namespace ntag
return NTAG_RESULT_INVALID;
}
void Initialize()
class : public COSModule
{
cafeExportRegister("ntag", NTAGInit, LogType::NTAG);
cafeExportRegister("ntag", NTAGInitEx, LogType::NTAG);
cafeExportRegister("ntag", NTAGShutdown, LogType::NTAG);
cafeExportRegister("ntag", NTAGIsInit, LogType::Placeholder); // disabled logging, since this gets spammed
cafeExportRegister("ntag", NTAGProc, LogType::Placeholder); // disabled logging, since this gets spammed
cafeExportRegister("ntag", NTAGSetFormatSettings, LogType::NTAG);
cafeExportRegister("ntag", NTAGSetTagDetectCallback, LogType::NTAG);
cafeExportRegister("ntag", NTAGAbort, LogType::NTAG);
cafeExportRegister("ntag", NTAGRead, LogType::NTAG);
cafeExportRegister("ntag", NTAGWrite, LogType::NTAG);
cafeExportRegister("ntag", NTAGFormat, LogType::NTAG);
public:
std::string_view GetName() override
{
return "ntag";
}
void RPLMapped() override
{
cafeExportRegister("ntag", NTAGInit, LogType::NTAG);
cafeExportRegister("ntag", NTAGInitEx, LogType::NTAG);
cafeExportRegister("ntag", NTAGShutdown, LogType::NTAG);
cafeExportRegister("ntag", NTAGIsInit, LogType::Placeholder); // disabled logging, since this gets spammed
cafeExportRegister("ntag", NTAGProc, LogType::Placeholder); // disabled logging, since this gets spammed
cafeExportRegister("ntag", NTAGSetFormatSettings, LogType::NTAG);
cafeExportRegister("ntag", NTAGSetTagDetectCallback, LogType::NTAG);
cafeExportRegister("ntag", NTAGAbort, LogType::NTAG);
cafeExportRegister("ntag", NTAGRead, LogType::NTAG);
cafeExportRegister("ntag", NTAGWrite, LogType::NTAG);
cafeExportRegister("ntag", NTAGFormat, LogType::NTAG);
};
}s_COSntagModule;
COSModule* GetModule()
{
return &s_COSntagModule;
}
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "Cafe/OS/libs/nfc/nfc.h"
#include "Cafe/OS/RPL/COSModule.h"
#define NTAG_RESULT_SUCCESS (0)
#define NTAG_RESULT_UNINITIALIZED (-0x3E7)
@ -97,5 +98,5 @@ namespace ntag
sint32 NTAGFormat(uint32 chan, uint32 timeout, nfc::NFCUid* uid, uint32 rwSize, void* rwData, MPTR callback, void* context);
void Initialize();
COSModule* GetModule();
}

View File

@ -766,45 +766,60 @@ namespace padscore
OSSetPeriodicAlarm(&g_padscore.alarm, start_tick, period_tick, handler);
}
void load()
class : public COSModule
{
cafeExportRegister("padscore", WPADIsMplsAttached, LogType::InputAPI);
cafeExportRegister("padscore", WPADGetAccGravityUnit, LogType::InputAPI);
public:
std::string_view GetName() override
{
return "padscore";
}
// wpad
//osLib_addFunction("padscore", "WPADInit", padscore::export_WPADInit);
void RPLMapped() override
{
cafeExportRegister("padscore", WPADIsMplsAttached, LogType::InputAPI);
cafeExportRegister("padscore", WPADGetAccGravityUnit, LogType::InputAPI);
// kpad
osLib_addFunction("padscore", "KPADSetMaxControllers", padscore::export_KPADSetMaxControllers);
osLib_addFunction("padscore", "KPADGetMaxControllers", padscore::export_KPADGetMaxControllers);
osLib_addFunction("padscore", "KPADEnableDPD", padscore::export_KPADEnableDPD);
osLib_addFunction("padscore", "KPADGetMplsWorkSize", padscore::export_KPADGetMplsWorkSize);
osLib_addFunction("padscore", "KPADInit", padscore::export_KPADInit);
osLib_addFunction("padscore", "KPADInitEx", padscore::export_KPADInitEx);
// wpad
//osLib_addFunction("padscore", "WPADInit", padscore::export_WPADInit);
osLib_addFunction("padscore", "KPADSetConnectCallback", padscoreExport_KPADSetConnectCallback);
osLib_addFunction("padscore", "KPADReadEx", padscoreExport_KPADReadEx);
osLib_addFunction("padscore", "KPADRead", padscoreExport_KPADRead);
osLib_addFunction("padscore", "KPADGetUnifiedWpadStatus", padscoreExport_KPADGetUnifiedWpadStatus);
osLib_addFunction("padscore", "KPADSetSamplingCallback", padscoreExport_KPADSetSamplingCallback);
osLib_addFunction("padscore", "KPADSetBtnRepeat", padscoreExport_KPADSetBtnRepeat);
// kpad
osLib_addFunction("padscore", "KPADSetMaxControllers", padscore::export_KPADSetMaxControllers);
osLib_addFunction("padscore", "KPADGetMaxControllers", padscore::export_KPADGetMaxControllers);
osLib_addFunction("padscore", "KPADEnableDPD", padscore::export_KPADEnableDPD);
osLib_addFunction("padscore", "KPADGetMplsWorkSize", padscore::export_KPADGetMplsWorkSize);
osLib_addFunction("padscore", "KPADInit", padscore::export_KPADInit);
osLib_addFunction("padscore", "KPADInitEx", padscore::export_KPADInitEx);
osLib_addFunction("padscore", "WPADGetBatteryLevel", padscoreExport_WPADGetBatteryLevel);
osLib_addFunction("padscore", "WPADControlMotor", padscoreExport_WPADControlMotor);
osLib_addFunction("padscore", "WPADIsMotorEnabled", padscoreExport_WPADIsMotorEnabled);
osLib_addFunction("padscore", "WPADGetStatus", padscoreExport_WPADGetStatus);
osLib_addFunction("padscore", "WPADProbe", padscoreExport_WPADProbe);
osLib_addFunction("padscore", "WPADGetInfoAsync", padscoreExport_WPADGetInfoAsync);
osLib_addFunction("padscore", "WPADGetInfo", padscoreExport_WPADGetInfo);
osLib_addFunction("padscore", "WPADSetConnectCallback", padscoreExport_KPADSetConnectCallback);
osLib_addFunction("padscore", "WPADSetDataFormat", padscoreExport_WPADSetDataFormat);
osLib_addFunction("padscore", "WPADGetDataFormat", padscoreExport_WPADGetDataFormat);
osLib_addFunction("padscore", "WPADRead", padscoreExport_WPADRead);
osLib_addFunction("padscore", "WPADSetExtensionCallback", padscoreExport_WPADSetExtensionCallback);
osLib_addFunction("padscore", "WPADSetSamplingCallback", padscoreExport_KPADSetSamplingCallback);
osLib_addFunction("padscore", "WPADControlDpd", padscoreExport_WPADControlDpd);
osLib_addFunction("padscore", "KPADSetConnectCallback", padscoreExport_KPADSetConnectCallback);
osLib_addFunction("padscore", "KPADReadEx", padscoreExport_KPADReadEx);
osLib_addFunction("padscore", "KPADRead", padscoreExport_KPADRead);
osLib_addFunction("padscore", "KPADGetUnifiedWpadStatus", padscoreExport_KPADGetUnifiedWpadStatus);
osLib_addFunction("padscore", "KPADSetSamplingCallback", padscoreExport_KPADSetSamplingCallback);
osLib_addFunction("padscore", "KPADSetBtnRepeat", padscoreExport_KPADSetBtnRepeat);
osLib_addFunction("padscore", "WPADSetCallbackByKPAD", padscore::export_WPADSetCallbackByKPAD);
osLib_addFunction("padscore", "WPADGetBatteryLevel", padscoreExport_WPADGetBatteryLevel);
osLib_addFunction("padscore", "WPADControlMotor", padscoreExport_WPADControlMotor);
osLib_addFunction("padscore", "WPADIsMotorEnabled", padscoreExport_WPADIsMotorEnabled);
osLib_addFunction("padscore", "WPADGetStatus", padscoreExport_WPADGetStatus);
osLib_addFunction("padscore", "WPADProbe", padscoreExport_WPADProbe);
osLib_addFunction("padscore", "WPADGetInfoAsync", padscoreExport_WPADGetInfoAsync);
osLib_addFunction("padscore", "WPADGetInfo", padscoreExport_WPADGetInfo);
osLib_addFunction("padscore", "WPADSetConnectCallback", padscoreExport_KPADSetConnectCallback);
osLib_addFunction("padscore", "WPADSetDataFormat", padscoreExport_WPADSetDataFormat);
osLib_addFunction("padscore", "WPADGetDataFormat", padscoreExport_WPADGetDataFormat);
osLib_addFunction("padscore", "WPADRead", padscoreExport_WPADRead);
osLib_addFunction("padscore", "WPADSetExtensionCallback", padscoreExport_WPADSetExtensionCallback);
osLib_addFunction("padscore", "WPADSetSamplingCallback", padscoreExport_KPADSetSamplingCallback);
osLib_addFunction("padscore", "WPADControlDpd", padscoreExport_WPADControlDpd);
osLib_addFunction("padscore", "WPADSetCallbackByKPAD", padscore::export_WPADSetCallbackByKPAD);
};
}s_COSCoreinitModule;
COSModule* GetModule()
{
return &s_COSCoreinitModule;
}
}

View File

@ -1,11 +1,12 @@
#pragma once
#include "util/math/vector3.h"
#include "Cafe/OS/RPL/COSModule.h"
namespace padscore
{
void start();
void load();
COSModule* GetModule();
}
constexpr int kWPADMaxControllers = 4;

View File

@ -808,42 +808,6 @@ namespace proc_ui
OSMemoryBarrier();
}
sint32 rpl_entry(uint32 moduleHandle, RplEntryReason reason)
{
if ( reason == RplEntryReason::Loaded )
{
s_ProcUIDriver->getDriverName = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {MEMPTR<const char> namePtr(ProcUIDriver_GetName()); osLib_returnFromFunction(hCPU, namePtr.GetMPTR()); });
s_ProcUIDriver->init = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_Init(); osLib_returnFromFunction(hCPU, 0); });
s_ProcUIDriver->onAcquireForeground = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_OnAcquiredForeground(); osLib_returnFromFunction(hCPU, 0); });
s_ProcUIDriver->onReleaseForeground = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_OnReleaseForeground(); osLib_returnFromFunction(hCPU, 0); });
s_ProcUIDriver->done = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_OnDone(); osLib_returnFromFunction(hCPU, 0); });
s_driverIsActive = false;
s_driverArgUkn1 = 0;
s_driverArgUkn2 = 0;
s_driverInBackground = false;
uint32be ukn3;
OSDriver_Register(moduleHandle, 200, &s_ProcUIDriver, 0, &s_driverArgUkn1, &s_driverArgUkn2, &ukn3);
if ( ukn3 )
{
if ( OSGetForegroundBucket(nullptr, nullptr) )
{
ProcUIDriver_Init();
OSMemoryBarrier();
return 0;
}
s_driverInBackground = true;
}
OSMemoryBarrier();
}
else if ( reason == RplEntryReason::Unloaded )
{
ProcUIDriver_OnDone();
OSDriver_Deregister(moduleHandle, 0);
}
return 0;
}
void reset()
{
// set variables to their initial state as if the RPL was just loaded
@ -877,32 +841,84 @@ namespace proc_ui
void load()
{
reset();
cafeExportRegister("proc_ui", ProcUIInit, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIInitEx, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIShutdown, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIIsRunning, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIInForeground, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIInShutdown, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIRegisterCallbackCore, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIRegisterCallback, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIRegisterBackgroundCallback, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIClearCallbacks, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetSaveCallback, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetCallbackStackSize, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUICalcMemorySize, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetMemoryPool, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetBucketStorage, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetMEM1Storage, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIDrawDoneRelease, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIProcessMessages, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISubProcessMessages, LogType::ProcUi);
// manually call rpl_entry for now
rpl_entry(-1, RplEntryReason::Loaded);
}
class : public COSModule
{
public:
std::string_view GetName() override
{
return "proc_ui";
}
void RPLMapped() override
{
reset();
cafeExportRegister("proc_ui", ProcUIInit, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIInitEx, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIShutdown, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIIsRunning, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIInForeground, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIInShutdown, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIRegisterCallbackCore, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIRegisterCallback, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIRegisterBackgroundCallback, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIClearCallbacks, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetSaveCallback, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetCallbackStackSize, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUICalcMemorySize, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetMemoryPool, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetBucketStorage, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISetMEM1Storage, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIDrawDoneRelease, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUIProcessMessages, LogType::ProcUi);
cafeExportRegister("proc_ui", ProcUISubProcessMessages, LogType::ProcUi);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if ( reason == RplEntryReason::Loaded )
{
s_ProcUIDriver->getDriverName = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {MEMPTR<const char> namePtr(ProcUIDriver_GetName()); osLib_returnFromFunction(hCPU, namePtr.GetMPTR()); });
s_ProcUIDriver->init = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_Init(); osLib_returnFromFunction(hCPU, 0); });
s_ProcUIDriver->onAcquireForeground = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_OnAcquiredForeground(); osLib_returnFromFunction(hCPU, 0); });
s_ProcUIDriver->onReleaseForeground = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_OnReleaseForeground(); osLib_returnFromFunction(hCPU, 0); });
s_ProcUIDriver->done = RPLLoader_MakePPCCallable([](PPCInterpreter_t* hCPU) {ProcUIDriver_OnDone(); osLib_returnFromFunction(hCPU, 0); });
s_driverIsActive = false;
s_driverArgUkn1 = 0;
s_driverArgUkn2 = 0;
s_driverInBackground = false;
uint32be ukn3;
OSDriver_Register(moduleHandle, 200, &s_ProcUIDriver, 0, &s_driverArgUkn1, &s_driverArgUkn2, &ukn3);
if ( ukn3 )
{
if ( OSGetForegroundBucket(nullptr, nullptr) )
{
ProcUIDriver_Init();
OSMemoryBarrier();
return;
}
s_driverInBackground = true;
}
OSMemoryBarrier();
}
else if ( reason == RplEntryReason::Unloaded )
{
ProcUIDriver_OnDone();
OSDriver_Deregister(moduleHandle, 0);
}
}
}s_COSprocuiModule;
COSModule* GetModule()
{
return &s_COSprocuiModule;
}
};

View File

@ -1,3 +1,4 @@
#include "Cafe/OS/RPL/COSModule.h"
namespace proc_ui
{
@ -40,5 +41,5 @@ namespace proc_ui
ProcUIStatus ProcUIProcessMessages(bool isBlockingInBackground);
ProcUIStatus ProcUISubProcessMessages(bool isBlockingInBackground);
void load();
COSModule* GetModule();
}

View File

@ -1,7 +1,7 @@
#pragma once
#include "Cafe/OS/libs/coreinit/coreinit.h" // for OSThread*
#include "util/helpers/fspinlock.h"
#include "Cafe/OS/RPL/COSModule.h"
struct PPCInterpreter_t;
@ -77,7 +77,6 @@ namespace snd_core
const int AX_FILTER_LOWPASS_12K = 0x1;
const int AX_FILTER_LOWPASS_16K = 0x2;
void loadExports();
bool isInitialized();
void reset();
@ -241,8 +240,10 @@ namespace snd_core
void AXSetVoiceBiquad(AXVPB* vpb, AXPBBIQUAD_t* biquad);
void AXSetVoiceBiquadCoefs(AXVPB* vpb, uint16 b0, uint16 b1, uint16 b2, uint16 a1, uint16 a2);
void AXSetVoiceOffsets(AXVPB* vpb, AXPBOFFSET_t* pbOffset);
void AXSetVoiceOffsetsEx(AXVPB* vpb, AXPBOFFSET_t* pbOffset, void* sampleBase);
void AXGetVoiceOffsets(AXVPB* vpb, AXPBOFFSET_t* pbOffset);
void AXGetVoiceOffsetsEx(AXVPB* vpb, AXPBOFFSET_t* pbOffset, MPTR sampleBase);
void AXSetVoiceSamplesAddr(AXVPB* vpb, void* sampleBase);
void AXSetVoiceCurrentOffset(AXVPB* vpb, uint32 currentOffset);
void AXSetVoiceLoopOffset(AXVPB* vpb, uint32 loopOffset);
void AXSetVoiceEndOffset(AXVPB* vpb, uint32 endOffset);
@ -251,6 +252,7 @@ namespace snd_core
void AXSetVoiceEndOffsetEx(AXVPB* vpb, uint32 endOffset, MPTR sampleBase);
uint32 AXGetVoiceCurrentOffsetEx(AXVPB* vpb, MPTR sampleBase);
void AXSetVoiceLoop(AXVPB* vpb, uint16 loopState);
sint32 AXGetVoiceLoopCount(AXVPB* vpb);
// AXIst
@ -389,5 +391,6 @@ namespace snd_core
void AXOut_reset();
void AXOut_update();
void Initialize();
COSModule* GetModuleSndCore1();
COSModule* GetModuleSndCore2();
}

View File

@ -3,6 +3,7 @@
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
#include "Cafe/OS/common/OSCommon.h"
#include "Cafe/OS/libs/coreinit/coreinit_MessageQueue.h"
#include "OS/libs/coreinit/coreinit_DynLoad.h"
namespace snd_core
{
@ -10,7 +11,7 @@ namespace snd_core
void AXResetToDefaultState()
{
memset(&sndGeneric, 0x00, sizeof(sndGeneric));
sndGeneric = {};
resetNumProcessedFrames();
AXVBP_Reset();
}
@ -378,133 +379,133 @@ namespace snd_core
return 0;
}
void loadExportsSndCore1()
{
cafeExportRegisterFunc(sndcore1_AXInit, "snd_core", "AXInit", LogType::SoundAPI);
cafeExportRegisterFunc(sndcore1_AXInitEx, "snd_core", "AXInitEx", LogType::SoundAPI);
cafeExportRegister("snd_core", AXIsInit, LogType::SoundAPI);
cafeExportRegister("snd_core", AXQuit, LogType::SoundAPI);
// void loadExportsSndCore1()
// {
// cafeExportRegisterFunc(sndcore1_AXInit, "snd_core", "AXInit", LogType::SoundAPI);
// cafeExportRegisterFunc(sndcore1_AXInitEx, "snd_core", "AXInitEx", LogType::SoundAPI);
// cafeExportRegister("snd_core", AXIsInit, LogType::SoundAPI);
// cafeExportRegister("snd_core", AXQuit, LogType::SoundAPI);
//
// cafeExportRegister("snd_core", AXGetMaxVoices, LogType::SoundAPI);
// cafeExportRegister("snd_core", AXGetInputSamplesPerFrame, LogType::SoundAPI);
// cafeExportRegister("snd_core", AXGetInputSamplesPerSec, LogType::SoundAPI);
// cafeExportRegister("snd_core", AXSetDefaultMixerSelect, LogType::SoundAPI);
// cafeExportRegister("snd_core", AXGetDefaultMixerSelect, LogType::SoundAPI);
//
// osLib_addFunction("snd_core", "AXGetDeviceFinalMixCallback", export_AXGetDeviceFinalMixCallback);
// osLib_addFunction("snd_core", "AXRegisterDeviceFinalMixCallback", export_AXRegisterDeviceFinalMixCallback);
//
// osLib_addFunction("snd_core", "AXRegisterAppFrameCallback", export_AXRegisterAppFrameCallback);
// osLib_addFunction("snd_core", "AXDeregisterAppFrameCallback", export_AXDeregisterAppFrameCallback);
//
// osLib_addFunction("snd_core", "AXRegisterFrameCallback", export_AXRegisterFrameCallback);
// osLib_addFunction("snd_core", "AXRegisterCallback", export_AXRegisterCallback);
//
// osLib_addFunction("snd_core", "AXRegisterAuxCallback", export_AXRegisterAuxCallback);
// osLib_addFunction("snd_core", "AXGetAuxCallback", export_AXGetAuxCallback);
//
// osLib_addFunction("snd_core", "AXSetAuxReturnVolume", export_AXSetAuxReturnVolume);
//
// osLib_addFunction("snd_core", "AXGetDeviceMode", export_AXGetDeviceMode);
//
// osLib_addFunction("snd_core", "AXSetDeviceUpsampleStage", export_AXSetDeviceUpsampleStage);
// osLib_addFunction("snd_core", "AXGetDeviceUpsampleStage", export_AXGetDeviceUpsampleStage);
//
// osLib_addFunction("snd_core", "AXAcquireVoiceEx", export_AXAcquireVoiceEx);
// osLib_addFunction("snd_core", "AXAcquireVoice", export_AXAcquireVoice);
// osLib_addFunction("snd_core", "AXFreeVoice", export_AXFreeVoice);
//
// osLib_addFunction("snd_core", "AXUserIsProtected", export_AXUserIsProtected);
// osLib_addFunction("snd_core", "AXUserBegin", export_AXUserBegin);
// osLib_addFunction("snd_core", "AXUserEnd", export_AXUserEnd);
// osLib_addFunction("snd_core", "AXVoiceBegin", export_AXVoiceBegin);
// osLib_addFunction("snd_core", "AXVoiceEnd", export_AXVoiceEnd);
// osLib_addFunction("snd_core", "AXVoiceIsProtected", export_AXVoiceIsProtected);
//
// osLib_addFunction("snd_core", "AXCheckVoiceOffsets", export_AXCheckVoiceOffsets);
//
// osLib_addFunction("snd_core", "AXSetDeviceRemixMatrix", export_AXSetDeviceRemixMatrix);
// osLib_addFunction("snd_core", "AXGetDeviceRemixMatrix", export_AXGetDeviceRemixMatrix);
//
// cafeExportRegister("snd_core", AXGetDeviceFinalOutput, LogType::SoundAPI);
// }
//
// void loadExportsSndCore2()
// {
// cafeExportRegisterFunc(sndcore2_AXInitWithParams, "sndcore2", "AXInitWithParams", LogType::SoundAPI);
// cafeExportRegisterFunc(sndcore2_AXInit, "sndcore2", "AXInit", LogType::SoundAPI);
// cafeExportRegisterFunc(sndcore2_AXInitEx, "sndcore2", "AXInitEx", LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXIsInit, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXQuit, LogType::SoundAPI);
//
// cafeExportRegister("sndcore2", AXGetMaxVoices, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXGetInputSamplesPerFrame, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXGetInputSamplesPerSec, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetDefaultMixerSelect, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXGetDefaultMixerSelect, LogType::SoundAPI);
//
// osLib_addFunction("sndcore2", "AXGetDeviceFinalMixCallback", export_AXGetDeviceFinalMixCallback);
// osLib_addFunction("sndcore2", "AXRegisterDeviceFinalMixCallback", export_AXRegisterDeviceFinalMixCallback);
//
// osLib_addFunction("sndcore2", "AXRegisterAppFrameCallback", export_AXRegisterAppFrameCallback);
// osLib_addFunction("sndcore2", "AXDeregisterAppFrameCallback", export_AXDeregisterAppFrameCallback);
//
// osLib_addFunction("sndcore2", "AXRegisterFrameCallback", export_AXRegisterFrameCallback);
// osLib_addFunction("sndcore2", "AXRegisterCallback", export_AXRegisterCallback);
//
// osLib_addFunction("sndcore2", "AXRegisterAuxCallback", export_AXRegisterAuxCallback);
// osLib_addFunction("sndcore2", "AXGetAuxCallback", export_AXGetAuxCallback);
//
// osLib_addFunction("sndcore2", "AXSetAuxReturnVolume", export_AXSetAuxReturnVolume);
//
// osLib_addFunction("sndcore2", "AXGetDeviceMode", export_AXGetDeviceMode);
//
// osLib_addFunction("sndcore2", "AXSetDeviceUpsampleStage", export_AXSetDeviceUpsampleStage);
// osLib_addFunction("sndcore2", "AXGetDeviceUpsampleStage", export_AXGetDeviceUpsampleStage);
//
// osLib_addFunction("sndcore2", "AXAcquireVoiceEx", export_AXAcquireVoiceEx);
// osLib_addFunction("sndcore2", "AXAcquireVoice", export_AXAcquireVoice);
// osLib_addFunction("sndcore2", "AXFreeVoice", export_AXFreeVoice);
//
// osLib_addFunction("sndcore2", "AXUserIsProtected", export_AXUserIsProtected);
// osLib_addFunction("sndcore2", "AXUserBegin", export_AXUserBegin);
// osLib_addFunction("sndcore2", "AXUserEnd", export_AXUserEnd);
// osLib_addFunction("sndcore2", "AXVoiceBegin", export_AXVoiceBegin);
// osLib_addFunction("sndcore2", "AXVoiceEnd", export_AXVoiceEnd);
//
// osLib_addFunction("sndcore2", "AXVoiceIsProtected", export_AXVoiceIsProtected);
//
// osLib_addFunction("sndcore2", "AXCheckVoiceOffsets", export_AXCheckVoiceOffsets);
//
// osLib_addFunction("sndcore2", "AXSetDeviceRemixMatrix", export_AXSetDeviceRemixMatrix);
// osLib_addFunction("sndcore2", "AXGetDeviceRemixMatrix", export_AXGetDeviceRemixMatrix);
//
// cafeExportRegister("sndcore2", AXGetDeviceFinalOutput, LogType::SoundAPI);
//
// // multi voice
// cafeExportRegister("sndcore2", AXAcquireMultiVoice, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXFreeMultiVoice, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXGetMultiVoiceReformatBufferSize, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceType, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceAdpcm, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceSrcType, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceOffsets, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceVe, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceSrcRatio, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceSrc, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceLoop, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceState, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXSetMultiVoiceAdpcmLoop, LogType::SoundAPI);
// cafeExportRegister("sndcore2", AXIsMultiVoiceRunning, LogType::SoundAPI);
// }
cafeExportRegister("snd_core", AXGetMaxVoices, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetInputSamplesPerFrame, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetInputSamplesPerSec, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetDefaultMixerSelect, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetDefaultMixerSelect, LogType::SoundAPI);
osLib_addFunction("snd_core", "AXGetDeviceFinalMixCallback", export_AXGetDeviceFinalMixCallback);
osLib_addFunction("snd_core", "AXRegisterDeviceFinalMixCallback", export_AXRegisterDeviceFinalMixCallback);
osLib_addFunction("snd_core", "AXRegisterAppFrameCallback", export_AXRegisterAppFrameCallback);
osLib_addFunction("snd_core", "AXDeregisterAppFrameCallback", export_AXDeregisterAppFrameCallback);
osLib_addFunction("snd_core", "AXRegisterFrameCallback", export_AXRegisterFrameCallback);
osLib_addFunction("snd_core", "AXRegisterCallback", export_AXRegisterCallback);
osLib_addFunction("snd_core", "AXRegisterAuxCallback", export_AXRegisterAuxCallback);
osLib_addFunction("snd_core", "AXGetAuxCallback", export_AXGetAuxCallback);
osLib_addFunction("snd_core", "AXSetAuxReturnVolume", export_AXSetAuxReturnVolume);
osLib_addFunction("snd_core", "AXGetDeviceMode", export_AXGetDeviceMode);
osLib_addFunction("snd_core", "AXSetDeviceUpsampleStage", export_AXSetDeviceUpsampleStage);
osLib_addFunction("snd_core", "AXGetDeviceUpsampleStage", export_AXGetDeviceUpsampleStage);
osLib_addFunction("snd_core", "AXAcquireVoiceEx", export_AXAcquireVoiceEx);
osLib_addFunction("snd_core", "AXAcquireVoice", export_AXAcquireVoice);
osLib_addFunction("snd_core", "AXFreeVoice", export_AXFreeVoice);
osLib_addFunction("snd_core", "AXUserIsProtected", export_AXUserIsProtected);
osLib_addFunction("snd_core", "AXUserBegin", export_AXUserBegin);
osLib_addFunction("snd_core", "AXUserEnd", export_AXUserEnd);
osLib_addFunction("snd_core", "AXVoiceBegin", export_AXVoiceBegin);
osLib_addFunction("snd_core", "AXVoiceEnd", export_AXVoiceEnd);
osLib_addFunction("snd_core", "AXVoiceIsProtected", export_AXVoiceIsProtected);
osLib_addFunction("snd_core", "AXCheckVoiceOffsets", export_AXCheckVoiceOffsets);
osLib_addFunction("snd_core", "AXSetDeviceRemixMatrix", export_AXSetDeviceRemixMatrix);
osLib_addFunction("snd_core", "AXGetDeviceRemixMatrix", export_AXGetDeviceRemixMatrix);
cafeExportRegister("snd_core", AXGetDeviceFinalOutput, LogType::SoundAPI);
}
void loadExportsSndCore2()
{
cafeExportRegisterFunc(sndcore2_AXInitWithParams, "sndcore2", "AXInitWithParams", LogType::SoundAPI);
cafeExportRegisterFunc(sndcore2_AXInit, "sndcore2", "AXInit", LogType::SoundAPI);
cafeExportRegisterFunc(sndcore2_AXInitEx, "sndcore2", "AXInitEx", LogType::SoundAPI);
cafeExportRegister("sndcore2", AXIsInit, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXQuit, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetMaxVoices, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetInputSamplesPerFrame, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetInputSamplesPerSec, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetDefaultMixerSelect, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetDefaultMixerSelect, LogType::SoundAPI);
osLib_addFunction("sndcore2", "AXGetDeviceFinalMixCallback", export_AXGetDeviceFinalMixCallback);
osLib_addFunction("sndcore2", "AXRegisterDeviceFinalMixCallback", export_AXRegisterDeviceFinalMixCallback);
osLib_addFunction("sndcore2", "AXRegisterAppFrameCallback", export_AXRegisterAppFrameCallback);
osLib_addFunction("sndcore2", "AXDeregisterAppFrameCallback", export_AXDeregisterAppFrameCallback);
osLib_addFunction("sndcore2", "AXRegisterFrameCallback", export_AXRegisterFrameCallback);
osLib_addFunction("sndcore2", "AXRegisterCallback", export_AXRegisterCallback);
osLib_addFunction("sndcore2", "AXRegisterAuxCallback", export_AXRegisterAuxCallback);
osLib_addFunction("sndcore2", "AXGetAuxCallback", export_AXGetAuxCallback);
osLib_addFunction("sndcore2", "AXSetAuxReturnVolume", export_AXSetAuxReturnVolume);
osLib_addFunction("sndcore2", "AXGetDeviceMode", export_AXGetDeviceMode);
osLib_addFunction("sndcore2", "AXSetDeviceUpsampleStage", export_AXSetDeviceUpsampleStage);
osLib_addFunction("sndcore2", "AXGetDeviceUpsampleStage", export_AXGetDeviceUpsampleStage);
osLib_addFunction("sndcore2", "AXAcquireVoiceEx", export_AXAcquireVoiceEx);
osLib_addFunction("sndcore2", "AXAcquireVoice", export_AXAcquireVoice);
osLib_addFunction("sndcore2", "AXFreeVoice", export_AXFreeVoice);
osLib_addFunction("sndcore2", "AXUserIsProtected", export_AXUserIsProtected);
osLib_addFunction("sndcore2", "AXUserBegin", export_AXUserBegin);
osLib_addFunction("sndcore2", "AXUserEnd", export_AXUserEnd);
osLib_addFunction("sndcore2", "AXVoiceBegin", export_AXVoiceBegin);
osLib_addFunction("sndcore2", "AXVoiceEnd", export_AXVoiceEnd);
osLib_addFunction("sndcore2", "AXVoiceIsProtected", export_AXVoiceIsProtected);
osLib_addFunction("sndcore2", "AXCheckVoiceOffsets", export_AXCheckVoiceOffsets);
osLib_addFunction("sndcore2", "AXSetDeviceRemixMatrix", export_AXSetDeviceRemixMatrix);
osLib_addFunction("sndcore2", "AXGetDeviceRemixMatrix", export_AXGetDeviceRemixMatrix);
cafeExportRegister("sndcore2", AXGetDeviceFinalOutput, LogType::SoundAPI);
// multi voice
cafeExportRegister("sndcore2", AXAcquireMultiVoice, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXFreeMultiVoice, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetMultiVoiceReformatBufferSize, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceAdpcm, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceSrcType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceVe, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceSrcRatio, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceSrc, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceState, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceAdpcmLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXIsMultiVoiceRunning, LogType::SoundAPI);
}
void loadExports()
{
AXResetToDefaultState();
loadExportsSndCore1();
loadExportsSndCore2();
}
// void loadExports()
// {
// AXResetToDefaultState();
//
// loadExportsSndCore1();
// loadExportsSndCore2();
// }
bool isInitialized()
{
@ -518,4 +519,248 @@ namespace snd_core
sndGeneric.isInitialized = false;
}
void RegisterVoiceFunctions()
{
// snd_core
cafeExportRegister("snd_core", AXSetVoiceDeviceMix, LogType::SoundAPI);
cafeExportRegister("snd_core", AXComputeLpfCoefs, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceState, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceType, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceAdpcmLoop, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSrc, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSrcType, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSrcRatio, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceVe, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceAdpcm, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLoop, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLpf, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLpfCoefs, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceBiquad, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceBiquadCoefs, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceOffsetsEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceCurrentOffset, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceCurrentOffsetEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLoopOffset, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLoopOffsetEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceEndOffset, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceEndOffsetEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSamplesAddr, LogType::SoundAPI);
cafeExportRegister("snd_core", AXIsVoiceRunning, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetVoiceLoopCount, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetVoiceCurrentOffsetEx, LogType::SoundAPI);
// sndcore2
cafeExportRegister("sndcore2", AXSetVoiceDeviceMix, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXComputeLpfCoefs, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceState, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceAdpcmLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSrc, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSrcType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSrcRatio, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceVe, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceAdpcm, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLpf, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLpfCoefs, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceBiquad, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceBiquadCoefs, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceOffsetsEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceCurrentOffset, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceCurrentOffsetEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLoopOffset, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLoopOffsetEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceEndOffset, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceEndOffsetEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSamplesAddr, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXIsVoiceRunning, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetVoiceLoopCount, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetVoiceCurrentOffsetEx, LogType::SoundAPI);
}
class : public COSModule
{
public:
std::string_view GetName() override
{
return "snd_core";
}
void RPLMapped() override
{
AXResetToDefaultState();
cafeExportRegisterFunc(sndcore1_AXInit, "snd_core", "AXInit", LogType::SoundAPI);
cafeExportRegisterFunc(sndcore1_AXInitEx, "snd_core", "AXInitEx", LogType::SoundAPI);
cafeExportRegister("snd_core", AXIsInit, LogType::SoundAPI);
cafeExportRegister("snd_core", AXQuit, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetMaxVoices, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetInputSamplesPerFrame, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetInputSamplesPerSec, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetDefaultMixerSelect, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetDefaultMixerSelect, LogType::SoundAPI);
osLib_addFunction("snd_core", "AXGetDeviceFinalMixCallback", export_AXGetDeviceFinalMixCallback);
osLib_addFunction("snd_core", "AXRegisterDeviceFinalMixCallback", export_AXRegisterDeviceFinalMixCallback);
osLib_addFunction("snd_core", "AXRegisterAppFrameCallback", export_AXRegisterAppFrameCallback);
osLib_addFunction("snd_core", "AXDeregisterAppFrameCallback", export_AXDeregisterAppFrameCallback);
osLib_addFunction("snd_core", "AXRegisterFrameCallback", export_AXRegisterFrameCallback);
osLib_addFunction("snd_core", "AXRegisterCallback", export_AXRegisterCallback);
osLib_addFunction("snd_core", "AXRegisterAuxCallback", export_AXRegisterAuxCallback);
osLib_addFunction("snd_core", "AXGetAuxCallback", export_AXGetAuxCallback);
osLib_addFunction("snd_core", "AXSetAuxReturnVolume", export_AXSetAuxReturnVolume);
osLib_addFunction("snd_core", "AXGetDeviceMode", export_AXGetDeviceMode);
osLib_addFunction("snd_core", "AXSetDeviceUpsampleStage", export_AXSetDeviceUpsampleStage);
osLib_addFunction("snd_core", "AXGetDeviceUpsampleStage", export_AXGetDeviceUpsampleStage);
osLib_addFunction("snd_core", "AXAcquireVoiceEx", export_AXAcquireVoiceEx);
osLib_addFunction("snd_core", "AXAcquireVoice", export_AXAcquireVoice);
osLib_addFunction("snd_core", "AXFreeVoice", export_AXFreeVoice);
osLib_addFunction("snd_core", "AXUserIsProtected", export_AXUserIsProtected);
osLib_addFunction("snd_core", "AXUserBegin", export_AXUserBegin);
osLib_addFunction("snd_core", "AXUserEnd", export_AXUserEnd);
osLib_addFunction("snd_core", "AXVoiceBegin", export_AXVoiceBegin);
osLib_addFunction("snd_core", "AXVoiceEnd", export_AXVoiceEnd);
osLib_addFunction("snd_core", "AXVoiceIsProtected", export_AXVoiceIsProtected);
osLib_addFunction("snd_core", "AXCheckVoiceOffsets", export_AXCheckVoiceOffsets);
osLib_addFunction("snd_core", "AXSetDeviceRemixMatrix", export_AXSetDeviceRemixMatrix);
osLib_addFunction("snd_core", "AXGetDeviceRemixMatrix", export_AXGetDeviceRemixMatrix);
cafeExportRegister("snd_core", AXGetDeviceFinalOutput, LogType::SoundAPI);
RegisterVoiceFunctions();
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
AXResetToDefaultState();
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
AXResetToDefaultState();
}
}
}s_COSsndcore1Module;
class : public COSModule
{
public:
std::string_view GetName() override
{
return "sndcore2";
}
void RPLMapped() override
{
cafeExportRegisterFunc(sndcore2_AXInitWithParams, "sndcore2", "AXInitWithParams", LogType::SoundAPI);
cafeExportRegisterFunc(sndcore2_AXInit, "sndcore2", "AXInit", LogType::SoundAPI);
cafeExportRegisterFunc(sndcore2_AXInitEx, "sndcore2", "AXInitEx", LogType::SoundAPI);
cafeExportRegister("sndcore2", AXIsInit, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXQuit, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetMaxVoices, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetInputSamplesPerFrame, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetInputSamplesPerSec, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetDefaultMixerSelect, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetDefaultMixerSelect, LogType::SoundAPI);
osLib_addFunction("sndcore2", "AXGetDeviceFinalMixCallback", export_AXGetDeviceFinalMixCallback);
osLib_addFunction("sndcore2", "AXRegisterDeviceFinalMixCallback", export_AXRegisterDeviceFinalMixCallback);
osLib_addFunction("sndcore2", "AXRegisterAppFrameCallback", export_AXRegisterAppFrameCallback);
osLib_addFunction("sndcore2", "AXDeregisterAppFrameCallback", export_AXDeregisterAppFrameCallback);
osLib_addFunction("sndcore2", "AXRegisterFrameCallback", export_AXRegisterFrameCallback);
osLib_addFunction("sndcore2", "AXRegisterCallback", export_AXRegisterCallback);
osLib_addFunction("sndcore2", "AXRegisterAuxCallback", export_AXRegisterAuxCallback);
osLib_addFunction("sndcore2", "AXGetAuxCallback", export_AXGetAuxCallback);
osLib_addFunction("sndcore2", "AXSetAuxReturnVolume", export_AXSetAuxReturnVolume);
osLib_addFunction("sndcore2", "AXGetDeviceMode", export_AXGetDeviceMode);
osLib_addFunction("sndcore2", "AXSetDeviceUpsampleStage", export_AXSetDeviceUpsampleStage);
osLib_addFunction("sndcore2", "AXGetDeviceUpsampleStage", export_AXGetDeviceUpsampleStage);
osLib_addFunction("sndcore2", "AXAcquireVoiceEx", export_AXAcquireVoiceEx);
osLib_addFunction("sndcore2", "AXAcquireVoice", export_AXAcquireVoice);
osLib_addFunction("sndcore2", "AXFreeVoice", export_AXFreeVoice);
osLib_addFunction("sndcore2", "AXUserIsProtected", export_AXUserIsProtected);
osLib_addFunction("sndcore2", "AXUserBegin", export_AXUserBegin);
osLib_addFunction("sndcore2", "AXUserEnd", export_AXUserEnd);
osLib_addFunction("sndcore2", "AXVoiceBegin", export_AXVoiceBegin);
osLib_addFunction("sndcore2", "AXVoiceEnd", export_AXVoiceEnd);
osLib_addFunction("sndcore2", "AXVoiceIsProtected", export_AXVoiceIsProtected);
osLib_addFunction("sndcore2", "AXCheckVoiceOffsets", export_AXCheckVoiceOffsets);
osLib_addFunction("sndcore2", "AXSetDeviceRemixMatrix", export_AXSetDeviceRemixMatrix);
osLib_addFunction("sndcore2", "AXGetDeviceRemixMatrix", export_AXGetDeviceRemixMatrix);
cafeExportRegister("sndcore2", AXGetDeviceFinalOutput, LogType::SoundAPI);
// multi voice
cafeExportRegister("sndcore2", AXAcquireMultiVoice, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXFreeMultiVoice, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetMultiVoiceReformatBufferSize, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceAdpcm, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceSrcType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceVe, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceSrcRatio, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceSrc, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceState, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetMultiVoiceAdpcmLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXIsMultiVoiceRunning, LogType::SoundAPI);
RegisterVoiceFunctions();
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
AXResetToDefaultState();
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
AXResetToDefaultState();
}
}
}s_COSsndcore2Module;
COSModule* GetModuleSndCore1()
{
return &s_COSsndcore1Module;
}
COSModule* GetModuleSndCore2()
{
return &s_COSsndcore2Module;
}
}

View File

@ -3,18 +3,18 @@
namespace snd_core
{
typedef struct
struct sndGeneric_t
{
bool isInitialized;
bool isSoundCore2;
bool isInitialized{false};
bool isSoundCore2{false};
// init params
struct
{
uint32 rendererFreq; // 32Khz or 48Khz
uint32 frameLength; // 3MS
uint32 pipelineMode;
uint32 rendererFreq{0}; // 32Khz or 48Khz
uint32 frameLength{0}; // 3MS
uint32 pipelineMode{0};
}initParam;
}sndGeneric_t;
};
extern sndGeneric_t sndGeneric;

View File

@ -3,6 +3,7 @@
#include "Cafe/HW/Espresso/PPCState.h"
#include "Cafe/HW/Espresso/PPCCallback.h"
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
#include "Cafe/OS/libs/coreinit/coreinit_MessageQueue.h"
namespace snd_core
{

View File

@ -1227,71 +1227,4 @@ namespace snd_core
vpbLoopTracker_prevCurrentOffset[voiceIndex] = currentOffset;
return vpbLoopTracker_loopCount[voiceIndex];
}
void Initialize()
{
// snd_core
cafeExportRegister("snd_core", AXSetVoiceDeviceMix, LogType::SoundAPI);
cafeExportRegister("snd_core", AXComputeLpfCoefs, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceState, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceType, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceAdpcmLoop, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSrc, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSrcType, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSrcRatio, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceVe, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceAdpcm, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLoop, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLpf, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLpfCoefs, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceBiquad, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceBiquadCoefs, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceOffsetsEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceCurrentOffset, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceCurrentOffsetEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLoopOffset, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceLoopOffsetEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceEndOffset, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceEndOffsetEx, LogType::SoundAPI);
cafeExportRegister("snd_core", AXSetVoiceSamplesAddr, LogType::SoundAPI);
cafeExportRegister("snd_core", AXIsVoiceRunning, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetVoiceLoopCount, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("snd_core", AXGetVoiceCurrentOffsetEx, LogType::SoundAPI);
// sndcore2
cafeExportRegister("sndcore2", AXSetVoiceDeviceMix, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXComputeLpfCoefs, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceState, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceAdpcmLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSrc, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSrcType, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSrcRatio, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceVe, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceAdpcm, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLoop, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLpf, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLpfCoefs, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceBiquad, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceBiquadCoefs, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceOffsetsEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceCurrentOffset, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceCurrentOffsetEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLoopOffset, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceLoopOffsetEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceEndOffset, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceEndOffsetEx, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXSetVoiceSamplesAddr, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXIsVoiceRunning, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetVoiceLoopCount, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetVoiceOffsets, LogType::SoundAPI);
cafeExportRegister("sndcore2", AXGetVoiceCurrentOffsetEx, LogType::SoundAPI);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,24 @@
#pragma once
#include "Cafe/OS/libs/snd_core/ax.h"
#include "Cafe/OS/RPL/COSModule.h"
namespace snd
namespace snd_user
{
namespace user
{
struct MixControl;
struct MixControl;
void MIXInit();
void MIXInitInputControl(snd_core::AXVPB* voice, uint16 input, uint32 mode);
void MIXInitDeviceControl(snd_core::AXVPB* voice, uint32 device_type, uint32 index, MixControl* control, uint32 mode);
void MIXSetDeviceSoundMode(uint32 device, uint32 mode);
void MIXUpdateSettings();
void MIXSetInput(snd_core::AXVPB* voice, uint16 input);
void MIXDRCInitChannel(snd_core::AXVPB* voice, uint16 mode, uint16 vol1, uint16 vol2, uint16 vol3);
void MIXAssignChannel(snd_core::AXVPB* voice);
void MIXInitChannel(snd_core::AXVPB* voice, uint16 mode, uint16 input, uint16 aux1, uint16 aux2, uint16 aux3, uint16 pan, uint16 span, uint16 fader);
uint32 MIXGetSoundMode();
void MIXSetSoundMode(uint32 sound_mode);
void MIXInit();
void MIXInitInputControl(snd_core::AXVPB* voice, uint16 input, uint32 mode);
void MIXInitDeviceControl(snd_core::AXVPB* voice, uint32 device_type, uint32 index, MixControl* control, uint32 mode);
void MIXSetDeviceSoundMode(uint32 device, uint32 mode);
void MIXUpdateSettings();
void MIXSetInput(snd_core::AXVPB* voice, uint16 input);
void MIXDRCInitChannel(snd_core::AXVPB* voice, uint16 mode, uint16 vol1, uint16 vol2, uint16 vol3);
void MIXAssignChannel(snd_core::AXVPB* voice);
void MIXInitChannel(snd_core::AXVPB* voice, uint16 mode, uint16 input, uint16 aux1, uint16 aux2, uint16 aux3, uint16 pan, uint16 span, uint16 fader);
uint32 MIXGetSoundMode();
void MIXSetSoundMode(uint32 sound_mode);
void Initialize();
}
COSModule* GetModuleSndUser1();
COSModule* GetModuleSndUser2();
}

View File

@ -624,21 +624,47 @@ void swkbd_keyInput(uint32 keyCode)
namespace swkbd
{
void load()
class : public COSModule
{
osLib_addFunction("swkbd", "SwkbdCreate__3RplFPUcQ3_2nn5swkbd10RegionTypeUiP8FSClient", swkbdExport_SwkbdCreate);
osLib_addFunction("swkbd", "SwkbdGetStateKeyboard__3RplFv", swkbdExport_SwkbdGetStateKeyboard);
osLib_addFunction("swkbd", "SwkbdGetStateInputForm__3RplFv", swkbdExport_SwkbdGetStateInputForm);
osLib_addFunction("swkbd", "SwkbdSetReceiver__3RplFRCQ3_2nn5swkbd11ReceiverArg", swkbdExport_SwkbdSetReceiver);
osLib_addFunction("swkbd", "SwkbdAppearInputForm__3RplFRCQ3_2nn5swkbd9AppearArg", swkbdExport_SwkbdAppearInputForm);
osLib_addFunction("swkbd", "SwkbdDisappearInputForm__3RplFv", swkbdExport_SwkbdDisappearInputForm);
osLib_addFunction("swkbd", "SwkbdDisappearKeyboard__3RplFv", swkbdExport_SwkbdDisappearKeyboard);
osLib_addFunction("swkbd", "SwkbdAppearKeyboard__3RplFRCQ3_2nn5swkbd11KeyboardArg", swkbdExport_SwkbdAppearKeyboard);
osLib_addFunction("swkbd", "SwkbdGetInputFormString__3RplFv", swkbdExport_SwkbdGetInputFormString);
osLib_addFunction("swkbd", "SwkbdIsDecideOkButton__3RplFPb", swkbdExport_SwkbdIsDecideOkButton);
osLib_addFunction("swkbd", "SwkbdInitLearnDic__3RplFPv", swkbdExport_SwkbdInitLearnDic);
osLib_addFunction("swkbd", "SwkbdGetDrawStringInfo__3RplFPQ3_2nn5swkbd14DrawStringInfo", swkbdExport_SwkbdGetDrawStringInfo);
osLib_addFunction("swkbd", "SwkbdIsNeedCalcSubThreadFont__3RplFv", swkbdExport_SwkbdIsNeedCalcSubThreadFont);
osLib_addFunction("swkbd", "SwkbdIsNeedCalcSubThreadPredict__3RplFv", swkbdExport_SwkbdIsNeedCalcSubThreadPredict);
public:
std::string_view GetName() override
{
return "swkbd";
}
void RPLMapped() override
{
osLib_addFunction("swkbd", "SwkbdCreate__3RplFPUcQ3_2nn5swkbd10RegionTypeUiP8FSClient", swkbdExport_SwkbdCreate);
osLib_addFunction("swkbd", "SwkbdGetStateKeyboard__3RplFv", swkbdExport_SwkbdGetStateKeyboard);
osLib_addFunction("swkbd", "SwkbdGetStateInputForm__3RplFv", swkbdExport_SwkbdGetStateInputForm);
osLib_addFunction("swkbd", "SwkbdSetReceiver__3RplFRCQ3_2nn5swkbd11ReceiverArg", swkbdExport_SwkbdSetReceiver);
osLib_addFunction("swkbd", "SwkbdAppearInputForm__3RplFRCQ3_2nn5swkbd9AppearArg", swkbdExport_SwkbdAppearInputForm);
osLib_addFunction("swkbd", "SwkbdDisappearInputForm__3RplFv", swkbdExport_SwkbdDisappearInputForm);
osLib_addFunction("swkbd", "SwkbdDisappearKeyboard__3RplFv", swkbdExport_SwkbdDisappearKeyboard);
osLib_addFunction("swkbd", "SwkbdAppearKeyboard__3RplFRCQ3_2nn5swkbd11KeyboardArg", swkbdExport_SwkbdAppearKeyboard);
osLib_addFunction("swkbd", "SwkbdGetInputFormString__3RplFv", swkbdExport_SwkbdGetInputFormString);
osLib_addFunction("swkbd", "SwkbdIsDecideOkButton__3RplFPb", swkbdExport_SwkbdIsDecideOkButton);
osLib_addFunction("swkbd", "SwkbdInitLearnDic__3RplFPv", swkbdExport_SwkbdInitLearnDic);
osLib_addFunction("swkbd", "SwkbdGetDrawStringInfo__3RplFPQ3_2nn5swkbd14DrawStringInfo", swkbdExport_SwkbdGetDrawStringInfo);
osLib_addFunction("swkbd", "SwkbdIsNeedCalcSubThreadFont__3RplFv", swkbdExport_SwkbdIsNeedCalcSubThreadFont);
osLib_addFunction("swkbd", "SwkbdIsNeedCalcSubThreadPredict__3RplFv", swkbdExport_SwkbdIsNeedCalcSubThreadPredict);
};
void rpl_entry(uint32 moduleHandle, coreinit::RplEntryReason reason) override
{
if (reason == coreinit::RplEntryReason::Loaded)
{
// todo
}
else if (reason == coreinit::RplEntryReason::Unloaded)
{
// todo
}
}
}s_COSswkbdModule;
COSModule* GetModule()
{
return &s_COSswkbdModule;
}
}

View File

@ -1,8 +1,10 @@
#include "Cafe/OS/RPL/COSModule.h"
void swkbd_render(bool mainWindow);
bool swkbd_hasKeyboardInputHook();
void swkbd_keyInput(uint32 keyCode);
namespace swkbd
{
void load();
COSModule* GetModule();
}

View File

@ -670,25 +670,42 @@ namespace sysapp
}
}
// register sysapp functions
void sysapp_load()
namespace sysapp
{
osLib_addFunction("sysapp", "_SYSLaunchMiiStudio", sysappExport__SYSLaunchMiiStudio);
osLib_addFunction("sysapp", "_SYSGetMiiStudioArgs", sysappExport__SYSGetMiiStudioArgs);
osLib_addFunction("sysapp", "_SYSGetSettingsArgs", sysappExport__SYSGetSettingsArgs);
osLib_addFunction("sysapp", "_SYSReturnToCallerWithStandardResult", sysappExport__SYSReturnToCallerWithStandardResult);
osLib_addFunction("sysapp", "_SYSGetSystemApplicationTitleId", sysappExport__SYSGetSystemApplicationTitleId);
osLib_addFunction("sysapp", "SYSGetUPIDFromTitleID", sysappExport_SYSGetUPIDFromTitleID);
class : public COSModule
{
public:
std::string_view GetName() override
{
return "nsysapp";
}
osLib_addFunction("sysapp", "_SYSGetEShopArgs", sysappExport__SYSGetEShopArgs);
void RPLMapped() override
{
osLib_addFunction("sysapp", "_SYSLaunchMiiStudio", sysappExport__SYSLaunchMiiStudio);
osLib_addFunction("sysapp", "_SYSGetMiiStudioArgs", sysappExport__SYSGetMiiStudioArgs);
osLib_addFunction("sysapp", "_SYSGetSettingsArgs", sysappExport__SYSGetSettingsArgs);
osLib_addFunction("sysapp", "_SYSReturnToCallerWithStandardResult", sysappExport__SYSReturnToCallerWithStandardResult);
osLib_addFunction("sysapp", "SYSGetVodArgs", sysappExport_SYSGetVodArgs);
osLib_addFunction("sysapp", "_SYSGetSystemApplicationTitleId", sysappExport__SYSGetSystemApplicationTitleId);
osLib_addFunction("sysapp", "SYSGetUPIDFromTitleID", sysappExport_SYSGetUPIDFromTitleID);
osLib_addFunction("sysapp", "SYSGetStandardResult", sysappExport_SYSGetStandardResult);
osLib_addFunction("sysapp", "_SYSGetEShopArgs", sysappExport__SYSGetEShopArgs);
cafeExportRegisterFunc(_SYSGetLauncherArgs, "sysapp", "_SYSGetLauncherArgs", LogType::Placeholder);
cafeExportRegisterFunc(_SYSGetAccountArgs, "sysapp", "_SYSGetAccountArgs", LogType::Placeholder);
osLib_addFunction("sysapp", "SYSGetVodArgs", sysappExport_SYSGetVodArgs);
sysapp::load();
}
osLib_addFunction("sysapp", "SYSGetStandardResult", sysappExport_SYSGetStandardResult);
cafeExportRegisterFunc(_SYSGetLauncherArgs, "sysapp", "_SYSGetLauncherArgs", LogType::Placeholder);
cafeExportRegisterFunc(_SYSGetAccountArgs, "sysapp", "_SYSGetAccountArgs", LogType::Placeholder);
sysapp::load();
};
}s_COSsysappModule;
COSModule* GetModule()
{
return &s_COSsysappModule;
}
}

View File

@ -1,3 +1,8 @@
void sysapp_load();
#include "Cafe/OS/RPL/COSModule.h"
namespace sysapp
{
COSModule* GetModule();
}
uint64 _SYSGetSystemApplicationTitleId(sint32 index);

Some files were not shown because too many files have changed in this diff Show More