wut  v1.7.0
Wii U Toolchain
Condition.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <coreinit/time.h>
4 #include <nn/result.h>
6 #include <nn/sl/ITimeAccessor.h>
9 #include <wut.h>
10 
11 #ifdef __cplusplus
12 
13 namespace nn::sl {
14  namespace details {
15  typedef struct WUT_PACKED ConditionInternal {
20  void *vtable;
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 
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 
58  return mSettingAccessor;
59  }
60 
62  return mUpdatePackageAccessor;
63  }
64 
66  return mPreviousSendingTimeSerializer;
67  }
68 
70  return mTimeAccessor;
71  }
72 
74  return GetEnability__Q3_2nn2sl9ConditionCFv(&mInstance);
75  }
76 
78  return NeedsUpdate__Q3_2nn2sl9ConditionCFv(&mInstance);
79  }
80 
83  }
84 
85  nn::Result GetPreviousSendingTime(int64_t *outTime) {
86  return GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(&mInstance, outTime);
87  }
88 
90  details::IUpdatePackageAccessorBase &updatePackageAccessor,
91  details::ISerializerBase<OSTime> &previousSendingTimeSerializer,
92  details::ITimeAccessorBase &timeAccessor) {
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
Result value type used by nn libraries.
Definition: result.h:68
void Initialize(details::ISettingAccessorBase &settingAccessor, details::IUpdatePackageAccessorBase &updatePackageAccessor, details::ISerializerBase< OSTime > &previousSendingTimeSerializer, details::ITimeAccessorBase &timeAccessor)
Definition: Condition.h:89
details::ITimeAccessorBase & GetTimeAccessor()
Definition: Condition.h:69
nn::Result GetPreviousSendingTime(int64_t *outTime)
Definition: Condition.h:85
details::ISerializerBase< OSTime > & GetPreviousSendingTimeSerializer()
Definition: Condition.h:65
details::ISettingAccessorBase & GetSettingAccessor()
Definition: Condition.h:57
~Condition()=default
details::IUpdatePackageAccessorBase & GetUpdatePackageAccessor()
Definition: Condition.h:61
nn::Result GetEnability()
Definition: Condition.h:73
nn::Result NeedsUpdate()
Definition: Condition.h:77
nn::Result StoreCurrentTimeAsPreviousSendingTime()
Definition: Condition.h:81
ISerializerInternal * previousSendingTimeSerializer
Definition: Condition.h:18
nn::Result NeedsUpdate__Q3_2nn2sl9ConditionCFv(ConditionInternal *)
struct nn::sl::details::ConditionInternal ConditionInternal
nn::Result StoreCurrentTimeAsPreviousSendingTime__Q3_2nn2sl9ConditionCFv(ConditionInternal *)
ConditionInternal * __ct__Q3_2nn2sl9ConditionFv(ConditionInternal *)
ISettingAccessorInternal * settingAccessor
Definition: Condition.h:16
nn::Result GetPreviousSendingTime__Q3_2nn2sl9ConditionCFPL(ConditionInternal *, int64_t *outTime)
IUpdatePackageAccessorInternal * updatePackageAccessor
Definition: Condition.h:17
void Initialize__Q3_2nn2sl9ConditionFRQ3_2nn2sl16ISettingAccessorRQ3_2nn2sl22IUpdatePackageAccessorRQ3_2nn2sl20ISerializer__tm__2_LRQ3_2nn2sl13ITimeAccessor(ConditionInternal *, ISettingAccessorInternal *, IUpdatePackageAccessorInternal *, ISerializerInternal *, ITimeAccessorInternal *)
nn::Result GetEnability__Q3_2nn2sl9ConditionCFv(ConditionInternal *)
ITimeAccessorInternal * timeAccessor
Definition: Condition.h:19