Skip to content

Commit

Permalink
Implement more functions/classes from nn::sl (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell authored Apr 22, 2024
1 parent c145777 commit f01a0b8
Show file tree
Hide file tree
Showing 76 changed files with 5,254 additions and 113 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SOURCES := cafe \
libraries/libgfd/src \
libraries/libirc/src \
libraries/nn_erreula \
libraries/nn_sl \
libraries/nn_swkbd
DATA := data
INCLUDES := include \
Expand Down
30 changes: 28 additions & 2 deletions include/nn/sl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,32 @@
* \defgroup nn_sl nn_sl
*/

#include <nn/sl/sl_cpp.h>
#include <nn/sl/LaunchInfoDatabase.h>
#include <nn/sl/CacheManager.h>
#include <nn/sl/Condition.h>
#include <nn/sl/DataCreator.h>
#include <nn/sl/DrcManager.h>
#include <nn/sl/FileStream.h>
#include <nn/sl/IAccountInfoAccessor.h>
#include <nn/sl/IBlackListAccessor.h>
#include <nn/sl/IDefaultTitleAccessor.h>
#include <nn/sl/IKillerNotificationAccessor.h>
#include <nn/sl/ILaunchedTitleListAccessor.h>
#include <nn/sl/IPreferentialTitleAccessor.h>
#include <nn/sl/ISerializer.h>
#include <nn/sl/ISettingAccessor.h>
#include <nn/sl/IStream.h>
#include <nn/sl/ITimeAccessor.h>
#include <nn/sl/ITitleIconCache.h>
#include <nn/sl/ITitleListAccessor.h>
#include <nn/sl/ITransferrer.h>
#include <nn/sl/IUpdatePackageAccessor.h>
#include <nn/sl/IWhiteListAccessor.h>
#include <nn/sl/KillerNotification.h>
#include <nn/sl/KillerNotificationSelector.h>
#include <nn/sl/KillerNotificationTransferRecordManager.h>
#include <nn/sl/KillerNotificationTransferRecordStream.h>
#include <nn/sl/LaunchInfoDatabase.h>
#include <nn/sl/QuickStartApplicationSelector.h>
#include <nn/sl/TitleIconCache.h>
#include <nn/sl/TitleListCache.h>
#include <nn/sl/sl_cpp.h>
95 changes: 95 additions & 0 deletions include/nn/sl/CacheManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#pragma once

#include <nn/result.h>
#include <nn/sl/ISerializer.h>
#include <nn/sl/KillerNotification.h>
#include <nn/sl/sl_cpp.h>
#include <wut.h>

#ifdef __cplusplus

namespace nn::sl {
namespace details {
typedef struct WUT_PACKED CacheManagerInternal {
ISerializerInternal *quickStartTitleInfoSerializer;
ISerializerInternal *killerNotificationSerializer;
ISerializerInternal *jumpTitleInfoSerializer;
} CacheManagerInternal;
WUT_CHECK_SIZE(CacheManagerInternal, 0x0c);
WUT_CHECK_OFFSET(CacheManagerInternal, 0x00, quickStartTitleInfoSerializer);
WUT_CHECK_OFFSET(CacheManagerInternal, 0x04, killerNotificationSerializer);
WUT_CHECK_OFFSET(CacheManagerInternal, 0x08, jumpTitleInfoSerializer);

extern "C" CacheManagerInternal *__ct__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *);
extern "C" void SetupInitialCache__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *);
extern "C" nn::Result GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(CacheManagerInternal *, KillerNotification *, TitleInfo *);
extern "C" nn::Result GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(CacheManagerInternal *, TitleInfo *, int);
extern "C" nn::Result Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(CacheManagerInternal *, TitleInfo *, int, KillerNotification *, TitleInfo *);
extern "C" nn::Result Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(
CacheManagerInternal *,
ISerializerInternal *,
ISerializerInternal *,
ISerializerInternal *);
} // namespace details

