wut  v1.7.0
Wii U Toolchain
IStreamDetails.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <coreinit/filesystem.h>
4 #include <nn/result.h>
5 #include <nn/sl/sl_cpp.h>
6 #include <wut.h>
7 
8 #ifdef __cplusplus
9 
10 namespace nn::sl {
11  class LaunchInfoDatabase;
12  class KillerNotificationTransferRecordManager;
13  class KillerNotificationTransferRecordManagerInternal;
14 
15  namespace details {
16  class KillerNotificationTransferRecordManagerFromPtr;
17  class IStreamBase;
18  struct IStreamInternal;
19 
20  typedef nn::Result (*IStream_ReadFn)(IStreamInternal *, uint32_t *bytesRead, void *buffer, uint32_t readSize);
21  typedef nn::Result (*IStream_WriteFn)(IStreamInternal *, uint32_t *bytesWritten, void *buffer, uint32_t writeSize);
22  typedef nn::Result (*IStream_GetSizeFn)(IStreamInternal *, uint32_t *fileSize);
23  typedef nn::Result (*IStream_SeekFn)(IStreamInternal *, int32_t offset, nn::sl::SeekOrigin seekOrigin);
24 
25  struct WUT_PACKED IStreamInternalVTable {
26  IStreamBase *instance; // normally this is padding
27  uint32_t info;
28  WUT_PADDING_BYTES(4);
29  uint32_t destructor;
30  WUT_PADDING_BYTES(4);
32  WUT_PADDING_BYTES(4);
34  WUT_PADDING_BYTES(4);
36  WUT_PADDING_BYTES(4);
38  };
39  WUT_CHECK_SIZE(IStreamInternalVTable, 0x30);
40  WUT_CHECK_OFFSET(IStreamInternalVTable, 0x14, ReadFn);
41  WUT_CHECK_OFFSET(IStreamInternalVTable, 0x1C, WriteFn);
42  WUT_CHECK_OFFSET(IStreamInternalVTable, 0x24, GetSizeFn);
43  WUT_CHECK_OFFSET(IStreamInternalVTable, 0x2C, SeekFn);
44 
45  typedef struct WUT_PACKED IStreamInternal {
48  WUT_CHECK_SIZE(IStreamInternal, 0x04);
49 
50  class IStreamBase {
55 
56  public:
57  IStreamBase() = default;
58 
59  virtual ~IStreamBase() = default;
60 
61  virtual nn::Result Read(uint32_t *bytesRead, void *buffer, uint32_t readSize) = 0;
62  virtual nn::Result Write(uint32_t *bytesWritten, void *buffer, uint32_t writeSize) = 0;
63  virtual nn::Result GetSize(uint32_t *fileSize) = 0;
64  virtual nn::Result Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin) = 0;
65 
66  private:
67  virtual details::IStreamInternal *GetInternal() = 0;
68  };
69 
70 
71  } // namespace details
72 
73 
74 } // namespace nn::sl
75 
76 #endif
Result value type used by nn libraries.
Definition: result.h:68
virtual nn::Result GetSize(uint32_t *fileSize)=0
virtual nn::Result Seek(int32_t offset, nn::sl::SeekOrigin seekOrigin)=0
virtual ~IStreamBase()=default
virtual nn::Result Read(uint32_t *bytesRead, void *buffer, uint32_t readSize)=0
virtual nn::Result Write(uint32_t *bytesWritten, void *buffer, uint32_t writeSize)=0
IStreamInternalVTable * vtable
nn::Result(* IStream_ReadFn)(IStreamInternal *, uint32_t *bytesRead, void *buffer, uint32_t readSize)
nn::Result(* IStream_GetSizeFn)(IStreamInternal *, uint32_t *fileSize)
nn::Result(* IStream_SeekFn)(IStreamInternal *, int32_t offset, nn::sl::SeekOrigin seekOrigin)
nn::Result(* IStream_WriteFn)(IStreamInternal *, uint32_t *bytesWritten, void *buffer, uint32_t writeSize)
struct nn::sl::details::IStreamInternal IStreamInternal
SeekOrigin
Definition: sl_cpp.h:266