wut v1.9.1
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
47
53
55{
56 char *name;
57
58 uint32_t textAddr;
59 uint32_t textOffset;
60 uint32_t textSize;
61
62 uint32_t dataAddr;
63 uint32_t dataOffset;
64 uint32_t dataSize;
65
66 uint32_t readAddr;
67 uint32_t readOffset;
68 uint32_t readSize;
69};
70WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x00, name);
71WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x04, textAddr);
72WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x08, textOffset);
73WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x0C, textSize);
74WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x10, dataAddr);
75WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x14, dataOffset);
76WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x18, dataSize);
77WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x1C, readAddr);
78WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x20, readOffset);
79WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x24, readSize);
80WUT_CHECK_SIZE(OSDynLoad_NotifyData, 0x28);
81
83{
84 uint32_t codeHeapUsed;
85 uint32_t unk_0x04;
86 uint32_t codeHeapFree;
88 uint32_t dataHeapUsed;
89 uint32_t unk_0x14;
90};
91WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x00, codeHeapUsed);
92WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x04, unk_0x04);
93WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x08, codeHeapFree);
94WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x0C, codeHeapLargestFree);
95WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x10, dataHeapUsed);
96WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x14, unk_0x14);
97WUT_CHECK_SIZE(OSDynLoad_LoaderHeapStatistics, 0x18);
98
100{
101 uint32_t size;
102 uint32_t magic;
110 uint32_t shstrndx;
112 WUT_UNKNOWN_BYTES(0x60 - 0x28);
113};
114WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x00, size);
115WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x04, magic);
116WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x08, pathStringLength);
117WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x0C, pathString);
118WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x10, fileInfoFlags);
119WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x14, tlsModuleIndex);
120WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x16, tlsAlignShift);
121WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x18, tlsAddressStart);
122WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x1C, tlsSectionSize);
123WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x20, shstrndx);
124WUT_CHECK_OFFSET(OSDynLoad_LoaderUserFileInfo, 0x24, titleLocation);
125WUT_CHECK_SIZE(OSDynLoad_LoaderUserFileInfo, 0x60);
126
127
129{
130 uint32_t type;
131 uint32_t flags;
132 void *address;
133
134 union
135 {
137 uint32_t size;
138
140 uint32_t name;
141 };
142};
143WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x00, type);
144WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x04, flags);
145WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x08, address);
146WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x0C, size);
147WUT_CHECK_OFFSET(OSDynLoad_LoaderSectionInfo, 0x0C, name);
148WUT_CHECK_SIZE(OSDynLoad_LoaderSectionInfo, 0x10);
149
150
177WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x00, handle);
178WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x04, loaderHandle);
179WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x08, moduleName);
180WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x0C, moduleNameLen);
181WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x10, sectionInfoCount);
182WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x14, sectionInfo);
183WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x18, importModules);
184WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x1C, importModuleCount);
185WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x20, userFileInfoSize);
186WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x24, userFileInfo);
187WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x28, notifyData);
188WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x2C, entryPoint);
189WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x30, dataSectionSize);
190WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x34, dataSection);
191WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x38, loadSectionSize);
192WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x3C, loadSection);
193WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x40, dynLoadFreeFn);
194WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x44, codeExports);
195WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x48, numCodeExports);
196WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x4C, dataExports);
197WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x50, numDataExports);
198WUT_CHECK_OFFSET(OSDynLoad_InternalData, 0x54, next);
199WUT_CHECK_SIZE(OSDynLoad_InternalData, 0x94);
200
206
208 void *userContext,
209 OSDynLoad_NotifyReason notifyReason,
210 OSDynLoad_NotifyData *infos);
211
219OSDynLoad_Acquire(char const *name,
220 OSDynLoad_Module *outModule);
221
222
230 OSDynLoad_ExportType exportType,
231 char const *name,
232 void **outAddr);
233
234
241void
243
244
250 OSDynLoadFreeFn freeFn);
251
252
258 OSDynLoadFreeFn *outFreeFn);
259
260
266 OSDynLoadFreeFn freeFn);
267
268
274 OSDynLoadFreeFn *outFreeFn);
275
276
282
283
290 char *nameBuf,
291 int32_t *nameBufSize);
292
293
300int32_t
302
303
315BOOL
316OSDynLoad_GetRPLInfo(uint32_t first,
317 uint32_t count,
318 OSDynLoad_NotifyData *outInfos);
319
327 OSDynLoad_Module *outModule);
328
334 void *userContext);
335
341 void *userContext);
342
348int
350 OSDynLoad_EntryReason reason);
351
352#ifdef __cplusplus
353}
354#endif
355
OSDynLoad_LoaderUserFileInfo * userFileInfo
Definition dynload.h:162
uint32_t readAddr
Definition dynload.h:66
uint32_t textOffset
Definition dynload.h:59
uint32_t textSize
Definition dynload.h:60
uint32_t numCodeExports
Definition dynload.h:171
uint32_t userFileInfoSize
Definition dynload.h:161
OSDynLoad_InternalData * next
Definition dynload.h:174
uint32_t numDataExports
Definition dynload.h:173
OSDynLoad_LoaderSectionInfo * sectionInfo
Definition dynload.h:158
uint32_t readSize
Definition dynload.h:68
uint32_t sectionInfoCount
Definition dynload.h:157
OSDynLoad_InternalData ** importModules
Definition dynload.h:159
uint32_t importModuleCount
Definition dynload.h:160
OSDynLoadFreeFn dynLoadFreeFn
Definition dynload.h:169
OSDynLoad_NotifyData * notifyData
Definition dynload.h:163
uint32_t loadSectionSize
Definition dynload.h:167
uint32_t readOffset
Definition dynload.h:67
uint32_t dataSize
Definition dynload.h:64
uint32_t dataSectionSize
Definition dynload.h:165
uint32_t textAddr
Definition dynload.h:58
uint32_t dataAddr
Definition dynload.h:62
uint32_t dataOffset
Definition dynload.h:63
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:49
OSDynLoad_Error
Definition dynload.h:25
OSDynLoad_NotifyReason
Definition dynload.h:202
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:43
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:207
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:50
@ OS_DYNLOAD_UNLOADED
Definition dynload.h:51
@ 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:203
@ OS_DYNLOAD_NOTIFY_LOADED
Definition dynload.h:204
@ OS_DYNLOAD_EXPORT_FUNC
Definition dynload.h:44
@ OS_DYNLOAD_EXPORT_DATA
Definition dynload.h:45
int32_t BOOL
Definition wut_types.h:7