wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
dynload.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include "thread.h"
4#include "time.h"
5
12#ifdef __cplusplus
13extern "C" {
14#endif
15
18typedef void *OSDynLoad_Module;
19
23
38
39typedef OSDynLoad_Error (*OSDynLoadAllocFn)(int32_t size, int32_t align, void **outAddr);
40typedef void (*OSDynLoadFreeFn)(void *addr);
41
46
52
54{
55 char *name;
56
57 uint32_t textAddr;
58 uint32_t textOffset;
59 uint32_t textSize;
60
61 uint32_t dataAddr;
62 uint32_t dataOffset;
63 uint32_t dataSize;
64
65 uint32_t readAddr;
66 uint32_t readOffset;
67 uint32_t readSize;
68};
69WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x00, name);
70WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x04, textAddr);
71WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x08, textOffset);
72WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x0C, textSize);
73WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x10, dataAddr);
74WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x14, dataOffset);
75WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x18, dataSize);
76WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x1C, readAddr);
77WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x20, readOffset);
78WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x24, readSize);
79WUT_CHECK_SIZE(OSDynLoad_NotifyData, 0x28);
80
82{
83 uint32_t codeHeapUsed;
84 uint32_t unk_0x04;
85 uint32_t codeHeapFree;
87 uint32_t dataHeapUsed;
88 uint32_t unk_0x14;
89};
90WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x00, codeHeapUsed);
91WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x04, unk_0x04);
92WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x08, codeHeapFree);
93WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x0C, codeHeapLargestFree);
94WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x10, dataHeapUsed);
95WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x14, unk_0x14);
96WUT_CHECK_SIZE(OSDynLoad_LoaderHeapStatistics, 0x18);
97
99{
100 uint32_t size;
101 uint32_t magic;
109 uint32_t shstrndx;
111 WUT_UNKNOWN_BYTES(0x60 - 0x28);
112};
113WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x00, size);
114WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x04, magic);
115WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x08, pathStringLength);
116WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x0C, pathString);
117WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x10, fileInfoFlags);
118WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x14, tlsModuleIndex);
119WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x16, tlsAlignShift);
120WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x18, tlsAddressStart);
121WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x1C, tlsSectionSize);
122WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x20, shstrndx);
123WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x24, titleLocation);
124WUT_CHECK_SIZE(OSDynLoad_LoaderUserFileInfo, 0x60);
125
126
128{
129 uint32_t type;
130 uint32_t flags;
131 void *address;
132
133 union {
135 uint32_t size;
136
138 uint32_t name;
139 };
140};
141WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x00, type);
142WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x04, flags);
143WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x08, address);
144WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x0C, size);
145WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x0C, name);
146WUT_CHECK_SIZE(OSDynLoad_LoaderSectionInfo, 0x10);
147
148
175WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x00, handle);
176WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x04, loaderHandle);
177WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x08, moduleName);
178WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x0C, moduleNameLen);
179WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x10, sectionInfoCount);
180WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x14, sectionInfo);
181WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x18, importModules);
182WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x1C, importModuleCount);
183WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x20, userFileInfoSize);
184WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x24, userFileInfo);
185WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x28, notifyData);
186WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x2C, entryPoint);
187WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x30, dataSectionSize);
188WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x34, dataSection);
189WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x38, loadSectionSize);
190WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x3C, loadSection);
191WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x40, dynLoadFreeFn);
192WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x44, codeExports);
193WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x48, numCodeExports);
194WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x4C, dataExports);
195WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x50, numDataExports);
196WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x54, next);
197WUT_CHECK_SIZE(OSDynLoad_InternalData, 0x94);
198
204
206 void *userContext,
207 OSDynLoad_NotifyReason notifyReason,
208 OSDynLoad_NotifyData *infos);
209
217OSDynLoad_Acquire(char const *name,
218 OSDynLoad_Module *outModule);
219
220
228 OSDynLoad_ExportType exportType,
229 char const *name,
230 void **outAddr);
231
232
239void
241
242
248 OSDynLoadFreeFn freeFn);
249
250
256 OSDynLoadFreeFn *outFreeFn);
257
258
264 OSDynLoadFreeFn freeFn);
265
266
272 OSDynLoadFreeFn *outFreeFn);
273
274
280
281
288 char *nameBuf,
289 int32_t *nameBufSize);
290
291
298int32_t
300
301
313BOOL
314OSDynLoad_GetRPLInfo(uint32_t first,
315 uint32_t count,
316 OSDynLoad_NotifyData *outInfos);
317
325 OSDynLoad_Module *outModule);
326
332 void *userContext);
333
339 void *userContext);
340
346int
348 OSDynLoad_EntryReason reason);
349
350#ifdef __cplusplus
351}
352#endif
353
OSDynLoad_LoaderUserFileInfo * userFileInfo
Definition dynload.h:160
uint32_t readAddr
Definition dynload.h:65
uint32_t textOffset
Definition dynload.h:58
uint32_t textSize
Definition dynload.h:59
uint32_t numCodeExports
Definition dynload.h:169
uint32_t userFileInfoSize
Definition dynload.h:159
OSDynLoad_InternalData * next
Definition dynload.h:172
uint32_t numDataExports
Definition dynload.h:171
OSDynLoad_LoaderSectionInfo * sectionInfo
Definition dynload.h:156
uint32_t readSize
Definition dynload.h:67
uint32_t sectionInfoCount
Definition dynload.h:155
OSDynLoad_InternalData ** importModules
Definition dynload.h:157
uint32_t importModuleCount
Definition dynload.h:158
OSDynLoadFreeFn dynLoadFreeFn
Definition dynload.h:167
OSDynLoad_NotifyData * notifyData
Definition dynload.h:161
uint32_t loadSectionSize
Definition dynload.h:165
uint32_t readOffset
Definition dynload.h:66
uint32_t dataSize
Definition dynload.h:63
uint32_t dataSectionSize
Definition dynload.h:163
uint32_t textAddr
Definition dynload.h:57
uint32_t dataAddr
Definition dynload.h:61
uint32_t dataOffset
Definition dynload.h:62
void(* OSDynLoadFreeFn)(void *addr)
Definition dynload.h:40
OSDynLoad_Error OSDynLoad_FindExport(OSDynLoad_Module module, OSDynLoad_ExportType exportType, char const *name, void **outAddr)
Retrieve the address of a function or data export from a module.
void * OSDynLoad_Module
Definition dynload.h:18
BOOL OSDynLoad_GetRPLInfo(uint32_t first, uint32_t count, OSDynLoad_NotifyData *outInfos)
Get information about the currently loaded RPLs.
OSDynLoad_Error OSDynLoad_GetLoaderHeapStatistics(OSDynLoad_LoaderHeapStatistics *outLoaderHeapStatistics)
Get loader heap statistics.
OSDynLoad_Error OSDynLoad_AddNotifyCallback(OSDynLoadNotifyFunc notifyFn, void *userContext)
Registers a callback that's called whenever a new .rpl is loaded or unloaded.
OSDynLoad_Error OSDynLoad_GetAllocator(OSDynLoadAllocFn *outAllocFn, OSDynLoadFreeFn *outFreeFn)
Get the allocator functions used for dynamic loading.
OSDynLoad_EntryReason
Definition dynload.h:48
OSDynLoad_Error
Definition dynload.h:25
OSDynLoad_NotifyReason
Definition dynload.h:200
OSDynLoad_Error OSDynLoad_SetTLSAllocator(OSDynLoadAllocFn allocFn, OSDynLoadFreeFn freeFn)
Set the allocator functions to use for thread local storage.
OSDynLoad_Error OSDynLoad_DelNotifyCallback(OSDynLoadNotifyFunc notifyFn, void *userContext)
Removes a previously added a callback.
int rpl_entry(OSDynLoad_Module module, OSDynLoad_EntryReason reason)
The prototype for an RPL entry point.
OSDynLoad_ExportType
Definition dynload.h:42
OSDynLoad_Error OSDynLoad_Acquire(char const *name, OSDynLoad_Module *outModule)
Load a module.
OSDynLoad_Error OSDynLoad_GetModuleName(OSDynLoad_Module module, char *nameBuf, int32_t *nameBufSize)
Gets the name for a given module handle.
void(* OSDynLoadNotifyFunc)(OSDynLoad_Module module, void *userContext, OSDynLoad_NotifyReason notifyReason, OSDynLoad_NotifyData *infos)
Definition dynload.h:205
int32_t OSDynLoad_GetNumberOfRPLs()
Gets the number of currently loaded RPLs.
OSDynLoad_Error OSDynLoad_GetTLSAllocator(OSDynLoadAllocFn *outAllocFn, OSDynLoadFreeFn *outFreeFn)
Get the allocator functions used for thread local storage.
OSDynLoad_Error OSDynLoad_SetAllocator(OSDynLoadAllocFn allocFn, OSDynLoadFreeFn freeFn)
Set the allocator functions to use for dynamic loading.
OSDynLoad_Error(* OSDynLoadAllocFn)(int32_t size, int32_t align, void **outAddr)
Definition dynload.h:39
void OSDynLoad_Release(OSDynLoad_Module module)
Free a module handle returned from OSDynLoad_Acquire.
OSDynLoad_Error OSDynLoad_IsModuleLoaded(char const *name, OSDynLoad_Module *outModule)
Checks if a module is already loaded.
@ OS_DYNLOAD_LOADED
Definition dynload.h:49
@ OS_DYNLOAD_UNLOADED
Definition dynload.h:50
@ OS_DYNLOAD_INVALID_MODULE_NAME
Definition dynload.h:30
@ OS_DYNLOAD_INVALID_ACQUIRE_PTR
Definition dynload.h:31
@ OS_DYNLOAD_INVALID_MODULE_NAME_PTR
Definition dynload.h:29
@ OS_DYNLOAD_EMPTY_MODULE_NAME
Definition dynload.h:32
@ OS_DYNLOAD_OUT_OF_MEMORY
Definition dynload.h:27
@ OS_DYNLOAD_OK
Definition dynload.h:26
@ OS_DYNLOAD_TLS_ALLOCATOR_LOCKED
Definition dynload.h:35
@ OS_DYNLOAD_INVALID_NOTIFY_PTR
Definition dynload.h:28
@ OS_DYNLOAD_MODULE_NOT_FOUND
Definition dynload.h:36
@ OS_DYNLOAD_INVALID_ALLOCATOR_PTR
Definition dynload.h:33
@ OS_DYNLOAD_OUT_OF_SYSTEM_MEMORY
Definition dynload.h:34
@ OS_DYNLOAD_NOTIFY_UNLOADED
Definition dynload.h:201
@ OS_DYNLOAD_NOTIFY_LOADED
Definition dynload.h:202
@ OS_DYNLOAD_EXPORT_FUNC
Definition dynload.h:43
@ OS_DYNLOAD_EXPORT_DATA
Definition dynload.h:44
int32_t BOOL
Definition wut_types.h:7