aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-11-05 12:22:59 +0000
committerGitHub <noreply@github.com>2023-11-05 13:22:59 +0100
commit35581f1ff23c75c10b970d336811215f6ea70dd9 (patch)
tree4a18cfb36a80b28c6e210cde9b88d665d377dc34
parent13f2facdb6b5a556f01e0d04aaa6bda5d2b29417 (diff)
downloadNorthstarLauncher-35581f1ff23c75c10b970d336811215f6ea70dd9.tar.gz
NorthstarLauncher-35581f1ff23c75c10b970d336811215f6ea70dd9.zip
Expose `Northstar.dll` version to squirrel (#558)
Exposes the version number in the form of individual digits to script.
-rw-r--r--NorthstarDLL/squirrel/squirrel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp
index 592cd153..429ef8b0 100644
--- a/NorthstarDLL/squirrel/squirrel.cpp
+++ b/NorthstarDLL/squirrel/squirrel.cpp
@@ -8,6 +8,7 @@
#include "core/tier0.h"
#include "plugins/plugin_abi.h"
#include "plugins/plugins.h"
+#include "ns_version.h"
#include <any>
@@ -256,7 +257,16 @@ template <ScriptContext context> void SquirrelManager<context>::VMCreated(CSquir
defconst(m_pSQVM, pair.first.c_str(), bWasFound);
}
+
defconst(m_pSQVM, "MAX_FOLDER_SIZE", GetMaxSaveFolderSize() / 1024);
+
+ // define squirrel constants for northstar(.dll) version
+ constexpr int version[4] {NORTHSTAR_VERSION};
+ defconst(m_pSQVM, "NS_VERSION_MAJOR", version[0]);
+ defconst(m_pSQVM, "NS_VERSION_MINOR", version[1]);
+ defconst(m_pSQVM, "NS_VERSION_PATCH", version[2]);
+ defconst(m_pSQVM, "NS_VERSION_DEV", version[3]);
+
g_pSquirrel<context>->messageBuffer = new SquirrelMessageBuffer();
g_pPluginManager->InformSQVMCreated(context, newSqvm);
}