From 756cfbccbd964ccffa3c8cebb2542912b907ac8c Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 9 May 2021 18:43:53 +0200 Subject: [PATCH] wip add file dumping for profiles to debug pumpnet downloads --- src/main/hook/patch/net-profile.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/hook/patch/net-profile.c b/src/main/hook/patch/net-profile.c index 1445a88..89a693c 100644 --- a/src/main/hook/patch/net-profile.c +++ b/src/main/hook/patch/net-profile.c @@ -478,6 +478,23 @@ static bool _patch_net_profile_download_profile_file( "Downloading file player %d, file_type %d, successful", player, file_type); + + FILE* out; + if (file_type == PUMPNET_LIB_FILE_TYPE_SAVE) { + out = fopen("/tmp/save_dump.bin", "w+"); + } else { + out = fopen("/tmp/rank_dump.bin", "w+"); + } + + if (!out) { + log_error("Cannot open file for dumping"); + return true; + } + + fwrite(virtual_file->buffer, virtual_file->file_info->file_size, 1, out); + + fclose(out); + return true; }