wut  v1.7.0
Wii U Toolchain
IIconInfoAccessorDetails.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 DataCreator;
11  class TitleIconCache;
12  namespace details {
13  class IIconInfoAccessorBase;
15 
17  typedef nn::Result (*IconInfoAccessor_GetMiiIconFn)(IIconInfoAccessorInternal *, void *buffer, uint32_t buffer_size, uint32_t slot);
18 
19  struct WUT_PACKED IIconInfoAccessorInternalVTable {
20  IIconInfoAccessorBase *instance; // normally this is padding
21  uint32_t info;
22  WUT_PADDING_BYTES(4);
23  uint32_t destructor;
24  WUT_PADDING_BYTES(4);
26  WUT_PADDING_BYTES(4);
28  WUT_PADDING_BYTES(4);
29  };
30  WUT_CHECK_SIZE(IIconInfoAccessorInternalVTable, 0x24);
31  WUT_CHECK_OFFSET(IIconInfoAccessorInternalVTable, 0x14, GetTitleIconInfoFn);
32  WUT_CHECK_OFFSET(IIconInfoAccessorInternalVTable, 0x1C, GetMiiIconFn);
33 
34  typedef struct WUT_PACKED IIconInfoAccessorInternal {
37  WUT_CHECK_SIZE(IIconInfoAccessorInternal, 0x04);
38  WUT_CHECK_OFFSET(IIconInfoAccessorInternal, 0x00, vtable);
39 
41  friend class nn::sl::DataCreator;
42  friend class nn::sl::TitleIconCache;
43 
44  public:
45  IIconInfoAccessorBase() = default;
46  virtual ~IIconInfoAccessorBase() = default;
47 
48  virtual nn::Result GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const = 0;
49 
50  virtual nn::Result GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const = 0;
51 
52  private:
53  virtual details::IIconInfoAccessorInternal *GetInternal() = 0;
54  };
55 
57  public:
58  explicit IconInfoAccessorFromPtr(details::IIconInfoAccessorInternal *ptr) : mInstancePtr(ptr) {
59  }
60 
61  nn::Result GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const override {
62  if (!mInstancePtr) {
64  }
65  return mInstancePtr->vtable->GetTitleIconInfoFn(mInstancePtr, outIconInfo, titleInfo, language);
66  }
67 
68  nn::Result GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const override {
69  if (!mInstancePtr) {
71  }
72  return mInstancePtr->vtable->GetMiiIconFn(mInstancePtr, buffer, buffer_size, slot);
73  }
74 
75  private:
76  nn::sl::details::IIconInfoAccessorInternal *GetInternal() override {
77  return mInstancePtr;
78  }
79 
81  };
82  } // namespace details
83 
84 } // namespace nn::sl
85 
86 #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 GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const =0
virtual nn::Result GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const =0
IconInfoAccessorFromPtr(details::IIconInfoAccessorInternal *ptr)
nn::Result GetMiiIcon(void *buffer, uint32_t buffer_size, uint32_t slot) const override
nn::Result GetTitleIconInfo(nn::sl::IconInfo *outIconInfo, const nn::sl::TitleInfo &titleInfo, nn::sl::Language language) const override
IconInfoAccessor_GetTitleIconInfoFn GetTitleIconInfoFn
struct nn::sl::details::IIconInfoAccessorInternal IIconInfoAccessorInternal
nn::Result(* IconInfoAccessor_GetTitleIconInfoFn)(IIconInfoAccessorInternal *, nn::sl::IconInfo *, const nn::sl::TitleInfo &, nn::sl::Language)
nn::Result(* IconInfoAccessor_GetMiiIconFn)(IIconInfoAccessorInternal *, void *buffer, uint32_t buffer_size, uint32_t slot)
Language
Definition: sl_cpp.h:251