Open lorenzofelletti opened 1 month ago
There's no difference to a compiled binary between usize and isize afaik. So we don't have a way to know which is more correct. But the idea of error codes makes sense.
Mmh ok. I never really did that stuff, so I'm not an expert on the matter, but I'm wondering then why there is a different between these two functions signatures:
#[psp(0xCDA85C99)]
pub fn sceNetInetRecv(
s: i32,
buf: *mut c_void,
len: usize,
flags: i32,
) -> usize;
#[psp(0xC91142E4, i6)]
pub fn sceNetInetRecvfrom(
s: i32,
buf: *mut c_void,
len: usize,
flags: i32,
from: *mut sockaddr,
from_len: *mut socklen_t,
) -> i32;
Why does one return usize
and the other one i32
?
Yeah ultimately I think you're right because sceNetInetRecv has the possibility to return an error code. I was just mentioning you can't tell from decompilation directly.
sys::sceNetInetRecv
return type is set tousize
, as pspsdk sets it tosize_t
. However, the Linux manual for therecv
functions sets its return type tossize_t
(isize
in Rust), which actually makes more sense as it gives you a way to intercept an error from the returned value.Do we know if the correct return type is indeed
usize
and notisize
?