2020-06-06 22:15:47 +02:00
|
|
|
#include <wums.h>
|
2022-01-12 23:07:09 +01:00
|
|
|
#ifdef DEBUG
|
2020-06-06 22:15:47 +02:00
|
|
|
#include <whb/log_udp.h>
|
2022-01-12 23:07:09 +01:00
|
|
|
#include <whb/log_cafe.h>
|
|
|
|
#include <whb/log_module.h>
|
|
|
|
#endif // DEBUG
|
|
|
|
|
2020-06-06 22:15:47 +02:00
|
|
|
#include "function_patcher.h"
|
2021-09-24 14:49:20 +02:00
|
|
|
|
2020-06-06 22:15:47 +02:00
|
|
|
WUMS_MODULE_EXPORT_NAME("homebrew_functionpatcher");
|
2020-12-28 14:42:19 +01:00
|
|
|
WUMS_MODULE_SKIP_ENTRYPOINT();
|
2020-06-06 22:15:47 +02:00
|
|
|
|
2022-01-12 23:07:09 +01:00
|
|
|
uint32_t moduleLogInit = false;
|
|
|
|
uint32_t cafeLogInit = false;
|
|
|
|
uint32_t udpLogInit = false;
|
|
|
|
|
2020-06-06 22:15:47 +02:00
|
|
|
WUMS_APPLICATION_STARTS() {
|
2022-01-12 23:07:09 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (!(moduleLogInit = WHBLogModuleInit())) {
|
|
|
|
cafeLogInit = WHBLogCafeInit();
|
|
|
|
udpLogInit = WHBLogUdpInit();
|
|
|
|
}
|
|
|
|
#endif // DEBUG
|
2020-06-06 22:15:47 +02:00
|
|
|
FunctionPatcherResetLibHandles();
|
2022-01-12 23:07:09 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
WUMS_APPLICATION_REQUESTS_EXIT() {
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (moduleLogInit) {
|
|
|
|
WHBLogModuleDeinit();
|
|
|
|
moduleLogInit = false;
|
|
|
|
}
|
|
|
|
if (cafeLogInit) {
|
|
|
|
WHBLogCafeDeinit();
|
|
|
|
cafeLogInit = false;
|
|
|
|
}
|
|
|
|
if (udpLogInit) {
|
|
|
|
WHBLogUdpDeinit();
|
|
|
|
udpLogInit = false;
|
|
|
|
}
|
|
|
|
#endif // DEBUG
|
2020-06-06 22:15:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
WUMS_EXPORT_FUNCTION(FunctionPatcherPatchFunction);
|
2020-06-12 21:10:59 +02:00
|
|
|
WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreFunctions);
|
2020-12-28 14:45:28 +01:00
|
|
|
WUMS_EXPORT_FUNCTION(FunctionPatcherRestoreDynamicFunctions);
|