class CacheManager {
public:
CacheManager() : mQuickStartTitleInfoSerializer(nullptr),
mKillerNotificationSerializer(nullptr),
mJumpTitleInfoSerializer(nullptr) {
if (__ct__Q3_2nn2sl12CacheManagerFv(&mInstance) != nullptr) {
mQuickStartTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(mInstance.quickStartTitleInfoSerializer);
mKillerNotificationSerializer = details::SerializerFromPtr<KillerNotification>(mInstance.killerNotificationSerializer);
mJumpTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(mInstance.jumpTitleInfoSerializer);
}
}

[[nodiscard]] details::ISerializerBase<TitleInfo> &GetQuickStartTitleInfoSerializer() {
return mQuickStartTitleInfoSerializer;
}

[[nodiscard]] details::ISerializerBase<KillerNotification> &GetKillerNotificationSerializer() {
return mKillerNotificationSerializer;
}

[[nodiscard]] details::ISerializerBase<TitleInfo> &GetJumpTitleInfoSerializer() {
return mJumpTitleInfoSerializer;
}

void SetupInitialCache() {
SetupInitialCache__Q3_2nn2sl12CacheManagerFv(&mInstance);
}

nn::Result GetKillerNotificationCache(KillerNotification *u1, TitleInfo *u2) {
return GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(&mInstance, u1, u2);
}

nn::Result GetQuickStartCache(TitleInfo *u1, int u2) {
return GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(&mInstance, u1, u2);
}

nn::Result Get(TitleInfo *u1, int u2, KillerNotification *u3, TitleInfo *u4) {
return Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(&mInstance, u1, u2, u3, u4);
}

void Initialize(details::ISerializerBase<TitleInfo> &quickStartTitleInfoSerializer, details::ISerializerBase<KillerNotification> &killerNotificationSerializer, details::ISerializerBase<TitleInfo> &jumpTitleInfoSerializer) {
Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(&mInstance,
quickStartTitleInfoSerializer.GetInternal(),
killerNotificationSerializer.GetInternal(),
jumpTitleInfoSerializer.GetInternal());
mQuickStartTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(quickStartTitleInfoSerializer.GetInternal());
mKillerNotificationSerializer = details::SerializerFromPtr<KillerNotification>(killerNotificationSerializer.GetInternal());
mJumpTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(jumpTitleInfoSerializer.GetInternal());
}

~CacheManager() = default;

private:
details::CacheManagerInternal mInstance{};
details::SerializerFromPtr<TitleInfo> mQuickStartTitleInfoSerializer;
details::SerializerFromPtr<KillerNotification> mKillerNotificationSerializer;
details::SerializerFromPtr<TitleInfo> mJumpTitleInfoSerializer;
};
} // namespace nn::sl

#endif
115 changes: 115 additions & 0 deletions include/nn/sl/Condition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#pragma once

#include <coreinit/time.h>
#include <nn/result.h>
#include <nn/sl/ISettingAccessor.h>
#include <nn/sl/ITimeAccessor.h>
#include <nn/sl/IUpdatePackageAccessor.h>
#include <nn/sl/details/ISerializerDetails.h>
#include <wut.h>

#ifdef __cplusplus

namespace nn::sl {
namespace details {
typedef struct WUT_PACKED ConditionInternal {
ISettingAccessorInternal *settingAccessor;
IUpdatePackageAccessorInternal *updatePackageAccessor;
ISerializerInternal *previousSendingTimeSerializer;
ITimeAccessorInternal *timeAccessor;
void *vtable;
} ConditionInternal;
WUT_CHECK_SIZE(ConditionInternal, 0x14);
WUT_CHECK_OFFSET(ConditionInternal, 0x00, settingAccessor);
WUT_CHECK_OFFSET(ConditionInternal, 0x04, updatePackageAccessor);
WUT_CHECK_OFFSET(ConditionInternal, 0x08, previousSendingTimeSerializer);
WUT_CHECK_OFFSET(ConditionInternal, 0x0C, timeAccessor);
WUT_CHECK_OFFSET(ConditionInternal, 0x10, vtable);

extern "C" ConditionInternal *__ct__Q3_2nn2sl9ConditionFv(ConditionInternal *);
extern "C" nn::Result GetEnability__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
extern "C" nn::Result StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
extern "C" nn::Result NeedsUpdate__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
extern "C" nn::Result GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(ConditionInternal *, int64_t *outTime);
extern "C" void Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(ConditionInternal *,
ISettingAccessorInternal *,
IUpdatePackageAccessorInternal *,
ISerializerInternal *,
ITimeAccessorInternal *);
} // namespace details

class Condition {
public:
Condition() : mSettingAccessor(nullptr),
mUpdatePackageAccessor(nullptr),
mPreviousSendingTimeSerializer(nullptr),
mTimeAccessor(nullptr) {
if (__ct__Q3_2nn2sl9ConditionFv(&mInstance) != nullptr) {
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingAccessor);
mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(mInstance.updatePackageAccessor);
mPreviousSendingTimeSerializer = details::SerializerFromPtr<OSTime>(mInstance.previousSendingTimeSerializer);
mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor);
}
}

~Condition() = default;

[[nodiscard]] details::ISettingAccessorBase &GetSettingAccessor() {
return mSettingAccessor;
}

[[nodiscard]] details::IUpdatePackageAccessorBase &GetUpdatePackageAccessor() {
return mUpdatePackageAccessor;
}

[[nodiscard]] details::ISerializerBase<OSTime> &GetPreviousSendingTimeSerializer() {
return mPreviousSendingTimeSerializer;
}

[[nodiscard]] details::ITimeAccessorBase &GetTimeAccessor() {
return mTimeAccessor;
}

nn::Result GetEnability() {
return GetEnability__Q3_2nn2sl9ConditionCFv(&mInstance);
}

nn::Result NeedsUpdate() {
return NeedsUpdate__Q3_2nn2sl9ConditionCFv(&mInstance);
}

nn::Result StoreCurrentTimeAsPreviousSendingTime() {
return StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(&mInstance);
}

nn::Result GetPreviousSendingTime(int64_t *outTime) {
return GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(&mInstance, outTime);
}

