diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 665d089..663be34 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -22,7 +22,7 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup VS environment
uses: ilammy/msvc-dev-cmd@v1
@@ -43,17 +43,18 @@ jobs:
run: |
cmake --build cmake-build-release --target ${{ matrix.target }}
- - name: Fetch hash list
+ - name: Fetch hash lists
run: |
+ mkdir _rpkg
Invoke-WebRequest -Uri "https://github.com/glacier-modding/Hitman-Hashes/releases/latest/download/latest-hashes.7z" -OutFile "latest-hashes.7z"
+ Invoke-WebRequest -Uri "https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/hash_list.hmla" -OutFile "_rpkg/hash_list.hmla"
- name: Prepare build
run: |
7z e latest-hashes.7z -o_rpkg
cp cmake-build-release/*.dll _rpkg
cp cmake-build-release/*.exe _rpkg
- cp cmake-build-release/*.lib _rpkg
- cp thirdparty/zhmtools/*.dll _rpkg
+ cp cmake-build-release/rpkg*.lib _rpkg
cp thirdparty/quickentity-ffi/*.dll _rpkg
cp thirdparty/assimp/*.dll _rpkg
@@ -69,7 +70,7 @@ jobs:
runs-on: ptlm-runner
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44c4e7f..2f68edf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,45 +1,65 @@
cmake_minimum_required(VERSION 3.22)
project(rpkg VERSION 2.30.0)
+include(FetchContent)
+
+# We need to set the defaults as setting the policy will not
+# persist when adding subdirectories.
+set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
+set(CMAKE_POLICY_DEFAULT_CMP0097 NEW)
+set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
+cmake_policy(SET CMP0077 NEW)
+cmake_policy(SET CMP0097 NEW)
+cmake_policy(SET CMP0135 NEW)
set(CMAKE_CXX_STANDARD 17)
-add_subdirectory(thirdparty/GLTFSDK)
-add_subdirectory(thirdparty/directxtex)
+# rapidjson is here to allow GLTFSDK to use it.
+set(RAPIDJSON_BUILD_DOC OFF)
+set(RAPIDJSON_BUILD_EXAMPLES OFF)
+set(RAPIDJSON_BUILD_TESTS OFF)
+FetchContent_Declare(rjson
+ GIT_REPOSITORY https://github.com/Tencent/rapidjson.git
+ GIT_TAG 516d0473949fdcf0a6dc9fbb40fa92b3b85db184
+ GIT_SUBMODULES ""
+)
-option(WITH_DIRECTX_SUPPORT
- "If DirectX components and support for .PRIM, .TEXT, and .BORG should be compiled. Currently only works on Windows."
- ON
+# GLTFSDK
+FetchContent_Declare(gltfsdk
+ GIT_REPOSITORY https://github.com/microsoft/glTF-SDK.git
+ GIT_TAG r1.9.6.0
)
-if (WITH_DIRECTX_SUPPORT)
- set(lib-directxmath
- thirdparty/directxmath/DirectXCollision.h
- thirdparty/directxmath/DirectXCollision.inl
- thirdparty/directxmath/DirectXColors.h
- thirdparty/directxmath/DirectXMath.h
- thirdparty/directxmath/DirectXMathConvert.inl
- thirdparty/directxmath/DirectXMathMatrix.inl
- thirdparty/directxmath/DirectXMathMisc.inl
- thirdparty/directxmath/DirectXMathVector.inl
- thirdparty/directxmath/DirectXPackedVector.h
- thirdparty/directxmath/DirectXPackedVector.inl
- )
-endif()
-set(lib-json
- thirdparty/json/json.hpp
+# DirectXTex
+set(BUILD_TOOLS OFF)
+set(BUILD_SAMPLE OFF)
+FetchContent_Declare(directxtex
+ GIT_REPOSITORY https://github.com/microsoft/DirectXTex.git
+ GIT_TAG jan2023
)
-set(lib-lz4
- thirdparty/lz4/LICENSE
- thirdparty/lz4/lz4.c
- thirdparty/lz4/lz4.h
- thirdparty/lz4/lz4frame.c
- thirdparty/lz4/lz4frame.h
- thirdparty/lz4/lz4frame_static.h
- thirdparty/lz4/lz4hc.c
- thirdparty/lz4/lz4hc.h
- thirdparty/lz4/xxhash.c
- thirdparty/lz4/xxhash.h
+
+set(ENABLE_UNIT_TESTS OFF)
+set(ENABLE_SAMPLES OFF)
+FetchContent_Declare(directxmath
+ GIT_REPOSITORY https://github.com/microsoft/DirectXMath.git
+ GIT_TAG dec2022
)
+
+# nlohmann json
+FetchContent_Declare(json
+ URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
+ URL_HASH SHA256=8c4b26bf4b422252e13f332bc5e388ec0ab5c3443d24399acb675e68278d341f
+)
+
+# lz4
+set(LZ4_BUILD_CLI OFF)
+set(LZ4_BUILD_LEGACY_LZ4C OFF)
+set(LZ4_BUNDLED_MODE ON)
+FetchContent_Declare(lz4
+ GIT_REPOSITORY https://github.com/lz4/lz4.git
+ GIT_TAG v1.9.4
+ SOURCE_SUBDIR build/cmake
+)
+
set(lib-md5
thirdparty/md5/md5.c
thirdparty/md5/md5.h
@@ -55,45 +75,6 @@ set(lib-ogg
thirdparty/ogg/src/crctable.h
thirdparty/ogg/src/framing.c
)
-set(lib-rapidjson
- thirdparty/rapidjson/error/en.h
- thirdparty/rapidjson/error/error.h
- thirdparty/rapidjson/internal/biginteger.h
- thirdparty/rapidjson/internal/clzll.h
- thirdparty/rapidjson/internal/diyfp.h
- thirdparty/rapidjson/internal/dtoa.h
- thirdparty/rapidjson/internal/ieee754.h
- thirdparty/rapidjson/internal/itoa.h
- thirdparty/rapidjson/internal/meta.h
- thirdparty/rapidjson/internal/pow10.h
- thirdparty/rapidjson/internal/regex.h
- thirdparty/rapidjson/internal/stack.h
- thirdparty/rapidjson/internal/strfunc.h
- thirdparty/rapidjson/internal/strtod.h
- thirdparty/rapidjson/internal/swap.h
- thirdparty/rapidjson/msinttypes/inttypes.h
- thirdparty/rapidjson/msinttypes/stdint.h
- thirdparty/rapidjson/allocators.h
- thirdparty/rapidjson/cursorstreamwrapper.h
- thirdparty/rapidjson/document.h
- thirdparty/rapidjson/encodedstream.h
- thirdparty/rapidjson/encodings.h
- thirdparty/rapidjson/filereadstream.h
- thirdparty/rapidjson/filewritestream.h
- thirdparty/rapidjson/fwd.h
- thirdparty/rapidjson/istreamwrapper.h
- thirdparty/rapidjson/memorybuffer.h
- thirdparty/rapidjson/memorystream.h
- thirdparty/rapidjson/ostreamwrapper.h
- thirdparty/rapidjson/pointer.h
- thirdparty/rapidjson/prettywriter.h
- thirdparty/rapidjson/rapidjson.h
- thirdparty/rapidjson/reader.h
- thirdparty/rapidjson/schema.h
- thirdparty/rapidjson/stream.h
- thirdparty/rapidjson/stringbuffer.h
- thirdparty/rapidjson/writer.h
-)
set(lib-revorb
thirdparty/revorb/revorb.cpp
thirdparty/revorb/revorb.h
@@ -134,39 +115,42 @@ set(lib-ww2ogg
thirdparty/ww2ogg/wwriff.cpp
thirdparty/ww2ogg/wwriff.h
)
-set(lib-yyjson
- thirdparty/yyjson/yyjson.c
- thirdparty/yyjson/yyjson.h
+
+# yyjson
+FetchContent_Declare(yyjson
+ GIT_REPOSITORY https://github.com/ibireme/yyjson.git
+ GIT_TAG 0.7.0
)
-set(lib-zhmtools
- thirdparty/zhmtools/Embind.h
- thirdparty/zhmtools/ResourceConverter.h
- thirdparty/zhmtools/ResourceGenerator.h
- thirdparty/zhmtools/ResourceLib.h
- thirdparty/zhmtools/ResourceLib_HM2.h
- thirdparty/zhmtools/ResourceLib_HM3.h
- thirdparty/zhmtools/ResourceLib_HM2016.h
- thirdparty/zhmtools/ResourceLibCommon.h
+
+# zhmtools/resourcelib
+set(ZHM_BUILD_TOOLS OFF)
+FetchContent_Declare(zhmtools
+ GIT_REPOSITORY https://github.com/OrfeasZ/ZHMTools.git
+ GIT_TAG v3.4.1
)
+
set(lib-quickentity-ffi
thirdparty/quickentity-ffi/quickentity_ffi.dll.h
)
set(thirdparty
-# ${lib-directxmath}
- ${lib-json}
- ${lib-lz4}
${lib-md5}
${lib-mikktspace}
${lib-ogg}
- ${lib-rapidjson}
${lib-revorb}
${lib-vorbis}
${lib-ww2ogg}
- ${lib-yyjson}
- ${lib-zhmtools}
${lib-quickentity-ffi}
)
+# TonyTools
+set(TONYTOOLS_BUILD_TOOLS OFF)
+FetchContent_Declare(tonytools
+ GIT_REPOSITORY https://github.com/AnthonyFuller/TonyTools.git
+ GIT_TAG v1.8.1
+)
+
+FetchContent_MakeAvailable(rjson tonytools gltfsdk directxtex lz4 yyjson json zhmtools directxmath)
+
configure_file(src/version.h.in src/version.h)
set(RPKG_COMMON_SOURCES
@@ -328,11 +312,37 @@ if (MSVC)
target_compile_options(rpkg-cli PUBLIC "/bigobj" "/W3" "/wd4068")
endif()
-target_link_directories(rpkg-cli PUBLIC ${PROJECT_SOURCE_DIR}/thirdparty/zhmtools ${PROJECT_SOURCE_DIR}/thirdparty/quickentity-ffi)
-target_link_libraries(rpkg-cli PUBLIC GLTFSDK DirectXTex ResourceLib_HM2 ResourceLib_HM2016 ResourceLib_HM3 quickentity_ffi.dll.lib)
+target_link_directories(rpkg-cli PUBLIC ${PROJECT_SOURCE_DIR}/thirdparty/quickentity-ffi)
+target_include_directories(rpkg-lib PUBLIC rapidjson)
+target_link_libraries(rpkg-cli PUBLIC
+ GLTFSDK
+ DirectXTex
+ DirectXMath
+ lz4_static
+ yyjson
+ nlohmann_json::nlohmann_json
+ ResourceLib_HM2
+ ResourceLib_HM2016
+ ResourceLib_HM3
+ quickentity_ffi.dll.lib
+ TonyTools::HMLanguages
+)
-target_link_directories(rpkg-lib PUBLIC ${PROJECT_SOURCE_DIR}/thirdparty/zhmtools ${PROJECT_SOURCE_DIR}/thirdparty/quickentity-ffi)
-target_link_libraries(rpkg-lib PUBLIC GLTFSDK DirectXTex ResourceLib_HM2 ResourceLib_HM2016 ResourceLib_HM3 quickentity_ffi.dll.lib)
+target_link_directories(rpkg-lib PUBLIC ${PROJECT_SOURCE_DIR}/thirdparty/quickentity-ffi)
+target_include_directories(rpkg-lib PUBLIC rapidjson)
+target_link_libraries(rpkg-lib PUBLIC
+ GLTFSDK
+ DirectXTex
+ DirectXMath
+ lz4_static
+ yyjson
+ nlohmann_json::nlohmann_json
+ ResourceLib_HM2
+ ResourceLib_HM2016
+ ResourceLib_HM3
+ quickentity_ffi.dll.lib
+ TonyTools::HMLanguages
+)
include_directories(${CMAKE_SOURCE_DIR})
# Pre-processed version header file (on configure step, before build)
diff --git a/rpkg-gui/DownloadExtractionProgress.xaml.cs b/rpkg-gui/DownloadExtractionProgress.xaml.cs
index bf73a28..6c5c4b5 100644
--- a/rpkg-gui/DownloadExtractionProgress.xaml.cs
+++ b/rpkg-gui/DownloadExtractionProgress.xaml.cs
@@ -19,9 +19,14 @@
using System.ComponentModel;
using MahApps.Metro.Controls;
using ControlzEx.Theming;
+using System.Text.Json;
namespace rpkg
{
+ public class HMLAVersion {
+ public int version { get; set; }
+ }
+
///
/// Interaction logic for DownloadExtractionProgress.xaml
///
@@ -56,6 +61,18 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
webClient.DownloadFileAsync(uri, "latest-hashes.7z");
}
+ else if (operation == 3)
+ {
+ WebClient webClient = new WebClient();
+
+ webClient.DownloadProgressChanged += WebClient_DownloadProgressChanged;
+
+ webClient.DownloadFileCompleted += WebClient_DownloadFileCompleted;
+
+ Uri uri = new Uri("https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/hash_list.hmla");
+
+ webClient.DownloadFileAsync(uri, "hash_list.hmla");
+ }
else
{
BackgroundWorker worker = new BackgroundWorker();
@@ -103,6 +120,14 @@ void worker_DoWork(object sender, DoWorkEventArgs e)
int.TryParse(http.GetAsync("https://github.com/glacier-modding/Hitman-Hashes/releases/latest/download/version").Result.Content.ReadAsStringAsync().Result, out currentVersionAvailable);
}
+ else if (operation == 4)
+ {
+ HttpClient http = new HttpClient() { Timeout = TimeSpan.FromSeconds(10) };
+
+ string data = http.GetAsync("https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/version.json").Result.Content.ReadAsStringAsync().Result;
+ dynamic json = JsonSerializer.Deserialize(data);
+ currentVersionAvailable = json.version;
+ }
}
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
diff --git a/rpkg-gui/MainWindow.xaml b/rpkg-gui/MainWindow.xaml
index d1e9082..b9c1eff 100644
--- a/rpkg-gui/MainWindow.xaml
+++ b/rpkg-gui/MainWindow.xaml
@@ -615,7 +615,12 @@
-
+
+
+
+
+
+
diff --git a/rpkg-gui/MainWindow.xaml.cs b/rpkg-gui/MainWindow.xaml.cs
index 3d61afc..41e7cdc 100644
--- a/rpkg-gui/MainWindow.xaml.cs
+++ b/rpkg-gui/MainWindow.xaml.cs
@@ -156,6 +156,14 @@ private void DownloadExtractHashList()
downloadExtractionProgress2.ShowDialog();
}
+ private void DownloadHMLAHashList()
+ {
+ DownloadExtractionProgress downloadExtractionProgress = new DownloadExtractionProgress();
+ downloadExtractionProgress.operation = 3;
+ downloadExtractionProgress.message.Content = "Downloading https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/hash_list.hmla...";
+ downloadExtractionProgress.ShowDialog();
+ }
+
private void Window_Loaded(object sender, RoutedEventArgs e)
{
AddHandlers();
@@ -247,6 +255,63 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
}
}
+ if (!File.Exists("hash_list.hmla")) {
+ MessageQuestion messageBox = new MessageQuestion();
+ messageBox.message.Content = "Error: The localisation hash list file (hash__list.hmla) is missing.\n\nIt improves the localisation experience greatly.\n\nClick OK to automatically download it.\n\nYou can also download it manually from https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/hash_list.hmla and place it next to the program.";
+ messageBox.ShowDialog();
+
+ if (messageBox.buttonPressed == "OKButton")
+ {
+ DownloadHMLAHashList();
+ System.Windows.Forms.Application.Restart();
+
+ if (discordOn)
+ {
+ Client.Dispose();
+ }
+
+ Environment.Exit(0);
+ }
+ else if (messageBox.buttonPressed == "CancelButton")
+ {
+ if (discordOn)
+ {
+ Client.Dispose();
+ }
+
+ Environment.Exit(0);
+ }
+ }
+
+ uint hmla_version = load_hmla_hash_list(AppDomain.CurrentDomain.BaseDirectory + "\\hash_list.hmla");
+ if (hmla_version != uint.MaxValue) {
+ DownloadExtractionProgress downloadExtractionProgress2 = new DownloadExtractionProgress();
+ downloadExtractionProgress2.operation = 4;
+ downloadExtractionProgress2.ProgressBar.IsIndeterminate = true;
+ downloadExtractionProgress2.message.Content = "Checking https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/version.json to see if a new hash list is available...";
+ downloadExtractionProgress2.ShowDialog();
+
+ if (hmla_version < downloadExtractionProgress2.currentVersionAvailable)
+ {
+ MessageQuestion messageBox = new MessageQuestion();
+ messageBox.message.Content = "There is a new version of the localisation hash list available.\n\nClick OK to automatically update to the latest version.";
+ messageBox.ShowDialog();
+
+ if (messageBox.buttonPressed == "OKButton")
+ {
+ DownloadHMLAHashList();
+ System.Windows.Forms.Application.Restart();
+
+ if (discordOn)
+ {
+ Client.Dispose();
+ }
+
+ Environment.Exit(0);
+ }
+ }
+ }
+
var item = new System.Windows.Forms.TreeNode();
item.Text = "Click";
MainTreeView.Nodes.Add(item);
@@ -4894,7 +4959,7 @@ public enum EntityDeepSearchCategory
public delegate int execute_get_hashes_with_no_reverse_depends(string rpkg_file);
public delegate int execute_get_direct_hash_depends(string rpkg_file, string hash_string);
public delegate int execute_task(string csharp_command, string csharp_input_path, string csharp_filter, string search, string search_type, string csharp_output_path);
- public delegate int execute_deep_search_localization(string input_path, string search_value, int search_dlge, int search_locr, int search_rtlv, int max_results);
+ public delegate int execute_deep_search_localization(string input_path, string search_value, int search_dlge, int search_locr, int search_rtlv, int max_results, string version);
public delegate int execute_deep_search_entities(string input_path, string[] search_strings, int[] search_types, int[] search_categories, int search_strings_count, int max_results, int store_jsons, int use_latest_hashes);
[DllImport("rpkg-lib.dll", EntryPoint = "task_execute", CallingConvention = CallingConvention.Cdecl)]
@@ -4977,6 +5042,9 @@ public static extern UInt32 generate_localization_line_string(string rpkg_file_n
[DllImport("rpkg-lib.dll", EntryPoint = "load_hash_list", CallingConvention = CallingConvention.Cdecl)]
public static extern int load_hash_list(string path);
+ [DllImport("rpkg-lib.dll", EntryPoint = "load_hmla_hash_list", CallingConvention = CallingConvention.Cdecl)]
+ public static extern uint load_hmla_hash_list(string path);
+
[DllImport("rpkg-lib.dll", EntryPoint = "get_hash_list_string", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr get_hash_list_string(string hash_string);
@@ -5070,7 +5138,7 @@ public static extern int modify_hash_depends(string rpkg_file, string hash_strin
[DllImport("rpkg-lib.dll", EntryPoint = "deep_search_localization", CallingConvention = CallingConvention.Cdecl)]
public static extern int deep_search_localization(string input_path, string search_value, int search_dlge,
- int search_locr, int search_rtlv, int max_results);
+ int search_locr, int search_rtlv, int max_results, string version);
[DllImport("rpkg-lib.dll", EntryPoint = "get_localization_search_results_size",
CallingConvention = CallingConvention.Cdecl)]
@@ -8399,7 +8467,16 @@ private void DeepSearchLocalizationButton_Click(object sender, RoutedEventArgs e
maxSearchResults = 100;
}
- IAsyncResult ar = rpkgExecute.BeginInvoke(input_path, DeepSearchLocalizationTextBox.Text, search_dlge, search_locr, search_rtlv, maxSearchResults, null, null);
+ string version = DeepSearchLocalizationVersionComboBox.Text switch
+ {
+ "Hitman 2016" => "HM2016",
+ "Hitman 2" => "HM2",
+ "Hitman 3" => "HM3",
+ _ => "HM3"
+ };
+
+
+ IAsyncResult ar = rpkgExecute.BeginInvoke(input_path, DeepSearchLocalizationTextBox.Text, search_dlge, search_locr, search_rtlv, maxSearchResults, version, null, null);
deepSearchLocalizationWorker = new BackgroundWorker();
deepSearchLocalizationWorker.WorkerReportsProgress = true;
diff --git a/rpkg-gui/rpkg-gui.csproj b/rpkg-gui/rpkg-gui.csproj
index 92c4b9c..3c2f20e 100644
--- a/rpkg-gui/rpkg-gui.csproj
+++ b/rpkg-gui/rpkg-gui.csproj
@@ -48,7 +48,7 @@
true
full
x64
- 7.3
+ 8.0
prompt
@@ -57,7 +57,7 @@
true
true
x64
- 7.3
+ 8.0
prompt
true
pdbonly
diff --git a/src/asva.cpp b/src/asva.cpp
index db11990..2cc8c61 100644
--- a/src/asva.cpp
+++ b/src/asva.cpp
@@ -6,7 +6,7 @@
#include "crypto.h"
#include "util.h"
#include "file.h"
-#include "thirdparty/lz4/lz4.h"
+#include
#include
#include