From 2119a78f6065f56c1d4ca63381b99c23199fb1a7 Mon Sep 17 00:00:00 2001 From: WillowSauceR Date: Thu, 8 Jun 2023 11:05:02 +0800 Subject: [PATCH] refactor: split too long strings --- src/mc/level.c | 3 ++- src/mc/player.c | 3 ++- src/plugin.c | 25 ++++++++++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/mc/level.c b/src/mc/level.c index 1d48131..6a74cc8 100644 --- a/src/mc/level.c +++ b/src/mc/level.c @@ -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); diff --git a/src/mc/player.c b/src/mc/player.c index 8ed8a98..4e018b8 100644 --- a/src/mc/player.c +++ b/src/mc/player.c @@ -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)); } diff --git a/src/plugin.c b/src/plugin.c index 3947dfa..55ce97e 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -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, @@ -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);