more packets using fixed size integers

This commit is contained in:
d1str4ught
2025-08-23 14:00:40 +02:00
parent 240f4f24c3
commit 08043416c5
16 changed files with 440 additions and 444 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -129,9 +129,9 @@ void CClientManager::QUERY_LOGIN_BY_KEY(CPeer * pkPeer, DWORD dwHandle, TPacketG
return; return;
} }
if (memcmp(pkLoginData->GetClientKey(), p->adwClientKey, sizeof(DWORD) * 4)) if (memcmp(pkLoginData->GetClientKey(), p->adwClientKey, sizeof(uint32_t) * 4))
{ {
const DWORD * pdwClientKey = pkLoginData->GetClientKey(); const uint32_t * pdwClientKey = pkLoginData->GetClientKey();
sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu", sys_log(0, "LOGIN_BY_KEY client key differ %s %lu %lu %lu %lu, %lu %lu %lu %lu",
r.login, r.login,

View File

@@ -40,7 +40,7 @@ class CDBManager : public singleton<CDBManager>
int Connect(int iSlot, const char * host, int port, const char* dbname, const char* user, const char* pass); int Connect(int iSlot, const char * host, int port, const char* dbname, const char* user, const char* pass);
void ReturnQuery(const char * c_pszQuery, int iType, DWORD dwIdent, void * pvData, int iSlot = SQL_PLAYER); void ReturnQuery(const char * c_pszQuery, int iType, IDENT dwIdent, void * pvData, int iSlot = SQL_PLAYER);
void AsyncQuery(const char * c_pszQuery, int iSlot = SQL_PLAYER); void AsyncQuery(const char * c_pszQuery, int iSlot = SQL_PLAYER);
SQLMsg * DirectQuery(const char * c_pszQuery, int iSlot = SQL_PLAYER); SQLMsg * DirectQuery(const char * c_pszQuery, int iSlot = SQL_PLAYER);

View File

@@ -24,12 +24,12 @@ TAccountTable & CLoginData::GetAccountRef()
return m_data; return m_data;
} }
void CLoginData::SetClientKey(const DWORD * c_pdwClientKey) void CLoginData::SetClientKey(const uint32_t* c_pdwClientKey)
{ {
thecore_memcpy(&m_adwClientKey, c_pdwClientKey, sizeof(DWORD) * 4); thecore_memcpy(&m_adwClientKey, c_pdwClientKey, sizeof(uint32_t) * 4);
} }
const DWORD * CLoginData::GetClientKey() const uint32_t * CLoginData::GetClientKey()
{ {
return &m_adwClientKey[0]; return &m_adwClientKey[0];
} }

View File

@@ -8,9 +8,9 @@ class CLoginData
CLoginData(); CLoginData();
TAccountTable & GetAccountRef(); TAccountTable & GetAccountRef();
void SetClientKey(const DWORD * c_pdwClientKey); void SetClientKey(const uint32_t * c_pdwClientKey);
const DWORD * GetClientKey(); const uint32_t* GetClientKey();
void SetKey(DWORD dwKey); void SetKey(DWORD dwKey);
DWORD GetKey(); DWORD GetKey();
@@ -46,7 +46,7 @@ class CLoginData
private: private:
DWORD m_dwKey; DWORD m_dwKey;
DWORD m_adwClientKey[4]; uint32_t m_adwClientKey[4];
DWORD m_dwConnectedPeerHandle; DWORD m_dwConnectedPeerHandle;
DWORD m_dwLogonTime; DWORD m_dwLogonTime;
char m_szIP[MAX_HOST_LENGTH+1]; char m_szIP[MAX_HOST_LENGTH+1];

View File

@@ -127,7 +127,7 @@ void CPeer::SetP2PPort(WORD wPort)
m_wP2PPort = wPort; m_wP2PPort = wPort;
} }
void CPeer::SetMaps(long * pl) void CPeer::SetMaps(int32_t * pl)
{ {
thecore_memcpy(m_alMaps, pl, sizeof(m_alMaps)); thecore_memcpy(m_alMaps, pl, sizeof(m_alMaps));
} }

View File

