diff --git a/misc/psp/Makefile b/misc/psp/Makefile index 2e839be96..47aa03925 100644 --- a/misc/psp/Makefile +++ b/misc/psp/Makefile @@ -1,6 +1,12 @@ -TARGET = ClassiCube-psp -SOURCES = $(wildcard src/*.c) $(wildcard third_party/bearssl/src/*.c) -OBJS = $(patsubst %.c, %.o, $(SOURCES)) +TARGET = ClassiCube-psp +PSP_EBOOT_TITLE = ClassiCube +PSP_EBOOT_ICON = misc/psp/ICON0.png + +BUILD_DIR := build-psp +SOURCE_DIRS := src third_party/bearssl/src + +C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) +OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o))) INCDIR = third_party/bearssl/inc CFLAGS = -g -O1 -fno-math-errno @@ -10,11 +16,12 @@ LIBDIR = LDFLAGS = LIBS = -lm -lpspgum -lpspgu -lpspge -lpspdisplay -lpspctrl -BUILD_PRX = 1 +# Dependency tracking +DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d +DEPFILES := $(OBJS:%.o=%.d) -EXTRA_TARGETS = EBOOT.PBP -PSP_EBOOT_TITLE = ClassiCube -PSP_EBOOT_ICON = misc/psp/ICON0.png +BUILD_PRX = 1 +EXTRA_TARGETS = $(BUILD_DIR) EBOOT.PBP ifeq ($(strip $(PSPSDK)),) $(warning "Please set PSPSDK variables in your environment. For example:") @@ -26,3 +33,21 @@ $(error Failed to find PSPSDK installation) endif include $(PSPSDK)/lib/build.mak + + +#--------------------------------------------------------------------------------- +# object generation +#--------------------------------------------------------------------------------- +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + +$(BUILD_DIR)/%.o : src/%.c + $(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@ + +$(BUILD_DIR)/%.o : third_party/bearssl/src/%.c + $(CC) $(CFLAGS) -c $< -o $@ + +# Dependency tracking +$(DEPFILES): + +include $(wildcard $(DEPFILES)) diff --git a/src/Graphics_PSP.c b/src/Graphics_PSP.c index e667575fa..67b2c6dc2 100644 --- a/src/Graphics_PSP.c +++ b/src/Graphics_PSP.c @@ -19,6 +19,7 @@ #define FB_SIZE (BUFFER_WIDTH * SCREEN_HEIGHT * 4) static unsigned int __attribute__((aligned(16))) list[262144]; +#define GE_CMD_TEXTUREMAPENABLE 0x1E /*########################################################################################################################* *---------------------------------------------------------General---------------------------------------------------------* @@ -264,7 +265,7 @@ void Gfx_BeginFrame(void) { } void Gfx_ClearBuffers(GfxBuffers buffers) { - int targets = 0; + int targets = GU_FAST_CLEAR_BIT; if (buffers & GFX_BUFFER_COLOR) targets |= GU_COLOR_BUFFER_BIT; if (buffers & GFX_BUFFER_DEPTH) targets |= GU_DEPTH_BUFFER_BIT; @@ -297,6 +298,7 @@ static int vb_size; GfxResourceID Gfx_CreateIb2(int count, Gfx_FillIBFunc fillFunc, void* obj) { fillFunc(gfx_indices, count, obj); + return gfx_indices; } void Gfx_BindIb(GfxResourceID ib) { } diff --git a/src/Launcher.c b/src/Launcher.c index d15dda6a1..8a82ad9bf 100644 --- a/src/Launcher.c +++ b/src/Launcher.c @@ -196,6 +196,10 @@ static void OnMouseWheel(void* obj, float delta) { Launcher_Active->MouseWheel(Launcher_Active, delta); } +static void OnClosing(void* obj) { + Launcher_ShouldExit = true; +} + /*########################################################################################################################* *-----------------------------------------------------------Main body-----------------------------------------------------* @@ -203,6 +207,7 @@ static void OnMouseWheel(void* obj, float delta) { static void Launcher_Init(void) { Event_Register_(&WindowEvents.Resized, NULL, OnResize); Event_Register_(&WindowEvents.StateChanged, NULL, OnResize); + Event_Register_(&WindowEvents.Closing, NULL, OnClosing); Event_Register_(&InputEvents.Down, NULL, OnInputDown); Event_Register_(&InputEvents.Wheel, NULL, OnMouseWheel); diff --git a/src/Window_SDL.c b/src/Window_SDL.c index f9e033059..c600d99b3 100644 --- a/src/Window_SDL.c +++ b/src/Window_SDL.c @@ -106,7 +106,9 @@ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); } #endif -void Window_Destroy(void) { } +void Window_Destroy(void) { + SDL_DestroyWindow(win_handle); +} void Window_SetTitle(const cc_string* title) { char str[NATIVE_STR_LEN]; @@ -318,7 +320,6 @@ void Window_ProcessEvents(float delta) { case SDL_QUIT: Window_Main.Exists = false; Event_RaiseVoid(&WindowEvents.Closing); - SDL_DestroyWindow(win_handle); break; case SDL_RENDER_DEVICE_RESET: diff --git a/src/Window_SDL3.c b/src/Window_SDL3.c index 2404d304d..51fc2d617 100644 --- a/src/Window_SDL3.c +++ b/src/Window_SDL3.c @@ -90,7 +90,9 @@ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); } #endif -void Window_Destroy(void) { } +void Window_Destroy(void) { + SDL_DestroyWindow(win_handle); +} void Window_SetTitle(const cc_string* title) { char str[NATIVE_STR_LEN]; @@ -280,7 +282,6 @@ void Window_ProcessEvents(float delta) { case SDL_EVENT_QUIT: Window_Main.Exists = false; Event_RaiseVoid(&WindowEvents.Closing); - SDL_DestroyWindow(win_handle); break; case SDL_EVENT_RENDER_DEVICE_RESET: