From ac0e4d84200d9b76b24b966ee09a19d35a89ed7d Mon Sep 17 00:00:00 2001 From: jracek Date: Thu, 17 Apr 2025 15:36:34 +0200 Subject: [PATCH] Added IsActive flag and scene lua files --- Runtime/PSXObjectExporter.cs | 2 ++ Runtime/PSXSceneExporter.cs | 22 +++++++++++++++++++++- tools/imhex.hexproj | Bin 19968 -> 19968 bytes 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Runtime/PSXObjectExporter.cs b/Runtime/PSXObjectExporter.cs index 1daceb4..889fad7 100644 --- a/Runtime/PSXObjectExporter.cs +++ b/Runtime/PSXObjectExporter.cs @@ -10,6 +10,8 @@ namespace SplashEdit.RuntimeCode { public LuaFile LuaFile => luaFile; + public bool IsActive = true; + public List Textures { get; set; } = new List(); // Stores the converted PlayStation-style texture public PSXMesh Mesh { get; protected set; } // Stores the converted PlayStation-style mesh [Header("Export Settings")] diff --git a/Runtime/PSXSceneExporter.cs b/Runtime/PSXSceneExporter.cs index 1411884..c7da4aa 100644 --- a/Runtime/PSXSceneExporter.cs +++ b/Runtime/PSXSceneExporter.cs @@ -15,6 +15,7 @@ namespace SplashEdit.RuntimeCode { public float GTEScaling = 100.0f; + public LuaFile SceneLuaFile; private PSXObjectExporter[] _exporters; private TextureAtlas[] _atlases; @@ -132,6 +133,13 @@ namespace SplashEdit.RuntimeCode } } } + if (SceneLuaFile != null) + { + if (!luaFiles.Contains(SceneLuaFile)) + { + luaFiles.Add(SceneLuaFile); + } + } using (BinaryWriter writer = new BinaryWriter(File.Open(path, FileMode.Create))) { @@ -154,7 +162,15 @@ namespace SplashEdit.RuntimeCode writer.Write((ushort)PSXTrig.ConvertCoordinateToPSX(_playerHeight, GTEScaling)); // 26 - writer.Write((ushort)0); + if (SceneLuaFile != null) + { + int index = luaFiles.IndexOf(SceneLuaFile); + writer.Write((short)index); + } + else + { + writer.Write((short)-1); + } writer.Write((ushort)0); // Lua file section @@ -199,6 +215,10 @@ namespace SplashEdit.RuntimeCode { writer.Write((short)-1); } + + // Write 4-byte bitfield with LSB as exporter.isActive + int bitfield = exporter.IsActive ? 0b1 : 0b0; + writer.Write(bitfield); } // Navmesh metadata section diff --git a/tools/imhex.hexproj b/tools/imhex.hexproj index 48f799811656f14f48745439a7d430f03856f60e..080213e59e0804551c9c0187f33c5d43a4375f1d 100644 GIT binary patch delta 102 zcmZpe!`Lu~aYL;Lv!Q|E%!k%AroOsEpY