mirror of
https://github.com/wiiu-env/wut.git
synced 2025-02-13 18:19:21 +01:00
nn: Add nn::act library
This commit is contained in:
parent
7492ff0483
commit
3f9be376d0
8
include/nn/act.h
Normal file
8
include/nn/act.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* \defgroup nn_act nn_act
|
||||
* Accounts API, manages user profiles and personal info.
|
||||
*/
|
||||
|
||||
#include <nn/act/client_cpp.h>
|
216
include/nn/act/client_cpp.h
Normal file
216
include/nn/act/client_cpp.h
Normal file
@ -0,0 +1,216 @@
|
||||
#pragma once
|
||||
#include <wut.h>
|
||||
#include <nn/result.h>
|
||||
#include <nn/ffl/miidata.h>
|
||||
|
||||
/**
|
||||
* \defgroup nn_act_client Accounts Client API
|
||||
* \ingroup nn_act
|
||||
* Personal information and accounts service client managment (see nn::act)
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace nn {
|
||||
|
||||
namespace act {
|
||||
|
||||
//https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/act/nn_act_types.h
|
||||
|
||||
using SlotNo = uint8_t;
|
||||
using LocalFriendCode = uint64_t;
|
||||
using PersistentId = uint32_t;
|
||||
using PrincipalId = uint32_t;
|
||||
using SimpleAddressId = uint32_t;
|
||||
using TransferrableId = uint64_t;
|
||||
|
||||
static constexpr size_t AccountIdSize = 17;
|
||||
static constexpr size_t DeviceHashSize = 8;
|
||||
static constexpr size_t NfsPasswordSize = 17;
|
||||
static constexpr size_t MiiNameSize = 11;
|
||||
static constexpr size_t UuidSize = 16;
|
||||
|
||||
//https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/cafe/libraries/nn_act/nn_act_client.cpp
|
||||
|
||||
nn::Result
|
||||
Initialize(void)
|
||||
asm("Initialize__Q2_2nn3actFv");
|
||||
|
||||
nn::Result
|
||||
Finalize(void)
|
||||
asm("Finalize__Q2_2nn3actFv");
|
||||
|
||||
//https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/cafe/libraries/nn_act/nn_act_clientstandardservice.cpp
|
||||
|
||||
nn::Result
|
||||
GetAccountId(char outAccountId[AccountIdSize])
|
||||
asm("GetAccountId__Q2_2nn3actFPc");
|
||||
|
||||
nn::Result
|
||||
GetAccountIdEx(char outAccountId[AccountIdSize], SlotNo slot)
|
||||
asm("GetAccountIdEx__Q2_2nn3actFPcUc");
|
||||
|
||||
nn::Result
|
||||
GetBirthday(uint16_t* outYear, uint8_t* outMonth, uint8_t* outDay)
|
||||
asm("GetBirthday__Q2_2nn3actFPUsPUcT2");
|
||||
|
||||
nn::Result
|
||||
GetBirthdayEx(uint16_t* outYear, uint8_t* outMonth, uint8_t* outDay, SlotNo slot)
|
||||
asm("GetBirthdayEx__Q2_2nn3actFPUsPUcT2Uc");
|
||||
|
||||
SlotNo
|
||||
GetDefaultAccount(void)
|
||||
asm("GetDefaultAccount__Q2_2nn3actFv");
|
||||
|
||||
nn::Result
|
||||
GetDeviceHash(char outHash[DeviceHashSize])
|
||||
asm("GetDeviceHash__Q2_2nn3actFPUL");
|
||||
|
||||
nn::Result
|
||||
GetMii(FFLStoreData* mii)
|
||||
asm("GetMii__Q2_2nn3actFP12FFLStoreData");
|
||||
|
||||
nn::Result
|
||||
GetMiiEx(FFLStoreData* mii, SlotNo slot)
|
||||
asm("GetMiiEx__Q2_2nn3actFP12FFLStoreDataUc");
|
||||
|
||||
nn::Result
|
||||
GetMiiImageEx(size_t* outImageSize, void* buffer, size_t bufferSize, int unk, SlotNo slot)
|
||||
asm("GetMiiImageEx__Q2_2nn3actFPUiPvUi15ACTMiiImageTypeUc");
|
||||
|
||||
nn::Result
|
||||
GetMiiName(int16_t outName[MiiNameSize])
|
||||
asm("GetMiiName__Q2_2nn3actFPw");
|
||||
|
||||
nn::Result
|
||||
GetMiiNameEx(int16_t outName[MiiNameSize], SlotNo slot)
|
||||
asm("GetMiiNameEx__Q2_2nn3actFPwUc");
|
||||
|
||||
nn::Result
|
||||
GetNfsPassword(char outPassword[NfsPasswordSize])
|
||||
asm("GetNfsPassword__Q2_2nn3actFPc");
|
||||
|
||||
nn::Result
|
||||
GetNfsPasswordEx(char outPassword[NfsPasswordSize], SlotNo slot)
|
||||
asm("GetNfsPasswordEx__Q2_2nn3actFPcUc");
|
||||
|
||||
uint8_t
|
||||
GetNumOfAccounts(void)
|
||||
asm("GetNumOfAccounts__Q2_2nn3actFv");
|
||||
|
||||
SlotNo
|
||||
GetParentalControlsSlotNo(void)
|
||||
asm("GetParentalControlSlotNo__Q2_2nn3actFv");
|
||||
|
||||
nn::Result
|
||||
GetParentalControlsSlotNoEx(void)
|
||||
asm("GetParentalControlSlotNoEx__Q2_2nn3actFPUcUc");
|
||||
|
||||
PersistentId
|
||||
GetPersistentId(void)
|
||||
asm("GetPersistentId__Q2_2nn3actFv");
|
||||
|
||||
PersistentId
|
||||
GetPersistentIdEx(SlotNo slot)
|
||||
asm("GetPersistentIdEx__Q2_2nn3actFUc");
|
||||
|
||||
PrincipalId
|
||||
GetPrincipalId(void)
|
||||
asm("GetPrincipalId__Q2_2nn3actFv");
|
||||
|
||||
nn::Result
|
||||
GetPrincipalIdEx(PrincipalId* outId, SlotNo slot)
|
||||
asm("GetPrincipalIdEx__Q2_2nn3actFPUiUc");
|
||||
|
||||
SimpleAddressId
|
||||
GetSimpleAddressId(void)
|
||||
asm("GetSimpleAddressId__Q2_2nn3actFv");
|
||||
|
||||
nn::Result
|
||||
GetSimpleAddressId(SimpleAddressId* outId, SlotNo slot)
|
||||
asm("GetSimpleAddressIdEx__Q2_2nn3actFPUiUc");
|
||||
|
||||
SlotNo
|
||||
GetSlotNo(void)
|
||||
asm("GetSlotNo__Q2_2nn3actFv");
|
||||
|
||||
TransferrableId
|
||||
GetTransferableId(uint32_t unk1)
|
||||
asm("GetTransferableId__Q2_2nn3actFUi");
|
||||
|
||||
nn::Result
|
||||
GetTransferableIdEx(TransferrableId* outId, uint32_t unk1, SlotNo slot)
|
||||
asm("GetTransferableIdEx__Q2_2nn3actFPULUiUc");
|
||||
|
||||
nn::Result
|
||||
GetUuidEx(char outUuid[UuidSize], SlotNo slot, int32_t unk1)
|
||||
asm("GetUuidEx__Q2_2nn3actFP7ACTUuidUcUi");
|
||||
|
||||
nn::Result
|
||||
GetUuidEx(char outUuid[UuidSize], SlotNo slot)
|
||||
asm("GetUuidEx__Q2_2nn3actFP7ACTUuidUc");
|
||||
|
||||
nn::Result
|
||||
GetUuid(char outUuid[UuidSize], int32_t unk1)
|
||||
asm("GetUuid__Q2_2nn3actFP7ACTUuidUi");
|
||||
|
||||
nn::Result
|
||||
GetUuid(char outUuid[UuidSize])
|
||||
asm("GetUuid__Q2_2nn3actFP7ACTUuid");
|
||||
|
||||
BOOL
|
||||
HasNfsAccount(void)
|
||||
asm("HasNfsAccount__Q2_2nn3actFv");
|
||||
|
||||
BOOL
|
||||
IsCommitted(void)
|
||||
asm("IsCommitted__Q2_2nn3actFv");
|
||||
|
||||
BOOL
|
||||
IsCommittedEx(SlotNo slot)
|
||||
asm("IsCommittedEx__Q2_2nn3actFUc");
|
||||
|
||||
BOOL
|
||||
IsPasswordCacheEnabled(void)
|
||||
asm("IsPasswordCacheEnabled__Q2_2nn3actFv");
|
||||
|
||||
BOOL
|
||||
IsPasswordCacheEnabledEx(SlotNo slot)
|
||||
asm("IsPasswordCacheEnabledEx__Q2_2nn3actFUc");
|
||||
|
||||
BOOL
|
||||
IsNetworkAccount(void)
|
||||
asm("IsNetworkAccount__Q2_2nn3actFv");
|
||||
|
||||
BOOL
|
||||
IsNetworkAccountEx(SlotNo slot)
|
||||
asm("IsNetworkAccountEx__Q2_2nn3actFUc");
|
||||
|
||||
BOOL
|
||||
IsServerAccountActive(void)
|
||||
asm("IsServerAccountActive__Q2_2nn3actFv");
|
||||
|
||||
BOOL
|
||||
IsServerAccountActiveEx(SlotNo slot)
|
||||
asm("IsServerAccountActiveEx__Q2_2nn3actFUc");
|
||||
|
||||
BOOL
|
||||
IsServerAccountDeleted(void)
|
||||
asm("IsServerAccountDeleted__Q2_2nn3actFv");
|
||||
|
||||
BOOL
|
||||
IsServerAccountDeletedEx(SlotNo slot)
|
||||
asm("IsServerAccountDeletedEx__Q2_2nn3actFUc");
|
||||
|
||||
BOOL
|
||||
IsSlotOccupied(SlotNo slot)
|
||||
asm("IsSlotOccupied__Q2_2nn3actFUc");
|
||||
|
||||
} //namespace act
|
||||
|
||||
} //namespace nn
|
||||
|
||||
#endif //__cplusplus
|
||||
|
||||
/** @} */
|
173
include/nn/ffl/miidata.h
Normal file
173
include/nn/ffl/miidata.h
Normal file
@ -0,0 +1,173 @@
|
||||
#pragma once
|
||||
#include <wut.h>
|
||||
|
||||
/**
|
||||
* \defgroup nn_ffl_miidata Mii binary format
|
||||
* \ingroup nn_ffl
|
||||
* Binary format for Mii storage and exchange
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// https://github.com/decaf-emu/decaf-emu/blob/master/src/libdecaf/src/nn/ffl/nn_ffl_miidata.h
|
||||
|
||||
typedef enum FFLCreateIDFlags {
|
||||
FFL_CREATE_ID_FLAG_WII_U = 0x1 | 0x4,
|
||||
FFL_CREATE_ID_FLAG_TEMPORARY = 0x2,
|
||||
FFL_CREATE_ID_FLAG_NORMAL = 0x8,
|
||||
} FFLCreateIDFlags;
|
||||
|
||||
typedef struct WUT_PACKED FFLCreateID {
|
||||
FFLCreateIDFlags flags : 4;
|
||||
|
||||
uint32_t timestamp : 28;
|
||||
|
||||
uint8_t deviceHash[6];
|
||||
} FFLCreateID;
|
||||
WUT_CHECK_OFFSET(FFLCreateID, 4, deviceHash);
|
||||
WUT_CHECK_SIZE(FFLCreateID, 10);
|
||||
|
||||
//Note: the endian may be wrong here
|
||||
typedef struct WUT_PACKED FFLiMiiDataCore {
|
||||
// 0x00
|
||||
uint8_t birth_platform : 4;
|
||||
uint8_t unk_0x00_b4 : 4;
|
||||
|
||||
// 0x01
|
||||
uint8_t unk_0x01_b0 : 4;
|
||||
uint8_t unk_0x01_b4 : 4;
|
||||
|
||||
// 0x02
|
||||
uint8_t font_region : 4;
|
||||
uint8_t region_move : 2;
|
||||
uint8_t unk_0x02_b6 : 1;
|
||||
uint8_t copyable : 1;
|
||||
|
||||
// 0x03
|
||||
uint8_t mii_version;
|
||||
|
||||
// 0x4
|
||||
uint64_t author_id;
|
||||
|
||||
// 0xC
|
||||
FFLCreateID mii_id;
|
||||
|
||||
// 0x16
|
||||
uint16_t unk_0x16;
|
||||
|
||||
// 0x18
|
||||
uint16_t unk_0x18_b0 : 1;
|
||||
uint16_t unk_0x18_b1 : 1;
|
||||
uint16_t color : 4;
|
||||
uint16_t birth_day : 5;
|
||||
uint16_t birth_month : 4;
|
||||
uint16_t gender : 1;
|
||||
|
||||
// 0x1A
|
||||
uint16_t mii_name[10];
|
||||
|
||||
// 0x2E
|
||||
uint8_t size;
|
||||
|
||||
// 0x2F
|
||||
uint8_t fatness;
|
||||
|
||||
// 0x30
|
||||
uint8_t blush_type : 4;
|
||||
uint8_t face_style : 4;
|
||||
|
||||
// 0x31
|
||||
uint8_t face_color : 3;
|
||||
uint8_t face_type : 4;
|
||||
uint8_t local_only : 1;
|
||||
|
||||
// 0x32
|
||||
uint8_t hair_mirrored : 5;
|
||||
uint8_t hair_color : 3;
|
||||
|
||||
// 0x33
|
||||
uint8_t hair_type;
|
||||
|
||||
// 0x34
|
||||
uint32_t eye_thickness : 3;
|
||||
uint32_t eye_scale : 4;
|
||||
uint32_t eye_color : 3;
|
||||
uint32_t eye_type : 6;
|
||||
uint32_t eye_height : 7;
|
||||
uint32_t eye_distance : 4;
|
||||
uint32_t eye_rotation : 5;
|
||||
|
||||
// 0x38
|
||||
uint32_t eyebrow_thickness : 4;
|
||||
uint32_t eyebrow_scale : 4;
|
||||
uint32_t eyebrow_color : 3;
|
||||
uint32_t eyebrow_type : 5;
|
||||
uint32_t eyebrow_height : 7;
|
||||
uint32_t eyebrow_distance : 4;
|
||||
uint32_t eyebrow_rotation : 5;
|
||||
|
||||
// 0x3c
|
||||
uint32_t nose_height : 7;
|
||||
uint32_t nose_scale : 4;
|
||||
uint32_t nose_type : 5;
|
||||
uint32_t mouth_thickness : 3;
|
||||
uint32_t mouth_scale : 4;
|
||||
uint32_t mouth_color : 3;
|
||||
uint32_t mouth_type : 6;
|
||||
|
||||
// 0x40
|
||||
uint32_t unk_0x40 : 8;
|
||||
uint32_t mustache_type : 3;
|
||||
uint32_t mouth_height : 5;
|
||||
uint32_t mustache_height : 6;
|
||||
uint32_t mustache_scale : 4;
|
||||
uint32_t beard_color : 3;
|
||||
uint32_t beard_type : 3;
|
||||
|
||||
// 0x44
|
||||
uint16_t glass_height : 5;
|
||||
uint16_t glass_scale : 4;
|
||||
uint16_t glass_color : 3;
|
||||
uint16_t glass_type : 4;
|
||||
|
||||
// 0x46
|
||||
uint16_t unk_0x46_b0 : 1;
|
||||
uint16_t mole_ypos : 5;
|
||||
uint16_t mole_xpos : 5;
|
||||
uint16_t mole_scale : 4;
|
||||
uint16_t mole_enabled : 1;
|
||||
} FFLiMiiDataCore;
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x03, mii_version);
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x04, author_id);
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x0C, mii_id);
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x16, unk_0x16);
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x1A, mii_name);
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x2E, size);
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x2F, fatness);
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataCore, 0x33, hair_type);
|
||||
WUT_CHECK_SIZE(FFLiMiiDataCore, 0x48);
|
||||
|
||||
typedef struct WUT_PACKED FFLiMiiDataOfficial {
|
||||
FFLiMiiDataCore core;
|
||||
uint16_t creator_name[10];
|
||||
} FFLiMiiDataOfficial;
|
||||
WUT_CHECK_OFFSET(FFLiMiiDataOfficial, 0x48, creator_name);
|
||||
WUT_CHECK_SIZE(FFLiMiiDataOfficial, 0x5C);
|
||||
|
||||
typedef struct WUT_PACKED FFLStoreData {
|
||||
FFLiMiiDataOfficial data;
|
||||
uint16_t unk_0x5C;
|
||||
uint16_t checksum;
|
||||
} FFLStoreData;
|
||||
WUT_CHECK_OFFSET(FFLStoreData, 0x5C, unk_0x5C);
|
||||
WUT_CHECK_OFFSET(FFLStoreData, 0x5E, checksum);
|
||||
WUT_CHECK_SIZE(FFLStoreData, 0x60);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
@ -79,9 +79,12 @@
|
||||
#include <nn/acp/result.h>
|
||||
#include <nn/acp/save.h>
|
||||
#include <nn/acp/title.h>
|
||||
#include <nn/act/client_cpp.h>
|
||||
#include <nn/ffl/miidata.h>
|
||||
#include <nn/swkbd/swkbd_cpp.h>
|
||||
#include <nn/ac.h>
|
||||
#include <nn/acp.h>
|
||||
#include <nn/act.h>
|
||||
#include <nn/result.h>
|
||||
#include <nn/swkbd.h>
|
||||
#include <nsyshid/hid.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user