diff --git a/examples/PoolBox/Makefile b/examples/PoolBox/Makefile
index 95a833c7..f379550a 100644
--- a/examples/PoolBox/Makefile
+++ b/examples/PoolBox/Makefile
@@ -1,5 +1,23 @@
+ARTIFACT = PoolBox
+make_assets = $(MAKE) $(1) ARTIFACT=$(ARTIFACT) -C assets
+make_application = $(MAKE) $(1) ARTIFACT=$(ARTIFACT) -C application
+make_cd = $(MAKE) $(1) ARTIFACT=$(ARTIFACT) -f $(JABY_ENGINE_DIR)/lib/ISOTarget.mk -C iso
+
all clean rebuild: always
- $(MAKE) $(MAKECMDGOALS) -C assets
- $(MAKE) $(MAKECMDGOALS) -C application
+ $(call make_assets,$(MAKECMDGOALS))
+ $(call make_application,$(MAKECMDGOALS))
+ $(call make_cd,$(MAKECMDGOALS))
+
+all_%: always
+ $(call make_assets,$*)
+ $(call make_application,$*)
+ $(call make_cd,$*)
+
+assets_%: always
+ $(call make_assets,$*)
+application_%: always
+ $(call make_application,$*)
+cd_%: always
+ $(call make_cd,$*)
always: ;
\ No newline at end of file
diff --git a/examples/PoolBox/PoolBox.code-workspace b/examples/PoolBox/PoolBox.code-workspace
index b6a16f43..17e82659 100644
--- a/examples/PoolBox/PoolBox.code-workspace
+++ b/examples/PoolBox/PoolBox.code-workspace
@@ -11,7 +11,7 @@
{
"label": "build",
"type": "shell",
- "command": "wsl make ${input:target} BUILD_PROFILE=${input:build profile} JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})",
+ "command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})",
"group": {
"kind": "build",
"isDefault": true
@@ -22,25 +22,6 @@
}
}
},
- {
- "label": "cdgen",
- "type": "shell",
- "command": "${env:JABY_ENGINE_PATH}/bin/psxcdgen_ex.exe --list iso/PoolBox.lba -o iso/PoolBox psx bin-cue iso/Config.xml",
- "group": {
- "kind": "build",
- "isDefault": true
- }
- },
- {
- "label": "build & generate cd",
- "type": "shell",
- "dependsOn": ["build", "cdgen"],
- "dependsOrder": "sequence",
- "group": {
- "kind": "build",
- "isDefault": true
- }
- }
],
"inputs": [
{
@@ -50,6 +31,13 @@
"default": "release",
"description": "The build profile for PoolBox"
},
+ {
+ "id": "project",
+ "type": "pickString",
+ "options": ["all", "assets", "application", "cd"],
+ "default": "all",
+ "description": "Project to build"
+ },
{
"id": "target",
"type": "pickString",
diff --git a/examples/PoolBox/application/Makefile b/examples/PoolBox/application/Makefile
index 71f4711e..5b712e86 100644
--- a/examples/PoolBox/application/Makefile
+++ b/examples/PoolBox/application/Makefile
@@ -1,4 +1,3 @@
-ARTIFACT = PoolBox
BUILD_DIR = bin
OVERLAY_CONFIG = Overlays.json
@@ -10,9 +9,4 @@ INCLUDES += -I$(JABY_ENGINE_DIR)/include
CCFLAGS += -save-temps=obj
include $(JABY_ENGINE_DIR)/lib/Makefile
-include $(JABY_ENGINE_DIR)/lib/PSEXETarget.mk
-
-clean:
- rm -fr $(OUTPUT_DIR)
- rm -fr ../iso/*.bin
- rm -fr ../iso/*.cue
\ No newline at end of file
+include $(JABY_ENGINE_DIR)/lib/PSEXETarget.mk
\ No newline at end of file
diff --git a/examples/PoolBox/iso/Config.xml b/examples/PoolBox/iso/Config.xml
index a12f195b..0211a1f3 100644
--- a/examples/PoolBox/iso/Config.xml
+++ b/examples/PoolBox/iso/Config.xml
@@ -4,14 +4,14 @@
%PSX_LICENSE_PATH%/LICENSEE.DAT
\ No newline at end of file
diff --git a/lib/ISOTarget.mk b/lib/ISOTarget.mk
new file mode 100644
index 00000000..f37fe9f0
--- /dev/null
+++ b/lib/ISOTarget.mk
@@ -0,0 +1,14 @@
+include $(JABY_ENGINE_DIR)/lib/RebuildTarget.mk
+CD_OUTPUT ?= $(ARTIFACT).bin
+
+$(CD_OUTPUT): always
+ psxcdgen_ex --list $(ARTIFACT).lba -o $(ARTIFACT) psx bin-cue Config.xml
+
+all: $(CD_OUTPUT)
+
+clean:
+ rm -fr *.bin
+ rm -fr *.cue
+ rm -fr *.lba
+
+always: ;
\ No newline at end of file
diff --git a/lib/PSEXETarget.mk b/lib/PSEXETarget.mk
index 7445dd7d..6776709d 100644
--- a/lib/PSEXETarget.mk
+++ b/lib/PSEXETarget.mk
@@ -7,6 +7,8 @@ include $(AUTO_OVERLAY_DIR)/Overlays.mk
JABY_ENGINE_LIB_DIR = $(JABY_ENGINE_DIR)/lib/PSX-$(BUILD_PROFILE)
JABY_ENGINE_LIB_NAME = JabyEngine_$(TV_FORMAT)
+OVERLAY_TARGET = $(foreach ovl, $(OVERLAYSECTION), $(OUTPUT_DIR)/Overlay$(ovl))
+
#Linking rule
$(TARGET).elf: $(OBJS) $(JABY_ENGINE_LIB_DIR)/lib$(JABY_ENGINE_LIB_NAME).a $(AUTO_OVERLAY_DIR)/Overlays.ld
$(LD) -o $(TARGET).elf $(LDFLAGS_all) $(LDFLAGS) $(OBJS) -L$(JABY_ENGINE_LIB_DIR) -l$(JABY_ENGINE_LIB_NAME) $(LIBS)
@@ -16,7 +18,7 @@ $(TARGET).psexe: $(TARGET).elf
$(PREFIX)-objcopy $(addprefix -R , $(OVERLAYSECTION)) -O binary $< $@
#Create overlays
-$(foreach ovl, $(OVERLAYSECTION), $(OUTPUT_DIR)/Overlay$(ovl)): $(TARGET).elf
+$(OVERLAY_TARGET): $(TARGET).elf
$(PREFIX)-objcopy -j $(suffix $@) -O binary $< $@
#Create overlay makefile
@@ -25,4 +27,7 @@ $(AUTO_OVERLAY_DIR)/Overlays.mk: $(OVERLAY_CONFIG)
mkoverlay --mk-file $(AUTO_OVERLAY_DIR)/Overlays.mk --ld-script $(AUTO_OVERLAY_DIR)/Overlays.ld $<
#Rules section for default compilation and linking
-all: $(TARGET).psexe $(foreach ovl, $(OVERLAYSECTION), $(OUTPUT_DIR)/Overlay$(ovl))
\ No newline at end of file
+all: $(TARGET).psexe $(OVERLAY_TARGET)
+
+clean:
+ rm -fr $(OUTPUT_DIR)
\ No newline at end of file
diff --git a/src/Tools/.config_build_all/recommended.bat b/src/Tools/.config_build_all/recommended.bat
index 34ed0956..8d991c09 100644
--- a/src/Tools/.config_build_all/recommended.bat
+++ b/src/Tools/.config_build_all/recommended.bat
@@ -1,4 +1,4 @@
set bin_projects=psxcdgen psxcdgen_ex psxcdread psxreadmap wslpath
-set bin_linux_projects=cpp_out jaby_engine_fconv mkoverlay
+set bin_linux_projects=cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay wslpath
set clean_projects=cdtypes
set clean_projects_linux=tool_helper
\ No newline at end of file
diff --git a/src/Tools/psxcdgen_ex/src/main.rs b/src/Tools/psxcdgen_ex/src/main.rs
index 186e7790..2ac38219 100644
--- a/src/Tools/psxcdgen_ex/src/main.rs
+++ b/src/Tools/psxcdgen_ex/src/main.rs
@@ -1,7 +1,7 @@
use clap::{Parser, ValueEnum};
use psxcdgen_ex::{encoder::{EncodingFunctions, psx::{calculate_psx_lbas, calculate_psx_length_for, encode_psx_image}}, file_writer::{ImageType, write_image}, config_reader};
-use std::{path::PathBuf};
-use tool_helper::{Error, exit_with_error};
+use std::path::PathBuf;
+use tool_helper::{Error, exit_with_error, read_file_to_string};
#[derive(Parser)]
#[clap(about = "Creates an ISO image from a description file", long_about = None)]
@@ -37,7 +37,7 @@ impl SystemType {
fn run_main(cmd_line: CommandLine) -> Result<(), Error> {
let encoding_functions = cmd_line.system_type.get_encoding_functions();
- let (desc, lba_embedded_files) = psxcdgen_ex::process(config_reader::parse_xml(std::fs::read_to_string(cmd_line.input_file)?)?, encoding_functions.lba_calculator)?;
+ let (desc, lba_embedded_files) = psxcdgen_ex::process(config_reader::parse_xml(read_file_to_string(&cmd_line.input_file)?)?, encoding_functions.lba_calculator)?;
let file_map = desc.create_file_map();
psxcdgen_ex::process_files(file_map, lba_embedded_files, encoding_functions.length_calculator)?;
diff --git a/src/Tools/wslpath/src/lib.rs b/src/Tools/wslpath/src/lib.rs
index 28b2a23e..66402776 100644
--- a/src/Tools/wslpath/src/lib.rs
+++ b/src/Tools/wslpath/src/lib.rs
@@ -6,6 +6,7 @@ fn convert_slashes(path: String) -> String {
path.replace('\\', "/")
}
+#[cfg(target_os = "windows")]
fn replace_drive_letter(mut path: String) -> String {
let has_drive_letter = {
let drive_letter = path.get(0..2);
@@ -35,5 +36,10 @@ fn replace_drive_letter(mut path: String) -> String {
path.insert_str(0, "/mnt/");
}
+ path
+}
+
+#[cfg(not(target_os = "windows"))]
+fn replace_drive_letter(path: String) -> String {
path
}
\ No newline at end of file
diff --git a/template/JabyEngine-PSX_Game/#{ProjectName}.code-workspace b/template/JabyEngine-PSX_Game/#{ProjectName}.code-workspace
index 1e6f6d38..843a8d0a 100644
--- a/template/JabyEngine-PSX_Game/#{ProjectName}.code-workspace
+++ b/template/JabyEngine-PSX_Game/#{ProjectName}.code-workspace
@@ -11,37 +11,17 @@
{
"label": "build",
"type": "shell",
- "command": "wsl make ${input:target} BUILD_PROFILE=${input:build profile} JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})",
+ "command": "wsl make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} PSX_LICENSE_PATH=$(wslpath ${env:PSX_LICENSE_PATH}) JABY_ENGINE_DIR=$(wslpath ${env:JABY_ENGINE_PATH})",
"group": {
"kind": "build",
"isDefault": true
},
"options": {
- "cwd": "application",
"env": {
"PATH": "${env:JABY_ENGINE_PATH}/bin;${env:PATH}"
}
}
},
- {
- "label": "cdgen",
- "type": "shell",
- "command": "${env:JABY_ENGINE_PATH}/bin/psxcdgen_ex.exe --list iso/#{ProjectName}.lba -o iso/#{ProjectName} psx bin-cue iso/Config.xml",
- "group": {
- "kind": "build",
- "isDefault": true
- }
- },
- {
- "label": "build & generate cd",
- "type": "shell",
- "dependsOn": ["build", "cdgen"],
- "dependsOrder": "sequence",
- "group": {
- "kind": "build",
- "isDefault": true
- }
- }
],
"inputs": [
{
@@ -51,6 +31,13 @@
"default": "release",
"description": "The build profile for #{ProjectName}"
},
+ {
+ "id": "project",
+ "type": "pickString",
+ "options": ["all", "assets", "application", "cd"],
+ "default": "all",
+ "description": "Project to build"
+ },
{
"id": "target",
"type": "pickString",
diff --git a/template/JabyEngine-PSX_Game/Makefile b/template/JabyEngine-PSX_Game/Makefile
new file mode 100644
index 00000000..6acbd708
--- /dev/null
+++ b/template/JabyEngine-PSX_Game/Makefile
@@ -0,0 +1,23 @@
+ARTIFACT = #{ProjectName}
+make_assets = $(MAKE) $(1) ARTIFACT=$(ARTIFACT) -C assets
+make_application = $(MAKE) $(1) ARTIFACT=$(ARTIFACT) -C application
+make_cd = $(MAKE) $(1) ARTIFACT=$(ARTIFACT) -f $(JABY_ENGINE_DIR)/lib/ISOTarget.mk -C iso
+
+all clean rebuild: always
+ $(call make_assets,$(MAKECMDGOALS))
+ $(call make_application,$(MAKECMDGOALS))
+ $(call make_cd,$(MAKECMDGOALS))
+
+all_%: always
+ $(call make_assets,$*)
+ $(call make_application,$*)
+ $(call make_cd,$*)
+
+assets_%: always
+ $(call make_assets,$*)
+application_%: always
+ $(call make_application,$*)
+cd_%: always
+ $(call make_cd,$*)
+
+always: ;
\ No newline at end of file
diff --git a/template/JabyEngine-PSX_Game/application/Makefile b/template/JabyEngine-PSX_Game/application/Makefile
index 16bd0518..f0ac70ea 100644
--- a/template/JabyEngine-PSX_Game/application/Makefile
+++ b/template/JabyEngine-PSX_Game/application/Makefile
@@ -1,4 +1,3 @@
-ARTIFACT = #{ProjectName}
BUILD_DIR = bin
#OVERLAY_CONFIG = Overlays.json
@@ -9,9 +8,4 @@ SRCS = $(call rwildcard, src, c cpp)
INCLUDES += -I$(JABY_ENGINE_DIR)/include
include $(JABY_ENGINE_DIR)/lib/Makefile
-include $(JABY_ENGINE_DIR)/lib/PSEXETarget.mk
-
-clean:
- rm -fr $(OUTPUT_DIR)
- rm -fr ../iso/*.bin
- rm -fr ../iso/*.cue
\ No newline at end of file
+include $(JABY_ENGINE_DIR)/lib/PSEXETarget.mk
\ No newline at end of file
diff --git a/template/JabyEngine-PSX_Game/assets/Makefile b/template/JabyEngine-PSX_Game/assets/Makefile
new file mode 100644
index 00000000..56da6521
--- /dev/null
+++ b/template/JabyEngine-PSX_Game/assets/Makefile
@@ -0,0 +1,14 @@
+include $(JABY_ENGINE_DIR)/lib/ExportPath.mk
+include $(JABY_ENGINE_DIR)/lib/RebuildTarget.mk
+
+OUTPUT_DIR = bin
+
+# Create build targets like
+# $(OUTPUT_DIR)/TexturePage.bin: TexturePage.png
+# @mkdir -p $(OUTPUT_DIR)
+# jaby_engine_fconv --lz4 $< -o $@ simple-tim clut4
+
+all: #$(OUTPUT_DIR)/TexturePage.bin
+
+clean:
+ rm -fr $(OUTPUT_DIR)
\ No newline at end of file
diff --git a/template/JabyEngine-PSX_Game/iso/Config.xml b/template/JabyEngine-PSX_Game/iso/Config.xml
index d52996a1..3210deef 100644
--- a/template/JabyEngine-PSX_Game/iso/Config.xml
+++ b/template/JabyEngine-PSX_Game/iso/Config.xml
@@ -4,7 +4,7 @@
\ No newline at end of file