From 7a31349744a04df5390145c2ac00315967e4377e Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 20 Jul 2017 15:18:32 +0200 Subject: [PATCH] Added ProcUI functions --- os_functions.c | 4 ++++ os_functions.h | 3 +++ proc_ui_functions.c | 44 ++++++++++++++++++++++++++++++++++++++++++ proc_ui_functions.h | 47 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 proc_ui_functions.c create mode 100644 proc_ui_functions.h diff --git a/os_functions.c b/os_functions.c index 6c2c9d9..36d50ab 100644 --- a/os_functions.c +++ b/os_functions.c @@ -48,6 +48,8 @@ EXPORT_DECL(s32, OSIsThreadSuspended, void *thread); EXPORT_DECL(s32, OSSetThreadPriority, void * thread, s32 priority); EXPORT_DECL(s32, OSJoinThread, void * thread, s32 * ret_val); EXPORT_DECL(void, OSDetachThread, void * thread); +EXPORT_DECL(void *,OSGetCurrentThread,void); +EXPORT_DECL(const char *,OSGetThreadName,void * thread); EXPORT_DECL(void, OSSleepTicks, u64 ticks); EXPORT_DECL(u64, OSGetTick, void); EXPORT_DECL(u64, OSGetTime, void); @@ -239,6 +241,8 @@ void InitOSFunctionPointers(void) OS_FIND_EXPORT(coreinit_handle, OSJoinThread); OS_FIND_EXPORT(coreinit_handle, OSSetThreadPriority); OS_FIND_EXPORT(coreinit_handle, OSDetachThread); + OS_FIND_EXPORT(coreinit_handle, OSGetCurrentThread); + OS_FIND_EXPORT(coreinit_handle, OSGetThreadName); OS_FIND_EXPORT(coreinit_handle, OSSleepTicks); OS_FIND_EXPORT(coreinit_handle, OSGetTick); OS_FIND_EXPORT(coreinit_handle, OSGetTime); diff --git a/os_functions.h b/os_functions.h index ab9d1da..13b10c4 100644 --- a/os_functions.h +++ b/os_functions.h @@ -87,6 +87,9 @@ extern s32 (* OSIsThreadSuspended)(void *thread); extern s32 (* OSJoinThread)(void * thread, s32 * ret_val); extern s32 (* OSSetThreadPriority)(void * thread, s32 priority); extern void (* OSDetachThread)(void * thread); + +extern void * (* OSGetCurrentThread)(void); +extern const char * (* OSGetThreadName)(void * thread); extern void (* OSSleepTicks)(u64 ticks); extern u64 (* OSGetTick)(void); extern u64 (* OSGetTime)(void); diff --git a/proc_ui_functions.c b/proc_ui_functions.c new file mode 100644 index 0000000..d270600 --- /dev/null +++ b/proc_ui_functions.c @@ -0,0 +1,44 @@ +/**************************************************************************** + * Copyright (C) 2015 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#include "os_functions.h" +#include "proc_ui_functions.h" + +u32 proc_ui_handle __attribute__((section(".data"))) = 0; + +EXPORT_DECL(u32, ProcUIInForeground, void); +EXPORT_DECL(void, ProcUIRegisterCallback, u32 type,ProcUICallback callback,void* param, u32 unkwn); + +void InitAcquireProcUI(void) +{ + OSDynLoad_Acquire("proc_ui.rpl", &proc_ui_handle); +} + +void InitProcUIFunctionPointers(void) +{ + u32 *funcPointer = 0; + InitAcquireProcUI(); + + OS_FIND_EXPORT(proc_ui_handle, ProcUIInForeground); + OS_FIND_EXPORT(proc_ui_handle, ProcUIRegisterCallback); +} diff --git a/proc_ui_functions.h b/proc_ui_functions.h new file mode 100644 index 0000000..92bd792 --- /dev/null +++ b/proc_ui_functions.h @@ -0,0 +1,47 @@ +/**************************************************************************** + * Copyright (C) 2015 + * by Dimok + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any + * damages arising from the use of this software. + * + * Permission is granted to anyone to use this software for any + * purpose, including commercial applications, and to alter it and + * redistribute it freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you + * must not claim that you wrote the original software. If you use + * this software in a product, an acknowledgment in the product + * documentation would be appreciated but is not required. + * + * 2. Altered source versions must be plainly marked as such, and + * must not be misrepresented as being the original software. + * + * 3. This notice may not be removed or altered from any source + * distribution. + ***************************************************************************/ +#ifndef __PROC_UI_FUNCTIONS_H_ +#define __PROC_UI_FUNCTIONS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +extern u32 proc_ui_handle; + +typedef u32 (*ProcUICallback)(void*); + +void InitProcUIFunctionPointers(void); +void InitAcquireProcUI(void); + +extern u32 (*ProcUIInForeground)(void); +extern void (*ProcUIRegisterCallback)(u32 type,ProcUICallback callback,void* param, u32 unkwn); + +#ifdef __cplusplus +} +#endif + +#endif // __PROC_UI_FUNCTIONS_H_