mirror of
https://github.com/Maschell/dynamic_libs.git
synced 2024-11-14 17:05:16 +01:00
Added some more OS functions, added nn_save and nn_act acquire
This commit is contained in:
parent
50ee5c62b7
commit
048a585d5e
@ -31,6 +31,14 @@ extern "C" {
|
||||
#define FS_CLIENT_SIZE 0x1700
|
||||
#define FS_CMD_BLOCK_SIZE 0xA80
|
||||
|
||||
struct FSClient {
|
||||
u8 buffer[FS_CLIENT_SIZE];
|
||||
};
|
||||
|
||||
struct FSCmdBlock {
|
||||
u8 buffer[FS_CMD_BLOCK_SIZE];
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t flag;
|
||||
|
@ -76,6 +76,8 @@ EXPORT_DECL(s32, FSBindUnmount, void *pClient, void *pCmd, char *target, s32 err
|
||||
EXPORT_DECL(s32, FSMakeQuota, void *pClient, void *pCmd, const char *path,u32 mode, u64 size, s32 errHandling);
|
||||
EXPORT_DECL(s32, FSMakeQuotaAsync ,void *pClient, void *pCmd, const char *path,u32 mode, u64 size, s32 errHandling,const void *asyncParams);
|
||||
|
||||
EXPORT_DECL(s32, FSGetCwd,void * client,void * block,char * buffer,u32 bufferSize,u32 flags);
|
||||
|
||||
void InitFSFunctionPointers(void)
|
||||
{
|
||||
u32 *funcPointer = 0;
|
||||
@ -132,4 +134,6 @@ void InitFSFunctionPointers(void)
|
||||
|
||||
OS_FIND_EXPORT(coreinit_handle, FSMakeQuota);
|
||||
OS_FIND_EXPORT(coreinit_handle, FSMakeQuotaAsync);
|
||||
|
||||
OS_FIND_EXPORT(coreinit_handle, FSGetCwd);
|
||||
}
|
||||
|
@ -89,6 +89,8 @@ extern s32 (* FSBindUnmount)(void *pClient, void *pCmd, char *target, s32 error)
|
||||
extern s32 (* FSMakeQuota)( void *pClient, void *pCmd, const char *path,u32 mode, u64 size, s32 errHandling);
|
||||
extern s32 (* FSMakeQuotaAsync)(void *pClient, void *pCmd, const char *path,u32 mode, u64 size, s32 errHandling,const void *asyncParams);
|
||||
|
||||
extern s32 (* FSGetCwd)(void * client,void * block,char * buffer,u32 bufferSize,u32 flags);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
48
nn_act_functions.c
Normal file
48
nn_act_functions.c
Normal file
@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
* 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 "nn_act_functions.h"
|
||||
|
||||
u32 nn_act_handle __attribute__((section(".data"))) = 0;
|
||||
|
||||
EXPORT_DECL(void, nn_act_Initialize, void);
|
||||
EXPORT_DECL(void, nn_act_Finalize, void);
|
||||
EXPORT_DECL(u8, nn_act_GetSlotNo, void);
|
||||
EXPORT_DECL(u32, nn_act_GetPersistentIdEx, u8 slot);
|
||||
|
||||
void InitAcquireACT(void)
|
||||
{
|
||||
OSDynLoad_Acquire("nn_act.rpl", &nn_act_handle);
|
||||
}
|
||||
|
||||
void InitACTFunctionPointers(void)
|
||||
{
|
||||
u32 *funcPointer = 0;
|
||||
InitAcquireACT();
|
||||
|
||||
OS_FIND_EXPORT_EX(nn_act_handle, Initialize__Q2_2nn3actFv, nn_act_Initialize)
|
||||
OS_FIND_EXPORT_EX(nn_act_handle, Finalize__Q2_2nn3actFv, nn_act_Finalize)
|
||||
OS_FIND_EXPORT_EX(nn_act_handle, GetSlotNo__Q2_2nn3actFv, nn_act_GetSlotNo)
|
||||
OS_FIND_EXPORT_EX(nn_act_handle, GetPersistentIdEx__Q2_2nn3actFUc, nn_act_GetPersistentIdEx)
|
||||
}
|
47
nn_act_functions.h
Normal file
47
nn_act_functions.h
Normal file
@ -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 __NN_ACT_FUNCTIONS_H_
|
||||
#define __NN_ACT_FUNCTIONS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <gctypes.h>
|
||||
|
||||
extern u32 nn_act_handle;
|
||||
|
||||
extern void(* nn_act_Initialize)(void);
|
||||
extern void(* nn_act_Finalize)(void);
|
||||
extern u8(* nn_act_GetSlotNo)(void);
|
||||
extern u32(*nn_act_GetPersistentIdEx)(u8 slot);
|
||||
|
||||
void InitACTFunctionPointers(void);
|
||||
void InitAcquireACT(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __NN_ACT_FUNCTIONS_H_
|
44
nn_save_functions.c
Normal file
44
nn_save_functions.c
Normal file
@ -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 "nn_save_functions.h"
|
||||
|
||||
u32 nn_save_handle __attribute__((section(".data"))) = 0;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
void InitAcquireSave(void)
|
||||
{
|
||||
OSDynLoad_Acquire("nn_save.rpl", &nn_save_handle);
|
||||
}
|
||||
|
||||
void InitSaveFunctionPointers(void)
|
||||
{
|
||||
u32 *funcPointer = 0;
|
||||
InitAcquireSave();
|
||||
OS_FIND_EXPORT(nn_save_handle, SAVEInit);
|
||||
OS_FIND_EXPORT(nn_save_handle, SAVEOpenFile);
|
||||
}
|
45
nn_save_functions.h
Normal file
45
nn_save_functions.h
Normal file
@ -0,0 +1,45 @@
|
||||
/****************************************************************************
|
||||
* 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 __NN_SAVE_FUNCTIONS_H_
|
||||
#define __NN_SAVE_FUNCTIONS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <gctypes.h>
|
||||
|
||||
extern u32 nn_save_handle;
|
||||
|
||||
extern void(*SAVEInit)(void);
|
||||
extern int(*SAVEOpenFile)(void *pClient, void *pCmd, unsigned char user, const char *path, const char *mode, int *fd, int errHandling);
|
||||
|
||||
void InitSaveFunctionPointers(void);
|
||||
void InitAcquireSave(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __NN_SAVE_FUNCTIONS_H_
|
@ -40,21 +40,31 @@ EXPORT_DECL(s32, OSGetSecurityLevel, void);
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Thread functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
EXPORT_DECL(s32, OSCreateThread, void *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
|
||||
EXPORT_DECL(s32, OSResumeThread, void *thread);
|
||||
EXPORT_DECL(s32, OSSuspendThread, void *thread);
|
||||
EXPORT_DECL(s32, OSIsThreadTerminated, void *thread);
|
||||
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(s32, OSCreateThread, OSThread *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
|
||||
EXPORT_DECL(s32, OSResumeThread, OSThread *thread);
|
||||
EXPORT_DECL(s32, OSSuspendThread, OSThread *thread);
|
||||
EXPORT_DECL(s32, OSIsThreadTerminated, OSThread *thread);
|
||||
EXPORT_DECL(s32, OSIsThreadSuspended, OSThread *thread);
|
||||
EXPORT_DECL(s32, OSSetThreadPriority, OSThread * thread, s32 priority);
|
||||
EXPORT_DECL(s32, OSJoinThread, OSThread * thread, s32 * ret_val);
|
||||
EXPORT_DECL(void, OSDetachThread, OSThread * thread);
|
||||
EXPORT_DECL(OSThread *,OSGetCurrentThread,void);
|
||||
EXPORT_DECL(const char *,OSGetThreadName,OSThread * thread);
|
||||
EXPORT_DECL(void ,OSGetActiveThreadLink,OSThread * thread, void* link);
|
||||
EXPORT_DECL(u32 ,OSGetThreadAffinity,OSThread * thread);
|
||||
EXPORT_DECL(s32 ,OSGetThreadPriority,OSThread * thread);
|
||||
EXPORT_DECL(void ,OSSetThreadName,OSThread * thread, const char *name);
|
||||
EXPORT_DECL(void, OSSleepTicks, u64 ticks);
|
||||
EXPORT_DECL(u64, OSGetTick, void);
|
||||
EXPORT_DECL(u64, OSGetTime, void);
|
||||
EXPORT_DECL(void, OSTicksToCalendarTime, u64 time, OSCalendarTime * calendarTime);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Message functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
EXPORT_DECL(void,OSInitMessageQueue,OSMessageQueue *queue, OSMessage *messages, s32 size);
|
||||
EXPORT_DECL(u32,OSSendMessage,OSMessageQueue *queue, OSMessage *message, s32 flags);
|
||||
EXPORT_DECL(u32,OSReceiveMessage,OSMessageQueue *queue, OSMessage *message, s32 flags);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Mutex functions
|
||||
@ -71,7 +81,9 @@ EXPORT_DECL(u64, OSGetTitleID, void);
|
||||
EXPORT_DECL(void, OSGetArgcArgv, s32* argc, char*** argv);
|
||||
EXPORT_DECL(void, __Exit, void);
|
||||
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);
|
||||
EXPORT_DECL(void *, OSSetExceptionCallbackEx, s32 unkwn, u8 exceptionType, exception_callback newCallback);
|
||||
EXPORT_DECL(void , OSLoadContext, OSContext * context);
|
||||
EXPORT_DECL(void, DCFlushRange, const void *addr, u32 length);
|
||||
EXPORT_DECL(void, ICInvalidateRange, const void *addr, u32 length);
|
||||
EXPORT_DECL(void*, OSEffectiveToPhysical, const void*);
|
||||
@ -131,6 +143,7 @@ EXPORT_DECL(void, addr_PrepareTitle_hook, void);
|
||||
//! Other function addresses
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
EXPORT_DECL(void, DCInvalidateRange, void *buffer, u32 length);
|
||||
EXPORT_DECL(s32, OSDynLoad_GetModuleName, s32 handle, char *name_buffer, s32 *name_buffer_size);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Energy Saver functions
|
||||
@ -214,6 +227,8 @@ void InitOSFunctionPointers(void)
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetTitleID);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetArgcArgv);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSetExceptionCallback);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSetExceptionCallbackEx);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSLoadContext);
|
||||
OS_FIND_EXPORT(coreinit_handle, DCFlushRange);
|
||||
OS_FIND_EXPORT(coreinit_handle, ICInvalidateRange);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSEffectiveToPhysical);
|
||||
@ -243,11 +258,23 @@ void InitOSFunctionPointers(void)
|
||||
OS_FIND_EXPORT(coreinit_handle, OSDetachThread);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetCurrentThread);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetThreadName);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetActiveThreadLink);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetThreadAffinity);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetThreadPriority);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSetThreadName);
|
||||
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSleepTicks);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetTick);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSGetTime);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSTicksToCalendarTime);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Message functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
OS_FIND_EXPORT(coreinit_handle, OSInitMessageQueue);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSSendMessage);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSReceiveMessage);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Mutex functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -285,6 +312,7 @@ void InitOSFunctionPointers(void)
|
||||
//! Other function addresses
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
OS_FIND_EXPORT(coreinit_handle, DCInvalidateRange);
|
||||
OS_FIND_EXPORT(coreinit_handle, OSDynLoad_GetModuleName);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Energy Saver functions
|
||||
|
@ -79,22 +79,34 @@ extern s32 (* OSGetSecurityLevel)(void);
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Thread functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern s32 (* OSCreateThread)(void *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
|
||||
extern s32 (* OSResumeThread)(void *thread);
|
||||
extern s32 (* OSSuspendThread)(void *thread);
|
||||
extern s32 (* OSIsThreadTerminated)(void *thread);
|
||||
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 s32 (* OSCreateThread)(OSThread *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
|
||||
extern s32 (* OSResumeThread)(OSThread *thread);
|
||||
extern s32 (* OSSuspendThread)(OSThread *thread);
|
||||
extern s32 (* OSIsThreadTerminated)(OSThread *thread);
|
||||
extern s32 (* OSIsThreadSuspended)(OSThread *thread);
|
||||
extern s32 (* OSJoinThread)(OSThread * thread, s32 * ret_val);
|
||||
extern s32 (* OSSetThreadPriority)(OSThread * thread, s32 priority);
|
||||
extern void (* OSDetachThread)(OSThread * thread);
|
||||
extern OSThread * (* OSGetCurrentThread)(void);
|
||||
extern const char * (* OSGetThreadName)(OSThread * thread);
|
||||
|
||||
extern void (* OSGetActiveThreadLink)(OSThread * thread, void* link);
|
||||
extern u32 (* OSGetThreadAffinity)(OSThread * thread);
|
||||
extern s32 (* OSGetThreadPriority)(OSThread * thread);
|
||||
extern void (* OSSetThreadName)(OSThread * thread, const char *name);
|
||||
|
||||
extern void * (* OSGetCurrentThread)(void);
|
||||
extern const char * (* OSGetThreadName)(void * thread);
|
||||
extern void (* OSSleepTicks)(u64 ticks);
|
||||
extern u64 (* OSGetTick)(void);
|
||||
extern u64 (* OSGetTime)(void);
|
||||
extern void (*OSTicksToCalendarTime)(u64 time, OSCalendarTime *calendarTime);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Message functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern void(* OSInitMessageQueue)(OSMessageQueue *queue, OSMessage *messages, s32 size);
|
||||
extern u32(* OSSendMessage)(OSMessageQueue *queue, OSMessage *message, s32 flags);
|
||||
extern u32(* OSReceiveMessage)(OSMessageQueue *queue, OSMessage *message, s32 flags);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Mutex functions
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -125,8 +137,10 @@ extern s32 (*OSScreenPutFontEx)(u32 bufferNum, u32 posX, u32 posY, const char *
|
||||
extern s32 (*OSScreenEnableEx)(u32 bufferNum, s32 enable);
|
||||
extern u32 (*OSScreenPutPixelEx)(u32 bufferNum, u32 posX, u32 posY, u32 color);
|
||||
|
||||
typedef unsigned char (*exception_callback)(void * interruptedContext);
|
||||
extern void (* OSSetExceptionCallback)(u8 exceptionType, exception_callback newCallback);
|
||||
typedef unsigned char (*exception_callback)(OSContext * interruptedContext);
|
||||
extern void * (* OSSetExceptionCallback)(u8 exceptionType, exception_callback newCallback);
|
||||
extern void * (* OSSetExceptionCallbackEx)(s32 unknwn,u8 exceptionType, exception_callback newCallback);
|
||||
extern void (* OSLoadContext)(OSContext * context);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Memory functions
|
||||
@ -172,6 +186,7 @@ extern void (* addr_PrepareTitle_hook)(void);
|
||||
//! Other function addresses
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
extern void (*DCInvalidateRange)(void *buffer, u32 length);
|
||||
extern s32 (*OSDynLoad_GetModuleName)(s32 handle, char *name_buffer, s32 *name_buffer_size);
|
||||
|
||||
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//! Energy Saver functions
|
||||
|
111
os_types.h
111
os_types.h
@ -7,6 +7,116 @@ extern "C" {
|
||||
|
||||
#include <gctypes.h>
|
||||
|
||||
|
||||
#define OS_MESSAGE_NOBLOCK 0
|
||||
#define OS_MESSAGE_BLOCK 1
|
||||
|
||||
#define OS_EXCEPTION_DSI 2
|
||||
#define OS_EXCEPTION_ISI 3
|
||||
#define OS_EXCEPTION_PROGRAM 6
|
||||
#define OS_EXCEPTION_MODE_THREAD 1
|
||||
#define OS_EXCEPTION_MODE_GLOBAL_ALL_CORES 4
|
||||
|
||||
typedef struct OSThread_ OSThread;
|
||||
|
||||
struct OSThreadLink {
|
||||
OSThread *next;
|
||||
OSThread *prev;
|
||||
};
|
||||
|
||||
typedef struct OSThreadQueue_ {
|
||||
OSThread *head;
|
||||
OSThread *tail;
|
||||
void *parentStruct;
|
||||
u32 reserved;
|
||||
} OSThreadQueue;
|
||||
|
||||
typedef struct OSMessage_ {
|
||||
u32 message;
|
||||
u32 data0;
|
||||
u32 data1;
|
||||
u32 data2;
|
||||
}OSMessage;
|
||||
|
||||
typedef struct OSMessageQueue_ {
|
||||
u32 tag;
|
||||
char *name;
|
||||
u32 reserved;
|
||||
|
||||
OSThreadQueue sendQueue;
|
||||
OSThreadQueue recvQueue;
|
||||
OSMessage *messages;
|
||||
int msgCount;
|
||||
int firstIndex;
|
||||
int usedCount;
|
||||
} OSMessageQueue;
|
||||
|
||||
typedef struct OSContext_ {
|
||||
char tag[8];
|
||||
|
||||
u32 gpr[32];
|
||||
|
||||
u32 cr;
|
||||
u32 lr;
|
||||
u32 ctr;
|
||||
u32 xer;
|
||||
|
||||
u32 srr0;
|
||||
u32 srr1;
|
||||
|
||||
u32 ex0;
|
||||
u32 ex1;
|
||||
|
||||
u32 exception_type;
|
||||
u32 reserved;
|
||||
|
||||
double fpscr;
|
||||
double fpr[32];
|
||||
|
||||
u16 spinLockCount;
|
||||
u16 state;
|
||||
|
||||
u32 gqr[8];
|
||||
u32 pir;
|
||||
double psf[32];
|
||||
|
||||
u64 coretime[3];
|
||||
u64 starttime;
|
||||
|
||||
u32 error;
|
||||
u32 attributes;
|
||||
|
||||
u32 pmc1;
|
||||
u32 pmc2;
|
||||
u32 pmc3;
|
||||
u32 pmc4;
|
||||
u32 mmcr0;
|
||||
u32 mmcr1;
|
||||
} OSContext;
|
||||
|
||||
typedef int (*ThreadFunc)(int argc, void *argv);
|
||||
|
||||
struct OSThread_ {
|
||||
OSContext context;
|
||||
|
||||
u32 txtTag;
|
||||
u8 state;
|
||||
u8 attr;
|
||||
|
||||
short threadId;
|
||||
int suspend;
|
||||
int priority;
|
||||
|
||||
char _[0x394 - 0x330];
|
||||
|
||||
void *stackBase;
|
||||
void *stackEnd;
|
||||
|
||||
ThreadFunc entryPoint;
|
||||
|
||||
char _3A0[0x6A0 - 0x3A0];
|
||||
};
|
||||
|
||||
typedef struct _OSCalendarTime {
|
||||
int sec;
|
||||
int min;
|
||||
@ -20,6 +130,7 @@ typedef struct _OSCalendarTime {
|
||||
int usec;
|
||||
} OSCalendarTime;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -28,7 +28,8 @@ u32 hostIpAddress = 0;
|
||||
|
||||
u32 nsysnet_handle __attribute__((section(".data"))) = 0;
|
||||
|
||||
EXPORT_DECL(void, socket_lib_init, void);
|
||||
EXPORT_DECL(s32, socket_lib_init, void);
|
||||
EXPORT_DECL(s32, socket_lib_finish, void);
|
||||
EXPORT_DECL(s32, socket, s32 domain, s32 type, s32 protocol);
|
||||
EXPORT_DECL(s32, socketclose, s32 s);
|
||||
EXPORT_DECL(s32, connect, s32 s, void *addr, s32 addrlen);
|
||||
@ -42,6 +43,7 @@ EXPORT_DECL(s32, sendto, s32 s, const void *buffer, s32 size, s32 flags, const s
|
||||
EXPORT_DECL(s32, setsockopt, s32 s, s32 level, s32 optname, void *optval, s32 optlen);
|
||||
EXPORT_DECL(char *, inet_ntoa, struct in_addr in);
|
||||
EXPORT_DECL(s32, inet_aton, const char *cp, struct in_addr *inp);
|
||||
EXPORT_DECL(s32, socketlasterr, void);
|
||||
|
||||
EXPORT_DECL(s32, NSSLWrite, s32 connection, const void* buf, s32 len,s32 * written);
|
||||
EXPORT_DECL(s32, NSSLRead, s32 connection, const void* buf, s32 len,s32 * read);
|
||||
@ -70,6 +72,8 @@ void InitSocketFunctionPointers(void)
|
||||
OSDynLoad_FindExport(nn_ac_handle, 0, "ACGetAssignedAddress",&ACGetAssignedAddress);
|
||||
|
||||
OS_FIND_EXPORT(nsysnet_handle, socket_lib_init);
|
||||
OS_FIND_EXPORT(nsysnet_handle, socket_lib_finish);
|
||||
OS_FIND_EXPORT(nsysnet_handle, socketlasterr);
|
||||
OS_FIND_EXPORT(nsysnet_handle, socket);
|
||||
OS_FIND_EXPORT(nsysnet_handle, socketclose);
|
||||
OS_FIND_EXPORT(nsysnet_handle, connect);
|
||||
|
@ -80,7 +80,8 @@ struct sockaddr
|
||||
void InitSocketFunctionPointers(void);
|
||||
void InitAcquireSocket(void);
|
||||
|
||||
extern void (*socket_lib_init)(void);
|
||||
extern s32 (*socket_lib_init)(void);
|
||||
extern s32 (*socket_lib_finish)(void);
|
||||
extern s32 (*socket)(s32 domain, s32 type, s32 protocol);
|
||||
extern s32 (*socketclose)(s32 s);
|
||||
extern s32 (*connect)(s32 s, void *addr, s32 addrlen);
|
||||
@ -90,6 +91,7 @@ extern s32 (*accept)(s32 s,struct sockaddr *addr,s32 *addrlen);
|
||||
extern s32 (*send)(s32 s, const void *buffer, s32 size, s32 flags);
|
||||
extern s32 (*recv)(s32 s, void *buffer, s32 size, s32 flags);
|
||||
extern s32 (*recvfrom)(s32 sockfd, void *buf, s32 len, s32 flags,struct sockaddr *src_addr, s32 *addrlen);
|
||||
extern s32 (*socketlasterr)(void);
|
||||
|
||||
extern s32 (*sendto)(s32 s, const void *buffer, s32 size, s32 flags, const struct sockaddr *dest, s32 dest_len);
|
||||
extern s32 (*setsockopt)(s32 s, s32 level, s32 optname, void *optval, s32 optlen);
|
||||
|
Loading…
Reference in New Issue
Block a user