Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysapp: Add missing functions and cleanup structs #282

Merged
merged 3 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion include/sysapp/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef struct SYSStandardArgs SYSStandardArgs;
typedef struct SYSStandardArgsIn SYSStandardArgsIn;
typedef struct SYSStandardArgsOut SYSStandardArgsOut;

typedef void (*SYSDeserializeCallback)(SYSDeserializeArg *arg, void *userptr);
typedef void (*SYSDeserializeCallback)(SYSDeserializeArg *arg, void *userArg);

typedef enum SYSArgIDEnum
{
Expand Down Expand Up @@ -136,18 +136,38 @@ int32_t
SYSGetArguments(SYSArgDataBlock *args,
SYSCallerInfo *callerInfo);

int32_t
SYSGetStandardArgs(SYSStandardArgs *stdArgs);

void
SYSClearSysArgs();

int32_t
SYSPackArgs();

int32_t
SYSSerializeSysArgs(const char *argName,
const void *data,
uint32_t size);

int32_t
SYSSerializeSysArgsToBuffer(char *buffer,
uint32_t *bytesWritten,
uint32_t bufferSize,
const char *argName,
const void *data,
uint32_t dataSize);

int32_t
SYSDeserializeSysArgs(SYSDeserializeCallback callback,
void *userArg);

int32_t
SYSDeserializeSysArgsFromBlock(void *block,
uint32_t blockSize,
SYSDeserializeCallback callback,
void *userArg);

int32_t
_SYSDirectlyReturnToCaller(SYSStandardArgsOut *arg);

Expand Down
13 changes: 7 additions & 6 deletions include/sysapp/launch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <wut.h>
#include "args.h"
#include "switch.h"
#include "nn/ffl/miidata.h"

Expand All @@ -25,7 +26,7 @@ typedef struct SysAppParentalArgs SysAppParentalArgs;
typedef struct SysAppNotificationArgs SysAppNotificationArgs;

struct SysAppMiiMakerArgs {
SysAppStandardArgs stdArgs;
SYSStandardArgsIn stdArgs;
uint32_t slotId;
FFLStoreData *mii;
};
Expand All @@ -35,7 +36,7 @@ WUT_CHECK_OFFSET(SysAppMiiMakerArgs, 0x0C, mii);
WUT_CHECK_SIZE(SysAppMiiMakerArgs, 0x10);

struct _SysAppMiiMakerArgs {
SysAppStandardArgs stdArgs;
SYSStandardArgsIn stdArgs;
uint32_t mode;
uint32_t slotId;
FFLStoreData *mii;
Expand All @@ -47,7 +48,7 @@ WUT_CHECK_OFFSET(_SysAppMiiMakerArgs, 0x10, mii);
WUT_CHECK_SIZE(_SysAppMiiMakerArgs, 0x14);

struct SysAppSettingsArgs {
SysAppStandardArgs stdArgs;
SYSStandardArgsIn stdArgs;
int32_t jumpTo;
uint32_t firstBootKind;
};
Expand All @@ -57,15 +58,15 @@ WUT_CHECK_OFFSET(SysAppSettingsArgs, 0x0C, firstBootKind);
WUT_CHECK_SIZE(SysAppSettingsArgs, 0x10);

struct SysAppParentalArgs {
SysAppStandardArgs stdArgs;
SYSStandardArgsIn stdArgs;
uint32_t mode;
};
WUT_CHECK_OFFSET(SysAppParentalArgs, 0x0, stdArgs);
WUT_CHECK_OFFSET(SysAppParentalArgs, 0x8, mode);
WUT_CHECK_SIZE(SysAppParentalArgs, 0x0C);

struct SysAppNotificationArgs {
SysAppStandardArgs stdArgs;
SYSStandardArgsIn stdArgs;
uint32_t notificationFile;
};
WUT_CHECK_OFFSET(SysAppNotificationArgs, 0x0, stdArgs);
Expand Down Expand Up @@ -123,7 +124,7 @@ SYSLaunchTitle(uint64_t TitleId);

void
_SYSLaunchTitleWithStdArgsInNoSplash(uint64_t titleId,
void *unknwn);
SYSStandardArgsIn *stdArgs);

void
_SYSLaunchMenuWithCheckingAccount(uint8_t slot);
Expand Down
27 changes: 9 additions & 18 deletions include/sysapp/switch.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <wut.h>
#include "args.h"

/**
* \defgroup sysapp_switch SYSAPP Switch
Expand All @@ -19,24 +20,14 @@
extern "C" {
#endif

typedef struct SysAppStandardArgs SysAppStandardArgs;
typedef struct SysAppBrowserArgs SysAppBrowserArgs;
typedef struct SysAppBrowserArgsWithCallback SysAppBrowserArgsWithCallback;
typedef struct SysAppEShopArgs SysAppEShopArgs;
typedef struct SysAppEManualArgs SysAppEManualArgs;

struct SysAppStandardArgs
{
void *anchor;
uint32_t anchorSize;
};
WUT_CHECK_OFFSET(SysAppStandardArgs, 0x0, anchor);
WUT_CHECK_OFFSET(SysAppStandardArgs, 0x4, anchorSize);
WUT_CHECK_SIZE(SysAppStandardArgs, 0x8);

struct SysAppEManualArgs
{
SysAppStandardArgs stdArgs;
SYSStandardArgsIn stdArgs;
uint64_t titleId;
};
WUT_CHECK_OFFSET(SysAppEManualArgs, 0x0, stdArgs);
Expand All @@ -45,7 +36,7 @@ WUT_CHECK_SIZE(SysAppEManualArgs, 0x10);

struct SysAppEShopArgs
{
SysAppStandardArgs stdArgs;
SYSStandardArgsIn stdArgs;
char *query;
uint32_t querySize;
};
Expand All @@ -56,9 +47,9 @@ WUT_CHECK_SIZE(SysAppEShopArgs, 0x10);

struct SysAppBrowserArgs
{
SysAppStandardArgs stdArgs;
char *url;
uint32_t urlSize;
SYSStandardArgsIn stdArgs;
char *url;
uint32_t urlSize;
};
WUT_CHECK_OFFSET(SysAppBrowserArgs, 0x0, stdArgs);
WUT_CHECK_OFFSET(SysAppBrowserArgs, 0x8, url);
Expand All @@ -69,8 +60,8 @@ struct SysAppBrowserArgsWithCallback
{
SysAppBrowserArgs browserArgs;
char *cbUrl;
uint32_t cbUrlSize;
BOOL hbmDisable;
uint32_t cbUrlSize;
BOOL hbmDisable;
};
WUT_CHECK_OFFSET(SysAppBrowserArgsWithCallback, 0x0, browserArgs);
WUT_CHECK_OFFSET(SysAppBrowserArgsWithCallback, 0x10, cbUrl);
Expand Down Expand Up @@ -134,7 +125,7 @@ int32_t
SYSSwitchToEShop(SysAppEShopArgs *);

int32_t
SYSSwitchToEShopTicketList(SysAppStandardArgs *);
SYSSwitchToEShopTicketList(SYSStandardArgsIn *);

int32_t
_SYSSwitchToEShopFromHBM(SysAppEShopArgs *);
Expand Down