mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-06 06:55:09 +00:00
Initial commit
This commit is contained in:
commit
1fdadaaee9
38 changed files with 5512 additions and 0 deletions
32
rpcsx-os/iodev/zero.cpp
Normal file
32
rpcsx-os/iodev/zero.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "io-device.hpp"
|
||||
#include <cstring>
|
||||
|
||||
struct ZeroDevice : public IoDevice {
|
||||
};
|
||||
|
||||
struct ZeroInstance : public IoDeviceInstance {
|
||||
};
|
||||
|
||||
static std::int64_t zero_device_read(IoDeviceInstance *instance, void *data,
|
||||
std::uint64_t size) {
|
||||
std::memset(data, 0, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
static std::int32_t zero_device_open(IoDevice *device,
|
||||
orbis::Ref<IoDeviceInstance> *instance,
|
||||
const char *path, std::uint32_t flags,
|
||||
std::uint32_t mode) {
|
||||
auto *newInstance = new ZeroInstance{};
|
||||
newInstance->read = zero_device_read;
|
||||
|
||||
io_device_instance_init(device, newInstance);
|
||||
*instance = newInstance;
|
||||
return 0;
|
||||
}
|
||||
|
||||
IoDevice *createZeroCharacterDevice() {
|
||||
auto *newDevice = new ZeroDevice();
|
||||
newDevice->open = zero_device_open;
|
||||
return newDevice;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue