Parse version number from a string and provide it to the runtime
This commit is contained in:
parent
2c23d5f29b
commit
be70a2a8f1
|
@ -58,7 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-left">
|
<div class="bottom-left">
|
||||||
<label>{{version_number}}</label>
|
<label>v{{version_number}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5699906f34fcc82905303092d081ad92aa74f926
|
Subproject commit 09f5759d3a68437d407d54922e3fddf0c52f4dad
|
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
#include "../../lib/rt64/src/contrib/stb/stb_image.h"
|
#include "../../lib/rt64/src/contrib/stb/stb_image.h"
|
||||||
|
|
||||||
|
const std::string version_string = "1.2.0-dev";
|
||||||
|
|
||||||
template<typename... Ts>
|
template<typename... Ts>
|
||||||
void exit_error(const char* str, Ts ...args) {
|
void exit_error(const char* str, Ts ...args) {
|
||||||
// TODO pop up an error
|
// TODO pop up an error
|
||||||
|
@ -527,6 +529,12 @@ void release_preload(PreloadContext& context) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
recomp::Version project_version{};
|
||||||
|
if (!recomp::Version::from_string(version_string, project_version)) {
|
||||||
|
ultramodern::error_handling::message_box(("Invalid version string: " + version_string).c_str());
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Map this executable into memory and lock it, which should keep it in physical memory. This ensures
|
// Map this executable into memory and lock it, which should keep it in physical memory. This ensures
|
||||||
// that there are no stutters from the OS having to load new pages of the executable whenever a new code page is run.
|
// that there are no stutters from the OS having to load new pages of the executable whenever a new code page is run.
|
||||||
PreloadContext preload_context;
|
PreloadContext preload_context;
|
||||||
|
@ -625,6 +633,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
recomp::start(
|
recomp::start(
|
||||||
64 * 1024 * 1024, // 64MB to have plenty of room for loading mods
|
64 * 1024 * 1024, // 64MB to have plenty of room for loading mods
|
||||||
|
project_version,
|
||||||
{},
|
{},
|
||||||
rsp_callbacks,
|
rsp_callbacks,
|
||||||
renderer_callbacks,
|
renderer_callbacks,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "nfd.h"
|
#include "nfd.h"
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
std::string version_number = "v1.1.1";
|
static std::string version_string;
|
||||||
|
|
||||||
Rml::DataModelHandle model_handle;
|
Rml::DataModelHandle model_handle;
|
||||||
bool mm_rom_valid = false;
|
bool mm_rom_valid = false;
|
||||||
|
@ -103,7 +103,9 @@ public:
|
||||||
Rml::DataModelConstructor constructor = context->CreateDataModel("launcher_model");
|
Rml::DataModelConstructor constructor = context->CreateDataModel("launcher_model");
|
||||||
|
|
||||||
constructor.Bind("mm_rom_valid", &mm_rom_valid);
|
constructor.Bind("mm_rom_valid", &mm_rom_valid);
|
||||||
constructor.Bind("version_number", &version_number);
|
|
||||||
|
version_string = recomp::get_project_version().to_string();
|
||||||
|
constructor.Bind("version_number", &version_string);
|
||||||
|
|
||||||
model_handle = constructor.GetModelHandle();
|
model_handle = constructor.GetModelHandle();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue