diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c38067 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +**/msvc/Debug* +**/msvc/Release* +**/msvc/*.sdf +**/msvc/*.opensdf +**/msvc/*.user +**/msvc/*.suo +**/msvc/PublishPath*.txt +**/msvc/ipch diff --git a/Makefile b/Makefile index 5e0c49c..2c78e11 100644 --- a/Makefile +++ b/Makefile @@ -1,70 +1,49 @@ -#(C)2004-2005 AMX Mod X Development Team -# Makefile written by David "BAILOPAN" Anderson - HLSDK = sdk/hlsdk METAMOD = sdk/metamod M_INCLUDE = include -OPT_FLAGS = -O2 -funroll-loops -s -pipe -fomit-frame-pointer -fno-strict-aliasing -DEBUG_FLAGS = -g -ggdb3 -CPP = g++ NAME = localizebugfix - -BIN_SUFFIX_32 = mm_i386.so -BIN_SUFFIX_64 = mm_amd64.so +COMPILER = /opt/intel/bin/icpc OBJECTS = main.cpp memory.cpp meta_api.cpp -LINK = +LINK = -lm -ldl -static-intel -static-libgcc -no-intel-extensions + +OPT_FLAGS = -O3 -msse3 -ipo -no-prec-div -fp-model fast=2 -funroll-loops -fomit-frame-pointer -fno-stack-protector INCLUDE = -I. -I$(M_INCLUDE)/ -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/pm_shared -I$(METAMOD) -GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1) +BIN_DIR = Release +CFLAGS = $(OPT_FLAGS) -ifeq "$(GCC_VERSION)" "4" - OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden -endif +CFLAGS += -g0 -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -Dlinux -std=c++0x -shared -wd147,274 -fasm-blocks -ifeq "$(DEBUG)" "true" - BIN_DIR = Debug - CFLAGS = $(DEBUG_FLAGS) -else - BIN_DIR = Release - CFLAGS = $(OPT_FLAGS) -endif +OBJ_LINUX := $(OBJECTS:%.c=$(BIN_DIR)/%.o) -CFLAGS += -DNDEBUG -Wall -Wno-char-subscripts -Wno-unknown-pragmas -Wno-write-strings -Wno-deprecated -Wno-non-virtual-dtor -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc -m32 - -ifeq "$(AMD64)" "true" - BINARY = $(NAME)_$(BIN_SUFFIX_64) - CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 -else - BINARY = $(NAME)_$(BIN_SUFFIX_32) - CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 - OPT_FLAGS += -march=i586 -endif - -OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) - -$(BIN_DIR)/%.o: %.cpp - $(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $< +$(BIN_DIR)/%.o: %.c + $(COMPILER) $(INCLUDE) $(CFLAGS) -o $@ -c $< all: mkdir -p $(BIN_DIR) - $(MAKE) $(NAME) + mkdir -p $(BIN_DIR)/sdk -amd64: - $(MAKE) all AMD64=true + $(MAKE) $(NAME) && strip -x $(BIN_DIR)/$(NAME)_mm_i386.so $(NAME): $(OBJ_LINUX) - $(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) + $(COMPILER) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -o$(BIN_DIR)/$(NAME)_mm_i386.so + +check: + cppcheck $(INCLUDE) --quiet --max-configs=100 -D__linux__ -DNDEBUG -DHAVE_STDINT_H . debug: - $(MAKE) all DEBUG=true + $(MAKE) all DEBUG=false default: all clean: - rm -rf $(BIN_DIR)/*.o - rm -rf $(BIN_DIR)/$(NAME)_$(BIN_SUFFIX_32) - rm -rf $(BIN_DIR)/$(NAME)_$(BIN_SUFFIX_64) + rm -rf Release/sdk/*.o + rm -rf Release/*.o + rm -rf Release/$(NAME)_mm_i386.so + rm -rf Debug/sdk/*.o + rm -rf Debug/*.o + rm -rf Debug/$(NAME)_mm_i386.so diff --git a/bin/2.4/localizebugfix.dll b/bin/2.4/localizebugfix.dll new file mode 100644 index 0000000..b083cd0 Binary files /dev/null and b/bin/2.4/localizebugfix.dll differ diff --git a/bin/2.4/localizebugfix.pdb b/bin/2.4/localizebugfix.pdb new file mode 100644 index 0000000..39d53c6 Binary files /dev/null and b/bin/2.4/localizebugfix.pdb differ diff --git a/bin/2.4/localizebugfix_mm_i386.so b/bin/2.4/localizebugfix_mm_i386.so new file mode 100644 index 0000000..f6a5ea8 Binary files /dev/null and b/bin/2.4/localizebugfix_mm_i386.so differ diff --git a/include/main.h b/include/main.h index 71d67a0..5393079 100644 --- a/include/main.h +++ b/include/main.h @@ -40,15 +40,13 @@ #include "extdll.h" #include "meta_api.h" -#define MAX_CLIENTS 32 - #ifdef _WIN32 #define SIZEOF_CLIENT_T 20504 #define PLAYER_NAME_OFFSET 19720 #else #define SIZEOF_CLIENT_T 20212 #define PLAYER_NAME_OFFSET 19432 -#endif +#endif // _WIN32 typedef struct server_static_s { @@ -60,45 +58,35 @@ typedef struct server_static_s const char *szLocalizeBuffer[] = { - "#GameUI_DetailTextures", - "#Team_Select","#Team_Select_Spect","#IG_Team_Select","#IG_Team_Select_Spect","#IG_VIP_Team_Select","#IG_VIP_Team_Select_Spect","#Terrorist_Select", - "#CT_Select","#Buy","#CT_BuyItem","#T_BuyItem","#DCT_BuyItem","#DT_BuyItem","#CT_BuyPistol","#T_BuyPistol","#AS_BuyShotgun","#BuyShotgun","#CT_BuySubMachineGun", - "#T_BuySubMachineGun","#AS_CT_BuySubMachineGun","#AS_T_BuySubMachineGun","#T_BuyRifle","#CT_BuyRifle","#AS_T_BuyRifle","#AS_CT_BuyRifle","#AS_T_BuyMachineGun", - "#BuyMachineGun","#RadioA","#RadioB","#RadioC","#AK47","#SG552","#M4A1","#Famas","#Galil","#Aug","#Scout","#ArcticWarfareMagnum","#G3SG1","#SG550","#USP45","#Glock18", - "#DesertEagle","#P228","#Beretta96G","#FiveSeven","#Super90","#XM1014","#mp5navy","#tmp","#FNP90","#Mac10","#UMP45","#M249","#Krieg552","#M4A1_Short","#Schmidt","#Magnum", - "#D3AU1","#Krieg550","#KM45Tactical","#Sidearm9X19mm","#NightHawk","#P228Compact","#Dual40","#ESFiveSeven","#Leone12","#AutoShotgun","#SubMachineGun","#SchmidtMP","#ESC90", - "#Mac10_Short","#KMUMP45","#ESM249","#TEAMS","#PLAYERS","#CLASS","#SCORE","#DEATHS","#LATENCY","#VOICE","#Menu_OK","#Menu_Cancel","#Menu_Spectate","#Team_AutoAssign", - "#Title_SelectYourTeam","#Target_Bombed","#VIP_Escaped","#VIP_Assassinated","#Terrorists_Escaped","#CTs_PreventEscape","#Escaping_Terrorists_Neutralized","#Bomb_Defused", - "#CTs_Win","#Terrorists_Win","#Round_Draw","#All_Hostages_Rescued","#Target_Saved","#Hostages_Not_Rescued","#Terrorists_Not_Escaped","#VIP_Not_Escaped","#Cannot_Buy_This", - "#Not_Enough_Money","#Weapon_Not_Available","#Already_Have_Kevlar","#Already_Have_Kevlar_Helmet","#Already_Have_Kevlar_Bought_Helmet","#Cannot_Carry_Anymore","#Already_Have_One", - "#Cannot_Switch_From_VIP","#All_Teams_Full","#Terrorists_Full","#CTs_Full","#Too_Many_Terrorists","#Too_Many_CTs","#Wait_3_Seconds","#Only_1_Team_Change","#Ignore_Broadcast_Messages", - "#Ignore_Broadcast_Team_Messages","#Accept_All_Messages","#Ignore_Radio","#Accept_Radio","#Command_Not_Available","#Defusing_Bomb_With_Defuse_Kit", - "#Defusing_Bomb_Without_Defuse_Kit","#Killed_Hostage","#Injured_Hostage","#Auto_Team_Balance_Next_Round","#All_VIP_Slots_Full","#Killed_Teammate", - "#Banned_For_Killing_Teammates","#Cannot_Vote_Map","#Weapon_Cannot_Be_Dropped","#Terrorist_Escaped","#C4_Plant_At_Bomb_Spot","#C4_Plant_Must_Be_On_Ground", - "#C4_Arming_Cancelled","#Bomb_Planted","#C4_Activated_At_Bomb_Spot","#Switch_To_BurstFire","#Switch_To_SemiAuto","#Switch_To_FullAuto","#TRAINING1","#TRAINING2","#TRAINING3", - "#TRAINING4","#TRAINING5","#TRAINING6","#TRAINING7","#GAMESAVED","#Game_Commencing","#Game_connected","#Game_disconnected","#Game_join_terrorist","#Game_join_ct", - "#Game_join_terrorist_auto","#Game_join_ct_auto","#Game_scoring","#Game_idle_kick","#Game_bomb_drop","#Game_bomb_pickup","#Game_no_timelimit","#Game_timelimit", - "#Game_unknown_command","#Game_in_position","#Game_added_position","#Game_teammate_kills","#Game_required_votes","#Game_radio","#Game_teammate_attack","#Game_kicked", - "#Game_vote_cast","#Game_vote_usage","#Game_vote_player_not_found","#Game_vote_players_on_your_team","#Game_vote_not_yourself","#Game_voted_for_map","#Game_votemap_usage", - "#Cannot_Vote_Need_More_People","#Map_Vote_Extend","#Cannot_Vote_With_Less_Than_Three","#Game_will_restart_in","#Game_will_restart_in_console","#Cover_me","#You_take_the_point", - "#Hold_this_position","#Regroup_team","#Follow_me","#Taking_fire","#Go_go_go","#Team_fall_back","#Stick_together_team","#Get_in_position_and_wait","#Storm_the_front","#Report_in_team", - "#Affirmative","#Roger_that","#Enemy_spotted","#Need_backup","#Sector_clear","#In_position","#Reporting_in","#Get_out_of_there","#Negative","#Enemy_down","#Hostage_down", - "#Fire_in_the_hole","#Cant_buy","#VIP_cant_buy","#CT_cant_buy","#Terrorist_cant_buy","#Vote","#Votes","#Hint_press_buy_to_purchase","#Hint_use_nightvision","#Hint_lost_money", - "#Hint_removed_for_next_hostage_killed","#Hint_careful_around_hostages","#Hint_careful_around_teammates","#Hint_reward_for_killing_vip","#Hint_win_round_by_killing_enemy", - "#Hint_try_not_to_injure_teammates","#Hint_you_are_in_targetzone","#Hint_hostage_rescue_zone","#Hint_terrorist_escape_zone","#Hint_ct_vip_zone","#Hint_terrorist_vip_zone", - "#Hint_cannot_play_because_tk","#Hint_use_hostage_to_stop_him","#Hint_lead_hostage_to_rescue_point","#Hint_you_have_the_bomb","#Hint_you_are_the_vip","#Hint_out_of_ammo", - "#Hint_spotted_a_friend","#Hint_spotted_an_enemy","#Hint_prevent_hostage_rescue","#Hint_rescue_the_hostages","#Hint_press_use_so_hostage_will_follow","#Friend","#Enemy","#Hostage", - "#Health","#Map_descr_not_avail","#Class_descr_not_avail","#Title_terrorist_model_selection","#Phoenix_Connexion","#L337_Krew","#Arctic_Avengers","#Guerilla_Warfare","#Auto_Select", - "#Title_ct_model_selection","#Seal_Team_6","#Title_seal_team","#GSG_9","#Title_gsg9","#SAS","#Title_sas","#GIGN","#Title_gign","#Title_select_category_of_purchase", - "#Title_equipment_selection","#Kevlar","#Kevlar_Vest","#Kevlar_Helmet","#Kevlar_Vest_Ballistic_Helmet","#Flashbang","#HE_Grenade","#High_Explosive_Grenade","#Smoke_Grenade", - "#Defusal_Kit","#Bomb_Defusal_Kit","#NightVision","#Nightvision_Goggles","#TactShield","#TactShield_Desc","#Title_pistol_selection","#Pistols","#Buy_pistols", - "#Title_shotgun_selection","#Shotguns","#Buy_shotguns","#Title_smg_selection","#SMGs","#Buy_smgs","#Title_rifle_selection","#Rifles","#Buy_rifles","#Title_machinegun_selection", - "#MachineGuns","#Buy_machineguns","#Prim_Ammo","#Buy_prim_ammo","#Sec_Ammo","#Buy_sec_ammo","#Equipment","#Buy_equipment","#Terrorist_Forces","#CT_Forces","#VIP","#WINS","#BOMB","#DEAD", - "#SCORES","#Player","#Player_plural","#Got_defuser","#Got_bomb","#Mic_Volume","#Speaker_Volume","#Voice_Properties","#Cannot_Be_Spectator","#Map_Description_not_available","#Muted", - "#Unmuted","#No_longer_hear_that_player","#OBS_NONE","#OBS_CHASE_LOCKED","#OBS_CHASE_FREE","#OBS_ROAMING","#OBS_IN_EYE","#OBS_MAP_FREE","#OBS_MAP_CHASE","#SPECT_OPTIONS","#CAM_OPTIONS", - "#Name_change_at_respawn","#C4_Defuse_Must_Be_On_Ground","#Spec_Mode1","#Spec_Mode2","#Spec_Mode3","#Spec_Mode4","#Spec_Mode5","#Spec_Mode6","#Spec_NoTarget","#Spec_Help_Title", - "#Spec_Help_Text","#Spec_Slow_Motion","#Spec_Replay","#Spec_Auto","#Spec_Time","#Spec_Map","#Spectators","#Unassigned","#Only_CT_Can_Move_Hostages","#Spec_Duck", - "#Spec_Not_Valid_Choice","#Spec_Not_In_Spectator_Mode","#Spec_NoPlayers","#Spec_ListPlayers","#Selection_Not_Available","#Alias_Not_Avail","#Spec_No_PIP" + "#Team_Select", "#Team_Select_Spect", "#IG_Team_Select", "#IG_Team_Select_Spect", "#IG_VIP_Team_Select", "#IG_VIP_Team_Select_Spect", "#Terrorist_Select", + "#CT_Select", "#Buy", "#CT_BuyItem", "#T_BuyItem", "#DCT_BuyItem", "#DT_BuyItem", "#CT_BuyPistol", "#T_BuyPistol", "#AS_BuyShotgun", "#BuyShotgun", + "#CT_BuySubMachineGun", "#T_BuySubMachineGun", "#AS_CT_BuySubMachineGun", "#AS_T_BuySubMachineGun", "#T_BuyRifle", "#CT_BuyRifle", "#AS_T_BuyRifle", + "#AS_CT_BuyRifle", "#AS_T_BuyMachineGun", "#BuyMachineGun", "#RadioA", "#RadioB", "#RadioC", "#AK47", "#SG552", "#M4A1", "#Famas", "#Galil", "#Aug", "#Scout", + "#ArcticWarfareMagnum", "#G3SG1", "#SG550", "#USP45", "#Glock18", "#DesertEagle", "#P228", "#Beretta96G", "#FiveSeven", "#Super90", "#XM1014", "#mp5navy", "#tmp", + "#FNP90", "#Mac10", "#UMP45", "#M249", "#Krieg552", "#M4A1_Short", "#Schmidt", "#Magnum", "#D3AU1", "#Krieg550", "#KM45Tactical", "#Sidearm9X19mm", "#NightHawk", + "#P228Compact", "#Dual40", "#ESFiveSeven", "#Leone12", "#AutoShotgun", "#SubMachineGun", "#SchmidtMP", "#ESC90", "#Mac10_Short", "#KMUMP45", "#ESM249", "#TEAMS", + "#PLAYERS", "#CLASS", "#SCORE", "#DEATHS", "#LATENCY", "#VOICE", "#Menu_OK", "#Menu_Cancel", "#Menu_Spectate", "#Team_AutoAssign", "#Target_Bombed", "#VIP_Escaped", + "#VIP_Assassinated", "#Terrorists_Escaped", "#CTs_PreventEscape", "#Escaping_Terrorists_Neutralized", "#Bomb_Defused", "#CTs_Win", "#Terrorists_Win", "#Round_Draw", + "#All_Hostages_Rescued", "#Target_Saved", "#Hostages_Not_Rescued", "#Terrorists_Not_Escaped", "#VIP_Not_Escaped", "#Cannot_Buy_This", "#Not_Enough_Money", "#Weapon_Not_Available", + "#Already_Have_Kevlar", "#Already_Have_Kevlar_Helmet", "#Already_Have_Kevlar_Bought_Helmet", "#Cannot_Carry_Anymore", "#Already_Have_One", "#Cannot_Switch_From_VIP", "#All_Teams_Full", + "#Terrorists_Full", "#CTs_Full", "#Too_Many_Terrorists", "#Too_Many_CTs", "#Wait_3_Seconds", "#Only_1_Team_Change", "#Ignore_Broadcast_Messages", "#Ignore_Broadcast_Team_Messages", + "#Accept_All_Messages", "#Ignore_Radio", "#Accept_Radio", "#Command_Not_Available", "#Defusing_Bomb_With_Defuse_Kit", "#Defusing_Bomb_Without_Defuse_Kit", "#Killed_Hostage", + "#Injured_Hostage", "#Auto_Team_Balance_Next_Round", "#All_VIP_Slots_Full", "#Killed_Teammate", "#Banned_For_Killing_Teammates", "#Cannot_Vote_Map", "#Weapon_Cannot_Be_Dropped", + "#Terrorist_Escaped", "#C4_Plant_At_Bomb_Spot", "#C4_Plant_Must_Be_On_Ground", "#C4_Arming_Cancelled", "#Bomb_Planted", "#C4_Activated_At_Bomb_Spot", "#Switch_To_BurstFire", + "#Switch_To_SemiAuto", "#Switch_To_FullAuto", "#TRAINING1", "#TRAINING2", "#TRAINING3", "#TRAINING4", "#TRAINING5", "#TRAINING6", "#TRAINING7", "#GAMESAVED", "#Cannot_Vote_Need_More_People", + "#Map_Vote_Extend", "#Cannot_Vote_With_Less_Than_Three", "#Cover_me", "#You_take_the_point", "#Hold_this_position", "#Regroup_team", "#Follow_me", "#Taking_fire", "#Go_go_go", "#Team_fall_back", + "#Stick_together_team", "#Get_in_position_and_wait", "#Storm_the_front", "#Report_in_team", "#Affirmative", "#Roger_that", "#Enemy_spotted", "#Need_backup", "#Sector_clear", "#In_position", + "#Reporting_in", "#Get_out_of_there", "#Negative", "#Enemy_down", "#Hostage_down", "#Fire_in_the_hole", "#Cant_buy", "#VIP_cant_buy", "#CT_cant_buy", "#Terrorist_cant_buy", "#Vote", "#Votes", + "#Friend", "#Enemy", "#Hostage", "#Health", "#Map_descr_not_avail", "#Class_descr_not_avail", "#Phoenix_Connexion", "#L337_Krew", "#Arctic_Avengers", "#Guerilla_Warfare", "#Auto_Select", + "#Seal_Team_6", "#GSG_9", "#SAS", "#GIGN", "#Kevlar", "#Kevlar_Vest", "#Kevlar_Helmet", "#Kevlar_Vest_Ballistic_Helmet", "#Flashbang", "#HE_Grenade", "#High_Explosive_Grenade", "#Smoke_Grenade", + "#Defusal_Kit", "#Bomb_Defusal_Kit", "#NightVision", "#Nightvision_Goggles", "#TactShield", "#TactShield_Desc", "#Pistols", "#Buy_pistols", "#Shotguns", "#Buy_shotguns", "#SMGs", "#Buy_smgs", + "#Rifles", "#Buy_rifles", "#MachineGuns", "#Buy_machineguns", "#Prim_Ammo", "#Buy_prim_ammo", "#Sec_Ammo", "#Buy_sec_ammo", "#Equipment", "#Buy_equipment", "#Terrorist_Forces", "#CT_Forces", + "#VIP", "#WINS", "#BOMB", "#DEAD", "#SCORES", "#Player", "#Player_plural", "#Got_defuser", "#Got_bomb", "#Mic_Volume", "#Speaker_Volume", "#Voice_Properties", "#Cannot_Be_Spectator", + "#Map_Description_not_available", "#Muted", "#Unmuted", "#No_longer_hear_that_player", "#OBS_NONE", "#OBS_CHASE_LOCKED", "#OBS_CHASE_FREE", "#OBS_ROAMING", "#OBS_IN_EYE", "#OBS_MAP_FREE", + "#OBS_MAP_CHASE", "#SPECT_OPTIONS", "#CAM_OPTIONS", "#Name_change_at_respawn", "#C4_Defuse_Must_Be_On_Ground", "#Spectators", "#Unassigned", "#Only_CT_Can_Move_Hostages", "#Selection_Not_Available", + "#Alias_Not_Avail", "T0A0TITLE", "C0A0TITLE", "C0A1TITLE", "C1A1TITLE", "C1A2TITLE", "C1A3TITLE", "C1A4TITLE", "C2A1TITLE", "C2A2TITLE", "C2A3TITLE", "C2A4TITLE1", "C2A4TITLE2", "C2A5TITLE", + "C3A1TITLE", "C3A2TITLE", "C4A1TITLE", "C4A1ATITLE", "C4A2TITLE", "C4A3TITLE", "C5TITLE", + }; extern DLL_FUNCTIONS *g_pFunctionTable; @@ -107,7 +95,7 @@ static server_static_t *global_svs; static CVector localize; -static int localize_string(char *buf,bool apersand); +static int localize_string(char *buf, bool apersand); static void (*pfnCmd_TokenizeString)(char *buf); @@ -117,12 +105,12 @@ static inline void localize_push() for(int i = 0; i < j; i++) localize.push_back(szLocalizeBuffer[i]); -}; +} + static inline char *getClientName(edict_t *pEdict) { unsigned int p = ENTINDEX(pEdict) - 1; return (char *)(global_svs->clients + p * SIZEOF_CLIENT_T + PLAYER_NAME_OFFSET); } -#endif //_MAIN_H_ - +#endif // _MAIN_H_ diff --git a/main.cpp b/main.cpp index bd9c81e..e9f8cc7 100644 --- a/main.cpp +++ b/main.cpp @@ -35,12 +35,14 @@ void Cmd_TokenizeString_Handler(char *buf) { - if(!strncmp(buf,"say ",4) || !strncmp(buf,"say_team ",9)) + if (!strncmp(buf, "say ", 4) || !strncmp(buf, "say_team ", 9)) { - localize_string(buf,true); + localize_string(buf, true); } + pfnCmd_TokenizeString(buf); } + void OnMetaAttach() { lib_t lib; @@ -51,19 +53,20 @@ void OnMetaAttach() #ifdef _WIN32 char p1[] = "\x55\x8B\x2A\xA1\x2A\x2A\x2A\x2A\x56\x33\x2A\x85\x2A\x7E\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2A\x50"; char p2[] = "\x56\xE8\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x50\xFF\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x5E\xC3"; -#endif +#endif // _WIN32 - lib_load_info((void *)gpGlobals,&lib); + lib_load_info((void *)gpGlobals, &lib); #ifdef _WIN32 // * Cmd_TokenizeString | addr - 049A3FC0 - addr = lib_find_pattern(&lib,p1,sizeof(p1) - 1);//23 + addr = lib_find_pattern(&lib, p1, sizeof(p1) - 1);//23 #else - addr = lib_find_symbol(&lib,"Cmd_TokenizeString"); -#endif - if(!addr) + addr = lib_find_symbol(&lib, "Cmd_TokenizeString"); +#endif // _WIN32 + + if (!addr) { - LOG_ERROR(PLID,"can't find \"Cmd_TokenizeString\""); + LOG_ERROR(PLID, "can't find \"Cmd_TokenizeString\""); return; } @@ -71,11 +74,11 @@ void OnMetaAttach() #ifdef _WIN32 // * SV_ParseStringCommand | addr - 01DAB0AF - addr = lib_find_pattern(&lib,p2,sizeof(p2) - 1); + addr = lib_find_pattern(&lib, p2, sizeof(p2) - 1); - if(!addr) + if (!addr) { - LOG_ERROR(PLID,"can't find \"Cmd_TokenizeString\" inside function \"SV_ParseStringCommand\""); + LOG_ERROR(PLID, "can't find \"Cmd_TokenizeString\" inside function \"SV_ParseStringCommand\""); return; } // 01DAB0D8 56 push esi @@ -84,44 +87,45 @@ void OnMetaAttach() addr += 2;// 01DAB0D8 + 1 #else - addr = lib_find_symbol(&lib,"SV_ParseStringCommand"); + addr = lib_find_symbol(&lib, "SV_ParseStringCommand"); - if(!addr) + if (!addr) { - LOG_ERROR(PLID,"can't find \"SV_ParseStringCommand\""); + LOG_ERROR(PLID, "can't find \"SV_ParseStringCommand\""); return; } // 0009B1B0 53 push ebx // 0009B1B1 E8 AA A5 FA FF call Cmd_TokenizeString - addr = mem_find_ref(addr,200,'\xE8',(dword)pfnCmd_TokenizeString,1); + addr = mem_find_ref(addr, 200, '\xE8', (dword)pfnCmd_TokenizeString, 1); - if(!addr) + if (!addr) { - LOG_ERROR(PLID,"can't find \"Cmd_TokenizeString\" inside function \"SV_ParseStringCommand\""); + LOG_ERROR(PLID, "can't find \"Cmd_TokenizeString\" inside function \"SV_ParseStringCommand\""); return; } addr += 1; -#endif +#endif // _WIN32 + *(dword *)patch = (dword)Cmd_TokenizeString_Handler - (dword)addr - 4; - if(!mem_change_protection(addr,patch,sizeof(patch))) + if (!mem_change_protection(addr, patch, sizeof(patch))) { - LOG_ERROR(PLID,"patch failed."); + LOG_ERROR(PLID, "patch failed."); return; } #ifdef _WIN32 - addr = lib_find_pattern_fstr(&lib,"# name userid uniqueid frag time ping loss adr\n",-12,"\x68\x2A\x2A\x2A\x2A\x53\x56",7); + addr = lib_find_pattern_fstr(&lib, "# name userid uniqueid frag time ping loss adr\n", -12, "\x68\x2A\x2A\x2A\x2A\x53\x56", 7); #else - addr = lib_find_symbol(&lib,"svs"); -#endif + addr = lib_find_symbol(&lib, "svs"); +#endif // _WIN32 - if(!addr) + if (!addr) { - LOG_ERROR(PLID,"can't find \"svs\""); + LOG_ERROR(PLID, "can't find \"svs\""); return; } @@ -130,13 +134,14 @@ void OnMetaAttach() global_svs = (struct server_static_s *)(*(dword **)addr - 2); #else global_svs = (struct server_static_s *)addr; -#endif +#endif // _WIN32 localize_push(); -}; -void ClientUserInfoChanged(edict_t *pEdict,char *infobuffer) +} + +void ClientUserInfoChanged(edict_t *pEdict, char *infobuffer) { - if(!global_svs) + if (!global_svs) RETURN_META(MRES_IGNORED); char c; @@ -147,55 +152,60 @@ void ClientUserInfoChanged(edict_t *pEdict,char *infobuffer) int j = 0; s = getClientName(pEdict); - buf = INFOKEY_VALUE(infobuffer,"name"); + buf = INFOKEY_VALUE(infobuffer, "name"); - if(*s != '\0' && !strcmp(s,buf)) + if (*s != '\0' && !strcmp(s, buf)) + { RETURN_META(MRES_IGNORED); + } - if(*s == '#') + if (*s == '#') *s = '*'; - for(;*buf != '\0'; buf++, i++) + for (;*buf != '\0'; buf++, i++) { - if(*buf != '+') + if (*buf != '+') continue; c = *(buf + 1); - if(!isspace(c) && (isdigit(c) || isalpha(c))) + if (!isspace(c) && (isdigit(c) || isalpha(c))) { *buf = '*'; j++; } }; - if(localize_string(buf -= i,false) || j) + if (localize_string(buf -= i, false) || j) { - SET_CLIENT_KEYVALUE(ENTINDEX(pEdict),infobuffer,"name",buf); + SET_CLIENT_KEYVALUE(ENTINDEX(pEdict), infobuffer, "name", buf); } + RETURN_META(MRES_IGNORED); -}; +} + #ifdef _WIN32 -static char *strcasestr(const char *phaystack,const char *pneedle) +static char *strcasestr(const char *phaystack, const char *pneedle) { const char *a,*b; - for(;*phaystack; *phaystack++) + for (;*phaystack; *phaystack++) { a = phaystack; b = pneedle; - while((*a++|32) == (*b++|32)) + while ((*a++|32) == (*b++|32)) { - if(!*b) + if (!*b) return (char *)phaystack; } } return NULL; -}; -#endif -static int localize_string(char *buf,bool apersand) +} +#endif // _WIN32 + +static int localize_string(char *buf, bool apersand) { - if(*buf == '\0') + if (*buf == '\0') { return 0; } @@ -204,39 +214,44 @@ static int localize_string(char *buf,bool apersand) char *j,*a; char *c = buf; - if(apersand) + if (apersand) { do { - if(*c == '%') + if (*c == '%') *c = ' '; t++; - } while(*c++); + } while (*c++); c -= t; } t = 0; - while(1) + while (true) { - if(!c || !(j = strstr(c,"#"))) + if (!c || !(j = strstr(c, "#"))) break; c = j + 1; - if(!isdigit(*c) && isalpha(*c) && !isspace(*c)) + if (!isdigit(*c) && isalpha(*c) && !isspace(*c)) { - CVector *p = &(localize); - for(CVector::iterator i = p->begin(); i != p->end(); i++) + for (CVector::iterator i = localize.begin(); i != localize.end(); i++) { - while(1) + while (true) { - if(!(a = strcasestr(buf,(*i))) - && !(a = strcasestr(buf,"#CZero_")) - && !(a = strcasestr(buf,"#Cstrike_")) - && !(a = strcasestr(buf,"#Career_"))) + if (!(a = strcasestr(buf, (*i))) + && !(a = strcasestr(buf, "#CZero_")) + && !(a = strcasestr(buf, "#Cstrike_")) + && !(a = strcasestr(buf, "#Career_")) + && !(a = strcasestr(buf, "#GameUI_")) + && !(a = strcasestr(buf, "#Hint_")) + && !(a = strcasestr(buf, "#Spec_")) + && !(a = strcasestr(buf, "#Game_")) + && !(a = strcasestr(buf, "#Title_")) + && !(a = strcasestr(buf, "#Valve_"))) { break; } @@ -247,5 +262,6 @@ static int localize_string(char *buf,bool apersand) } } } + return (t > 0 && *buf != '\0'); -}; \ No newline at end of file +} diff --git a/meta_api.cpp b/meta_api.cpp index 6ef8582..09ffa00 100644 --- a/meta_api.cpp +++ b/meta_api.cpp @@ -35,19 +35,17 @@ #include "meta_api.h" #undef C_DLLEXPORT - #ifdef _WIN32 #define C_DLLEXPORT extern "C" __declspec(dllexport) #else - #include #define C_DLLEXPORT extern "C" __attribute__((visibility("default"))) -#endif +#endif // _WIN32 plugin_info_t Plugin_info = { META_INTERFACE_VERSION, "LocalizeBug Fix", - "2.3", + "2.4", "20/09/14", "s1lent", "http://www.aghl.ru/", diff --git a/msvc/PostBuild.bat b/msvc/PostBuild.bat new file mode 100644 index 0000000..8583878 --- /dev/null +++ b/msvc/PostBuild.bat @@ -0,0 +1,39 @@ +@echo OFF +:: +:: Post-build auto-deploy script +:: Create and fill PublishPath.txt file with path to deployment folder +:: I.e. PublishPath.txt should contain one line with a folder path +:: Call it so: +:: IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") +:: + +SET targetDir=%~1 +SET targetName=%~2 +SET targetExt=%~3 +SET projectDir=%~4 +SET destination= + +IF NOT EXIST "%projectDir%\PublishPath.txt" ( + ECHO No deployment path specified. Create PublishPath.txt near PostBuild.bat with paths on separate lines for auto deployment. + exit /B 0 +) + +FOR /f "tokens=* delims= usebackq" %%a IN ("%projectDir%\PublishPath.txt") DO ( + ECHO Deploying to: %%a + IF NOT "%%a" == "" ( + copy /Y "%targetDir%%targetName%%targetExt%" "%%a" + IF NOT ERRORLEVEL 1 ( + IF EXIST "%targetDir%%targetName%.pdb" ( + copy /Y "%targetDir%%targetName%.pdb" "%%a" + ) + ) ELSE ( + ECHO PostBuild.bat ^(27^) : warning : Can't copy '%targetName%%targetExt%' to deploy path '%%a' + ) + ) +) + +IF "%%a" == "" ( + ECHO No deployment path specified. +) + +exit /B 0 \ No newline at end of file diff --git a/msvc10/localizebugfix.sln b/msvc/localizebugfix.sln similarity index 83% rename from msvc10/localizebugfix.sln rename to msvc/localizebugfix.sln index af09dbf..6134f1c 100644 --- a/msvc10/localizebugfix.sln +++ b/msvc/localizebugfix.sln @@ -1,20 +1,22 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "localizebugfix", "localizebugfix.vcxproj", "{933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Debug|Win32.ActiveCfg = Debug|Win32 - {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Debug|Win32.Build.0 = Debug|Win32 - {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Release|Win32.ActiveCfg = Release|Win32 - {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "localizebugfix", "localizebugfix.vcxproj", "{933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Debug|Win32.ActiveCfg = Debug|Win32 + {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Debug|Win32.Build.0 = Debug|Win32 + {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Release|Win32.ActiveCfg = Release|Win32 + {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/msvc10/localizebugfix.vcxproj b/msvc/localizebugfix.vcxproj similarity index 84% rename from msvc10/localizebugfix.vcxproj rename to msvc/localizebugfix.vcxproj index 6707ea1..706b9af 100644 --- a/msvc10/localizebugfix.vcxproj +++ b/msvc/localizebugfix.vcxproj @@ -1,142 +1,138 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - - - - - - - - - - - {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851} - Win32Proj - shdetect - localizebugfix - - - - DynamicLibrary - true - v110 - MultiByte - - - DynamicLibrary - false - v100 - MultiByte - true - - - - - - - - - - - - - false - - - false - - - - - - TurnOffAllWarnings - Full - WIN32;NDEBUG;%(PreprocessorDefinitions) - include\;sdk\metamod;sdk\hlsdk\common;sdk\hlsdk\engine;sdk\hlsdk\dlls;sdk\hlsdk\pm_shared - Default - MultiThreadedDebugDLL - ProgramDatabase - - - Windows - false - false - false - %(AdditionalLibraryDirectories) - - - - - TurnOffAllWarnings - NotUsing - Full - true - false - WIN32;%(PreprocessorDefinitions) - ..\include\;..\sdk\metamod;..\sdk\hlsdk\common;..\sdk\hlsdk\engine;..\sdk\hlsdk\dlls;..\sdk\hlsdk\pm_shared - OnlyExplicitInline - false - false - MultiThreaded - - - - - - - Windows - true - true - true - psapi.lib - %(AdditionalLibraryDirectories) - - - false - - - - - - - echo "LocalizeBugFix Compiling" - - - - -copy /Y "$(TargetDir)localizebugfix.dll" "D:\HLDS\cstrike\addons\localizebugfix\localizebugfix.dll" - - - - - -copy /Y "$(TargetDir)localizebugfix.dll" "C:\CrashDumps\localizebugfix.dll" - - -copy /Y "$(TargetDir)localizebugfix.pdb" "C:\CrashDumps\localizebugfix.pdb" - - - - - -rmdir /q /s Release - - -IF EXIST "$(ProjectDir)ServerStart.bat" (CALL "$(ProjectDir)ServerStart.bat" "$(ProjectDir)..\" "$(ProjectDir)..\") - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + {933B0D94-C6EC-47FB-AE34-2DC9F2B6D851} + Win32Proj + localizebugfix + localizebugfix + + + + DynamicLibrary + true + v120_xp + MultiByte + + + DynamicLibrary + false + v120_xp + MultiByte + true + + + + + + + + + + + + + false + + + false + true + true + + + + + + TurnOffAllWarnings + Full + WIN32;NDEBUG;%(PreprocessorDefinitions) + include\;sdk\metamod;sdk\hlsdk\common;sdk\hlsdk\engine;sdk\hlsdk\dlls;sdk\hlsdk\pm_shared + Default + MultiThreadedDebugDLL + ProgramDatabase + + + Windows + false + false + false + %(AdditionalLibraryDirectories) + + + + + TurnOffAllWarnings + NotUsing + Full + true + false + WIN32;%(PreprocessorDefinitions) + ..\include\;..\sdk\metamod;..\sdk\hlsdk\common;..\sdk\hlsdk\engine;..\sdk\hlsdk\dlls;..\sdk\hlsdk\pm_shared + OnlyExplicitInline + false + false + MultiThreaded + + + + + + + + + Windows + true + true + true + psapi.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories) + + + false + + + + + + + + + IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") + Automatic deployment script + + + echo Empty Action + + + Force build to run Pre-Build event + + + subversion.always.run + + + subversion.always.run + + + + + \ No newline at end of file diff --git a/msvc10/localizebugfix.vcxproj.filters b/msvc/localizebugfix.vcxproj.filters similarity index 97% rename from msvc10/localizebugfix.vcxproj.filters rename to msvc/localizebugfix.vcxproj.filters index 62a4779..5ea949e 100644 --- a/msvc10/localizebugfix.vcxproj.filters +++ b/msvc/localizebugfix.vcxproj.filters @@ -1,39 +1,39 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Файлы исходного кода - - - Файлы исходного кода - - - Файлы исходного кода - - - - - Заголовочные файлы - - - Заголовочные файлы - - - Заголовочные файлы - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Файлы исходного кода + + + Файлы исходного кода + + + Файлы исходного кода + + + + + Заголовочные файлы + + + Заголовочные файлы + + + Заголовочные файлы + + \ No newline at end of file diff --git a/msvc10/localizebugfix.suo b/msvc10/localizebugfix.suo deleted file mode 100644 index 9eb70fb..0000000 Binary files a/msvc10/localizebugfix.suo and /dev/null differ