From 864f7c268e2da8a3c2b93181cd8b3acc1b0ad2d4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 25 Aug 2005 08:34:09 +0000 Subject: [PATCH] Fixed module for AMD64 --- dlls/cstrike/cstrike.cpp | 17 +++++++++++++++-- dlls/cstrike/cstrike.h | 2 -- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dlls/cstrike/cstrike.cpp b/dlls/cstrike/cstrike.cpp index 862fe848..99f8cf1a 100755 --- a/dlls/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike.cpp @@ -175,7 +175,7 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params) // cs // Make into edict pointer edict_t *pWeapon = INDEXENT(params[1]); - int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE); + int weapontype = *((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE); int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE); switch (weapontype) { case CSW_M4A1: @@ -357,10 +357,12 @@ static cell AMX_NATIVE_CALL cs_get_user_armor(AMX *amx, cell *params) // cs_get_ // Make into edict pointer edict_t *pPlayer = MF_GetPlayerEdict(params[1]); +#if 0 cell *armorTypeByRef = MF_GetAmxAddr(amx, params[2]); *armorTypeByRef = *((int *)pPlayer->pvPrivateData + OFFSET_ARMORTYPE); +#endif - return pPlayer->v.armorvalue; + return (cell)pPlayer->v.armorvalue; } static cell AMX_NATIVE_CALL cs_set_user_armor(AMX *amx, cell *params) // cs_set_user_armor(index, armorvalue, CsArmorType:armortype); = 3 params @@ -1250,6 +1252,7 @@ static cell AMX_NATIVE_CALL cs_get_armoury_type(AMX *amx, cell *params) return 0; } +#if PAWN_CELL_SIZE == 32 int weapontype = *((int *)pArmoury->pvPrivateData + OFFSET_ARMOURY_TYPE); // We do a switch instead of a mapped array because this way we can nicely catch unexpected values, and we don't get array out of bounds thingies. @@ -1280,6 +1283,10 @@ static cell AMX_NATIVE_CALL cs_get_armoury_type(AMX *amx, cell *params) } return weapontype_out; +#else + MF_LogError(amx, AMX_ERR_NATIVE, "This function not implemented on AMD64."); + return 0; +#endif } static cell AMX_NATIVE_CALL cs_set_armoury_type(AMX *amx, cell *params) @@ -1301,6 +1308,8 @@ static cell AMX_NATIVE_CALL cs_set_armoury_type(AMX *amx, cell *params) return 0; } +#if PAWN_CELL_SIZE == 32 + // We do a switch instead of a mapped array because this way we can nicely catch unexpected values, and we don't get array out of bounds thingies. int weapontype; switch (params[2]) { @@ -1331,6 +1340,10 @@ static cell AMX_NATIVE_CALL cs_set_armoury_type(AMX *amx, cell *params) *((int *)pArmoury->pvPrivateData + OFFSET_ARMOURY_TYPE) = weapontype; return 1; +#else + MF_LogError(amx, AMX_ERR_NATIVE, "This function not implemented on AMD64."); + return 0; +#endif } AMX_NATIVE_INFO cstrike_Exports[] = { diff --git a/dlls/cstrike/cstrike.h b/dlls/cstrike/cstrike.h index 3f5e5b53..d30a33ed 100755 --- a/dlls/cstrike/cstrike.h +++ b/dlls/cstrike/cstrike.h @@ -143,8 +143,6 @@ // "hostage_entity" entities #define OFFSET_HOSTAGEFOLLOW 51 + EXTRAOFFSET // +21, long=51, int=107! (must use the long* offset because pointers on amd64 are stored the size of longs, 8 bytes, instead of the usual int 4 bytes.) #define OFFSET_HOSTAGEID 516 + EXTRAOFFSET // +29 - // "armoury_entity" - #define OFFSET_WEAPONTYPE ??? + EXTRAOFFSET // To do... #endif // Ids of weapons in CS