devkitPro / wut

Let's try to make a Wii U Toolchain / SDK for creating rpx/rpl.
zlib License
236 stars 52 forks source link

A little fleshing out of the dynamic library header #289

Closed gblues closed 1 year ago

gblues commented 1 year ago

== DETAILS

This commit provides two tweaks:

  1. Add the "library not found" error, value of -6, to the OSDynLoad_Error enums
  2. Define an OSDynLoad_ExportType enum and use it in place of the isData boolean parameter to avoid raw true/false values in the code and make usages easier to read:

    // before - unclear what "false" means in this context
    last_error = OSDynLoad_FindExport((OSDynLoad_Module)lib, false, proc, &ptr_sym);

    vs:

    // after - aha, we're looking up a function symbol 
    last_error = OSDynLoad_FindExport((OSDynLoad_Module)lib, OS_DYNLOAD_EXPORT_FUNC, proc, &ptr_sym);
Maschell commented 1 year ago

Where is that -6 coming from? decaf defines ModuleNotFound as 0xBAD10023. It's probably a good idea to add the missing enum values from decaf to wut

gblues commented 1 year ago

The -6 comes from my own experiments trying to use OSDynload_Acquire() with WUT-built RPLs, and I poked around via Ghidra to see the context of the -6 return code.