wut  v1.7.0
Wii U Toolchain
ITransferrer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <nn/result.h>
5 #include <nn/sl/sl_cpp.h>
6 #include <wut.h>
7 
8 #ifdef __cplusplus
9 
10 namespace nn::sl {
12 
13  public:
15  InitInternalVtable();
16  }
17 
19  InitInternalVtable();
20  }
21 
23  InitInternalVtable();
24  return *this;
25  }
26 
27  ITransferrer &operator=(ITransferrer &&src) noexcept {
28  InitInternalVtable();
29  return *this;
30  }
31 
32  ~ITransferrer() override = default;
33 
34  private:
35  static nn::Result TransferDeprecatedWrapper(details::ITransferrerInternal *instance, void *buffer, uint32_t size, bool setKillerNotification, int transferMode) {
36  return instance->vtable->instance->TransferDeprecated(buffer, size, setKillerNotification, transferMode);
37  }
38  static nn::Result TransferWrapper(details::ITransferrerInternal *instance, void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) {
39  return instance->vtable->instance->Transfer(buffer, size, setKillerNotification, transferMode);
40  }
41  static nn::Result CancelTransferWrapper(details::ITransferrerInternal *instance) {
42  return instance->vtable->instance->CancelTransfer();
43  }
44  static nn::Result InvalidateNotificationWrapper(details::ITransferrerInternal *instance, uint32_t u1) {
45  return instance->vtable->instance->InvalidateNotification(u1);
46  }
47  static nn::Result DisplayNotificationWrapper(details::ITransferrerInternal *instance, uint32_t u1, uint32_t u2, uint32_t u3) {
48  return instance->vtable->instance->DisplayNotification(u1, u2, u3);
49  }
50 
51  details::ITransferrerInternal *GetInternal() override {
52  return &mInstance;
53  }
54 
55  void InitInternalVtable() {
56  mVTable = {.instance = this,
57  .TransferDeprecatedFn = &TransferDeprecatedWrapper,
58  .TransferFn = &TransferWrapper,
59  .CancelTransferFn = &CancelTransferWrapper,
60  .InvalidateNotificationFn = &InvalidateNotificationWrapper,
61  .DisplayNotificationFn = &DisplayNotificationWrapper};
62  mInstance.vtable = &mVTable;
63  }
64 
66  details::ITransferrerInternalVTable mVTable{};
67  };
68 
70 } // namespace nn::sl
71 
72 #endif
Result value type used by nn libraries.
Definition: result.h:68
ITransferrer & operator=(ITransferrer &&src) noexcept
Definition: ITransferrer.h:27
~ITransferrer() override=default
ITransferrer(ITransferrer &src)
Definition: ITransferrer.h:18
ITransferrer & operator=(const ITransferrer &other)
Definition: ITransferrer.h:22
virtual nn::Result TransferDeprecated(void *buffer, uint32_t size, bool setKillerNotification, int transferMode) const =0
virtual nn::Result Transfer(void *buffer, uint32_t size, bool setKillerNotification, TransferMode transferMode) const =0
struct nn::sl::details::ITransferrerInternal ITransferrerInternal
ITransferrerInternalVTable * vtable
details::ITransferrerBase & GetDrcTransferrer()
TransferMode
Definition: sl_cpp.h:245