Fix 32x/GBA builds not compiling

This commit is contained in:
UnknownShadow200 2025-06-28 22:36:57 +10:00
parent 155d7b2e07
commit ffb3964b10
15 changed files with 65 additions and 72 deletions

View File

@ -18,8 +18,6 @@ LIBTONC := $(DEVKITPRO)/libtonc
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary data
# GRAPHICS is a list of directories containing files to be processed by grit
# #
# All directories are specified relative to the project directory where # All directories are specified relative to the project directory where
# the makefile is found # the makefile is found
@ -29,9 +27,6 @@ TARGET := ClassiCube-gba
BUILD := build-gba BUILD := build-gba
SOURCES := src SOURCES := src
INCLUDES := include INCLUDES := include
DATA :=
MUSIC :=
GRAPHICS := graphics
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation
@ -73,8 +68,7 @@ ifneq ($(BUILD),$(notdir $(CURDIR)))
export OUTPUT := $(CURDIR)/$(TARGET) export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD) export DEPSDIR := $(CURDIR)/$(BUILD)
@ -88,9 +82,7 @@ export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES_GRAPHICS := $(PNGFILES:.png=.o) export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) $(OFILES_GRAPHICS)
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(PNGFILES:.png=.h) export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(PNGFILES:.png=.h)

View File

@ -9,7 +9,7 @@ endif
# Configurable options # Configurable options
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
BUILD_DIR := build/ps1 BUILD_DIR := build/ps1
SOURCE_DIRS := src SOURCE_DIRS := src src/ps1
TARGET := ClassiCube-ps1 TARGET := ClassiCube-ps1
@ -67,6 +67,9 @@ $(TARGET).bin: $(TARGET).exe
$(BUILD_DIR)/%.o: src/%.c $(BUILD_DIR)/%.o: src/%.c
$(PSN00BSDK_ROOT)/bin/mipsel-none-elf-gcc $(CFLAGS) $(CINCLUDES) $(DEPFLAGS) -c $< -o $@ $(PSN00BSDK_ROOT)/bin/mipsel-none-elf-gcc $(CFLAGS) $(CINCLUDES) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: src/ps1/%.c
$(PSN00BSDK_ROOT)/bin/mipsel-none-elf-gcc $(CFLAGS) $(CINCLUDES) $(DEPFLAGS) -c $< -o $@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Dependency tracking # Dependency tracking

View File

@ -7,7 +7,7 @@ endif
# Configurable options # Configurable options
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
SOURCE_DIRS := src src/ps2 third_party/bearssl/src SOURCE_DIRS := src src/ps2 third_party/bearssl/src
BUILD_DIR = build-ps2 BUILD_DIR = build/ps2
TARGET = ClassiCube-ps2 TARGET = ClassiCube-ps2

View File

@ -903,13 +903,25 @@ static void Game_RunLoop(void) {
} }
#endif #endif
void Game_Run(int width, int height, const cc_string* title) { static void Game_Setup(const cc_string* title) {
int width = Options_GetInt(OPT_WINDOW_WIDTH, 0, DisplayInfo.Width, 0);
int height = Options_GetInt(OPT_WINDOW_HEIGHT, 0, DisplayInfo.Height, 0);
/* No custom resolution has been set */
if (width == 0 || height == 0) {
width = 854; height = 480;
if (DisplayInfo.Width < 854) width = 640;
}
Window_Create3D(width, height); Window_Create3D(width, height);
Window_SetTitle(title); Window_SetTitle(title);
Window_Show(); Window_Show();
gameRunning = true; gameRunning = true;
Game.CurrentState = 0; Game.CurrentState = 0;
}
void Game_Run(const cc_string* title) {
Game_Setup(title);
Game_Load(); Game_Load();
Event_RaiseVoid(&WindowEvents.Resized); Event_RaiseVoid(&WindowEvents.Resized);
@ -917,3 +929,4 @@ void Game_Run(int width, int height, const cc_string* title) {
Game_RunLoop(); Game_RunLoop();
Window_Destroy(); Window_Destroy();
} }

View File

@ -125,7 +125,7 @@ cc_bool Game_ValidateBitmap(const cc_string* file, struct Bitmap* bmp);
cc_bool Game_ValidateBitmapPow2(const cc_string* file, struct Bitmap* bmp); cc_bool Game_ValidateBitmapPow2(const cc_string* file, struct Bitmap* bmp);
/* Runs the main game loop until the window is closed. */ /* Runs the main game loop until the window is closed. */
void Game_Run(int width, int height, const cc_string* title); void Game_Run(const cc_string* title);
/* Whether the game should be allowed to automatically close */ /* Whether the game should be allowed to automatically close */
cc_bool Game_ShouldClose(void); cc_bool Game_ShouldClose(void);

View File

@ -276,8 +276,5 @@ cc_result Platform_Encrypt(const void* data, int len, cc_string* dst) {
cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) { cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) {
return ERR_NOT_SUPPORTED; return ERR_NOT_SUPPORTED;
} }
cc_result Platform_GetEntropy(void* data, int len) {
return ERR_NOT_SUPPORTED;
}
#endif #endif

View File

@ -264,8 +264,5 @@ cc_result Platform_Encrypt(const void* data, int len, cc_string* dst) {
cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) { cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) {
return ERR_NOT_SUPPORTED; return ERR_NOT_SUPPORTED;
} }
cc_result Platform_GetEntropy(void* data, int len) {
return ERR_NOT_SUPPORTED;
}
#endif #endif

View File

@ -8,7 +8,6 @@
#include "../Utils.h" #include "../Utils.h"
#include "../Errors.h" #include "../Errors.h"
#include "../PackedCol.h" #include "../PackedCol.h"
#include "../_PlatfromConsole.h"
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
@ -27,6 +26,7 @@
#ifdef HW_RVL #ifdef HW_RVL
#include <ogc/wiilaunch.h> #include <ogc/wiilaunch.h>
#endif #endif
#include "../_PlatfromConsole.h"
const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */
const cc_result ReturnCode_FileNotFound = ENOENT; const cc_result ReturnCode_FileNotFound = ENOENT;

View File

@ -77,18 +77,10 @@ void DirectUrl_ExtractAddress(const cc_string* addr, cc_string* ip, cc_string* p
*#########################################################################################################################*/ *#########################################################################################################################*/
static void RunGame(void) { static void RunGame(void) {
cc_string title; char titleBuffer[STRING_SIZE]; cc_string title; char titleBuffer[STRING_SIZE];
int width = Options_GetInt(OPT_WINDOW_WIDTH, 0, DisplayInfo.Width, 0);
int height = Options_GetInt(OPT_WINDOW_HEIGHT, 0, DisplayInfo.Height, 0);
/* No custom resolution has been set */
if (width == 0 || height == 0) {
width = 854; height = 480;
if (DisplayInfo.Width < 854) width = 640;
}
String_InitArray(title, titleBuffer); String_InitArray(title, titleBuffer);
String_Format2(&title, "%c (%s)", GAME_APP_TITLE, &Game_Username); String_Format2(&title, "%c (%s)", GAME_APP_TITLE, &Game_Username);
Game_Run(width, height, &title); Game_Run(&title);
} }
/* Shows a warning dialog due to an invalid command line argument */ /* Shows a warning dialog due to an invalid command line argument */

View File

@ -1,8 +1,8 @@
#include "Core.h" #include "../Core.h"
#if defined CC_BUILD_PS1 #include "../_GraphicsBase.h"
#include "_GraphicsBase.h" #include "../Errors.h"
#include "Errors.h" #include "../Window.h"
#include "Window.h"
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
@ -11,7 +11,7 @@
#include <psxapi.h> #include <psxapi.h>
#include <psxetc.h> #include <psxetc.h>
#include <inline_c.h> #include <inline_c.h>
#include "../misc/ps1/ps1defs.h" #include "ps1defs.h"
// Based off https://github.com/Lameguy64/PSn00bSDK/blob/master/examples/beginner/hello/main.c // Based off https://github.com/Lameguy64/PSn00bSDK/blob/master/examples/beginner/hello/main.c
#define wait_while(cond) while (cond) { __asm__ volatile(""); } #define wait_while(cond) while (cond) { __asm__ volatile(""); }
@ -1127,4 +1127,4 @@ void Gfx_End2D(void) {
gfx_rendering2D = false; gfx_rendering2D = false;
Gfx_SetAlphaBlending(false); Gfx_SetAlphaBlending(false);
} }
#endif

View File

@ -1,16 +1,15 @@
#include "Core.h" #include "../Core.h"
#if defined PLAT_PS1
#define CC_XTEA_ENCRYPTION #define CC_XTEA_ENCRYPTION
#include "_PlatformBase.h" #include "../_PlatformBase.h"
#include "Stream.h" #include "../Stream.h"
#include "ExtMath.h" #include "../ExtMath.h"
#include "Funcs.h" #include "../Funcs.h"
#include "Window.h" #include "../Window.h"
#include "Utils.h" #include "../Utils.h"
#include "Errors.h" #include "../Errors.h"
#include "Options.h" #include "../Options.h"
#include "PackedCol.h" #include "../PackedCol.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -26,7 +25,7 @@ void* calloc(size_t num, size_t size) {
if (ptr) memset(ptr, 0, num * size); if (ptr) memset(ptr, 0, num * size);
return ptr; return ptr;
} }
#include "_PlatformConsole.h" #include "../_PlatformConsole.h"
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
const cc_result ReturnCode_FileNotFound = 99999; const cc_result ReturnCode_FileNotFound = 99999;
@ -276,4 +275,4 @@ static cc_result GetMachineID(cc_uint32* key) {
Mem_Copy(key, MACHINE_KEY, sizeof(MACHINE_KEY) - 1); Mem_Copy(key, MACHINE_KEY, sizeof(MACHINE_KEY) - 1);
return 0; return 0;
} }
#endif

View File

@ -1,22 +1,22 @@
#include "Core.h" #include "../Core.h"
#if defined CC_BUILD_PS1 #include "../Window.h"
#include "Window.h" #include "../Platform.h"
#include "Platform.h" #include "../Input.h"
#include "Input.h" #include "../Event.h"
#include "Event.h" #include "../Graphics.h"
#include "Graphics.h" #include "../String.h"
#include "String.h" #include "../Funcs.h"
#include "Funcs.h" #include "../Bitmap.h"
#include "Bitmap.h" #include "../Errors.h"
#include "Errors.h" #include "../ExtMath.h"
#include "ExtMath.h" #include "../Logger.h"
#include "Logger.h" #include "../VirtualKeyboard.h"
#include "VirtualKeyboard.h"
#include <psxapi.h> #include <psxapi.h>
#include <psxetc.h> #include <psxetc.h>
#include <psxgpu.h> #include <psxgpu.h>
#include <psxpad.h> #include <psxpad.h>
#include "../misc/ps1/ps1defs.h" #include "ps1defs.h"
#define SCREEN_XRES 320 #define SCREEN_XRES 320
#define SCREEN_YRES 240 #define SCREEN_YRES 240
@ -287,4 +287,4 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) { cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
return ERR_NOT_SUPPORTED; return ERR_NOT_SUPPORTED;
} }
#endif

View File

@ -8,7 +8,6 @@
#include "../Utils.h" #include "../Utils.h"
#include "../Errors.h" #include "../Errors.h"
#include "../PackedCol.h" #include "../PackedCol.h"
#include "../_PlatformConsole.h"
#define LIBCGLUE_SYS_SOCKET_ALIASES 0 #define LIBCGLUE_SYS_SOCKET_ALIASES 0
#define LIBCGLUE_SYS_SOCKET_NO_ALIASES #define LIBCGLUE_SYS_SOCKET_NO_ALIASES
@ -39,6 +38,7 @@
#include <io_common.h> #include <io_common.h>
#include <iox_stat.h> #include <iox_stat.h>
#include <libcdvd.h> #include <libcdvd.h>
#include "../_PlatformConsole.h"
const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileShareViolation = 1000000000; // not used
const cc_result ReturnCode_FileNotFound = -4; const cc_result ReturnCode_FileNotFound = -4;

View File

@ -15,7 +15,7 @@
#include <lwip/sockets.h> #include <lwip/sockets.h>
#include <nxdk/net.h> #include <nxdk/net.h>
#include <nxdk/mount.h> #include <nxdk/mount.h>
#include "_PlatformConsole.h" #include "../_PlatformConsole.h"
const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION;
const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND; const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND;