Added WPAD and socket functions

This commit is contained in:
Maschell 2017-03-30 17:51:11 +02:00
parent 7310a39d47
commit 5e01fb7d3f
20 changed files with 74 additions and 23 deletions

View File

@ -24,7 +24,7 @@
#include "os_functions.h"
#include "acp_functions.h"
unsigned int acp_handle __attribute__((section(".data"))) = 0;
u32 acp_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, GetMetaXml, void * _ACPMetaXml);

View File

@ -30,7 +30,7 @@ extern "C" {
#include <gctypes.h>
extern unsigned int acp_handle;
extern u32 acp_handle;
void InitACPFunctionPointers(void);
void InitAcquireACP(void);

View File

@ -24,7 +24,7 @@
#include "os_functions.h"
#include "aoc_functions.h"
unsigned int aoc_handle __attribute__((section(".data"))) = 0;
u32 aoc_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(s32, AOC_Initialize, void);
EXPORT_DECL(s32, AOC_Finalize, void);

View File

@ -28,7 +28,7 @@
extern "C" {
#endif
extern unsigned int aoc_handle;
extern u32 aoc_handle;
#define AOC_TITLE_SIZE 104

View File

@ -25,7 +25,7 @@
#include "os_functions.h"
#include "ax_functions.h"
unsigned int sound_handle __attribute__((section(".data"))) = 0;
u32 sound_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, AXInitWithParams, u32 * params);
EXPORT_DECL(void, AXInit, void);

View File

@ -30,7 +30,7 @@ extern "C" {
#include <gctypes.h>
extern unsigned int sound_handle;
extern u32 sound_handle;
void InitAXFunctionPointers(void);
void InitAcquireAX(void);

View File

@ -24,7 +24,7 @@
#include "os_functions.h"
#include "curl_functions.h"
unsigned int libcurl_handle __attribute__((section(".data"))) = 0;
u32 libcurl_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(CURLcode, n_curl_global_init, long flags);
EXPORT_DECL(CURL *, n_curl_easy_init, void);

View File

@ -24,7 +24,7 @@
#include "os_functions.h"
#include "gx2_types.h"
unsigned int gx2_handle __attribute__((section(".data"))) = 0;
u32 gx2_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, GX2Init, u32 * init_attribs);
EXPORT_DECL(void, GX2Shutdown, void);

View File

@ -24,7 +24,7 @@
#include "common/common.h"
#include "os_functions.h"
unsigned int coreinit_handle __attribute__((section(".data"))) = 0;
u32 coreinit_handle __attribute__((section(".data"))) = 0;
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Lib handle functions
@ -139,6 +139,8 @@ EXPORT_DECL(int, IMDisableAPD,void);
EXPORT_DECL(int, IMIsAPDEnabled,int * result);
EXPORT_DECL(int, IMIsAPDEnabledBySysSettings,int * result);
EXPORT_DECL(s32, OSSendAppSwitchRequest,int param,void* unknown1,void* unknown2);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! IOS functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -254,6 +256,8 @@ void InitOSFunctionPointers(void)
OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabled);
OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabledBySysSettings);
OS_FIND_EXPORT(coreinit_handle, OSSendAppSwitchRequest);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! IOS functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -65,7 +65,7 @@ extern "C" {
#define OS_MUTEX_SIZE 44
/* Handle for coreinit */
extern unsigned int coreinit_handle;
extern u32 coreinit_handle;
void InitOSFunctionPointers(void);
void InitAcquireOS(void);
@ -167,6 +167,8 @@ extern int (*IMDisableAPD)(void);
extern int (*IMIsAPDEnabled)(int * result);
extern int (*IMIsAPDEnabledBySysSettings)(int * result);
extern s32 (*OSSendAppSwitchRequest)(int param,void* unknown1,void* unknown2);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! IOS functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -24,7 +24,7 @@
#include "os_functions.h"
#include "padscore_functions.h"
unsigned int padscore_handle __attribute__((section(".data"))) = 0;
u32 padscore_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, KPADInit, void);
EXPORT_DECL(void, WPADInit, void);

View File

@ -30,10 +30,20 @@ extern "C" {
#include "dynamic_libs/vpad_functions.h"
extern unsigned int padscore_handle;
extern u32 padscore_handle;
#include <gctypes.h>
#define WPAD_EXT_CORE 0
#define WPAD_EXT_NUNCHUK 1
#define WPAD_EXT_CLASSIC 2
#define WPAD_EXT_MPLUS 5
#define WPAD_EXT_MPLUS_NUNCHUK 6
#define WPAD_EXT_MPLUS_CLASSIC 7
#define WPAD_EXT_PRO_CONTROLLER 31
#define WPAD_FMT_PRO_CONTROLLER 22
#define WPAD_BUTTON_LEFT 0x0001
#define WPAD_BUTTON_RIGHT 0x0002
#define WPAD_BUTTON_DOWN 0x0004
@ -148,9 +158,27 @@ typedef struct _KPADData
};
u32 unused_7[16];
} KPADData;
typedef struct WPADReadData_ {
u8 unknown[40];
u8 dev;
u8 err;
u8 unknown1[2];
u32 buttons;
s16 l_stick_x;
s16 l_stick_y;
s16 r_stick_x;
s16 r_stick_y;
u8 unknown2[8];
u8 fmt;
}WPADReadData;
typedef WPADReadData KPADUnifiedWpadData;
void InitPadScoreFunctionPointers(void);
void InitAcquirePadScore(void);
typedef void (* wpad_extension_callback_t)(s32 chan, s32 status);
typedef void (* wpad_connect_callback_t)(s32 chan, s32 status);
extern void (* KPADInit)(void);

View File

@ -26,7 +26,7 @@
u32 hostIpAddress = 0;
unsigned int nsysnet_handle __attribute__((section(".data"))) = 0;
u32 nsysnet_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, socket_lib_init, void);
EXPORT_DECL(int, socket, int domain, int type, int protocol);
@ -58,6 +58,17 @@ void InitSocketFunctionPointers(void)
InitAcquireSocket();
unsigned int nn_ac_handle;
int(*ACInitialize)();
int(*ACGetStartupId) (unsigned int *id);
int(*ACConnectWithConfigId) (unsigned int id);
int(*ACGetAssignedAddress) (u32 * ip);
OSDynLoad_Acquire("nn_ac.rpl", &nn_ac_handle);
OSDynLoad_FindExport(nn_ac_handle, 0, "ACInitialize", &ACInitialize);
OSDynLoad_FindExport(nn_ac_handle, 0, "ACGetStartupId", &ACGetStartupId);
OSDynLoad_FindExport(nn_ac_handle, 0, "ACConnectWithConfigId",&ACConnectWithConfigId);
OSDynLoad_FindExport(nn_ac_handle, 0, "ACGetAssignedAddress",&ACGetAssignedAddress);
OS_FIND_EXPORT(nsysnet_handle, socket_lib_init);
OS_FIND_EXPORT(nsysnet_handle, socket);
OS_FIND_EXPORT(nsysnet_handle, socketclose);
@ -77,5 +88,11 @@ void InitSocketFunctionPointers(void)
OS_FIND_EXPORT(nsysnet_handle, NSSLRead);
OS_FIND_EXPORT(nsysnet_handle, NSSLCreateConnection);
unsigned int nn_startupid;
ACInitialize();
ACGetStartupId(&nn_startupid);
ACConnectWithConfigId(nn_startupid);
ACGetAssignedAddress(&hostIpAddress);
socket_lib_init();
}

View File

@ -28,7 +28,7 @@
extern "C" {
#endif
extern unsigned int nsysnet_handle;
extern u32 nsysnet_handle;
#include <gctypes.h>

View File

@ -23,7 +23,7 @@
***************************************************************************/
#include "os_functions.h"
unsigned int sysapp_handle __attribute__((section(".data"))) = 0;
u32 sysapp_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(int, _SYSLaunchTitleByPathFromLauncher, const char* path, int len, int zero);
EXPORT_DECL(int, SYSRelaunchTitle, int argc, char** argv);

View File

@ -28,7 +28,7 @@
extern "C" {
#endif
extern unsigned int sysapp_handle;
extern u32 sysapp_handle;
void InitSysFunctionPointers(void);
void InitAcquireSys(void);

View File

@ -24,7 +24,7 @@
#include "os_functions.h"
#include "syshid_functions.h"
unsigned int syshid_handle __attribute__((section(".data"))) = 0;
u32 syshid_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(int, HIDSetup,void);
EXPORT_DECL(int, HIDTeardown,void);

View File

@ -28,7 +28,7 @@
extern "C" {
#endif
extern unsigned int syshid_handle;
extern u32 syshid_handle;
typedef struct
{

View File

@ -24,8 +24,8 @@
#include "os_functions.h"
#include "vpad_functions.h"
unsigned int vpad_handle __attribute__((section(".data"))) = 0;
unsigned int vpadbase_handle __attribute__((section(".data"))) = 0;
u32 vpad_handle __attribute__((section(".data"))) = 0;
u32 vpadbase_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, VPADInit, void);
EXPORT_DECL(int, VPADRead, int chan, VPADData *buffer, u32 buffer_size, s32 *error);

View File

@ -28,8 +28,8 @@
extern "C" {
#endif
extern unsigned int vpad_handle;
extern unsigned int vpadbase_handle;
extern u32 vpad_handle;
extern u32 vpadbase_handle;
#include <gctypes.h>