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,59 +7,107 @@ $(warning export PSPSDK=$$(shell psp-config --pspsdk-path))
$(error Failed to find PSPSDK installation)
endif
#---------------------------------------------------------------------------------
# Configurable options
#---------------------------------------------------------------------------------
# Name of the final output
TARGET = ClassiCube-psp
# 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
BUILD_DIR = build/psp
PSP_EBOOT_TITLE = ClassiCube
PSP_EBOOT_ICON = misc/psp/ICON0.png
PSP_EBOOT_TITLE = ClassiCube
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
#---------------------------------------------------------------------------------
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
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
CFLAGS = -g -O1 -fno-math-errno
ASFLAGS = $(CFLAGS)
INCDIR := $(PSPDEV)/psp/include $(PSPSDK)/include
LIBDIR := $(PSPDEV)/psp/lib $(PSPSDK)/lib
LIBDIR =
LDFLAGS =
LIBS = -lm -lpspgum -lpspgu -lpspge -lpspdisplay -lpspctrl
CFLAGS := $(addprefix -I,$(INCDIR)) -g -O1 -fno-math-errno -D_PSP_FW_VERSION=600
ASFLAGS := $(addprefix -I,$(INCDIR)) -g
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
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.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
#---------------------------------------------------------------------------------
all: $(BUILD_DIR) $(PSP_EBOOT)
$(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
#---------------------------------------------------------------------------------
$(BUILD_DIR)/%.o : src/%.c
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o : src/psp/%.c
$(VITA_CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o : third_party/bearssl/%.c
$(CC) $(CFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
# Dependency tracking
#---------------------------------------------------------------------------------
$(DEPFILES):
include $(wildcard $(DEPFILES))

View File

@ -9,14 +9,14 @@ endif
# Configurable options
#---------------------------------------------------------------------------------
# Name of the final output
TARGET := ClassiCube-vita
TARGET = ClassiCube-vita
# 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
BUILD_DIR := build/vita
BUILD_DIR = build/vita
PROJECT_TITLE := ClassiCube
PROJECT_TITLEID := CUBE00200
PROJECT_TITLE = ClassiCube
PROJECT_TITLEID = CUBE00200
#---------------------------------------------------------------------------------

View File

@ -274,16 +274,15 @@ void Launcher_Setup(void) {
#endif
}
void Launcher_Run(void) {
for (;;) {
Window_ProcessEvents(10 / 1000.0f);
Gamepad_Tick(10 / 1000.0f);
if (!Window_Main.Exists || Launcher_ShouldStop) break;
cc_bool Launcher_Tick(void) {
/* NOTE: Make sure to keep delay same as hardcoded delay in RunLauncher in main_impl.h */
Window_ProcessEvents(10 / 1000.0f);
Gamepad_Tick(10 / 1000.0f);
if (!Window_Main.Exists || Launcher_ShouldStop) return false;
Launcher_Active->Tick(Launcher_Active);
LBackend_Tick();
Thread_Sleep(10);
}
Launcher_Active->Tick(Launcher_Active);
LBackend_Tick();
return true;
}
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 */
void Launcher_Setup(void);
/* Ticks the launcher main loop */
void Launcher_Run(void);
cc_bool Launcher_Tick(void);
/* Cleans up state and then destroys the launcher window */
void Launcher_Finish(void);

View File

@ -86,7 +86,9 @@ static void RunGame(void) {
static void RunLauncher(void) {
#ifndef CC_BUILD_WEB
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();
Window_Destroy();
#endif