Compare commits

...

2 Commits

Author SHA1 Message Date
281f2a4f66 Bumped version to 2.1.4 2025-08-05 23:14:07 +02:00
c2e1fd1c72 Read Enderal version from INI at build time 2025-08-05 23:13:56 +02:00
8 changed files with 53 additions and 34 deletions

View File

@ -1 +1 @@
version = 2.1.3
version = 2.1.4

Binary file not shown.

Binary file not shown.

View File

@ -2,12 +2,17 @@ option(ENABLE_VCPKG OFF)
cmake_minimum_required(VERSION 3.21)
message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")
# Get current version
file(READ "${CMAKE_SOURCE_DIR}/../../SKSE/Plugins/EnderalVersion.ini" CONFIG_CONTENT)
string(REGEX MATCH "version[ \t]*=[ \t]*([0-9.]+)" _ ${CONFIG_CONTENT})
set(VERSION_NUMBER "${CMAKE_MATCH_1}")
########################################################################################################################
## Define project
########################################################################################################################
project(
EnderalSE
VERSION 2.1.4
VERSION ${VERSION_NUMBER}
DESCRIPTION "Enderal SE DLL"
LANGUAGES CXX
)
@ -20,7 +25,7 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY
)
#include(GNUInstallDirs)
file(
@ -78,7 +83,6 @@ FetchContent_MakeAvailable(simpleini)
INCLUDE_DIRECTORIES(${simpleini_SOURCE_DIR})
# rapidcsv
set(RAPIDCSV_INCLUDE_DIRS ${rapidcsv_SOURCE_DIR}/src)
FetchContent_Declare(
rapidcsv
URL "https://github.com/d99kris/rapidcsv/archive/refs/tags/v8.87.tar.gz"

View File

@ -41,6 +41,28 @@ namespace Papyrus::PapyrusFunctions
return NewGameCount();
}
inline std::string GetEnderalVersion(RE::StaticFunctionTag*)
{
const auto pluginVersion = SKSE::PluginDeclaration::GetSingleton()->GetVersion();
std::string versionStr;
if (pluginVersion.build() > 0) {
versionStr = std::format("{}.{}.{}.{}", pluginVersion.major(), pluginVersion.minor(), pluginVersion.patch(), pluginVersion.build());
} else {
versionStr = std::format("{}.{}.{}", pluginVersion.major(), pluginVersion.minor(), pluginVersion.patch());
}
return versionStr;
}
inline std::uint32_t GetEnderalVersionInt(RE::StaticFunctionTag*)
{
const auto pluginVersion = SKSE::PluginDeclaration::GetSingleton()->GetVersion();
std::string versionStr = std::format("{}{}{}{}", pluginVersion.major(), pluginVersion.minor(), pluginVersion.patch(), pluginVersion.build());
return std::stoi(versionStr);
}
inline RE::TESObjectREFR* GetCurrentContainer(RE::StaticFunctionTag*)
{
const auto handle = RE::ContainerMenu::GetTargetRefHandle();
@ -155,6 +177,10 @@ namespace Papyrus::PapyrusFunctions
logger::info("{}", "Registered CreatePotion"sv);
BIND(GetNewGameCount);
logger::info("{}", "Registered GetNewGameCount"sv);
BIND(GetEnderalVersion);
logger::info("{}", "Registered GetEnderalVersion"sv);
BIND(GetEnderalVersionInt);
logger::info("{}", "Registered GetEnderalVersionInt"sv);
BIND(GetCurrentContainer);
logger::info("{}", "Registered GetCurrentContainer"sv);
BIND(GetPlayerFollowers);

View File

@ -26,23 +26,16 @@ inline uint8_t NewGameCount(bool increment = false)
inline void CheckIncompatibleMods()
{
bool bPrinted = false;
if (std::filesystem::exists("Data\\SKSE\\Plugins\\EnderalVersion.ini")) {
CSimpleIniA ini;
ini.SetUnicode(false);
ini.SetMultiKey(false);
ini.LoadFile("Data/SKSE/Plugins/EnderalVersion.ini");
const char* version = ini.GetValue("", "version", "2.0.x");
std::regex version_expr("^[\\d\\.]+$");
if (std::regex_match(version, version_expr)) {
RE::ConsoleLog::GetSingleton()->Print(std::format("Loaded SureAI's Enderal: Forgotten Stories | Special Edition v{} by Eddoursul and contributors", version).c_str());
bPrinted = true;
}
const auto pluginVersion = SKSE::PluginDeclaration::GetSingleton()->GetVersion();
std::string versionStr;
if (pluginVersion.build() > 0) {
versionStr = std::format("{}.{}.{}.{}", pluginVersion.major(), pluginVersion.minor(), pluginVersion.patch(), pluginVersion.build());
} else {
versionStr = std::format("{}.{}.{}", pluginVersion.major(), pluginVersion.minor(), pluginVersion.patch());
}
if (!bPrinted) {
RE::ConsoleLog::GetSingleton()->Print("Loaded SureAI's Enderal: Forgotten Stories | Special Edition v2.0.x by Eddoursul and contributors");
}
RE::ConsoleLog::GetSingleton()->Print(std::format("Loaded SureAI's Enderal: Forgotten Stories | Special Edition v{} by Eddoursul and contributors", versionStr).c_str());
if (RE::BSResourceNiBinaryStream("scripts/_00e_questfunctions.pex").good() || RE::BSResourceNiBinaryStream("scripts/_00e_game_skillmenusc.pex").good() || RE::TESDataHandler::GetSingleton()->LookupForm<RE::TESQuest>(0x10AA2, "Skyrim.esm"))
{
@ -107,7 +100,8 @@ inline void CheckScriptVersions()
std::map<std::string, short> scripts;
scripts["_00e_a2_eyeofthestormsc"] = 1;
scripts["EnderalFunctions"] = 1;
scripts["_00E_EnderalVersion"] = 1;
scripts["EnderalFunctions"] = 2;
scripts["_00E_PlayerFunctions"] = 2;
scripts["_00E_PlayerSetUpScript"] = 1;
scripts["_00E_EngineBugfixAlias"] = 2;

View File

@ -3,19 +3,12 @@ Scriptname _00E_EnderalVersion extends ReferenceAlias Hidden
int iPatchVersion
; Do not make comparisons with GetVersionFull(), versions are not float numbers, use GetVersion().
float function _GetVersionFull() global
; ABCD.E
; A - engine version (1 - LE, 2 - SE)
; B - backward-incompatible update
; C - backward-compatible update
; D - hotfix
; E - build
return 2130.0
endfunction
int function _GetScriptVersion() Global
return 1
endFunction
int function GetVersion() global
return Math.Floor(_GetVersionFull())
return EnderalFunctions.GetEnderalVersionInt()
endfunction
Event OnInit()
@ -27,8 +20,6 @@ EndEvent
Event OnPlayerLoadGame()
if iPatchVersion < GetVersion()
;Utility.Wait(0.1) ; wait for menu mode to end
;
iPatchVersion = GetVersion()
endif

View File

@ -1,7 +1,7 @@
Scriptname EnderalFunctions Hidden
int function _GetScriptVersion() Global
return 1
return 2
endFunction
float function CalculateContentStrength(ObjectReference container) native global
@ -12,6 +12,10 @@ ObjectReference function GetCurrentContainer() native global
int function GetNewGameCount() native global
string function GetEnderalVersion() native global
int function GetEnderalVersionInt() native global
Actor[] function GetPlayerFollowers() native global
String Function GetAutosaveName(int index) native global