From 09972b2cf6c3f4bdc54346c305854e8621e854e5 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 4 Mar 2018 16:10:41 +0100 Subject: [PATCH] Added more functions --- source/acp_functions.c | 2 +- source/acp_functions.h | 7 +++++++ source/nn_fp_functions.c | 43 ++++++++++++++++++++++++++++++++++++++++ source/nn_fp_functions.h | 23 +++++++++++++++++++++ source/os_functions.c | 2 +- source/os_functions.h | 2 +- source/os_types.h | 12 +++++++++++ 7 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 source/nn_fp_functions.c create mode 100644 source/nn_fp_functions.h diff --git a/source/acp_functions.c b/source/acp_functions.c index fc91b93..91f5b2c 100644 --- a/source/acp_functions.c +++ b/source/acp_functions.c @@ -26,7 +26,7 @@ u32 acp_handle __attribute__((section(".data"))) = 0; -EXPORT_DECL(void, GetMetaXml, void * _ACPMetaXml); +EXPORT_DECL(void, GetMetaXml, ACPMetaXml * _ACPMetaXml); void InitAcquireACP(void){ if(coreinit_handle == 0){ InitAcquireOS(); }; diff --git a/source/acp_functions.h b/source/acp_functions.h index 33fe979..96007c5 100644 --- a/source/acp_functions.h +++ b/source/acp_functions.h @@ -30,7 +30,14 @@ extern "C" { #include "os_types.h" + +typedef struct ACPMetaXml_ +{ + u8 data[0x3440]; +}ACPMetaXml; + extern u32 acp_handle; +extern void (*GetMetaXml)(ACPMetaXml * _ACPMetaXml); void InitACPFunctionPointers(void); void InitAcquireACP(void); diff --git a/source/nn_fp_functions.c b/source/nn_fp_functions.c new file mode 100644 index 0000000..89c485e --- /dev/null +++ b/source/nn_fp_functions.c @@ -0,0 +1,43 @@ +/**************************************************************************** + * 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_fp_functions.h" + +u32 nn_fp_handle __attribute__((section(".data"))) = 0; + +EXPORT_DECL(void, nn_fp_GetMyPresence, void *); +EXPORT_DECL(void, nn_fp_Initialize, void); + +void InitAcquireFp(void){ + if(coreinit_handle == 0){ InitAcquireOS(); }; + OSDynLoad_Acquire("nn_fp.rpl", &nn_fp_handle); +} + +void InitFpFunctionPointers(void){ + u32 *funcPointer = 0; + InitAcquireFp(); + + OS_FIND_EXPORT_EX(nn_fp_handle, GetMyPresence__Q2_2nn2fpFPQ3_2nn2fp10MyPresence, nn_fp_GetMyPresence) + OS_FIND_EXPORT_EX(nn_fp_handle, Initialize__Q2_2nn2fpFv, nn_fp_Initialize) +} diff --git a/source/nn_fp_functions.h b/source/nn_fp_functions.h new file mode 100644 index 0000000..a7eb73c --- /dev/null +++ b/source/nn_fp_functions.h @@ -0,0 +1,23 @@ +#ifndef __NN_FP_FUNCTIONS_H_ +#define __NN_FP_FUNCTIONS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "os_types.h" + +/* Handle for coreinit */ +extern u32 nn_fp_handle; + +extern void(* nn_fp_GetMyPresence)(void *); +extern void(* nn_fp_Initialize)(void); + +void InitAcquireFp(void); +void InitFpFunctionPointers(void); + +#ifdef __cplusplus +} +#endif + +#endif // __NN_FP_FUNCTIONS_H_ diff --git a/source/os_functions.c b/source/os_functions.c index a375144..f7db305 100644 --- a/source/os_functions.c +++ b/source/os_functions.c @@ -150,7 +150,7 @@ EXPORT_DECL(s32, OSGetMemBound, s32 type, u32 * startAddress, u32 * size); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- EXPORT_DECL(s32, MCP_Open, void); EXPORT_DECL(s32, MCP_Close, s32 handle); -EXPORT_DECL(s32, MCP_GetOwnTitleInfo, s32 handle, void * data); +EXPORT_DECL(s32, MCP_GetOwnTitleInfo, s32 handle, MCPTitleListType * data); EXPORT_DECL(void*, MCP_GetDeviceId, s32 handle, u32 * id); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/source/os_functions.h b/source/os_functions.h index bcad853..c96757a 100644 --- a/source/os_functions.h +++ b/source/os_functions.h @@ -231,7 +231,7 @@ extern s32 (* OSGetMemBound)(s32 type, u32 * startAddress, u32 * size); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- extern s32 (* MCP_Open)(void); extern s32 (* MCP_Close)(s32 handle); -extern s32 (* MCP_GetOwnTitleInfo)(s32 handle, void * data); +extern s32 (* MCP_GetOwnTitleInfo)(s32 handle, MCPTitleListType * data); extern void* (* MCP_GetDeviceId)(s32 handle, u32 * id); //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/source/os_types.h b/source/os_types.h index 21be4c0..edf2140 100644 --- a/source/os_types.h +++ b/source/os_types.h @@ -197,6 +197,18 @@ typedef struct _OSCalendarTime { } OSCalendarTime; +typedef struct MCPTitleListType{ + u64 titleId; + u8 unknwn[4]; + s8 path[56]; + u32 appType; + u8 unknwn1[0x54 - 0x48]; + u8 device; + u8 unknwn2; + s8 indexedDevice[10]; + u8 unk0x60; +} MCPTitleListType; + #ifdef __cplusplus } #endif