Player icon indicating copy to clipboard operation
Player copied to clipboard

WiiU Fixes

Open Ghabry opened this issue 1 year ago • 12 comments

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

Ghabry avatar Jun 02 '24 22:06 Ghabry

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

carstene1ns avatar Jun 02 '24 23:06 carstene1ns

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

Ghabry avatar Jun 03 '24 12:06 Ghabry

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 avatar Jun 03 '24 14:06 Ghabry

Shutting down works now properly in all three cases:

  • Home Menu
  • Player picks Exit
  • Output::Error

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 avatar Jun 03 '24 17:06 Ghabry

IMG_20240603_143132

IMG_20240603_143145

IMG_20240603_143147

IMG_20240603_201808

Ghabry avatar Jun 03 '24 18:06 Ghabry

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

Ghabry avatar Jun 03 '24 20:06 Ghabry

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.

jetrotal avatar Jun 04 '24 09:06 jetrotal

Thanks!

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

Quickly edited it:

grafik

Ghabry avatar Jun 04 '24 10:06 Ghabry

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 avatar Jun 04 '24 17:06 Ghabry

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 avatar Jun 05 '24 07:06 Ghabry

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.

Ghabry avatar Jun 06 '24 00:06 Ghabry

Addressed the review comments and fixed a few more minor bugs. Is ready now :+1:

Ghabry avatar Aug 27 '24 17:08 Ghabry