Show Reborn Version In Start Screen
minecraft-pi-reborn/pipeline/head This commit looks good
Details
minecraft-pi-reborn/pipeline/head This commit looks good
Details
parent
2b0d1d55ff
commit
053bf4aa5f
@ -0,0 +1,2 @@
|
||||
# ``version`` Mod
|
||||
This mod adds the MCPI-Reborn version to the start screen.
|
@ -0,0 +1,34 @@
|
||||
#include <libreborn/libreborn.h>
|
||||
#include <libreborn/minecraft.h>
|
||||
|
||||
#include "version.h"
|
||||
#include "../init/init.h"
|
||||
|
||||
// Get New Version
|
||||
char *version_get() {
|
||||
static char *version = NULL;
|
||||
// Load
|
||||
if (version == NULL) {
|
||||
safe_asprintf(&version, "%s / Reborn v" VERSION, *minecraft_pi_version);
|
||||
}
|
||||
// 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
|
||||
patch_address((void *) minecraft_pi_version, version_get());
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
char *version_get();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Loading…
Reference in new issue