mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
[rpcsx-os] mbus_av: emit events
This commit is contained in:
parent
6e25f347d3
commit
f5c8fce5aa
4 changed files with 89 additions and 17 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "orbis-config.hpp"
|
||||
#include "error/ErrorCode.hpp"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
|
@ -29,7 +31,7 @@ struct Uio {
|
|||
UioRw rw;
|
||||
void *td;
|
||||
|
||||
std::size_t write(const void *data, std::size_t size) {
|
||||
ErrorCode write(const void *data, std::size_t size) {
|
||||
auto pos = reinterpret_cast<const std::byte *>(data);
|
||||
auto end = pos + size;
|
||||
|
||||
|
|
@ -39,15 +41,16 @@ struct Uio {
|
|||
}
|
||||
|
||||
auto nextPos = std::min(pos + vec.len, end);
|
||||
std::memcpy(vec.base, pos, nextPos - pos);
|
||||
ORBIS_RET_ON_ERROR(uwriteRaw(vec.base, pos, nextPos - pos));
|
||||
offset += nextPos - pos;
|
||||
pos = nextPos;
|
||||
}
|
||||
|
||||
return size - (end - pos);
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::size_t write(const T &object) {
|
||||
ErrorCode write(const T &object) {
|
||||
return write(&object, sizeof(T));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue