Formatting

This commit is contained in:
Maschell 2018-03-11 16:46:31 +01:00
parent 100029ffc7
commit fcb17e5826
29 changed files with 180 additions and 197 deletions

View File

@ -29,7 +29,7 @@ LIB := lib
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall -D__wiiu__ $(MACHDEP) $(INCLUDE) CFLAGS = -g -Os -Wall -D__wiiu__ $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
ASFLAGS := -g ASFLAGS := -g

View File

@ -28,12 +28,14 @@ u32 acp_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, GetMetaXml, ACPMetaXml * _ACPMetaXml); EXPORT_DECL(void, GetMetaXml, ACPMetaXml * _ACPMetaXml);
void InitAcquireACP(void){ void InitAcquireACP(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nn_acp.rpl", &acp_handle); OSDynLoad_Acquire("nn_acp.rpl", &acp_handle);
} }
void InitACPFunctionPointers(void){ void InitACPFunctionPointers(void) {
InitAcquireACP(); InitAcquireACP();
OSDynLoad_FindExport(acp_handle,0,"GetMetaXml__Q2_2nn3acpFP11_ACPMetaXml",&GetMetaXml); OSDynLoad_FindExport(acp_handle,0,"GetMetaXml__Q2_2nn3acpFP11_ACPMetaXml",&GetMetaXml);
} }

View File

@ -31,10 +31,9 @@ extern "C" {
#include "os_types.h" #include "os_types.h"
typedef struct ACPMetaXml_ typedef struct ACPMetaXml_ {
{ u8 data[0x3440];
u8 data[0x3440]; } ACPMetaXml;
}ACPMetaXml;
extern u32 acp_handle; extern u32 acp_handle;
extern void (*GetMetaXml)(ACPMetaXml * _ACPMetaXml); extern void (*GetMetaXml)(ACPMetaXml * _ACPMetaXml);

View File

@ -35,12 +35,14 @@ EXPORT_DECL(s32, AOC_CloseTitle, void * title);
EXPORT_DECL(s32, AOC_DeleteContent, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void* buffer, u32 buffer_size); EXPORT_DECL(s32, AOC_DeleteContent, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void* buffer, u32 buffer_size);
EXPORT_DECL(s32, AOC_GetPurchaseInfo, u32 * bResult, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size); EXPORT_DECL(s32, AOC_GetPurchaseInfo, u32 * bResult, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size);
void InitAcquireAoc(void){ void InitAcquireAoc(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nn_aoc.rpl", &aoc_handle); OSDynLoad_Acquire("nn_aoc.rpl", &aoc_handle);
} }
void InitAocFunctionPointers(void){ void InitAocFunctionPointers(void) {
InitAcquireAoc(); InitAcquireAoc();
if(aoc_handle == 0) if(aoc_handle == 0)
return; return;

View File

@ -49,21 +49,20 @@ EXPORT_DECL(u32, AXGetVoiceLoopCount, void *v);
EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset); EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset);
EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset); EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset);
void InitAcquireAX(void){ void InitAcquireAX(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
u32 *funcPointer = 0; u32 *funcPointer = 0;
if(OS_FIRMWARE >= 400) if(OS_FIRMWARE >= 400) {
{
AXInit = 0; AXInit = 0;
OSDynLoad_Acquire("snd_core.rpl", &sound_handle_old); OSDynLoad_Acquire("snd_core.rpl", &sound_handle_old);
OSDynLoad_Acquire("sndcore2.rpl", &sound_handle); OSDynLoad_Acquire("sndcore2.rpl", &sound_handle);
OS_FIND_EXPORT(sound_handle, AXInitWithParams); OS_FIND_EXPORT(sound_handle, AXInitWithParams);
OS_FIND_EXPORT(sound_handle, AXGetInputSamplesPerSec); OS_FIND_EXPORT(sound_handle, AXGetInputSamplesPerSec);
} } else {
else
{
AXInitWithParams = 0; AXInitWithParams = 0;
AXGetInputSamplesPerSec = 0; AXGetInputSamplesPerSec = 0;
@ -73,7 +72,7 @@ void InitAcquireAX(void){
} }
} }
void InitAXFunctionPointers(void){ void InitAXFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireAX(); InitAcquireAX();
@ -97,8 +96,7 @@ void InitAXFunctionPointers(void){
OS_FIND_EXPORT(sound_handle, AXSetVoiceLoopOffset); OS_FIND_EXPORT(sound_handle, AXSetVoiceLoopOffset);
} }
void ProperlyEndTransitionAudio(void) void ProperlyEndTransitionAudio(void) {
{
bool (* check_os_audio_transition_flag_old)(void); bool (* check_os_audio_transition_flag_old)(void);
void (* AXInit_old)(void); void (* AXInit_old)(void);
void (* AXQuit_old)(void); void (* AXQuit_old)(void);
@ -111,8 +109,7 @@ void ProperlyEndTransitionAudio(void)
OS_FIND_EXPORT_EX(sound_handle, AXInit, AXInit_old); OS_FIND_EXPORT_EX(sound_handle, AXInit, AXInit_old);
OS_FIND_EXPORT_EX(sound_handle, AXQuit, AXQuit_old); OS_FIND_EXPORT_EX(sound_handle, AXQuit, AXQuit_old);
if (check_os_audio_transition_flag_old()) if (check_os_audio_transition_flag_old()) {
{
AXInit_old(); AXInit_old();
AXQuit_old(); AXQuit_old();
} }

View File

@ -38,12 +38,14 @@ EXPORT_DECL(void, n_curl_formfree, struct curl_httppost *form);
EXPORT_DECL(struct curl_slist *, n_curl_slist_append, struct curl_slist *list, const char *string); EXPORT_DECL(struct curl_slist *, n_curl_slist_append, struct curl_slist *list, const char *string);
EXPORT_DECL(void, n_curl_slist_free_all, struct curl_slist *list); EXPORT_DECL(void, n_curl_slist_free_all, struct curl_slist *list);
void InitAcquireCurl(void){ void InitAcquireCurl(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nlibcurl", &libcurl_handle); OSDynLoad_Acquire("nlibcurl", &libcurl_handle);
} }
void InitCurlFunctionPointers(void){ void InitCurlFunctionPointers(void) {
InitAcquireCurl(); InitAcquireCurl();
u32 *funcPointer = 0; u32 *funcPointer = 0;

View File

@ -36,14 +36,13 @@ extern "C" {
typedef struct FSClient_ { typedef struct FSClient_ {
u8 buffer[FS_CLIENT_SIZE]; u8 buffer[FS_CLIENT_SIZE];
}FSClient; } FSClient;
typedef struct FSCmdBlock_ { typedef struct FSCmdBlock_ {
u8 buffer[FS_CMD_BLOCK_SIZE]; u8 buffer[FS_CMD_BLOCK_SIZE];
} FSCmdBlock; } FSCmdBlock;
typedef struct typedef struct {
{
u32 flag; u32 flag;
u32 permission; u32 permission;
u32 owner_id; u32 owner_id;
@ -57,28 +56,26 @@ typedef struct
u8 attributes[48]; u8 attributes[48];
} __attribute__((packed)) FSStat; } __attribute__((packed)) FSStat;
typedef struct typedef struct {
{
FSStat stat; FSStat stat;
char name[FS_MAX_ENTNAME_SIZE]; char name[FS_MAX_ENTNAME_SIZE];
} FSDirEntry; } FSDirEntry;
typedef void (*FSAsyncCallback)(FSClient * pClient, FSCmdBlock * pCmd, s32 result, void *context); typedef void (*FSAsyncCallback)(FSClient * pClient, FSCmdBlock * pCmd, s32 result, void *context);
typedef struct typedef struct {
{
FSAsyncCallback userCallback; FSAsyncCallback userCallback;
void *userContext; void *userContext;
OSMessageQueue *ioMsgQueue; OSMessageQueue *ioMsgQueue;
} FSAsyncParams; } FSAsyncParams;
typedef struct{ typedef struct {
void* data; // pointer to a FSAsyncResult; void* data; // pointer to a FSAsyncResult;
u32 unkwn1; u32 unkwn1;
u32 unkwn2; u32 unkwn2;
u32 unkwn3; // always 0x08 u32 unkwn3; // always 0x08
} __attribute__((packed)) FSMessage; } __attribute__((packed)) FSMessage;
typedef struct FSAsyncResult_{ typedef struct FSAsyncResult_ {
FSAsyncParams userParams; FSAsyncParams userParams;
FSMessage ioMsg; FSMessage ioMsg;

View File

@ -78,8 +78,10 @@ EXPORT_DECL(s32, FSMakeQuotaAsync ,void *pClient, void *pCmd, const char *path,u
EXPORT_DECL(s32, FSGetCwd,void * client,void * block,char * buffer,u32 bufferSize,u32 flags); EXPORT_DECL(s32, FSGetCwd,void * client,void * block,char * buffer,u32 bufferSize,u32 flags);
void InitFSFunctionPointers(void){ void InitFSFunctionPointers(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
u32 *funcPointer = 0; u32 *funcPointer = 0;
OS_FIND_EXPORT(coreinit_handle, FSInit); OS_FIND_EXPORT(coreinit_handle, FSInit);

View File

@ -82,8 +82,8 @@ EXPORT_DECL(void, GX2SetDRCEnable, s32 enable);
EXPORT_DECL(void, GX2SetPolygonControl, s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset); EXPORT_DECL(void, GX2SetPolygonControl, s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset);
EXPORT_DECL(void, GX2SetCullOnlyControl, s32 front_face_mode, s32 cull_front, s32 cull_back); EXPORT_DECL(void, GX2SetCullOnlyControl, s32 front_face_mode, s32 cull_front, s32 cull_back);
EXPORT_DECL(void, GX2SetDepthStencilControl, s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable, EXPORT_DECL(void, GX2SetDepthStencilControl, s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable,
s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail, s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail,
s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail); s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail);
EXPORT_DECL(void, GX2SetStencilMask, u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back); EXPORT_DECL(void, GX2SetStencilMask, u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back);
EXPORT_DECL(void, GX2SetLineWidth, f32 width); EXPORT_DECL(void, GX2SetLineWidth, f32 width);
EXPORT_DECL(void, GX2SetTVGamma, f32 val); EXPORT_DECL(void, GX2SetTVGamma, f32 val);
@ -102,12 +102,14 @@ EXPORT_DECL(void, GX2ResolveAAColorBuffer, const GX2ColorBuffer * srcBuffer, GX2
EXPORT_DECL(void, GX2ClearBuffersEx, GX2ColorBuffer * colorBuffer,GX2DepthBuffer * depthBuffer,f32 r, f32 g, f32 b, f32 a,f32 depthValue,u8 stencilValue,s32 clearFlags); EXPORT_DECL(void, GX2ClearBuffersEx, GX2ColorBuffer * colorBuffer,GX2DepthBuffer * depthBuffer,f32 r, f32 g, f32 b, f32 a,f32 depthValue,u8 stencilValue,s32 clearFlags);
void InitAcquireGX2(void){ void InitAcquireGX2(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("gx2.rpl", &gx2_handle); OSDynLoad_Acquire("gx2.rpl", &gx2_handle);
} }
void InitGX2FunctionPointers(void){ void InitGX2FunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireGX2(); InitAcquireGX2();

View File

@ -92,8 +92,8 @@ extern void (* GX2SetDRCEnable)(s32 enable);
extern void (* GX2SetPolygonControl)(s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset); extern void (* GX2SetPolygonControl)(s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset);
extern void (* GX2SetCullOnlyControl)(s32 front_face_mode, s32 cull_front, s32 cull_back); extern void (* GX2SetCullOnlyControl)(s32 front_face_mode, s32 cull_front, s32 cull_back);
extern void (* GX2SetDepthStencilControl)(s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable, extern void (* GX2SetDepthStencilControl)(s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable,
s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail, s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail,
s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail); s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail);
extern void (* GX2SetStencilMask)(u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back); extern void (* GX2SetStencilMask)(u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back);
extern void (* GX2SetLineWidth)(f32 width); extern void (* GX2SetLineWidth)(f32 width);
extern void (* GX2SetTVGamma)(f32 val); extern void (* GX2SetTVGamma)(f32 val);
@ -110,8 +110,7 @@ extern void (*GX2CallDisplayList)(void * list, u32 size);
extern void (*GX2ExpandAAColorBuffer)(GX2ColorBuffer * buffer); extern void (*GX2ExpandAAColorBuffer)(GX2ColorBuffer * buffer);
extern void (*GX2ResolveAAColorBuffer)(const GX2ColorBuffer * srcBuffer, GX2Surface * dstSurface,u32 dstMip,u32 dstSlice); extern void (*GX2ResolveAAColorBuffer)(const GX2ColorBuffer * srcBuffer, GX2Surface * dstSurface,u32 dstMip,u32 dstSlice);
static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa) static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa) {
{
depthBuffer->surface.dimension = dimension; depthBuffer->surface.dimension = dimension;
depthBuffer->surface.width = width; depthBuffer->surface.width = width;
depthBuffer->surface.height = height; depthBuffer->surface.height = height;
@ -133,8 +132,7 @@ static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, s32 dimension
GX2InitDepthBufferRegs(depthBuffer); GX2InitDepthBufferRegs(depthBuffer);
} }
static inline void GX2InitColorBuffer(GX2ColorBuffer *colorBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa) static inline void GX2InitColorBuffer(GX2ColorBuffer *colorBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa) {
{
colorBuffer->surface.dimension = dimension; colorBuffer->surface.dimension = dimension;
colorBuffer->surface.width = width; colorBuffer->surface.width = width;
colorBuffer->surface.height = height; colorBuffer->surface.height = height;
@ -166,8 +164,7 @@ static inline void GX2InitColorBuffer(GX2ColorBuffer *colorBuffer, s32 dimension
GX2InitColorBufferRegs(colorBuffer); GX2InitColorBufferRegs(colorBuffer);
} }
static inline void GX2InitAttribStream(GX2AttribStream* attr, u32 location, u32 buffer, u32 offset, s32 format) static inline void GX2InitAttribStream(GX2AttribStream* attr, u32 location, u32 buffer, u32 offset, s32 format) {
{
attr->location = location; attr->location = location;
attr->buffer = buffer; attr->buffer = buffer;
attr->offset = offset; attr->offset = offset;
@ -178,8 +175,7 @@ static inline void GX2InitAttribStream(GX2AttribStream* attr, u32 location, u32
attr->endian_swap = GX2_ENDIANSWAP_DEFAULT; attr->endian_swap = GX2_ENDIANSWAP_DEFAULT;
} }
static inline void GX2InitTexture(GX2Texture *tex, u32 width, u32 height, u32 depth, u32 num_mips, s32 format, s32 dimension, s32 tile) static inline void GX2InitTexture(GX2Texture *tex, u32 width, u32 height, u32 depth, u32 num_mips, s32 format, s32 dimension, s32 tile) {
{
tex->surface.dimension = dimension; tex->surface.dimension = dimension;
tex->surface.width = width; tex->surface.width = width;
tex->surface.height = height; tex->surface.height = height;

View File

@ -590,8 +590,7 @@ typedef struct _GX2FetchShader {
u32 divisor[3]; u32 divisor[3];
} GX2FetchShader; } GX2FetchShader;
typedef struct _GX2AttribVar typedef struct _GX2AttribVar {
{
const char *name; const char *name;
s32 var_type; s32 var_type;
u32 array_count; u32 array_count;
@ -610,15 +609,13 @@ typedef struct _GX2UniformInitialValue {
u32 offset; u32 offset;
} GX2UniformInitialValue; } GX2UniformInitialValue;
typedef struct _GX2SamplerVar typedef struct _GX2SamplerVar {
{
const char *name; const char *name;
s32 sampler_type; s32 sampler_type;
u32 location; u32 location;
} GX2SamplerVar; } GX2SamplerVar;
typedef struct _GX2UniformVar typedef struct _GX2UniformVar {
{
const char *name; const char *name;
s32 var_type; s32 var_type;
u32 array_count; u32 array_count;

View File

@ -26,12 +26,14 @@
u32 nfp_handle __attribute__((section(".data"))) = 0; u32 nfp_handle __attribute__((section(".data"))) = 0;
void InitAcquireNFP(void){ void InitAcquireNFP(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nn_nfp.rpl", &nfp_handle); OSDynLoad_Acquire("nn_nfp.rpl", &nfp_handle);
} }
void InitNFPFunctionPointers(void){ void InitNFPFunctionPointers(void) {
// u32 *funcPointer = 0; // u32 *funcPointer = 0;
InitAcquireNFP(); InitAcquireNFP();
} }

View File

@ -32,12 +32,14 @@ EXPORT_DECL(u8, nn_act_GetSlotNo, void);
EXPORT_DECL(u8, nn_act_GetDefaultAccount, void); EXPORT_DECL(u8, nn_act_GetDefaultAccount, void);
EXPORT_DECL(u32, nn_act_GetPersistentIdEx, u8 slot); EXPORT_DECL(u32, nn_act_GetPersistentIdEx, u8 slot);
void InitAcquireACT(void){ void InitAcquireACT(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle); OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle);
} }
void InitACTFunctionPointers(void){ void InitACTFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireACT(); InitAcquireACT();

View File

@ -26,12 +26,14 @@
u32 nn_nim_handle __attribute__((section(".data"))) = 0; u32 nn_nim_handle __attribute__((section(".data"))) = 0;
void InitAcquireNim(void){ void InitAcquireNim(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nn_nim.rpl", &nn_nim_handle); OSDynLoad_Acquire("nn_nim.rpl", &nn_nim_handle);
} }
void InitNimFunctionPointers(void){ void InitNimFunctionPointers(void) {
// u32 *funcPointer = 0; // u32 *funcPointer = 0;
InitAcquireNim(); InitAcquireNim();
} }

View File

@ -30,12 +30,14 @@ u32 nn_save_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, SAVEInit, void); EXPORT_DECL(void, SAVEInit, void);
EXPORT_DECL(int, SAVEOpenFile, void *pClient, void *pCmd, unsigned char user, const char *path, const char *mode, int *fd, int errHandling); EXPORT_DECL(int, SAVEOpenFile, void *pClient, void *pCmd, unsigned char user, const char *path, const char *mode, int *fd, int errHandling);
void InitAcquireSave(void){ void InitAcquireSave(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nn_save.rpl", &nn_save_handle); OSDynLoad_Acquire("nn_save.rpl", &nn_save_handle);
} }
void InitSaveFunctionPointers(void){ void InitSaveFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireSave(); InitAcquireSave();
OS_FIND_EXPORT(nn_save_handle, SAVEInit); OS_FIND_EXPORT(nn_save_handle, SAVEInit);

View File

@ -26,12 +26,14 @@
u32 ntag_handle __attribute__((section(".data"))) = 0; u32 ntag_handle __attribute__((section(".data"))) = 0;
void InitAcquireNTAG(void){ void InitAcquireNTAG(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("ntag.rpl", &ntag_handle); OSDynLoad_Acquire("ntag.rpl", &ntag_handle);
} }
void InitNTAGFunctionPointers(void){ void InitNTAGFunctionPointers(void) {
// u32 *funcPointer = 0; // u32 *funcPointer = 0;
InitAcquireNTAG(); InitAcquireNTAG();
} }

View File

@ -5,8 +5,7 @@
extern "C" { extern "C" {
#endif #endif
typedef struct _OsSpecifics typedef struct _OsSpecifics {
{
unsigned int addr_OSDynLoad_Acquire; unsigned int addr_OSDynLoad_Acquire;
unsigned int addr_OSDynLoad_FindExport; unsigned int addr_OSDynLoad_FindExport;
unsigned int addr_OSTitle_main_entry; unsigned int addr_OSTitle_main_entry;
@ -18,8 +17,7 @@ typedef struct _OsSpecifics
unsigned int addr_KernSyscallTbl5; unsigned int addr_KernSyscallTbl5;
} OsSpecifics; } OsSpecifics;
typedef struct _s_mem_area typedef struct _s_mem_area {
{
unsigned int address; unsigned int address;
unsigned int size; unsigned int size;
struct _s_mem_area* next; struct _s_mem_area* next;

View File

@ -204,8 +204,7 @@ EXPORT_DECL(s32, IOS_IoctlAsync,s32 fd, u32 request, void *input_buffer,u32 inpu
EXPORT_DECL(s32, IOS_Open,char *path, u32 mode); EXPORT_DECL(s32, IOS_Open,char *path, u32 mode);
EXPORT_DECL(s32, IOS_Close,s32 fd); EXPORT_DECL(s32, IOS_Close,s32 fd);
void _os_find_export(u32 handle, const char *funcName, void *funcPointer) void _os_find_export(u32 handle, const char *funcName, void *funcPointer) {
{
OSDynLoad_FindExport(handle, 0, funcName, funcPointer); OSDynLoad_FindExport(handle, 0, funcName, funcPointer);
if(!*(u32 *)funcPointer) { if(!*(u32 *)funcPointer) {
@ -235,7 +234,7 @@ void _os_find_export(u32 handle, const char *funcName, void *funcPointer)
} }
} }
void InitAcquireOS(void){ void InitAcquireOS(void) {
//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Lib handle functions //! Lib handle functions
//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -245,7 +244,7 @@ void InitAcquireOS(void){
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
} }
void InitOSFunctionPointers(void){ void InitOSFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireOS(); InitAcquireOS();
@ -406,8 +405,7 @@ void InitOSFunctionPointers(void){
//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Special non library functions //! Special non library functions
//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if(OS_FIRMWARE == 550) if(OS_FIRMWARE == 550) {
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x01010180); EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x01010180);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0101006C); EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0101006C);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x0100080C); EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x0100080C);
@ -415,9 +413,7 @@ void InitOSFunctionPointers(void){
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19E80); EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19E80);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13DBC); EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13DBC);
} } else if(OS_FIRMWARE == 532 || OS_FIRMWARE == 540) {
else if(OS_FIRMWARE == 532 || OS_FIRMWARE == 540)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100FFA4); // loader.elf EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100FFA4); // loader.elf
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100FE90); // loader.elf EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100FE90); // loader.elf
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007EC); // loader.elf EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007EC); // loader.elf
@ -425,9 +421,7 @@ void InitOSFunctionPointers(void){
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19D00); // loader.elf EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19D00); // loader.elf
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13C3C); // loader.elf EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13C3C); // loader.elf
} } else if(OS_FIRMWARE == 500 || OS_FIRMWARE == 510) {
else if(OS_FIRMWARE == 500 || OS_FIRMWARE == 510)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100FBC4); EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100FBC4);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100FAB0); EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100FAB0);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007EC); EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007EC);
@ -435,9 +429,7 @@ void InitOSFunctionPointers(void){
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19D00); EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19D00);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13C3C); EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13C3C);
} } else if(OS_FIRMWARE == 410) {
else if(OS_FIRMWARE == 410)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100F78C); EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100F78C);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100F678); EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100F678);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007F8); EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007F8);
@ -445,9 +437,7 @@ void InitOSFunctionPointers(void){
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19CC0); EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19CC0);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13BFC); EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13BFC);
} } else if(OS_FIRMWARE == 400) { //same for 402 and 403
else if(OS_FIRMWARE == 400) //same for 402 and 403
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100F78C); EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100F78C);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100F678); EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100F678);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007F8); EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010007F8);
@ -455,9 +445,7 @@ void InitOSFunctionPointers(void){
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19CC0); EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19CC0);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13BFC); EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE13BFC);
} } else if(OS_FIRMWARE == 310) {
else if(OS_FIRMWARE == 310)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100C4E4); EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100C4E4);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100C3D4); EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100C3D4);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010004D8); EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010004D8);
@ -465,9 +453,7 @@ void InitOSFunctionPointers(void){
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19340); EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19340);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE1329C); EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE1329C);
} } else if(OS_FIRMWARE == 300) {
else if(OS_FIRMWARE == 300)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100C4E4); EXPORT_FUNC_WRITE(LiWaitIopComplete, (s32 (*)(s32, s32 *))0x0100C4E4);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100C3D4); EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (s32 (*)(s32, s32 *))0x0100C3D4);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010004D8); EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (s32 (*)(s32, s32 *))0x010004D8);
@ -475,9 +461,7 @@ void InitOSFunctionPointers(void){
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19340); EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (s32 (*)(s32, s32 *))0xEFE19340);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE1329C); EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (s32 (*)(s32, s32 *))0xEFE1329C);
} } else {
else
{
OSFatal("Missing all OS specific addresses."); OSFatal("Missing all OS specific addresses.");
} }
} }

View File

@ -82,7 +82,7 @@ typedef struct OSMessage_ {
u32 data0; u32 data0;
u32 data1; u32 data1;
u32 data2; u32 data2;
}OSMessage; } OSMessage;
typedef struct OSMessageQueue_ { typedef struct OSMessageQueue_ {
u32 tag; u32 tag;
@ -140,23 +140,22 @@ typedef struct OSContext_ {
u32 mmcr1; u32 mmcr1;
} OSContext; } OSContext;
typedef enum OSExceptionType typedef enum OSExceptionType {
{ OS_EXCEPTION_TYPE_SYSTEM_RESET = 0,
OS_EXCEPTION_TYPE_SYSTEM_RESET = 0, OS_EXCEPTION_TYPE_MACHINE_CHECK = 1,
OS_EXCEPTION_TYPE_MACHINE_CHECK = 1, OS_EXCEPTION_TYPE_DSI = 2,
OS_EXCEPTION_TYPE_DSI = 2, OS_EXCEPTION_TYPE_ISI = 3,
OS_EXCEPTION_TYPE_ISI = 3, OS_EXCEPTION_TYPE_EXTERNAL_INTERRUPT = 4,
OS_EXCEPTION_TYPE_EXTERNAL_INTERRUPT = 4, OS_EXCEPTION_TYPE_ALIGNMENT = 5,
OS_EXCEPTION_TYPE_ALIGNMENT = 5, OS_EXCEPTION_TYPE_PROGRAM = 6,
OS_EXCEPTION_TYPE_PROGRAM = 6, OS_EXCEPTION_TYPE_FLOATING_POINT = 7,
OS_EXCEPTION_TYPE_FLOATING_POINT = 7, OS_EXCEPTION_TYPE_DECREMENTER = 8,
OS_EXCEPTION_TYPE_DECREMENTER = 8, OS_EXCEPTION_TYPE_SYSTEM_CALL = 9,
OS_EXCEPTION_TYPE_SYSTEM_CALL = 9, OS_EXCEPTION_TYPE_TRACE = 10,
OS_EXCEPTION_TYPE_TRACE = 10, OS_EXCEPTION_TYPE_PERFORMANCE_MONITOR = 11,
OS_EXCEPTION_TYPE_PERFORMANCE_MONITOR = 11, OS_EXCEPTION_TYPE_BREAKPOINT = 12,
OS_EXCEPTION_TYPE_BREAKPOINT = 12, OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13,
OS_EXCEPTION_TYPE_SYSTEM_INTERRUPT = 13, OS_EXCEPTION_TYPE_ICI = 14,
OS_EXCEPTION_TYPE_ICI = 14,
} OSExceptionType; } OSExceptionType;
typedef int (*ThreadFunc)(int argc, void *argv); typedef int (*ThreadFunc)(int argc, void *argv);
@ -184,29 +183,29 @@ struct OSThread_ {
}; };
typedef struct _OSCalendarTime { typedef struct _OSCalendarTime {
int sec; int sec;
int min; int min;
int hour; int hour;
int mday; int mday;
int mon; int mon;
int year; int year;
int wday; int wday;
int yday; int yday;
int msec; int msec;
int usec; int usec;
} OSCalendarTime; } OSCalendarTime;
typedef struct MCPTitleListType{ typedef struct MCPTitleListType {
u64 titleId; u64 titleId;
u8 unknwn[4]; u8 unknwn[4];
s8 path[56]; s8 path[56];
u32 appType; u32 appType;
u8 unknwn1[0x54 - 0x48]; u8 unknwn1[0x54 - 0x48];
u8 device; u8 device;
u8 unknwn2; u8 unknwn2;
s8 indexedDevice[10]; s8 indexedDevice[10];
u8 unk0x60; u8 unk0x60;
} MCPTitleListType; } MCPTitleListType;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -37,12 +37,14 @@ EXPORT_DECL(s32, KPADReadEx, s32 chan, KPADData * data, u32 size, s32 *error);
EXPORT_DECL(void,WPADSetAutoSleepTime,u8 minute); EXPORT_DECL(void,WPADSetAutoSleepTime,u8 minute);
EXPORT_DECL(void,WPADDisconnect,s32 chan); EXPORT_DECL(void,WPADDisconnect,s32 chan);
void InitAcquirePadScore(void){ void InitAcquirePadScore(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("padscore.rpl", &padscore_handle); OSDynLoad_Acquire("padscore.rpl", &padscore_handle);
} }
void InitPadScoreFunctionPointers(void){ void InitPadScoreFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquirePadScore(); InitAcquirePadScore();

View File

@ -103,8 +103,7 @@ extern u32 padscore_handle;
#define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000 #define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000
#define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000 #define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000
typedef struct _KPADData typedef struct _KPADData {
{
u32 btns_h; u32 btns_h;
u32 btns_d; u32 btns_d;
u32 btns_r; u32 btns_r;
@ -133,16 +132,13 @@ typedef struct _KPADData
s8 pos_valid; s8 pos_valid;
u8 format; u8 format;
union union {
{ struct {
struct
{
f32 stick_x; f32 stick_x;
f32 stick_y; f32 stick_y;
} nunchuck; } nunchuck;
struct struct {
{
u32 btns_h; u32 btns_h;
u32 btns_d; u32 btns_d;
u32 btns_r; u32 btns_r;
@ -154,8 +150,7 @@ typedef struct _KPADData
f32 rtrigger; f32 rtrigger;
} classic; } classic;
struct struct {
{
u32 btns_h; u32 btns_h;
u32 btns_d; u32 btns_d;
u32 btns_r; u32 btns_r;
@ -184,7 +179,7 @@ typedef struct WPADReadData_ {
s16 r_stick_y; s16 r_stick_y;
u8 unknown2[8]; u8 unknown2[8];
u8 fmt; u8 fmt;
}WPADReadData; } WPADReadData;
typedef WPADReadData KPADUnifiedWpadData; typedef WPADReadData KPADUnifiedWpadData;

View File

@ -29,12 +29,14 @@ u32 proc_ui_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(u32, ProcUIInForeground, void); EXPORT_DECL(u32, ProcUIInForeground, void);
EXPORT_DECL(void, ProcUIRegisterCallback, u32 type,ProcUICallback callback,void* param, u32 unkwn); EXPORT_DECL(void, ProcUIRegisterCallback, u32 type,ProcUICallback callback,void* param, u32 unkwn);
void InitAcquireProcUI(void){ void InitAcquireProcUI(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("proc_ui.rpl", &proc_ui_handle); OSDynLoad_Acquire("proc_ui.rpl", &proc_ui_handle);
} }
void InitProcUIFunctionPointers(void){ void InitProcUIFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireProcUI(); InitAcquireProcUI();

View File

@ -52,12 +52,14 @@ EXPORT_DECL(s32, NSSLWrite, s32 connection, const void* buf, s32 len,s32 * writt
EXPORT_DECL(s32, NSSLRead, s32 connection, const void* buf, s32 len,s32 * read); EXPORT_DECL(s32, NSSLRead, s32 connection, const void* buf, s32 len,s32 * read);
EXPORT_DECL(s32, NSSLCreateConnection, s32 context, const char* host, s32 hotlen,s32 options,s32 sock,s32 block); EXPORT_DECL(s32, NSSLCreateConnection, s32 context, const char* host, s32 hotlen,s32 options,s32 sock,s32 block);
void InitAcquireSocket(void){ void InitAcquireSocket(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle); OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle);
} }
void InitSocketFunctionPointers(void){ void InitSocketFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireSocket(); InitAcquireSocket();

View File

@ -77,10 +77,9 @@ struct sockaddr_in {
char sin_zero[8]; char sin_zero[8];
}; };
struct sockaddr struct sockaddr {
{ unsigned short sa_family;
unsigned short sa_family; char sa_data[14];
char sa_data[14];
}; };

View File

@ -33,12 +33,14 @@ EXPORT_DECL(s32, SYSCheckTitleExists, u64 titleId);
EXPORT_DECL(s32, SYSLaunchTitle, u64 titleId); EXPORT_DECL(s32, SYSLaunchTitle, u64 titleId);
EXPORT_DECL(s32, SYSLaunchSettings, s32 unk); EXPORT_DECL(s32, SYSLaunchSettings, s32 unk);
void InitAcquireSys(void){ void InitAcquireSys(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle);
} }
void InitSysFunctionPointers(void){ void InitSysFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireSys(); InitAcquireSys();

View File

@ -46,15 +46,17 @@ EXPORT_DECL(s32, HIDSetIdle,u32 handle, u8 s32erface_index,u8 duration, HIDCallb
EXPORT_DECL(s32, HIDRead,u32 handle, unsigned char *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); EXPORT_DECL(s32, HIDRead,u32 handle, unsigned char *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
EXPORT_DECL(s32, HIDWrite,u32 handle, unsigned char *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); EXPORT_DECL(s32, HIDWrite,u32 handle, unsigned char *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
void InitAcquireSysHID(void){ void InitAcquireSysHID(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
OSDynLoad_Acquire("nsyshid.rpl", &syshid_handle); InitAcquireOS();
};
OSDynLoad_Acquire("nsyshid.rpl", &syshid_handle);
} }
void InitSysHIDFunctionPointers(void){ void InitSysHIDFunctionPointers(void) {
InitAcquireSysHID(); InitAcquireSysHID();
if(syshid_handle == 0){ if(syshid_handle == 0) {
return; return;
} }

View File

@ -32,8 +32,7 @@ extern "C" {
extern u32 syshid_handle; extern u32 syshid_handle;
typedef struct typedef struct {
{
u32 handle; u32 handle;
u32 physical_device_inst; u32 physical_device_inst;
u16 vid; u16 vid;
@ -54,8 +53,7 @@ typedef struct _HIDClient HIDClient;
typedef s32 (*HIDAttachCallback)(HIDClient *p_hc,HIDDevice *p_hd,u32 attach); typedef s32 (*HIDAttachCallback)(HIDClient *p_hc,HIDDevice *p_hd,u32 attach);
struct _HIDClient struct _HIDClient {
{
HIDClient *next; HIDClient *next;
HIDAttachCallback attach_cb; HIDAttachCallback attach_cb;
}; };

View File

@ -90,13 +90,15 @@ EXPORT_DECL(void, VPADBASESetSensorBarSetting, s32 chan, s8 setting);
EXPORT_DECL(void, VPADBASEGetSensorBarSetting, s32 chan, s8 *setting); EXPORT_DECL(void, VPADBASEGetSensorBarSetting, s32 chan, s8 *setting);
EXPORT_DECL(s32, VPADSetSensorBar, s32 chan, bool on); EXPORT_DECL(s32, VPADSetSensorBar, s32 chan, bool on);
void InitAcquireVPad(void){ void InitAcquireVPad(void) {
if(coreinit_handle == 0){ InitAcquireOS(); }; if(coreinit_handle == 0) {
InitAcquireOS();
};
OSDynLoad_Acquire("vpad.rpl", &vpad_handle); OSDynLoad_Acquire("vpad.rpl", &vpad_handle);
OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle); OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle);
} }
void InitVPadFunctionPointers(void){ void InitVPadFunctionPointers(void) {
u32 *funcPointer = 0; u32 *funcPointer = 0;
InitAcquireVPad(); InitAcquireVPad();

View File

@ -68,52 +68,44 @@ extern u32 vpadbase_handle;
#define VPAD_MASK_EMULATED_STICKS 0x7F800000 #define VPAD_MASK_EMULATED_STICKS 0x7F800000
#define VPAD_MASK_BUTTONS ~VPAD_MASK_EMULATED_STICKS #define VPAD_MASK_BUTTONS ~VPAD_MASK_EMULATED_STICKS
typedef enum VPADTPResolution typedef enum VPADTPResolution {
{
VPAD_TP_1920x1080, VPAD_TP_1920x1080,
VPAD_TP_1280x720, VPAD_TP_1280x720,
VPAD_TP_854x480 VPAD_TP_854x480
} VPADTPResolution; } VPADTPResolution;
typedef enum VPADGyroZeroDriftMode typedef enum VPADGyroZeroDriftMode {
{
VPAD_GYRO_ZERODRIFT_LOOSE, VPAD_GYRO_ZERODRIFT_LOOSE,
VPAD_GYRO_ZERODRIFT_STANDARD, VPAD_GYRO_ZERODRIFT_STANDARD,
VPAD_GYRO_ZERODRIFT_TIGHT VPAD_GYRO_ZERODRIFT_TIGHT
} VPADGyroZeroDriftMode; } VPADGyroZeroDriftMode;
typedef struct typedef struct {
{
f32 x,y; f32 x,y;
} Vec2D; } Vec2D;
typedef struct typedef struct {
{
f32 x,y,z; f32 x,y,z;
} Vec3D; } Vec3D;
typedef struct typedef struct {
{
Vec3D X,Y,Z; Vec3D X,Y,Z;
} VPADDir; } VPADDir;
typedef struct typedef struct {
{
u16 x, y; /* Touch coordinates */ u16 x, y; /* Touch coordinates */
u16 touched; /* 1 = Touched, 0 = Not touched */ u16 touched; /* 1 = Touched, 0 = Not touched */
u16 invalid; /* 0 = All valid, 1 = X invalid, 2 = Y invalid, 3 = Both invalid? */ u16 invalid; /* 0 = All valid, 1 = X invalid, 2 = Y invalid, 3 = Both invalid? */
} VPADTPData; } VPADTPData;
typedef struct typedef struct {
{
s16 offsetX; s16 offsetX;
s16 offsetY; s16 offsetY;
f32 scaleX; f32 scaleX;
f32 scaleY; f32 scaleY;
} VPADTPCalibrationParam; } VPADTPCalibrationParam;
typedef struct typedef struct {
{
u32 btns_h; /* Held buttons */ u32 btns_h; /* Held buttons */
u32 btns_d; /* Buttons that are pressed at that instant */ u32 btns_d; /* Buttons that are pressed at that instant */
u32 btns_r; /* Released buttons */ u32 btns_r; /* Released buttons */