PSP: refactoring and 16 bit support
|Reported by:||bluddy||Owned by:||joostp|
I broke the OsystemPSP class apart into several classes, refactoring it and cleaning up the code.
Practical enhancements to the port:
- 16 bit support. I had to implement memcopy to enable swapping red an blue channels for some 16 bit games such as HE.
- Blurriness is gone in the main menu (unscaled and scaled images need to be handled differently when rendering)
- Cursor looks cleaner with blending than with alpha masking.
- Dirty implementation for all DisplayClients makes code more efficient -- we only draw if there's been a change on the screen.
- Went back to storing the Overlay and Screen in hardware memory, but did it properly: I removed the depth buffer, did proper allocation, and have backup allocation in main memory in case we run out of hardware memory.
- I think there's also some other speed improvement compared to the old code, but I'm not sure why.
Layout of the new code:
- OsystemPSP now contains very little of the logic.
- GuRenderer class and MasterGuRenderer contain all calls to the graphics hardware.
- All surfaces (Screen, Overlay, Cursor, PSPKeyboard) were rebuilt to inherit the DisplayClient class. DisplayClients use one or more Buffers, Palettes and GuRenderers.
- Trace system has been refined and added to almost all PSP files. We can now fully trace almost all function calls (and localize it to individual functions/classes). Tracing can be done to shell, to a file, or both.
- Virtual functions have been avoided to keep performance high. (we still get them at the entrance to OsystemPSP obviously)
- PSPKeyboard code was factored out (especially the complex state machine)
Ticket imported from: #2974509. Ticket imported from: patches/1257.