wut  v1.7.0
Wii U Toolchain
IMetaInfoAccessorDetails.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <nn/result.h>
4 #include <nn/sl/sl_cpp.h>
5 #include <wut.h>
6 
7 #ifdef __cplusplus
8 
9 namespace nn::sl {
10  class TitleListCache;
11  namespace details {
12  class IMetaInfoAccessorBase;
14 
16 
17  struct WUT_PACKED IMetaInfoAccessorInternalVTable {
18  IMetaInfoAccessorBase *instance; // normally this is padding
19  uint32_t info;
20  WUT_PADDING_BYTES(4);
21  uint32_t destructor;
22  WUT_PADDING_BYTES(4);
24  };
25  WUT_CHECK_SIZE(IMetaInfoAccessorInternalVTable, 0x18);
26  WUT_CHECK_OFFSET(IMetaInfoAccessorInternalVTable, 0x00, instance);
27  WUT_CHECK_OFFSET(IMetaInfoAccessorInternalVTable, 0x14, GetFn);
28 
29  typedef struct WUT_PACKED IMetaInfoAccessorInternal {
32  WUT_CHECK_SIZE(IMetaInfoAccessorInternal, 0x04);
33  WUT_CHECK_OFFSET(IMetaInfoAccessorInternal, 0x00, vtable);
34 
36  friend class nn::sl::TitleListCache;
37 
38  public:
39  IMetaInfoAccessorBase() = default;
40  virtual ~IMetaInfoAccessorBase() = default;
41 
42  virtual nn::Result Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const = 0;
43 
44  private:
45  virtual details::IMetaInfoAccessorInternal *GetInternal() = 0;
46  };
47 
49  public:
50  explicit MetaInfoAccessorFromPtr(details::IMetaInfoAccessorInternal *ptr) : mInstancePtr(ptr) {
51  }
52  nn::Result Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const override {
53  if (!mInstancePtr) {
55  }
56  return mInstancePtr->vtable->GetFn(mInstancePtr, outMetaInfo, titleInfo);
57  }
58 
59  private:
60  nn::sl::details::IMetaInfoAccessorInternal *GetInternal() override {
61  return mInstancePtr;
62  }
63 
65  };
66  } // namespace details
67 
68 } // namespace nn::sl
69 
70 #endif
Result value type used by nn libraries.
Definition: result.h:68
@ LEVEL_FATAL
Definition: result.h:73
@ RESULT_MODULE_NN_SL
Definition: result.h:114
virtual nn::Result Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const =0
MetaInfoAccessorFromPtr(details::IMetaInfoAccessorInternal *ptr)
nn::Result Get(nn::sl::TitleMetaInfo *outMetaInfo, const nn::sl::TitleInfo &titleInfo) const override
struct nn::sl::details::IMetaInfoAccessorInternal IMetaInfoAccessorInternal
nn::Result(* IMetaInfoAccessor_GetFn)(IMetaInfoAccessorInternal *, nn::sl::TitleMetaInfo *, const nn::sl::TitleInfo &)