overdrivenpotato / rust-psp

Rust on PSP. Panic and allocation support. Access PSP system libraries.
Other
588 stars 31 forks source link

fix: `SceUtilityOskState` status #157

Closed lorenzofelletti closed 6 months ago

lorenzofelletti commented 6 months ago

Fix the enum of OSK (On-Screen Keyboard) status.

The enum had a variant too much (SceUtilityOskState::Initializing) that I removed.

sajattack commented 6 months ago

Are you sure? PSPSDK has a similar enum https://github.com/pspdev/pspsdk/blob/db7ee550eaed98a5a51a5f0b0872ef9f8620288e/src/utility/psputility_osk.h#L43-L51

lorenzofelletti commented 6 months ago

In my experience, it is like this, but I didn't know a similar enum existed in PSPSDK, so I will investigate a bit more... Thank you for pointing it out!

lorenzofelletti commented 6 months ago

Hi @sajattack I've conducted some tests, and I'm quite sure now that the OSK possible states are 5, and not 6.

The tests I conducted consisted in creating and OSK, and logging every unique OSK status in a array, then checking the array's length. Moreover, this snippet from CrossCraft also suggests the number of OSK states to be 5.

sajattack commented 6 months ago

K I'll do some ghidra to see if I can confirm.

sajattack commented 6 months ago

So I did a bit more digging and pspsdk has another enum which we seem to be missing. It's the one referred to in the docs as ::DialogState. I think we should create this enum separate from the osk one and update struct members and function parameters as necessary. https://github.com/pspdev/pspsdk/blame/8fc8beb72ab46ee9b6922505f0c1da199114c48a/src/utility/psputility.h#L47-L55

sajattack commented 6 months ago

superceded by #158