From c31e2be46facb49f1d812c85924296feeeb3b502 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 15 Feb 2006 17:31:30 +0000 Subject: [PATCH] added backward compatibility for % mistakes --- amxmodx/JIT/helpers-x86.o | Bin 7136 -> 7104 bytes amxmodx/JIT/helpers-x86.obj | Bin 7319 -> 7276 bytes amxmodx/amxmodx.cpp | 112 +++++++++++++++++++++++++++++++++++- amxmodx/helpers-x86.asm | 20 ++++--- 4 files changed, 123 insertions(+), 9 deletions(-) diff --git a/amxmodx/JIT/helpers-x86.o b/amxmodx/JIT/helpers-x86.o index 92e89925d0b58d37cba0fdd54b0d2db2b8a454aa..9bf2644ef146c0492c770ccb9e9f3eadabe0186e 100644 GIT binary patch literal 7104 zcmeI%e@q+a83*w9>;#k0$=;w%x3F>>W+aW`kP(&qsFctUtcsK$a|w%BdUMQSApXJZ zLnKNn)Yyp78=_kN$R;*rRaQ}nKe8!P>4YZ2$ndgkVrr^oRn%rGniAw_*_LV1luWnh zvA+iw<4)Q?{inRr@p+&3eeS)x*YBA-7&vgSUXmnX7D?E}awNn)bnM8uNvsoV%+&u& z9+S5M?DbO$p0Y0w;X>6xa-P}s2RfX$a5>LB`sa{m_Q=#wW(JnNr>Jg@#ohZTuZ}Ay zd@L?9Z8ol;yg_+CrUpJ=nKnKypW`Oltm9Qt;|G=<&GD)zZyjxBaTN>kHU(>G;~XB3 zFKah#*1XG<#~qx8?vea8e zweMwme@8#3X~5L!Kcn}^EDhb}JM@cZs5x<0o?GLt7&+yZwqJg|AbHuDoT9vuFMFv| zFG&o(=N#k{9lYvH7LjKh-uf3gukT~d9i`kejybO+>h)J2>8<~y9qE(}cS1k%gl?a? zW7At*`ubfn&Y@;XP1vO2KfQLBFMD{Q%b+FTGj^OY`U>wnG7Q5va^!uV(O24*i4s@j z*RF7;lv;e2_FXZc!KZJN^wvWC3;GK#=~wm=-S~RW7%tlTE?-LS>CEKW`vY6zZsCWe z?wm17XpFaW$Ef9NI+Yp3*3u(-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4{170ono;L))R9PzmIO z%Ag9!1=T>ckN|lgA9Mr~p)hn5Iu5l$GSmSnP!H4#^+Em6S?C-z01ZMz(0S+rGz^VE z<4_cugr=ZrXa>3r%|dg~RVW56KsTX9=oX|xmNd*iC=0Sexllf|3MzmKp(1DE3ki@1@`q2o|1BtspL0`)+> zP#@F}orTUp1JEEe1f7R2K*P`oG!8|fNoWe1hGwA4&@40uU4>%M0(28vgl<79WTDlc z`22&iAS;v$nu>gk!t0Mc zvCZKQ2dM7vOVoTF!D8Zz(0oa8X}i5V%@cm-7875f)|OOwq-_rO;jrkBXsg{Sol9TI zrY|kn_>qj=i?ZGqV+Bdc<4MVmq{JCd_%-W2A4p30A}qiEr8Xz1^lCiOukZ|&-Zvye zRQk-2Oj3!jjcemWX6z?=@s;+agl<_|U0+J_iK?N^W-9UDVoPl*l9Gm`q?Hnf;ixl| zY&0Z;loZDk+R^q=Qt~+^RfeOkP||2fZcq|5BrB-&vLVT*QlBB=SJ!Vyc2ntXL$aSr z1BRrDN+X6urqZ|};k|xiNIs;}A`+kA4Tb6h+N`6HW}Qz6_<3-9u~&b}6I97(jNXQi z&sRK&f2X#v@2Dh{i@s+Fh`L8H(f$IZ`hL}(uO~|WiUn4q#o&$H>pdW(afRyO6ZhV e1o^X0k@NYT5Np@v6Fd#>kaXBj?*cykxc&ldoFa4p diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 448d3b3c..318e0677 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -1478,6 +1478,18 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */ return len; } +static cell AMX_NATIVE_CALL get_pcvar_string(AMX *amx, cell *params) +{ + cvar_t *ptr = reinterpret_cast(params[1]); + if (!ptr) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer"); + return 0; + } + + return set_amxstring(amx, params[2], ptr->string ? ptr->string : "", params[3]); +} + static cell AMX_NATIVE_CALL get_cvar_string(AMX *amx, cell *params) /* 3 param */ { int ilen; @@ -1486,6 +1498,18 @@ static cell AMX_NATIVE_CALL get_cvar_string(AMX *amx, cell *params) /* 3 param * return set_amxstring(amx, params[2], CVAR_GET_STRING(sptemp), params[3]); } +static cell AMX_NATIVE_CALL get_pcvar_float(AMX *amx, cell *params) +{ + cvar_t *ptr = reinterpret_cast(params[1]); + if (!ptr) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer"); + return 0; + } + + return amx_ftoc(ptr->value); +} + static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */ { int ilen; @@ -1494,6 +1518,20 @@ static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */ return amx_ftoc(pFloat); } +static cell AMX_NATIVE_CALL set_pcvar_float(AMX *amx, cell *params) +{ + cvar_t *ptr = reinterpret_cast(params[1]); + if (!ptr) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer"); + return 0; + } + + ptr->value = amx_ctof(params[2]); + + return 1; +} + static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */ { int ilen; @@ -1502,12 +1540,38 @@ static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */ return 1; } +static cell AMX_NATIVE_CALL get_pcvar_num(AMX *amx, cell *params) +{ + cvar_t *ptr = reinterpret_cast(params[1]); + if (!ptr) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer"); + return 0; + } + + return (int)ptr->value; +} + static cell AMX_NATIVE_CALL get_cvar_num(AMX *amx, cell *params) /* 1 param */ { int ilen; return (int)CVAR_GET_FLOAT(get_amxstring(amx, params[1], 0, ilen)); } +static cell AMX_NATIVE_CALL set_pcvar_num(AMX *amx, cell *params) +{ + cvar_t *ptr = reinterpret_cast(params[1]); + if (!ptr) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer"); + return 0; + } + + ptr->value = (float)params[2]; + + return 1; +} + static cell AMX_NATIVE_CALL set_cvar_num(AMX *amx, cell *params) /* 2 param */ { int ilen; @@ -2203,10 +2267,10 @@ static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params) /* 3 param */ } CVAR_SET_STRING(temp, get_amxstring(amx, params[2], 1, i)); - return 1; + return reinterpret_cast(CVAR_GET_POINTER(temp)); } - return 0; + return reinterpret_cast(CVAR_GET_POINTER(temp)); } static cell AMX_NATIVE_CALL get_user_ping(AMX *amx, cell *params) /* 3 param */ @@ -2662,6 +2726,18 @@ static cell AMX_NATIVE_CALL remove_cvar_flags(AMX *amx, cell *params) return 0; } +static cell AMX_NATIVE_CALL get_pcvar_flags(AMX *amx, cell *params) +{ + cvar_t *ptr = reinterpret_cast(params[1]); + if (!ptr) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer"); + return 0; + } + + return ptr->flags; +} + static cell AMX_NATIVE_CALL get_cvar_flags(AMX *amx, cell *params) { int ilen; @@ -2671,6 +2747,20 @@ static cell AMX_NATIVE_CALL get_cvar_flags(AMX *amx, cell *params) return pCvar ? pCvar->flags : 0; } +static cell AMX_NATIVE_CALL set_pcvar_flags(AMX *amx, cell *params) +{ + cvar_t *ptr = reinterpret_cast(params[1]); + if (!ptr) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer"); + return 0; + } + + ptr->flags = static_cast(params[2]); + + return 1; +} + static cell AMX_NATIVE_CALL set_cvar_flags(AMX *amx, cell *params) { int ilen; @@ -3778,6 +3868,16 @@ static cell AMX_NATIVE_CALL DestroyForward(AMX *amx, cell *params) return 1; } +static cell AMX_NATIVE_CALL get_cvar_pointer(AMX *amx, cell *params) +{ + int len; + char *temp = get_amxstring(amx, params[1], 0, len); + + cvar_t *ptr = CVAR_GET_POINTER(temp); + + return reinterpret_cast(ptr); +} + AMX_NATIVE_INFO amxmodx_Natives[] = { {"abort", amx_abort}, @@ -3812,6 +3912,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] = {"get_cvar_flags", get_cvar_flags}, {"get_cvar_float", get_cvar_float}, {"get_cvar_num", get_cvar_num}, + {"get_cvar_pointer", get_cvar_pointer}, {"get_cvar_string", get_cvar_string}, {"get_distance", get_distance}, {"get_distance_f", get_distance_f}, @@ -3826,6 +3927,10 @@ AMX_NATIVE_INFO amxmodx_Natives[] = {"get_modname", get_modname}, {"get_module", get_module}, {"get_modulesnum", get_modulesnum}, + {"get_pcvar_flags", get_pcvar_flags}, + {"get_pcvar_float", get_pcvar_float}, + {"get_pcvar_num", get_pcvar_num}, + {"get_pcvar_string", get_pcvar_string}, {"get_players", get_players}, {"get_playersnum", get_playersnum}, {"get_plugin", get_plugin}, @@ -3932,6 +4037,9 @@ AMX_NATIVE_INFO amxmodx_Natives[] = {"set_fail_state", set_fail_state}, {"set_hudmessage", set_hudmessage}, {"set_localinfo", set_localinfo}, + {"set_pcvar_flags", set_pcvar_flags}, + {"set_pcvar_float", set_pcvar_float}, + {"set_pcvar_num", set_pcvar_num}, {"set_task", set_task}, {"set_user_flags", set_user_flags}, {"set_user_info", set_user_info}, diff --git a/amxmodx/helpers-x86.asm b/amxmodx/helpers-x86.asm index 57a1c71e..f62e8b2f 100644 --- a/amxmodx/helpers-x86.asm +++ b/amxmodx/helpers-x86.asm @@ -33,7 +33,7 @@ _init_format_jumps: mov [edx+'g'*4], dword format_parameter.fmt_float mov [edx+'i'*4], dword format_parameter.fmt_num mov [edx+'L'*4], dword format_parameter.fmt_ml - mov [edx+'p'*4], dword format_parameter.fmt_ptr + ;mov [edx+'p'*4], dword format_parameter.fmt_ptr mov [edx+'s'*4], dword format_parameter.fmt_string mov [edx+'x'*4], dword format_parameter.fmt_num @@ -58,6 +58,7 @@ format_parameter: push edi push ebx + push esi ;len=30 mov ecx, 30 @@ -100,7 +101,7 @@ format_parameter: inc esi ;get output ptr mov edi, [ebp-4] - + mov edx, [ebp-12] lea ebx, [g_jumptbl] jmp [ebx+eax*4] ;LOLolOLoL. @@ -124,7 +125,7 @@ format_parameter: push dword [ebp+8] ;context call _get_amxstring_r push ebx ;push buffer - lea ebx, [ebp-40] + lea ebx, [ebp-44] push ebx ;push format push dword [ebp+28] ;push maxlen push edi ;push output @@ -151,7 +152,7 @@ format_parameter: add edx, eax ;add dat to base add edx, dword [ebx+ecx*4] ;add params[ecx] push dword [edx] - lea ebx, [ebp-40] + lea ebx, [ebp-44] push ebx push dword [ebp+28] push edi @@ -181,7 +182,7 @@ format_parameter: sub esp, 8 fstp qword [esp] ;it's already on the stack now, push rest - lea ebx, [ebp-40] + lea ebx, [ebp-44] push ebx push dword [ebp+28] push edi @@ -250,8 +251,12 @@ format_parameter: .fmt_default - -.fmt_ptr + mov esi, edx + ;store the % at least + mov [edi], byte '%' + inc edi + mov eax, 1 + jmp .end .error push ecx @@ -267,6 +272,7 @@ format_parameter: .end add esp, 32 + pop ecx pop ebx pop ecx