Skip to content

Commit f01a0b8

Browse files
authored
Implement more functions/classes from nn::sl (#354)
1 parent c145777 commit f01a0b8

76 files changed

Lines changed: 5254 additions & 113 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ SOURCES := cafe \
2929
libraries/libgfd/src \
3030
libraries/libirc/src \
3131
libraries/nn_erreula \
32+
libraries/nn_sl \
3233
libraries/nn_swkbd
3334
DATA := data
3435
INCLUDES := include \

include/nn/sl.h

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@
44
* \defgroup nn_sl nn_sl
55
*/
66

7-
#include <nn/sl/sl_cpp.h>
8-
#include <nn/sl/LaunchInfoDatabase.h>
7+
#include <nn/sl/CacheManager.h>
8+
#include <nn/sl/Condition.h>
9+
#include <nn/sl/DataCreator.h>
10+
#include <nn/sl/DrcManager.h>
911
#include <nn/sl/FileStream.h>
12+
#include <nn/sl/IAccountInfoAccessor.h>
13+
#include <nn/sl/IBlackListAccessor.h>
14+
#include <nn/sl/IDefaultTitleAccessor.h>
15+
#include <nn/sl/IKillerNotificationAccessor.h>
16+
#include <nn/sl/ILaunchedTitleListAccessor.h>
17+
#include <nn/sl/IPreferentialTitleAccessor.h>
18+
#include <nn/sl/ISerializer.h>
19+
#include <nn/sl/ISettingAccessor.h>
20+
#include <nn/sl/IStream.h>
21+
#include <nn/sl/ITimeAccessor.h>
22+
#include <nn/sl/ITitleIconCache.h>
23+
#include <nn/sl/ITitleListAccessor.h>
24+
#include <nn/sl/ITransferrer.h>
25+
#include <nn/sl/IUpdatePackageAccessor.h>
26+
#include <nn/sl/IWhiteListAccessor.h>
27+
#include <nn/sl/KillerNotification.h>
28+
#include <nn/sl/KillerNotificationSelector.h>
29+
#include <nn/sl/KillerNotificationTransferRecordManager.h>
30+
#include <nn/sl/KillerNotificationTransferRecordStream.h>
31+
#include <nn/sl/LaunchInfoDatabase.h>
32+
#include <nn/sl/QuickStartApplicationSelector.h>
33+
#include <nn/sl/TitleIconCache.h>
34+
#include <nn/sl/TitleListCache.h>
35+
#include <nn/sl/sl_cpp.h>

include/nn/sl/CacheManager.h

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#pragma once
2+
3+
#include <nn/result.h>
4+
#include <nn/sl/ISerializer.h>
5+
#include <nn/sl/KillerNotification.h>
6+
#include <nn/sl/sl_cpp.h>
7+
#include <wut.h>
8+
9+
#ifdef __cplusplus
10+
11+
namespace nn::sl {
12+
namespace details {
13+
typedef struct WUT_PACKED CacheManagerInternal {
14+
ISerializerInternal *quickStartTitleInfoSerializer;
15+
ISerializerInternal *killerNotificationSerializer;
16+
ISerializerInternal *jumpTitleInfoSerializer;
17+
} CacheManagerInternal;
18+
WUT_CHECK_SIZE(CacheManagerInternal, 0x0c);
19+
WUT_CHECK_OFFSET(CacheManagerInternal, 0x00, quickStartTitleInfoSerializer);
20+
WUT_CHECK_OFFSET(CacheManagerInternal, 0x04, killerNotificationSerializer);
21+
WUT_CHECK_OFFSET(CacheManagerInternal, 0x08, jumpTitleInfoSerializer);
22+
23+
extern "C" CacheManagerInternal *__ct__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *);
24+
extern "C" void SetupInitialCache__Q3_2nn2sl12CacheManagerFv(CacheManagerInternal *);
25+
extern "C" nn::Result GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(CacheManagerInternal *, KillerNotification *, TitleInfo *);
26+
extern "C" nn::Result GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(CacheManagerInternal *, TitleInfo *, int);
27+
extern "C" nn::Result Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(CacheManagerInternal *, TitleInfo *, int, KillerNotification *, TitleInfo *);
28+
extern "C" nn::Result Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(
29+
CacheManagerInternal *,
30+
ISerializerInternal *,
31+
ISerializerInternal *,
32+
ISerializerInternal *);
33+
} // namespace details
34+
35+
class CacheManager {
36+
public:
37+
CacheManager() : mQuickStartTitleInfoSerializer(nullptr),
38+
mKillerNotificationSerializer(nullptr),
39+
mJumpTitleInfoSerializer(nullptr) {
40+
if (__ct__Q3_2nn2sl12CacheManagerFv(&mInstance) != nullptr) {
41+
mQuickStartTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(mInstance.quickStartTitleInfoSerializer);
42+
mKillerNotificationSerializer = details::SerializerFromPtr<KillerNotification>(mInstance.killerNotificationSerializer);
43+
mJumpTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(mInstance.jumpTitleInfoSerializer);
44+
}
45+
}
46+
47+
[[nodiscard]] details::ISerializerBase<TitleInfo> &GetQuickStartTitleInfoSerializer() {
48+
return mQuickStartTitleInfoSerializer;
49+
}
50+
51+
[[nodiscard]] details::ISerializerBase<KillerNotification> &GetKillerNotificationSerializer() {
52+
return mKillerNotificationSerializer;
53+
}
54+
55+
[[nodiscard]] details::ISerializerBase<TitleInfo> &GetJumpTitleInfoSerializer() {
56+
return mJumpTitleInfoSerializer;
57+
}
58+
59+
void SetupInitialCache() {
60+
SetupInitialCache__Q3_2nn2sl12CacheManagerFv(&mInstance);
61+
}
62+
63+
nn::Result GetKillerNotificationCache(KillerNotification *u1, TitleInfo *u2) {
64+
return GetKillerNotificationCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl18KillerNotificationPQ3_2nn2sl9TitleInfo(&mInstance, u1, u2);
65+
}
66+
67+
nn::Result GetQuickStartCache(TitleInfo *u1, int u2) {
68+
return GetQuickStartCache__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoi(&mInstance, u1, u2);
69+
}
70+
71+
nn::Result Get(TitleInfo *u1, int u2, KillerNotification *u3, TitleInfo *u4) {
72+
return Get__Q3_2nn2sl12CacheManagerFPQ3_2nn2sl9TitleInfoiPQ3_2nn2sl18KillerNotificationT1(&mInstance, u1, u2, u3, u4);
73+
}
74+
75+
void Initialize(details::ISerializerBase<TitleInfo> &quickStartTitleInfoSerializer, details::ISerializerBase<KillerNotification> &killerNotificationSerializer, details::ISerializerBase<TitleInfo> &jumpTitleInfoSerializer) {
76+
Initialize__Q3_2nn2sl12CacheManagerFRQ3_2nn2sl39ISerializer__tm__20_Q3_2nn2sl9TitleInfoRQ3_2nn2sl49ISerializer__tm__30_Q3_2nn2sl18KillerNotificationT1(&mInstance,
77+
quickStartTitleInfoSerializer.GetInternal(),
78+
killerNotificationSerializer.GetInternal(),
79+
jumpTitleInfoSerializer.GetInternal());
80+
mQuickStartTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(quickStartTitleInfoSerializer.GetInternal());
81+
mKillerNotificationSerializer = details::SerializerFromPtr<KillerNotification>(killerNotificationSerializer.GetInternal());
82+
mJumpTitleInfoSerializer = details::SerializerFromPtr<TitleInfo>(jumpTitleInfoSerializer.GetInternal());
83+
}
84+
85+
~CacheManager() = default;
86+
87+
private:
88+
details::CacheManagerInternal mInstance{};
89+
details::SerializerFromPtr<TitleInfo> mQuickStartTitleInfoSerializer;
90+
details::SerializerFromPtr<KillerNotification> mKillerNotificationSerializer;
91+
details::SerializerFromPtr<TitleInfo> mJumpTitleInfoSerializer;
92+
};
93+
} // namespace nn::sl
94+
95+
#endif

include/nn/sl/Condition.h

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#pragma once
2+
3+
#include <coreinit/time.h>
4+
#include <nn/result.h>
5+
#include <nn/sl/ISettingAccessor.h>
6+
#include <nn/sl/ITimeAccessor.h>
7+
#include <nn/sl/IUpdatePackageAccessor.h>
8+
#include <nn/sl/details/ISerializerDetails.h>
9+
#include <wut.h>
10+
11+
#ifdef __cplusplus
12+
13+
namespace nn::sl {
14+
namespace details {
15+
typedef struct WUT_PACKED ConditionInternal {
16+
ISettingAccessorInternal *settingAccessor;
17+
IUpdatePackageAccessorInternal *updatePackageAccessor;
18+
ISerializerInternal *previousSendingTimeSerializer;
19+
ITimeAccessorInternal *timeAccessor;
20+
void *vtable;
21+
} ConditionInternal;
22+
WUT_CHECK_SIZE(ConditionInternal, 0x14);
23+
WUT_CHECK_OFFSET(ConditionInternal, 0x00, settingAccessor);
24+
WUT_CHECK_OFFSET(ConditionInternal, 0x04, updatePackageAccessor);
25+
WUT_CHECK_OFFSET(ConditionInternal, 0x08, previousSendingTimeSerializer);
26+
WUT_CHECK_OFFSET(ConditionInternal, 0x0C, timeAccessor);
27+
WUT_CHECK_OFFSET(ConditionInternal, 0x10, vtable);
28+
29+
extern "C" ConditionInternal *__ct__Q3_2nn2sl9ConditionFv(ConditionInternal *);
30+
extern "C" nn::Result GetEnability__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
31+
extern "C" nn::Result StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
32+
extern "C" nn::Result NeedsUpdate__Q3_2nn2sl9ConditionCFv(ConditionInternal *);
33+
extern "C" nn::Result GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(ConditionInternal *, int64_t *outTime);
34+
extern "C" void Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(ConditionInternal *,
35+
ISettingAccessorInternal *,
36+
IUpdatePackageAccessorInternal *,
37+
ISerializerInternal *,
38+
ITimeAccessorInternal *);
39+
} // namespace details
40+
41+
class Condition {
42+
public:
43+
Condition() : mSettingAccessor(nullptr),
44+
mUpdatePackageAccessor(nullptr),
45+
mPreviousSendingTimeSerializer(nullptr),
46+
mTimeAccessor(nullptr) {
47+
if (__ct__Q3_2nn2sl9ConditionFv(&mInstance) != nullptr) {
48+
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingAccessor);
49+
mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(mInstance.updatePackageAccessor);
50+
mPreviousSendingTimeSerializer = details::SerializerFromPtr<OSTime>(mInstance.previousSendingTimeSerializer);
51+
mTimeAccessor = details::TimeAccessorFromPtr(mInstance.timeAccessor);
52+
}
53+
}
54+
55+
~Condition() = default;
56+
57+
[[nodiscard]] details::ISettingAccessorBase &GetSettingAccessor() {
58+
return mSettingAccessor;
59+
}
60+
61+
[[nodiscard]] details::IUpdatePackageAccessorBase &GetUpdatePackageAccessor() {
62+
return mUpdatePackageAccessor;
63+
}
64+
65+
[[nodiscard]] details::ISerializerBase<OSTime> &GetPreviousSendingTimeSerializer() {
66+
return mPreviousSendingTimeSerializer;
67+
}
68+
69+
[[nodiscard]] details::ITimeAccessorBase &GetTimeAccessor() {
70+
return mTimeAccessor;
71+
}
72+
73+
nn::Result GetEnability() {
74+
return GetEnability__Q3_2nn2sl9ConditionCFv(&mInstance);
75+
}
76+
77+
nn::Result NeedsUpdate() {
78+
return NeedsUpdate__Q3_2nn2sl9ConditionCFv(&mInstance);
79+
}
80+
81+
nn::Result StoreCurrentTimeAsPreviousSendingTime() {
82+
return StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(&mInstance);
83+
}
84+
85+
nn::Result GetPreviousSendingTime(int64_t *outTime) {
86+
return GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(&mInstance, outTime);
87+
}
88+
89+
void Initialize(details::ISettingAccessorBase &settingAccessor,
90+
details::IUpdatePackageAccessorBase &updatePackageAccessor,
91+
details::ISerializerBase<OSTime> &previousSendingTimeSerializer,
92+
details::ITimeAccessorBase &timeAccessor) {
93+
Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(
94+
&mInstance,
95+
settingAccessor.GetInternal(),
96+
updatePackageAccessor.GetInternal(),
97+
previousSendingTimeSerializer.GetInternal(),
98+
timeAccessor.GetInternal());
99+
mSettingAccessor = details::SettingAccessorFromPtr(settingAccessor.GetInternal());
100+
mUpdatePackageAccessor = details::UpdatePackageAccessorFromPtr(updatePackageAccessor.GetInternal());
101+
mPreviousSendingTimeSerializer = details::SerializerFromPtr<OSTime>(previousSendingTimeSerializer.GetInternal());
102+
mTimeAccessor = details::TimeAccessorFromPtr(timeAccessor.GetInternal());
103+
}
104+
105+
private:
106+
details::ConditionInternal mInstance = {};
107+
details::SettingAccessorFromPtr mSettingAccessor;
108+
details::UpdatePackageAccessorFromPtr mUpdatePackageAccessor;
109+
details::SerializerFromPtr<OSTime> mPreviousSendingTimeSerializer;
110+
details::TimeAccessorFromPtr mTimeAccessor;
111+
};
112+
113+
} // namespace nn::sl
114+
115+
#endif

