EasyRPG / Player

RPG Maker 2000/2003 and EasyRPG games interpreter
https://easyrpg.org/player/
GNU General Public License v3.0
966 stars 183 forks source link

WiiU Fixes #3234

Open Ghabry opened 1 month ago

Ghabry commented 1 month ago

Still lacks polish like e.g. a nice banner but at least audio does not assert anymore and saving of the config works.


About this weird teardown in player.cpp (can we do better?)

SDL2 has a ProcUI handle which refers to the current application and for a proper shutdown of the app, SDL2 listens to PROCUI_STATUS_EXITING and then does some further cleanup.

When using the Exit menu item this will not trigger the cleanup automatically because SDL will not receive the shutdown event (but it receives it when using "WiiU Menu" in the home menu).

To make it receive the event I call SYSLaunchMenu(), then pump events once more (via that recursive call, SDL gets the quit event now) and then everything works...

https://github.com/devkitPro/SDL/blob/7b058bd042a7c624c277aaddbca6fb2f6ae5233d/src/video/wiiu/SDL_wiiuvideo.c#L326-L338

carstene1ns commented 1 month ago

The `SysLaunchMenu()' call is a good workaround, using this now as well: https://github.com/carstene1ns/easyrpg-player/blob/956eb50afcb5cbd624ad94d237d2bfa9b4405bed/src/platform/wiiu/main.cpp#L121-L131

And here is the rest of the WIP branch: https://github.com/EasyRPG/Player/compare/master...carstene1ns:easyrpg-player:feature/wiiu

You can use this network log receiver for debugging: https://gist.github.com/carstene1ns/e38fa10351449fee25cf2cc339c8e043

Ghabry commented 4 weeks ago

woah that UDP logger is awesome. Makes my life much easier xD

Ghabry commented 4 weeks ago

Your code terminates fine when using the exit option but exiting from the WiiU menu crashes in most cases :/

Haven't found a working solution yet.


My ugly recursive call on exit is working in both cases

Ghabry commented 4 weeks ago

Shutting down works now properly in all three cases:

The only remaining problem is extremly slow opening of ZIP archives, likely some IO buffering issue. But is not a blocker for me.


Had to replace these WHB wrapper functions with calls to ProcUI which is the low level API.

SDL2 will not handle it when it is initialized before launching SDL2. (see code in wiiu_video.c)

Problem is that you cannot query the ProcUI status after it was shutdown (calling the function will crash) so I needed more low level access to differentiate between "Home Menu used" and "Exit option selected (or Output::Error)".

(This also makes WHBProcIsRunning crash when the shut down was requested, making this function pretty useless for checking whether it is running xD)


btw it seems USB Keyboards are not initialized by SDL2/WUT, so cannot use it :( (used it to input the Wifi password before so should work in theory...)

Ghabry commented 4 weeks ago

IMG_20240603_143132

IMG_20240603_143145

IMG_20240603_143147

IMG_20240603_201808

Ghabry commented 4 weeks ago

The ICU issue is a simple fix :confetti_ball: :confetti_ball: :confetti_ball:

The patch must be moved before cp -rup icu icu-native as the tool that requires patching is from the native icu.

https://github.com/EasyRPG/buildscripts/blob/master/wiiu/2_build_toolchain.sh#L45

jetrotal commented 4 weeks ago

icon image

TV image

PAD image


The idea is to promote our charsets on the joypad screen, by letting a user search for their favorite character by looking while waiting... But I don't have a wii u to test how does it look like 🤔

Here's a psd containing editable assets: EasyRP_wiiu_PSDs.zip

I recomend opening my psd files over the browser editor https://www.photopea.com/ instead of GIMP.

Ghabry commented 4 weeks ago

Thanks!

The downscale made imo Y look weird because on one side it is one pixel shorter.

Quickly edited it:

grafik

Ghabry commented 4 weeks ago

Somehow the buffering doesn't work and "pubsetbuf" does nothing (which is allowed by the standard xD) so I wrote my own buffering file IO.

Verifying whether the filebuf implementation is correct is a bit tricky. I wrote a test code that does hundreds of random seeks using beg/cur/end mode and reads and compared the result with the normal fstream.

Then executed it multiple times until I got no asserts anymore because of mismatches...

Ghabry commented 4 weeks ago

I will enable this custom IO for the other homebrew targets.

Only did an additional test on the Wii and this gives a huge loading time speedup. So likely also helps on Vita, 3DS and Switch.

Ghabry commented 3 weeks ago

Is imo enough xD. Can start to bitrot now ;). At least some improvements (ZIP and buffer) will help other homebrew platforms, too.

The pixel format was wrong (we know this issue ^^). Fixing this made the rendering significantly faster. Went in Yume Nikki from 22 FPS to 58 FPS in one map. Unterwegs in Düsterburg got +5-10 FPS.

Also did some measuring and SDL2 render step takes around ~3-5ms.

Decided to not implement ErrEula for now. This requires integration in the render loop so is not a simple fire-and-forget as the typical message box.