wut  v1.7.0
Wii U Toolchain
ITransferrerDetails.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 DrcManager;
11  namespace details {
12  class ITransferrerBase;
13  struct ITransferrerInternal;
14 
15  typedef nn::Result (*ITransferrer_TransferDeprecatedFn)(ITransferrerInternal *, void *, uint32_t, bool, int);
16  typedef nn::Result (*ITransferrer_TransferFn)(ITransferrerInternal *, void *, uint32_t, bool, TransferMode);
19  typedef nn::Result (*ITransferrer_DisplayNotificationFn)(ITransferrerInternal *, uint32_t, uint32_t, uint32_t);
20 
21  struct WUT_PACKED ITransferrerInternalVTable {
22  ITransferrerBase *instance; // Is normally padding
23  uint32_t info;
24  WUT_PADDING_BYTES(4);
25  uint32_t destructor;
26  WUT_PADDING_BYTES(4);
28  WUT_PADDING_BYTES(4);
30  WUT_PADDING_BYTES(4);
32  WUT_PADDING_BYTES(4);
34  WUT_PADDING_BYTES(4);
36  };
37  WUT_CHECK_SIZE(ITransferrerInternalVTable, 0x38);
38  WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x00, instance);
39  WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x14, TransferDeprecatedFn);
40  WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x1C, TransferFn);
41  WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x24, CancelTransferFn);
42  WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x2C, InvalidateNotificationFn);
43  WUT_CHECK_OFFSET(ITransferrerInternalVTable, 0x34, DisplayNotificationFn);
44 
45  typedef struct WUT_PACKED ITransferrerInternal {
48  WUT_CHECK_SIZE(ITransferrerInternal, 0x04);
49  WUT_CHECK_OFFSET(ITransferrerInternal, 0x00, vtable);
50 
52  friend class nn::sl::DrcManager;
53 
54  public:
55  ITransferrerBase() = default;
56 
57  virtual ~ITransferrerBase() = default;
58 
59  virtual nn::Result TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const = 0;
60  virtual nn::Result Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const = 0;
61  virtual nn::Result CancelTransfer() const = 0;
62  virtual nn::Result InvalidateNotification(uint32_t) const = 0;
63  virtual nn::Result DisplayNotification(uint32_t, uint32_t, uint32_t) const = 0;
64 
65  private:
66  virtual details::ITransferrerInternal *GetInternal() = 0;
67  };
68 
70  public:
71  explicit TransferrerFromPtr(details::ITransferrerInternal *ptr) : mInstancePtr(ptr) {
72  }
73  nn::Result TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const override {
74  if (!mInstancePtr) {
76  }
77  return mInstancePtr->vtable->TransferDeprecatedFn(mInstancePtr, buffer, size, setKillerNotification, transferMode);
78  }
79  nn::Result Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const override {
80  if (!mInstancePtr) {
82  }
83  return mInstancePtr->vtable->TransferFn(mInstancePtr, buffer, size, setKillerNotification, transferMode);
84  }
85  nn::Result CancelTransfer() const override {
86  if (!mInstancePtr) {
88  }
89  return mInstancePtr->vtable->CancelTransferFn(mInstancePtr);
90  }
91  nn::Result InvalidateNotification(uint32_t u1) const override {
92  if (!mInstancePtr) {
94  }
95  return mInstancePtr->vtable->InvalidateNotificationFn(mInstancePtr, u1);
96  }
97  nn::Result DisplayNotification(uint32_t u1, uint32_t u2, uint32_t u3) const override {
98  if (!mInstancePtr) {
100  }
101  return mInstancePtr->vtable->DisplayNotificationFn(mInstancePtr, u1, u2, u3);
102  }
103 
104  private:
105  details::ITransferrerInternal *GetInternal() override {
106  return mInstancePtr;
107  }
108 
109  details::ITransferrerInternal *mInstancePtr;
110  };
111  } // namespace details
112 
113 } // namespace nn::sl
114 
115 #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 InvalidateNotification(uint32_t) const =0
virtual nn::Result TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const =0
virtual nn::Result CancelTransfer() const =0
virtual nn::Result DisplayNotification(uint32_t, uint32_t, uint32_t) const =0
virtual ~ITransferrerBase()=default
virtual nn::Result Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const =0
TransferrerFromPtr(details::ITransferrerInternal *ptr)
nn::Result Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const override
nn::Result CancelTransfer() const override
nn::Result TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const override
nn::Result DisplayNotification(uint32_t u1, uint32_t u2, uint32_t u3) const override
nn::Result InvalidateNotification(uint32_t u1) const override
ITransferrer_InvalidateNotificationFn InvalidateNotificationFn
nn::Result(* ITransferrer_InvalidateNotificationFn)(ITransferrerInternal *, uint32_t)
struct nn::sl::details::ITransferrerInternal ITransferrerInternal
nn::Result(* ITransferrer_TransferFn)(ITransferrerInternal *, void *, uint32_t, bool, TransferMode)
nn::Result(* ITransferrer_TransferDeprecatedFn)(ITransferrerInternal *, void *, uint32_t, bool, int)
nn::Result(* ITransferrer_CancelTransferFn)(ITransferrerInternal *)
ITransferrer_DisplayNotificationFn DisplayNotificationFn
ITransferrer_TransferDeprecatedFn TransferDeprecatedFn
ITransferrer_CancelTransferFn CancelTransferFn
ITransferrerInternalVTable * vtable
nn::Result(* ITransferrer_DisplayNotificationFn)(ITransferrerInternal *, uint32_t, uint32_t, uint32_t)
TransferMode
Definition: sl_cpp.h:245