mirror of
https://github.com/Maschell/dynamic_libs.git
synced 2024-09-12 06:03:49 +02:00
Added energy saver functions and pro controller defines
This commit is contained in:
parent
4f6bb467c3
commit
4ade58bf6a
@ -50,6 +50,7 @@ EXPORT_DECL(int, OSJoinThread, void * thread, int * ret_val);
|
|||||||
EXPORT_DECL(void, OSDetachThread, void * thread);
|
EXPORT_DECL(void, OSDetachThread, void * thread);
|
||||||
EXPORT_DECL(void, OSSleepTicks, u64 ticks);
|
EXPORT_DECL(void, OSSleepTicks, u64 ticks);
|
||||||
EXPORT_DECL(u64, OSGetTick, void);
|
EXPORT_DECL(u64, OSGetTick, void);
|
||||||
|
EXPORT_DECL(u64, OSGetTime, void);
|
||||||
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
//! Mutex functions
|
//! Mutex functions
|
||||||
@ -63,6 +64,7 @@ EXPORT_DECL(int, OSTryLockMutex, void* mutex);
|
|||||||
//! System functions
|
//! System functions
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
EXPORT_DECL(u64, OSGetTitleID, void);
|
EXPORT_DECL(u64, OSGetTitleID, void);
|
||||||
|
EXPORT_DECL(void, OSGetArgcArgv, int* argc, char*** argv);
|
||||||
EXPORT_DECL(void, __Exit, void);
|
EXPORT_DECL(void, __Exit, void);
|
||||||
EXPORT_DECL(void, OSFatal, const char* msg);
|
EXPORT_DECL(void, OSFatal, const char* msg);
|
||||||
EXPORT_DECL(void, OSSetExceptionCallback, u8 exceptionType, exception_callback newCallback);
|
EXPORT_DECL(void, OSSetExceptionCallback, u8 exceptionType, exception_callback newCallback);
|
||||||
@ -122,6 +124,19 @@ EXPORT_DECL(void, addr_PrepareTitle_hook, void);
|
|||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
EXPORT_DECL(void, DCInvalidateRange, void *buffer, uint32_t length);
|
EXPORT_DECL(void, DCInvalidateRange, void *buffer, uint32_t length);
|
||||||
|
|
||||||
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
//! Energy Saver functions
|
||||||
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
//Burn-in Reduction
|
||||||
|
EXPORT_DECL(int, IMEnableDim,void);
|
||||||
|
EXPORT_DECL(int, IMDisableDim,void);
|
||||||
|
EXPORT_DECL(int, IMIsDimEnabled,int * result);
|
||||||
|
//Auto power down
|
||||||
|
EXPORT_DECL(int, IMEnableAPD,void);
|
||||||
|
EXPORT_DECL(int, IMDisableAPD,void);
|
||||||
|
EXPORT_DECL(int, IMIsAPDEnabled,int * result);
|
||||||
|
EXPORT_DECL(int, IMIsAPDEnabledBySysSettings,int * result);
|
||||||
|
|
||||||
void InitAcquireOS(void)
|
void InitAcquireOS(void)
|
||||||
{
|
{
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -148,6 +163,7 @@ void InitOSFunctionPointers(void)
|
|||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
OS_FIND_EXPORT(coreinit_handle, OSFatal);
|
OS_FIND_EXPORT(coreinit_handle, OSFatal);
|
||||||
OS_FIND_EXPORT(coreinit_handle, OSGetTitleID);
|
OS_FIND_EXPORT(coreinit_handle, OSGetTitleID);
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, OSGetArgcArgv);
|
||||||
OS_FIND_EXPORT(coreinit_handle, OSSetExceptionCallback);
|
OS_FIND_EXPORT(coreinit_handle, OSSetExceptionCallback);
|
||||||
OS_FIND_EXPORT(coreinit_handle, DCFlushRange);
|
OS_FIND_EXPORT(coreinit_handle, DCFlushRange);
|
||||||
OS_FIND_EXPORT(coreinit_handle, ICInvalidateRange);
|
OS_FIND_EXPORT(coreinit_handle, ICInvalidateRange);
|
||||||
@ -177,6 +193,7 @@ void InitOSFunctionPointers(void)
|
|||||||
OS_FIND_EXPORT(coreinit_handle, OSDetachThread);
|
OS_FIND_EXPORT(coreinit_handle, OSDetachThread);
|
||||||
OS_FIND_EXPORT(coreinit_handle, OSSleepTicks);
|
OS_FIND_EXPORT(coreinit_handle, OSSleepTicks);
|
||||||
OS_FIND_EXPORT(coreinit_handle, OSGetTick);
|
OS_FIND_EXPORT(coreinit_handle, OSGetTick);
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, OSGetTime);
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
//! Mutex functions
|
//! Mutex functions
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -212,6 +229,19 @@ void InitOSFunctionPointers(void)
|
|||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
OS_FIND_EXPORT(coreinit_handle, DCInvalidateRange);
|
OS_FIND_EXPORT(coreinit_handle, DCInvalidateRange);
|
||||||
|
|
||||||
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
//! Energy Saver functions
|
||||||
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
//Burn-in Reduction
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, IMEnableDim);
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, IMDisableDim);
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, IMIsDimEnabled);
|
||||||
|
//Auto power down
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, IMEnableAPD);
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, IMDisableAPD);
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabled);
|
||||||
|
OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabledBySysSettings);
|
||||||
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
//! Special non library functions
|
//! Special non library functions
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -92,6 +92,7 @@ extern int (* OSSetThreadPriority)(void * thread, int priority);
|
|||||||
extern void (* OSDetachThread)(void * thread);
|
extern void (* OSDetachThread)(void * thread);
|
||||||
extern void (* OSSleepTicks)(u64 ticks);
|
extern void (* OSSleepTicks)(u64 ticks);
|
||||||
extern u64 (* OSGetTick)(void);
|
extern u64 (* OSGetTick)(void);
|
||||||
|
extern u64 (* OSGetTime)(void);
|
||||||
|
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
//! Mutex functions
|
//! Mutex functions
|
||||||
@ -105,6 +106,7 @@ extern int (* OSTryLockMutex)(void* mutex);
|
|||||||
//! System functions
|
//! System functions
|
||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
extern u64 (* OSGetTitleID)(void);
|
extern u64 (* OSGetTitleID)(void);
|
||||||
|
extern void (* OSGetArgcArgv)(int* argc, char*** argv);
|
||||||
extern void (* __Exit)(void);
|
extern void (* __Exit)(void);
|
||||||
extern void (* OSFatal)(const char* msg);
|
extern void (* OSFatal)(const char* msg);
|
||||||
extern void (* DCFlushRange)(const void *addr, u32 length);
|
extern void (* DCFlushRange)(const void *addr, u32 length);
|
||||||
@ -150,6 +152,19 @@ extern void (* addr_PrepareTitle_hook)(void);
|
|||||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
extern void (*DCInvalidateRange)(void *buffer, uint32_t length);
|
extern void (*DCInvalidateRange)(void *buffer, uint32_t length);
|
||||||
|
|
||||||
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
//! Energy Saver functions
|
||||||
|
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
////Burn-in Reduction
|
||||||
|
extern int (*IMEnableDim)(void);
|
||||||
|
extern int (*IMDisableDim)(void);
|
||||||
|
extern int (*IMIsDimEnabled)(int * result);
|
||||||
|
//Auto power down
|
||||||
|
extern int (*IMEnableAPD)(void);
|
||||||
|
extern int (*IMDisableAPD)(void);
|
||||||
|
extern int (*IMIsAPDEnabled)(int * result);
|
||||||
|
extern int (*IMIsAPDEnabledBySysSettings)(int * result);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,11 +27,14 @@
|
|||||||
unsigned int padscore_handle __attribute__((section(".data"))) = 0;
|
unsigned int padscore_handle __attribute__((section(".data"))) = 0;
|
||||||
|
|
||||||
EXPORT_DECL(void, KPADInit, void);
|
EXPORT_DECL(void, KPADInit, void);
|
||||||
|
EXPORT_DECL(void, WPADInit, void);
|
||||||
EXPORT_DECL(s32, WPADProbe, s32 chan, u32 * pad_type);
|
EXPORT_DECL(s32, WPADProbe, s32 chan, u32 * pad_type);
|
||||||
EXPORT_DECL(s32, WPADSetDataFormat, s32 chan, s32 format);
|
EXPORT_DECL(s32, WPADSetDataFormat, s32 chan, s32 format);
|
||||||
EXPORT_DECL(void, WPADEnableURCC, s32 enable);
|
EXPORT_DECL(void, WPADEnableURCC, s32 enable);
|
||||||
EXPORT_DECL(void, WPADRead, s32 chan, void * data);
|
EXPORT_DECL(void, WPADRead, s32 chan, void * data);
|
||||||
EXPORT_DECL(s32, KPADRead, s32 chan, void * data, u32 size);
|
EXPORT_DECL(s32, KPADRead, s32 chan, void * data, u32 size);
|
||||||
|
EXPORT_DECL(void,WPADSetAutoSleepTime,u8 minute);
|
||||||
|
EXPORT_DECL(void,WPADDisconnect,s32 chan);
|
||||||
|
|
||||||
void InitAcquirePadScore(void)
|
void InitAcquirePadScore(void)
|
||||||
{
|
{
|
||||||
@ -43,12 +46,15 @@ void InitPadScoreFunctionPointers(void)
|
|||||||
unsigned int *funcPointer = 0;
|
unsigned int *funcPointer = 0;
|
||||||
InitAcquirePadScore();
|
InitAcquirePadScore();
|
||||||
|
|
||||||
|
OS_FIND_EXPORT(padscore_handle, WPADInit);
|
||||||
OS_FIND_EXPORT(padscore_handle, KPADInit);
|
OS_FIND_EXPORT(padscore_handle, KPADInit);
|
||||||
OS_FIND_EXPORT(padscore_handle, WPADProbe);
|
OS_FIND_EXPORT(padscore_handle, WPADProbe);
|
||||||
OS_FIND_EXPORT(padscore_handle, WPADSetDataFormat);
|
OS_FIND_EXPORT(padscore_handle, WPADSetDataFormat);
|
||||||
OS_FIND_EXPORT(padscore_handle, WPADEnableURCC);
|
OS_FIND_EXPORT(padscore_handle, WPADEnableURCC);
|
||||||
OS_FIND_EXPORT(padscore_handle, WPADRead);
|
OS_FIND_EXPORT(padscore_handle, WPADRead);
|
||||||
OS_FIND_EXPORT(padscore_handle, KPADRead);
|
OS_FIND_EXPORT(padscore_handle, KPADRead);
|
||||||
|
OS_FIND_EXPORT(padscore_handle, WPADSetAutoSleepTime);
|
||||||
|
OS_FIND_EXPORT(padscore_handle, WPADDisconnect);
|
||||||
|
|
||||||
KPADInit();
|
KPADInit();
|
||||||
WPADEnableURCC(1);
|
WPADEnableURCC(1);
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "dynamic_libs/vpad_functions.h"
|
||||||
|
|
||||||
extern unsigned int padscore_handle;
|
extern unsigned int padscore_handle;
|
||||||
|
|
||||||
#include <gctypes.h>
|
#include <gctypes.h>
|
||||||
@ -62,8 +64,34 @@ extern unsigned int padscore_handle;
|
|||||||
#define WPAD_CLASSIC_BUTTON_DOWN 0x4000
|
#define WPAD_CLASSIC_BUTTON_DOWN 0x4000
|
||||||
#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000
|
#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000
|
||||||
|
|
||||||
void InitPadScoreFunctionPointers(void);
|
#define WPAD_PRO_BUTTON_UP 0x00000001
|
||||||
void InitAcquirePadScore(void);
|
#define WPAD_PRO_BUTTON_LEFT 0x00000002
|
||||||
|
#define WPAD_PRO_TRIGGER_ZR 0x00000004
|
||||||
|
#define WPAD_PRO_BUTTON_X 0x00000008
|
||||||
|
#define WPAD_PRO_BUTTON_A 0x00000010
|
||||||
|
#define WPAD_PRO_BUTTON_Y 0x00000020
|
||||||
|
#define WPAD_PRO_BUTTON_B 0x00000040
|
||||||
|
#define WPAD_PRO_TRIGGER_ZL 0x00000080
|
||||||
|
#define WPAD_PRO_RESERVED 0x00000100
|
||||||
|
#define WPAD_PRO_TRIGGER_R 0x00000200
|
||||||
|
#define WPAD_PRO_BUTTON_PLUS 0x00000400
|
||||||
|
#define WPAD_PRO_BUTTON_HOME 0x00000800
|
||||||
|
#define WPAD_PRO_BUTTON_MINUS 0x00001000
|
||||||
|
#define WPAD_PRO_TRIGGER_L 0x00002000
|
||||||
|
#define WPAD_PRO_BUTTON_DOWN 0x00004000
|
||||||
|
#define WPAD_PRO_BUTTON_RIGHT 0x00008000
|
||||||
|
#define WPAD_PRO_BUTTON_STICK_R 0x00010000
|
||||||
|
#define WPAD_PRO_BUTTON_STICK_L 0x00020000
|
||||||
|
|
||||||
|
#define WPAD_PRO_STICK_L_EMULATION_UP 0x00200000
|
||||||
|
#define WPAD_PRO_STICK_L_EMULATION_DOWN 0x00100000
|
||||||
|
#define WPAD_PRO_STICK_L_EMULATION_LEFT 0x00040000
|
||||||
|
#define WPAD_PRO_STICK_L_EMULATION_RIGHT 0x00080000
|
||||||
|
|
||||||
|
#define WPAD_PRO_STICK_R_EMULATION_UP 0x02000000
|
||||||
|
#define WPAD_PRO_STICK_R_EMULATION_DOWN 0x01000000
|
||||||
|
#define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000
|
||||||
|
#define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000
|
||||||
|
|
||||||
typedef struct _KPADData
|
typedef struct _KPADData
|
||||||
{
|
{
|
||||||
@ -80,7 +108,7 @@ typedef struct _KPADData
|
|||||||
u8 device_type;
|
u8 device_type;
|
||||||
u8 wpad_error;
|
u8 wpad_error;
|
||||||
u8 pos_valid;
|
u8 pos_valid;
|
||||||
u8 unused_4[1];
|
u8 format;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@ -103,19 +131,38 @@ typedef struct _KPADData
|
|||||||
f32 rtrigger;
|
f32 rtrigger;
|
||||||
} classic;
|
} classic;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
u32 btns_h;
|
||||||
|
u32 btns_d;
|
||||||
|
u32 btns_r;
|
||||||
|
f32 lstick_x;
|
||||||
|
f32 lstick_y;
|
||||||
|
f32 rstick_x;
|
||||||
|
f32 rstick_y;
|
||||||
|
int charging;
|
||||||
|
int wired;
|
||||||
|
} pro;
|
||||||
|
|
||||||
u32 unused_6[20];
|
u32 unused_6[20];
|
||||||
};
|
};
|
||||||
u32 unused_7[16];
|
u32 unused_7[16];
|
||||||
} KPADData;
|
} KPADData;
|
||||||
|
void InitPadScoreFunctionPointers(void);
|
||||||
|
void InitAcquirePadScore(void);
|
||||||
|
|
||||||
typedef void (* wpad_connect_callback_t)(s32 chan, s32 status);
|
typedef void (* wpad_connect_callback_t)(s32 chan, s32 status);
|
||||||
|
|
||||||
extern void (* KPADInit)(void);
|
extern void (* KPADInit)(void);
|
||||||
|
extern void (* WPADInit)(void);
|
||||||
extern s32 (* WPADProbe)(s32 chan, u32 * pad_type);
|
extern s32 (* WPADProbe)(s32 chan, u32 * pad_type);
|
||||||
extern s32 (* WPADSetDataFormat)(s32 chan, s32 format);
|
extern s32 (* WPADSetDataFormat)(s32 chan, s32 format);
|
||||||
extern void (* WPADEnableURCC)(s32 enable);
|
extern void (* WPADEnableURCC)(s32 enable);
|
||||||
extern void (* WPADRead)(s32 chan, void * data);
|
extern void (* WPADRead)(s32 chan, void * data);
|
||||||
extern s32 (* KPADRead)(s32 chan, void * data, u32 size);
|
extern s32 (* KPADRead)(s32 chan, void * data, u32 size);
|
||||||
|
extern s32 (* KPADReadEx)(s32 chan, KPADData * data, u32 size, s32 *error);
|
||||||
|
extern void (*WPADSetAutoSleepTime)(u8 time);
|
||||||
|
extern void (*WPADDisconnect)( s32 chan );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user