@@ -52,8 +52,8 @@ class CPeer : public CPeerBase
void SetP2PPort(WORD wPort); void SetP2PPort(WORD wPort);
WORD GetP2PPort() { return m_wP2PPort; } WORD GetP2PPort() { return m_wP2PPort; }
void SetMaps(long* pl); void SetMaps(int32_t* pl);
long * GetMaps() { return &m_alMaps[0]; } int32_t* GetMaps() { return &m_alMaps[0]; }
bool SetItemIDRange(TItemIDRangeTable itemRange); bool SetItemIDRange(TItemIDRangeTable itemRange);
bool SetSpareItemIDRange(TItemIDRangeTable itemRange); bool SetSpareItemIDRange(TItemIDRangeTable itemRange);
@@ -68,7 +68,7 @@ class CPeer : public CPeerBase
DWORD m_dwUserCount; DWORD m_dwUserCount;
WORD m_wListenPort; // 게임서버가 클라이언트를 위해 listen 하는 포트 WORD m_wListenPort; // 게임서버가 클라이언트를 위해 listen 하는 포트
WORD m_wP2PPort; // 게임서버가 게임서버 P2P 접속을 위해 listen 하는 포트 WORD m_wP2PPort; // 게임서버가 게임서버 P2P 접속을 위해 listen 하는 포트
long m_alMaps[32]; // 어떤 맵을 관장하고 있는가? int32_t m_alMaps[32]; // 어떤 맵을 관장하고 있는가?
TItemIDRangeTable m_itemRange; TItemIDRangeTable m_itemRange;
TItemIDRangeTable m_itemSpareRange; TItemIDRangeTable m_itemSpareRange;

View File

