PSP: Fixup makefile

This commit is contained in:
UnknownShadow200 2025-07-10 07:20:21 +10:00
parent cedd6ffae6
commit 221ee0303c
8 changed files with 78 additions and 29 deletions

View File

@ -7,47 +7,90 @@ $(warning export PSPSDK=$$(shell psp-config --pspsdk-path))
$(error Failed to find PSPSDK installation) $(error Failed to find PSPSDK installation)
endif endif
#---------------------------------------------------------------------------------
# Configurable options
#---------------------------------------------------------------------------------
# Name of the final output # Name of the final output
TARGET = ClassiCube-psp TARGET = ClassiCube-psp
# List of directories containing source code # List of directories containing source code
SOURCE_DIRS = src third_party/bearssl SOURCE_DIRS = src src/psp third_party/bearssl
# Directory where object files are placed # Directory where object files are placed
BUILD_DIR = build/psp BUILD_DIR = build/psp
PSP_EBOOT_TITLE = ClassiCube PSP_EBOOT_TITLE = ClassiCube
PSP_EBOOT_ICON = misc/psp/ICON0.png PSP_EBOOT_ICON = misc/psp/ICON0.png
PSP_EBOOT_SFO = PARAM.SFO
PSP_EBOOT_ICON1 = NULL
PSP_EBOOT_UNKPNG = NULL
PSP_EBOOT_PIC1 = NULL
PSP_EBOOT_SND0 = NULL
PSP_EBOOT_PSAR = NULL
PSP_EBOOT = EBOOT.PBP
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Code generation # Code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o))) OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
INCDIR = third_party/bearssl INCDIR := $(PSPDEV)/psp/include $(PSPSDK)/include
CFLAGS = -g -O1 -fno-math-errno LIBDIR := $(PSPDEV)/psp/lib $(PSPSDK)/lib
ASFLAGS = $(CFLAGS)
LIBDIR = CFLAGS := $(addprefix -I,$(INCDIR)) -g -O1 -fno-math-errno -D_PSP_FW_VERSION=600
LDFLAGS = ASFLAGS := $(addprefix -I,$(INCDIR)) -g
LIBS = -lm -lpspgum -lpspgu -lpspge -lpspdisplay -lpspctrl
LDFLAGS := $(addprefix -L,$(LIBDIR)) -specs=$(PSPSDK)/lib/prxspecs -Wl,-q,-T$(PSPSDK)/lib/linkfile.prx -Wl,-zmax-page-size=128
LIBS := -lm -lpspgum -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspdebug -lpspnet -lpspnet_apctl
# Dependency tracking # Dependency tracking
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
DEPFILES := $(OBJS:%.o=%.d) DEPFILES := $(OBJS:%.o=%.d)
BUILD_PRX = 1
EXTRA_TARGETS = $(BUILD_DIR) EBOOT.PBP
include $(PSPSDK)/lib/build.mak #---------------------------------------------------------------------------------
# Compiler tools
#---------------------------------------------------------------------------------
CC = psp-gcc
AS = psp-gcc
LD = psp-gcc
MKSFO = mksfoex
PACK_PBP = pack-pbp
FIXUP = psp-fixup-imports
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# main targets # main targets
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
all: $(BUILD_DIR) $(PSP_EBOOT)
$(BUILD_DIR): $(BUILD_DIR):
mkdir -p $(BUILD_DIR) mkdir -p $(BUILD_DIR)
clean:
-rm -f $(TARGET).prx $(TARGET).elf $(OBJS) $(PSP_EBOOT_SFO) $(PSP_EBOOT)
#---------------------------------------------------------------------------------
# executable generation
#---------------------------------------------------------------------------------
$(TARGET).elf: $(OBJS)
$(LD) $^ $(LDFLAGS) $(LIBS) -o $@
$(FIXUP) $@
$(TARGET).prx: $(TARGET).elf
psp-prxgen $< $@
$(PSP_EBOOT_SFO):
$(MKSFO) -d MEMSIZE=1 '$(PSP_EBOOT_TITLE)' $@
$(PSP_EBOOT): $(TARGET).prx $(PSP_EBOOT_SFO)
$(PACK_PBP) $(PSP_EBOOT) $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) \
$(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1) \
$(PSP_EBOOT_SND0) $(TARGET).prx $(PSP_EBOOT_PSAR)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# object generation # object generation
@ -55,11 +98,16 @@ $(BUILD_DIR):
$(BUILD_DIR)/%.o : src/%.c $(BUILD_DIR)/%.o : src/%.c
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@ $(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o : src/psp/%.c
$(VITA_CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o : third_party/bearssl/%.c $(BUILD_DIR)/%.o : third_party/bearssl/%.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
# Dependency tracking # Dependency tracking
#---------------------------------------------------------------------------------
$(DEPFILES): $(DEPFILES):
include $(wildcard $(DEPFILES)) include $(wildcard $(DEPFILES))

View File

@ -9,14 +9,14 @@ endif
# Configurable options # Configurable options
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Name of the final output # Name of the final output
TARGET := ClassiCube-vita TARGET = ClassiCube-vita
# List of directories containing source code # List of directories containing source code
SOURCE_DIRS := src src/psvita third_party/bearssl SOURCE_DIRS = src src/psvita third_party/bearssl
# Directory where object files are placed # Directory where object files are placed
BUILD_DIR := build/vita BUILD_DIR = build/vita
PROJECT_TITLE := ClassiCube PROJECT_TITLE = ClassiCube
PROJECT_TITLEID := CUBE00200 PROJECT_TITLEID = CUBE00200
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

View File

@ -274,16 +274,15 @@ void Launcher_Setup(void) {
#endif #endif
} }
void Launcher_Run(void) { cc_bool Launcher_Tick(void) {
for (;;) { /* NOTE: Make sure to keep delay same as hardcoded delay in RunLauncher in main_impl.h */
Window_ProcessEvents(10 / 1000.0f); Window_ProcessEvents(10 / 1000.0f);
Gamepad_Tick(10 / 1000.0f); Gamepad_Tick(10 / 1000.0f);
if (!Window_Main.Exists || Launcher_ShouldStop) break; if (!Window_Main.Exists || Launcher_ShouldStop) return false;
Launcher_Active->Tick(Launcher_Active); Launcher_Active->Tick(Launcher_Active);
LBackend_Tick(); LBackend_Tick();
Thread_Sleep(10); return true;
}
} }
void Launcher_Finish(void) { void Launcher_Finish(void) {

View File

@ -82,7 +82,7 @@ void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_s
/* Sets up state and then creates the launcher window */ /* Sets up state and then creates the launcher window */
void Launcher_Setup(void); void Launcher_Setup(void);
/* Ticks the launcher main loop */ /* Ticks the launcher main loop */
void Launcher_Run(void); cc_bool Launcher_Tick(void);
/* Cleans up state and then destroys the launcher window */ /* Cleans up state and then destroys the launcher window */
void Launcher_Finish(void); void Launcher_Finish(void);

View File

@ -86,7 +86,9 @@ static void RunGame(void) {
static void RunLauncher(void) { static void RunLauncher(void) {
#ifndef CC_BUILD_WEB #ifndef CC_BUILD_WEB
Launcher_Setup(); Launcher_Setup();
Launcher_Run(); /* NOTE: Make sure to keep delay same as hardcoded delay in Launcher_Tick */
while (Launcher_Tick()) { Thread_Sleep(10); }
Launcher_Finish(); Launcher_Finish();
Window_Destroy(); Window_Destroy();
#endif #endif