It runs on the ps2, barely (broken)

This commit is contained in:
Carlos Sanchez 2024-09-12 04:46:47 -04:00
parent 93d9113451
commit 1de3a60aef
3 changed files with 23 additions and 12 deletions

View File

@ -6,14 +6,14 @@
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
EE_BIN = $(PROGRAM).elf
EE_BIN = $(PROGRAM_PS2).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
EE_OBJS = $(PROGRAM_PS2).o
EE_CFLAGS += -DPS2 -fdata-sections -ffunction-sections -I$(PS2SDK)/ports/include -Wformat=0
EE_LDFLAGS += -L$(PS2SDK)/ports/lib -L$(GSKIT)/lib -lSDL2 -lSDL2main -lkernel -lpatches -lgskit -ldmakit -lps2_drivers -lm -Wl,--gc-sections
ifeq ($(DUMMY_TIMEZONE), 1)
EE_CFLAGS += -DDUMMY_TIMEZONE

View File

@ -1,9 +1,15 @@
#!/bin/bash
if [ "$#" -ne "1" ]; then
if [ "$#" -lt "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"
make -f Makefile_PS2 PROGRAM_PS2="$1"
if [ "$#" -gt "1" ]; then
echo "Running on $2"
ps2client -h "$2" reset
ps2client -h "$2" execee host:$1.elf
fi

17
maze.c
View File

@ -4,18 +4,20 @@
#endif
#ifdef DIRECTBUILD
// clang-format off
#define MATHC_USE_UNIONS
#define MATHC_NO_STRUCT_FUNCTIONS
#include "haloo3d/lib/mathc.c"
#define FNL_IMPL
#include "haloo3d/lib/FastNoiseLite.h"
#include "haloo3d/haloo3d.c"
#include "haloo3d/haloo3dex_console.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 "haloo3d/lib/FastNoiseLite.h"
#include "unigi.platform.sdl2/main.c"
// clang-format on
#else
#include "haloo3d/haloo3d.h"
#include "haloo3d/haloo3dex_console.h"
@ -995,11 +997,10 @@ void create_paintingobj(haloo3d_obj *obj) {
}
}
#ifdef PS2
int main(int argc, char *argv[]) {
#else
int main() { // int argc, char **argv) {
#endif
// We HAVE to use argc and argv
eprintf("Argc: %d, prog: %s\n", argc, argv[0]);
srand(clock());
@ -1120,6 +1121,7 @@ int main() { // int argc, char **argv) {
// render.camera.pitch = MPI - 0.1; // 2.2;
// ceili->pos.y = -10;
#ifndef PS2
haloo3d_debugconsole dc;
haloo3d_debugconsole_init(&dc);
@ -1134,6 +1136,7 @@ int main() { // int argc, char **argv) {
haloo3d_debugconsole_set(&dc, "camera/pos_y.f", &render.camera.pos.y);
haloo3d_debugconsole_set(&dc, "camera/pitch.f", &render.camera.pitch);
haloo3d_debugconsole_set(&dc, "obj/ceil/pos_y.f", &ceili->pos.y);
#endif
// Set up ECS entities. For this game, we mostly have global entities.
mecs ecs;
@ -1238,9 +1241,11 @@ int main() { // int argc, char **argv) {
case unigi_enum_event_input_keyboard:
if (event.data.input_keyboard.down) {
switch (event.data.input_keyboard.button) {
#ifndef PS2
case KEY_SPACE:
haloo3d_debugconsole_beginprompt(&dc);
break;
#endif
default:
exit(0);
}