gpsp
gpsp copied to clipboard
Green swap support
Thanks for your work on this core, compatibility is much better than I expected! Most of Butano games and examples work without issues.
Would it be too hard to add support for the green swap effect? I know that it's a niche thing and no commercial games used it, but it would be cool to see it on this core too.
Here's a test ROM and a couple of screenshots: Test ROM
Ah - is that the undocumented mode in DISPCNT? Not sure how hard that would be to implement - can't speak for David but I might have a look at some point out of curiosity - although ultimately it's probably a bit far down the priority list given there's still issues with commercial games to resolve! Will keep you updated here tho.
Yeah I am aware of this bit, however since no commercial games used it I did not bother :D Do homebrew games use this often? I'm curious what's the usecase. Is it to "mimic" some sort of mosaic effect? We have been fixing many bugs related to new homebrew (for instance Good Boy has uncovered a bunch of bugs) so any bugs and/or fixes are welcome!
I use it quite a bit, usually to mimic a short full screen blur:
- Butano Fighter shows it when the MC is hit.
- Varooom 3D shows it when the car is hit or when a turbo boost is used.
- GBA-NICCC uses it to show the black and white antialiased mode.
Some pics taken with mGBA:
Cool! Will give it a look! It might require some work since gpsp tries really hard to optimize stuff like palette writes and conversion (for speed) and there's palette calculations all over the place :D It's also a case that should be really optimized for it being disabled, since literally 99% of games dont use it. Thanks!!
Isn't it just a full screen effect after the final image has been composed?
According to gbatek, green swap "appears to be applied to the final picture (ie. after mixing the separate BG and OBJ layers)."
Anyway, thanks a lot for looking at it.
Ah right! For some reason I recalled it being like mosaic (with BG/OBJ bits), but it's just a full effect at the end! Yeah we can just add some routine at the end, won't be very fast tho, but it's OK since nobody uses it. I have some plan to rewrite some of these parts in gpsp to make it faster. We currently have color correction (which is also a full-screen effect), and we could merge some of these effects so that they don't require a full screen update at the end (and save a lot of cycles, right now video rendering is 50% of the consumed cpu cycles for the emulator). Thanks!
Hey @GValiente, I just opened draft PRs that implement Green Swap - PR #260 and PR #261. I used the mgba implementation as a guide. Looks pretty straightforward but any chance you can build and test it for me? It looks correct to me when I try the test ROM you gave in the first message but my eyes aren't what they used to be!!!
@davidgfnet I added the code to video.cc rather than in post-processing in libretro.c - as this is a native effect rather an emulation feature this seemed more correct?
https://github.com/user-attachments/assets/146a737c-e4f8-4722-a7ef-85e3a90ce4cd
Just me pressing A at random times on your demo to toggle between AA on/off. Think it seems to be working ok?
There's no fake antialiasing like with mGBA:
@GValiente I think I've fixed it - needed to use RGB565 values but also a dumb error on my part with overwriting the previous pixel value before getting the next green channel to swap. Please try testing again? Thanks!
https://github.com/user-attachments/assets/1dd86cc6-267f-4030-994b-02f215e8e6e0
The new video looks better, yeah.
Here's a test ROM, if you want to compare it against a real GBA and other emulators: green_swap.zip
EDIT: I already posted it in the first post xD
Thanks - yes I used green_swap.gba primarily to compare gpsp to mgba and Nanoboy when troubleshooting intially. The results are now pretty much identical since my latest commit to the PR.
mgba
gpsp (with PR #260 / PR #261)