mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-18 16:37:55 +00:00
am: Refactor IStorage interface.
This commit is contained in:
parent
0d376ae49e
commit
b10a96347f
7 changed files with 81 additions and 43 deletions
|
@ -12,7 +12,8 @@
|
|||
|
||||
namespace Kernel {
|
||||
class KernelCore;
|
||||
}
|
||||
class TransferMemory;
|
||||
} // namespace Kernel
|
||||
|
||||
namespace Service::NVFlinger {
|
||||
class NVFlinger;
|
||||
|
@ -188,19 +189,36 @@ private:
|
|||
std::shared_ptr<AppletMessageQueue> msg_queue;
|
||||
};
|
||||
|
||||
class IStorageImpl {
|
||||
public:
|
||||
virtual ~IStorageImpl();
|
||||
virtual std::vector<u8>& GetData() = 0;
|
||||
virtual const std::vector<u8>& GetData() const = 0;
|
||||
virtual std::size_t GetSize() const = 0;
|
||||
};
|
||||
|
||||
class IStorage final : public ServiceFramework<IStorage> {
|
||||
public:
|
||||
explicit IStorage(std::vector<u8> buffer);
|
||||
explicit IStorage(std::vector<u8>&& buffer);
|
||||
~IStorage() override;
|
||||
|
||||
const std::vector<u8>& GetData() const;
|
||||
std::vector<u8>& GetData() {
|
||||
return impl->GetData();
|
||||
}
|
||||
|
||||
const std::vector<u8>& GetData() const {
|
||||
return impl->GetData();
|
||||
}
|
||||
|
||||
std::size_t GetSize() const {
|
||||
return impl->GetSize();
|
||||
}
|
||||
|
||||
private:
|
||||
void Register();
|
||||
void Open(Kernel::HLERequestContext& ctx);
|
||||
|
||||
std::vector<u8> buffer;
|
||||
|
||||
friend class IStorageAccessor;
|
||||
std::shared_ptr<IStorageImpl> impl;
|
||||
};
|
||||
|
||||
class IStorageAccessor final : public ServiceFramework<IStorageAccessor> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue