etra0 / botw-freecam

Freecam for the game Zelda: Breath of the Wild for the Wii U using the Cemu emulator
MIT License
67 stars 12 forks source link

make check_key_press function unsafe #36

Closed kitcatier closed 1 year ago

kitcatier commented 1 year ago

https://github.com/etra0/botw-freecam/blob/5129e21902336ae8555cdcae231a15655201a249/botw-freecam/src/utils.rs#L49-L51 hello, if a function's entire body is unsafe, the function is itself unsafe and should be marked appropriately. Marking them unsafe also means that callers must make sure they know what they're doing.

etra0 commented 1 year ago

Although GetAsyncKeyState is an unsafe function, according to Microsoft docs there's no remark that the function could crash or corrupt anything, and I'm pretty sure that's a battle tested API, too.

And to be honest, I wasn't very careful on marking unsafe/safe functions, I should, in the future, but for now, I think it's ok, since we're building an app and not a library.

Thanks for pointing it out, though!