2021-06-28 16:00:52 -04:00
|
|
|
#include <libreborn/libreborn.h>
|
2021-09-11 23:18:12 -04:00
|
|
|
#include <symbols/minecraft.h>
|
2021-06-28 16:00:52 -04:00
|
|
|
|
2022-06-25 17:30:08 -04:00
|
|
|
#include <mods/version/version.h>
|
|
|
|
#include <mods/init/init.h>
|
2021-06-28 16:00:52 -04:00
|
|
|
|
|
|
|
// Get New Version
|
2024-06-16 00:47:36 -04:00
|
|
|
const char *version_get() {
|
|
|
|
static std::string version = "";
|
2021-06-28 16:00:52 -04:00
|
|
|
// Load
|
2024-06-16 00:47:36 -04:00
|
|
|
if (version.empty()) {
|
|
|
|
version = std::string(Strings::minecraft_pi_version) + " / Reborn v" + reborn_get_version();
|
2021-06-28 16:00:52 -04:00
|
|
|
}
|
|
|
|
// Return
|
2024-06-16 00:47:36 -04:00
|
|
|
return version.c_str();
|
2021-06-28 16:00:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Injection For Touch GUI Version
|
2024-07-15 03:05:05 -04:00
|
|
|
static std::string Common_getGameVersionString_injection(__attribute__((unused)) Common_getGameVersionString_t original, __attribute__((unused)) const std::string &version_suffix) {
|
2021-06-28 16:00:52 -04:00
|
|
|
// Set Version
|
|
|
|
return version_get();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Init
|
|
|
|
void init_version() {
|
|
|
|
// Touch GUI
|
2024-06-21 01:19:37 -04:00
|
|
|
overwrite_calls(Common_getGameVersionString, Common_getGameVersionString_injection);
|
2021-06-28 16:00:52 -04:00
|
|
|
// Normal GUI
|
2024-06-16 00:47:36 -04:00
|
|
|
patch_address((void *) &Strings::minecraft_pi_version, (void *) version_get());
|
2021-11-13 23:29:48 -05:00
|
|
|
|
|
|
|
// Log
|
|
|
|
INFO("Starting Minecraft: Pi Edition (%s)", version_get());
|
2021-06-28 16:00:52 -04:00
|
|
|
}
|