Logging Changes
This commit is contained in:
parent
006243d02f
commit
b3b935dd1d
@ -78,14 +78,14 @@ static void load(char **ld_preload, char *folder) {
|
|||||||
// Add Terminator
|
// Add Terminator
|
||||||
name[total_length] = '\0';
|
name[total_length] = '\0';
|
||||||
|
|
||||||
// Check If File Is Executable
|
// Check If File Is Accessible
|
||||||
int result = access(name, R_OK);
|
int result = access(name, R_OK);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
// Add To LD_PRELOAD
|
// Add To LD_PRELOAD
|
||||||
string_append(ld_preload, "%s%s", *ld_preload == NULL ? "" : ":", name);
|
string_append(ld_preload, "%s%s", *ld_preload == NULL ? "" : ":", name);
|
||||||
} else if (result == -1 && errno != 0) {
|
} else if (result == -1 && errno != 0) {
|
||||||
// Fail
|
// Fail
|
||||||
INFO("Unable To Acesss: %s: %s", name, strerror(errno));
|
WARN("Unable To Acesss: %s: %s", name, strerror(errno));
|
||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ void media_take_screenshot(char *home) {
|
|||||||
|
|
||||||
// Save Image
|
// Save Image
|
||||||
if (save_png(file, pixels, line_size, width, height)) {
|
if (save_png(file, pixels, line_size, width, height)) {
|
||||||
INFO("Screenshot Failed: %s", file);
|
WARN("Screenshot Failed: %s", file);
|
||||||
} else {
|
} else {
|
||||||
INFO("Screenshot Saved: %s", file);
|
INFO("Screenshot Saved: %s", file);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ static int is_survival = -1;
|
|||||||
// Patch Game Mode
|
// Patch Game Mode
|
||||||
static void set_is_survival(int new_is_survival) {
|
static void set_is_survival(int new_is_survival) {
|
||||||
if (is_survival != new_is_survival) {
|
if (is_survival != new_is_survival) {
|
||||||
INFO("Setting Game Mode: %s", new_is_survival ? "Survival" : "Creative");
|
DEBUG("Setting Game Mode: %s", new_is_survival ? "Survival" : "Creative");
|
||||||
|
|
||||||
// Correct Inventpry UI
|
// Correct Inventpry UI
|
||||||
unsigned char inventory_patch[4] = {new_is_survival ? 0x00 : 0x01, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1"
|
unsigned char inventory_patch[4] = {new_is_survival ? 0x00 : 0x01, 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1"
|
||||||
|
@ -12,7 +12,6 @@ static bool LevelData_getSpawnMobs_injection(__attribute__((unused)) unsigned ch
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MCPI_SERVER_MODE
|
|
||||||
// Get Custom Render Distance
|
// Get Custom Render Distance
|
||||||
static int get_render_distance() {
|
static int get_render_distance() {
|
||||||
char *distance_str = getenv("MCPI_RENDER_DISTANCE");
|
char *distance_str = getenv("MCPI_RENDER_DISTANCE");
|
||||||
@ -31,7 +30,6 @@ static int get_render_distance() {
|
|||||||
ERR("Invalid Render Distance: %s", distance_str);
|
ERR("Invalid Render Distance: %s", distance_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Get Custom Username
|
// Get Custom Username
|
||||||
static char *get_username() {
|
static char *get_username() {
|
||||||
@ -91,12 +89,8 @@ void init_options() {
|
|||||||
// 3D Anaglyph
|
// 3D Anaglyph
|
||||||
anaglyph = feature_has("3D Anaglyph", server_disabled);
|
anaglyph = feature_has("3D Anaglyph", server_disabled);
|
||||||
// Render Distance
|
// Render Distance
|
||||||
#ifndef MCPI_SERVER_MODE
|
|
||||||
render_distance = get_render_distance();
|
render_distance = get_render_distance();
|
||||||
INFO("Setting Render Distance: %i", render_distance);
|
DEBUG("Setting Render Distance: %i", render_distance);
|
||||||
#else
|
|
||||||
render_distance = 3;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set Options
|
// Set Options
|
||||||
overwrite_calls((void *) Options_initDefaultValue, (void *) Options_initDefaultValue_injection);
|
overwrite_calls((void *) Options_initDefaultValue, (void *) Options_initDefaultValue_injection);
|
||||||
@ -104,9 +98,7 @@ void init_options() {
|
|||||||
|
|
||||||
// Change Username
|
// Change Username
|
||||||
const char *username = get_username();
|
const char *username = get_username();
|
||||||
#ifndef MCPI_SERVER_MODE
|
DEBUG("Setting Username: %s", username);
|
||||||
INFO("Setting Username: %s", username);
|
|
||||||
#endif
|
|
||||||
if (strcmp(*default_username, "StevePi") != 0) {
|
if (strcmp(*default_username, "StevePi") != 0) {
|
||||||
ERR("Default Username Is Invalid");
|
ERR("Default Username Is Invalid");
|
||||||
}
|
}
|
||||||
|
@ -585,5 +585,6 @@ static void server_init() {
|
|||||||
void init_server() {
|
void init_server() {
|
||||||
server_init();
|
server_init();
|
||||||
setenv("MCPI_FEATURE_FLAGS", get_features(), 1);
|
setenv("MCPI_FEATURE_FLAGS", get_features(), 1);
|
||||||
|
setenv("MCPI_RENDER_DISTANCE", "Tiny", 1);
|
||||||
setenv("MCPI_USERNAME", get_motd().c_str(), 1);
|
setenv("MCPI_USERNAME", get_motd().c_str(), 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user