mirror of
https://github.com/wiiu-env/FunctionPatcherModule.git
synced 2025-01-07 23:50:44 +01:00
Use std::list instead of array
This commit is contained in:
parent
c719b4c8ac
commit
f94b857f12
@ -7,19 +7,18 @@ uint32_t FunctionAddressProvider::getEffectiveAddressOfFunction(function_replace
|
|||||||
uint32_t real_addr = 0;
|
uint32_t real_addr = 0;
|
||||||
OSDynLoad_Module rpl_handle = nullptr;
|
OSDynLoad_Module rpl_handle = nullptr;
|
||||||
OSDynLoad_Error err = OS_DYNLOAD_OK;
|
OSDynLoad_Error err = OS_DYNLOAD_OK;
|
||||||
int32_t rpl_handles_size = sizeof rpl_handles / sizeof rpl_handles[0];
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < rpl_handles_size; i++) {
|
for (auto &rplHandle : rpl_handles) {
|
||||||
if (rpl_handles[i].library == library) {
|
if (rplHandle.library == library) {
|
||||||
if (rpl_handles[i].handle == nullptr) {
|
if (rplHandle.handle == nullptr) {
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Lets acquire handle for rpl: %s", rpl_handles[i].rplname);
|
DEBUG_FUNCTION_LINE_VERBOSE("Lets acquire handle for rpl: %s", rplHandle.rplname);
|
||||||
err = OSDynLoad_IsModuleLoaded((char *) rpl_handles[i].rplname, &rpl_handles[i].handle);
|
err = OSDynLoad_IsModuleLoaded((char *) rplHandle.rplname, &rplHandle.handle);
|
||||||
}
|
}
|
||||||
if (err != OS_DYNLOAD_OK || !rpl_handles[i].handle) {
|
if (err != OS_DYNLOAD_OK || !rplHandle.handle) {
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("%s is not loaded yet", rpl_handles[i].rplname, err, rpl_handles[i].handle);
|
DEBUG_FUNCTION_LINE_VERBOSE("%s is not loaded yet", rplHandle.rplname, err, rplHandle.handle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rpl_handle = rpl_handles[i].handle;
|
rpl_handle = rplHandle.handle;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,13 +49,11 @@ uint32_t FunctionAddressProvider::getEffectiveAddressOfFunction(function_replace
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FunctionAddressProvider::resetHandles() {
|
void FunctionAddressProvider::resetHandles() {
|
||||||
int32_t rpl_handles_size = sizeof rpl_handles / sizeof rpl_handles[0];
|
for (auto &rplHandle : rpl_handles) {
|
||||||
|
if (rplHandle.handle != nullptr) {
|
||||||
for (int32_t i = 0; i < rpl_handles_size; i++) {
|
DEBUG_FUNCTION_LINE_VERBOSE("Resetting handle for rpl: %s", rplHandle.rplname);
|
||||||
if (rpl_handles[i].handle != nullptr) {
|
|
||||||
DEBUG_FUNCTION_LINE_VERBOSE("Resetting handle for rpl: %s", rpl_handles[i].rplname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl_handles[i].handle = nullptr;
|
rplHandle.handle = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <coreinit/dynload.h>
|
#include <coreinit/dynload.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <function_patcher/fpatching_defines.h>
|
#include <function_patcher/fpatching_defines.h>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
typedef struct rpl_handling {
|
typedef struct rpl_handling {
|
||||||
function_replacement_library_type_t library;
|
function_replacement_library_type_t library;
|
||||||
@ -15,7 +16,7 @@ public:
|
|||||||
uint32_t getEffectiveAddressOfFunction(function_replacement_library_type_t library, const char *functionName);
|
uint32_t getEffectiveAddressOfFunction(function_replacement_library_type_t library, const char *functionName);
|
||||||
void resetHandles();
|
void resetHandles();
|
||||||
|
|
||||||
rpl_handling rpl_handles[LIBRARY_OTHER] = {
|
std::list<rpl_handling> rpl_handles = {
|
||||||
{LIBRARY_AVM, "avm.rpl", nullptr},
|
{LIBRARY_AVM, "avm.rpl", nullptr},
|
||||||
{LIBRARY_CAMERA, "camera.rpl", nullptr},
|
{LIBRARY_CAMERA, "camera.rpl", nullptr},
|
||||||
{LIBRARY_COREINIT, "coreinit.rpl", nullptr},
|
{LIBRARY_COREINIT, "coreinit.rpl", nullptr},
|
||||||
|
Loading…
Reference in New Issue
Block a user