@@ -5239,9 +5239,9 @@ bool CHARACTER::WarpSet(long x, long y, long lPrivateMapIndex)
if (!IsPC()) if (!IsPC())
return false; return false;
long lAddr; uint32_t lAddr;
long lMapIndex; int32_t lMapIndex;
WORD wPort; uint16_t wPort;
if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort)) if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
{ {
@@ -5251,9 +5251,9 @@ bool CHARACTER::WarpSet(long x, long y, long lPrivateMapIndex)
//Send Supplementary Data Block if new map requires security packages in loading this map //Send Supplementary Data Block if new map requires security packages in loading this map
{ {
long lCurAddr; uint32_t lCurAddr;
long lCurMapIndex = 0; int32_t lCurMapIndex = 0;
WORD wCurPort; uint16_t wCurPort;
CMapLocation::instance().Get(GetX(), GetY(), lCurMapIndex, lCurAddr, wCurPort); CMapLocation::instance().Get(GetX(), GetY(), lCurMapIndex, lCurAddr, wCurPort);

View File

@@ -188,7 +188,7 @@ void map_allow_add(int index)
s_set_map_allows.insert(index); s_set_map_allows.insert(index);
} }
void map_allow_copy(long * pl, int size) void map_allow_copy(int32_t* pl, int size)
{ {
int iCount = 0; int iCount = 0;
std::set<int>::iterator it = s_set_map_allows.begin(); std::set<int>::iterator it = s_set_map_allows.begin();

View File

@@ -40,7 +40,7 @@ extern bool g_bTrafficProfileOn; ///< true 이면 TrafficProfiler 를 켠다.
extern BYTE g_bChannel; extern BYTE g_bChannel;
extern bool map_allow_find(int index); extern bool map_allow_find(int index);
extern void map_allow_copy(long * pl, int size); extern void map_allow_copy(int32_t * pl, int size);
extern bool no_wander; extern bool no_wander;
extern int g_iUserLimit; extern int g_iUserLimit;

View File

@@ -42,11 +42,11 @@ enum
typedef struct SUseTime typedef struct SUseTime
{ {
DWORD dwLoginKey; uint32_t dwLoginKey;
char szLogin[LOGIN_MAX_LEN+1]; char szLogin[LOGIN_MAX_LEN+1];
BYTE bBillType; uint8_t bBillType;
DWORD dwUseSec; uint32_t dwUseSec;
char szIP[MAX_HOST_LENGTH+1]; char szIP[MAX_HOST_LENGTH+1];
} TUseTime; } TUseTime;
class CQueryInfo class CQueryInfo

View File

@@ -72,7 +72,7 @@ bool GetServerLocation(TAccountTable & rTab, BYTE bEmpire)
continue; continue;
bFound = true; bFound = true;
long lIndex = 0; int32_t lIndex = 0;
if (!CMapLocation::instance().Get(rTab.players[i].x, if (!CMapLocation::instance().Get(rTab.players[i].x,
rTab.players[i].y, rTab.players[i].y,
@@ -219,8 +219,7 @@ void CInputDB::PlayerCreateSuccess(LPDESC d, const char * data)
return; return;
} }
long lIndex = 0; int32_t lIndex = 0;
if (!CMapLocation::instance().Get(pPacketDB->player.x, if (!CMapLocation::instance().Get(pPacketDB->player.x,
pPacketDB->player.y, pPacketDB->player.y,
lIndex, lIndex,

View File

@@ -1044,13 +1044,13 @@ bool CItem::CreateSocket(BYTE bSlot, BYTE bGold)
return true; return true;
} }
void CItem::SetSockets(const long * c_al) void CItem::SetSockets(const int32_t* c_al)
{ {
thecore_memcpy(m_alSockets, c_al, sizeof(m_alSockets)); thecore_memcpy(m_alSockets, c_al, sizeof(m_alSockets));
Save(); Save();
} }
void CItem::SetSocket(int i, long v, bool bLog) void CItem::SetSocket(int i, int32_t v, bool bLog)
{ {
assert(i < ITEM_SOCKET_MAX_NUM); assert(i < ITEM_SOCKET_MAX_NUM);
m_alSockets[i] = v; m_alSockets[i] = v;

View File

@@ -106,11 +106,11 @@ class CItem : public CEntity
void ModifyPoints(bool bAdd); // 아이템의 효과를 캐릭터에 부여 한다. bAdd가 false이면 제거함 void ModifyPoints(bool bAdd); // 아이템의 효과를 캐릭터에 부여 한다. bAdd가 false이면 제거함
bool CreateSocket(BYTE bSlot, BYTE bGold); bool CreateSocket(BYTE bSlot, BYTE bGold);
const long * GetSockets() { return &m_alSockets[0]; } const int32_t* GetSockets() { return &m_alSockets[0]; }
long GetSocket(int i) { return m_alSockets[i]; } int32_t GetSocket(int i) { return m_alSockets[i]; }
void SetSockets(const long * al); void SetSockets(const int32_t * al);
void SetSocket(int i, long v, bool bLog = true); void SetSocket(int i, int32_t v, bool bLog = true);
int GetSocketCount(); int GetSocketCount();
bool AddSocket(); bool AddSocket();
@@ -276,7 +276,7 @@ class CItem : public CEntity
bool m_bExchanging; ///< 현재 교환중 상태 bool m_bExchanging; ///< 현재 교환중 상태
long m_alSockets[ITEM_SOCKET_MAX_NUM]; // 아이템 소캣 int32_t m_alSockets[ITEM_SOCKET_MAX_NUM]; // 아이템 소캣
TPlayerItemAttribute m_aAttr[ITEM_ATTRIBUTE_MAX_NUM]; TPlayerItemAttribute m_aAttr[ITEM_ATTRIBUTE_MAX_NUM];
LPEVENT m_pkDestroyEvent; LPEVENT m_pkDestroyEvent;

View File

@@ -1,20 +1,17 @@
#include "stdafx.h"
#include "stdafx.h"
#include "map_location.h" #include "map_location.h"
#include "sectree_manager.h" #include "sectree_manager.h"
CMapLocation g_mapLocations; CMapLocation g_mapLocations;
bool CMapLocation::Get(long x, long y, long & lIndex, long & lAddr, WORD & wPort) bool CMapLocation::Get(long x, long y, int32_t& lIndex, uint32_t& lAddr, uint16_t& wPort)
{ {
lIndex = SECTREE_MANAGER::instance().GetMapIndex(x, y); lIndex = SECTREE_MANAGER::instance().GetMapIndex(x, y);
return Get(lIndex, lAddr, wPort); return Get(lIndex, lAddr, wPort);
} }
bool CMapLocation::Get(int iIndex, long & lAddr, WORD & wPort) bool CMapLocation::Get(int32_t iIndex, uint32_t& lAddr, uint16_t& wPort)
{ {
if (iIndex == 0) if (iIndex == 0)
{ {
@@ -40,7 +37,7 @@ bool CMapLocation::Get(int iIndex, long & lAddr, WORD & wPort)
return true; return true;
} }
void CMapLocation::Insert(long lIndex, const char * c_pszHost, WORD wPort) void CMapLocation::Insert(int32_t lIndex, const char * c_pszHost, uint16_t wPort)
{ {
TLocation loc; TLocation loc;

View File

@@ -6,13 +6,13 @@ class CMapLocation : public singleton<CMapLocation>
public: public:
typedef struct SLocation typedef struct SLocation
{ {
long addr; uint32_t addr;
WORD port; uint16_t port;
} TLocation; } TLocation;
bool Get(long x, long y, long & lMapIndex, long & lAddr, WORD & wPort); bool Get(long x, long y, int32_t& lMapIndex, uint32_t& lAddr, uint16_t& wPort);
bool Get(int iIndex, long & lAddr, WORD & wPort); bool Get(int32_t iIndex, uint32_t& lAddr, uint16_t& wPort);
void Insert(long lIndex, const char * c_pszHost, WORD wPort); void Insert(int32_t lIndex, const char * c_pszHost, uint16_t wPort);
protected: protected:
std::map<long, TLocation> m_map_address; std::map<long, TLocation> m_map_address;