Stuff Learned From Legacy
This commit is contained in:
parent
55679dd54c
commit
406aa3f9a6
@ -83,9 +83,11 @@ void init_creative() {
|
||||
patch((void *) 0x8d090, nop_patch);
|
||||
patch((void *) 0x91d48, nop_patch);
|
||||
patch((void *) 0x92098, nop_patch);
|
||||
unsigned char FillingContainer_removeResource_creative_check_patch[4] = {0x03, 0x00, 0x53, 0xe1}; // "cmp r3, r3"
|
||||
patch((void *) 0x923c0, FillingContainer_removeResource_creative_check_patch);
|
||||
unsigned char inv_creative_check_r3_patch[4] = {0x03, 0x00, 0x53, 0xe1}; // "cmp r3, r3"
|
||||
patch((void *) 0x923c0, inv_creative_check_r3_patch);
|
||||
patch((void *) 0x92828, nop_patch);
|
||||
unsigned char inv_creative_check_r1_patch[4] = {0x01, 0x00, 0x51, 0xe1}; // "cmp r1, r1"
|
||||
patch((void *) 0x9282c, inv_creative_check_r1_patch);
|
||||
// Display Slot Count
|
||||
patch((void *) 0x1e3f4, nop_patch);
|
||||
unsigned char slot_count_patch[4] = {0x18, 0x00, 0x00, 0xea}; // "b 0x27110"
|
||||
|
@ -9,11 +9,11 @@
|
||||
// Death Messages
|
||||
static std::string get_death_message(unsigned char *player) {
|
||||
// Get Username
|
||||
char *username = *(char **) (player + Player_username_property_offset);
|
||||
std::string *username = (std::string *) (player + Player_username_property_offset);
|
||||
|
||||
// Prepare Death Message
|
||||
std::string message;
|
||||
message.append(username);
|
||||
message.append(username->c_str());
|
||||
message.append(" has died");
|
||||
|
||||
// Return
|
||||
|
@ -50,6 +50,7 @@ static void _handle_drop(unsigned char *minecraft) {
|
||||
if (inventory_item != NULL && inventory_item->count > 0) {
|
||||
// Copy
|
||||
ItemInstance *dropped_item = new ItemInstance;
|
||||
ALLOC_CHECK(dropped_item);
|
||||
*dropped_item = *inventory_item;
|
||||
|
||||
// Update Inventory
|
||||
|
@ -113,8 +113,8 @@ static std::vector<unsigned char *> get_players_in_level(unsigned char *level) {
|
||||
return *(std::vector<unsigned char *> *) (level + Level_players_property_offset);
|
||||
}
|
||||
// Get Player's Username
|
||||
static std::string get_player_username(unsigned char *player) {
|
||||
return *(char **) (player + Player_username_property_offset);
|
||||
static std::string *get_player_username(unsigned char *player) {
|
||||
return (std::string *) (player + Player_username_property_offset);
|
||||
}
|
||||
// Get Level From Minecraft
|
||||
static unsigned char *get_level(unsigned char *minecraft) {
|
||||
@ -130,7 +130,7 @@ static void find_players(unsigned char *minecraft, std::string target_username,
|
||||
for (std::size_t i = 0; i < players.size(); i++) {
|
||||
// Iterate Players
|
||||
unsigned char *player = players[i];
|
||||
std::string username = get_player_username(player);
|
||||
std::string username = *get_player_username(player);
|
||||
if (all_players || username == target_username) {
|
||||
// Run Callback
|
||||
(*callback)(minecraft, username, player);
|
||||
@ -390,13 +390,13 @@ static unsigned char *ServerSideNetworkHandler_onReady_ClientGeneration_ServerSi
|
||||
// Check If Player Is Null
|
||||
if (player != NULL) {
|
||||
// Get Data
|
||||
char *username = (char *) *(unsigned char **) (player + Player_username_property_offset);
|
||||
std::string *username = (std::string *) (player + Player_username_property_offset);
|
||||
unsigned char *minecraft = *(unsigned char **) (server_side_network_handler + ServerSideNetworkHandler_minecraft_property_offset);
|
||||
unsigned char *rak_peer = get_rak_peer(minecraft);
|
||||
char *ip = get_rak_net_guid_ip(rak_peer, *guid);
|
||||
|
||||
// Log
|
||||
INFO("%s Has Joined (IP: %s)", username, ip);
|
||||
INFO("%s Has Joined (IP: %s)", username->c_str(), ip);
|
||||
}
|
||||
|
||||
// Return
|
||||
|
@ -300,7 +300,7 @@ static uint32_t Player_drop_vtable_offset = 0x208;
|
||||
|
||||
static Mob_getWalkingSpeedModifier_t Player_getWalkingSpeedModifier = (Mob_getWalkingSpeedModifier_t) 0x8ea0c;
|
||||
|
||||
static uint32_t Player_username_property_offset = 0xbf4; // char *
|
||||
static uint32_t Player_username_property_offset = 0xbf4; // std::string
|
||||
static uint32_t Player_inventory_property_offset = 0xbe0; // Inventory *
|
||||
|
||||
// LocalPlayer
|
||||
|
Loading…
Reference in New Issue
Block a user