diff --git a/.gitignore b/.gitignore
index 23da971..7a69e0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,4 @@
-*.db
*.zip
-.vs
-*.vcxproj.user
-Debug/
-ipch/
-Release/
-x64/
-*.filters
-*.o
-playpen.exe
*.dll
+build32/
+build64/
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c5d02bb..0000000
--- a/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-# This is ONLY for the playpen, because it's just used for testing/dev.
-# The expected build setup for creating the DLL is MSVC
-
-CXX=x86_64-w64-mingw32-g++
-CC=x86_64-w64-mingw32-gcc
-CXXFLAGS=-Werror -std=c++17 -static
-CFLAGS=-Werror -std=c11 -static
-
-OBJECTS=layeredfs/playpen.o layeredfs/utils.o layeredfs/log.o \
- layeredfs/config.o layeredfs/avs.o layeredfs/hook.o \
- layeredfs/ramfs_demangler.o layeredfs/modpath_handler.o layeredfs/dllmain.o \
- layeredfs/texture_packer.o layeredfs/texbin.o \
- minhook/src/hook.o minhook/src/buffer.o minhook/src/trampoline.o \
- minhook/src/hde/hde32.o minhook/src/hde/hde64.o \
- layeredfs/3rd_party/lodepng.o \
- layeredfs/3rd_party/libsquish/squish.o \
- layeredfs/3rd_party/libsquish/alpha.o \
- layeredfs/3rd_party/libsquish/rangefit.o \
- layeredfs/3rd_party/libsquish/singlecolourfit.o \
- layeredfs/3rd_party/libsquish/clusterfit.o \
- layeredfs/3rd_party/libsquish/colourset.o \
- layeredfs/3rd_party/libsquish/colourfit.o \
- layeredfs/3rd_party/libsquish/colourblock.o \
- layeredfs/3rd_party/libsquish/maths.o \
- layeredfs/3rd_party/GuillotineBinPack.o layeredfs/3rd_party/stb_dxt.o
-
-playpen.exe: $(OBJECTS)
- $(CXX) $(CXXFLAGS) -o playpen.exe $(OBJECTS)
-
-clean:
- rm -f $(OBJECTS) playpen.exe
diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000..a3b5851
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -euxo pipefail
+
+# x86
+meson setup --cross-file cross-i686-w64-mingw32.txt build32
+meson compile -C build32
+
+# x86_64
+meson setup --cross-file cross-x86_64-w64-mingw32.txt build64
+meson compile -C build64
diff --git a/clean.sh b/clean.sh
new file mode 100644
index 0000000..46fb911
--- /dev/null
+++ b/clean.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+rm -rf build32 build64
diff --git a/cross-i686-w64-mingw32.txt b/cross-i686-w64-mingw32.txt
new file mode 100644
index 0000000..9e6f0f0
--- /dev/null
+++ b/cross-i686-w64-mingw32.txt
@@ -0,0 +1,11 @@
+[binaries]
+c = 'i686-w64-mingw32-gcc'
+cpp = 'i686-w64-mingw32-g++'
+ar = 'i686-w64-mingw32-ar'
+strip = 'i686-w64-mingw32-strip'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'
diff --git a/cross-x86_64-w64-mingw32.txt b/cross-x86_64-w64-mingw32.txt
new file mode 100644
index 0000000..b6de79f
--- /dev/null
+++ b/cross-x86_64-w64-mingw32.txt
@@ -0,0 +1,11 @@
+[binaries]
+c = 'x86_64-w64-mingw32-gcc'
+cpp = 'x86_64-w64-mingw32-g++'
+ar = 'x86_64-w64-mingw32-ar'
+strip = 'x86_64-w64-mingw32-strip'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'
diff --git a/layeredfs.sln b/layeredfs.sln
deleted file mode 100644
index 6d5d7ad..0000000
--- a/layeredfs.sln
+++ /dev/null
@@ -1,54 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.33801.447
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ifs_hook", "layeredfs\layeredfs.vcxproj", "{3ECDB046-9887-4012-B3CE-A3E8971A43D4}"
- ProjectSection(ProjectDependencies) = postProject
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1} = {7A03FC5A-436B-450A-A1E3-44680FCF09D1}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minhook", "minhook\minhook.vcxproj", "{7A03FC5A-436B-450A-A1E3-44680FCF09D1}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Playpen|x64 = Playpen|x64
- Playpen|x86 = Playpen|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Debug|x64.ActiveCfg = Debug|x64
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Debug|x64.Build.0 = Debug|x64
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Debug|x86.ActiveCfg = Debug|Win32
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Debug|x86.Build.0 = Debug|Win32
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Playpen|x64.ActiveCfg = Playpen|x64
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Playpen|x64.Build.0 = Playpen|x64
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Playpen|x86.ActiveCfg = Playpen|Win32
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Playpen|x86.Build.0 = Playpen|Win32
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Release|x64.ActiveCfg = Release|x64
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Release|x64.Build.0 = Release|x64
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Release|x86.ActiveCfg = Release|Win32
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}.Release|x86.Build.0 = Release|Win32
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Debug|x64.ActiveCfg = Debug|x64
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Debug|x64.Build.0 = Debug|x64
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Debug|x86.ActiveCfg = Debug|Win32
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Debug|x86.Build.0 = Debug|Win32
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Playpen|x64.ActiveCfg = Playpen|x64
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Playpen|x64.Build.0 = Playpen|x64
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Playpen|x86.ActiveCfg = Playpen|Win32
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Playpen|x86.Build.0 = Playpen|Win32
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Release|x64.ActiveCfg = Release|x64
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Release|x64.Build.0 = Release|x64
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Release|x86.ActiveCfg = Release|Win32
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {E77F14F4-E15D-4A94-8770-2E930D6AFDF2}
- EndGlobalSection
-EndGlobal
diff --git a/layeredfs/layeredfs.vcxproj b/layeredfs/layeredfs.vcxproj
deleted file mode 100644
index eae139d..0000000
--- a/layeredfs/layeredfs.vcxproj
+++ /dev/null
@@ -1,298 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Playpen
- Win32
-
-
- Playpen
- x64
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {3ECDB046-9887-4012-B3CE-A3E8971A43D4}
- Win32Proj
- hook
- 7.0
- ifs_hook
-
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
- false
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
- false
-
-
- DynamicLibrary
- false
- true
- Unicode
- v141_xp
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
-
-
- Application
- true
- v141_xp
- Unicode
-
-
- DynamicLibrary
- false
- v141_xp
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
- true
-
-
- true
-
-
- false
-
-
- false
-
-
- Debug
-
-
-
- NotUsing
- Level3
- Disabled
- true
- WIN32;_DEBUG;HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- MultiThreadedDebug
- stdcpp17
-
-
- Windows
- true
-
-
-
-
- NotUsing
- Level3
- Disabled
- true
- WIN32;_DEBUG;HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- MultiThreadedDebug
- stdcpp17
-
-
- Windows
- true
-
-
-
-
- NotUsing
- Level3
- Disabled
- true
- _DEBUG;HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- MultiThreadedDebug
- stdcpp17
-
-
- Windows
- true
-
-
-
-
- NotUsing
- Level3
- Disabled
- true
- _DEBUG;HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- MultiThreadedDebug
- stdcpp17
-
-
- Console
- true
-
-
-
-
- NotUsing
- Level3
- MaxSpeed
- true
- true
- true
- WIN32;NDEBUG;HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- None
- MultiThreaded
- stdcpp17
- /Zc:threadSafeInit- %(AdditionalOptions)
-
-
- Windows
- true
- true
- false
-
-
-
-
- NotUsing
- Level3
- MaxSpeed
- true
- true
- true
- NDEBUG;HOOK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- MultiThreaded
- None
- stdcpp17
- /Zc:threadSafeInit-
-
-
- Windows
- true
- true
- false
- %(AdditionalDependencies)
- %(AdditionalLibraryDirectories)
-
-
-
-
- {7a03fc5a-436b-450a-a1e3-44680fcf09d1}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..d9116e8
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,68 @@
+project('layeredfs', 'c', 'cpp', version: '3.0_BETA',
+ default_options: [
+ 'cpp_std=c++17',
+ 'buildtype=release',
+ 'strip=true',
+ 'werror=true',
+ 'b_lto=true',
+ ]
+)
+
+add_project_link_arguments('-static', language: 'cpp')
+
+third_party = static_library('3rd_party',
+ sources: [
+ 'src/3rd_party/GuillotineBinPack.cpp',
+ 'src/3rd_party/Rect.cpp',
+ 'src/3rd_party/lodepng.cpp',
+ 'src/3rd_party/stb_dxt.cpp',
+
+ 'src/3rd_party/libsquish/alpha.cpp',
+ 'src/3rd_party/libsquish/clusterfit.cpp',
+ 'src/3rd_party/libsquish/colourblock.cpp',
+ 'src/3rd_party/libsquish/colourfit.cpp',
+ 'src/3rd_party/libsquish/colourset.cpp',
+ 'src/3rd_party/libsquish/maths.cpp',
+ 'src/3rd_party/libsquish/rangefit.cpp',
+ 'src/3rd_party/libsquish/singlecolourfit.cpp',
+ 'src/3rd_party/libsquish/squish.cpp',
+
+ 'src/3rd_party/minhook/src/buffer.c',
+ 'src/3rd_party/minhook/src/hde/hde32.c',
+ 'src/3rd_party/minhook/src/hde/hde64.c',
+ 'src/3rd_party/minhook/src/hook.c',
+ 'src/3rd_party/minhook/src/trampoline.c',
+ ],
+ # ignore warnings in 3rd party libs
+ cpp_args: '-w',
+)
+
+layeredfs_lib = static_library('layeredfs',
+ sources: [
+ 'src/avs.cpp',
+ 'src/config.cpp',
+ 'src/dllmain.cpp',
+ 'src/hook.cpp',
+ 'src/log.cpp',
+ 'src/modpath_handler.cpp',
+ 'src/playpen.cpp',
+ 'src/ramfs_demangler.cpp',
+ 'src/texbin.cpp',
+ 'src/texture_packer.cpp',
+ 'src/utils.cpp',
+ ],
+ link_with: third_party,
+ cpp_args: '-DVER_STRING="' + meson.project_version() + '"',
+)
+
+shared_library('ifs_hook',
+ sources: 'src/dllmain.cpp',
+ link_with: layeredfs_lib,
+ name_prefix: '',
+)
+
+executable('playpen',
+ sources: 'src/playpen.cpp',
+ build_by_default: false,
+ link_with: layeredfs_lib
+)
diff --git a/minhook/minhook.vcxproj b/minhook/minhook.vcxproj
deleted file mode 100644
index 235bad7..0000000
--- a/minhook/minhook.vcxproj
+++ /dev/null
@@ -1,230 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Playpen
- Win32
-
-
- Playpen
- x64
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {7A03FC5A-436B-450A-A1E3-44680FCF09D1}
- Win32Proj
- minhook
- 7.0
-
-
-
- StaticLibrary
- true
- v141_xp
- Unicode
-
-
- StaticLibrary
- true
- v141_xp
- Unicode
-
-
- StaticLibrary
- false
- true
- Unicode
- v141_xp
-
-
- StaticLibrary
- true
- v141_xp
- Unicode
-
-
- StaticLibrary
- true
- v141_xp
- Unicode
-
-
- StaticLibrary
- false
- v141_xp
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
-
-
- true
-
-
- true
-
-
- true
-
-
- true
-
-
- false
-
-
-
- NotUsing
- Level3
- MaxSpeed
- true
- true
- false
- NDEBUG;_LIB;%(PreprocessorDefinitions)
- MultiThreaded
-
-
- Windows
- true
- true
- true
-
-
- true
-
-
-
-
- NotUsing
- Level3
- Disabled
- true
- WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
- MultiThreadedDebug
-
-
- Windows
- true
-
-
-
-
- NotUsing
- Level3
- Disabled
- true
- WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
- MultiThreadedDebug
-
-
- Windows
- true
-
-
-
-
- NotUsing
- Level3
- Disabled
- true
- _DEBUG;_LIB;%(PreprocessorDefinitions)
-
-
- Windows
- true
-
-
-
-
- NotUsing
- Level3
- Disabled
- true
- _DEBUG;_LIB;%(PreprocessorDefinitions)
-
-
- Windows
- true
-
-
-
-
- NotUsing
- Level3
- MaxSpeed
- true
- true
- true
- WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
- MultiThreaded
-
-
- Windows
- true
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/layeredfs/3rd_party/GuillotineBinPack.cpp b/src/3rd_party/GuillotineBinPack.cpp
similarity index 100%
rename from layeredfs/3rd_party/GuillotineBinPack.cpp
rename to src/3rd_party/GuillotineBinPack.cpp
diff --git a/layeredfs/3rd_party/GuillotineBinPack.h b/src/3rd_party/GuillotineBinPack.h
similarity index 100%
rename from layeredfs/3rd_party/GuillotineBinPack.h
rename to src/3rd_party/GuillotineBinPack.h
diff --git a/layeredfs/3rd_party/MinHook.h b/src/3rd_party/MinHook.h
similarity index 100%
rename from layeredfs/3rd_party/MinHook.h
rename to src/3rd_party/MinHook.h
diff --git a/layeredfs/3rd_party/Rect.cpp b/src/3rd_party/Rect.cpp
similarity index 100%
rename from layeredfs/3rd_party/Rect.cpp
rename to src/3rd_party/Rect.cpp
diff --git a/layeredfs/3rd_party/Rect.h b/src/3rd_party/Rect.h
similarity index 100%
rename from layeredfs/3rd_party/Rect.h
rename to src/3rd_party/Rect.h
diff --git a/layeredfs/3rd_party/hat-trie/array-hash/array_growth_policy.h b/src/3rd_party/hat-trie/array-hash/array_growth_policy.h
similarity index 100%
rename from layeredfs/3rd_party/hat-trie/array-hash/array_growth_policy.h
rename to src/3rd_party/hat-trie/array-hash/array_growth_policy.h
diff --git a/layeredfs/3rd_party/hat-trie/array-hash/array_hash.h b/src/3rd_party/hat-trie/array-hash/array_hash.h
similarity index 100%
rename from layeredfs/3rd_party/hat-trie/array-hash/array_hash.h
rename to src/3rd_party/hat-trie/array-hash/array_hash.h
diff --git a/layeredfs/3rd_party/hat-trie/array-hash/array_map.h b/src/3rd_party/hat-trie/array-hash/array_map.h
similarity index 100%
rename from layeredfs/3rd_party/hat-trie/array-hash/array_map.h
rename to src/3rd_party/hat-trie/array-hash/array_map.h
diff --git a/layeredfs/3rd_party/hat-trie/array-hash/array_set.h b/src/3rd_party/hat-trie/array-hash/array_set.h
similarity index 100%
rename from layeredfs/3rd_party/hat-trie/array-hash/array_set.h
rename to src/3rd_party/hat-trie/array-hash/array_set.h
diff --git a/layeredfs/3rd_party/hat-trie/htrie_hash.h b/src/3rd_party/hat-trie/htrie_hash.h
similarity index 100%
rename from layeredfs/3rd_party/hat-trie/htrie_hash.h
rename to src/3rd_party/hat-trie/htrie_hash.h
diff --git a/layeredfs/3rd_party/hat-trie/htrie_map.h b/src/3rd_party/hat-trie/htrie_map.h
similarity index 100%
rename from layeredfs/3rd_party/hat-trie/htrie_map.h
rename to src/3rd_party/hat-trie/htrie_map.h
diff --git a/layeredfs/3rd_party/hat-trie/htrie_set.h b/src/3rd_party/hat-trie/htrie_set.h
similarity index 100%
rename from layeredfs/3rd_party/hat-trie/htrie_set.h
rename to src/3rd_party/hat-trie/htrie_set.h
diff --git a/layeredfs/3rd_party/htrie_hash.h b/src/3rd_party/htrie_hash.h
similarity index 100%
rename from layeredfs/3rd_party/htrie_hash.h
rename to src/3rd_party/htrie_hash.h
diff --git a/layeredfs/3rd_party/htrie_map.h b/src/3rd_party/htrie_map.h
similarity index 100%
rename from layeredfs/3rd_party/htrie_map.h
rename to src/3rd_party/htrie_map.h
diff --git a/layeredfs/3rd_party/htrie_set.h b/src/3rd_party/htrie_set.h
similarity index 100%
rename from layeredfs/3rd_party/htrie_set.h
rename to src/3rd_party/htrie_set.h
diff --git a/layeredfs/3rd_party/libsquish/LICENSE.txt b/src/3rd_party/libsquish/LICENSE.txt
similarity index 100%
rename from layeredfs/3rd_party/libsquish/LICENSE.txt
rename to src/3rd_party/libsquish/LICENSE.txt
diff --git a/layeredfs/3rd_party/libsquish/alpha.cpp b/src/3rd_party/libsquish/alpha.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/alpha.cpp
rename to src/3rd_party/libsquish/alpha.cpp
diff --git a/layeredfs/3rd_party/libsquish/alpha.h b/src/3rd_party/libsquish/alpha.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/alpha.h
rename to src/3rd_party/libsquish/alpha.h
diff --git a/layeredfs/3rd_party/libsquish/clusterfit.cpp b/src/3rd_party/libsquish/clusterfit.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/clusterfit.cpp
rename to src/3rd_party/libsquish/clusterfit.cpp
diff --git a/layeredfs/3rd_party/libsquish/clusterfit.h b/src/3rd_party/libsquish/clusterfit.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/clusterfit.h
rename to src/3rd_party/libsquish/clusterfit.h
diff --git a/layeredfs/3rd_party/libsquish/colourblock.cpp b/src/3rd_party/libsquish/colourblock.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/colourblock.cpp
rename to src/3rd_party/libsquish/colourblock.cpp
diff --git a/layeredfs/3rd_party/libsquish/colourblock.h b/src/3rd_party/libsquish/colourblock.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/colourblock.h
rename to src/3rd_party/libsquish/colourblock.h
diff --git a/layeredfs/3rd_party/libsquish/colourfit.cpp b/src/3rd_party/libsquish/colourfit.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/colourfit.cpp
rename to src/3rd_party/libsquish/colourfit.cpp
diff --git a/layeredfs/3rd_party/libsquish/colourfit.h b/src/3rd_party/libsquish/colourfit.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/colourfit.h
rename to src/3rd_party/libsquish/colourfit.h
diff --git a/layeredfs/3rd_party/libsquish/colourset.cpp b/src/3rd_party/libsquish/colourset.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/colourset.cpp
rename to src/3rd_party/libsquish/colourset.cpp
diff --git a/layeredfs/3rd_party/libsquish/colourset.h b/src/3rd_party/libsquish/colourset.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/colourset.h
rename to src/3rd_party/libsquish/colourset.h
diff --git a/layeredfs/3rd_party/libsquish/config.h b/src/3rd_party/libsquish/config.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/config.h
rename to src/3rd_party/libsquish/config.h
diff --git a/layeredfs/3rd_party/libsquish/maths.cpp b/src/3rd_party/libsquish/maths.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/maths.cpp
rename to src/3rd_party/libsquish/maths.cpp
diff --git a/layeredfs/3rd_party/libsquish/maths.h b/src/3rd_party/libsquish/maths.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/maths.h
rename to src/3rd_party/libsquish/maths.h
diff --git a/layeredfs/3rd_party/libsquish/note.layeredfs.txt b/src/3rd_party/libsquish/note.layeredfs.txt
similarity index 100%
rename from layeredfs/3rd_party/libsquish/note.layeredfs.txt
rename to src/3rd_party/libsquish/note.layeredfs.txt
diff --git a/layeredfs/3rd_party/libsquish/rangefit.cpp b/src/3rd_party/libsquish/rangefit.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/rangefit.cpp
rename to src/3rd_party/libsquish/rangefit.cpp
diff --git a/layeredfs/3rd_party/libsquish/rangefit.h b/src/3rd_party/libsquish/rangefit.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/rangefit.h
rename to src/3rd_party/libsquish/rangefit.h
diff --git a/layeredfs/3rd_party/libsquish/simd.h b/src/3rd_party/libsquish/simd.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/simd.h
rename to src/3rd_party/libsquish/simd.h
diff --git a/layeredfs/3rd_party/libsquish/simd_float.h b/src/3rd_party/libsquish/simd_float.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/simd_float.h
rename to src/3rd_party/libsquish/simd_float.h
diff --git a/layeredfs/3rd_party/libsquish/simd_sse.h b/src/3rd_party/libsquish/simd_sse.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/simd_sse.h
rename to src/3rd_party/libsquish/simd_sse.h
diff --git a/layeredfs/3rd_party/libsquish/simd_ve.h b/src/3rd_party/libsquish/simd_ve.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/simd_ve.h
rename to src/3rd_party/libsquish/simd_ve.h
diff --git a/layeredfs/3rd_party/libsquish/singlecolourfit.cpp b/src/3rd_party/libsquish/singlecolourfit.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/singlecolourfit.cpp
rename to src/3rd_party/libsquish/singlecolourfit.cpp
diff --git a/layeredfs/3rd_party/libsquish/singlecolourfit.h b/src/3rd_party/libsquish/singlecolourfit.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/singlecolourfit.h
rename to src/3rd_party/libsquish/singlecolourfit.h
diff --git a/layeredfs/3rd_party/libsquish/singlecolourlookup.inl b/src/3rd_party/libsquish/singlecolourlookup.inl
similarity index 100%
rename from layeredfs/3rd_party/libsquish/singlecolourlookup.inl
rename to src/3rd_party/libsquish/singlecolourlookup.inl
diff --git a/layeredfs/3rd_party/libsquish/squish.cpp b/src/3rd_party/libsquish/squish.cpp
similarity index 100%
rename from layeredfs/3rd_party/libsquish/squish.cpp
rename to src/3rd_party/libsquish/squish.cpp
diff --git a/layeredfs/3rd_party/libsquish/squish.h b/src/3rd_party/libsquish/squish.h
similarity index 100%
rename from layeredfs/3rd_party/libsquish/squish.h
rename to src/3rd_party/libsquish/squish.h
diff --git a/layeredfs/3rd_party/lodepng.cpp b/src/3rd_party/lodepng.cpp
similarity index 100%
rename from layeredfs/3rd_party/lodepng.cpp
rename to src/3rd_party/lodepng.cpp
diff --git a/layeredfs/3rd_party/lodepng.h b/src/3rd_party/lodepng.h
similarity index 100%
rename from layeredfs/3rd_party/lodepng.h
rename to src/3rd_party/lodepng.h
diff --git a/minhook/include/MinHook.h b/src/3rd_party/minhook/include/MinHook.h
similarity index 100%
rename from minhook/include/MinHook.h
rename to src/3rd_party/minhook/include/MinHook.h
diff --git a/minhook/src/buffer.c b/src/3rd_party/minhook/src/buffer.c
similarity index 100%
rename from minhook/src/buffer.c
rename to src/3rd_party/minhook/src/buffer.c
diff --git a/minhook/src/buffer.h b/src/3rd_party/minhook/src/buffer.h
similarity index 100%
rename from minhook/src/buffer.h
rename to src/3rd_party/minhook/src/buffer.h
diff --git a/minhook/src/hde/hde32.c b/src/3rd_party/minhook/src/hde/hde32.c
similarity index 100%
rename from minhook/src/hde/hde32.c
rename to src/3rd_party/minhook/src/hde/hde32.c
diff --git a/minhook/src/hde/hde32.h b/src/3rd_party/minhook/src/hde/hde32.h
similarity index 100%
rename from minhook/src/hde/hde32.h
rename to src/3rd_party/minhook/src/hde/hde32.h
diff --git a/minhook/src/hde/hde64.c b/src/3rd_party/minhook/src/hde/hde64.c
similarity index 100%
rename from minhook/src/hde/hde64.c
rename to src/3rd_party/minhook/src/hde/hde64.c
diff --git a/minhook/src/hde/hde64.h b/src/3rd_party/minhook/src/hde/hde64.h
similarity index 100%
rename from minhook/src/hde/hde64.h
rename to src/3rd_party/minhook/src/hde/hde64.h
diff --git a/minhook/src/hde/pstdint.h b/src/3rd_party/minhook/src/hde/pstdint.h
similarity index 100%
rename from minhook/src/hde/pstdint.h
rename to src/3rd_party/minhook/src/hde/pstdint.h
diff --git a/minhook/src/hde/table32.h b/src/3rd_party/minhook/src/hde/table32.h
similarity index 100%
rename from minhook/src/hde/table32.h
rename to src/3rd_party/minhook/src/hde/table32.h
diff --git a/minhook/src/hde/table64.h b/src/3rd_party/minhook/src/hde/table64.h
similarity index 100%
rename from minhook/src/hde/table64.h
rename to src/3rd_party/minhook/src/hde/table64.h
diff --git a/minhook/src/hook.c b/src/3rd_party/minhook/src/hook.c
similarity index 100%
rename from minhook/src/hook.c
rename to src/3rd_party/minhook/src/hook.c
diff --git a/minhook/src/trampoline.c b/src/3rd_party/minhook/src/trampoline.c
similarity index 100%
rename from minhook/src/trampoline.c
rename to src/3rd_party/minhook/src/trampoline.c
diff --git a/minhook/src/trampoline.h b/src/3rd_party/minhook/src/trampoline.h
similarity index 100%
rename from minhook/src/trampoline.h
rename to src/3rd_party/minhook/src/trampoline.h
diff --git a/layeredfs/3rd_party/rapidxml.hpp b/src/3rd_party/rapidxml.hpp
similarity index 100%
rename from layeredfs/3rd_party/rapidxml.hpp
rename to src/3rd_party/rapidxml.hpp
diff --git a/layeredfs/3rd_party/rapidxml_print.hpp b/src/3rd_party/rapidxml_print.hpp
similarity index 100%
rename from layeredfs/3rd_party/rapidxml_print.hpp
rename to src/3rd_party/rapidxml_print.hpp
diff --git a/layeredfs/3rd_party/stb_dxt.cpp b/src/3rd_party/stb_dxt.cpp
similarity index 100%
rename from layeredfs/3rd_party/stb_dxt.cpp
rename to src/3rd_party/stb_dxt.cpp
diff --git a/layeredfs/3rd_party/stb_dxt.h b/src/3rd_party/stb_dxt.h
similarity index 100%
rename from layeredfs/3rd_party/stb_dxt.h
rename to src/3rd_party/stb_dxt.h
diff --git a/layeredfs/avs.cpp b/src/avs.cpp
similarity index 96%
rename from layeredfs/avs.cpp
rename to src/avs.cpp
index 7795c97..779082b 100644
--- a/layeredfs/avs.cpp
+++ b/src/avs.cpp
@@ -6,7 +6,7 @@
#include "hook.h"
#include "log.hpp"
#include "3rd_party/MinHook.h"
-#include "utils.h"
+#include "utils.hpp"
#define AVS_STRUCT_DEF(ret_type, name, ...) const char* name;
@@ -255,7 +255,7 @@ bool init_avs(void) {
// Please don't be proven wrong
LPCWSTR dll_name = NULL;
HMODULE mod_handle = NULL;
- for (int i = 0; i < lenof(dll_names); i++) {
+ for (size_t i = 0; i < lenof(dll_names); i++) {
mod_handle = GetModuleHandleW(dll_names[i]);
if (mod_handle != NULL) {
dll_name = dll_names[i];
@@ -268,7 +268,7 @@ bool init_avs(void) {
return false;
}
- for (int i = 0; i < lenof(avs_exports); i++) {
+ for (size_t i = 0; i < lenof(avs_exports); i++) {
// make sure this is the right DLL
CHECK_UNIQUE(unique_check);
@@ -419,11 +419,6 @@ bool rapidxml_from_avs_filepath(
}
avs_fs_close(f);
- /*FILE* fff;
- fopen_s(&fff, "hmmm.xml", "wb");
- fwrite(xml_owned, 1, strlen(xml_owned), fff);
- fclose(fff);*/
-
try {
// parse_declaration_node: to get the header
doc.parse(xml);
@@ -591,8 +586,8 @@ const prop_error_info_t prop_error_list[73] = {
const char* get_prop_error_str(int32_t code) {
static char ret[64];
- for (int i = 0; i < lenof(prop_error_list); i++) {
- if (prop_error_list[i].code == code)
+ for (size_t i = 0; i < lenof(prop_error_list); i++) {
+ if (prop_error_list[i].code == (uint32_t)code)
return prop_error_list[i].msg;
}
snprintf(ret, sizeof(ret), "unknown (%d)", code);
diff --git a/layeredfs/avs.h b/src/avs.h
similarity index 94%
rename from layeredfs/avs.h
rename to src/avs.h
index 4d76036..920d051 100644
--- a/layeredfs/avs.h
+++ b/src/avs.h
@@ -22,14 +22,16 @@ enum mdigest_algs_t {
};
#define MD5_LEN 16
+#pragma pack(push,1)
struct avs_stat {
- time_t st_atime;
- time_t st_mtime;
- time_t st_ctime;
- int32_t unk1;
+ int64_t st_ctime;
+ int64_t st_mtime;
+ int64_t st_atime;
+ int32_t link_count;
uint32_t filesize;
- // not actually sure how big theirs is
- struct stat padding;
+ uint32_t hi_filesize;
+ uint16_t mode;
+ uint16_t perm;
};
typedef struct {
@@ -175,6 +177,8 @@ struct node_info {
property_type type;
};
+#pragma pack(pop)
+
typedef property_info* property_t;
typedef node_info* node_t;
typedef int32_t AVS_FILE;
diff --git a/layeredfs/config.cpp b/src/config.cpp
similarity index 84%
rename from layeredfs/config.cpp
rename to src/config.cpp
index 2886cb0..4324098 100644
--- a/layeredfs/config.cpp
+++ b/src/config.cpp
@@ -4,7 +4,7 @@
#include "config.hpp"
#include "log.hpp"
-#include "utils.h"
+#include "utils.hpp"
#define VERBOSE_FLAG "--layered-verbose"
#define DEVMODE_FLAG "--layered-devmode"
@@ -19,18 +19,14 @@ config_t config;
static const char *allowlist = NULL;
static const char *blocklist = NULL;
-void comma_separated_to_set(std::unordered_set &dest, const char* arg) {
- char *str = _strdup(arg);
- str_tolower_inline(str); // ignore case for filenames
- char *state = NULL;
- char* token = strtok_s(str, ",", &state);
-
- do {
- dest.insert(token);
- token = strtok_s(NULL, ",", &state);
- } while (token != NULL);
-
- free(str);
+void comma_separated_to_set(std::unordered_set &dest, const std::string &arg) {
+ size_t last = 0;
+ size_t next = 0;
+ while ((next = arg.find(",", last)) != std::string::npos) {
+ dest.insert(arg.substr(last, next-last));
+ last = next + 1;
+ }
+ dest.insert(arg.substr(last));
}
const char* parse_list(const char* prefix, const char* arg, std::unordered_set &dest) {
@@ -41,7 +37,7 @@ const char* parse_list(const char* prefix, const char* arg, std::unordered_set
#include "hook.h"
-#include "utils.h"
+#include "utils.hpp"
HMODULE my_module;
char dll_filename[MAX_PATH];
diff --git a/layeredfs/hook.cpp b/src/hook.cpp
similarity index 94%
rename from layeredfs/hook.cpp
rename to src/hook.cpp
index 508c1d0..b93c7b3 100644
--- a/layeredfs/hook.cpp
+++ b/src/hook.cpp
@@ -19,7 +19,6 @@ using std::string;
#include
#include "3rd_party/MinHook.h"
-#pragma comment(lib, "minhook.lib")
#include "3rd_party/lodepng.h"
#include "3rd_party/stb_dxt.h"
@@ -30,7 +29,7 @@ using std::string;
#include "config.hpp"
#include "log.hpp"
#include "texbin.hpp"
-#include "utils.h"
+#include "utils.hpp"
#include "avs.h"
//#include "jubeat.h"
#include "texture_packer.h"
@@ -41,8 +40,6 @@ using std::string;
#undef max
#undef min
-#define VER_STRING "3.0"
-
#ifdef _DEBUG
#define DBG_VER_STRING "_DEBUG"
#else
@@ -154,8 +151,7 @@ bool add_images_to_list(string_set &extra_pngs, rapidxml::xml_node<> *texturelis
if (!png_loc)
continue;
- FILE* f;
- fopen_s(&f, png_loc->c_str(), "rb");
+ FILE* f = fopen(png_loc->c_str(), "rb");
if (!f) // shouldn't happen but check anyway
continue;
@@ -283,7 +279,7 @@ void parse_texturelist(string const&path, string const&norm_path, optional *compress_node;
- if (compress_node = texturelist_node->first_attribute("compress")) {
+ if ((compress_node = texturelist_node->first_attribute("compress"))) {
if (!_stricmp(compress_node->value(), "avslz")) {
compress = AVSLZ;
}
@@ -334,7 +330,7 @@ void parse_texturelist(string const&path, string const&norm_path, optionalvalue(), "%" SCNu16 " %" SCNu16 " %" SCNu16 " %" SCNu16, &dimensions[0], &dimensions[1], &dimensions[2], &dimensions[3]);
+ sscanf(imgrect->value(), "%" SCNu16 " %" SCNu16 " %" SCNu16 " %" SCNu16, &dimensions[0], &dimensions[1], &dimensions[2], &dimensions[3]);
//log_misc("Image '%s' compress %d format %d", tmp, compress, format_type);
image_t image_info;
@@ -403,7 +399,7 @@ bool cache_texture(string const&png_path, image_t &tex) {
return false;
}
- if (width != tex.width || height != tex.height) {
+ if ((int)width != tex.width || (int)height != tex.height) {
log_warning("Loaded png (%dx%d) doesn't match texturelist.xml (%dx%d), ignoring", width, height, tex.width, tex.height);
return false;
}
@@ -434,8 +430,7 @@ bool cache_texture(string const&png_path, image_t &tex) {
image[i + 1] = tmp;
}
- /*FILE* f;
- fopen_s(&f, "dxt_debug.bin", "wb");
+ /*FILE* f = fopen("dxt_debug.bin", "wb");
fwrite(dxt5_image, 1, dxt5_size, f);
fclose(f);*/
break;
@@ -457,7 +452,7 @@ bool cache_texture(string const&png_path, image_t &tex) {
image_size = compressed_size;
}
- fopen_s(&cache, cache_file.c_str(), "wb");
+ cache = fopen(cache_file.c_str(), "wb");
if (!cache) {
log_warning("can't open cache for writing");
return false;
@@ -544,8 +539,7 @@ void merge_xmls(string const& path, string const&norm_path, optional &mo
hash_filenames(to_merge, hash);
uint8_t cache_hash[MD5_LEN] = {0};
- FILE* cache_hashfile;
- fopen_s(&cache_hashfile, out_hashed.c_str(), "rb");
+ FILE* cache_hashfile = fopen(out_hashed.c_str(), "rb");
if (cache_hashfile) {
fread(cache_hash, 1, sizeof(cache_hash), cache_hashfile);
fclose(cache_hashfile);
@@ -593,7 +587,7 @@ void merge_xmls(string const& path, string const&norm_path, optional &mo
}
rapidxml_dump_to_file(out, merged_xml);
- fopen_s(&cache_hashfile, out_hashed.c_str(), "wb");
+ cache_hashfile = fopen(out_hashed.c_str(), "wb");
if (cache_hashfile) {
fwrite(hash, 1, sizeof(hash), cache_hashfile);
fclose(cache_hashfile);
@@ -653,7 +647,7 @@ void handle_texbin(string const& path, string const&norm_path, optional
uint8_t cache_hash[MD5_LEN] = {0};
FILE* cache_hashfile;
- fopen_s(&cache_hashfile, out_hashed.c_str(), "rb");
+ cache_hashfile = fopen(out_hashed.c_str(), "rb");
if (cache_hashfile) {
fread(cache_hash, 1, sizeof(cache_hash), cache_hashfile);
fclose(cache_hashfile);
@@ -707,7 +701,7 @@ void handle_texbin(string const& path, string const&norm_path, optional
return;
}
- fopen_s(&cache_hashfile, out_hashed.c_str(), "wb");
+ cache_hashfile = fopen(out_hashed.c_str(), "wb");
if (cache_hashfile) {
fwrite(hash, 1, sizeof(hash), cache_hashfile);
fclose(cache_hashfile);
diff --git a/layeredfs/hook.h b/src/hook.h
similarity index 100%
rename from layeredfs/hook.h
rename to src/hook.h
diff --git a/layeredfs/log.cpp b/src/log.cpp
similarity index 95%
rename from layeredfs/log.cpp
rename to src/log.cpp
index 88008dd..3f9a75a 100644
--- a/layeredfs/log.cpp
+++ b/src/log.cpp
@@ -27,7 +27,7 @@ static void log_to_file(char level, const char* fmt, va_list args) {
// default to ifs_hook.log because we need *something* in the case
// of a fatal error
const char *path = config.logfile ? config.logfile : "ifs_hook.log";
- fopen_s(&logfile, path, "w");
+ logfile = fopen(path, "w");
}
tried_to_open = true;
log_mutex.unlock();
diff --git a/layeredfs/log.hpp b/src/log.hpp
similarity index 100%
rename from layeredfs/log.hpp
rename to src/log.hpp
diff --git a/layeredfs/modpath_handler.cpp b/src/modpath_handler.cpp
similarity index 91%
rename from layeredfs/modpath_handler.cpp
rename to src/modpath_handler.cpp
index 06af368..25777dc 100644
--- a/layeredfs/modpath_handler.cpp
+++ b/src/modpath_handler.cpp
@@ -8,7 +8,7 @@
#include "modpath_handler.h"
#include "config.hpp"
#include "log.hpp"
-#include "utils.h"
+#include "utils.hpp"
#include "avs.h"
#include "winxp_mutex.hpp"
@@ -180,27 +180,19 @@ vector available_mods() {
return ret;
}
-bool mkdir_p(string &path) {
+bool mkdir_p(const string &path) {
/* Adapted from http://stackoverflow.com/a/2336245/119527 */
- const size_t len = strlen(path.c_str());
- char _path[MAX_PATH];
char *p;
-
errno = 0;
-
- /* Copy string so its mutable */
- if (len > sizeof(_path) - 1) {
- return false;
- }
- strcpy_s(_path, sizeof(_path), path.c_str());
+ auto _path = path;
/* Iterate the string */
- for (p = _path + 1; *p; p++) {
+ for (p = _path.data() + 1; *p; p++) {
if (*p == '/') {
/* Temporarily truncate */
*p = '\0';
- if (!CreateDirectoryA(_path, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
+ if (!CreateDirectoryA(_path.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
return false;
}
@@ -208,7 +200,7 @@ bool mkdir_p(string &path) {
}
}
- if (!CreateDirectoryA(_path, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
+ if (!CreateDirectoryA(_path.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS) {
return false;
}
diff --git a/layeredfs/modpath_handler.h b/src/modpath_handler.h
similarity index 91%
rename from layeredfs/modpath_handler.h
rename to src/modpath_handler.h
index 7b77b77..04ebac8 100644
--- a/layeredfs/modpath_handler.h
+++ b/src/modpath_handler.h
@@ -24,4 +24,4 @@ optional normalise_path(string &path);
optional find_first_modfile(const string &norm_path);
optional find_first_modfolder(const string &norm_path);
vector find_all_modfile(const string &norm_path);
-bool mkdir_p(string &path);
\ No newline at end of file
+bool mkdir_p(const string &path);
diff --git a/layeredfs/playpen.cpp b/src/playpen.cpp
similarity index 95%
rename from layeredfs/playpen.cpp
rename to src/playpen.cpp
index 9c640d4..5fad439 100644
--- a/layeredfs/playpen.cpp
+++ b/src/playpen.cpp
@@ -371,7 +371,7 @@ void boot_avs(void) {
}
LONG WINAPI exc_handler(_EXCEPTION_POINTERS *ExceptionInfo) {
- fprintf(stderr, "Unhandled exception %X\n", ExceptionInfo->ExceptionRecord->ExceptionCode);
+ fprintf(stderr, "Unhandled exception %lX\n", ExceptionInfo->ExceptionRecord->ExceptionCode);
return EXCEPTION_CONTINUE_SEARCH;
}
diff --git a/layeredfs/ramfs_demangler.cpp b/src/ramfs_demangler.cpp
similarity index 96%
rename from layeredfs/ramfs_demangler.cpp
rename to src/ramfs_demangler.cpp
index 275a30a..54eb9b0 100644
--- a/layeredfs/ramfs_demangler.cpp
+++ b/src/ramfs_demangler.cpp
@@ -38,7 +38,7 @@
#include "ramfs_demangler.h"
#include "log.hpp"
-#include "utils.h"
+#include "utils.hpp"
#include "winxp_mutex.hpp"
using namespace std;
diff --git a/layeredfs/ramfs_demangler.h b/src/ramfs_demangler.h
similarity index 100%
rename from layeredfs/ramfs_demangler.h
rename to src/ramfs_demangler.h
diff --git a/layeredfs/texbin.cpp b/src/texbin.cpp
similarity index 95%
rename from layeredfs/texbin.cpp
rename to src/texbin.cpp
index 00a6cc4..68091e8 100644
--- a/layeredfs/texbin.cpp
+++ b/src/texbin.cpp
@@ -288,7 +288,7 @@ uint32_t hash_name(const char *name) {
for(; *name; name++) {
for (int i = 0; i <= 5; i++) {
- hash = (hash >> 31) & 0x4C11DB7 ^ ((hash << 1) | ((*name >> i) & 1));
+ hash = ((hash >> 31) & 0x4C11DB7) ^ ((hash << 1) | ((*name >> i) & 1));
}
}
@@ -398,7 +398,7 @@ void Texbin::debug() {
total += (uint32_t)image.tex.size();
}
- for(auto &[name, rect] : rects) {
+ for([[maybe_unused]] auto &[_name, rect] : rects) {
VLOG("rect: %s parent %s dims (%d,%d,%d,%d)\n",
name.c_str(), rect.parent_name.c_str(),
rect.x, rect.y, rect.w, rect.h
@@ -893,7 +893,7 @@ vector texbin_lz77_compress(const vector &data) {
}
uint32_t length = 2;
- int32_t dict_i = 0;
+ int32_t dict_pos = 0;
if (data_i + 2 < data.size()) {
uint32_t value;
@@ -927,17 +927,17 @@ vector texbin_lz77_compress(const vector &data) {
if (match_len > length && match_len < output.size())
{
length = match_len;
- dict_i = index;
+ dict_pos = index;
}
}
}
if (length > 2)
{
- output.push_back(dict_i);
+ output.push_back(dict_pos);
uint32_t niblo = (length - 3) & 0xf;
- uint32_t nibhi = (dict_i >> 4) & 0xf0;
+ uint32_t nibhi = (dict_pos >> 4) & 0xf0;
output.push_back((niblo | nibhi));
}
diff --git a/layeredfs/texbin.hpp b/src/texbin.hpp
similarity index 100%
rename from layeredfs/texbin.hpp
rename to src/texbin.hpp
diff --git a/layeredfs/texture_packer.cpp b/src/texture_packer.cpp
similarity index 93%
rename from layeredfs/texture_packer.cpp
rename to src/texture_packer.cpp
index b1c6864..9148b79 100644
--- a/layeredfs/texture_packer.cpp
+++ b/src/texture_packer.cpp
@@ -6,12 +6,6 @@
using namespace rbp;
-Bitmap::Bitmap(const string& name, int width, int height)
- : width(width), height(height), name(name)
-{
-
-}
-
bool pack_textures(vector &textures, vector &packed_textures) {
std::sort(textures.begin(), textures.end(), [](const Bitmap* a, const Bitmap* b) {
return (a->width * a->height) < (b->width * b->height);
@@ -68,4 +62,4 @@ void Packer::Pack(vector &bitmaps)
width /= 2;
while (height / 2 >= hh)
height /= 2;
-}
\ No newline at end of file
+}
diff --git a/layeredfs/texture_packer.h b/src/texture_packer.h
similarity index 77%
rename from layeredfs/texture_packer.h
rename to src/texture_packer.h
index f316126..4606c11 100644
--- a/layeredfs/texture_packer.h
+++ b/src/texture_packer.h
@@ -15,7 +15,9 @@ struct Bitmap
int height;
int packX;
int packY;
- Bitmap(const string& name, int width, int height);
+ Bitmap(const string& name, int width, int height)
+ : name(name), width(width), height(height)
+ {}
};
struct Packer
@@ -29,4 +31,4 @@ struct Packer
void Pack(vector &bitmaps);
};
-bool pack_textures(vector &textures, vector &packed_textures);
\ No newline at end of file
+bool pack_textures(vector &textures, vector &packed_textures);
diff --git a/layeredfs/utils.cpp b/src/utils.cpp
similarity index 94%
rename from layeredfs/utils.cpp
rename to src/utils.cpp
index 1d131f7..e3498b6 100644
--- a/layeredfs/utils.cpp
+++ b/src/utils.cpp
@@ -1,7 +1,7 @@
#include
#include
-#include "utils.h"
+#include "utils.hpp"
#include "avs.h"
char* snprintf_auto(const char* fmt, ...) {
@@ -98,7 +98,8 @@ bool folder_exists(const char* name) {
void str_tolower_inline(char* str) {
while (*str) {
- *str++ = tolower(*str);
+ *str = tolower(*str);
+ str++;
}
}
diff --git a/layeredfs/utils.h b/src/utils.hpp
similarity index 100%
rename from layeredfs/utils.h
rename to src/utils.hpp
diff --git a/layeredfs/winxp_mutex.hpp b/src/winxp_mutex.hpp
similarity index 100%
rename from layeredfs/winxp_mutex.hpp
rename to src/winxp_mutex.hpp