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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,12 @@ elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "amigaos4")
src/platform/sdl/axis.h
src/platform/sdl/sdl_ui.cpp
src/platform/sdl/sdl_ui.h)
else()
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?

target_compile_options(${PROJECT_NAME} PUBLIC -fno-exceptions -fno-rtti)
set(CMAKE_DL_LIBS "") # hack4icu!
set(PLAYER_ENABLE_TESTS OFF)
Expand Down Expand Up @@ -1067,7 +1068,16 @@ if(${PLAYER_AUDIO_BACKEND} MATCHES "^(SDL2|SDL1|libretro|psvita|3ds|switch|wii|a
endif()

# Executable
if(${PLAYER_BUILD_EXECUTABLE} AND (${PLAYER_TARGET_PLATFORM} STREQUAL "SDL2" OR ${PLAYER_TARGET_PLATFORM} STREQUAL "SDL1"))
if(NINTENDO_WIIU)
add_executable(easyrpg-player src/platform/sdl/main.cpp)
target_link_libraries(easyrpg-player ${PROJECT_NAME})
wut_create_rpx(easyrpg-player)
wut_create_wuhb(easyrpg-player
NAME "EasyRPG Player ${PLAYER_VERSION_FULL}"
SHORT_NAME "Player"
AUTHOR "EasyRPG Team"
) # todo icon, splashs
elseif(${PLAYER_BUILD_EXECUTABLE} AND (${PLAYER_TARGET_PLATFORM} STREQUAL "SDL2" OR ${PLAYER_TARGET_PLATFORM} STREQUAL "SDL1"))
if(APPLE)
set(EXE_NAME "EasyRPG-Player.app")
set_source_files_properties(${${PROJECT_NAME}_BUNDLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
Expand Down
3 changes: 3 additions & 0 deletions src/filefinder_rtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ FileFinder_RTP::FileFinder_RTP(bool no_rtp, bool no_rtp_warnings, std::string rt
#ifdef GEKKO
AddPath("sd:/data/rtp/" + version_str);
AddPath("usb:/data/rtp/" + version_str);
#elif defined(__WIIU__)
AddPath("./rtp/" + version_str);
AddPath("/data/easyrpg-player/rtp/" + version_str);
#elif defined(__SWITCH__)
AddPath("./rtp/" + version_str);
AddPath("/switch/easyrpg-player/rtp/" + version_str);
Expand Down
4 changes: 3 additions & 1 deletion src/game_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ FilesystemView Game_Config::GetGlobalConfigFilesystem() {

if (config_path.empty()) {
#ifdef GEKKO
path = "sd:/data/easyrpg-player";
path = "/data/easyrpg-player";
#elif defined(__WIIU__)
path = "/vol/external01/data/easyrpg-player"; // temp
#elif defined(__SWITCH__)
path = "/switch/easyrpg-player";
#elif defined(__3DS__)
Expand Down
20 changes: 20 additions & 0 deletions src/platform/sdl/sdl2_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
# include <SDL_system.h>
#elif defined(EMSCRIPTEN)
# include <emscripten.h>
#elif defined(__WIIU__)
# include <whb/proc.h>
# include <coreinit/debug.h>
#endif
#include "icon.h"

Expand Down Expand Up @@ -137,6 +140,9 @@ Sdl2Ui::Sdl2Ui(long width, long height, const Game_Config& cfg) : BaseUi(cfg)
#ifdef EMSCRIPTEN
SDL_SetHint(SDL_HINT_EMSCRIPTEN_ASYNCIFY, "0");
#endif
#ifdef __WIIU__
//WHBProcInit();
#endif

if (SDL_Init(SDL_INIT_VIDEO) < 0) {
Output::Error("Couldn't initialize SDL.\n{}\n", SDL_GetError());
Expand Down Expand Up @@ -189,6 +195,10 @@ Sdl2Ui::~Sdl2Ui() {
SDL_DestroyWindow(sdl_window);
}
SDL_Quit();

#ifdef __WIIU__
//WHBProcShutdown();
#endif
}

bool Sdl2Ui::vChangeDisplaySurfaceResolution(int new_width, int new_height) {
Expand Down Expand Up @@ -492,6 +502,16 @@ void Sdl2Ui::ToggleZoom() {
#endif
}

bool Sdl2Ui::LogMessage(const std::string &message) {
#ifdef __WIIU__
OSReport("%s\n", message.c_str());
return true;
#else
// not logged
return false;
#endif
}

void Sdl2Ui::ProcessEvents() {
SDL_Event evnt;

Expand Down
1 change: 1 addition & 0 deletions src/platform/sdl/sdl2_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Sdl2Ui final : public BaseUi {
void UpdateDisplay() override;
void SetTitle(const std::string &title) override;
bool ShowCursor(bool flag) override;
bool LogMessage(const std::string &message) override;
void ProcessEvents() override;
void SetScalingMode(ScalingMode) override;
void ToggleStretch() override;
Expand Down
4 changes: 4 additions & 0 deletions src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
# include <cstdint>
# define SUPPORT_JOYSTICK
# define SUPPORT_JOYSTICK_AXIS
#elif defined(__WIIU__)
# define SUPPORT_JOYSTICK
# define SUPPORT_JOYSTICK_AXIS
# define SUPPORT_TOUCH
#elif defined(_WIN32)
# define SUPPORT_ZOOM
# define SUPPORT_MOUSE
Expand Down
Loading