38 lines
1013 B
C++
Raw Normal View History

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
char *version_get() {
2024-04-02 19:22:01 -04:00
static char *version = nullptr;
2021-06-28 16:00:52 -04:00
// Load
2024-04-02 19:22:01 -04:00
if (version == nullptr) {
2024-01-07 02:59:04 -05:00
safe_asprintf(&version, "%s / Reborn v%s", Strings_minecraft_pi_version, reborn_get_version());
2021-06-28 16:00:52 -04:00
}
// Return
return version;
}
// Free
__attribute__((destructor)) static void _free_version() {
free(version_get());
}
// Injection For Touch GUI Version
static std::string Common_getGameVersionString_injection(__attribute__((unused)) std::string const& version_suffix) {
// Set Version
return version_get();
}
// Init
void init_version() {
// Touch GUI
overwrite((void *) Common_getGameVersionString, (void *) Common_getGameVersionString_injection);
// Normal GUI
2024-01-07 02:59:04 -05:00
patch_address((void *) Strings_minecraft_pi_version_pointer, 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
}