Skip to content

WiiU Fixes - #3234

Merged
20 commits merged into
EasyRPG:masterfrom
Ghabry:wiiu
Sep 2, 2024
Merged

WiiU Fixes#3234
20 commits merged into
EasyRPG:masterfrom
Ghabry:wiiu

Conversation

@Ghabry

@Ghabry Ghabry commented Jun 2, 2024

Copy link
Copy Markdown
Member

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 Ghabry added the WiiU label Jun 2, 2024
@Ghabry Ghabry added this to the 0.8.1 milestone Jun 2, 2024
@Ghabry
Ghabry requested a review from carstene1ns June 2, 2024 22:34
@carstene1ns

This comment was marked as outdated.

@Ghabry

Ghabry commented Jun 3, 2024

Copy link
Copy Markdown
Member Author

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

@Ghabry

Ghabry commented Jun 3, 2024

Copy link
Copy Markdown
Member Author

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 added 2 commits June 3, 2024 19:44
The ProcUI API is very unstable and querying it crashes when a shutdown was requested.

For more control use it directly.
Consider "/vol" a valid path
@Ghabry

Ghabry commented Jun 3, 2024

Copy link
Copy Markdown
Member Author

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

Ghabry commented Jun 3, 2024

Copy link
Copy Markdown
Member Author

IMG_20240603_143132

IMG_20240603_143145

IMG_20240603_143147

IMG_20240603_201808

Comment thread resources/wiiu/splash-drc.png
@Ghabry

Ghabry commented Jun 3, 2024

Copy link
Copy Markdown
Member Author

The ICU issue is a simple fix 🎊 🎊 🎊

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

jetrotal commented Jun 4, 2024

Copy link
Copy Markdown
Contributor

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

Ghabry commented Jun 4, 2024

Copy link
Copy Markdown
Member Author

Thanks!

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

Quickly edited it:

grafik

Ghabry added 2 commits June 4, 2024 19:04
…a single read

Was the only agressive use of "end" in our code.
Implemented for the WiiU because IO through std::filebuf appears to be unbuffered.

But can maybe help on other platforms.

Can be toggled by setting USE_CUSTOM_FILE_READBUF to the prefered buffer size.
@Ghabry

Ghabry commented Jun 4, 2024

Copy link
Copy Markdown
Member Author

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 added 2 commits June 4, 2024 20:53
With the upcoming audiocfg branch it will create "Soundfont" and "Font" folders on startup.
Looks ugly when in the game directory as they are shown.
@Ghabry

Ghabry commented Jun 5, 2024

Copy link
Copy Markdown
Member Author

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

Ghabry commented Jun 6, 2024

Copy link
Copy Markdown
Member Author

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.

@carstene1ns carstene1ns left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from a few nits, works really great now!

Comment thread src/platform/wiiu/main.cpp
Comment thread src/platform/wiiu/main.cpp Outdated
Comment thread src/platform/wiiu/main.cpp Outdated
Comment thread src/platform/wiiu/main.cpp Outdated
Comment thread src/player.cpp Outdated
@ghost ghost added the Awaiting Rebase Pull requests with conflicting files due to former merge label Jul 2, 2024
@Ghabry Ghabry removed the Awaiting Rebase Pull requests with conflicting files due to former merge label Aug 27, 2024
@Ghabry

Ghabry commented Aug 27, 2024

Copy link
Copy Markdown
Member Author

Addressed the review comments and fixed a few more minor bugs. Is ready now 👍

Ghabry added 3 commits August 27, 2024 22:11
- ProdUi renamed
- Fixed save path for bundled games
- Moved ProcessProcUi call to the Ui
Calling Player::Exit in the Ui can crash because the Ui is deleted by it.
Also the normal teardown codepath is too slow on WiiU and crashes the console when the home button is used.
@ghost
ghost requested a review from carstene1ns August 27, 2024 20:11
@ghost
ghost merged commit b4fd5d5 into EasyRPG:master Sep 2, 2024
sevenc-nanashi pushed a commit to sevenc-nanashi/easyrpg-player that referenced this pull request May 31, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants