First post, by superfury
I'm using SDL2 for touch/finger events, but each event, Android's debugging tools indicates the screen to be updating completely(indicated by app execution speed lowering a lot as well)?
It's basically multiple layers, which update only when a parent layer is updated with different pixels(parents being application video output(emulated video surface) and text layers(three in total)). Oddly enough, neither video surface is visibly updated, but Android does indicate it as being updated? Each layer is self-checking, containing a flag for it's pixels being updated. If none of the flags are set, the screen isn't redrawn and flipped(SDL_flip or it's equivalent for SDL2). If any layer indicates it's dirty(flag is set), the entire display is redrawn in order:
1.1. Draw the background layer(video output). Clear it's dirty flag.
1.2. For each text layer: Draw the layer with transparency(stretched to fullscreen on Android/PSP). Clear it's dirty flag.
2. Always trigger a global redraw event. This calls SDL_flip or equivalent, but only if it's dirty flag is set(or forced redraw(because SDL indicated it's requiring a redraw)), cleared after flipping.
Code:
I/O: https://bitbucket.org/superfury/commonemufram … put.c?at=master
GPU: https://bitbucket.org/superfury/commonemufram … /gpu/?at=master
Anyone can see why it's giving the extreme screen updates on finger events?
Edit: Managed to largely fix it by only making it refresh the finger OSK(thus text surfaces & rendering) when pressing and releasing the touch input(including mouse input). That makes it only update when pressing and releasing the touch screen/mouse buttons. It's still heavy on pressing and releasing input(mouse keys/touch), but that can't be helped(since the OSK would need updating/checking anyway). Since movement doesn't count anymore as updates, it increases speed in those cases dramatically.
Edit: Managed to decrease the text surface changes to only actually changing the contents when required(only changing the OSK text when required, leaving all other text unchanged(instead of changing NULL/space characters or color/background, triggering a screen frame update when nothing visible happens). Now it only updates the OSK layer when something ACTUALLY changed:D That actually speeds up operation by a lot(except when stuff like hard disk I/O triggers the HDD LED character to blink on and off, which does cause a speeddown in emulation speed).
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io