Latest compatible version of Classicube from the original GitHub repository (https://github.com/ClassiCube/ClassiCube) that can be compiled on Classicube for PowerMac PPC running Mac OS X 10.4.

This commit is contained in:
Andrei Alexandru
2025-12-17 13:17:57 +02:00
commit c71492f846
1248 changed files with 422858 additions and 0 deletions

60
misc/ds/Makefile Normal file
View File

@@ -0,0 +1,60 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external
GAME_TITLE := ClassiCube
GAME_SUBTITLE := Built with BlocksDS
GAME_AUTHOR := ClassiCube team
GAME_ICON := misc/ds/icon.bmp
GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR)
# DLDI and internal SD slot of DSi
# --------------------------------
# Root folder of the SD image
SDROOT := sdroot
# Name of the generated image it "DSi-1.sd" for no$gba in DSi mode
SDIMAGE := image.bin
# Build artfacts
# --------------
ifdef BUILD_DSI
BUILDDIR := build/dsi
ROM := ClassiCube-dsi.nds
else
BUILDDIR := build/nds
ROM := ClassiCube-nds.nds
endif
# Targets
# -------
.PHONY: all clean arm9 arm7 dldipatch sdimage
all: $(ROM)
clean:
$(MAKE) -f Makefile.arm9 clean --no-print-directory
$(MAKE) -f Makefile.arm7 clean --no-print-directory
$(RM) $(ROM) $(BUILDDIR) $(SDIMAGE)
arm9:
$(MAKE) -f misc/ds/Makefile.arm9 --no-print-directory
arm7:
$(MAKE) -f misc/ds/Makefile.arm7 --no-print-directory
$(ROM): arm9 arm7
$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \
-7 $(BUILDDIR)/cc-arm7.elf -9 $(BUILDDIR)/cc-arm9.elf \
-b $(GAME_ICON) "$(GAME_FULL_TITLE)"
sdimage:
$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE)
dldipatch: $(ROM)
$(BLOCKSDS)/tools/dlditool/dlditool $(BLOCKSDS)/tools/dldi/r4tfv2.dldi $(ROM)

96
misc/ds/Makefile.arm7 Normal file
View File

@@ -0,0 +1,96 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external
export WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
SOURCEDIRS := misc/ds
INCLUDEDIRS :=
DSIWIFI := third_party/dsiwifi
ifdef BUILD_DSI
SOURCEDIRS += $(DSIWIFI)/arm_iop/source $(DSIWIFI)/common/source $(DSIWIFI)/arm_iop/source/ath $(DSIWIFI)/arm_iop/source/crypto $(DSIWIFI)/arm_iop/source/ieee
INCLUDEDIRS += $(DSIWIFI)/arm_iop/source $(DSIWIFI)/arm_iop/include $(DSIWIFI)/common/source $(DSIWIFI)/include $(DSIWIFI)/include/lwip
BUILDDIR := build/dsi
LIBS := -lc -lnds7
LIBDIRS := $(BLOCKSDS)/libs/libnds
else
BUILDDIR := build/nds
LIBS := -lc -lnds7 -ldswifi7
LIBDIRS := $(BLOCKSDS)/libs/libnds $(BLOCKSDS)/libs/dswifi
endif
NAME := cc-arm7
ELF := $(BUILDDIR)/$(NAME).elf
MAP := $(BUILDDIR)/$(NAME).map
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
LD := $(CC)
DEFINES := -D__NDS__ -DARM7
ARCH := -mcpu=arm7tdmi -mtune=arm7tdmi
WARNFLAGS := -Wall
# Source files
# ------------
S_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.s))
C_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.c))
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
$(foreach path,$(LIBDIRS),-I$(path)/include)
LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib)
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
-ffunction-sections -fdata-sections
CFLAGS += -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
-fomit-frame-pointer
LDFLAGS := -mthumb -mthumb-interwork $(LIBDIRSFLAGS) \
-Wl,-Map,$(MAP) -Wl,--gc-sections -nostdlib \
-T$(BLOCKSDS)/sys/crts/ds_arm7.ld \
-Wl,--no-warn-rwx-segments \
-Wl,--start-group $(LIBS) -lgcc -Wl,--end-group
# Intermediate build files
# ------------------------
OBJS := $(addprefix $(BUILDDIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.s=%.o)))
DEPS := $(OBJS:.o=.d)
export VPATH := $(SOURCEDIRS)
# Targets
# -------
.PHONY: all clean
all: $(BUILDDIR) $(ELF)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(ELF): $(OBJS)
$(LD) -o $@ $(OBJS) $(BLOCKSDS)/sys/crts/ds_arm7_crt0.o $(LDFLAGS)
clean:
rm $(ELF) $(MAP) $(OBJS)
# Rules
# -----
$(BUILDDIR)/%.o : %.s
$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.o : %.c
$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
# Include dependency files if they exist
# --------------------------------------
-include $(DEPS)

