From f216649ed382a55c83e03569686a1261ac384ebd Mon Sep 17 00:00:00 2001 From: EPICGameGuy Date: Sat, 30 Dec 2023 00:35:41 -0500 Subject: [PATCH] Refactored makefile --- src/Makefile | 25 ----------------- src/Makefile.iso | 39 +++++++++++---------------- src/engine.cc | 4 +-- src/input/keyboard.cpp | 4 +-- src/net/net.cc | 6 ++--- src/sound/sound.cc | 4 +-- tools/ps2-mesh-converter/src/main.cpp | 13 ++++----- 7 files changed, 32 insertions(+), 63 deletions(-) diff --git a/src/Makefile b/src/Makefile index 1d056d0..103319d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -17,38 +17,13 @@ LINKFLAGS = -O3 -g -Wl,-zmax-page-size=128 OUTPUT_DIR = build ISO_FOLDER_DIR = build/iso -VU_OUTPUT_DIR = vu -VU_PROGS = $(addprefix $(OUTPUT_DIR)/$(VU_OUTPUT_DIR)/, $(patsubst %.vcl, %.o, $(VCL_FILES))) PS2GL_DIR = dependencies/ps2gl EE_INCS += -I$(PS2GL_DIR)/vu1 -# -# Vector Unit assembler: -# -PS2_VU_DVP = dvp-as - -# -# openvcl = Vector Command Line preprocessor. -# (get it at: https://github.com/jsvennevid/openvcl) -# -# vclpp = Vector assembly preprocessor -# (get it at: https://github.com/glampert/vclpp) -PS2_VCL = vcl -PS2_VCLPP = vclpp - -# -# VCL/VU microprograms: -# -VCL_PATH = $(PREFIX) -VCL_FILES = renderer/ps2gl_renderers/vuprogs/general_pv_diff.vcl - include src/Makefile.iso include src/Makefile.vuprogs -VUPROGS: $(addsuffix .vo, $(addprefix vu1/, $(RENDERERS))) -EE_OBJS := $(VUPROGS) $(EE_OBJS) - .PHONY: compile cleancompile compile: $(EE_BIN) diff --git a/src/Makefile.iso b/src/Makefile.iso index 919afcb..d849c51 100644 --- a/src/Makefile.iso +++ b/src/Makefile.iso @@ -4,32 +4,27 @@ $(ISO_FOLDER_DIR): $(ISO_FOLDER_DIR)/SYSTEM.CNF: $(ISO_FOLDER_DIR) cp SYSTEM.CNF $@ -$(ISO_FOLDER_DIR)/AUDSRV.IRX: $(ISO_FOLDER_DIR) - cp $(PS2SDK)/iop/irx/audsrv.irx $@ - -$(ISO_FOLDER_DIR)/PS2SND.IRX: $(ISO_FOLDER_DIR) - cp $(PS2SDK)/iop/irx/ps2snd.irx $@ - -$(ISO_FOLDER_DIR)/DEV9.IRX: $(ISO_FOLDER_DIR) - cp $(PS2SDK)/iop/irx/ps2dev9.irx $@ - -$(ISO_FOLDER_DIR)/NETMAN.IRX: $(ISO_FOLDER_DIR) - cp $(PS2SDK)/iop/irx/netman.irx $@ - -$(ISO_FOLDER_DIR)/USBD.IRX: $(ISO_FOLDER_DIR) - cp $(PS2SDK)/iop/irx/usbd.irx $@ - -$(ISO_FOLDER_DIR)/PS2KBD.IRX: $(ISO_FOLDER_DIR) - cp $(PS2SDK)/iop/irx/ps2kbd.irx $@ +IRX_FILES = \ + audsrv.irx \ + ps2snd.irx \ + ps2dev9.irx \ + netman.irx \ + usbd.irx \ + ps2kbd.irx \ + smap.irx + +IRX_SRC_FILES := $(addprefix $(PS2SDK)/iop/irx/, $(IRX_FILES)) +IRX_TARGET_FILES := $(addprefix $(ISO_FOLDER_DIR)/, $(IRX_FILES)) + +$(IRX_TARGET_FILES): $(ISO_FOLDER_DIR)/%.irx: $(PS2SDK)/iop/irx/%.irx + cp $< $@ -$(ISO_FOLDER_DIR)/SMAP.IRX: $(ISO_FOLDER_DIR) - cp $(PS2SDK)/iop/irx/smap.irx $@ +copy_irx: $(IRX_TARGET_FILES) $(ISO_FOLDER_DIR)/ps2client.exe: $(ISO_FOLDER_DIR) cp assets/ps2client.exe $@ -.PHONY: copy_libs -copy_libs: $(ISO_FOLDER_DIR)/AUDSRV.IRX $(ISO_FOLDER_DIR)/DEV9.IRX $(ISO_FOLDER_DIR)/NETMAN.IRX $(ISO_FOLDER_DIR)/SMAP.IRX $(ISO_FOLDER_DIR)/PS2SND.IRX $(ISO_FOLDER_DIR)/USBD.IRX $(ISO_FOLDER_DIR)/PS2KBD.IRX $(ISO_FOLDER_DIR)/ps2client.exe +copy_libs: copy_irx $(ISO_FOLDER_DIR)/ps2client.exe # Sound files AUDIO_FILE_TYPE = wav @@ -66,13 +61,11 @@ $(LVL_DEST_FILES): $(ISO_FOLDER_DIR)/assets/%.lvl: assets/%.lvl .PHONY: levels levels: $(LVL_DEST_FILES) - # Asset Manifest compilation .PHONY: manifestassets manifestassets: sounds models levels MANIFEST_CC = egg-ps2-manifest-generator -FORCE: ; $(ISO_FOLDER_DIR)/MANIFEST.ISO: manifestassets $(MANIFEST_CC) -i$(ISO_FOLDER_DIR)/assets -p assets/ -o$@ diff --git a/src/engine.cc b/src/engine.cc index 7803cfe..aecb9c7 100644 --- a/src/engine.cc +++ b/src/engine.cc @@ -141,9 +141,9 @@ void init(int argc, char* argv[]) load_asset_manifest(); { - int ret = SifLoadModule("USBD.IRX"_p.to_full_filepath(), 0, nullptr); + int ret = SifLoadModule("usbd.irx"_p.to_full_filepath(), 0, nullptr); printf("ret: %d\n", ret); - checkf(ret >= 0, "USBD.IRX"_p.to_full_filepath()); + checkf(ret >= 0, "usbd.irx"_p.to_full_filepath()); } Stats::init(); diff --git a/src/input/keyboard.cpp b/src/input/keyboard.cpp index bf0e6db..5942a62 100644 --- a/src/input/keyboard.cpp +++ b/src/input/keyboard.cpp @@ -17,9 +17,9 @@ void Keyboard::init() memset(keyboard_status, sizeof(keyboard_status), 0); { - int ret = SifLoadModule("PS2KBD.IRX"_p.to_full_filepath(), 0, nullptr); + int ret = SifLoadModule("ps2kbd.irx"_p.to_full_filepath(), 0, nullptr); printf("ret: %d\n", ret); - checkf(ret >= 0, "PS2KBD.IRX"_p.to_full_filepath()); + checkf(ret >= 0, "ps2kbd.irx"_p.to_full_filepath()); } // Note: this depends on the USB modules being load (BSD.IRX) diff --git a/src/net/net.cc b/src/net/net.cc index 3f7de29..1f5431e 100644 --- a/src/net/net.cc +++ b/src/net/net.cc @@ -279,19 +279,19 @@ void Net::init() // //sbv_patch_enable_lmb(); { - int ret = SifLoadModule("DEV9.IRX"_p.to_full_filepath(), 0, nullptr); + int ret = SifLoadModule("dev9.irx"_p.to_full_filepath(), 0, nullptr); printf("ret: %d\n", ret); check(ret >= 0); } { - int ret = SifLoadModule("NETMAN.IRX"_p.to_full_filepath(), 0, nullptr); + int ret = SifLoadModule("netman.irx"_p.to_full_filepath(), 0, nullptr); printf("ret: %d\n", ret); check(ret >= 0); } { - int ret = SifLoadModule("SMAP.IRX"_p.to_full_filepath(), 0, nullptr); + int ret = SifLoadModule("smap.irx"_p.to_full_filepath(), 0, nullptr); printf("ret: %d\n", ret); check(ret >= 0); } diff --git a/src/sound/sound.cc b/src/sound/sound.cc index 0949769..71e25c8 100644 --- a/src/sound/sound.cc +++ b/src/sound/sound.cc @@ -58,9 +58,9 @@ static void create_audio_thread() void init() { { - int ret = SifLoadModule("AUDSRV.IRX"_p.to_full_filepath(), 0, nullptr); + int ret = SifLoadModule("audsrv.irx"_p.to_full_filepath(), 0, nullptr); printf("ret: %d\n", ret); - checkf(ret >= 0, "AUDSRV.IRX"_p.to_full_filepath()); + checkf(ret >= 0, "audsrv.irx"_p.to_full_filepath()); } printf("initializing audiosrv...\n"); diff --git a/tools/ps2-mesh-converter/src/main.cpp b/tools/ps2-mesh-converter/src/main.cpp index 2b58730..c0a441d 100644 --- a/tools/ps2-mesh-converter/src/main.cpp +++ b/tools/ps2-mesh-converter/src/main.cpp @@ -200,11 +200,11 @@ static void process() static void parse_args(int argc, char** argv) { - cxxopts::options options("egg-ps2-mesh-converter", "Converts .obj meshes into a mesh format that the ps2 can " - "understand by turning the mesh into strips."); + cxxopts::options options("egg-ps2-mesh-converter", "Converts json assets into a cooked asset format that the ps2 can " + "understand."); - options.add_options()("i,input", "path to the input obj mesh", cxxopts::value()); - options.add_options()("o,output", "output path for the mesh", cxxopts::value()); + options.add_options()("i,input", "path to the input file", cxxopts::value()); + options.add_options()("o,output", "output path for the file", cxxopts::value()); options.add_options()("null", "null output, don't write file", cxxopts::value()->default_value("false")); options.add_options()("h,help", "print usage", cxxopts::value()); @@ -212,7 +212,7 @@ static void parse_args(int argc, char** argv) options.positional_help("[input file] [output file]"); - options.footer("If no output file is specified then the program will output the file to \"input path\" + .ps2_mesh"); + options.footer("If no output file is specified then the program will output the file to \"input path\" + .type"); auto result = options.parse(argc, argv); @@ -242,7 +242,8 @@ static void parse_args(int argc, char** argv) } else { - output_path = input_path + ".ps2_mesh"; + printf("Output path not specified\n"); + exit(-1); } }