diff --git a/misc/gba/Makefile b/misc/gba/Makefile index a6ee653f8..bf7a6ddba 100644 --- a/misc/gba/Makefile +++ b/misc/gba/Makefile @@ -18,8 +18,6 @@ LIBTONC := $(DEVKITPRO)/libtonc # BUILD is the directory where object files & intermediate files will be placed # SOURCES is a list of directories containing source code # 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 # the makefile is found @@ -29,9 +27,6 @@ TARGET := ClassiCube-gba BUILD := build-gba SOURCES := src INCLUDES := include -DATA := -MUSIC := -GRAPHICS := graphics #--------------------------------------------------------------------------------- # options for code generation @@ -73,8 +68,7 @@ ifneq ($(BUILD),$(notdir $(CURDIR))) export OUTPUT := $(CURDIR)/$(TARGET) -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) 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_GRAPHICS := $(PNGFILES:.png=.o) - -export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) $(OFILES_GRAPHICS) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(PNGFILES:.png=.h) diff --git a/misc/ps1/Makefile b/misc/ps1/Makefile index f909f527a..173a1079a 100644 --- a/misc/ps1/Makefile +++ b/misc/ps1/Makefile @@ -9,7 +9,7 @@ endif # Configurable options #--------------------------------------------------------------------------------- BUILD_DIR := build/ps1 -SOURCE_DIRS := src +SOURCE_DIRS := src src/ps1 TARGET := ClassiCube-ps1 @@ -67,6 +67,9 @@ $(TARGET).bin: $(TARGET).exe $(BUILD_DIR)/%.o: src/%.c $(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 diff --git a/misc/ps2/Makefile b/misc/ps2/Makefile index 4fb8800d1..b68e36dfa 100644 --- a/misc/ps2/Makefile +++ b/misc/ps2/Makefile @@ -7,7 +7,7 @@ endif # Configurable options #--------------------------------------------------------------------------------- SOURCE_DIRS := src src/ps2 third_party/bearssl/src -BUILD_DIR = build-ps2 +BUILD_DIR = build/ps2 TARGET = ClassiCube-ps2 diff --git a/src/Game.c b/src/Game.c index f51dad37c..9d0119c7c 100644 --- a/src/Game.c +++ b/src/Game.c @@ -903,13 +903,25 @@ static void Game_RunLoop(void) { } #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_SetTitle(title); Window_Show(); gameRunning = true; Game.CurrentState = 0; +} +void Game_Run(const cc_string* title) { + Game_Setup(title); Game_Load(); Event_RaiseVoid(&WindowEvents.Resized); @@ -917,3 +929,4 @@ void Game_Run(int width, int height, const cc_string* title) { Game_RunLoop(); Window_Destroy(); } + diff --git a/src/Game.h b/src/Game.h index 32bd6fb73..9e3ccf6f2 100644 --- a/src/Game.h +++ b/src/Game.h @@ -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); /* 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 */ cc_bool Game_ShouldClose(void); diff --git a/src/Platform_32x.c b/src/Platform_32x.c index d48d7d397..f7037d7db 100644 --- a/src/Platform_32x.c +++ b/src/Platform_32x.c @@ -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) { return ERR_NOT_SUPPORTED; } - -cc_result Platform_GetEntropy(void* data, int len) { - return ERR_NOT_SUPPORTED; -} #endif + diff --git a/src/Platform_GBA.c b/src/Platform_GBA.c index b8cc64749..4a01452c4 100644 --- a/src/Platform_GBA.c +++ b/src/Platform_GBA.c @@ -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) { return ERR_NOT_SUPPORTED; } - -cc_result Platform_GetEntropy(void* data, int len) { - return ERR_NOT_SUPPORTED; -} #endif + diff --git a/src/gcwii/Platform_GCWii.c b/src/gcwii/Platform_GCWii.c index 64edd06aa..9437e3767 100644 --- a/src/gcwii/Platform_GCWii.c +++ b/src/gcwii/Platform_GCWii.c @@ -8,7 +8,6 @@ #include "../Utils.h" #include "../Errors.h" #include "../PackedCol.h" -#include "../_PlatfromConsole.h" #include #include @@ -27,6 +26,7 @@ #ifdef HW_RVL #include #endif +#include "../_PlatfromConsole.h" const cc_result ReturnCode_FileShareViolation = 1000000000; /* TODO: not used apparently */ const cc_result ReturnCode_FileNotFound = ENOENT; diff --git a/src/main_impl.h b/src/main_impl.h index 82ead7211..0ecb64423 100644 --- a/src/main_impl.h +++ b/src/main_impl.h @@ -77,18 +77,10 @@ void DirectUrl_ExtractAddress(const cc_string* addr, cc_string* ip, cc_string* p *#########################################################################################################################*/ static void RunGame(void) { 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_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 */ diff --git a/src/Graphics_PS1.c b/src/ps1/Graphics_PS1.c similarity index 96% rename from src/Graphics_PS1.c rename to src/ps1/Graphics_PS1.c index 29f7c6c7c..65d52c786 100644 --- a/src/Graphics_PS1.c +++ b/src/ps1/Graphics_PS1.c @@ -1,8 +1,8 @@ -#include "Core.h" -#if defined CC_BUILD_PS1 -#include "_GraphicsBase.h" -#include "Errors.h" -#include "Window.h" +#include "../Core.h" +#include "../_GraphicsBase.h" +#include "../Errors.h" +#include "../Window.h" + #include #include #include @@ -11,7 +11,7 @@ #include #include #include -#include "../misc/ps1/ps1defs.h" +#include "ps1defs.h" // Based off https://github.com/Lameguy64/PSn00bSDK/blob/master/examples/beginner/hello/main.c #define wait_while(cond) while (cond) { __asm__ volatile(""); } @@ -1127,4 +1127,4 @@ void Gfx_End2D(void) { gfx_rendering2D = false; Gfx_SetAlphaBlending(false); } -#endif + diff --git a/src/Platform_PS1.c b/src/ps1/Platform_PS1.c similarity index 93% rename from src/Platform_PS1.c rename to src/ps1/Platform_PS1.c index 546e543bc..1a9124a29 100644 --- a/src/Platform_PS1.c +++ b/src/ps1/Platform_PS1.c @@ -1,16 +1,15 @@ -#include "Core.h" -#if defined PLAT_PS1 - +#include "../Core.h" #define CC_XTEA_ENCRYPTION -#include "_PlatformBase.h" -#include "Stream.h" -#include "ExtMath.h" -#include "Funcs.h" -#include "Window.h" -#include "Utils.h" -#include "Errors.h" -#include "Options.h" -#include "PackedCol.h" +#include "../_PlatformBase.h" +#include "../Stream.h" +#include "../ExtMath.h" +#include "../Funcs.h" +#include "../Window.h" +#include "../Utils.h" +#include "../Errors.h" +#include "../Options.h" +#include "../PackedCol.h" + #include #include #include @@ -26,7 +25,7 @@ void* calloc(size_t num, size_t size) { if (ptr) memset(ptr, 0, num * size); return ptr; } -#include "_PlatformConsole.h" +#include "../_PlatformConsole.h" const cc_result ReturnCode_FileShareViolation = 1000000000; // not used 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); return 0; } -#endif + diff --git a/src/Window_PS1.c b/src/ps1/Window_PS1.c similarity index 93% rename from src/Window_PS1.c rename to src/ps1/Window_PS1.c index f2360ac32..6d82d8171 100644 --- a/src/Window_PS1.c +++ b/src/ps1/Window_PS1.c @@ -1,22 +1,22 @@ -#include "Core.h" -#if defined CC_BUILD_PS1 -#include "Window.h" -#include "Platform.h" -#include "Input.h" -#include "Event.h" -#include "Graphics.h" -#include "String.h" -#include "Funcs.h" -#include "Bitmap.h" -#include "Errors.h" -#include "ExtMath.h" -#include "Logger.h" -#include "VirtualKeyboard.h" +#include "../Core.h" +#include "../Window.h" +#include "../Platform.h" +#include "../Input.h" +#include "../Event.h" +#include "../Graphics.h" +#include "../String.h" +#include "../Funcs.h" +#include "../Bitmap.h" +#include "../Errors.h" +#include "../ExtMath.h" +#include "../Logger.h" +#include "../VirtualKeyboard.h" + #include #include #include #include -#include "../misc/ps1/ps1defs.h" +#include "ps1defs.h" #define SCREEN_XRES 320 #define SCREEN_YRES 240 @@ -287,4 +287,4 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) { cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) { return ERR_NOT_SUPPORTED; } -#endif + diff --git a/misc/ps1/ps1defs.h b/src/ps1/ps1defs.h similarity index 100% rename from misc/ps1/ps1defs.h rename to src/ps1/ps1defs.h diff --git a/src/ps2/Platform_PS2.c b/src/ps2/Platform_PS2.c index b7c1d81e6..54395961b 100644 --- a/src/ps2/Platform_PS2.c +++ b/src/ps2/Platform_PS2.c @@ -8,7 +8,6 @@ #include "../Utils.h" #include "../Errors.h" #include "../PackedCol.h" -#include "../_PlatformConsole.h" #define LIBCGLUE_SYS_SOCKET_ALIASES 0 #define LIBCGLUE_SYS_SOCKET_NO_ALIASES @@ -39,6 +38,7 @@ #include #include #include +#include "../_PlatformConsole.h" const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = -4; diff --git a/src/xbox/Platform_Xbox.c b/src/xbox/Platform_Xbox.c index 5522c769f..c5aab40b8 100644 --- a/src/xbox/Platform_Xbox.c +++ b/src/xbox/Platform_Xbox.c @@ -15,7 +15,7 @@ #include #include #include -#include "_PlatformConsole.h" +#include "../_PlatformConsole.h" const cc_result ReturnCode_FileShareViolation = ERROR_SHARING_VIOLATION; const cc_result ReturnCode_FileNotFound = ERROR_FILE_NOT_FOUND;