Skip to content

Commit

Permalink
refactor: split too long strings
Browse files Browse the repository at this point in the history
  • Loading branch information
WillowSauceR authored and WillowSauceR committed Jun 8, 2023
1 parent 8818a58 commit 2119a78
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/mc/level.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ struct player *get_player_by_xuid(struct level *level, const char *xuid)
{
struct string *xuid_cpp_str = std_string_string(xuid);
struct player *player =
TLCALL("?getPlayerByXuid@Level@@UEBAPEAVPlayer@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z",
TLCALL("?getPlayerByXuid@Level@@UEBAPEAVPlayer@@AEBV?$basic_string@"
"DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z",
struct player *(*)(struct level *level, struct string *xuid),
level, xuid_cpp_str);
free(xuid_cpp_str);
Expand Down
3 changes: 2 additions & 1 deletion src/mc/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

struct player *get_server_player(struct server_network_handler *handler, uintptr_t id, uintptr_t pkt)
{
return TLCALL("?_getServerPlayer@ServerNetworkHandler@@EEAAPEAVServerPlayer@@AEBVNetworkIdentifier@@W4SubClientId@@@Z",
return TLCALL("?_getServerPlayer@ServerNetworkHandler@@EEAAPEAVServerPlayer@@"
"AEBVNetworkIdentifier@@W4SubClientId@@@Z",
struct player *(*)(struct server_network_handler *handler, uintptr_t id, uintptr_t pkt),
REFERENCE(struct server_network_handler, handler, -16), id, DEREFERENCE(char, pkt, 16));
}
Expand Down
25 changes: 20 additions & 5 deletions src/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@ TLHOOK(on_initialize_logging, void,

// Constructor for Level
TLHOOK(level_construct, struct level *,
"??0Level@@QEAA@AEBV?$not_null@V?$NonOwnerPointer@VSoundPlayerInterface@@@Bedrock@@@gsl@@V?$unique_ptr@VLevelStorage@@U?$default_delete@VLevelStorage@@@std@@@std@@V?$unique_ptr@VLevelLooseFileStorage@@U?$default_delete@VLevelLooseFileStorage@@@std@@@4@AEAVIMinecraftEventing@@_NW4SubClientId@@AEAVScheduler@@V?$not_null@V?$NonOwnerPointer@VStructureManager@@@Bedrock@@@2@AEAVResourcePackManager@@AEBV?$not_null@V?$NonOwnerPointer@VIEntityRegistryOwner@@@Bedrock@@@2@V?$WeakRefT@UEntityRefTraits@@@@V?$unique_ptr@VBlockComponentFactory@@U?$default_delete@VBlockComponentFactory@@@std@@@4@V?$unique_ptr@VBlockDefinitionGroup@@U?$default_delete@VBlockDefinitionGroup@@@std@@@4@VItemRegistryRef@@V?$weak_ptr@VBlockTypeRegistry@@@4@44AEBUNetworkPermissions@@V?$optional@VDimensionDefinitionGroup@@@4@@Z",
struct level *level, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9, uintptr_t a10, uintptr_t a11, uintptr_t a12, uintptr_t a13, uintptr_t a14, uintptr_t a15, uintptr_t a16, uintptr_t a17, uintptr_t a18, uintptr_t a19)
"??0Level@@QEAA@AEBV?$not_null@V?$NonOwnerPointer@VSoundPlayerInterface@@@Bedrock@@@"
"gsl@@V?$unique_ptr@VLevelStorage@@U?$default_delete@VLevelStorage@@@std@@@std@@"
"V?$unique_ptr@VLevelLooseFileStorage@@U?$default_delete@VLevelLooseFileStorage@@@"
"std@@@4@AEAVIMinecraftEventing@@_NW4SubClientId@@AEAVScheduler@@V?$not_null@"
"V?$NonOwnerPointer@VStructureManager@@@Bedrock@@@2@AEAVResourcePackManager@@"
"AEBV?$not_null@V?$NonOwnerPointer@VIEntityRegistryOwner@@@Bedrock@@@2@V?$WeakRefT@"
"UEntityRefTraits@@@@V?$unique_ptr@VBlockComponentFactory@@U?$default_delete@"
"VBlockComponentFactory@@@std@@@4@V?$unique_ptr@VBlockDefinitionGroup@@"
"U?$default_delete@VBlockDefinitionGroup@@@std@@@4@VItemRegistryRef@@V?$weak_ptr@"
"VBlockTypeRegistry@@@4@44AEBUNetworkPermissions@@V?$optional@VDimensionDefinitionGroup@@@4@@Z",
struct level *level, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5,
uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9, uintptr_t a10, uintptr_t a11,
uintptr_t a12, uintptr_t a13, uintptr_t a14, uintptr_t a15, uintptr_t a16, uintptr_t a17,
uintptr_t a18, uintptr_t a19)
{
return g_level = level_construct.original(level, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19);
return g_level = level_construct.original(level, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19);
}

TLHOOK(change_setting_command_setup, void,
Expand All @@ -23,10 +36,12 @@ TLHOOK(change_setting_command_setup, void,
{
struct string *cmd_music = std_string_string("mpm");
struct string *cmd_video = std_string_string("mpv");
TLCALL("?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBDW4CommandPermissionLevel@@UCommandFlag@@3@Z",
TLCALL("?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@"
"std@@V?$allocator@D@2@@std@@PEBDW4CommandPermissionLevel@@UCommandFlag@@3@Z",
void (*)(uintptr_t, struct string *, const char *, char, short, short),
this, cmd_music, "mediaplayer music", 0, 0, 0x80);
TLCALL("?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBDW4CommandPermissionLevel@@UCommandFlag@@3@Z",
TLCALL("?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@"
"std@@V?$allocator@D@2@@std@@PEBDW4CommandPermissionLevel@@UCommandFlag@@3@Z",
void (*)(uintptr_t, struct string *, const char *, char, short, short),
this, cmd_video, "mediaplayer video", 0, 0, 0x80);
free(cmd_music);
Expand Down

0 comments on commit 2119a78

Please sign in to comment.