summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Estelami <NEstelami@users.noreply.github.com>2021-08-08 13:51:51 -0400
committerGitHub <noreply@github.com>2021-08-08 13:51:51 -0400
commit0fb7568ec0d07ea414f8c3f286de352e9606d016 (patch)
treedeba58f4cf06f669aa14e85462055d63b4bc6e99
parent82bd27604a4c8f8c1f01f9c2f54c87fab103c39f (diff)
Moved utility code into its own library (#162)
* Initial exporter implementation * Updated to use static library. * minor cleanup * Cleaned things up a bit * Fixed merge issues * Minor commenting * Added Begin and End functions, and removed HL stuff (to be turned into an exporter at a later date) * Cleaned some stuff up * Additional cleanup * Removed some commented out code * Fixed compilation issues * Cleanup * Fixed merge issues * Got rid of unused windows.h includes * Cleanup * Fixed warning * Removed additional redundancies * Cleanup * Fixed merge issues * Fixed some compiler issues, added makefile for exportertest. * Removed redundancies and clang formatted * Made sure exportertest compiles with C++17 * Moved certain files into new "Utils" folder. * GetExporterMap uses a reference now * Minor fixes and updates. * Moved utility code into its own library * Fixed merge issues * Fixed compilation issue * Added missing classes * Updated makefile * Minor update * Forgot to make an enum an 'enum class' * Minor fix * Few more adjustments * Bug fix * Another bug fix * Bug fix again * added comment * New functions added for exporters * Made certain fields public Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
-rw-r--r--.gitignore1
-rw-r--r--ExporterTest/Makefile2
-rw-r--r--ExporterTest/RoomExporter.cpp6
-rw-r--r--Makefile9
-rw-r--r--ZAPD.sln18
-rw-r--r--ZAPD/Globals.cpp18
-rw-r--r--ZAPD/Globals.h5
-rw-r--r--ZAPD/ImageBackend.cpp3
-rw-r--r--ZAPD/Main.cpp14
-rw-r--r--ZAPD/Overlays/ZOverlay.cpp8
-rw-r--r--ZAPD/Utils/MemoryStream.h32
-rw-r--r--ZAPD/ZAPD.vcxproj22
-rw-r--r--ZAPD/ZAPD.vcxproj.filters45
-rw-r--r--ZAPD/ZFile.cpp4
-rw-r--r--ZAPD/ZFile.h2
-rw-r--r--ZAPD/ZResource.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetActorCutsceneList.h3
-rw-r--r--ZAPD/ZRoom/Commands/SetActorList.h6
-rw-r--r--ZAPD/ZRoom/Commands/SetAlternateHeaders.h3
-rw-r--r--ZAPD/ZRoom/Commands/SetCameraSettings.h7
-rw-r--r--ZAPD/ZRoom/Commands/SetCutscenes.h9
-rw-r--r--ZAPD/ZRoom/Commands/SetEchoSettings.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetExitList.h5
-rw-r--r--ZAPD/ZRoom/Commands/SetLightList.h7
-rw-r--r--ZAPD/ZRoom/Commands/SetLightingSettings.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetMesh.h44
-rw-r--r--ZAPD/ZRoom/Commands/SetMinimapChests.h5
-rw-r--r--ZAPD/ZRoom/Commands/SetMinimapList.h4
-rw-r--r--ZAPD/ZRoom/Commands/SetObjectList.h5
-rw-r--r--ZAPD/ZRoom/Commands/SetPathways.h5
-rw-r--r--ZAPD/ZRoom/Commands/SetRoomBehavior.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetRoomList.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetSkyboxModifier.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetSkyboxSettings.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetSoundSettings.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetSpecialObjects.h2
-rw-r--r--ZAPD/ZRoom/Commands/SetStartPositionList.h3
-rw-r--r--ZAPD/ZRoom/Commands/SetTransitionActorList.h14
-rw-r--r--ZAPD/ZRoom/ZRoom.cpp4
-rw-r--r--ZAPDUtils/Color3b.h11
-rw-r--r--ZAPDUtils/Makefile23
-rw-r--r--ZAPDUtils/StrHash.h51
-rw-r--r--ZAPDUtils/Utils/BinaryReader.cpp142
-rw-r--r--ZAPDUtils/Utils/BinaryReader.h43
-rw-r--r--ZAPDUtils/Utils/BinaryWriter.cpp (renamed from ZAPD/Utils/BinaryWriter.cpp)0
-rw-r--r--ZAPDUtils/Utils/BinaryWriter.h (renamed from ZAPD/Utils/BinaryWriter.h)0
-rw-r--r--ZAPDUtils/Utils/BitConverter.h (renamed from ZAPD/Utils/BitConverter.h)0
-rw-r--r--ZAPDUtils/Utils/Directory.h (renamed from ZAPD/Utils/Directory.h)2
-rw-r--r--ZAPDUtils/Utils/File.h (renamed from ZAPD/Utils/File.h)0
-rw-r--r--ZAPDUtils/Utils/MemoryStream.cpp (renamed from ZAPD/Utils/MemoryStream.cpp)6
-rw-r--r--ZAPDUtils/Utils/MemoryStream.h33
-rw-r--r--ZAPDUtils/Utils/Path.h (renamed from ZAPD/Utils/Path.h)0
-rw-r--r--ZAPDUtils/Utils/Stream.h (renamed from ZAPD/Utils/Stream.h)8
-rw-r--r--ZAPDUtils/Utils/StringHelper.h (renamed from ZAPD/Utils/StringHelper.h)0
-rw-r--r--ZAPDUtils/Vec2f.h11
-rw-r--r--ZAPDUtils/Vec3f.h11
-rw-r--r--ZAPDUtils/Vec3s.h (renamed from ZAPD/Vec3s.h)0
-rw-r--r--ZAPDUtils/ZAPDUtils.vcxproj165
-rw-r--r--ZAPDUtils/ZAPDUtils.vcxproj.filters78
-rw-r--r--lib/libgfxd/uc_macrofn.c1
60 files changed, 712 insertions, 204 deletions
diff --git a/.gitignore b/.gitignore
index 5401cb9..9d2d2da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -334,5 +334,6 @@ ASALocalRun/
*.d
lib/libgfxd/libgfxd.a
ExporterTest/ExporterTest.a
+ZAPDUtils/ZAPDUtils.a
.vscode/
ZAPD/BuildInfo.h \ No newline at end of file
diff --git a/ExporterTest/Makefile b/ExporterTest/Makefile
index a83efd8..6c09e5a 100644
--- a/ExporterTest/Makefile
+++ b/ExporterTest/Makefile
@@ -20,4 +20,4 @@ $(LIB): $(OBJ)
$(AR) rcs $@ $^
%.o: %.cpp
- $(COMPILE.c) $(OUTPUT_OPTION) $(CXXFLAGS) $< -I ./ -I ../ZAPD -I ../lib/tinyxml2
+ $(COMPILE.c) $(OUTPUT_OPTION) $(CXXFLAGS) $< -I ./ -I ../ZAPD -I ../ZAPDUtils -I ../lib/tinyxml2
diff --git a/ExporterTest/RoomExporter.cpp b/ExporterTest/RoomExporter.cpp
index 0cc9a2b..f08e631 100644
--- a/ExporterTest/RoomExporter.cpp
+++ b/ExporterTest/RoomExporter.cpp
@@ -1,7 +1,7 @@
#include "RoomExporter.h"
-#include "Utils/BinaryWriter.h"
-#include "Utils/MemoryStream.h"
-#include "Utils/File.h"
+#include <Utils/BinaryWriter.h>
+#include <Utils/MemoryStream.h>
+#include <Utils/File.h>
#include <ZRoom/Commands/SetWind.h>
#include <ZRoom/Commands/SetTimeSettings.h>
#include <ZRoom/Commands/SetSkyboxModifier.h>
diff --git a/Makefile b/Makefile
index 034b270..b0291ac 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ CXXFLAGS ?=
COPYCHECK_ARGS ?=
CXX := g++
-INC := -I ZAPD -I lib/assimp/include -I lib/elfio -I lib/json/include -I lib/stb -I lib/tinygltf -I lib/libgfxd -I lib/tinyxml2
+INC := -I ZAPD -I lib/assimp/include -I lib/elfio -I lib/json/include -I lib/stb -I lib/tinygltf -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils
CXXFLAGS += -fpic -std=c++17 -Wall -fno-omit-frame-pointer
ifneq ($(DEBUG),0)
@@ -77,5 +77,8 @@ lib/libgfxd/libgfxd.a:
ExporterTest/ExporterTest.a:
$(MAKE) -C ExporterTest
-ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest/ExporterTest.a
- $(CXX) $(CXXFLAGS) $(INC) $(O_FILES) lib/libgfxd/libgfxd.a -Wl,--whole-archive ExporterTest/ExporterTest.a -Wl,--no-whole-archive -o $@ $(FS_INC) $(LDFLAGS)
+ZAPDUtils/ZAPDUtils.a:
+ $(MAKE) -C ZAPDUtils
+
+ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest/ExporterTest.a ZAPDUtils/ZAPDUtils.a
+ $(CXX) $(CXXFLAGS) $(INC) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a -Wl,--whole-archive ExporterTest/ExporterTest.a -Wl,--no-whole-archive -o $@ $(FS_INC) $(LDFLAGS)
diff --git a/ZAPD.sln b/ZAPD.sln
index d4c3027..82538dd 100644
--- a/ZAPD.sln
+++ b/ZAPD.sln
@@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "ZAPD\ZAPD.vcxproj",
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExporterExample", "ExporterTest\ExporterTest.vcxproj", "{65608EB0-1A47-45AD-AB66-192FB64C762C}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -51,6 +53,22 @@ Global
{65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x64.Build.0 = Release|x64
{65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.Build.0 = Release|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.ActiveCfg = Debug|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.Build.0 = Debug|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.ActiveCfg = Debug|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.Build.0 = Debug|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.ActiveCfg = Release|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.Build.0 = Release|x64
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
+ {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ZAPD/Globals.cpp b/ZAPD/Globals.cpp
index 94455d4..cb9b358 100644
--- a/ZAPD/Globals.cpp
+++ b/ZAPD/Globals.cpp
@@ -1,7 +1,7 @@
#include "Globals.h"
#include <algorithm>
-#include "Utils/File.h"
-#include "Utils/Path.h"
+#include <Utils/File.h>
+#include <Utils/Path.h>
#include "tinyxml2.h"
using namespace tinyxml2;
@@ -187,24 +187,24 @@ bool Globals::HasSegment(int32_t segment)
return std::find(segments.begin(), segments.end(), segment) != segments.end();
}
-std::map<std::string, ExporterSet*>& Globals::GetExporterMap()
+std::map<std::string, ExporterSet*>* Globals::GetExporterMap()
{
static std::map<std::string, ExporterSet*> exporters;
- return exporters;
+ return &exporters;
}
void Globals::AddExporter(std::string exporterName, ExporterSet* exporterSet)
{
auto exporters = GetExporterMap();
- exporters[exporterName] = exporterSet;
+ (*exporters)[exporterName] = exporterSet;
}
ZResourceExporter* Globals::GetExporter(ZResourceType resType)
{
- auto exporters = GetExporterMap();
+ auto exporters = *GetExporterMap();
if (currentExporter != "" && exporters[currentExporter]->exporters.find(resType) !=
- exporters[currentExporter]->exporters.end())
+ exporters[currentExporter]->exporters.end())
return exporters[currentExporter]->exporters[resType];
else
return nullptr;
@@ -212,10 +212,10 @@ ZResourceExporter* Globals::GetExporter(ZResourceType resType)
ExporterSet* Globals::GetExporterSet()
{
- auto exporters = GetExporterMap();
+ auto exporters = *GetExporterMap();
if (currentExporter != "")
return exporters[currentExporter];
else
return nullptr;
-}
+} \ No newline at end of file
diff --git a/ZAPD/Globals.h b/ZAPD/Globals.h
index fcfd6b7..904fd92 100644
--- a/ZAPD/Globals.h
+++ b/ZAPD/Globals.h
@@ -39,6 +39,7 @@ typedef void (*ExporterSetFunc)(ZFile*);
typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode);
typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i);
typedef void (*ExporterSetFuncVoid2)(std::string buildMode, ZFileMode& fileMode);
+typedef void (*ExporterSetFuncVoid3)();
class ExporterSet
{
@@ -49,6 +50,8 @@ public:
ExporterSetFuncBool processFileModeFunc = nullptr;
ExporterSetFunc beginFileFunc = nullptr;
ExporterSetFunc endFileFunc = nullptr;
+ ExporterSetFuncVoid3 beginXMLFunc = nullptr;
+ ExporterSetFuncVoid3 endXMLFunc = nullptr;
};
class Globals
@@ -81,7 +84,7 @@ public:
std::map<uint32_t, std::string> symbolMap;
std::string currentExporter;
- static std::map<std::string, ExporterSet*>& GetExporterMap();
+ static std::map<std::string, ExporterSet*>* GetExporterMap();
static void AddExporter(std::string exporterName, ExporterSet* exporterSet);
Globals();
diff --git a/ZAPD/ImageBackend.cpp b/ZAPD/ImageBackend.cpp
index cbb0f96..b8f13ac 100644
--- a/ZAPD/ImageBackend.cpp
+++ b/ZAPD/ImageBackend.cpp
@@ -216,7 +216,8 @@ void ImageBackend::WritePng(const char* filename)
void ImageBackend::WritePng(const fs::path& filename)
{
- WritePng(filename.c_str());
+ // Note: The .string() is necessary for MSVC, due to the implementation of std::filesystem differing from GCC. Do not remove!
+ WritePng(filename.string().c_str());
}
void ImageBackend::SetTextureData(const std::vector<std::vector<RGBAPixel>>& texData,
diff --git a/ZAPD/Main.cpp b/ZAPD/Main.cpp
index 1ca939e..0c86ab6 100644
--- a/ZAPD/Main.cpp
+++ b/ZAPD/Main.cpp
@@ -1,7 +1,7 @@
#include "BuildInfo.h"
-#include "Utils/Directory.h"
-#include "Utils/File.h"
-#include "Utils/Path.h"
+#include <Utils/Directory.h>
+#include <Utils/File.h>
+#include <Utils/Path.h>
#include "Globals.h"
#include "Overlays/ZOverlay.h"
#include "ZAnimation.h"
@@ -360,6 +360,11 @@ bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, ZFileMode file
}
}
+ ExporterSet* exporterSet = Globals::Instance->GetExporterSet();
+
+ if (exporterSet != nullptr && exporterSet->beginXMLFunc != nullptr)
+ exporterSet->beginXMLFunc();
+
for (ZFile* file : Globals::Instance->files)
{
if (fileMode == ZFileMode::BuildSourceFile)
@@ -368,6 +373,9 @@ bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, ZFileMode file
file->ExtractResources();
}
+ if (exporterSet != nullptr && exporterSet->endXMLFunc != nullptr)
+ exporterSet->endXMLFunc();
+
// All done, free files
for (ZFile* file : Globals::Instance->files)
delete file;
diff --git a/ZAPD/Overlays/ZOverlay.cpp b/ZAPD/Overlays/ZOverlay.cpp
index 4ac3ed4..7064e29 100644
--- a/ZAPD/Overlays/ZOverlay.cpp
+++ b/ZAPD/Overlays/ZOverlay.cpp
@@ -1,8 +1,8 @@
#include "ZOverlay.h"
-#include "../Utils/Directory.h"
-#include "../Utils/File.h"
-#include "../Utils/Path.h"
-#include "../Utils/StringHelper.h"
+#include <Utils/Directory.h>
+#include <Utils/File.h>
+#include <Utils/Path.h>
+#include <Utils/StringHelper.h>
using namespace ELFIO;
diff --git a/ZAPD/Utils/MemoryStream.h b/ZAPD/Utils/MemoryStream.h
deleted file mode 100644
index cc24315..0000000
--- a/ZAPD/Utils/MemoryStream.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#pragma once
-
-#include <memory>
-#include <vector>
-#include "Stream.h"
-
-class MemoryStream : public Stream
-{
-public:
- MemoryStream();
- MemoryStream(char* nBuffer, size_t nBufferSize);
- ~MemoryStream();
-
- uint64_t GetLength() override;
-
- void Seek(int32_t offset, SeekOffsetType seekType);
-
- std::unique_ptr<char[]> Read(size_t length);
- int8_t ReadByte();
-
- void Write(char* srcBuffer, size_t length);
- void WriteByte(int8_t value);
-
- std::vector<char> ToVector();
-
- void Flush();
- void Close();
-
-protected:
- std::vector<char> buffer;
- std::size_t bufferSize;
-}; \ No newline at end of file
diff --git a/ZAPD/ZAPD.vcxproj b/ZAPD/ZAPD.vcxproj
index 4d2facb..a49a9e7 100644
--- a/ZAPD/ZAPD.vcxproj
+++ b/ZAPD/ZAPD.vcxproj
@@ -71,12 +71,16 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <IncludePath>$(SolutionDir)lib\tinyxml2;$(SolutionDir)lib\libgfxd;$(SolutionDir)lib\elfio;$(SolutionDir)lib\assimp\include;$(SolutionDir)lib\stb;$(ProjectDir);$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)lib\libgfxd;$(SolutionDir)lib\assimp-built;$(SolutionDir)x64\Debug;$(SolutionDir)packages\libpng.1.6.28.1\build\native\lib\x64\v140\dynamic\Debug;$(LibraryPath)</LibraryPath>
+ <IncludePath>$(SolutionDir)ZAPDUtils;$(SolutionDir)lib\tinyxml2;$(SolutionDir)lib\libgfxd;$(SolutionDir)lib\elfio;$(SolutionDir)lib\assimp\include;$(SolutionDir)lib\stb;$(ProjectDir);$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(IncludePath)</IncludePath>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <IncludePath>$(SolutionDir)ZAPD\lib\tinyxml2;$(SolutionDir)ZAPD\lib\libgfxd;$(SolutionDir)ZAPD\lib\elfio;$(SolutionDir)ZAPD\lib\assimp\include;$(SolutionDir)ZAPD\lib\stb;$(ProjectDir);$(IncludePath)</IncludePath>
+ <LibraryPath>$(SolutionDir)ZAPD\lib\libgfxd;$(SolutionDir)ZAPD\lib\assimp-built;$(SolutionDir)x64\Debug;$(SolutionDir)packages\libpng.1.6.28.1\build\native\lib\x64\v140\dynamic\Debug;$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@@ -85,6 +89,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;USE_ASSIMP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<Profile>true</Profile>
@@ -103,7 +108,7 @@
</ClCompile>
<Link>
<Profile>true</Profile>
- <AdditionalDependencies>assimp-vc142-mt.lib;libpng16.lib;/WHOLEARCHIVE:ExporterExample.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>assimp-vc142-mt.lib;libpng16.lib;ZAPDUtils.lib;/WHOLEARCHIVE:ExporterExample.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>cd ..
@@ -155,8 +160,6 @@ python3 ZAPD/genbuildinfo.py</Command>
<ClCompile Include="Main.cpp" />
<ClCompile Include="OutputFormatter.cpp" />
<ClCompile Include="Overlays\ZOverlay.cpp" />
- <ClCompile Include="Utils\BinaryWriter.cpp" />
- <ClCompile Include="Utils\MemoryStream.cpp" />
<ClCompile Include="ZArray.cpp" />
<ClCompile Include="ZBackground.cpp" />
<ClCompile Include="ZCutsceneMM.cpp" />
@@ -240,15 +243,6 @@ python3 ZAPD/genbuildinfo.py</Command>
<ClInclude Include="ImageBackend.h" />
<ClInclude Include="OutputFormatter.h" />
<ClInclude Include="Overlays\ZOverlay.h" />
- <ClInclude Include="Utils\BinaryWriter.h" />
- <ClInclude Include="Utils\BitConverter.h" />
- <ClInclude Include="Utils\Directory.h" />
- <ClInclude Include="Utils\File.h" />
- <ClInclude Include="Utils\MemoryStream.h" />
- <ClInclude Include="Utils\Path.h" />
- <ClInclude Include="Utils\Stream.h" />
- <ClInclude Include="Utils\StringHelper.h" />
- <ClInclude Include="Vec3s.h" />
<ClInclude Include="ZAnimation.h" />
<ClInclude Include="ZArray.h" />
<ClInclude Include="ZBackground.h" />
@@ -271,7 +265,6 @@ python3 ZAPD/genbuildinfo.py</Command>
<ClInclude Include="ZScalar.h" />
<ClInclude Include="ZSkeleton.h" />
<ClInclude Include="ZResource.h" />
- <ClInclude Include="ZRoom\ActorList.h" />
<ClInclude Include="ZRoom\Commands\EndMarker.h" />
<ClInclude Include="ZRoom\Commands\SetActorList.h" />
<ClInclude Include="ZRoom\Commands\SetAlternateHeaders.h" />
@@ -298,7 +291,6 @@ python3 ZAPD/genbuildinfo.py</Command>
<ClInclude Include="ZRoom\Commands\SetWind.h" />
<ClInclude Include="ZRoom\Commands\Unused09.h" />
<ClInclude Include="ZRoom\Commands\ZRoomCommandUnk.h" />
- <ClInclude Include="ZRoom\ObjectList.h" />
<ClInclude Include="ZRoom\ZRoom.h" />
<ClInclude Include="ZRoom\ZRoomCommand.h" />
<ClInclude Include="ZString.h" />
diff --git a/ZAPD/ZAPD.vcxproj.filters b/ZAPD/ZAPD.vcxproj.filters
index 0d9644e..a227d6d 100644
--- a/ZAPD/ZAPD.vcxproj.filters
+++ b/ZAPD/ZAPD.vcxproj.filters
@@ -49,12 +49,6 @@
<Filter Include="Header Files\Libraries\libgfxd">
<UniqueIdentifier>{85600275-99fe-491d-8189-bcc3dc1a8903}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Utils">
- <UniqueIdentifier>{a5084513-6b48-4c46-9baa-a07aaaca941e}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\Utils">
- <UniqueIdentifier>{118073fe-284f-4eb2-804c-2f37b3b8df27}</UniqueIdentifier>
- </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Main.cpp">
@@ -261,12 +255,6 @@
<ClCompile Include="ImageBackend.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="Utils\BinaryWriter.cpp">
- <Filter>Source Files\Utils</Filter>
- </ClCompile>
- <ClCompile Include="Utils\MemoryStream.cpp">
- <Filter>Source Files\Utils</Filter>
- </ClCompile>
<ClCompile Include="ZString.cpp">
<Filter>Source Files\Z64</Filter>
</ClCompile>
@@ -377,12 +365,6 @@
<ClInclude Include="ZRoom\Commands\Unused09.h">
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
</ClInclude>
- <ClInclude Include="ZRoom\ObjectList.h">
- <Filter>Header Files\Z64\ZRoom</Filter>
- </ClInclude>
- <ClInclude Include="ZRoom\ActorList.h">
- <Filter>Header Files\Z64\ZRoom</Filter>
- </ClInclude>
<ClInclude Include="ZRoom\Commands\SetLightingSettings.h">
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
</ClInclude>
@@ -395,9 +377,6 @@
<ClInclude Include="ZRoom\Commands\SetCutscenes.h">
<Filter>Header Files\Z64\ZRoom\Commands</Filter>
</ClInclude>
- <ClInclude Include="Vec3s.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\lib\json\include\nlohmann\json.hpp">
<Filter>Header Files\Libraries</Filter>
</ClInclude>
@@ -521,30 +500,6 @@
<ClInclude Include="Declaration.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="Utils\BinaryWriter.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
- <ClInclude Include="Utils\Directory.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
- <ClInclude Include="Utils\File.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
- <ClInclude Include="Utils\Path.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
- <ClInclude Include="Utils\Stream.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
- <ClInclude Include="Utils\StringHelper.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
- <ClInclude Include="Utils\MemoryStream.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
- <ClInclude Include="Utils\BitConverter.h">
- <Filter>Header Files\Utils</Filter>
- </ClInclude>
<ClInclude Include="ZString.h">
<Filter>Header Files\Z64</Filter>
</ClInclude>
diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp
index 34b8083..57dd472 100644
--- a/ZAPD/ZFile.cpp
+++ b/ZAPD/ZFile.cpp
@@ -306,8 +306,8 @@ void ZFile::ExtractResources()
if (memStream->GetLength() > 0)
{
- File::WriteAllBytes(StringHelper::Sprintf("%s.bin", GetName().c_str()),
- memStream->ToVector());
+ File::WriteAllBytes(StringHelper::Sprintf("%s%s.bin", Globals::Instance->outputPath.string().c_str(), GetName().c_str()),
+ memStream->ToVector());
}
writer.Close();
diff --git a/ZAPD/ZFile.h b/ZAPD/ZFile.h
index ecdfc06..f21410f 100644
--- a/ZAPD/ZFile.h
+++ b/ZAPD/ZFile.h
@@ -2,7 +2,7 @@
#include <string>
#include <vector>
-#include "Utils/Directory.h"
+#include <Utils/Directory.h>
#include "ZTexture.h"
#include "tinyxml2.h"
diff --git a/ZAPD/ZResource.h b/ZAPD/ZResource.h
index 853fc7c..db961e3 100644
--- a/ZAPD/ZResource.h
+++ b/ZAPD/ZResource.h
@@ -9,7 +9,7 @@
#include "Declaration.h"
#include "tinyxml2.h"
-#include "Utils/Directory.h"
+#include <Utils/Directory.h>
#define SEGMENT_SCENE 2
#define SEGMENT_ROOM 3
diff --git a/ZAPD/ZRoom/Commands/SetActorCutsceneList.h b/ZAPD/ZRoom/Commands/SetActorCutsceneList.h
index d36dd4c..743b92b 100644
--- a/ZAPD/ZRoom/Commands/SetActorCutsceneList.h
+++ b/ZAPD/ZRoom/Commands/SetActorCutsceneList.h
@@ -26,6 +26,8 @@ public:
class SetActorCutsceneList : public ZRoomCommand
{
public:
+ std::vector<ActorCutsceneEntry> cutscenes;
+
SetActorCutsceneList(ZFile* nParent);
void ParseRawData() override;
@@ -38,5 +40,4 @@ public:
size_t GetRawDataSize() const override;
private:
- std::vector<ActorCutsceneEntry> cutscenes;
};
diff --git a/ZAPD/ZRoom/Commands/SetActorList.h b/ZAPD/ZRoom/Commands/SetActorList.h
index 36d00bb..3b8eee5 100644
--- a/ZAPD/ZRoom/Commands/SetActorList.h
+++ b/ZAPD/ZRoom/Commands/SetActorList.h
@@ -27,6 +27,9 @@ public:
class SetActorList : public ZRoomCommand
{
public:
+ uint8_t numActors;
+ std::vector<ActorSpawnEntry> actors;
+
SetActorList(ZFile* nParent);
void ParseRawData() override;
@@ -40,7 +43,4 @@ public:
protected:
size_t GetActorListArraySize() const;
-
- uint8_t numActors;
- std::vector<ActorSpawnEntry> actors;
};
diff --git a/ZAPD/ZRoom/Commands/SetAlternateHeaders.h b/ZAPD/ZRoom/Commands/SetAlternateHeaders.h
index e6e7baf..e66df93 100644
--- a/ZAPD/ZRoom/Commands/SetAlternateHeaders.h
+++ b/ZAPD/ZRoom/Commands/SetAlternateHeaders.h
@@ -6,6 +6,8 @@
class SetAlternateHeaders : public ZRoomCommand
{
public:
+ std::vector<uint32_t> headers;
+
SetAlternateHeaders(ZFile* nParent);
void DeclareReferences(const std::string& prefix) override;
@@ -18,5 +20,4 @@ public:
std::string GetCommandCName() const override;
private:
- std::vector<uint32_t> headers;
};
diff --git a/ZAPD/ZRoom/Commands/SetCameraSettings.h b/ZAPD/ZRoom/Commands/SetCameraSettings.h
index 6cd629c..eecdeb9 100644
--- a/ZAPD/ZRoom/Commands/SetCameraSettings.h
+++ b/ZAPD/ZRoom/Commands/SetCameraSettings.h
@@ -5,6 +5,9 @@
class SetCameraSettings : public ZRoomCommand
{
public:
+ uint8_t cameraMovement;
+ uint32_t mapHighlight;
+
SetCameraSettings(ZFile* nParent);
void ParseRawData() override;
@@ -13,9 +16,5 @@ public:
std::string GetCommandCName() const override;
RoomCommand GetRoomCommand() const override;
-
- uint8_t cameraMovement;
- uint32_t mapHighlight;
-
private:
};
diff --git a/ZAPD/ZRoom/Commands/SetCutscenes.h b/ZAPD/ZRoom/Commands/SetCutscenes.h
index 0d1def2..20df118 100644
--- a/ZAPD/ZRoom/Commands/SetCutscenes.h
+++ b/ZAPD/ZRoom/Commands/SetCutscenes.h
@@ -18,6 +18,10 @@ public:
class SetCutscenes : public ZRoomCommand
{
public:
+ std::vector<ZCutsceneBase*> cutscenes;
+ std::vector<CutsceneEntry> cutsceneEntries; // (MM Only)
+ uint8_t numCutscenes; // (MM Only)
+
SetCutscenes(ZFile* nParent);
~SetCutscenes();
@@ -28,9 +32,4 @@ public:
RoomCommand GetRoomCommand() const override;
size_t GetRawDataSize() const override;
std::string GetCommandCName() const override;
-
-private:
- std::vector<ZCutsceneBase*> cutscenes;
- std::vector<CutsceneEntry> cutsceneEntries; // (MM Only)
- uint8_t numCutscenes; // (MM Only)
};
diff --git a/ZAPD/ZRoom/Commands/SetEchoSettings.h b/ZAPD/ZRoom/Commands/SetEchoSettings.h
index 4a2714a..82b8c27 100644
--- a/ZAPD/ZRoom/Commands/SetEchoSettings.h
+++ b/ZAPD/ZRoom/Commands/SetEchoSettings.h
@@ -15,6 +15,4 @@ public:
std::string GetCommandCName() const override;
RoomCommand GetRoomCommand() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetExitList.h b/ZAPD/ZRoom/Commands/SetExitList.h
index 8d220b1..9d2791a 100644
--- a/ZAPD/ZRoom/Commands/SetExitList.h
+++ b/ZAPD/ZRoom/Commands/SetExitList.h
@@ -5,6 +5,8 @@
class SetExitList : public ZRoomCommand
{
public:
+ std::vector<uint16_t> exits;
+
SetExitList(ZFile* nParent);
void DeclareReferences(const std::string& prefix) override;
@@ -15,7 +17,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-private:
- std::vector<uint16_t> exits;
};
diff --git a/ZAPD/ZRoom/Commands/SetLightList.h b/ZAPD/ZRoom/Commands/SetLightList.h
index 389ffef..c089d82 100644
--- a/ZAPD/ZRoom/Commands/SetLightList.h
+++ b/ZAPD/ZRoom/Commands/SetLightList.h
@@ -27,6 +27,9 @@ protected:
class SetLightList : public ZRoomCommand
{
public:
+ uint8_t numLights;
+ std::vector<LightInfo> lights;
+
SetLightList(ZFile* nParent);
void ParseRawData() override;
@@ -36,8 +39,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-private:
- uint8_t numLights;
- std::vector<LightInfo> lights;
};
diff --git a/ZAPD/ZRoom/Commands/SetLightingSettings.h b/ZAPD/ZRoom/Commands/SetLightingSettings.h
index 03a2d4e..29caf4a 100644
--- a/ZAPD/ZRoom/Commands/SetLightingSettings.h
+++ b/ZAPD/ZRoom/Commands/SetLightingSettings.h
@@ -35,6 +35,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetMesh.h b/ZAPD/ZRoom/Commands/SetMesh.h
index f4b69df..937c04c 100644
--- a/ZAPD/ZRoom/Commands/SetMesh.h
+++ b/ZAPD/ZRoom/Commands/SetMesh.h
@@ -8,6 +8,17 @@
class PolygonDlist
{
public:
+ uint8_t polyType;
+
+ int16_t x, y, z; // polyType == 2
+ int16_t unk_06; // polyType == 2
+
+ segptr_t opa = 0; // Gfx*
+ segptr_t xlu = 0; // Gfx*
+
+ ZDisplayList* opaDList = nullptr; // Gfx*
+ ZDisplayList* xluDList = nullptr; // Gfx*
+
PolygonDlist() = default;
PolygonDlist(const std::string& prefix, const std::vector<uint8_t>& nRawData,
uint32_t nRawDataIndex, ZFile* nParent, ZRoom* nRoom);
@@ -28,17 +39,6 @@ public:
std::string GetName();
protected:
- int16_t x, y, z; // polyType == 2
- int16_t unk_06; // polyType == 2
-
- segptr_t opa = 0; // Gfx*
- segptr_t xlu = 0; // Gfx*
-
- uint8_t polyType;
-
- ZDisplayList* opaDList = nullptr; // Gfx*
- ZDisplayList* xluDList = nullptr; // Gfx*
-
uint32_t rawDataIndex;
ZFile* parent;
ZRoom* zRoom;
@@ -49,7 +49,7 @@ protected:
class BgImage
{
-protected:
+public:
uint16_t unk_00;
uint8_t id;
segptr_t source;
@@ -69,6 +69,7 @@ protected:
std::string name;
bool isSubStruct;
+protected:
void ParseRawData();
ZBackground* MakeBackground(segptr_t ptr, const std::string& prefix);
@@ -89,6 +90,9 @@ public:
class PolygonTypeBase
{
public:
+ uint8_t type;
+ std::vector<PolygonDlist> polyDLists;
+
PolygonTypeBase(ZFile* nParent, const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex,
ZRoom* nRoom);
@@ -108,9 +112,6 @@ public:
std::string GetDefaultName(const std::string& prefix) const;
protected:
- uint8_t type;
-
- std::vector<PolygonDlist> polyDLists;
uint32_t rawDataIndex;
ZFile* parent;
@@ -120,7 +121,7 @@ protected:
class PolygonType1 : public PolygonTypeBase
{
-protected:
+public:
uint8_t format;
segptr_t dlist;
@@ -132,7 +133,6 @@ protected:
segptr_t list; // BgImage*
std::vector<BgImage> multiList;
-public:
PolygonType1(ZFile* nParent, const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex,
ZRoom* nRoom);
@@ -149,6 +149,10 @@ public:
class PolygonType2 : public PolygonTypeBase
{
public:
+ uint8_t num;
+ segptr_t start;
+ segptr_t end;
+
PolygonType2(ZFile* nParent, const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex,
ZRoom* nRoom);
@@ -160,9 +164,6 @@ public:
size_t GetRawDataSize() const override;
protected:
- uint8_t num;
- segptr_t start;
- segptr_t end;
};
class SetMesh : public ZRoomCommand
@@ -170,6 +171,7 @@ class SetMesh : public ZRoomCommand
public:
uint8_t data;
uint8_t meshHeaderType;
+ std::shared_ptr<PolygonTypeBase> polyType;
SetMesh(ZFile* nParent);
@@ -183,7 +185,5 @@ public:
std::string GetCommandCName() const override;
private:
- std::shared_ptr<PolygonTypeBase> polyType;
-
std::string GenDListExterns(ZDisplayList* dList);
};
diff --git a/ZAPD/ZRoom/Commands/SetMinimapChests.h b/ZAPD/ZRoom/Commands/SetMinimapChests.h
index b18534d..04a1e1e 100644
--- a/ZAPD/ZRoom/Commands/SetMinimapChests.h
+++ b/ZAPD/ZRoom/Commands/SetMinimapChests.h
@@ -20,6 +20,8 @@ protected:
class SetMinimapChests : public ZRoomCommand
{
public:
+ std::vector<MinimapChest> chests;
+
SetMinimapChests(ZFile* nParent);
void ParseRawData() override;
@@ -30,7 +32,4 @@ public:
RoomCommand GetRoomCommand() const override;
size_t GetRawDataSize() const override;
std::string GetCommandCName() const override;
-
-private:
- std::vector<MinimapChest> chests;
};
diff --git a/ZAPD/ZRoom/Commands/SetMinimapList.h b/ZAPD/ZRoom/Commands/SetMinimapList.h
index 079e7b3..38a818e 100644
--- a/ZAPD/ZRoom/Commands/SetMinimapList.h
+++ b/ZAPD/ZRoom/Commands/SetMinimapList.h
@@ -20,6 +20,8 @@ protected:
class SetMinimapList : public ZRoomCommand
{
public:
+ std::vector<MinimapEntry> minimaps;
+
SetMinimapList(ZFile* nParent);
void ParseRawData() override;
@@ -32,8 +34,6 @@ public:
std::string GetCommandCName() const override;
private:
- std::vector<MinimapEntry> minimaps;
-
segptr_t listSegmentAddr;
uint32_t listSegmentOffset;
uint32_t unk4;
diff --git a/ZAPD/ZRoom/Commands/SetObjectList.h b/ZAPD/ZRoom/Commands/SetObjectList.h
index c952333..4f02017 100644
--- a/ZAPD/ZRoom/Commands/SetObjectList.h
+++ b/ZAPD/ZRoom/Commands/SetObjectList.h
@@ -5,6 +5,8 @@
class SetObjectList : public ZRoomCommand
{
public:
+ std::vector<uint16_t> objects;
+
SetObjectList(ZFile* nParent);
void ParseRawData() override;
@@ -15,7 +17,4 @@ public:
std::string GetCommandCName() const override;
RoomCommand GetRoomCommand() const override;
size_t GetRawDataSize() const override;
-
-private:
- std::vector<uint16_t> objects;
};
diff --git a/ZAPD/ZRoom/Commands/SetPathways.h b/ZAPD/ZRoom/Commands/SetPathways.h
index 30b765b..e192082 100644
--- a/ZAPD/ZRoom/Commands/SetPathways.h
+++ b/ZAPD/ZRoom/Commands/SetPathways.h
@@ -8,6 +8,8 @@
class SetPathways : public ZRoomCommand
{
public:
+ ZPath pathwayList;
+
SetPathways(ZFile* nParent);
void DeclareReferences(const std::string& prefix) override;
@@ -22,7 +24,4 @@ public:
RoomCommand GetRoomCommand() const override;
size_t GetRawDataSize() const override;
std::string GetCommandCName() const override;
-
-private:
- ZPath pathwayList;
};
diff --git a/ZAPD/ZRoom/Commands/SetRoomBehavior.h b/ZAPD/ZRoom/Commands/SetRoomBehavior.h
index 1022654..47b772d 100644
--- a/ZAPD/ZRoom/Commands/SetRoomBehavior.h
+++ b/ZAPD/ZRoom/Commands/SetRoomBehavior.h
@@ -26,6 +26,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-protected:
};
diff --git a/ZAPD/ZRoom/Commands/SetRoomList.h b/ZAPD/ZRoom/Commands/SetRoomList.h
index d0690f2..a7b45fe 100644
--- a/ZAPD/ZRoom/Commands/SetRoomList.h
+++ b/ZAPD/ZRoom/Commands/SetRoomList.h
@@ -27,6 +27,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetSkyboxModifier.h b/ZAPD/ZRoom/Commands/SetSkyboxModifier.h
index 97310ca..65935bf 100644
--- a/ZAPD/ZRoom/Commands/SetSkyboxModifier.h
+++ b/ZAPD/ZRoom/Commands/SetSkyboxModifier.h
@@ -16,6 +16,4 @@ public:
std::string GetCommandCName() const override;
RoomCommand GetRoomCommand() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetSkyboxSettings.h b/ZAPD/ZRoom/Commands/SetSkyboxSettings.h
index 6007e7d..1c7e01a 100644
--- a/ZAPD/ZRoom/Commands/SetSkyboxSettings.h
+++ b/ZAPD/ZRoom/Commands/SetSkyboxSettings.h
@@ -18,6 +18,4 @@ public:
std::string GetCommandCName() const override;
RoomCommand GetRoomCommand() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetSoundSettings.h b/ZAPD/ZRoom/Commands/SetSoundSettings.h
index 6971ced..f378e5e 100644
--- a/ZAPD/ZRoom/Commands/SetSoundSettings.h
+++ b/ZAPD/ZRoom/Commands/SetSoundSettings.h
@@ -17,6 +17,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetSpecialObjects.h b/ZAPD/ZRoom/Commands/SetSpecialObjects.h
index 7fc0ece..3327d44 100644
--- a/ZAPD/ZRoom/Commands/SetSpecialObjects.h
+++ b/ZAPD/ZRoom/Commands/SetSpecialObjects.h
@@ -16,6 +16,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetStartPositionList.h b/ZAPD/ZRoom/Commands/SetStartPositionList.h
index 0c83061..10075ad 100644
--- a/ZAPD/ZRoom/Commands/SetStartPositionList.h
+++ b/ZAPD/ZRoom/Commands/SetStartPositionList.h
@@ -7,6 +7,7 @@ class SetStartPositionList : public ZRoomCommand
{
public:
std::vector<ActorSpawnEntry> actors;
+
SetStartPositionList(ZFile* nParent);
void ParseRawData() override;
@@ -16,6 +17,4 @@ public:
RoomCommand GetRoomCommand() const override;
std::string GetCommandCName() const override;
-
-private:
};
diff --git a/ZAPD/ZRoom/Commands/SetTransitionActorList.h b/ZAPD/ZRoom/Commands/SetTransitionActorList.h
index dba7a80..e581ceb 100644
--- a/ZAPD/ZRoom/Commands/SetTransitionActorList.h
+++ b/ZAPD/ZRoom/Commands/SetTransitionActorList.h
@@ -5,11 +5,6 @@
class TransitionActorEntry
{
public:
- TransitionActorEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
-
- std::string GetBodySourceCode() const;
-
-protected:
uint8_t frontObjectRoom;
uint8_t frontTransitionReaction;
uint8_t backObjectRoom;
@@ -18,11 +13,17 @@ protected:
int16_t posX, posY, posZ;
int16_t rotY;
uint16_t initVar;
+
+ TransitionActorEntry(const std::vector<uint8_t>& rawData, int rawDataIndex);
+
+ std::string GetBodySourceCode() const;
};
class SetTransitionActorList : public ZRoomCommand
{
public:
+ std::vector<TransitionActorEntry> transitionActors;
+
SetTransitionActorList(ZFile* nParent);
void ParseRawData() override;
@@ -33,7 +34,4 @@ public:
RoomCommand GetRoomCommand() const override;
size_t GetRawDataSize() const override;
std::string GetCommandCName() const override;
-
-private:
- std::vector<TransitionActorEntry> transitionActors;
};
diff --git a/ZAPD/ZRoom/ZRoom.cpp b/ZAPD/ZRoom/ZRoom.cpp
index db9f2ba..01d9eb6 100644
--- a/ZAPD/ZRoom/ZRoom.cpp
+++ b/ZAPD/ZRoom/ZRoom.cpp
@@ -2,9 +2,9 @@
#include <Utils/Path.h>
#include <algorithm>
#include <chrono>
-#include "../Utils/File.h"
+#include <Utils/File.h>
+#include <Utils/StringHelper.h>
#include "../Globals.h"
-#include "../Utils/StringHelper.h"
#include "../ZBlob.h"
#include "Commands/EndMarker.h"
#include "Commands/SetActorCutsceneList.h"
diff --git a/ZAPDUtils/Color3b.h b/ZAPDUtils/Color3b.h
new file mode 100644
index 0000000..d241297
--- /dev/null
+++ b/ZAPDUtils/Color3b.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <stdint.h>
+
+struct Color3b
+{
+ uint8_t r, g, b;
+
+ Color3b() { r = 0; g = 0; b = 0; };
+ Color3b(uint8_t nR, uint8_t nG, uint8_t nB) { r = nR; g = nG; b = nB; };
+}; \ No newline at end of file
diff --git a/ZAPDUtils/Makefile b/ZAPDUtils/Makefile
new file mode 100644
index 0000000..307f033
--- /dev/null
+++ b/ZAPDUtils/Makefile
@@ -0,0 +1,23 @@
+CXXFLAGS = -Wall -O2 -g -std=c++17
+OBJ = Utils/BinaryWriter.o Utils/MemoryStream.o
+LIB = ZAPDUtils.a
+
+CPPFLAGS-$(MT) += -DCONFIG_MT
+CPPFLAGS += $(CPPFLAGS-y)
+
+.PHONY: all
+all: $(LIB)
+
+.PHONY: clean
+clean:
+ rm -f $(OBJ) $(LIB)
+
+.INTERMEDIATE: $(OBJ)
+
+$(OBJ): Utils/BinaryReader.cpp Utils/BinaryWriter.cpp Utils/MemoryStream.cpp
+
+$(LIB): $(OBJ)
+ $(AR) rcs $@ $^
+
+%.o: %.cpp
+ $(COMPILE.c) $(OUTPUT_OPTION) $(CXXFLAGS) $< -I ./ -I ../ZAPD -I ../lib/tinyxml2
diff --git a/ZAPDUtils/StrHash.h b/ZAPDUtils/StrHash.h
new file mode 100644
index 0000000..a3eb0c9
--- /dev/null
+++ b/ZAPDUtils/StrHash.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef uint32_t strhash;
+
+static strhash CRC32B(unsigned char* message, int32_t size)
+{
+ int32_t byte = 0, crc = 0;
+ int32_t mask = 0;
+
+ crc = 0xFFFFFFFF;
+
+ for (int32_t i = 0; i < size; i++)
+ {
+ byte = message[i];
+ crc = crc ^ byte;
+
+ for (int32_t j = 7; j >= 0; j--)
+ {
+ mask = -(crc & 1);
+ crc = (crc >> 1) ^ (0xEDB88320 & mask);
+ }
+ }
+
+ return ~(uint32_t)(crc);
+}
+
+constexpr static strhash CRC32BCT(const char* message, int32_t size)
+{
+ int32_t byte = 0, crc = 0;
+ int32_t mask = 0;
+
+ crc = 0xFFFFFFFF;
+
+ for (int32_t i = 0; i < size; i++)
+ {
+ byte = message[i];
+ crc = crc ^ byte;
+
+ for (int32_t j = 7; j >= 0; j--)
+ {
+ mask = -(crc & 1);
+ crc = (crc >> 1) ^ (0xEDB88320 & mask);
+ }
+ }
+
+ return ~(uint32_t)(crc);
+} \ No newline at end of file
diff --git a/ZAPDUtils/Utils/BinaryReader.cpp b/ZAPDUtils/Utils/BinaryReader.cpp
new file mode 100644
index 0000000..192fb1f
--- /dev/null
+++ b/ZAPDUtils/Utils/BinaryReader.cpp
@@ -0,0 +1,142 @@
+#pragma once
+
+#include "BinaryReader.h"
+#include "Stream.h"
+
+BinaryReader::BinaryReader(Stream* nStream)
+{
+ stream.reset(nStream);
+}
+
+void BinaryReader::Close()
+{
+ stream->Close();
+}
+
+void BinaryReader::Seek(uint32_t offset, SeekOffsetType seekType)
+{
+ stream->Seek(offset, seekType);
+}
+
+uint32_t BinaryReader::GetBaseAddress()
+{
+ return stream->GetBaseAddress();
+}
+
+void BinaryReader::Read(char* buffer, int32_t length)
+{
+ stream->Read(length);
+}
+
+char BinaryReader::ReadChar()
+{
+ return (char)stream->ReadByte();
+}
+
+int8_t BinaryReader::ReadByte()
+{
+ return stream->ReadByte();
+}
+
+uint8_t BinaryReader::ReadUByte()
+{
+ return (uint8_t)stream->ReadByte();
+}
+
+int16_t BinaryReader::ReadInt16()
+{
+ int16_t result;
+
+ stream->Read((char*)&result, sizeof(int16_t));
+ return result;
+}
+
+int32_t BinaryReader::ReadInt32()
+{
+ int32_t result;
+
+ stream->Read((char*)&result, sizeof(int32_t));
+ return result;
+}
+
+uint16_t BinaryReader::ReadUInt16()
+{
+ uint16_t result;
+
+ stream->Read((char*)&result, sizeof(uint16_t));
+ return result;
+}
+
+uint32_t BinaryReader::ReadUInt32()
+{
+ uint32_t result;
+
+ stream->Read((char*)&result, sizeof(uint32_t));
+ return result;
+}
+
+uint64_t BinaryReader::ReadUInt64()
+{
+ uint64_t result;
+
+ stream->Read((char*)&result, sizeof(uint64_t));
+ return result;
+}
+
+float BinaryReader::ReadSingle()
+{
+ float result;
+
+ stream->Read((char*)&result, sizeof(float));
+ return result;
+}
+
+double BinaryReader::ReadDouble()
+{
+ double result;
+
+ stream->Read((char*)&result, sizeof(double));
+ return result;
+}
+
+Vec3f BinaryReader::ReadVec3f()
+{
+ return Vec3f();
+}
+
+Vec3s BinaryReader::ReadVec3s()
+{
+ return Vec3s(0, 0, 0);
+}
+
+Vec3s BinaryReader::ReadVec3b()
+{
+ return Vec3s(0, 0, 0);
+}
+
+Vec2f BinaryReader::ReadVec2f()
+{
+ return Vec2f();
+}
+
+Color3b BinaryReader::ReadColor3b()
+{
+ return Color3b();
+}
+
+std::string BinaryReader::ReadString()
+{
+ std::string res = "";
+ char c;
+
+ do
+ {
+ c = ReadChar();
+
+ if (c != 0)
+ res += c;
+ } while (c != 0);
+
+
+ return res;
+} \ No newline at end of file
diff --git a/ZAPDUtils/Utils/BinaryReader.h b/ZAPDUtils/Utils/BinaryReader.h
new file mode 100644
index 0000000..9e28718
--- /dev/null
+++ b/ZAPDUtils/Utils/BinaryReader.h
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "Stream.h"
+#include "../Vec2f.h"
+#include "../Vec3f.h"
+#include "../Vec3s.h"
+#include "../Color3b.h"
+#include <memory>
+#include <array>
+#include <vector>
+#include <string>
+
+class BinaryReader
+{
+public:
+ BinaryReader(Stream* nStream);
+
+ void Close();
+
+ void Seek(uint32_t offset, SeekOffsetType seekType);
+ uint32_t GetBaseAddress();
+
+ void Read(char* buffer, int32_t length);
+ char ReadChar();
+ int8_t ReadByte();
+ int16_t ReadInt16();
+ int32_t ReadInt32();
+ uint8_t ReadUByte();
+ uint16_t ReadUInt16();
+ uint32_t ReadUInt32();
+ uint64_t ReadUInt64();
+ float ReadSingle();
+ double ReadDouble();
+ Vec3f ReadVec3f();
+ Vec3s ReadVec3s();
+ Vec3s ReadVec3b();
+ Vec2f ReadVec2f();
+ Color3b ReadColor3b();
+ std::string ReadString();
+
+protected:
+ std::shared_ptr<Stream> stream;
+}; \ No newline at end of file
diff --git a/ZAPD/Utils/BinaryWriter.cpp b/ZAPDUtils/Utils/BinaryWriter.cpp
index a48d40d..a48d40d 100644
--- a/ZAPD/Utils/BinaryWriter.cpp
+++ b/ZAPDUtils/Utils/BinaryWriter.cpp
diff --git a/ZAPD/Utils/BinaryWriter.h b/ZAPDUtils/Utils/BinaryWriter.h
index e187b8c..e187b8c 100644
--- a/ZAPD/Utils/BinaryWriter.h
+++ b/ZAPDUtils/Utils/BinaryWriter.h
diff --git a/ZAPD/Utils/BitConverter.h b/ZAPDUtils/Utils/BitConverter.h
index 5cca35b..5cca35b 100644
--- a/ZAPD/Utils/BitConverter.h
+++ b/ZAPDUtils/Utils/BitConverter.h
diff --git a/ZAPD/Utils/Directory.h b/ZAPDUtils/Utils/Directory.h
index a266487..adb2e17 100644
--- a/ZAPD/Utils/Directory.h
+++ b/ZAPDUtils/Utils/Directory.h
@@ -12,7 +12,7 @@ namespace fs = std::filesystem;
namespace fs = std::experimental::filesystem;
#endif
-#include "Utils/StringHelper.h"
+#include "StringHelper.h"
class Directory
{
diff --git a/ZAPD/Utils/File.h b/ZAPDUtils/Utils/File.h
index e3f8880..e3f8880 100644
--- a/ZAPD/Utils/File.h
+++ b/ZAPDUtils/Utils/File.h
diff --git a/ZAPD/Utils/MemoryStream.cpp b/ZAPDUtils/Utils/MemoryStream.cpp
index 6c940be..6c27399 100644
--- a/ZAPD/Utils/MemoryStream.cpp
+++ b/ZAPDUtils/Utils/MemoryStream.cpp
@@ -48,6 +48,12 @@ std::unique_ptr<char[]> MemoryStream::Read(size_t length)
return result;
}
+void MemoryStream::Read(const char* dest, size_t length)
+{
+ memcpy_s((void*)dest, length, &buffer[baseAddress], length);
+ baseAddress += length;
+}
+
int8_t MemoryStream::ReadByte()
{
return buffer[baseAddress++];
diff --git a/ZAPDUtils/Utils/MemoryStream.h b/ZAPDUtils/Utils/MemoryStream.h
new file mode 100644
index 0000000..5a17bb0
--- /dev/null
+++ b/ZAPDUtils/Utils/MemoryStream.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <memory>
+#include <vector>
+#include "Stream.h"
+
+class MemoryStream : public Stream
+{
+public:
+ MemoryStream();
+ MemoryStream(char* nBuffer, size_t nBufferSize);
+ ~MemoryStream();
+
+ uint64_t GetLength() override;
+
+ void Seek(int32_t offset, SeekOffsetType seekType) override;
+
+ std::unique_ptr<char[]> Read(size_t length) override;
+ void Read(const char* dest, size_t length) override;
+ int8_t ReadByte() override;
+
+ void Write(char* srcBuffer, size_t length) override;
+ void WriteByte(int8_t value) override;
+
+ std::vector<char> ToVector();
+
+ void Flush() override;
+ void Close() override;
+
+protected:
+ std::vector<char> buffer;
+ std::size_t bufferSize;
+}; \ No newline at end of file
diff --git a/ZAPD/Utils/Path.h b/ZAPDUtils/Utils/Path.h
index fd3c658..fd3c658 100644
--- a/ZAPD/Utils/Path.h
+++ b/ZAPDUtils/Utils/Path.h
diff --git a/ZAPD/Utils/Stream.h b/ZAPDUtils/Utils/Stream.h
index facb710..7c758d4 100644
--- a/ZAPD/Utils/Stream.h
+++ b/ZAPDUtils/Utils/Stream.h
@@ -10,6 +10,13 @@ enum class SeekOffsetType
End
};
+// TODO: Eventually account for endianess in binaryreader and binarywriter
+enum class Endianess
+{
+ Little = 0,
+ Big = 1,
+};
+
class Stream
{
public:
@@ -19,6 +26,7 @@ public:
virtual void Seek(int32_t offset, SeekOffsetType seekType) = 0;
virtual std::unique_ptr<char[]> Read(size_t length) = 0;
+ virtual void Read(const char* dest, size_t length) = 0;
virtual int8_t ReadByte() = 0;
virtual void Write(char* destBuffer, size_t length) = 0;
diff --git a/ZAPD/Utils/StringHelper.h b/ZAPDUtils/Utils/StringHelper.h
index 26516d0..26516d0 100644
--- a/ZAPD/Utils/StringHelper.h
+++ b/ZAPDUtils/Utils/StringHelper.h
diff --git a/ZAPDUtils/Vec2f.h b/ZAPDUtils/Vec2f.h
new file mode 100644
index 0000000..e9c5059
--- /dev/null
+++ b/ZAPDUtils/Vec2f.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <stdint.h>
+
+struct Vec2f
+{
+ float x, y;
+
+ Vec2f() { x = 0; y = 0; };
+ Vec2f(float nX, float nY) { x = nX; y = nY; };
+}; \ No newline at end of file
diff --git a/ZAPDUtils/Vec3f.h b/ZAPDUtils/Vec3f.h
new file mode 100644
index 0000000..cde5202
--- /dev/null
+++ b/ZAPDUtils/Vec3f.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <stdint.h>
+
+struct Vec3f
+{
+ float x, y, z;
+
+ Vec3f() { x = 0; y = 0; z = 0; };
+ Vec3f(float nX, float nY, float nZ) { x = nX; y = nY; z = nZ; };
+}; \ No newline at end of file
diff --git a/ZAPD/Vec3s.h b/ZAPDUtils/Vec3s.h
index 23e4673..23e4673 100644
--- a/ZAPD/Vec3s.h
+++ b/ZAPDUtils/Vec3s.h
diff --git a/ZAPDUtils/ZAPDUtils.vcxproj b/ZAPDUtils/ZAPDUtils.vcxproj
new file mode 100644
index 0000000..803cdb5
--- /dev/null
+++ b/ZAPDUtils/ZAPDUtils.vcxproj
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>16.0</VCProjectVersion>
+ <Keyword>Win32Proj</Keyword>
+ <ProjectGuid>{a2e01c3e-d647-45d1-9788-043debc1a908}</ProjectGuid>
+ <RootNamespace>ZAPDUtils</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v142</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClInclude Include="Color3b.h" />
+ <ClInclude Include="StrHash.h" />
+ <ClInclude Include="Utils\BinaryReader.h" />
+ <ClInclude Include="Utils\BinaryWriter.h" />
+ <ClInclude Include="Utils\BitConverter.h" />
+ <ClInclude Include="Utils\Directory.h" />
+ <ClInclude Include="Utils\File.h" />
+ <ClInclude Include="Utils\MemoryStream.h" />
+ <ClInclude Include="Utils\Path.h" />
+ <ClInclude Include="Utils\Stream.h" />
+ <ClInclude Include="Utils\StringHelper.h" />
+ <ClInclude Include="Vec2f.h" />
+ <ClInclude Include="Vec3f.h" />
+ <ClInclude Include="Vec3s.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Utils\BinaryReader.cpp" />
+ <ClCompile Include="Utils\BinaryWriter.cpp" />
+ <ClCompile Include="Utils\MemoryStream.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/ZAPDUtils/ZAPDUtils.vcxproj.filters b/ZAPDUtils/ZAPDUtils.vcxproj.filters
new file mode 100644
index 0000000..48117c8
--- /dev/null
+++ b/ZAPDUtils/ZAPDUtils.vcxproj.filters
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ <Filter Include="Header Files\Utils">
+ <UniqueIdentifier>{d8c2c1e7-b065-4b0f-86a2-46ab46eedc0b}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\Utils">
+ <UniqueIdentifier>{e047919d-7186-49ca-b115-e48fbb5c8743}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="Utils\BinaryWriter.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\BitConverter.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\Directory.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\File.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\MemoryStream.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\Path.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\Stream.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\StringHelper.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Vec3s.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Utils\BinaryReader.h">
+ <Filter>Header Files\Utils</Filter>
+ </ClInclude>
+ <ClInclude Include="Color3b.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="StrHash.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Vec2f.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Vec3f.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Utils\BinaryWriter.cpp">
+ <Filter>Source Files\Utils</Filter>
+ </ClCompile>
+ <ClCompile Include="Utils\MemoryStream.cpp">
+ <Filter>Source Files\Utils</Filter>
+ </ClCompile>
+ <ClCompile Include="Utils\BinaryReader.cpp">
+ <Filter>Source Files\Utils</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/lib/libgfxd/uc_macrofn.c b/lib/libgfxd/uc_macrofn.c
index 59f72a2..7659325 100644
--- a/lib/libgfxd/uc_macrofn.c
+++ b/lib/libgfxd/uc_macrofn.c
@@ -2047,6 +2047,7 @@ UCFUNC int c_DPLoadTLUT(gfxd_macro_t *m, int n_macro)
return 0;
}
+#pragma warning(disable:4146)
#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2)
UCFUNC int d_BranchZ(gfxd_macro_t *m, uint32_t hi, uint32_t lo)
{