Remove libreborn.h: Part 3

This commit is contained in:
TheBrokenRail 2024-11-22 00:22:49 -05:00
parent 57aed4d0b3
commit 596ff01f75
60 changed files with 149 additions and 105 deletions

View File

@ -2,7 +2,6 @@
#include <string> #include <string>
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
extern "C" { extern "C" {

View File

@ -1,7 +1,10 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/util.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <media-layer/core.h> #include <media-layer/core.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>

View File

@ -1,6 +1,10 @@
#include <ctime> #include <ctime>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/util.h>
#include <libreborn/env.h>
#include <libreborn/config.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <media-layer/core.h> #include <media-layer/core.h>
@ -41,7 +45,6 @@ static void start_world(Minecraft *minecraft) {
// Open ProgressScreen // Open ProgressScreen
ProgressScreen *screen = ProgressScreen::allocate(); ProgressScreen *screen = ProgressScreen::allocate();
ALLOC_CHECK(screen);
screen = screen->constructor(); screen = screen->constructor();
minecraft->setScreen((Screen *) screen); minecraft->setScreen((Screen *) screen);
} }

View File

@ -1,4 +1,5 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
@ -22,7 +23,7 @@ static std::string BucketItem_getDescriptionId(__attribute__((unused)) FoodItem
return "item.bucket"; return "item.bucket";
} }
} }
static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, int32_t auxiliary) { static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, const int32_t auxiliary) {
if (auxiliary == Tile::water->id) { if (auxiliary == Tile::water->id) {
return 75; return 75;
} else if (auxiliary == Tile::lava->id) { } else if (auxiliary == Tile::lava->id) {
@ -35,7 +36,7 @@ static int32_t BucketItem_getIcon(__attribute__((unused)) FoodItem *item, int32_
} }
// Filling // Filling
static bool fill_bucket(ItemInstance *item_instance, Player *player, int new_auxiliary) { static bool fill_bucket(ItemInstance *item_instance, const Player *player, const int new_auxiliary) {
bool success = false; bool success = false;
if (item_instance->count == 1) { if (item_instance->count == 1) {
item_instance->auxiliary = new_auxiliary; item_instance->auxiliary = new_auxiliary;
@ -57,7 +58,7 @@ static bool fill_bucket(ItemInstance *item_instance, Player *player, int new_aux
// Use Bucket // Use Bucket
static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInstance *item_instance, Player *player, Level *level, int32_t x, int32_t y, int32_t z, int32_t hit_side, __attribute__((unused)) float hit_x, __attribute__((unused)) float hit_y, __attribute__((unused)) float hit_z) { static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInstance *item_instance, Player *player, Level *level, int32_t x, int32_t y, int32_t z, const int32_t hit_side, __attribute__((unused)) float hit_x, __attribute__((unused)) float hit_y, __attribute__((unused)) float hit_z) {
if (item_instance->count < 1 || item_instance->auxiliary == 1) { if (item_instance->count < 1 || item_instance->auxiliary == 1) {
return 0; return 0;
} else if (item_instance->auxiliary == 0) { } else if (item_instance->auxiliary == 0) {
@ -188,7 +189,6 @@ CUSTOM_VTABLE(bucket, FoodItem) {
static FoodItem *create_bucket(const int32_t id, int32_t texture_x, int32_t texture_y, std::string name) { static FoodItem *create_bucket(const int32_t id, int32_t texture_x, int32_t texture_y, std::string name) {
// Construct // Construct
FoodItem *item = FoodItem::allocate(); FoodItem *item = FoodItem::allocate();
ALLOC_CHECK(item);
Item_constructor->get(false)((Item *) item, id); // FoodItem's Constructor Was Inlined Item_constructor->get(false)((Item *) item, id); // FoodItem's Constructor Was Inlined
// Set VTable // Set VTable
@ -237,7 +237,6 @@ bool Cow_interact_injection(Cow_interact_t original, Cow *self, Player *player)
// Creative Inventory // Creative Inventory
static void inventory_add_item(FillingContainer *inventory, FoodItem *item, int32_t auxiliary) { static void inventory_add_item(FillingContainer *inventory, FoodItem *item, int32_t auxiliary) {
ItemInstance *item_instance = new ItemInstance; ItemInstance *item_instance = new ItemInstance;
ALLOC_CHECK(item_instance);
item_instance = item_instance->constructor_item_extra((Item *) item, 1, auxiliary); item_instance = item_instance->constructor_item_extra((Item *) item, 1, auxiliary);
inventory->addItem(item_instance); inventory->addItem(item_instance);
} }

View File

@ -1,4 +1,3 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
@ -45,7 +44,7 @@ static int Cake_getTexture3(__attribute__((unused)) Tile *tile, LevelSource *lev
// Rendering // Rendering
static bool Cake_isSolidRender(__attribute__((unused)) Tile *tile) { static bool Cake_isSolidRender(__attribute__((unused)) Tile *tile) {
// Stop it from turning other blocks invisable // Stop it from turning other blocks invisable
return 0; return false;
} }
static int Cake_getRenderLayer(__attribute__((unused)) Tile *tile) { static int Cake_getRenderLayer(__attribute__((unused)) Tile *tile) {
@ -70,7 +69,7 @@ static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) {
// Get the size of the slices // Get the size of the slices
int data = level->getData(x, y, z); int data = level->getData(x, y, z);
if (data >= 6) data = 0; if (data >= 6) data = 0;
const float slice_size = (1.0 / 7.0) * (float) data; const float slice_size = (1.0f / 7.0f) * (float) data;
// Corner 1 // Corner 1
AABB *aabb = &tile->aabb; AABB *aabb = &tile->aabb;
@ -79,9 +78,9 @@ static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) {
aabb->z1 = (float) z + CAKE_LEN; aabb->z1 = (float) z + CAKE_LEN;
// Corner 2 // Corner 2
aabb->x2 = (float) x + (1.0 - CAKE_LEN); aabb->x2 = (float) x + (1.0f - CAKE_LEN);
aabb->y2 = (float) y + 0.5; aabb->y2 = (float) y + 0.5f;
aabb->z2 = (float) z + (1.0 - CAKE_LEN) - slice_size; aabb->z2 = (float) z + (1.0f - CAKE_LEN) - slice_size;
return aabb; return aabb;
} }
@ -91,7 +90,7 @@ static void Cake_updateShape(Tile *tile, LevelSource *level, int x, int y, int z
int data = level->getData(x, y, z); int data = level->getData(x, y, z);
if (data >= 6) data = 0; if (data >= 6) data = 0;
// Get slice amount // Get slice amount
const float slice_size = (1.0 / 7.0) * (float) data; const float slice_size = (1.0f / 7.0f) * (float) data;
tile->setShape( tile->setShape(
CAKE_LEN, 0.0, CAKE_LEN, CAKE_LEN, 0.0, CAKE_LEN,
1.0 - CAKE_LEN, 0.5, (1.0 - CAKE_LEN) - slice_size 1.0 - CAKE_LEN, 0.5, (1.0 - CAKE_LEN) - slice_size
@ -118,14 +117,12 @@ static int Cake_use(__attribute__((unused)) Tile *tile, Level *level, int x, int
static void make_cake() { static void make_cake() {
// Construct // Construct
cake = Tile::allocate(); cake = Tile::allocate();
ALLOC_CHECK(cake);
int texture = 122; int texture = 122;
cake->constructor(92, texture, Material::dirt); cake->constructor(92, texture, Material::dirt);
cake->texture = texture; cake->texture = texture;
// Set VTable // Set VTable
cake->vtable = extend_dup_vtable(Tile_vtable::base); cake->vtable = extend_dup_vtable(Tile_vtable::base);
ALLOC_CHECK(cake->vtable);
// Set shape // Set shape
cake->setShape( cake->setShape(
@ -161,7 +158,6 @@ static void Tile_initTiles_injection() {
// Add cake to creative inventory // Add cake to creative inventory
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) { static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
ItemInstance *cake_instance = new ItemInstance; ItemInstance *cake_instance = new ItemInstance;
ALLOC_CHECK(cake_instance);
cake_instance->count = 255; cake_instance->count = 255;
cake_instance->auxiliary = 0; cake_instance->auxiliary = 0;
cake_instance->id = 92; cake_instance->id = 92;

View File

@ -1,4 +1,4 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
@ -17,7 +17,6 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp
// Register TripodCameraRenderer // Register TripodCameraRenderer
TripodCameraRenderer *renderer = TripodCameraRenderer::allocate(); TripodCameraRenderer *renderer = TripodCameraRenderer::allocate();
ALLOC_CHECK(renderer);
renderer->constructor(); renderer->constructor();
dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer); dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer);

View File

@ -1,8 +1,6 @@
#include <string> #include <libreborn/patch.h>
#include <cstring> #include <libreborn/string.h>
#include <cstdio>
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>

View File

@ -1,6 +1,5 @@
#include "chat-internal.h" #include "chat-internal.h"
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/chat/chat.h> #include <mods/chat/chat.h>

View File

@ -1,5 +1,5 @@
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <mods/init/init.h> #include <mods/init/init.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>

View File

@ -1,4 +1,4 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include "compat-internal.h" #include "compat-internal.h"
// Do Nothing Function // Do Nothing Function

View File

@ -3,11 +3,12 @@
#include <cerrno> #include <cerrno>
#include <mods/compat/compat.h> #include <mods/compat/compat.h>
#include <mods/screenshot/screenshot.h>
#include <mods/init/init.h> #include <mods/init/init.h>
#include "compat-internal.h" #include "compat-internal.h"
#include <libreborn/libreborn.h> #include <libreborn/log.h>
#include <libreborn/util.h>
#include <libreborn/config.h>
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <media-layer/core.h> #include <media-layer/core.h>

View File

@ -1,6 +1,6 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <media-layer/core.h> #include <media-layer/core.h>
#include "compat-internal.h" #include "compat-internal.h"

View File

@ -1,7 +1,7 @@
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <media-layer/core.h> #include <media-layer/core.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include "compat-internal.h" #include "compat-internal.h"
// SDL Stub // SDL Stub
@ -19,7 +19,7 @@ static int SDL_GetWMInfo_injection(SDL_SysWMinfo *info) {
SDL_SysWMinfo ret; SDL_SysWMinfo ret;
ret.info.x11.lock_func = x11_nop; ret.info.x11.lock_func = x11_nop;
ret.info.x11.unlock_func = x11_nop; ret.info.x11.unlock_func = x11_nop;
ret.info.x11.display = NULL; ret.info.x11.display = nullptr;
ret.info.x11.window = 0; ret.info.x11.window = 0;
ret.info.x11.wmwindow = ret.info.x11.window; ret.info.x11.wmwindow = ret.info.x11.window;
*info = ret; *info = ret;

View File

@ -1,18 +1,18 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <media-layer/core.h> #include <media-layer/core.h>
#include "compat-internal.h" #include "compat-internal.h"
// Functions That Have Their Return Values Used // Functions That Have Their Return Values Used
static int XTranslateCoordinates_injection(__attribute__((unused)) void *display, __attribute__((unused)) XID src_w, __attribute__((unused)) XID dest_w, int src_x, int src_y, int *dest_x_return, int *dest_y_return, __attribute__((unused)) XID *child_return) { static int XTranslateCoordinates_injection(__attribute__((unused)) void *display, __attribute__((unused)) XID src_w, __attribute__((unused)) XID dest_w, int src_x, int src_y, int *dest_x_return, int *dest_y_return, __attribute__((unused)) XID *child_return) {
// Use MCPI Replacemnt Function // Use MCPI Replacement Function
*dest_x_return = src_x; *dest_x_return = src_x;
*dest_y_return = src_y; *dest_y_return = src_y;
return 1; return 1;
} }
static int XGetWindowAttributes_injection(__attribute__((unused)) void *display, __attribute__((unused)) XID w, XWindowAttributes *window_attributes_return) { static int XGetWindowAttributes_injection(__attribute__((unused)) void *display, __attribute__((unused)) XID w, XWindowAttributes *window_attributes_return) {
// Use MCPI Replacemnt Function // Use MCPI Replacement Function
XWindowAttributes attributes = {}; XWindowAttributes attributes = {};
attributes.x = 0; attributes.x = 0;
attributes.y = 0; attributes.y = 0;

View File

@ -1,4 +1,5 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>
@ -9,13 +10,11 @@
// Add Item To Inventory // Add Item To Inventory
static void inventory_add_item(FillingContainer *inventory, Item *item) { static void inventory_add_item(FillingContainer *inventory, Item *item) {
ItemInstance *item_instance = new ItemInstance; ItemInstance *item_instance = new ItemInstance;
ALLOC_CHECK(item_instance);
item_instance = item_instance->constructor_item(item); item_instance = item_instance->constructor_item(item);
inventory->addItem(item_instance); inventory->addItem(item_instance);
} }
static void inventory_add_item(FillingContainer *inventory, Tile *item) { static void inventory_add_item(FillingContainer *inventory, Tile *item) {
ItemInstance *item_instance = new ItemInstance; ItemInstance *item_instance = new ItemInstance;
ALLOC_CHECK(item_instance);
item_instance = item_instance->constructor_tile(item); item_instance = item_instance->constructor_tile(item);
inventory->addItem(item_instance); inventory->addItem(item_instance);
} }
@ -34,7 +33,6 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
continue; continue;
} }
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance);
new_item_instance = new_item_instance->constructor_item_extra(Item::dye_powder, 1, i); new_item_instance = new_item_instance->constructor_item_extra(Item::dye_powder, 1, i);
filling_container->addItem(new_item_instance); filling_container->addItem(new_item_instance);
} }
@ -59,7 +57,6 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
continue; continue;
} }
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance);
new_item_instance = new_item_instance->constructor_tile_extra(Tile::netherReactor, 1, i); new_item_instance = new_item_instance->constructor_tile_extra(Tile::netherReactor, 1, i);
filling_container->addItem(new_item_instance); filling_container->addItem(new_item_instance);
} }
@ -70,14 +67,12 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
continue; continue;
} }
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance);
new_item_instance = new_item_instance->constructor_tile_extra(Tile::tallgrass, 1, i); new_item_instance = new_item_instance->constructor_tile_extra(Tile::tallgrass, 1, i);
filling_container->addItem(new_item_instance); filling_container->addItem(new_item_instance);
} }
// Smooth Stone Slab // Smooth Stone Slab
{ {
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance);
new_item_instance = new_item_instance->constructor_tile_extra(Tile::stoneSlab, 1, 6); new_item_instance = new_item_instance->constructor_tile_extra(Tile::stoneSlab, 1, 6);
filling_container->addItem(new_item_instance); filling_container->addItem(new_item_instance);
} }

View File

@ -1,6 +1,7 @@
#include <string> #include <string>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>

View File

@ -4,7 +4,7 @@
#include <cmath> #include <cmath>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <GLES/gl.h> #include <GLES/gl.h>
#include <mods/misc/misc.h> #include <mods/misc/misc.h>

View File

@ -1,4 +1,6 @@
#include <libreborn/libreborn.h> #include <libreborn/log.h>
#include <libreborn/config.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>

View File

@ -1,11 +1,12 @@
#include <cstdint> #include <cstdint>
#include <libreborn/patch.h>
#include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h>
#include "game-mode-internal.h" #include "game-mode-internal.h"
static int is_survival = -1; static int is_survival = -1;
@ -17,7 +18,7 @@ static void set_is_survival(const bool new_is_survival) {
if (is_survival != new_is_survival) { if (is_survival != new_is_survival) {
DEBUG("Setting Game Mode: %s", new_is_survival ? "Survival" : "Creative"); DEBUG("Setting Game Mode: %s", new_is_survival ? "Survival" : "Creative");
// Correct Inventpry UI // Correct Inventory UI
unsigned char inventory_patch[4] = {(unsigned char) (new_is_survival ? 0x00 : 0x01), 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1" unsigned char inventory_patch[4] = {(unsigned char) (new_is_survival ? 0x00 : 0x01), 0x30, 0xa0, 0xe3}; // "mov r3, #0x0" or "mov r3, #0x1"
patch((void *) 0x16efc, inventory_patch); patch((void *) 0x16efc, inventory_patch);

View File

@ -1,9 +1,9 @@
#include <string> #include <string>
#include <set> #include <set>
#include <utility>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h>
#include <libreborn/patch.h>
#include <mods/text-input-box/TextInputScreen.h> #include <mods/text-input-box/TextInputScreen.h>
#include <mods/touch/touch.h> #include <mods/touch/touch.h>
@ -213,7 +213,6 @@ static void create_world(Minecraft *minecraft, std::string name, const bool is_c
// Open ProgressScreen // Open ProgressScreen
ProgressScreen *screen = ProgressScreen::allocate(); ProgressScreen *screen = ProgressScreen::allocate();
ALLOC_CHECK(screen);
screen = screen->constructor(); screen = screen->constructor();
minecraft->setScreen((Screen *) screen); minecraft->setScreen((Screen *) screen);
} }

View File

@ -1,6 +1,7 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/config.h>
#include <mods/init/init.h> #include <mods/init/init.h>
#include <media-layer/core.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
__attribute__((constructor)) static void init() { __attribute__((constructor)) static void init() {

View File

@ -1,6 +1,7 @@
#include <cstdint> #include <cstdint>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>

View File

@ -1,4 +1,5 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>

View File

@ -1,4 +1,3 @@
#include <libreborn/libreborn.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include "input-internal.h" #include "input-internal.h"
@ -29,7 +28,6 @@ static void _handle_drop(Minecraft *minecraft) {
if (inventory_item != nullptr && inventory_item->count > 0) { if (inventory_item != nullptr && inventory_item->count > 0) {
// Copy // Copy
ItemInstance *dropped_item = new ItemInstance; ItemInstance *dropped_item = new ItemInstance;
ALLOC_CHECK(dropped_item);
*dropped_item = *inventory_item; *dropped_item = *inventory_item;
// Update Inventory // Update Inventory

View File

@ -1,6 +1,6 @@
#include <mods/input/input.h> #include <mods/input/input.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include "input-internal.h" #include "input-internal.h"

View File

@ -1,4 +1,5 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <SDL/SDL.h> #include <SDL/SDL.h>

View File

@ -1,4 +1,5 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include "input-internal.h" #include "input-internal.h"

View File

@ -1,6 +1,8 @@
#include <vector> #include <vector>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/util.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -1,6 +1,9 @@
#include <cmath> #include <cmath>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/config.h>
#include <libreborn/env.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -1,6 +1,7 @@
#include <libreborn/patch.h> #include <libreborn/patch.h>
#include <libreborn/env.h> #include <libreborn/env.h>
#include <libreborn/util.h> #include <libreborn/util.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include "misc-internal.h" #include "misc-internal.h"

View File

@ -1,6 +1,9 @@
#include <string> #include <string>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/string.h>
#include <libreborn/util.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include "misc-internal.h" #include "misc-internal.h"

View File

@ -11,7 +11,12 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <media-layer/core.h> #include <media-layer/core.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/string.h>
#include <libreborn/config.h>
#include <libreborn/util.h>
#include <libreborn/env.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>

View File

@ -1,4 +1,5 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>

View File

@ -1,4 +1,6 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/env.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -1,7 +1,10 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h>
#include <libreborn/patch.h>
#include <libreborn/util.h>
#include <media-layer/core.h> #include <media-layer/core.h>
#include <mods/init/init.h> #include <mods/init/init.h>

View File

@ -2,8 +2,6 @@
#include "storage.h" #include "storage.h"
#include <libreborn/libreborn.h>
// Setup // Setup
#define DEFAULT_SIZE 16777216 // 16 MiB #define DEFAULT_SIZE 16777216 // 16 MiB
Storage::Storage(const int chunks) { Storage::Storage(const int chunks) {

View File

@ -4,7 +4,9 @@
#include <vector> #include <vector>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h>
#include <libreborn/patch.h>
#include <libreborn/util.h>
#include <mods/init/init.h> #include <mods/init/init.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>

View File

@ -1,4 +1,8 @@
#include <libreborn/libreborn.h> #include <libreborn/log.h>
#include <libreborn/exec.h>
#include <libreborn/config.h>
#include <libreborn/util.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -3,7 +3,12 @@
#include <vector> #include <vector>
#include <sstream> #include <sstream>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/config.h>
#include <libreborn/env.h>
#include <libreborn/string.h>
#include <libreborn/util.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
@ -157,9 +162,8 @@ void init_options() {
if (strcmp(Strings::default_username, "StevePi") != 0) { if (strcmp(Strings::default_username, "StevePi") != 0) {
ERR("Default Username Is Invalid"); ERR("Default Username Is Invalid");
} }
std::string *safe_username = new std::string; static std::string safe_username = to_cp437(username);
*safe_username = to_cp437(username); patch_address((void *) &Strings::default_username, (void *) safe_username.c_str());
patch_address((void *) &Strings::default_username, (void *) safe_username->c_str());
// Disable Autojump By Default // Disable Autojump By Default
if (feature_has("Disable Autojump By Default", server_disabled)) { if (feature_has("Disable Autojump By Default", server_disabled)) {

View File

@ -1,7 +1,8 @@
#include <string> #include <string>
#include <cstdint> #include <cstdint>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
@ -98,7 +99,6 @@ static void OptionsScreen_init_injection(OptionsScreen_init_t original, OptionsS
// Add Button // Add Button
Touch_TButton *button = Touch_TButton::allocate(); Touch_TButton *button = Touch_TButton::allocate();
ALLOC_CHECK(button);
std::string name = "Reborn"; std::string name = "Reborn";
button->constructor(INFO_BUTTON_ID, name); button->constructor(INFO_BUTTON_ID, name);
self->rendered_buttons.push_back((Button *) button); self->rendered_buttons.push_back((Button *) button);

View File

@ -4,7 +4,8 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <libreborn/libreborn.h> #include <libreborn/util.h>
#include <libreborn/env.h>
#include <mods/override/override.h> #include <mods/override/override.h>
#include <mods/init/init.h> #include <mods/init/init.h>

View File

@ -2,14 +2,15 @@
#include <cstdio> #include <cstdio>
#include <unistd.h> #include <unistd.h>
#include <ctime> #include <ctime>
#include <cstring>
#include <cerrno>
#include <sys/stat.h> #include <sys/stat.h>
#include "stb_image.h" #include "stb_image.h"
#include "stb_image_write.h" #include "stb_image_write.h"
#include <libreborn/libreborn.h> #include <libreborn/log.h>
#include <libreborn/util.h>
#include <libreborn/config.h>
#include <GLES/gl.h> #include <GLES/gl.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>

View File

@ -11,7 +11,11 @@
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/env.h>
#include <libreborn/string.h>
#include <libreborn/util.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/server/server.h> #include <mods/server/server.h>
@ -92,7 +96,6 @@ static void start_world(Minecraft *minecraft) {
// Open ProgressScreen // Open ProgressScreen
ProgressScreen *screen = ProgressScreen::allocate(); ProgressScreen *screen = ProgressScreen::allocate();
ALLOC_CHECK(screen);
screen = screen->constructor(); screen = screen->constructor();
minecraft->setScreen((Screen *) screen); minecraft->setScreen((Screen *) screen);
} }

View File

@ -1,6 +1,6 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include "shading-internal.h" #include "shading-internal.h"

View File

@ -1,7 +1,7 @@
#include <cstdint> #include <cstdint>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include "shading-internal.h" #include "shading-internal.h"

View File

@ -4,7 +4,7 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/multidraw/multidraw.h> #include <mods/multidraw/multidraw.h>

View File

@ -1,6 +1,7 @@
#include <vector> #include <vector>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>
@ -12,7 +13,6 @@ static void LocalPlayer_openTextEdit_injection(__attribute__((unused)) LocalPlay
if (sign->type == 4) { if (sign->type == 4) {
Minecraft *minecraft = local_player->minecraft; Minecraft *minecraft = local_player->minecraft;
TextEditScreen *screen = TextEditScreen::allocate(); TextEditScreen *screen = TextEditScreen::allocate();
ALLOC_CHECK(screen);
screen = screen->constructor((SignTileEntity *) sign); screen = screen->constructor((SignTileEntity *) sign);
minecraft->setScreen((Screen *) screen); minecraft->setScreen((Screen *) screen);
} }

View File

@ -1,7 +1,11 @@
#include <pthread.h> #include <pthread.h>
#include <vector> #include <vector>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/env.h>
#include <libreborn/exec.h>
#include <libreborn/config.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -1,4 +1,4 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/init/init.h> #include <mods/init/init.h>

View File

@ -2,7 +2,7 @@
#include <cstdlib> #include <cstdlib>
#include <ctime> #include <ctime>
#include <libreborn/libreborn.h> #include <libreborn/log.h>
#include <media-layer/audio.h> #include <media-layer/audio.h>
#include "sound-internal.h" #include "sound-internal.h"

View File

@ -1,6 +1,6 @@
#include <string> #include <string>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <media-layer/audio.h> #include <media-layer/audio.h>

View File

@ -1,4 +1,4 @@
#include <libreborn/libreborn.h> #include <libreborn/log.h>
#include <mods/text-input-box/TextInputBox.h> #include <mods/text-input-box/TextInputBox.h>
#include <mods/input/input.h> #include <mods/input/input.h>

View File

@ -1,4 +1,4 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include "textures-internal.h" #include "textures-internal.h"

View File

@ -1,7 +1,7 @@
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <mods/extend/extend.h> #include <mods/extend/extend.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>

View File

@ -4,7 +4,10 @@
#include <GLES/gl.h> #include <GLES/gl.h>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/util.h>
#include <libreborn/config.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/misc/misc.h> #include <mods/misc/misc.h>

View File

@ -1,7 +1,8 @@
#include <fstream> #include <fstream>
#include <cmath> #include <cmath>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -1,7 +1,7 @@
#include <fstream> #include <fstream>
#include <cmath> #include <cmath>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -1,6 +1,10 @@
#include <fstream> #include <fstream>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/config.h>
#include <libreborn/util.h>
#include <libreborn/exec.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/touch/touch.h> #include <mods/touch/touch.h>

View File

@ -1,6 +1,6 @@
#include <cstdint> #include <cstdint>
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <mods/feature/feature.h> #include <mods/feature/feature.h>
#include <mods/init/init.h> #include <mods/init/init.h>
@ -48,7 +48,6 @@ int touch_gui = 0;
template <typename T> template <typename T>
static Button *create_button(int id, std::string text) { static Button *create_button(int id, std::string text) {
T *button = T::allocate(); T *button = T::allocate();
ALLOC_CHECK(button);
button->constructor(id, text); button->constructor(id, text);
return (Button *) button; return (Button *) button;
} }

View File

@ -1,4 +1,6 @@
#include <libreborn/libreborn.h> #include <libreborn/patch.h>
#include <libreborn/config.h>
#include <symbols/minecraft.h> #include <symbols/minecraft.h>
#include <mods/version/version.h> #include <mods/version/version.h>