diff --git a/Makefile_PS2 b/Makefile_PS2 new file mode 100644 index 0000000..e85ff3b --- /dev/null +++ b/Makefile_PS2 @@ -0,0 +1,44 @@ +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright 2001-2022, ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. + +EE_BIN = $(PROGRAM).elf + +# KERNEL_NOPATCH = 1 +# NEWLIB_NANO = 1 + +EE_OBJS = $(PROGRAM).o +EE_CFLAGS += -fdata-sections -DPS2 -ffunction-sections -I$(PS2SDK)/ports/include -Wformat=0 +EE_LDFLAGS += -L$(PS2SDK)/ports/lib -L$(GSKIT)/lib -lSDL2 -lgskit -ldmakit -lps2_drivers -lm -Wl,--gc-sections + +ifeq ($(DUMMY_TIMEZONE), 1) + EE_CFLAGS += -DDUMMY_TIMEZONE +endif + +ifeq ($(DUMMY_LIBC_INIT), 1) + EE_CFLAGS += -DDUMMY_LIBC_INIT +endif + +ifeq ($(KERNEL_NOPATCH), 1) + EE_CFLAGS += -DKERNEL_NOPATCH +endif + +ifeq ($(DEBUG), 1) + EE_CFLAGS += -DDEBUG -O0 -g +else + EE_CFLAGS += -Os + EE_LDFLAGS += -s +endif + +all: $(EE_BIN) + +clean: + rm -rf $(EE_OBJS) $(EE_BIN) + +# Include makefiles +include $(PS2SDK)/samples/Makefile.pref +include $(PS2SDK)/samples/Makefile.eeglobal diff --git a/make_ps2.sh b/make_ps2.sh new file mode 100755 index 0000000..2f5e524 --- /dev/null +++ b/make_ps2.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ "$#" -ne "1" ]; then + echo "ERROR: You must pass the program name! For instance, to build maze.elf," + echo "pass in just 'maze'" + exit 1 +fi + +make -f Makefile_PS2 PROGRAM="$1" diff --git a/maze.c b/maze.c index 9fb3102..457c718 100644 --- a/maze.c +++ b/maze.c @@ -1,12 +1,24 @@ +#ifdef PS2 +#define DIRECTBUILD +#endif + +#ifdef DIRECTBUILD +#include "haloo3d/haloo3d.c" +#include "haloo3d/haloo3dex_console.c" +#include "haloo3d/haloo3dex_easy.c" +#include "haloo3d/haloo3dex_gen.c" +#include "haloo3d/haloo3dex_obj.c" +#include "haloo3d/haloo3dex_print.c" +#include "unigi.platform.sdl2/main.c" +#else #include "haloo3d/haloo3d.h" #include "haloo3d/haloo3dex_console.h" #include "haloo3d/haloo3dex_easy.h" #include "haloo3d/haloo3dex_gen.h" -// #include "haloo3d/haloo3dex_img.h" #include "haloo3d/haloo3dex_obj.h" #include "haloo3d/haloo3dex_print.h" - #include "unigi/main.h" +#endif #include "ecs2.h" #include "keys.h" @@ -22,25 +34,36 @@ #include -// INteresting flags for debugging #define FASTFILL #define NUMMICE 1 -#define MOUSELOGGING // #define NOWALLS +#ifdef PS2 +#define WIDTH 160 +#define HEIGHT 120 +#define SCREENSCALE 4 +#define DITHERSTART 2.5 +#define DITHEREND 3.5 +int fps = 24; +uint16_t sky = 0xF644; +#else #define WIDTH 480 #define HEIGHT 300 -#define ASPECT ((float)WIDTH / HEIGHT) #define SCREENSCALE 2 +#define MOUSELOGGING +#define DITHERSTART 10000 +#define DITHEREND 10000 +int fps = 30; +uint16_t sky = 0xF000; +#endif + +#define ASPECT ((float)WIDTH / HEIGHT) #define SWIDTH (WIDTH * SCREENSCALE) #define SHEIGHT (HEIGHT * SCREENSCALE) #define NEARCLIP 0.01 #define FARCLIP 100.0 #define LIGHTANG -MPI / 4.0 #define AVGWEIGHT 0.85 -// Try 0.5 and 3.5 or something -#define DITHERSTART 10000 -#define DITHEREND 10000 // Game options #define MAZESIZE 15 @@ -96,8 +119,6 @@ const char POLYNAMES[NUMPOLYS][20] = {"tetrahedron"}; float fov = 90.0; float minlight = 0.15; float speed = 1.0; -int fps = 30; -uint16_t sky = 0xF000; struct vec2i dirtovec(uint8_t dir) { struct vec2i result; diff --git a/ps2/Makefile b/ps2_old/Makefile similarity index 100% rename from ps2/Makefile rename to ps2_old/Makefile diff --git a/ps2/maze.c b/ps2_old/maze.c similarity index 100% rename from ps2/maze.c rename to ps2_old/maze.c