From 42c99921600ead72266d6095bfda603c06409220 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:31:36 +0800 Subject: [PATCH] [bot] Implement/match `CNetGame::FUNC_6(...)` --- bot/net/netgame.cpp | 25 +++++++++++++++++++++++++ bot/net/netgame.h | 1 + 2 files changed, 26 insertions(+) diff --git a/bot/net/netgame.cpp b/bot/net/netgame.cpp index 5d62886..609b7ec 100644 --- a/bot/net/netgame.cpp +++ b/bot/net/netgame.cpp @@ -873,6 +873,7 @@ void CNetGame::SendCommand(char *szCommand) } DWORD *GLOBAL_7; +ONFOOT_SYNC_DATA *GLOBAL_8; INCAR_SYNC_DATA *GLOBAL_6; DWORD GLOBAL_5; @@ -900,6 +901,30 @@ void CNetGame::FUNC_5(FILE *a1, DWORD a2) } } +void CNetGame::FUNC_6(FILE *a1, DWORD a2) +{ + DWORD i=0; + + if(0x48 * (a2 / 0x48) != a2) + { + //logprintf("NPC: Total failure. File doesn't have correct data alignment for onfoot recording."); + exit(1); + } + GLOBAL_5 = a2 / 0x48; + if(GLOBAL_8) + free(GLOBAL_8); + if(GLOBAL_7) + free(GLOBAL_7); + GLOBAL_8 = (ONFOOT_SYNC_DATA *)calloc(1, sizeof(ONFOOT_SYNC_DATA) * GLOBAL_5); + GLOBAL_7 = (DWORD *)calloc(1, sizeof(DWORD) * GLOBAL_5); + while(!feof(a1)) + { + fread(&GLOBAL_7[i], 1, sizeof(DWORD), a1); + fread(&GLOBAL_8[i], 1, sizeof(ONFOOT_SYNC_DATA), a1); + i++; + } +} + void CNetGame::StopRecordingPlayback() { field_1DE = 0; diff --git a/bot/net/netgame.h b/bot/net/netgame.h index 6a39653..fca5c22 100644 --- a/bot/net/netgame.h +++ b/bot/net/netgame.h @@ -122,6 +122,7 @@ public: void SetMyZAngle(float fAngle); void FUNC_5(FILE *a1, DWORD a2); + void FUNC_6(FILE *a1, DWORD a2); void StopRecordingPlayback(); void PauseRecordingPlayback();