Skip to content

Commit

Permalink
Merge pull request #128 from AudriusButkevicius/more-renames
Browse files Browse the repository at this point in the history
More renames
  • Loading branch information
Lectem authored Jan 1, 2024
2 parents c295c54 + 138cdfa commit ab8527d
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 134 deletions.
2 changes: 2 additions & 0 deletions source/D2Common/statictests/D2PacketDef_staticchecks.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <D2PacketDef.h>

static_assert(sizeof(D2GSPacketClt32) == 0x11, "size mismatch");

static_assert(sizeof(D2GSPacketSrv7B) == 0x08, "size mismatch");
15 changes: 9 additions & 6 deletions source/D2CommonDefinitions/include/D2PacketDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -1638,9 +1638,12 @@ struct D2GSPacketSrv7A //size of 0x0D
struct D2GSPacketSrv7B //size of 0x08
{
uint8_t nHeader; //0x00
uint8_t unk0x01; //0x01
uint16_t unk0x02; //0x02
uint32_t unk0x04; //0x04
uint8_t nSlot; //0x01
struct { //0x02
uint16_t nSkill : 12;
uint16_t nHand : 4;
};
uint32_t nItemGUID; //0x04
};

struct D2GSPacketSrv7C //size of 0x06
Expand Down Expand Up @@ -2103,9 +2106,9 @@ struct D2GSPacketSrvB0 //size of 0x01
struct D2GSPacketSrvB1 //size of 0x35
{
uint8_t nHeader; //0x00
char unk0x01[48]; //0x01
uint16_t unk0x31; //0x31
uint16_t unk0x33; //0x33
char szGameName[48]; //0x01
uint16_t nClientCount; //0x31
uint16_t nGameId; //0x33
};

struct D2GSPacketSrvB2 //variable size
Expand Down
22 changes: 11 additions & 11 deletions source/D2Game/include/GAME/Clients.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ struct D2ClientUnitUpdateSortStrc
struct D2ClientKeySkillStrc
{
int16_t nSkill; //0x00
int16_t unk0x002; //0x02
uint32_t dwFlags; //0x04
int16_t nHand; //0x02
uint32_t nItemGUID; //0x04
};

struct D2GuildInformationStrc
Expand All @@ -166,11 +166,11 @@ struct D2ClientStrc
uint8_t nClassId; //0x008
uint8_t unk0x09; //0x009
uint16_t nSaveFlags; //0x00A D2ClientSaveFlags
uint8_t unk0x0C; //0x00C
uint8_t nCharTemplate; //0x00C
char szName[16]; //0x00D
char szAccount[16]; //0x01D
uint8_t unk0x2D[51]; //0x02D
int32_t unk0x60; //0x060
int32_t nCharSaveTransactionToken; //0x060
int32_t unk0x64; //0x064
D2ClientInfoStrc* pClientInfo; //0x068
D2CharacterPreviewInfoStrc tCharacterInfo; //0x06C
Expand All @@ -184,8 +184,8 @@ struct D2ClientStrc
uint32_t unk0x184; //0x184
uint32_t nSaveHeaderDataSentBytes; //0x188
DWORD nSaveChecksum; //0x18C
DWORD unk0x190; //0x190
DWORD unk0x194[5]; //0x194
uint64_t nLadderGUID; //0x190
DWORD unk0x198[4]; //0x198
D2GameStrc* pGame; //0x1A8
uint8_t nAct; //0x1AC
uint8_t pad0x1AD[3]; //0x1AD
Expand Down Expand Up @@ -222,7 +222,7 @@ struct D2ClientStrc
uint32_t unk0x504; //0x504
#endif
int32_t nExpLoss; //0x504
uint32_t dwExpLost; //0x508
uint32_t dwLocale; //0x508
uint32_t dwLangId; //0x50C
#ifdef D2_VERSION_113C
uint32_t pad0x514; //0x514
Expand Down Expand Up @@ -251,7 +251,7 @@ void __fastcall sub_6FC32220(D2ClientStrc* pClient);
int32_t __fastcall CLIENTS_AddPlayerToGame(D2ClientStrc* pClient, D2GameStrc* pGame, int32_t a3, int32_t a4, int32_t a5, int32_t a6);
//1.10f: D2Game.0x6FC325E0
//1.13c: D2Game.0x6FC6A9B0
D2ClientStrc* __fastcall CLIENTS_AddToGame(D2GameStrc* pGame, int32_t nClientId, uint8_t nClassIdOrCharTemplate, const char* szClientName, const char* szAccount, int32_t a6, uint32_t nExpLost, int32_t a8, int32_t a9);
D2ClientStrc* __fastcall CLIENTS_AddToGame(D2GameStrc* pGame, int32_t nClientId, uint8_t nClassIdOrCharTemplate, const char* szClientName, const char* szAccount, int32_t nCharSaveTransactionToken, uint32_t nLocale, int32_t a8, int32_t a9);
//D2Game.0x6FC327E0
void __fastcall CLIENTS_SetGameData(D2GameStrc* pGame);
//D2Game.0x6FC32810
Expand Down Expand Up @@ -351,9 +351,9 @@ uint32_t __fastcall CLIENT_IsSaveLoaded(D2ClientStrc* pClient);
//D2Game.0x6FC34420
D2ClientStrc* __fastcall CLIENTS_GetNext(D2ClientStrc* pClient);
//D2Game.0x6FC34430
void __fastcall CLIENTS_SetSkillHotKey(D2ClientStrc* pClient, int32_t nHotkeyId, int16_t nSkillId, uint8_t a4, int32_t nFlags);
void __fastcall CLIENTS_SetSkillHotKey(D2ClientStrc* pClient, int32_t nHotkeyId, int16_t nSkillId, uint8_t nHand, int32_t nItemGUID);
//D2Game.0x6FC34460
void __fastcall CLIENTS_GetSkillHotKey(D2ClientStrc* pClient, int32_t nId, int32_t* pSkillId, int32_t* a4, int32_t* pFlags);
void __fastcall CLIENTS_GetSkillHotKey(D2ClientStrc* pClient, int32_t nId, int32_t* pSkillId, int32_t* nHand, int32_t* nItemGUID);
//D2Game.0x6FC344A0
int16_t __fastcall CLIENTS_GetGuildFlags(D2ClientStrc* pClient);
//D2Game.0x6FC344B0
Expand Down Expand Up @@ -391,7 +391,7 @@ D2PacketDataStrc* __fastcall CLIENTS_PacketDataList_GetHead(D2ClientStrc* pClien
//D2Game.0x6FC34690
void __fastcall CLIENTS_CopyAccountNameToBuffer(D2ClientStrc* pClient, char* szAccount);
//D2Game.0x6FC346A0
void __fastcall sub_6FC346A0(D2ClientStrc* pClient, int32_t* a2);
void __fastcall D2GAME_GetCharSaveTransactionToken_6FC346A0(D2ClientStrc* pClient, int32_t* pCharSaveTransactionToken);
//D2Game.0x6FC346B0
void __fastcall D2GAME_GetRealmIdFromClient_6FC346B0(D2ClientStrc* pClient, D2ClientInfoStrc** ppClientInfo);
//D2Game.0x6FC346C0
Expand Down
16 changes: 8 additions & 8 deletions source/D2Game/include/GAME/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static const HGAMEDATA D2GameReservedSlotHandle = GetGameHandleFromHashValue(D2G


using FnCloseGame = void(__fastcall*)(WORD nGameId, uint32_t nProductCode, uint32_t nSpawnedPlayers, int32_t nFrame);
using FnLeaveGame = void(__fastcall*)(D2ClientInfoStrc** ppClientInfo, WORD nGameId, int32_t nClassId, int32_t nLevel, uint32_t nExperience, int32_t a6, uint32_t nFlags, const char* szCharName, const char* a9, int32_t bUnlockChar, int32_t nZero11, int32_t nZero12, const char* szAccountName, int32_t a14, void* a15); //TODO: Unknown args
using FnLeaveGame = void(__fastcall*)(D2ClientInfoStrc** ppClientInfo, WORD nGameId, int32_t nClassId, int32_t nLevel, uint32_t nExperience, int32_t a6, uint32_t nFlags, const char* szCharName, const char* a9, int32_t bUnlockChar, int32_t nZero11, int32_t nZero12, const char* szAccountName, int32_t a14, uint64_t* pLadderGUID); //TODO: Unknown args
using FnGetDatabaseCharacter = void(__fastcall*)(D2ClientInfoStrc** ppClientInfo, const char* szCharName, DWORD dwClientId, const char* szAccountName);
using FnSaveDatabaseCharacter = void(__fastcall*)(int32_t* pRealmId, const char* szCharName, const char* szAccountName, BYTE* pSaveData, uint32_t nSaveDataSize, int32_t nUnused);
using FnServerLogMessage = void(*)(int32_t nLogLevel, const char* szFormat, ...);
Expand All @@ -69,7 +69,7 @@ using FnFindPlayerToken = int32_t(__fastcall*)(const char* szCharName, int32_t n
/*UNUSED*/ using FnSaveDatabaseGuild = int(__fastcall*)(const char*, char*, size_t);
using FnUnlockDatabaseCharacter = void(__fastcall*)(uint32_t* pGameData, const char* szCharName, const char* szAccountName);
/*UNUSED*/ using FnUnk0x24 = int(__fastcall*)(int, int);
using FnUpdateCharacterLadder = void(__fastcall*)(const char* szCharName, int32_t nClassId, int32_t nLevel, uint32_t nExperience, int32_t nZero, uint32_t nFlags, void* pUnknown);
using FnUpdateCharacterLadder = void(__fastcall*)(const char* szCharName, int32_t nClassId, int32_t nLevel, uint32_t nExperience, int32_t nZero, uint32_t nFlags, uint64_t* pLadderGUID);
using FnUpdateGameInformation = void(__fastcall*)(WORD nGameId, const char* szCharName, int32_t nClassId, int32_t nLevel);
using FnHandlePacket = void(__fastcall*)(void* pPacket, int32_t nPacketSize);
using FnSetGameData = uint32_t(__fastcall*)();
Expand Down Expand Up @@ -102,7 +102,7 @@ struct D2ServerCallbackFunctions // sizeof 0x40

struct D2GameInfoStrc
{
int32_t nServerToken; // 0x00 nGameId
int32_t nGameId; // 0x00
uint32_t nInitSeed; // 0x04
int32_t nClients; // 0x08
int32_t nPlayers; // 0x0C
Expand Down Expand Up @@ -147,7 +147,7 @@ struct D2GameStrc : TSHashObject<D2GameStrc, HASHKEY_NONE> // called SGAMEDATA i
void* pMemoryPool; //0x1C
uint32_t nGameData; //0x20
uint32_t unk0x24; //0x24
uint16_t nServerToken; //0x28
uint16_t nGameId; //0x28
char szGameName[16]; //0x2A
char szGamePassword[16]; //0x3A
char szGameDesc[32]; //0x4A
Expand Down Expand Up @@ -261,9 +261,9 @@ D2GAME_DLL_DECL void __stdcall D2Game_10056(int32_t a1);
//D2Game.0x6FC35E70 (#10047)
D2GAME_DLL_DECL int32_t __stdcall GAME_CreateNewEmptyGame(char* szGameName, const char* szPassword, const char* szGameDescription, uint32_t nFlags, uint8_t a5, uint8_t a6, uint8_t a7, uint16_t* pGameId);
//D2Game.0x6FC36280 (#10007)
D2GAME_DLL_DECL int32_t __stdcall GAME_ReceiveDatabaseCharacter(int32_t nClientId, const uint8_t* pSaveData, uint16_t nSaveSize, uint16_t nTotalSize, int32_t a5, int32_t a6, int32_t a7, int32_t a8);
D2GAME_DLL_DECL int32_t __stdcall GAME_ReceiveDatabaseCharacter(int32_t nClientId, const uint8_t* pSaveData, uint16_t nSaveSize, uint16_t nTotalSize, int32_t a5, int32_t a6, uint64_t* pLadderGUID, int32_t nCharSaveTransactionToken);
//D2Game.0x6FC36570
void __fastcall GAME_SendGameInit(int32_t nClientId, char* szGameName, uint8_t nGameType, uint8_t nCharTemplate, const char* szClientName, int32_t a2, uint32_t nFlags, int32_t nArenaTemplate, int32_t a9, int32_t a10, uint8_t nDifficulty, uint8_t nExpLost, int32_t a13, int32_t a14);
void __fastcall GAME_SendGameInit(int32_t nClientId, char* szGameName, uint8_t nGameType, uint8_t nCharTemplate, const char* szClientName, int32_t a2, uint32_t nFlags, int32_t nArenaTemplate, int32_t a9, int32_t a10, uint8_t nDifficulty, uint8_t nLocale, int32_t a13, int32_t a14);
//D2Game.0x6FC369C0
void __fastcall sub_6FC369C0(D2GameStrc* pGame, D2ClientStrc* pClient);
//D2Game.0x6FC36AA0
Expand All @@ -277,9 +277,9 @@ void __fastcall sub_6FC36C20(D2GameStrc* pGame, int32_t nClientId, const char* s
//D2Game.0x6FC36C60
void __fastcall GAME_SendActInit(int32_t nClientId);
//D2Game.0x6FC36DF0
int32_t __fastcall GAME_VerifyJoinGme(int32_t nClientId, uint16_t nGameId, uint8_t nPlayerClass, const char* szClientName, int32_t nToken, char* szAccountName, int32_t* a7, uint8_t nLocale, int32_t* a9, int32_t* a10);
int32_t __fastcall GAME_VerifyJoinGme(int32_t nClientId, uint16_t nGameId, uint8_t nPlayerClass, const char* szClientName, int32_t nToken, char* szAccountName, int32_t* pCharSaveTransactionToken, uint8_t nLocale, int32_t* a9, int32_t* a10);
//D2Game.0x6FC37150
void __fastcall GAME_JoinGame(int32_t dwClientId, uint16_t nGameId, int32_t a3, char* szClientName, char* szAccountName, int32_t a6, int32_t a7, int32_t a8, int32_t a9);
void __fastcall GAME_JoinGame(int32_t dwClientId, uint16_t nGameId, int32_t nClass, char* szClientName, char* szAccountName, int32_t nCharSaveTransactionToken, int32_t nLocale, int32_t a8, int32_t a9);
//D2Game.0x6FC37450
_Requires_lock_held_(*pGame->lpCriticalSection)
_Releases_lock_(*pGame->lpCriticalSection)
Expand Down
4 changes: 2 additions & 2 deletions source/D2Game/include/GAME/SCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


//D2Game.0x6FC3C640
int32_t __fastcall sub_6FC3C640(int32_t nClientId, int16_t a2, int16_t a3, const char* szSource);
int32_t __fastcall sub_6FC3C640(int32_t nClientId, int16_t nGameId, int16_t nClientCount, const char* szGameName);
//D2Game.0x6FC3C690
void __fastcall sub_6FC3C690(int32_t nClientId);
//D2Game.0x6FC3C6B0
Expand Down Expand Up @@ -234,7 +234,7 @@ void __fastcall D2GAME_PACKETS_SendPacket0x74_6FC3F640(D2ClientStrc* pClient, D2
//D2Game.0x6FC3F690
void __fastcall SCMD_Send0x75_PartyRosterUpdate(D2UnitStrc* pLocalPlayer, D2UnitStrc* pOtherPlayer);
//D2Game.0x6FC3F720
void __fastcall D2GAME_PACKETS_SendPacket0x7B_6FC3F720(D2ClientStrc* pClient, BYTE slot, int16_t a3, int32_t a4, int32_t a5);
void __fastcall D2GAME_PACKETS_SendPacket0x7B_6FC3F720(D2ClientStrc* pClient, BYTE slot, int16_t nSkill, int32_t nHand, int32_t nItemGUID);
//D2Game.0x6FC3F770
void __fastcall D2GAME_PACKETS_SendPacket0x7E_6FC3F770(D2ClientStrc* pClient);
//D2Game.0x6FC3F790
Expand Down
6 changes: 3 additions & 3 deletions source/D2Game/src/GAME/CCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ void __fastcall CCMD_ProcessClientSystemMessage(void* pData, int32_t nSize)
}

char szAccountName[16] = {};
int32_t v17 = 0;
int32_t nCharSaveTransactionToken = 0;
int32_t v18 = 0;
int32_t v19 = 0;
if (GAME_VerifyJoinGme(nClientId, pPacket67->nGameId, pPacket67->nPlayerClass, pPacket67->szClientName, pPacket67->nToken, szAccountName, &v17, pPacket67->nLocale, &v19, &v18))
if (GAME_VerifyJoinGme(nClientId, pPacket67->nGameId, pPacket67->nPlayerClass, pPacket67->szClientName, pPacket67->nToken, szAccountName, &nCharSaveTransactionToken, pPacket67->nLocale, &v19, &v18))
{
GAME_JoinGame(nClientId, pPacket67->nGameId, pPacket67->nPlayerClass, pPacket67->szClientName, szAccountName, v17, pPacket67->nLocale, v19, v18);
GAME_JoinGame(nClientId, pPacket67->nGameId, pPacket67->nPlayerClass, pPacket67->szClientName, szAccountName, nCharSaveTransactionToken, pPacket67->nLocale, v19, v18);
}
else
{
Expand Down
Loading

0 comments on commit ab8527d

Please sign in to comment.