106
misc/ds/Makefile.arm9 Normal file
View File

@@ -0,0 +1,106 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
export BLOCKSDS ?= /opt/wonderful/thirdparty/blocksds/core
export BLOCKSDSEXT ?= /opt/wonderful/thirdparty/blocksds/external
export WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
SOURCEDIRS := src
INCLUDEDIRS :=
DSIWIFI := third_party/dsiwifi
ifdef BUILD_DSI
SOURCEDIRS += $(DSIWIFI)/arm_host/source $(DSIWIFI)/common/source $(DSIWIFI)/arm_host/source/nds $(DSIWIFI)/arm_host/source/lwip $(DSIWIFI)/arm_host/source/lwip/ipv4 $(DSIWIFI)/arm_host/source/lwip/ipv6 $(DSIWIFI)/arm_host/source/lwip/netif $(DSIWIFI)/arm_host/source/lwip/netif/ppp $(DSIWIFI)/arm_host/source/lwip/api
INCLUDEDIRS += $(DSIWIFI)/arm_host/include $(DSIWIFI)/common/source $(DSIWIFI)/include $(DSIWIFI)/include/lwip
BUILDDIR := build/dsi
DEFINES := -DPLAT_NDS -DBUILD_DSI
LIBS := -lnds9 -lc
LIBDIRS := $(BLOCKSDS)/libs/libnds
else
BUILDDIR := build/nds
DEFINES := -DPLAT_NDS
LIBS := -ldswifi9 -lnds9 -lc
LIBDIRS := $(BLOCKSDS)/libs/dswifi $(BLOCKSDS)/libs/libnds
endif
NAME := cc-arm9
ELF := $(BUILDDIR)/$(NAME).elf
MAP := $(BUILDDIR)/$(NAME).map
# Tools
# -----
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
LD := $(PREFIX)gcc
# Source files
# ------------
S_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.s))
C_FILES := $(foreach dir,$(SOURCEDIRS),$(wildcard $(dir)/*.c))
# Compiler and linker flags
# -------------------------
ARCH := -mthumb -mcpu=arm946e-s+nofp
SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs
WARNFLAGS := -Wall
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
$(foreach path,$(LIBDIRS),-I$(path)/include)
LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib)
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(INCLUDEFLAGS) \
$(ARCH) -ffunction-sections -fdata-sections \
-specs=$(SPECS)
CFLAGS += -std=gnu17 $(WARNFLAGS) $(DEFINES) $(INCLUDEFLAGS) \
$(ARCH) -O2 -ffunction-sections -fdata-sections \
-specs=$(SPECS) -Wstack-usage=10000
LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \
-Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS)
# Intermediate build files
# ------------------------
OBJS := $(addprefix $(BUILDDIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.s=%.o)))
DEPS := $(OBJS:.o=.d)
export VPATH := $(SOURCEDIRS)
# Targets
# -------
.PHONY: all
all: $(BUILDDIR) $(ELF)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(ELF): $(OBJS)
$(LD) -o $@ $(OBJS) $(LDFLAGS)
clean:
rm $(ELF) $(MAP) $(OBJS)
rm -rf $(BUILDDIR)
# Rules
# -----
$(BUILDDIR)/%.o : %.s
$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.o : %.c
$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.arm.o : %.arm.c
$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<
# Include dependency files if they exist
# --------------------------------------
-include $(DEPS)

BIN
misc/ds/icon.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

54
misc/ds/main_arm7.c Normal file
View File

@@ -0,0 +1,54 @@
// SPDX-License-Identifier: Zlib
//
// Copyright (C) 2005 Michael Noland (joat)
// Copyright (C) 2005 Jason Rogers (Dovoto)
// Copyright (C) 2005-2015 Dave Murphy (WinterMute)
// Copyright (C) 2023 Antonio Niño Díaz
// Default ARM7 core
#include <dswifi7.h>
#include <nds.h>
volatile bool exit_loop = false;
static void power_button_callback(void) {
exit_loop = true;
}
static void vblank_handler(void) {
inputGetAndSend();
Wifi_Update();
}
int main(int argc, char *argv[]) {
enableSound();
readUserSettings();
ledBlink(0);
touchInit();
irqInit();
irqSet(IRQ_VBLANK, vblank_handler);
fifoInit();
installWifiFIFO();
installSoundFIFO();
installSystemFIFO();
setPowerButtonCB(power_button_callback);
initClockIRQTimer(3);
irqEnable(IRQ_VBLANK | IRQ_RTC);
while (!exit_loop)
{
const uint16_t key_mask = KEY_SELECT | KEY_START | KEY_L | KEY_R;
uint16_t keys_pressed = ~REG_KEYINPUT;
if ((keys_pressed & key_mask) == key_mask)
exit_loop = true;
swiWaitForVBlank();
}
return 0;
}