Move Wii U to new makefile

This commit is contained in:
UnknownShadow200 2025-07-26 21:37:23 +10:00
parent 6dab29e62d
commit 7c94970b8d
9 changed files with 137 additions and 312 deletions

View File

@ -121,7 +121,7 @@ $(BUILD_DIR)/%.shbin: misc/3ds/%.v.pica
$(PICASSO) $< -o $@
$(BUILD_DIR)/%.shbin.o: $(BUILD_DIR)/%.shbin
$(BIN2S) $< | $(ARM_AS) -o $@
$(BIN2S) $< | $(ARM_CC) -x assembler-with-cpp -c - -o $@
#---------------------------------------------------------------------------------

View File

@ -4,16 +4,24 @@ N64_ROM_TITLE = "ClassiCube"
N64_ROM_RTC = true
TARGET = ClassiCube-n64
N64_MKDFS_ROOT = "misc/n64/files"
SRC_DIRS =
CFILES := $(notdir $(wildcard src/*.c))
OFILES := $(CFILES:.c=.o) rsp_gpu.o
OBJS := $(addprefix $(BUILD_DIR)/,$(OFILES))
CFLAGS := -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=incompatible-pointer-types
default: $(TARGET).z64
default: $(BUILD_DIR) $(TARGET).z64
clean:
rm -rf $(BUILD_DIR) $(TARGET).z64
$(BUILD_DIR):
mkdir -p $@
$(BUILD_DIR)/%.o: src/%.c
@mkdir -p $(dir $@)
@echo " [CC] $<"
$(CC) -c $(CFLAGS) -o $@ $<
@ -26,8 +34,4 @@ $(BUILD_DIR)/filesystem.dfs: misc/n64/files/default.zip
$(BUILD_DIR)/ClassiCube-n64.elf: $(OBJS)
clean:
rm -rf $(BUILD_DIR) $(TARGET).z64
.PHONY: clean
-include $(wildcard $(BUILD_DIR)/*.d)

View File

@ -1,170 +1,123 @@
#-------------------------------------------------------------------------------
.SUFFIXES:
#-------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif
TOPDIR ?= $(CURDIR)
.SUFFIXES:
#-------------------------------------------------------------------------------
# APP_NAME sets the long name of the application
# APP_SHORTNAME sets the short name of the application
# APP_AUTHOR sets the author of the application
#-------------------------------------------------------------------------------
APP_NAME := ClassiCube
APP_SHORTNAME := ClassiCube
APP_AUTHOR := ClassiCube team
include $(DEVKITPRO)/wut/share/wut_rules
#---------------------------------------------------------------------------------
# Configurable options
#---------------------------------------------------------------------------------
# Name of the final output
TARGET = ClassiCube-wiiu
# List of directories containing source code
SOURCE_DIRS = src src/wiiu third_party/bearssl
# Directory where object files are placed
BUILD_DIR = build/wiiu
# Directory where shader files are
SHADERS = misc/wiiu
#-------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
# CONTENT is the path to the bundled folder that will be mounted as /vol/content/
# ICON is the game icon, leave blank to use default rule
# TV_SPLASH is the image displayed during bootup on the TV, leave blank to use default rule
# DRC_SPLASH is the image displayed during bootup on the DRC, leave blank to use default rule
#-------------------------------------------------------------------------------
TARGET := ClassiCube-wiiu
BUILD := build-wiiu
SOURCES := src third_party/bearssl
SHADERS := misc/wiiu
DATA := data
INCLUDES :=
CONTENT :=
ICON :=
TV_SPLASH :=
DRC_SPLASH :=
WUHB_OPTIONS = \
--name "ClassiCube" \
--short-name "ClassiCube" \
--author "ClassiCube team" \
--icon=misc/wiiu/icon.png
#-------------------------------------------------------------------------------
# options for code generation
#-------------------------------------------------------------------------------
CFLAGS := -g -Wall -O2 -ffunction-sections -fno-math-errno \
$(MACHDEP)
#WUHB_OPTIONS += --tv-image=misc/wiiu/tv_splash.png
#WUHB_OPTIONS += --drc-image=misc/wiiu/drc_splash.png
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS)
#---------------------------------------------------------------------------------
# Compilable files
#---------------------------------------------------------------------------------
S_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map)
LIBS := -lwut -lm
#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level
# containing include and lib
#-------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(WUT_ROOT)
#-------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#-------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#-------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.gsh)))
export LD := $(CC)
BINFILES := $(foreach dir,$(SHADERS),$(wildcard $(dir)/*.gsh))
OBJS += $(addprefix $(BUILD_DIR)/, $(notdir $(BINFILES:%.gsh=%.gsh.o)))
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
# Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(OBJS:%.o=%.d)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifneq (,$(strip $(CONTENT)))
export APP_CONTENT := $(TOPDIR)/$(CONTENT)
endif
#---------------------------------------------------------------------------------
# Code generation
#---------------------------------------------------------------------------------
MACHDEP = -DESPRESSO -mcpu=750 -meabi -mhard-float
CFLAGS = -g -Wall -O2 -ffunction-sections -fno-math-errno $(MACHDEP) \
-I $(DEVKITPRO)/wut/include \
-D__WIIU__ -D__WUT__
ifneq (,$(strip $(ICON)))
export APP_ICON := $(TOPDIR)/$(ICON)
else ifneq (,$(wildcard $(TOPDIR)/$(TARGET).png))
export APP_ICON := $(TOPDIR)/$(TARGET).png
else ifneq (,$(wildcard $(TOPDIR)/icon.png))
export APP_ICON := $(TOPDIR)/icon.png
endif
LDFLAGS = -g $(MACHDEP) -specs=$(DEVKITPRO)/wut/share/wut.specs \
-L $(DEVKITPRO)/wut/lib
# Additional libraries to link against
LIBS = -lwut -lm
ifneq (,$(strip $(TV_SPLASH)))
export APP_TV_SPLASH := $(TOPDIR)/$(TV_SPLASH)
else ifneq (,$(wildcard $(TOPDIR)/tv-splash.png))
export APP_TV_SPLASH := $(TOPDIR)/tv-splash.png
else ifneq (,$(wildcard $(TOPDIR)/splash.png))
export APP_TV_SPLASH := $(TOPDIR)/splash.png
endif
ifneq (,$(strip $(DRC_SPLASH)))
export APP_DRC_SPLASH := $(TOPDIR)/$(DRC_SPLASH)
else ifneq (,$(wildcard $(TOPDIR)/drc-splash.png))
export APP_DRC_SPLASH := $(TOPDIR)/drc-splash.png
else ifneq (,$(wildcard $(TOPDIR)/splash.png))
export APP_DRC_SPLASH := $(TOPDIR)/splash.png
endif
#---------------------------------------------------------------------------------
# Compiler tools
#---------------------------------------------------------------------------------
PREFIX := $(DEVKITPRO)/devkitPPC/bin/powerpc-eabi-
PPC_AS := $(PREFIX)as
PPC_CC := $(PREFIX)gcc
PPC_CXX := $(PREFIX)g++
.PHONY: $(BUILD) clean all
ELF2RPL := $(DEVKITPRO)/tools/bin/elf2rpl
WUHBTOOL := $(DEVKITPRO)/tools/bin/wuhbtool
BIN2S := $(DEVKITPRO)/tools/bin/bin2s
#-------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/misc/wiiu/Makefile
#---------------------------------------------------------------------------------
# Main targets
#---------------------------------------------------------------------------------
default: $(BUILD_DIR) $(TARGET).wuhb
#-------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).wuhb $(TARGET).rpx $(TARGET).elf
rm $(TARGET).wuhb $(TARGET).rpx $(TARGET).elf $(OBJS)
#-------------------------------------------------------------------------------
else
.PHONY: all
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
DEPENDS := $(OFILES:.o=.d)
#-------------------------------------------------------------------------------
# main targets
#-------------------------------------------------------------------------------
all : $(OUTPUT).wuhb
#---------------------------------------------------------------------------------
# Executable generation
#---------------------------------------------------------------------------------
$(TARGET).elf: $(OBJS)
$(PPC_CC) $(LDFLAGS) $^ -o $@ $(LIBS)
$(TARGET).rpx: $(TARGET).elf
$(ELF2RPL) $< $@
$(TARGET).wuhb: $(TARGET).rpx
$(WUHBTOOL) $< $@ $(WUHB_OPTIONS)
$(OUTPUT).wuhb : $(OUTPUT).rpx
$(OUTPUT).rpx : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
# you need a rule like this for each extension you use as binary data
#-------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#-------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#-------------------------------------------------------------------------------
%.gsh.o %_gsh.h : ../misc/wiiu/%.gsh
#-------------------------------------------------------------------------------
echo $(notdir $<)
$(bin2o)
#---------------------------------------------------------------------------------
# Object generation
#---------------------------------------------------------------------------------
$(BUILD_DIR)/%.o: src/%.c
$(PPC_CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
-include $(DEPENDS)
$(BUILD_DIR)/%.o: src/wiiu/%.S
$(PPC_CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
#-------------------------------------------------------------------------------
endif
#-------------------------------------------------------------------------------
$(BUILD_DIR)/%.o: src/wiiu/%.c
$(PPC_CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: third_party/bearssl/%.c
$(PPC_CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.gsh.o : misc/wiiu/%.gsh
$(BIN2S) $< | $(PPC_CC) -x assembler-with-cpp -c - -o $@
#---------------------------------------------------------------------------------
# Dependency tracking
#---------------------------------------------------------------------------------
$(DEPFILES):
include $(wildcard $(DEPFILES))

BIN
misc/wiiu/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -737,128 +737,6 @@ static cc_result HttpBackend_Do(struct HttpRequest* req, cc_string* urlStr) {
static cc_bool HttpBackend_DescribeError(cc_result res, cc_string* dst) {
return SSLBackend_DescribeError(res, dst);
}
#elif defined CC_BUILD_ANDROID
/*########################################################################################################################*
*-----------------------------------------------------Android backend-----------------------------------------------------*
*#########################################################################################################################*/
struct HttpRequest* java_req;
static jmethodID JAVA_httpInit, JAVA_httpSetHeader, JAVA_httpPerform, JAVA_httpSetData;
static jmethodID JAVA_httpDescribeError;
static cc_bool HttpBackend_DescribeError(cc_result res, cc_string* dst) {
char buffer[NATIVE_STR_LEN];
cc_string err;
JNIEnv* env;
jvalue args[1];
jobject obj;
JavaGetCurrentEnv(env);
args[0].i = res;
obj = JavaSCall_Obj(env, JAVA_httpDescribeError, args);
if (!obj) return false;
err = JavaGetString(env, obj, buffer);
String_AppendString(dst, &err);
(*env)->DeleteLocalRef(env, obj);
return true;
}
static void Http_AddHeader(struct HttpRequest* req, const char* key, const cc_string* value) {
JNIEnv* env;
jvalue args[2];
JavaGetCurrentEnv(env);
args[0].l = JavaMakeConst(env, key);
args[1].l = JavaMakeString(env, value);
JavaSCall_Void(env, JAVA_httpSetHeader, args);
(*env)->DeleteLocalRef(env, args[0].l);
(*env)->DeleteLocalRef(env, args[1].l);
}
/* Processes a HTTP header downloaded from the server */
static void JNICALL java_HttpParseHeader(JNIEnv* env, jobject o, jstring header) {
char buffer[NATIVE_STR_LEN];
cc_string line = JavaGetString(env, header, buffer);
Http_ParseHeader(java_req, &line);
}
/* Processes a chunk of data downloaded from the web server */
static void JNICALL java_HttpAppendData(JNIEnv* env, jobject o, jbyteArray arr, jint len) {
struct HttpRequest* req = java_req;
int ok = Http_BufferExpand(req, len);
if (!ok) Process_Abort("Out of memory for HTTP request");
(*env)->GetByteArrayRegion(env, arr, 0, len, (jbyte*)(&req->data[req->size]));
Http_BufferExpanded(req, len);
}
static const JNINativeMethod methods[] = {
{ "httpParseHeader", "(Ljava/lang/String;)V", java_HttpParseHeader },
{ "httpAppendData", "([BI)V", java_HttpAppendData }
};
static void CacheMethodRefs(JNIEnv* env) {
JAVA_httpInit = JavaGetSMethod(env, "httpInit", "(Ljava/lang/String;Ljava/lang/String;)I");
JAVA_httpSetHeader = JavaGetSMethod(env, "httpSetHeader", "(Ljava/lang/String;Ljava/lang/String;)V");
JAVA_httpPerform = JavaGetSMethod(env, "httpPerform", "()I");
JAVA_httpSetData = JavaGetSMethod(env, "httpSetData", "([B)I");
JAVA_httpDescribeError = JavaGetSMethod(env, "httpDescribeError", "(I)Ljava/lang/String;");
}
static void HttpBackend_Init(void) {
JNIEnv* env;
JavaGetCurrentEnv(env);
JavaRegisterNatives(env, methods);
CacheMethodRefs(env);
}
static cc_result Http_InitReq(JNIEnv* env, struct HttpRequest* req, cc_string* url) {
static const char* verbs[3] = { "GET", "HEAD", "POST" };
jvalue args[2];
jint res;
args[0].l = JavaMakeString(env, url);
args[1].l = JavaMakeConst(env, verbs[req->requestType]);
res = JavaSCall_Int(env, JAVA_httpInit, args);
(*env)->DeleteLocalRef(env, args[0].l);
(*env)->DeleteLocalRef(env, args[1].l);
return res;
}
static cc_result Http_SetData(JNIEnv* env, struct HttpRequest* req) {
jvalue args[1];
jint res;
args[0].l = JavaMakeBytes(env, req->data, req->size);
res = JavaSCall_Int(env, JAVA_httpSetData, args);
(*env)->DeleteLocalRef(env, args[0].l);
return res;
}
static cc_result HttpBackend_Do(struct HttpRequest* req, cc_string* url) {
JNIEnv* env;
jint res;
JavaGetCurrentEnv(env);
if ((res = Http_InitReq(env, req, url))) return res;
java_req = req;
Http_SetRequestHeaders(req);
Http_AddHeader(req, "User-Agent", Http_GetUserAgent_UNSAFE());
if (req->data) {
if ((res = Http_SetData(env, req))) return res;
HttpRequest_Free(req);
}
req->_capacity = 0;
req->progress = HTTP_PROGRESS_FETCHING_DATA;
res = JavaSCall_Int(env, JAVA_httpPerform, NULL);
req->progress = 100;
return res;
}
#elif !defined CC_BUILD_NETWORKING
/*########################################################################################################################*
*------------------------------------------------------Null backend-------------------------------------------------------*

View File

@ -1,12 +1,9 @@
#include "Core.h"
#if defined CC_BUILD_WIIU
#include <sndcore2/core.h>
static cc_bool ax_inited;
struct AudioContext { int count; };
#include "_AudioBase.h"
#include "../_AudioBase.h"
static cc_bool ax_inited;
cc_bool AudioBackend_Init(void) {
if (ax_inited) return true;
@ -114,5 +111,4 @@ cc_result SoundContext_PollBusy(struct AudioContext* ctx, cc_bool* isBusy) {
cc_bool Audio_DescribeError(cc_result res, cc_string* dst) {
return false;
}
#endif

View File

@ -1,8 +1,7 @@
#include "Core.h"
#ifdef CC_BUILD_WIIU
#include "_GraphicsBase.h"
#include "Errors.h"
#include "Window.h"
#include "../_GraphicsBase.h"
#include "../Errors.h"
#include "../Window.h"
#include <gx2/clear.h>
#include <gx2/context.h>
#include <gx2/display.h>
@ -591,4 +590,3 @@ void Gfx_3DS_SetRenderScreen1(enum Screen3DS screen) {
GX2SetContextState(screen == TOP_SCREEN ? tv_state : drc_state);
}
#endif

View File

@ -1,17 +1,15 @@
#include "Core.h"
#if defined CC_BUILD_WIIU
#define CC_XTEA_ENCRYPTION
#include "_PlatformBase.h"
#include "Stream.h"
#include "ExtMath.h"
#include "SystemFonts.h"
#include "Funcs.h"
#include "Window.h"
#include "Utils.h"
#include "Errors.h"
#include "PackedCol.h"
#include "Audio.h"
#include "../_PlatformBase.h"
#include "../Stream.h"
#include "../ExtMath.h"
#include "../SystemFonts.h"
#include "../Funcs.h"
#include "../Window.h"
#include "../Utils.h"
#include "../Errors.h"
#include "../PackedCol.h"
#include "../Audio.h"
#include <errno.h>
#include <time.h>
#include <stdlib.h>
@ -40,7 +38,8 @@
#include <coreinit/systeminfo.h>
#include <coreinit/time.h>
#include <whb/proc.h>
#include "_PlatformConsole.h"
#include "../_PlatformConsole.h"
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
const cc_result ReturnCode_FileNotFound = ENOENT;
@ -476,4 +475,3 @@ static cc_result GetMachineID(cc_uint32* key) {
Mem_Copy(key, MACHINE_KEY, sizeof(MACHINE_KEY) - 1);
return 0;
}
#endif

View File

@ -1,18 +1,17 @@
#include "Core.h"
#if defined CC_BUILD_WIIU
#include "Window.h"
#include "Platform.h"
#include "Input.h"
#include "Event.h"
#include "String.h"
#include "Funcs.h"
#include "Bitmap.h"
#include "Errors.h"
#include "ExtMath.h"
#include "Graphics.h"
#include "Launcher.h"
#include "LBackend.h"
#include "VirtualKeyboard.h"
#include "../Window.h"
#include "../Platform.h"
#include "../Input.h"
#include "../Event.h"
#include "../String.h"
#include "../Funcs.h"
#include "../Bitmap.h"
#include "../Errors.h"
#include "../ExtMath.h"
#include "../Graphics.h"
#include "../Launcher.h"
#include "../LBackend.h"
#include "../VirtualKeyboard.h"
#include <coreinit/memheap.h>
#include <coreinit/cache.h>
#include <coreinit/memfrmheap.h>
@ -488,4 +487,3 @@ void OnscreenKeyboard_SetText(const cc_string* text) {
void OnscreenKeyboard_Close(void) {
VirtualKeyboard_Close();
}
#endif