include/nn/sl/DataCreator.h

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#pragma once
2+
3+
#include <nn/result.h>
4+
#include <nn/sl/IIconInfoAccessor.h>
5+
#include <nn/sl/ISettingAccessor.h>
6+
#include <nn/sl/ITitleIconCache.h>
7+
#include <nn/sl/KillerNotification.h>
8+
#include <nn/sl/LaunchInfoDatabase.h>
9+
#include <nn/sl/details/IAccountInfoAccessorDetails.h>
10+
#include <nn/sl/sl_cpp.h>
11+
#include <wut.h>
12+
13+
#ifdef __cplusplus
14+
15+
namespace nn ::sl {
16+
namespace details {
17+
typedef struct WUT_PACKED DataCreatorInternal {
18+
IIconInfoAccessorInternal *iconInfoAccessor;
19+
IAccountInfoAccessorInternal *accountInfoAccessor;
20+
ISettingAccessorInternal *settingInfoAccessor;
21+
ITitleIconCacheInternal *titleIconCache;
22+
void *vtable;
23+
} DataCreatorInternal;
24+
WUT_CHECK_SIZE(DataCreatorInternal, 0x14);
25+
WUT_CHECK_OFFSET(DataCreatorInternal, 0x00, iconInfoAccessor);
26+
WUT_CHECK_OFFSET(DataCreatorInternal, 0x04, accountInfoAccessor);
27+
WUT_CHECK_OFFSET(DataCreatorInternal, 0x08, settingInfoAccessor);
28+
WUT_CHECK_OFFSET(DataCreatorInternal, 0x0c, titleIconCache);
29+
WUT_CHECK_OFFSET(DataCreatorInternal, 0x10, vtable);
30+
31+
extern "C" DataCreatorInternal *__ct__Q3_2nn2sl11DataCreatorFv(DataCreatorInternal *);
32+
extern "C" nn::Result Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase(
33+
DataCreatorInternal *, TransferableInfo *, const TitleInfo *, int, const KillerNotification &, const TitleInfo &, LaunchInfoDatabase &);
34+
extern "C" nn::Result Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache(
35+
DataCreatorInternal *, IIconInfoAccessorInternal *, IAccountInfoAccessorInternal *, ISettingAccessorInternal *, ITitleIconCacheInternal *);
36+
} // namespace details
37+
38+
39+
class DataCreator {
40+
public:
41+
DataCreator() : mIconInfoAccessor(nullptr),
42+
mAccountInfoAccessor(nullptr),
43+
mSettingAccessor(nullptr),
44+
mTitleIconCache(nullptr) {
45+
if (__ct__Q3_2nn2sl11DataCreatorFv(&mInstance) != nullptr) {
46+
mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor);
47+
mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor);
48+
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor);
49+
mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache);
50+
}
51+
}
52+
53+
[[nodiscard]] details::IIconInfoAccessorBase &getIconInfoAccessor() {
54+
return mIconInfoAccessor;
55+
}
56+
57+
[[nodiscard]] details::IAccountInfoAccessorBase &getAccountInfoAccessor() {
58+
return mAccountInfoAccessor;
59+
}
60+
61+
[[nodiscard]] details::ISettingAccessorBase &getSettingAccessor() {
62+
return mSettingAccessor;
63+
}
64+
65+
[[nodiscard]] details::ITitleIconCacheBase &getTitleIconCache() {
66+
return mTitleIconCache;
67+
}
68+
69+
nn::Result Create(TransferableInfo *outTransferableInfo,
70+
const TitleInfo *quickstartTitleInfos,
71+
int numQuickstartTitleInfos,
72+
const KillerNotification &killerNotification,
73+
const TitleInfo &killerNotificationTitleInfo,
74+
LaunchInfoDatabase &launchInfoDatabase) {
75+
return details::Create__Q3_2nn2sl11DataCreatorFPQ3_2nn2sl16TransferableInfoPCQ3_2nn2sl9TitleInfoiRCQ3_2nn2sl18KillerNotificationRCQ3_2nn2sl9TitleInfoRQ3_2nn2sl18LaunchInfoDatabase(
76+
&mInstance, outTransferableInfo, quickstartTitleInfos, numQuickstartTitleInfos, killerNotification, killerNotificationTitleInfo, launchInfoDatabase);
77+
}
78+
79+
void Initialize(details::IIconInfoAccessorBase &iconInfoAccessor, details::IAccountInfoAccessorBase &accountInfoAccessor, details::ISettingAccessorBase &settingAccessor, details::ITitleIconCacheBase &titleIconCache) {
80+
details::Initialize__Q3_2nn2sl11DataCreatorFRQ3_2nn2sl17IIconInfoAccessorRQ3_2nn2sl20IAccountInfoAccessorRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl15ITitleIconCache(
81+
&mInstance, iconInfoAccessor.GetInternal(), accountInfoAccessor.GetInternal(), settingAccessor.GetInternal(), titleIconCache.GetInternal());
82+
mIconInfoAccessor = details::IconInfoAccessorFromPtr(mInstance.iconInfoAccessor);
83+
mAccountInfoAccessor = details::AccountInfoAccessorFromPtr(mInstance.accountInfoAccessor);
84+
mSettingAccessor = details::SettingAccessorFromPtr(mInstance.settingInfoAccessor);
85+
mTitleIconCache = details::TitleIconCacheFromPtr(mInstance.titleIconCache);
86+
}
87+
88+
~DataCreator() = default;
89+
90+
private:
91+
details::DataCreatorInternal mInstance = {};
92+
details::IconInfoAccessorFromPtr mIconInfoAccessor;
93+
details::AccountInfoAccessorFromPtr mAccountInfoAccessor;
94+
details::SettingAccessorFromPtr mSettingAccessor;
95+
details::TitleIconCacheFromPtr mTitleIconCache;
96+
};
97+
}; // namespace nn::sl
98+
99+
#endif

0 commit comments

Comments
 (0)