Add a bunch of GetServiceSession functions (#305)

* Add a bunch of GetServiceSession functions
This commit is contained in:
friedkeenan 2019-07-13 14:09:28 -05:00 committed by yellows8
parent 40d7e0de51
commit da4c060278
68 changed files with 218 additions and 8 deletions

View File

@ -33,7 +33,7 @@ typedef struct
Result accountInitialize(void); Result accountInitialize(void);
void accountExit(void); void accountExit(void);
Service* accountGetService(void); Service* accountGetServiceSession(void);
/// Get the total number of user profiles /// Get the total number of user profiles
Result accountGetUserCount(s32* user_count); Result accountGetUserCount(s32* user_count);

View File

@ -6,6 +6,7 @@
*/ */
#pragma once #pragma once
#include "../types.h" #include "../types.h"
#include "../services/sm.h"
/// CpuBoostMode. With \ref appletSetCpuBoostMode, only values 0/1 are available. This allows using higher clock rates. /// CpuBoostMode. With \ref appletSetCpuBoostMode, only values 0/1 are available. This allows using higher clock rates.
typedef enum { typedef enum {
@ -16,6 +17,7 @@ typedef enum {
Result apmInitialize(void); Result apmInitialize(void);
void apmExit(void); void apmExit(void);
Service* apmGetServiceSession(void);
Result apmSetPerformanceConfiguration(u32 PerformanceMode, u32 PerformanceConfiguration); Result apmSetPerformanceConfiguration(u32 PerformanceMode, u32 PerformanceConfiguration);
Result apmGetPerformanceConfiguration(u32 PerformanceMode, u32 *PerformanceConfiguration); Result apmGetPerformanceConfiguration(u32 PerformanceMode, u32 *PerformanceConfiguration);

View File

@ -7,9 +7,11 @@
#pragma once #pragma once
#include "../audio/audio.h" #include "../audio/audio.h"
#include "../services/sm.h"
Result auddevInitialize(void); Result auddevInitialize(void);
void auddevExit(void); void auddevExit(void);
Service* auddevGetServiceSession(void);
Result auddevListAudioDeviceName(AudioDeviceName *DeviceNames, s32 max_names, s32 *total_names); Result auddevListAudioDeviceName(AudioDeviceName *DeviceNames, s32 max_names, s32 *total_names);
Result auddevSetAudioDeviceOutputVolume(const AudioDeviceName *DeviceName, float volume); Result auddevSetAudioDeviceOutputVolume(const AudioDeviceName *DeviceName, float volume);

View File

@ -7,6 +7,7 @@
#pragma once #pragma once
#include "../audio/audio.h" #include "../audio/audio.h"
#include "../services/sm.h"
#if __cplusplus >= 201402L #if __cplusplus >= 201402L
#define AUDREN_CONSTEXPR constexpr #define AUDREN_CONSTEXPR constexpr
@ -321,6 +322,7 @@ AUDREN_CONSTEXPR size_t audrenGetOutputParamSize(const AudioRendererConfig* conf
Result audrenInitialize(const AudioRendererConfig* config); Result audrenInitialize(const AudioRendererConfig* config);
void audrenExit(void); void audrenExit(void);
Service* audrenGetServiceSession(void);
void audrenWaitFrame(void); void audrenWaitFrame(void);
Result audrenGetState(u32* out_state); Result audrenGetState(u32* out_state);
Result audrenRequestUpdateAudioRenderer(const void* in_param_buf, size_t in_param_buf_size, void* out_param_buf, size_t out_param_buf_size, void* perf_buf, size_t perf_buf_size); Result audrenRequestUpdateAudioRenderer(const void* in_param_buf, size_t in_param_buf_size, void* out_param_buf, size_t out_param_buf_size, void* perf_buf, size_t perf_buf_size);

View File

@ -6,6 +6,7 @@
*/ */
#pragma once #pragma once
#include "../types.h" #include "../types.h"
#include "../services/sm.h"
typedef enum { typedef enum {
BpcSleepButtonState_Held = 0, BpcSleepButtonState_Held = 0,
@ -14,6 +15,7 @@ typedef enum {
Result bpcInitialize(void); Result bpcInitialize(void);
void bpcExit(void); void bpcExit(void);
Service* bpcGetServiceSession(void);
Result bpcShutdownSystem(void); Result bpcShutdownSystem(void);
Result bpcRebootSystem(void); Result bpcRebootSystem(void);

View File

@ -12,6 +12,7 @@
#include "../types.h" #include "../types.h"
#include "../kernel/tmem.h" #include "../kernel/tmem.h"
#include "../services/sm.h"
/// Configuration structure for bsdInitalize /// Configuration structure for bsdInitalize
typedef struct { typedef struct {
@ -37,6 +38,7 @@ const BsdInitConfig *bsdGetDefaultInitConfig(void);
Result bsdInitialize(const BsdInitConfig *config); Result bsdInitialize(const BsdInitConfig *config);
/// Deinitialize the BSD service. /// Deinitialize the BSD service.
void bsdExit(void); void bsdExit(void);
Service* bsdGetServiceSession(void);
/// Creates a socket. /// Creates a socket.
int bsdSocket(int domain, int type, int protocol); int bsdSocket(int domain, int type, int protocol);

View File

@ -12,6 +12,7 @@
/// Initialize caps:sc. Only available on 2.0.0+. /// Initialize caps:sc. Only available on 2.0.0+.
Result capsscInitialize(void); Result capsscInitialize(void);
void capsscExit(void); void capsscExit(void);
Service* capsscGetServiceSession(void);
/** /**
* @brief This takes a screenshot, with the screenshot being written into the output buffer. * @brief This takes a screenshot, with the screenshot being written into the output buffer.

View File

@ -12,6 +12,7 @@
/// Initialize caps:su. Only available on 4.0.0+. /// Initialize caps:su. Only available on 4.0.0+.
Result capssuInitialize(void); Result capssuInitialize(void);
void capssuExit(void); void capssuExit(void);
Service* capssuGetServiceSession(void);
/// Same as \ref capssuSaveScreenShotEx0, except this uses an all-zero CapsScreenShotAttribute where the first u32 is set to attr_val. attr_val can be zero. /// Same as \ref capssuSaveScreenShotEx0, except this uses an all-zero CapsScreenShotAttribute where the first u32 is set to attr_val. attr_val can be zero.
Result capssuSaveScreenShot(const void* buffer, size_t size, u32 unk, u32 attr_val, CapsApplicationAlbumEntry *out); Result capssuSaveScreenShot(const void* buffer, size_t size, u32 unk, u32 attr_val, CapsApplicationAlbumEntry *out);

View File

@ -15,6 +15,7 @@ typedef struct {
Result clkrstInitialize(void); Result clkrstInitialize(void);
void clkrstExit(void); void clkrstExit(void);
Service* clkrstGetServiceSession(void);
/// Opens a ClkrstSession for the requested PcvModuleId, unk is set to 3 in official sysmodules. /// Opens a ClkrstSession for the requested PcvModuleId, unk is set to 3 in official sysmodules.
Result clkrstOpenSession(ClkrstSession* session_out, PcvModuleId module_id, u32 unk); Result clkrstOpenSession(ClkrstSession* session_out, PcvModuleId module_id, u32 unk);

View File

@ -6,8 +6,10 @@
*/ */
#pragma once #pragma once
#include "../types.h" #include "../types.h"
#include "../services/sm.h"
Result csrngInitialize(void); Result csrngInitialize(void);
void csrngExit(void); void csrngExit(void);
Service* csrngGetServiceSession(void);
Result csrngGetRandomBytes(void *out, size_t out_size); Result csrngGetRandomBytes(void *out, size_t out_size);

View File

@ -11,6 +11,7 @@
Result fsldrInitialize(void); Result fsldrInitialize(void);
void fsldrExit(void); void fsldrExit(void);
Service* fsldrGetServiceSession(void);
Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out); Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out);
Result fsldrIsArchivedProgram(u64 pid, bool *out); Result fsldrIsArchivedProgram(u64 pid, bool *out);

View File

@ -11,6 +11,7 @@
Result fsprInitialize(void); Result fsprInitialize(void);
void fsprExit(void); void fsprExit(void);
Service* fsprGetServiceSession(void);
Result fsprRegisterProgram(u64 pid, u64 titleID, FsStorageId storageID, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size); Result fsprRegisterProgram(u64 pid, u64 titleID, FsStorageId storageID, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size);
Result fsprUnregisterProgram(u64 pid); Result fsprUnregisterProgram(u64 pid);

View File

@ -30,6 +30,7 @@ typedef enum {
Result gpioInitialize(void); Result gpioInitialize(void);
void gpioExit(void); void gpioExit(void);
Service* gpioGetServiceSession(void);
Result gpioOpenSession(GpioPadSession *out, GpioPadName name); Result gpioOpenSession(GpioPadSession *out, GpioPadName name);

View File

@ -656,7 +656,7 @@ Result hidInitialize(void);
void hidExit(void); void hidExit(void);
void hidReset(void); void hidReset(void);
Service* hidGetSessionService(void); Service* hidGetServiceSession(void);
void* hidGetSharedmemAddr(void); void* hidGetSharedmemAddr(void);
void hidSetControllerLayout(HidControllerID id, HidControllerLayoutType layoutType); void hidSetControllerLayout(HidControllerID id, HidControllerLayoutType layoutType);

View File

@ -78,6 +78,7 @@ typedef struct {
Result hiddbgInitialize(void); Result hiddbgInitialize(void);
void hiddbgExit(void); void hiddbgExit(void);
Service* hiddbgGetServiceSession(void);
/// Writes the input RGB colors to the spi-flash for the specified controller (offset 0x6050 size 0x6). See hidsys.h for UniquePadId. Only available with [3.0.0+]. /// Writes the input RGB colors to the spi-flash for the specified controller (offset 0x6050 size 0x6). See hidsys.h for UniquePadId. Only available with [3.0.0+].
Result hiddbgUpdateControllerColor(u32 colorBody, u32 colorButtons, u64 UniquePadId); Result hiddbgUpdateControllerColor(u32 colorBody, u32 colorButtons, u64 UniquePadId);

View File

@ -34,6 +34,7 @@ typedef struct {
Result hidsysInitialize(void); Result hidsysInitialize(void);
void hidsysExit(void); void hidsysExit(void);
Service* hidsysGetServiceSession(void);
Result hidsysEnableAppletToGetInput(bool enable); Result hidsysEnableAppletToGetInput(bool enable);

View File

@ -57,6 +57,7 @@ typedef enum {
Result i2cInitialize(void); Result i2cInitialize(void);
void i2cExit(void); void i2cExit(void);
Service* i2cGetServiceSession(void);
Result i2cOpenSession(I2cSession *out, I2cDevice dev); Result i2cOpenSession(I2cSession *out, I2cDevice dev);

View File

@ -55,7 +55,7 @@ Result irsInitialize(void);
/// Exit irs. /// Exit irs.
void irsExit(void); void irsExit(void);
Service* irsGetSessionService(void); Service* irsGetServiceSession(void);
void* irsGetSharedmemAddr(void); void* irsGetSharedmemAddr(void);
/// (De)activate the IR sensor, this is automatically used by \ref irsExit. Must be called after irsInitialize() to activate the IR sensor. /// (De)activate the IR sensor, this is automatically used by \ref irsExit. Must be called after irsInitialize() to activate the IR sensor.

View File

@ -6,9 +6,11 @@
*/ */
#pragma once #pragma once
#include "../types.h" #include "../types.h"
#include "../services/sm.h"
Result lblInitialize(void); Result lblInitialize(void);
void lblExit(void); void lblExit(void);
Service* lblGetServiceSession(void);
Result lblSwitchBacklightOn(u64 fade_time); Result lblSwitchBacklightOn(u64 fade_time);
Result lblSwitchBacklightOff(u64 fade_time); Result lblSwitchBacklightOff(u64 fade_time);

View File

@ -19,6 +19,7 @@ typedef struct {
Result lrInitialize(void); Result lrInitialize(void);
void lrExit(void); void lrExit(void);
Service* lrGetServiceSession(void);
Result lrOpenLocationResolver(FsStorageId storage, LrLocationResolver* out); Result lrOpenLocationResolver(FsStorageId storage, LrLocationResolver* out);
Result lrOpenRegisteredLocationResolver(LrRegisteredLocationResolver* out); Result lrOpenRegisteredLocationResolver(LrRegisteredLocationResolver* out);

View File

@ -76,6 +76,7 @@ typedef struct {
Result ncmInitialize(void); Result ncmInitialize(void);
void ncmExit(void); void ncmExit(void);
Service* ncmGetServiceSession(void);
Result ncmOpenContentStorage(FsStorageId storage, NcmContentStorage* out); Result ncmOpenContentStorage(FsStorageId storage, NcmContentStorage* out);
Result ncmOpenContentMetaDatabase(FsStorageId storage, NcmContentMetaDatabase* out); Result ncmOpenContentMetaDatabase(FsStorageId storage, NcmContentMetaDatabase* out);

View File

@ -6,6 +6,7 @@
*/ */
#pragma once #pragma once
#include "../types.h" #include "../types.h"
#include "../services/sm.h"
typedef enum { typedef enum {
PcvModule_CpuBus = 0, PcvModule_CpuBus = 0,
@ -192,6 +193,7 @@ typedef enum {
Result pcvInitialize(void); Result pcvInitialize(void);
void pcvExit(void); void pcvExit(void);
Service* pcvGetServiceSession(void);
Result pcvGetModuleId(PcvModuleId *module_id, PcvModule module); Result pcvGetModuleId(PcvModuleId *module_id, PcvModule module);

View File

@ -161,6 +161,7 @@ typedef struct {
Result pdmqryInitialize(void); Result pdmqryInitialize(void);
void pdmqryExit(void); void pdmqryExit(void);
Service* pdmqueryGetServiceSession(void);
/** /**
* @brief Gets a list of \ref PdmApplicationEvent. * @brief Gets a list of \ref PdmApplicationEvent.

View File

@ -27,6 +27,7 @@ typedef struct {
Result plInitialize(void); Result plInitialize(void);
void plExit(void); void plExit(void);
Service* plGetServiceSession(void);
void* plGetSharedmemAddr(void); void* plGetSharedmemAddr(void);
///< Gets a specific shared-font via SharedFontType, see \ref PlSharedFontType. ///< Gets a specific shared-font via SharedFontType, see \ref PlSharedFontType.

View File

@ -26,6 +26,7 @@ typedef struct {
Result pscInitialize(void); Result pscInitialize(void);
void pscExit(void); void pscExit(void);
Service* pscGetServiceSession(void);
Result pscGetPmModule(PscPmModule *out, u16 module_id, const u16 *dependencies, size_t dependency_count, bool autoclear); Result pscGetPmModule(PscPmModule *out, u16 module_id, const u16 *dependencies, size_t dependency_count, bool autoclear);

View File

@ -30,6 +30,7 @@ typedef struct {
Result psmInitialize(void); Result psmInitialize(void);
void psmExit(void); void psmExit(void);
Service* psmGetServiceSession(void);
Result psmGetBatteryChargePercentage(u32 *out); Result psmGetBatteryChargePercentage(u32 *out);
Result psmGetChargerType(ChargerType *out); Result psmGetChargerType(ChargerType *out);

View File

@ -11,12 +11,15 @@
Result ldrRoInitialize(void); Result ldrRoInitialize(void);
void ldrRoExit(void); void ldrRoExit(void);
Service* ldrRoGetServiceSession(void);
Result ro1Initialize(void); Result ro1Initialize(void);
void ro1Exit(void); void ro1Exit(void);
Service* ro1GetServiceSession(void);
Result roDmntInitialize(void); Result roDmntInitialize(void);
void roDmntExit(void); void roDmntExit(void);
Service* roDmntGetServiceSession(void);
Result ldrRoLoadNro(u64* out_address, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size); Result ldrRoLoadNro(u64* out_address, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size);
Result ldrRoUnloadNro(u64 nro_address); Result ldrRoUnloadNro(u64 nro_address);

View File

@ -9,6 +9,7 @@
#pragma once #pragma once
#include "../result.h" #include "../result.h"
#include "../kernel/event.h" #include "../kernel/event.h"
#include "../services/sm.h"
#define SET_MAX_NAME_SIZE 0x48 #define SET_MAX_NAME_SIZE 0x48
#define SET_MAX_NICKNAME_SIZE 0x80 #define SET_MAX_NICKNAME_SIZE 0x80
@ -86,6 +87,7 @@ typedef struct {
Result setInitialize(void); Result setInitialize(void);
void setExit(void); void setExit(void);
Service* setGetServiceSession(void);
/// Converts LanguageCode to Language. /// Converts LanguageCode to Language.
Result setMakeLanguage(u64 LanguageCode, s32 *Language); Result setMakeLanguage(u64 LanguageCode, s32 *Language);
@ -114,6 +116,7 @@ Result setGetRegionCode(SetRegion *out);
Result setsysInitialize(void); Result setsysInitialize(void);
void setsysExit(void); void setsysExit(void);
Service* setsysGetServiceSession(void);
/// Gets the current system theme. /// Gets the current system theme.
Result setsysGetColorSetId(ColorSetId *out); Result setsysGetColorSetId(ColorSetId *out);

View File

@ -36,21 +36,27 @@ typedef enum {
Result splInitialize(void); Result splInitialize(void);
void splExit(void); void splExit(void);
Service* splGetServiceSession(void);
Result splCryptoInitialize(void); Result splCryptoInitialize(void);
void splCryptoExit(void); void splCryptoExit(void);
Service* splCryptoGetServiceSession(void);
Result splSslInitialize(void); Result splSslInitialize(void);
void splSslExit(void); void splSslExit(void);
Service* splSslGetServiceSession(void);
Result splEsInitialize(void); Result splEsInitialize(void);
void splEsExit(void); void splEsExit(void);
Service* splEsGetServiceSession(void);
Result splFsInitialize(void); Result splFsInitialize(void);
void splFsExit(void); void splFsExit(void);
Service* splFsGetServiceSession(void);
Result splManuInitialize(void); Result splManuInitialize(void);
void splManuExit(void); void splManuExit(void);
Service* splManuGetServiceSession(void);
Result splGetConfig(SplConfigItem config_item, u64 *out_config); Result splGetConfig(SplConfigItem config_item, u64 *out_config);
Result splUserExpMod(const void *input, const void *modulus, const void *exp, size_t exp_size, void *dst); Result splUserExpMod(const void *input, const void *modulus, const void *exp, size_t exp_size, void *dst);

View File

@ -6,9 +6,11 @@
*/ */
#pragma once #pragma once
#include "../types.h" #include "../types.h"
#include "../services/sm.h"
Result spsmInitialize(void); Result spsmInitialize(void);
void spsmExit(void); void spsmExit(void);
Service* spsmGetServiceSession(void);
Result spsmShutdown(bool reboot); Result spsmShutdown(bool reboot);
Result spsmPutErrorState(void); Result spsmPutErrorState(void);

View File

@ -46,7 +46,7 @@ typedef struct {
Result timeInitialize(void); Result timeInitialize(void);
void timeExit(void); void timeExit(void);
Service* timeGetSessionService(void); Service* timeGetServiceSession(void);
Result timeGetCurrentTime(TimeType type, u64 *timestamp); Result timeGetCurrentTime(TimeType type, u64 *timestamp);

View File

@ -64,6 +64,7 @@ typedef enum {
Result usbDsInitialize(void); Result usbDsInitialize(void);
/// Closes the usb:ds session. Any interfaces/endpoints which are left open are automatically closed, since otherwise usb-sysmodule won't fully reset usb:ds to defaults. /// Closes the usb:ds session. Any interfaces/endpoints which are left open are automatically closed, since otherwise usb-sysmodule won't fully reset usb:ds to defaults.
void usbDsExit(void); void usbDsExit(void);
Service* usbDsGetServiceSession(void);
/// Helpers /// Helpers
Result usbDsWaitReady(u64 timeout); Result usbDsWaitReady(u64 timeout);

View File

@ -104,6 +104,7 @@ typedef struct {
/// Initialize/exit usb:hs. /// Initialize/exit usb:hs.
Result usbHsInitialize(void); Result usbHsInitialize(void);
void usbHsExit(void); void usbHsExit(void);
Service* usbHsGetServiceSession(void);
/// Returns the Event loaded during init with autoclear=false. /// Returns the Event loaded during init with autoclear=false.
/// Signaled when a device was removed. /// Signaled when a device was removed.

View File

@ -18,6 +18,7 @@ typedef enum {
Result wlaninfInitialize(void); Result wlaninfInitialize(void);
void wlaninfExit(void); void wlaninfExit(void);
Service* wlaninfGetServiceSession(void);
Result wlaninfGetState(WlanInfState* out); Result wlaninfGetState(WlanInfState* out);

View File

@ -30,7 +30,7 @@ void accountExit(void)
serviceClose(&g_accSrv); serviceClose(&g_accSrv);
} }
Service* accountGetService(void) { Service* accountGetServiceSession(void) {
return &g_accSrv; return &g_accSrv;
} }

View File

@ -41,6 +41,10 @@ void apmExit(void)
} }
} }
Service* apmGetServiceSession(void) {
return &g_apmSrv;
}
static Result _apmGetSession(Service* srv, Service* srv_out, u64 cmd_id) { static Result _apmGetSession(Service* srv, Service* srv_out, u64 cmd_id) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -47,6 +47,10 @@ void auddevExit(void) {
} }
} }
Service* auddevGetServiceSession(void) {
return &g_auddevIAudioDevice;
}
static Result _auddevGetAudioDeviceService(Service* srv, Service* out_srv, u64 aruid) { static Result _auddevGetAudioDeviceService(Service* srv, Service* out_srv, u64 aruid) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -129,6 +129,10 @@ void audrenExit(void)
tmemClose(&g_audrenWorkBuf); tmemClose(&g_audrenWorkBuf);
} }
Service* audrenGetServiceSession(void) {
return &g_audrenIAudioRenderer;
}
void audrenWaitFrame(void) void audrenWaitFrame(void)
{ {
eventWait(&g_audrenEvent, U64_MAX); eventWait(&g_audrenEvent, U64_MAX);

View File

@ -29,6 +29,10 @@ void bpcExit(void)
serviceClose(&g_bpcSrv); serviceClose(&g_bpcSrv);
} }
Service* bpcGetServiceSession(void) {
return &g_bpcSrv;
}
Result bpcShutdownSystem(void) Result bpcShutdownSystem(void)
{ {
IpcCommand c; IpcCommand c;

View File

@ -277,6 +277,10 @@ void bsdExit(void) {
tmemClose(&g_bsdTmem); tmemClose(&g_bsdTmem);
} }
Service* bsdGetServiceSession(void) {
return &g_bsdSrv;
}
int bsdSocket(int domain, int type, int protocol) { int bsdSocket(int domain, int type, int protocol) {
return _bsdSocketCreationCommand(2, domain, type, protocol); return _bsdSocketCreationCommand(2, domain, type, protocol);
} }

View File

@ -33,6 +33,10 @@ void capsscExit(void) {
serviceClose(&g_capsscSrv); serviceClose(&g_capsscSrv);
} }
Service* capsscGetServiceSession(void) {
return &g_capsscSrv;
}
Result capsscCaptureScreenshot(void* buf, size_t size, u32 inval, u64 width, u64 height, s64 buffer_count, s64 buffer_index, u64 timeout) { Result capsscCaptureScreenshot(void* buf, size_t size, u32 inval, u64 width, u64 height, s64 buffer_count, s64 buffer_index, u64 timeout) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -35,6 +35,10 @@ void capssuExit(void) {
serviceClose(&g_capssuSrv); serviceClose(&g_capssuSrv);
} }
Service* capssuGetServiceSession(void) {
return &g_capssuSrv;
}
static Result _capssuSaveScreenShotEx0(const void* buffer, size_t size, CapsScreenShotAttribute *attr, u32 unk, CapsApplicationAlbumEntry *out) { static Result _capssuSaveScreenShotEx0(const void* buffer, size_t size, CapsScreenShotAttribute *attr, u32 unk, CapsApplicationAlbumEntry *out) {
u64 AppletResourceUserId = 0; u64 AppletResourceUserId = 0;
appletGetAppletResourceUserId(&AppletResourceUserId); appletGetAppletResourceUserId(&AppletResourceUserId);

View File

@ -37,6 +37,10 @@ void clkrstExit(void) {
} }
} }
Service* clkrstGetServiceSession(void) {
return &g_clkrstSrv;
}
Result clkrstOpenSession(ClkrstSession* session_out, PcvModuleId module_id, u32 unk) { Result clkrstOpenSession(ClkrstSession* session_out, PcvModuleId module_id, u32 unk) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -25,6 +25,10 @@ void csrngExit(void) {
serviceClose(&g_csrngSrv); serviceClose(&g_csrngSrv);
} }
Service* csrngGetServiceSession(void) {
return &g_csrngSrv;
}
Result csrngGetRandomBytes(void *out, size_t out_size) { Result csrngGetRandomBytes(void *out, size_t out_size) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -39,6 +39,10 @@ void fsldrExit(void) {
serviceClose(&g_fsldrSrv); serviceClose(&g_fsldrSrv);
} }
Service* fsldrGetServiceSession(void) {
return &g_fsldrSrv;
}
Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out) { Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out) {
char send_path[FS_MAX_PATH+1] = {0}; char send_path[FS_MAX_PATH+1] = {0};
IpcCommand c; IpcCommand c;

View File

@ -39,6 +39,10 @@ void fsprExit(void) {
serviceClose(&g_fsprSrv); serviceClose(&g_fsprSrv);
} }
Service* fsprGetServiceSession(void) {
return &g_fsprSrv;
}
Result fsprRegisterProgram(u64 pid, u64 titleID, FsStorageId storageID, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size) { Result fsprRegisterProgram(u64 pid, u64 titleID, FsStorageId storageID, const void *fs_access_header, size_t fah_size, const void *fs_access_control, size_t fac_size) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -29,6 +29,10 @@ void gpioExit(void) {
} }
} }
Service* gpioGetServiceSession(void) {
return &g_gpioSrv;
}
Result gpioOpenSession(GpioPadSession *out, GpioPadName name) { Result gpioOpenSession(GpioPadSession *out, GpioPadName name) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -167,7 +167,7 @@ void hidReset(void)
rwlockWriteUnlock(&g_hidLock); rwlockWriteUnlock(&g_hidLock);
} }
Service* hidGetSessionService(void) { Service* hidGetServiceSession(void) {
return &g_hidSrv; return &g_hidSrv;
} }

View File

@ -37,6 +37,10 @@ void hiddbgExit(void) {
} }
} }
Service* hiddbgGetServiceSession(void) {
return &g_hiddbgSrv;
}
static Result _hiddbgCmdNoIO(u64 cmd_id) { static Result _hiddbgCmdNoIO(u64 cmd_id) {
Result rc; Result rc;

View File

@ -38,6 +38,10 @@ void hidsysExit(void) {
} }
} }
Service* hidsysGetServiceSession(void) {
return &g_hidsysSrv;
}
Result hidsysEnableAppletToGetInput(bool enable) { Result hidsysEnableAppletToGetInput(bool enable) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -33,6 +33,10 @@ void i2cExit(void) {
} }
} }
Service* i2cGetServiceSession(void) {
return &g_i2cSrv;
}
Result i2cOpenSession(I2cSession *out, I2cDevice dev) { Result i2cOpenSession(I2cSession *out, I2cDevice dev) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -135,7 +135,7 @@ static void _IrsCameraEntryFree(IrsCameraEntry *entry) {
memset(entry, 0, sizeof(IrsCameraEntry)); memset(entry, 0, sizeof(IrsCameraEntry));
} }
Service* irsGetSessionService(void) { Service* irsGetServiceSession(void) {
return &g_irsSrv; return &g_irsSrv;
} }

View File

@ -29,6 +29,10 @@ void lblExit(void) {
} }
} }
Service* lblGetServiceSession(void) {
return &g_lblSrv;
}
static Result _lblCmdNoIO(u64 cmd_id) { static Result _lblCmdNoIO(u64 cmd_id) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -27,6 +27,10 @@ void lrExit(void) {
} }
} }
Service* lrGetServiceSession(void) {
return &g_managerSrv;
}
Result lrOpenLocationResolver(FsStorageId storage, LrLocationResolver* out) { Result lrOpenLocationResolver(FsStorageId storage, LrLocationResolver* out) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -20,6 +20,10 @@ void ncmExit(void) {
} }
} }
Service* ncmGetServiceSession(void) {
return &g_ncmSrv;
}
Result ncmOpenContentStorage(FsStorageId storage, NcmContentStorage* out) { Result ncmOpenContentStorage(FsStorageId storage, NcmContentStorage* out) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -30,6 +30,10 @@ void pcvExit(void) {
} }
} }
Service* pcvGetServiceSession(void) {
return &g_pcvSrv;
}
Result pcvGetModuleId(PcvModuleId *module_id, PcvModule module) { Result pcvGetModuleId(PcvModuleId *module_id, PcvModule module) {
static const PcvModuleId s_moduleIdMap[PcvModule_Count] = { static const PcvModuleId s_moduleIdMap[PcvModule_Count] = {
PcvModuleId_CpuBus, PcvModuleId_GPU, PcvModuleId_I2S1, PcvModuleId_I2S2, PcvModuleId_CpuBus, PcvModuleId_GPU, PcvModuleId_I2S1, PcvModuleId_I2S2,

View File

@ -29,6 +29,10 @@ void pdmqryExit(void) {
serviceClose(&g_pdmqrySrv); serviceClose(&g_pdmqrySrv);
} }
Service* pdmqryGetServiceSession(void) {
return &g_pdmqrySrv;
}
static Result _pdmqryQueryEvent(u64 cmd_id, u32 entryindex, void* events, size_t entrysize, s32 count, s32 *total_out) { static Result _pdmqryQueryEvent(u64 cmd_id, u32 entryindex, void* events, size_t entrysize, s32 count, s32 *total_out) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -53,6 +53,10 @@ void plExit(void)
} }
} }
Service* plGetServiceSession(void) {
return &g_plSrv;
}
void* plGetSharedmemAddr(void) { void* plGetSharedmemAddr(void) {
return shmemGetAddr(&g_plSharedmem); return shmemGetAddr(&g_plSharedmem);
} }

View File

@ -45,6 +45,10 @@ void pscExit(void) {
} }
} }
Service* pscGetServiceSession(void) {
return &g_pscSrv;
}
Result pscGetPmModule(PscPmModule *out, u16 module_id, const u16 *dependencies, size_t dependency_count, bool autoclear) { Result pscGetPmModule(PscPmModule *out, u16 module_id, const u16 *dependencies, size_t dependency_count, bool autoclear) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -37,6 +37,10 @@ void psmExit(void) {
} }
} }
Service* psmGetServiceSession(void) {
return &g_psmSrv;
}
static Result _psmGetOutU32(u64 cmd_id, u32 *out) { static Result _psmGetOutU32(u64 cmd_id, u32 *out) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -37,6 +37,10 @@ void ldrRoExit(void) {
serviceClose(&g_roSrv); serviceClose(&g_roSrv);
} }
Service* ldrRoGetServiceSession(void) {
return &g_roSrv;
}
Result ro1Initialize(void) { Result ro1Initialize(void) {
if (hosversionBefore(7,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); if (hosversionBefore(7,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -59,6 +63,10 @@ void ro1Exit(void) {
serviceClose(&g_ro1Srv); serviceClose(&g_ro1Srv);
} }
Service* ro1GetServiceSession(void) {
return &g_ro1Srv;
}
Result roDmntInitialize(void) { Result roDmntInitialize(void) {
if (hosversionBefore(3,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); if (hosversionBefore(3,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -75,6 +83,10 @@ void roDmntExit(void) {
serviceClose(&g_dmntSrv); serviceClose(&g_dmntSrv);
} }
Service* roDmntGetServiceSession(void) {
return &g_dmntSrv;
}
Result _rosrvInitialize(Service* srv) { Result _rosrvInitialize(Service* srv) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -45,6 +45,10 @@ void setExit(void)
} }
} }
Service* setGetServiceSession(void) {
return &g_setSrv;
}
Result setsysInitialize(void) Result setsysInitialize(void)
{ {
atomicIncrement64(&g_refCntSys); atomicIncrement64(&g_refCntSys);
@ -62,6 +66,10 @@ void setsysExit(void)
} }
} }
Service* setsysGetSessionService(void) {
return &g_setsysSrv;
}
static Result setInitializeLanguageCodesCache(void) { static Result setInitializeLanguageCodesCache(void) {
if (g_setLanguageCodesInitialized) return 0; if (g_setLanguageCodesInitialized) return 0;
Result rc = 0; Result rc = 0;

View File

@ -18,6 +18,8 @@ static Service* _splGetRsaSrv(void);
static Service* _splGetEsSrv(void); static Service* _splGetEsSrv(void);
static Service* _splGetFsSrv(void); static Service* _splGetFsSrv(void);
static Service* _splGetSslSrv(void);
static Service* _splGetManuSrv(void);
Service* _splGetGeneralSrv(void) { Service* _splGetGeneralSrv(void) {
if (hosversionBefore(4,0,0)) { if (hosversionBefore(4,0,0)) {
@ -71,6 +73,14 @@ Service* _splGetFsSrv(void) {
return hosversionAtLeast(4,0,0) ? &g_splFsSrv : &g_splSrv; return hosversionAtLeast(4,0,0) ? &g_splFsSrv : &g_splSrv;
} }
Service* _splGetSslSrv(void) {
return hosversionAtLeast(4,0,0) ? &g_splSslSrv : &g_splSrv;
}
Service* _splGetManuSrv(void) {
return hosversionAtLeast(4,0,0) ? &g_splManuSrv : &g_splSrv;
}
/* There are like six services, so these helpers will initialize/exit the relevant services. */ /* There are like six services, so these helpers will initialize/exit the relevant services. */
static Result _splSrvInitialize(Service* srv, u64 *refcnt, const char *name) { static Result _splSrvInitialize(Service* srv, u64 *refcnt, const char *name) {
atomicIncrement64(refcnt); atomicIncrement64(refcnt);
@ -94,6 +104,10 @@ void splExit(void) {
return _splSrvExit(&g_splSrv, &g_splRefCnt); return _splSrvExit(&g_splSrv, &g_splRefCnt);
} }
Service* splGetServiceSession(void) {
return _splGetGeneralSrv();
}
Result splCryptoInitialize(void) { Result splCryptoInitialize(void) {
if (hosversionAtLeast(4,0,0)) { if (hosversionAtLeast(4,0,0)) {
return _splSrvInitialize(&g_splCryptoSrv, &g_splCryptoRefCnt, "spl:mig"); return _splSrvInitialize(&g_splCryptoSrv, &g_splCryptoRefCnt, "spl:mig");
@ -110,6 +124,10 @@ void splCryptoExit(void) {
} }
} }
Service* splCryptoGetServiceSession(void) {
return _splGetCryptoSrv();
}
Result splSslInitialize(void) { Result splSslInitialize(void) {
if (hosversionAtLeast(4,0,0)) { if (hosversionAtLeast(4,0,0)) {
return _splSrvInitialize(&g_splSslSrv, &g_splSslRefCnt, "spl:ssl"); return _splSrvInitialize(&g_splSslSrv, &g_splSslRefCnt, "spl:ssl");
@ -126,6 +144,10 @@ void splSslExit(void) {
} }
} }
Service* splSslGetServiceSession(void) {
return _splGetSslSrv();
}
Result splEsInitialize(void) { Result splEsInitialize(void) {
if (hosversionAtLeast(4,0,0)) { if (hosversionAtLeast(4,0,0)) {
return _splSrvInitialize(&g_splEsSrv, &g_splEsRefCnt, "spl:es"); return _splSrvInitialize(&g_splEsSrv, &g_splEsRefCnt, "spl:es");
@ -142,6 +164,10 @@ void splEsExit(void) {
} }
} }
Service* splEsGetServiceSession(void) {
return _splGetEsSrv();
}
Result splFsInitialize(void) { Result splFsInitialize(void) {
if (hosversionAtLeast(4,0,0)) { if (hosversionAtLeast(4,0,0)) {
return _splSrvInitialize(&g_splFsSrv, &g_splFsRefCnt, "spl:fs"); return _splSrvInitialize(&g_splFsSrv, &g_splFsRefCnt, "spl:fs");
@ -158,6 +184,10 @@ void splFsExit(void) {
} }
} }
Service* splFsGetServiceSession(void) {
return _splGetFsSrv();
}
Result splManuInitialize(void) { Result splManuInitialize(void) {
return _splSrvInitialize(&g_splManuSrv, &g_splManuRefCnt, "spl:manu"); return _splSrvInitialize(&g_splManuSrv, &g_splManuRefCnt, "spl:manu");
} }
@ -166,6 +196,10 @@ void splManuExit(void) {
return _splSrvExit(&g_splManuSrv, &g_splManuRefCnt); return _splSrvExit(&g_splManuSrv, &g_splManuRefCnt);
} }
Service* splManuGetServiceSession(void) {
return _splGetManuSrv();
}
/* SPL IGeneralService functionality. */ /* SPL IGeneralService functionality. */
Result splGetConfig(SplConfigItem config_item, u64 *out_config) { Result splGetConfig(SplConfigItem config_item, u64 *out_config) {

View File

@ -29,6 +29,10 @@ void spsmExit(void) {
} }
} }
Service* spsmGetServiceSession(void) {
return &g_spsmSrv;
}
Result spsmShutdown(bool reboot) { Result spsmShutdown(bool reboot) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);

View File

@ -60,7 +60,7 @@ void timeExit(void)
} }
} }
Service* timeGetSessionService(void) { Service* timeGetServiceSession(void) {
return &g_timeSrv; return &g_timeSrv;
} }

View File

@ -78,6 +78,10 @@ void usbDsExit(void)
serviceClose(&g_usbDsSrv); serviceClose(&g_usbDsSrv);
} }
Service* usbDsGetServiceSession(void) {
return &g_usbDsSrv;
}
Event* usbDsGetStateChangeEvent(void) Event* usbDsGetStateChangeEvent(void)
{ {
return &g_usbDsStateChangeEvent; return &g_usbDsStateChangeEvent;

View File

@ -52,6 +52,10 @@ void usbHsExit(void) {
serviceClose(&g_usbHsSrv); serviceClose(&g_usbHsSrv);
} }
Service* usbHsGetServiceSession(void) {
return &g_usbHsSrv;
}
Event* usbHsGetInterfaceStateChangeEvent(void) { Event* usbHsGetInterfaceStateChangeEvent(void) {
return &g_usbHsInterfaceStateChangeEvent; return &g_usbHsInterfaceStateChangeEvent;
} }

View File

@ -36,6 +36,10 @@ void wlaninfExit(void) {
} }
} }
Service* wlaninfGetServiceSession(void) {
return &g_wlaninfSrv;
}
Result wlaninfGetState(WlanInfState* out) { Result wlaninfGetState(WlanInfState* out) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);