Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial WiiU support #3167

Merged
merged 4 commits into from
Dec 20, 2023
Merged

Initial WiiU support #3167

merged 4 commits into from
Dec 20, 2023

Conversation

carstene1ns
Copy link
Member

Simple and straightforward.

@carstene1ns carstene1ns added this to the 0.8.1 milestone Dec 3, 2023
message(FATAL_ERROR "Invalid target platform")
endif()

# Shared by homebrew platforms
if(${PLAYER_TARGET_PLATFORM} MATCHES "^(3ds|psvita|switch|wii)$")
if(${PLAYER_TARGET_PLATFORM} MATCHES "^(3ds|psvita|switch|wii)$" OR NINTENDO_WIIU)
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering first why you didn't add "wiiu" here but I get it now:

The target platform is SDL2 with a few WIIU adjustments.


This looks still a bit WIP but: Can I merge this or are more commits planned?

@carstene1ns
Copy link
Member Author

One thing i wanted to add is some config scene stuff. Need to check SDL2 source to get controller mapping

@carstene1ns
Copy link
Member Author

#3126 - first part fixed
#3054 - should be fixed, tested here
#1348 - bit related, but unfixed.

@carstene1ns
Copy link
Member Author

carstene1ns commented Dec 6, 2023

@carstene1ns
Copy link
Member Author

Something is fishy in big endian land: The debug build asserts in sdl_format_to_format().

We get LSB, but the WiiU SDL2 sets explicitly MSB.

Here is a patch that makes Player start, but is a bit ugly:

diff --git a/src/platform/sdl/sdl_audio.cpp b/src/platform/sdl/sdl_audio.cpp
index adf56dfb4..5e184c7fa 100644
--- a/src/platform/sdl/sdl_audio.cpp
+++ b/src/platform/sdl/sdl_audio.cpp
@@ -53,9 +53,11 @@ AudioDecoder::Format sdl_format_to_format(Uint16 format) {
 			return AudioDecoder::Format::U8;
 		case AUDIO_S8:
 			return AudioDecoder::Format::S8;
-		case AUDIO_U16SYS:
+		case AUDIO_U16LSB:
+		case AUDIO_U16MSB:
 			return AudioDecoder::Format::U16;
-		case AUDIO_S16SYS:
+		case AUDIO_S16LSB:
+		case AUDIO_S16MSB:
 			return AudioDecoder::Format::S16;
 #if SDL_MAJOR_VERSION > 1
 		case AUDIO_S32:
@@ -64,6 +66,7 @@ AudioDecoder::Format sdl_format_to_format(Uint16 format) {
 			return AudioDecoder::Format::F32;
 #endif
 		default:
+			Output::Warning("Couldn't convert SDL Audio Format! Got: {x}", format);
 			assert(false);
 	}

I had this problem with the buildscripts before and added big endian defines manually. Not sure if this is a packaging error or some HLE in cemu maybe.

@Ghabry
Copy link
Member

Ghabry commented Dec 6, 2023

okay lets try to figure this one out (worth checking SDL_BYTEORDER). Otherwise LGTM.

Cannot do an hardware test before xmas. Is something for after merge. Will take the WiiU from my parents attic when I visit them and take it to my flat. Will make testing easier xD.

@Ghabry
Copy link
Member

Ghabry commented Dec 6, 2023

@carstene1ns after lots of tracing about the preprocessor values: They are all correct.

The issue is much simpler.

We do want.format = AUDIO_S16;

And the code in SDL2 says: #define AUDIO_S16 AUDIO_S16LSB

So changing this to AUDIO_S16SYS should resolve it...

Which means this also never worked on Big Endian Debian but who uses this 😅

@carstene1ns
Copy link
Member Author

carstene1ns commented Dec 7, 2023

This seems to be a difference in SDL1.2 vs 2, otherwise we would have noticed this on Wii and Amiga.

Just checked, it is the same there, so no idea why this worked so long.

Copy link
Member

@Ghabry Ghabry left a comment

Choose a reason for hiding this comment

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

I'm merging this for now to make the PR builder green. Will amend this when I have the WiiU around, will set mine up in January :)

@Ghabry Ghabry merged commit dc933f5 into EasyRPG:master Dec 20, 2023
13 checks passed
@carstene1ns
Copy link
Member Author

Yay

@AlbertoDiazC
Copy link

Seems to error about the folder sdmc:/data/easyrpg-player/ , has to be created beforehand manually.

@carstene1ns carstene1ns deleted the feature/wiiu branch January 14, 2024 22:15
@carstene1ns
Copy link
Member Author

@AlbertoDiazC Thank you for the feedback, did you try if it does run games? I could not test it, because I do not own a Wii U.

@AlbertoDiazC
Copy link

Yes it does run games quite well.
Settings can't be saved when that folder doesn't exist, which is a minor issue. A fix should be easy imho, the player could create it at first if it's missing.

@Ghabry
Copy link
Member

Ghabry commented Jan 15, 2024

Hmm the setting folder is automatically created when missing. Must be a WiiU exclusive bug 🤔. Thanks for testing!

@AlbertoDiazC
Copy link

Found another small issue, this time is about the rtp path.
This is the relevant fragment of the logfile:

[2024-01-21 18:35:29] Debug: EXEReader: VERSIONINFO resource found (DE 0xea180; 0x10e770; len 0x2ec)
[2024-01-21 18:35:29] Debug: RPG_RT information: version=1.1.1.0 logos=1 code=0xc9000 cherry=0xb800 geep=0x0 i386=true easyrpg=false
[2024-01-21 18:35:29] Debug: Engine configured as: 2k=false 2k3=true MajorUpdated=true Eng=true
[2024-01-21 18:35:29] Debug: RTP path ./rtp/2003 is invalid, not adding
[2024-01-21 18:35:29] Debug: RTP path /data/easyrpg-player/rtp/2003 is invalid, not adding
[2024-01-21 18:35:29] Debug: Patch configuration: dynrpg=false maniac=false key-patch=false common-this=false pic-unlock=false 2k3-commands=false
[2024-01-21 18:35:29] Debug: Cannot find: Logo/LOGO1
[2024-01-21 18:35:29] Debug: EXEReader: LOGO1 resource found (DE 0xe9d60; 0xea398; len 0x3d38)
[2024-01-21 18:35:29] Debug: Resolution changed to 320x240
[2024-01-21 18:35:29] Debug: Loaded Map Map0001.lmu

I keep good copies of the rtp at
./rtp/2003 (not usable in aroma cfw because a proccess cant know its own path)
/data/rtp/2003 (and 2000)
/data/easyrpg-player/rtp/2003 (and 2000)

I figure this bug could be fixable with one of these workarounds:
Prepend smdc:/ as in sdmc:/data/rtp/2003
Use the full path /vol/external01/data/rtp/2003

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants