forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git subrepo clone https://github.com/c08oprkiua/godot-wii-u platform/…
…wiiu subrepo: subdir: "platform/wiiu" merged: "1b5c230ac9" upstream: origin: "https://github.com/c08oprkiua/godot-wii-u" branch: "main" commit: "1b5c230ac9" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "110b9eb"
- Loading branch information
1 parent
c7fb064
commit 81678a8
Showing
31 changed files
with
1,290 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
; DO NOT EDIT (unless you know what you are doing) | ||
; | ||
; This subdirectory is a git "subrepo", and this file is maintained by the | ||
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme | ||
; | ||
[subrepo] | ||
remote = https://github.com/c08oprkiua/godot-wii-u | ||
branch = main | ||
commit = 1b5c230ac9fda518cb0152dd487a0b2273e595c9 | ||
parent = c7fb0645af400a1859154bcee9394e63bdabd198 | ||
method = merge | ||
cmdver = 0.4.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# godot-wii-u | ||
WIP port of Godot 4 to Wii U | ||
|
||
Uses Wii U Toolchain. | ||
|
||
This repo will only contain the relevant folders to add to an existing copy of the Godot source code. | ||
|
||
|
||
# Progress | ||
## Vital core things | ||
- [ ] Threading (coreinit) | ||
- [ ] Thread (coreinit/thread) | ||
- [ ] Mutex (coreinit/mutex) | ||
- [ ] Semaphore (coreinit/semaphore) | ||
- [ ] Crash handling | ||
- [ ] OS integration | ||
- [ ] Home Menu (ProcUI) | ||
- [ ] Keyboard overlay (swkbd) | ||
- [x] Software information | ||
- [x] Hardware information | ||
- [ ] Time (Time) | ||
|
||
## Secondary vital core things | ||
- [ ] Filesystem access | ||
- [ ] Graphics (gx2, gx2r) | ||
- [ ] Audio (sndcore2) | ||
- [ ] Input | ||
- [ ] Gamepad (VPAD) | ||
- [ ] Wii remotes (KPAD) | ||
|
||
## Nice QoL things | ||
- [ ] Networking | ||
- [ ] HTTPClient | ||
|
||
# Compiling | ||
|
||
I'm adding this here just so people don't ask about it. The SCons script to build the platform isn't done, nor will I worry about it until I have enough done to make it work trying to compile to see if it works. | ||
|
||
If you have any questions, join [The Homebrodot Discord](https://discord.gg/mYzXDke5yv),[my Discord](https://discord.com/invite/Mu6YUEmerN) or make an issue here on GitHub. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import os | ||
import platform | ||
import sys | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from SCons import Environment | ||
|
||
#Godot for Wii U | ||
#Based heavily on the Android port, because that's a prime example of linking external libraries, | ||
#compiling for an arch that is not the host's arch, etc. Also based on SeleDream's port of Godot 4 to 3DS. | ||
|
||
def is_active(): | ||
return False #Needs to be true for the platform to be usable, false for convenience | ||
|
||
def get_name(): | ||
return "Wii U" | ||
|
||
def can_build(): | ||
if not(os.getenv("DEVKITPRO") and os.getenv("DEVKITPPC")): | ||
print("Either DevKitPro or DevKitPPC were not found, Wii U disabled.") | ||
return False | ||
return True | ||
|
||
|
||
def get_opts(): | ||
from SCons.Variables import BoolVariable, EnumVariable | ||
|
||
return [ | ||
EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")), | ||
BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True), | ||
BoolVariable("use_coverage", "Test Godot coverage", False), | ||
BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), | ||
BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False), | ||
BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False), | ||
BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False), | ||
BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False), | ||
BoolVariable("use_sowrap", "Dynamically load system libraries", True), | ||
BoolVariable("alsa", "Use ALSA", True), | ||
BoolVariable("touch", "Enable touch events", True), #probably the only option here that should stay lol | ||
BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False), | ||
] | ||
|
||
def get_doc_classes(): | ||
return [ | ||
"EditorExportPlatformWiiU", | ||
] | ||
|
||
def get_doc_path(): | ||
return "doc_classes" | ||
|
||
def get_flags(): | ||
return [ | ||
("arch", "ppc32"), | ||
] | ||
|
||
def configure(env: "Environment"): | ||
# Validate arch. These are supported COMPILE arches, not supported EXPORT arches. | ||
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"] #Does devkitppc even work on ARM...??? | ||
if env["arch"] not in supported_arches: | ||
print( | ||
'Unsupported CPU architecture "%s" for Wii U. Supported architectures are: %s.' | ||
% (env["arch"], ", ".join(supported_arches)) | ||
) | ||
sys.exit() | ||
|
||
## Build type | ||
|
||
env["bits"] = "32" | ||
|
||
## Compiler configuration | ||
devkitpath = env["DEVKITPRO"] | ||
wutpath = devkitpath + "/wut" | ||
wuhbpath = devkitpath + "tools/bin/wuhbtool" #I figure this will be needed to export to wuhb? | ||
#Link flags | ||
|
||
env.Prepend(CPPPATH=["#platform/wiiu"]) | ||
env.Append(LIBS=["wut"]) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/*************************************************************************/ | ||
/* export.cpp */ | ||
/*************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* http://www.godotengine.org */ | ||
/*************************************************************************/ | ||
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ | ||
/* */ | ||
/* Permission is hereby granted, free of charge, to any person obtaining */ | ||
/* a copy of this software and associated documentation files (the */ | ||
/* "Software"), to deal in the Software without restriction, including */ | ||
/* without limitation the rights to use, copy, modify, merge, publish, */ | ||
/* distribute, sublicense, and/or sell copies of the Software, and to */ | ||
/* permit persons to whom the Software is furnished to do so, subject to */ | ||
/* the following conditions: */ | ||
/* */ | ||
/* The above copyright notice and this permission notice shall be */ | ||
/* included in all copies or substantial portions of the Software. */ | ||
/* */ | ||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ | ||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ | ||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ | ||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ | ||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ | ||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ | ||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ | ||
/*************************************************************************/ | ||
|
||
#include "export.h" | ||
|
||
#include "editor/export/editor_export.h" | ||
|
||
void register_wiiu_exporter_types(){ | ||
GDREGISTER_VIRTUAL_CLASS(EditorExportPlatformWiiU) | ||
} | ||
|
||
void register_wiiu_exporter() { | ||
|
||
{ | ||
Ref<EditorExportPlatformWiiU> exporter = Ref<EditorExportPlatformWiiU>( memnew(EditorExportPlatformWiiU) ); | ||
exporter->set_binary_extension("rpx"); | ||
exporter->set_release_binary32("wiiu_release"); | ||
exporter->set_debug_binary32("wiiu_debug"); | ||
platform->set_name("Wii U"); | ||
platform->set_os_name("Wii U"); | ||
|
||
EditorExport::get_singleton()->add_export_platform(exporter); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*************************************************************************/ | ||
/* export.h */ | ||
/*************************************************************************/ | ||
/* This file is part of: */ | ||
/* GODOT ENGINE */ | ||
/* http://www.godotengine.org */ | ||
/*************************************************************************/ | ||
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ | ||
/* */ | ||
/* Permission is hereby granted, free of charge, to any person obtaining */ | ||
/* a copy of this software and associated documentation files (the */ | ||
/* "Software"), to deal in the Software without restriction, including */ | ||
/* without limitation the rights to use, copy, modify, merge, publish, */ | ||
/* distribute, sublicense, and/or sell copies of the Software, and to */ | ||
/* permit persons to whom the Software is furnished to do so, subject to */ | ||
/* the following conditions: */ | ||
/* */ | ||
/* The above copyright notice and this permission notice shall be */ | ||
/* included in all copies or substantial portions of the Software. */ | ||
/* */ | ||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ | ||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ | ||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ | ||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ | ||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ | ||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ | ||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ | ||
/*************************************************************************/ | ||
|
||
#ifndef WIIU_EXPORT_H | ||
#define WIIU_EXPORT_H | ||
|
||
void register_wiiu_exporter_types(); | ||
void register_wiiu_exporter(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
//WUT stuff | ||
#include <whb/proc.h> | ||
#include <whb/gfx.h> | ||
#include <padscore/kpad.h> | ||
#include <vpad/input.h> | ||
|
||
//platform files | ||
#include "os_wiiu.h" | ||
#include "processor/wiiu_thread.h" | ||
#include "graphics/CafeGLSLCompiler.h" | ||
|
||
#ifndef PLATFORM_THREAD_OVERRIDE | ||
#include "core/os/thread.h" | ||
#else | ||
#include "platform/wiiu/platform_thread.h" | ||
#endif | ||
|
||
int main(int argc, char *argv) { | ||
OS_WiiU os; | ||
|
||
//Setting the special platform thread functions | ||
Thread::PlatformFunctions customfuncs; | ||
customfuncs.init = wiiu_thread_init; | ||
customfuncs.set_name = wiiu_thread_set_name; | ||
customfuncs.set_priority = wiiu_thread_set_priority; | ||
customfuncs.wrapper = wiiu_thread_call_wrap; | ||
customfuncs.term = wiiu_thread_term; | ||
Thread::_set_platform_functions(customfuncs) | ||
|
||
//Start the Wii U stuff | ||
WHBProcInit(); | ||
WhbGfxInit(); | ||
InitGLSLCompiler(); | ||
VPADInit(); //idc if it's depreciated | ||
KPADInit(); | ||
|
||
|
||
|
||
|
||
//Basically copy pasted from godot_linuxbsd.cpp's main function | ||
char *cwd = (char *)malloc(PATH_MAX); | ||
ERR_FAIL_NULL_V(cwd, ERR_OUT_OF_MEMORY); | ||
char *ret = getcwd(cwd, PATH_MAX); | ||
//Set up Godot | ||
Error err = Main::setup(argv[0], argc - 1, &argv[1]); | ||
if (err != OK) { | ||
free(cwd); | ||
if (err == ERR_HELP) { // Returned by --help and --version, so success. | ||
return 0; | ||
} | ||
return 255; | ||
} | ||
//Run the Godot-integrated main loop | ||
if (Main::start()) { | ||
os.set_exit_code(EXIT_SUCCESS); | ||
os.run(); // This is the REAL main loop | ||
} | ||
Main::cleanup(); | ||
|
||
|
||
|
||
return os.get_exit_code(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#pragma once | ||
#include <stdint.h> | ||
|
||
#if defined(__WUT__) || defined(__WIIU__) | ||
#include <gx2/shaders.h> | ||
#include <coreinit/dynload.h> | ||
#include <coreinit/debug.h> | ||
|
||
#define GLSL_COMPILER_CAFE_RPL // use compiler as rpl | ||
#endif | ||
|
||
#ifdef GLSL_COMPILER_CAFE_RPL | ||
inline OSDynLoad_Module s_glslCompilerModule = nullptr; | ||
#endif | ||
|
||
enum GLSL_COMPILER_FLAG | ||
{ | ||
// reserved for future use | ||
GLSL_COMPILER_FLAG_NONE = 0, | ||
GLSL_COMPILER_FLAG_GENERATE_DISASSEMBLY = 1 << 0, // write disassembly to stderr | ||
}; | ||
|
||
inline GX2VertexShader* (*GLSL_CompileVertexShader)(const char* shaderSource, char* infoLogOut, int infoLogMaxLength, GLSL_COMPILER_FLAG flags); | ||
inline GX2PixelShader* (*GLSL_CompilePixelShader)(const char* shaderSource, char* infoLogOut, int infoLogMaxLength, GLSL_COMPILER_FLAG flags); | ||
inline void (*GLSL_FreeVertexShader)(GX2VertexShader* shader); | ||
inline void (*GLSL_FreePixelShader)(GX2PixelShader* shader); | ||
inline void (*__GLSL_DestroyGLSLCompiler)(); | ||
|
||
#ifndef GLSL_COMPILER_CAFE_RPL | ||
extern "C" | ||
{ | ||
void InitGLSLCompiler(); | ||
void DestroyGLSLCompiler(); | ||
GX2VertexShader* CompileVertexShader(const char* shaderSource, char* infoLogOut, int infoLogMaxLength, GLSL_COMPILER_FLAG flags); | ||
GX2PixelShader* CompilePixelShader(const char* shaderSource, char* infoLogOut, int infoLogMaxLength, GLSL_COMPILER_FLAG flags); | ||
void FreeVertexShader(GX2VertexShader* shader); | ||
void FreePixelShader(GX2PixelShader* shader); | ||
}; | ||
#endif | ||
|
||
static inline bool GLSL_Init() | ||
{ | ||
void (*_InitGLSLCompiler)() = nullptr; | ||
#if defined(__WUT__) || defined(__WIIU__) | ||
if (s_glslCompilerModule != nullptr) | ||
return false; | ||
OSDynLoad_Error r = OSDynLoad_Acquire("glslcompiler", &s_glslCompilerModule); | ||
if(r != OS_DYNLOAD_OK) // try alternate path | ||
r = OSDynLoad_Acquire("~/wiiu/libs/glslcompiler.rpl", &s_glslCompilerModule); | ||
if (r != OS_DYNLOAD_OK) | ||
{ | ||
OSReport("glslcompiler.rpl not found\n"); | ||
return false; | ||
} | ||
// find exports | ||
OSDynLoad_FindExport(s_glslCompilerModule, OS_DYNLOAD_EXPORT_FUNC, "InitGLSLCompiler", (void**)&_InitGLSLCompiler); | ||
OSDynLoad_FindExport(s_glslCompilerModule, OS_DYNLOAD_EXPORT_FUNC, "CompileVertexShader", (void**)&GLSL_CompileVertexShader); | ||
OSDynLoad_FindExport(s_glslCompilerModule, OS_DYNLOAD_EXPORT_FUNC, "CompilePixelShader", (void**)&GLSL_CompilePixelShader); | ||
OSDynLoad_FindExport(s_glslCompilerModule, OS_DYNLOAD_EXPORT_FUNC, "FreeVertexShader", (void**)&GLSL_FreeVertexShader); | ||
OSDynLoad_FindExport(s_glslCompilerModule, OS_DYNLOAD_EXPORT_FUNC, "FreePixelShader", (void**)&GLSL_FreePixelShader); | ||
OSDynLoad_FindExport(s_glslCompilerModule, OS_DYNLOAD_EXPORT_FUNC, "DestroyGLSLCompiler", (void**)&__GLSL_DestroyGLSLCompiler); | ||
#else | ||
_InitGLSLCompiler = InitGLSLCompiler; | ||
GLSL_CompileVertexShader = CompileVertexShader; | ||
GLSL_CompilePixelShader = CompilePixelShader; | ||
GLSL_FreeVertexShader = FreeVertexShader; | ||
GLSL_FreePixelShader = FreePixelShader; | ||
__GLSL_DestroyGLSLCompiler = DestroyGLSLCompiler; | ||
#endif | ||
_InitGLSLCompiler(); | ||
return true; | ||
} | ||
|
||
static inline bool GLSL_Shutdown() | ||
{ | ||
#ifdef GLSL_COMPILER_CAFE_RPL | ||
if (s_glslCompilerModule == nullptr) | ||
return false; | ||
__GLSL_DestroyGLSLCompiler(); | ||
OSDynLoad_Release(s_glslCompilerModule); | ||
s_glslCompilerModule = nullptr; | ||
#else | ||
__GLSL_DestroyGLSLCompiler(); | ||
#endif | ||
return true; | ||
} | ||
|
Oops, something went wrong.