obhq / obliteration

Experimental PS4 emulator written in Rust for Windows, macOS and Linux
https://obliteration.net
MIT License
586 stars 17 forks source link

Fixes offset related code #793

Closed SuchAFuriousDeath closed 3 months ago

SuchAFuriousDeath commented 3 months ago

This PR:

I'm still unsure whether we want to have the offset be a prt of Uio and UioMut or whether all functions should take them as a standalone argument. In order to construct Uio/UioMut properly (without uninitialized memory or fields that are set and then ignored) we would have to pass around a closure that takes and offset and only then constructs the Uio/UioMut, which is doable, but it results in some things happening in reverse order (we would lock the offset field on file and only then call copyin, which could fail - so we would have unnecessarilly locked the file offset and then fail because of something that could've been checked before)

We could create an intermediate struct that doesn't contain the offset of course, but that feels like a bit too many structs, as we already have Uio and UioMut, which is just one struct in FreeBSD,