Skip to content

Commit

Permalink
Merge branch 'ClassiCube:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
josch1710 authored Apr 14, 2024
2 parents 424ad68 + e20bf23 commit 56c88ca
Show file tree
Hide file tree
Showing 133 changed files with 7,278 additions and 1,545 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build_3ds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ jobs:
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'


- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-3ds.cia'
DEST_NAME: 'ClassiCube-3ds.cia'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/build_ds.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build latest (DS)
name: Build latest (NDS)
on: [push]

concurrency:
group: ${{ github.ref }}-ds
group: ${{ github.ref }}-nds
cancel-in-progress: true

jobs:
Expand All @@ -13,7 +13,7 @@ jobs:
image: skylyrac/blocksds:dev-latest
steps:
- uses: actions/checkout@v4
- name: Compile DS build
- name: Compile NDS build
id: compile
run: |
export BLOCKSDS=/opt/blocksds/core
Expand All @@ -29,12 +29,18 @@ jobs:
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile DS build'
NOTIFY_MESSAGE: 'Failed to compile NDS build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'


- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'classicube.nds'
DEST_NAME: 'classicube.nds'
SOURCE_FILE: 'ClassiCube.nds'
DEST_NAME: 'ClassiCube.nds'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'build-nds/ClassiCube.elf'
DEST_NAME: 'ClassiCube-nds.elf'
5 changes: 5 additions & 0 deletions .github/workflows/build_ps2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
make ps2
# otherwise notify_failure doesn't work
- name: Install curl when necessary
if: ${{ always() && steps.compile.outcome == 'failure' }}
run: apk add curl

- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build_ps3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ jobs:
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'


- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-PS3.elf'
DEST_NAME: 'ClassiCube-PS3.elf'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
Expand All @@ -44,4 +50,4 @@ jobs:
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-PS3.pkg'
DEST_NAME: 'ClassiCube-PS3.pkg'
DEST_NAME: 'ClassiCube-PS3.pkg'
45 changes: 45 additions & 0 deletions .github/workflows/build_wiiu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build latest (WiiU)
on: [push]

concurrency:
group: ${{ github.ref }}-wiiu
cancel-in-progress: true

jobs:
build:
if: github.ref_name == github.event.repository.default_branch
runs-on: ubuntu-latest
container:
image: devkitpro/devkitppc:latest
steps:
- uses: actions/checkout@v4
- name: Compile Wii U build
id: compile
run: |
make wiiu
- uses: ./.github/actions/notify_failure
if: ${{ always() && steps.compile.outcome == 'failure' }}
with:
NOTIFY_MESSAGE: 'Failed to compile WiiU build'
WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'


- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-wiiu.wuhb'
DEST_NAME: 'ClassiCube-wiiu.wuhb'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-wiiu.rpx'
DEST_NAME: 'ClassiCube-wiiu.rpx'

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
with:
SOURCE_FILE: 'ClassiCube-wiiu.elf'
DEST_NAME: 'ClassiCube-wiiu.elf'
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ android/local.properties
# Nintendo Console build results
build-3ds/
build-gc/
build-nds/
build-n64/
build-wii/
build-wiiu/
build-switch/
classicube.nds
# SEGA console build results
build-dc/
# Microsoft console build results
Expand All @@ -36,6 +38,9 @@ build-ps2/
build-ps3/
build-psp/
build-vita/
eboot.pbp
eboot.bin
param.sfo

# Build results
[Dd]ebug/
Expand Down
103 changes: 63 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ DEL = rm -f
CFLAGS = -g -pipe -fno-math-errno
LDFLAGS = -g -rdynamic

# Enables dependency tracking (https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/)
# This ensures that changing a .h file automatically results in the .c files using it being auto recompiled when next running make
# On older systems the required GCC options may not be supported - in which case just change TRACK_DEPENDENCIES to 0
TRACK_DEPENDENCIES=1

ifndef $(PLAT)
ifeq ($(OS),Windows_NT)
PLAT = mingw
Expand All @@ -18,85 +23,86 @@ ifndef $(PLAT)
endif

ifeq ($(PLAT),web)
CC = emcc
OEXT = .html
CFLAGS = -g
LDFLAGS = -s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library $(SOURCE_DIR)/interop_web.js
CC = emcc
OEXT = .html
CFLAGS = -g
LDFLAGS = -s WASM=1 -s NO_EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=1Mb --js-library $(SOURCE_DIR)/interop_web.js
endif

ifeq ($(PLAT),mingw)
CC = gcc
OEXT = .exe
CFLAGS = -g -pipe -DUNICODE -fno-math-errno
LDFLAGS = -g
LIBS = -mwindows -lwinmm -limagehlp
CC = gcc
OEXT = .exe
CFLAGS = -g -pipe -DUNICODE -fno-math-errno
LDFLAGS = -g
LIBS = -mwindows -lwinmm -limagehlp
endif

ifeq ($(PLAT),linux)
LIBS = -lX11 -lXi -lpthread -lGL -ldl
CFLAGS = -g -pipe -fno-math-errno -DCC_BUILD_ICON
LIBS = -lX11 -lXi -lpthread -lGL -ldl
endif

ifeq ($(PLAT),sunos)
CFLAGS = -g -pipe -fno-math-errno
LIBS = -lsocket -lX11 -lXi -lGL
CFLAGS = -g -pipe -fno-math-errno
LIBS = -lsocket -lX11 -lXi -lGL
endif

ifeq ($(PLAT),darwin)
OBJECTS += $(BUILD_DIR)/interop_cocoa.o
CFLAGS = -g -pipe -fno-math-errno
LIBS =
LDFLAGS = -rdynamic -framework Cocoa -framework OpenGL -framework IOKit -lobjc
OBJECTS += $(BUILD_DIR)/interop_cocoa.o
CFLAGS = -g -pipe -fno-math-errno -DCC_BUILD_ICON
LIBS =
LDFLAGS = -rdynamic -framework Cocoa -framework OpenGL -framework IOKit -lobjc
endif

ifeq ($(PLAT),freebsd)
CFLAGS = -g -pipe -I /usr/local/include -fno-math-errno
LDFLAGS = -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
CFLAGS = -g -pipe -I /usr/local/include -fno-math-errno -DCC_BUILD_ICON
LDFLAGS = -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
endif

ifeq ($(PLAT),openbsd)
CFLAGS = -g -pipe -I /usr/X11R6/include -I /usr/local/include -fno-math-errno
LDFLAGS = -L /usr/X11R6/lib -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
CFLAGS = -g -pipe -I /usr/X11R6/include -I /usr/local/include -fno-math-errno -DCC_BUILD_ICON
LDFLAGS = -L /usr/X11R6/lib -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
endif

ifeq ($(PLAT),netbsd)
CFLAGS = -g -pipe -I /usr/X11R7/include -I /usr/pkg/include -fno-math-errno
LDFLAGS = -L /usr/X11R7/lib -L /usr/pkg/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
CFLAGS = -g -pipe -I /usr/X11R7/include -I /usr/pkg/include -fno-math-errno -DCC_BUILD_ICON
LDFLAGS = -L /usr/X11R7/lib -L /usr/pkg/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
endif

ifeq ($(PLAT),dragonfly)
CFLAGS = -g -pipe -I /usr/local/include -fno-math-errno
LDFLAGS = -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
CFLAGS = -g -pipe -I /usr/local/include -fno-math-errno -DCC_BUILD_ICON
LDFLAGS = -L /usr/local/lib -rdynamic
LIBS = -lexecinfo -lGL -lX11 -lXi -lpthread
endif

ifeq ($(PLAT),haiku)
OBJECTS += $(BUILD_DIR)/interop_BeOS.o
CFLAGS = -g -pipe -fno-math-errno
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
OBJECTS += $(BUILD_DIR)/interop_BeOS.o
CFLAGS = -g -pipe -fno-math-errno
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
endif

ifeq ($(PLAT),beos)
OBJECTS += $(BUILD_DIR)/interop_BeOS.o
CFLAGS = -g -pipe
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
OBJECTS += $(BUILD_DIR)/interop_BeOS.o
CFLAGS = -g -pipe
LDFLAGS = -g
LIBS = -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker
endif

ifeq ($(PLAT),serenityos)
LIBS = -lgl -lSDL2
LIBS = -lgl -lSDL2
endif

ifeq ($(PLAT),irix)
CC = gcc
LIBS = -lGL -lX11 -lXi -lpthread -ldl
CC = gcc
LIBS = -lGL -lX11 -lXi -lpthread -ldl
endif

ifeq ($(OS),Windows_NT)
DEL = del
DEL = del
endif

default: $(PLAT)
Expand Down Expand Up @@ -167,14 +173,31 @@ os/2:
clean:
$(DEL) $(OBJECTS)


$(ENAME): $(BUILD_DIR) $(OBJECTS)
$(CC) $(LDFLAGS) -o $@$(OEXT) $(OBJECTS) $(LIBS)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)


# NOTE: Tracking dependencies might not work on older systems - disable if so
ifeq ($(TRACK_DEPENDENCIES), 1)
# Compiling with dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(patsubst $(SOURCE_DIR)/%.c, $(BUILD_DIR)/%.d, $(C_SOURCES))
$(DEPFILES):

$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c $(BUILD_DIR)/%.d
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@

include $(wildcard $(DEPFILES))
# Compiling WITHOUT dependency tracking
else
$(C_OBJECTS): $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
endif

# Platform specific file compiling
$(BUILD_DIR)/interop_cocoa.o: $(SOURCE_DIR)/interop_cocoa.m
$(CC) $(CFLAGS) -c $< -o $@

Expand Down
4 changes: 3 additions & 1 deletion doc/portability.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ Although most of the code is platform-independent, some per-platform functionali
By default I try to automatically define appropriate backends for your system in `Core.h`. Define ```CC_BUILD_MANUAL``` to disable this.

## Before you start
* IEEE floating support is required.
* IEEE floating support is required. (Can be emulated in software, but will affect performance)
* int must be 32-bits. 32-bit addressing (or more) is required.
* Support for 8/16/32/64 integer types is required. (your compiler must support 64-bit arithmetic)
* At least around 2 MB of RAM is required at a minimum
* At least 128 kb for main thread stack size

In other words, the codebase can theroetically be ported to any modern-ish hardware, but not stuff like a UNIVAC machine, the SuperFX chip on the SNES, or an 8-bit microcontroller.

Expand Down
18 changes: 15 additions & 3 deletions misc/3ds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ BUILD := build-3ds
SOURCES := src misc/3ds third_party/bearssl/src
INCLUDES := third_party/bearssl/inc

CIA_BANNER_BIN := $(TOPDIR)/misc/3ds/banner.bin
CIA_ICON_BIN := $(TOPDIR)/misc/3ds/icon.bin
CIA_SPEC_RSF := $(TOPDIR)/misc/3ds/spec.rsf

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
Expand All @@ -44,7 +48,7 @@ CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS := -lcitro3d -lctru -lm
LIBS := -lctru -lm


#---------------------------------------------------------------------------------
Expand Down Expand Up @@ -93,14 +97,22 @@ $(BUILD):
#---------------------------------------------------------------------------------
clean:
echo clean ...
rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
rm -fr $(BUILD) $(TARGET).cia $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf

#---------------------------------------------------------------------------------
else

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).cia : $(OUTPUT).3dsx makerom
./makerom -f cia -o "$(OUTPUT).cia" -elf "$(OUTPUT).elf" -rsf "$(CIA_SPEC_RSF)" -icon "$(CIA_ICON_BIN)" -banner "$(CIA_BANNER_BIN)" -exefslogo -target t

makerom:
wget https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v0.18.3/makerom-v0.18.3-ubuntu_x86_64.zip
unzip makerom-v0.18.3-ubuntu_x86_64.zip
chmod +x makerom

$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh

$(OUTPUT).elf : $(OFILES)
Expand All @@ -121,4 +133,4 @@ $(OUTPUT).elf : $(OFILES)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------
Binary file added misc/3ds/audio.wav
Binary file not shown.
Binary file added misc/3ds/banner.bin
Binary file not shown.
Binary file added misc/3ds/icon.bin
Binary file not shown.
5 changes: 5 additions & 0 deletions misc/3ds/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Commands used to generate the .bin files:

`bannertool makebanner -i banner.png -a audio.wav -o banner.bin`

`bannertool makesmdh -s ClassiCube -l ClassiCube -p UnknownShadow200 -i icon.png -o icon.bin`
Loading

0 comments on commit 56c88ca

Please sign in to comment.