From bf7bc6d9e93d670851b14fe6be3436feb08ba416 Mon Sep 17 00:00:00 2001 From: Angad Date: Tue, 12 Sep 2023 21:51:47 -0700 Subject: [PATCH] Fix template --- CMakePresets.json | 11 ++++++----- cmake/Plugin.h.in | 8 +++++--- include/Plugin.h | 8 +++++--- src/Main.cpp | 6 +++--- src/Settings.cpp | 6 +++++- vcpkg.json | 2 +- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index f29f125..ef03870 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -11,7 +11,8 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": "$env{COMMONLIBSF_COMPILER} $env{COMMONLIBSF_PLATFORM} $env{COMMONLIBSF_TEXT}", - "CMAKE_SHARED_LINKER_FLAGS": "$env{COMMONLIBSF_LINKER}" + "CMAKE_SHARED_LINKER_FLAGS": "$env{COMMONLIBSF_LINKER}", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>DLL" } }, { @@ -19,8 +20,8 @@ "hidden": true, "cacheVariables": { "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", - "VCPKG_TARGET_TRIPLET": "x64-windows", - "VCPKG_HOST_TRIPLET": "x64-windows", + "VCPKG_TARGET_TRIPLET": "x64-windows-static-md", + "VCPKG_HOST_TRIPLET": "x64-windows-static-md", "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/cmake" } }, @@ -49,9 +50,9 @@ "COMMONLIBSF_LINKER": "/CGTHREADS:8 /MACHINE:x64 /DEBUG:FULL" }, "cacheVariables": { - "CMAKE_CXX_FLAGS_RELWITHDEBINFO": "/fp:fast /GL /GR- /Gw /O2 /Ob3 /Qpar /MD", + "CMAKE_CXX_FLAGS_RELWITHDEBINFO": "/fp:fast /GL /GR- /Gw /O2 /Ob3 /Qpar", "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO": "/LTCG:INCREMENTAL /OPT:REF,ICF=4", - "CMAKE_CXX_FLAGS_DEBUG": "/Od /MDd", + "CMAKE_CXX_FLAGS_DEBUG": "/Od", "CMAKE_SHARED_LINKER_FLAGS_DEBUG": "/DEBUGTYPE:FIXUP" }, "vendor": { diff --git a/cmake/Plugin.h.in b/cmake/Plugin.h.in index 48d154b..149df00 100644 --- a/cmake/Plugin.h.in +++ b/cmake/Plugin.h.in @@ -1,8 +1,10 @@ #pragma once +using namespace std::string_view_literals; + namespace Plugin { - static constexpr auto Name = "@PROJECT_NAME@"; - static constexpr auto Author = "AuthorName"; - static constexpr auto Version = @PROJECT_VERSION_MAJOR@u * 10000 + @PROJECT_VERSION_MINOR@u * 100 + @PROJECT_VERSION_PATCH@u; + static constexpr auto Name = "PluginName"sv; + static constexpr auto Author = "AuthorName"sv; + static constexpr auto Version = REL::Version{ @PROJECT_VERSION_MAJOR@, @PROJECT_VERSION_MINOR@, @PROJECT_VERSION_PATCH@, 0 }; } // namespace Plugin diff --git a/include/Plugin.h b/include/Plugin.h index 4a4cdfe..2488ab3 100644 --- a/include/Plugin.h +++ b/include/Plugin.h @@ -1,8 +1,10 @@ #pragma once +using namespace std::string_view_literals; + namespace Plugin { - static constexpr auto Name = "PluginName"; - static constexpr auto Author = "AuthorName"; - static constexpr auto Version = 0u * 10000 + 0u * 100 + 1u; + static constexpr auto Name = "PluginName"sv; + static constexpr auto Author = "AuthorName"sv; + static constexpr auto Version = REL::Version{ 0, 0, 1, 0 }; } // namespace Plugin diff --git a/src/Main.cpp b/src/Main.cpp index a74935a..57ad0bc 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -15,7 +15,7 @@ SFSEPluginLoad(const SFSE::LoadInterface* sfse) { InitializeLogging(); - logger::info("{} {} is loading...", Plugin::Name, Plugin::Version); + logger::info("{} {} is loading...", Plugin::Name, Plugin::Version.string("."sv)); Init(sfse); @@ -30,10 +30,10 @@ SFSEPluginLoad(const SFSE::LoadInterface* sfse) SFSEPluginVersion = []() noexcept { SFSE::PluginVersionData data{}; - data.PluginVersion(Plugin::Version); + data.PluginVersion(Plugin::Version.pack()); data.PluginName(Plugin::Name); data.AuthorName(Plugin::Author); - data.UsesSigScanning(false); + data.UsesSigScanning(true); data.HasNoStructUse(true); data.CompatibleVersions({ SFSE::RUNTIME_LATEST }); diff --git a/src/Settings.cpp b/src/Settings.cpp index 1a4a66b..9dca8f8 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -7,7 +7,11 @@ void Settings::LoadSettings() noexcept CSimpleIniA ini; ini.SetUnicode(); - ini.LoadFile(R"(.\Data\SFSE\Plugins\PluginName.ini)"); + if (ini.LoadFile(R"(.\Data\SFSE\Plugins\PluginName.ini)") <=> 0 < 0) + { + logger::error("ERROR: Failed to load ini"); + return; + } debug_logging = ini.GetBoolValue("Log", "Debug"); diff --git a/vcpkg.json b/vcpkg.json index f1d42ad..54baee9 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,7 +14,7 @@ { "kind": "git", "repository": "https://github.com/Starfield-Reverse-Engineering/Starfield-RE-vcpkg", - "baseline": "9e739fd13c18190e71e54a6bab300c666ae1041d", + "baseline": "5f9859537f348417963ac2d28f3f8242685a943f", "packages": ["commonlibsf"] } ]