void Initialize(details::ISettingAccessorBase &settingAccessor,
details::IUpdatePackageAccessorBase &updatePackageAccessor,
details::ISerializerBase<OSTime> &previousSendingTimeSerializer,
details::ITimeAccessorBase &timeAccessor) {
Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(
&mInstance,
settingAccessor.GetInternal(),
updatePackageAccessor.GetInternal(),
previousSendingTimeSerializer.GetInternal(),
timeAccessor.GetInternal());
mSettingAccessor = details::SettingAccessorFromPtr(settingAccessor.GetInternal());
mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(updatePackageAccessor.GetInternal());
mPreviousSendingTimeSerializer = details::SerializerFromPtr<OSTime>(previousSendingTimeSerializer.GetInternal());
mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal());
}

private:
details::ConditionInternal mInstance = {};
details::SettingAccessorFromPtr mSettingAccessor;
details::UpdatePackageAccessorFromPtr mUpdatePackageAccessor;
details::SerializerFromPtr<OSTime> mPreviousSendingTimeSerializer;
details::TimeAccessorFromPtr mTimeAccessor;
};

} // namespace nn::sl

#endif
99 changes: 99 additions & 0 deletions include/nn/sl/DataCreator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#pragma once

#include <nn/result.h>
#include <nn/sl/IIconInfoAccessor.h>
#include <nn/sl/ISettingAccessor.h>
#include <nn/sl/ITitleIconCache.h>
#include <nn/sl/KillerNotification.h>
#include <nn/sl/LaunchInfoDatabase.h>
#include <nn/sl/details/IAccountInfoAccessorDetails.h>
#include <nn/sl/sl_cpp.h>
#include <wut.h>

#ifdef __cplusplus

namespace nn ::sl {
namespace details {
typedef struct WUT_PACKED DataCreatorInternal {
IIconInfoAccessorInternal *iconInfoAccessor;
IAccountInfoAccessorInternal *accountInfoAccessor;
ISettingAccessorInternal *settingInfoAccessor;
ITitleIconCacheInternal *titleIconCache;
void *vtable;
} DataCreatorInternal;
WUT_CHECK_SIZE(DataCreatorInternal, 0x14);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x00, iconInfoAccessor);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x04, accountInfoAccessor);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x08, settingInfoAccessor);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x0c, titleIconCache);
WUT_CHECK_OFFSET(DataCreatorInternal, 0x10, vtable);

extern "C" DataCreatorInternal *__ct__Q3_2nn2sl11DataCreatorFv(DataCreatorInternal *);
extern "C" nn::Result Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase(
DataCreatorInternal *, TransferableInfo *, const TitleInfo *, int, const KillerNotification &, const TitleInfo &, LaunchInfoDatabase &);
extern "C" nn::Result Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache(
DataCreatorInternal *, IIconInfoAccessorInternal *, IAccountInfoAccessorInternal *, ISettingAccessorInternal *, ITitleIconCacheInternal *);
} // namespace details


class DataCreator {
public:
DataCreator() : mIconInfoAccessor(nullptr),
mAccountInfoAccessor(nullptr),
mSettingAccessor(nullptr),
mTitleIconCache(nullptr) {
if (__ct__Q3_2nn2sl11DataCreatorFv(&mInstance) != nullptr) {
mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor);
mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor);
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor);
mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache);
}
}

[[nodiscard]] details::IIconInfoAccessorBase &getIconInfoAccessor() {
return mIconInfoAccessor;
}

[[nodiscard]] details::IAccountInfoAccessorBase &getAccountInfoAccessor() {
return mAccountInfoAccessor;
}

[[nodiscard]] details::ISettingAccessorBase &getSettingAccessor() {
return mSettingAccessor;
}

[[nodiscard]] details::ITitleIconCacheBase &getTitleIconCache() {
return mTitleIconCache;
}

nn::Result Create(TransferableInfo *outTransferableInfo,
const TitleInfo *quickstartTitleInfos,
int numQuickstartTitleInfos,
const KillerNotification &killerNotification,
const TitleInfo &killerNotificationTitleInfo,
LaunchInfoDatabase &launchInfoDatabase) {
return details::Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase(
&mInstance, outTransferableInfo, quickstartTitleInfos, numQuickstartTitleInfos, killerNotification, killerNotificationTitleInfo, launchInfoDatabase);
}

void Initialize(details::IIconInfoAccessorBase &iconInfoAccessor, details::IAccountInfoAccessorBase &accountInfoAccessor, details::ISettingAccessorBase &settingAccessor, details::ITitleIconCacheBase &titleIconCache) {
details::Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache(
&mInstance, iconInfoAccessor.GetInternal(), accountInfoAccessor.GetInternal(), settingAccessor.GetInternal(), titleIconCache.GetInternal());
mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor);
mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor);
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor);
mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache);
}

~DataCreator() = default;

private:
details::DataCreatorInternal mInstance = {};
details::IconInfoAccessorFromPtr mIconInfoAccessor;
details::AccountInfoAccessorFromPtr mAccountInfoAccessor;
details::SettingAccessorFromPtr mSettingAccessor;
details::TitleIconCacheFromPtr mTitleIconCache;
};
}; // namespace nn::sl

#endif
Loading

0 comments on commit f01a0b8

Please sign in to comment.