Move dlls/ to modules/
This commit is contained in:
28
modules/geoip/AMBuilder
Normal file
28
modules/geoip/AMBuilder
Normal file
@@ -0,0 +1,28 @@
|
||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||
import os.path
|
||||
|
||||
binary = AMXX.MetaModule(builder, 'geoip')
|
||||
|
||||
binary.compiler.cxxincludes += [
|
||||
os.path.join(builder.currentSourcePath, '..', '..', 'third_party', 'libmaxminddb')
|
||||
]
|
||||
|
||||
binary.compiler.defines += [
|
||||
'HAVE_STDINT_H'
|
||||
]
|
||||
|
||||
binary.sources = [
|
||||
'../../public/sdk/amxxmodule.cpp',
|
||||
'../../third_party/libmaxminddb/maxminddb.c',
|
||||
'geoip_main.cpp',
|
||||
'geoip_natives.cpp',
|
||||
'geoip_util.cpp',
|
||||
]
|
||||
|
||||
if builder.target_platform == 'windows':
|
||||
binary.sources += ['version.rc']
|
||||
|
||||
if builder.target_platform == 'windows':
|
||||
binary.compiler.postlink += ['ws2_32.lib']
|
||||
|
||||
AMXX.modules += [builder.Add(binary)]
|
BIN
modules/geoip/GeoLite2-Country.mmdb
Normal file
BIN
modules/geoip/GeoLite2-Country.mmdb
Normal file
Binary file not shown.
130
modules/geoip/Makefile
Normal file
130
modules/geoip/Makefile
Normal file
@@ -0,0 +1,130 @@
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../public
|
||||
THIRD_PARTY = $(PUBLIC_ROOT)/third_party
|
||||
GEOIP = $(THIRD_PARTY)/libmaxminddb
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
PROJECT = geoip
|
||||
|
||||
OBJECTS = amxxmodule.cpp $(GEOIP)/maxminddb.c geoip_main.cpp geoip_natives.cpp geoip_util.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared\
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _amxx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _amxx_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CPPFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
OBJ_BIN := $(OBJ_BIN:%.c=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
$(BIN_DIR)/%.o: %.c
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
22
modules/geoip/geoip_amxx.h
Normal file
22
modules/geoip/geoip_amxx.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// GeoIP Module
|
||||
//
|
||||
|
||||
#ifndef _INCLUDE_GEOIPAMXX_H
|
||||
#define _INCLUDE_GEOIPAMXX_H
|
||||
|
||||
#include "GeoIP2/maxminddb.h"
|
||||
#include "amxxmodule.h"
|
||||
|
||||
extern AMX_NATIVE_INFO geoip_natives[];
|
||||
|
||||
#endif //_INCLUDE_GEOIPAMXX_H
|
232
modules/geoip/geoip_main.cpp
Normal file
232
modules/geoip/geoip_main.cpp
Normal file
@@ -0,0 +1,232 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// GeoIP Module
|
||||
//
|
||||
|
||||
#include "geoip_main.h"
|
||||
#include "geoip_natives.h"
|
||||
#include "geoip_util.h"
|
||||
#include <time.h>
|
||||
|
||||
MMDB_s HandleDB;
|
||||
ke::Vector<ke::AString> LangList;
|
||||
|
||||
void OnAmxxAttach()
|
||||
{
|
||||
if (loadDatabase())
|
||||
{
|
||||
MF_AddNatives(GeoipNatives);
|
||||
}
|
||||
|
||||
REG_SVR_COMMAND("geoip", OnGeoipCommand);
|
||||
}
|
||||
|
||||
void OnAmxxDetach()
|
||||
{
|
||||
MMDB_close(&HandleDB);
|
||||
|
||||
LangList.clear();
|
||||
}
|
||||
|
||||
void OnGeoipCommand()
|
||||
{
|
||||
const char *cmd = CMD_ARGV(1);
|
||||
|
||||
if (!strcmp(cmd, "version"))
|
||||
{
|
||||
if (!HandleDB.filename)
|
||||
{
|
||||
MF_PrintSrvConsole("\n Database is not loaded.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
const char *meta_dump = "\n"
|
||||
" Database metadata\n"
|
||||
" Node count: %i\n"
|
||||
" Record size: %i bits\n"
|
||||
" IP version: IPv%i\n"
|
||||
" Binary format: %i.%i\n"
|
||||
" Build epoch: %llu (%s)\n"
|
||||
" Type: %s\n"
|
||||
" Languages: ";
|
||||
|
||||
char date[40];
|
||||
strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S UTC", gmtime((const time_t *)&HandleDB.metadata.build_epoch));
|
||||
|
||||
fprintf(stdout, meta_dump,
|
||||
HandleDB.metadata.node_count,
|
||||
HandleDB.metadata.record_size,
|
||||
HandleDB.metadata.ip_version,
|
||||
HandleDB.metadata.binary_format_major_version,
|
||||
HandleDB.metadata.binary_format_minor_version,
|
||||
HandleDB.metadata.build_epoch,
|
||||
date,
|
||||
HandleDB.metadata.database_type);
|
||||
|
||||
for (size_t i = 0; i < HandleDB.metadata.languages.count; ++i)
|
||||
{
|
||||
fprintf(stdout, "%s", HandleDB.metadata.languages.names[i]);
|
||||
|
||||
if (i < HandleDB.metadata.languages.count - 1)
|
||||
{
|
||||
fprintf(stdout, " ");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout, " Description:\n");
|
||||
|
||||
for (size_t i = 0; i < HandleDB.metadata.description.count; ++i)
|
||||
{
|
||||
fprintf(stdout, " %s: %s\n",
|
||||
HandleDB.metadata.description.descriptions[i]->language,
|
||||
HandleDB.metadata.description.descriptions[i]->description);
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
else if (!strcmp(cmd, "dump"))
|
||||
{
|
||||
if (!HandleDB.filename)
|
||||
{
|
||||
MF_PrintSrvConsole("\n Database is not loaded.\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int num_args = CMD_ARGC();
|
||||
|
||||
if (num_args < 3)
|
||||
{
|
||||
MF_PrintSrvConsole("\n An IP address must be provided.\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
char *ip = stripPort((char *)CMD_ARGV(2));
|
||||
|
||||
int gai_error = 0;
|
||||
int mmdb_error = 0;
|
||||
|
||||
MMDB_lookup_result_s result = MMDB_lookup_string(&HandleDB, ip, &gai_error, &mmdb_error);
|
||||
|
||||
if (gai_error != 0 || mmdb_error != MMDB_SUCCESS || !result.found_entry)
|
||||
{
|
||||
MF_PrintSrvConsole("\n Either look up failed or no found result.\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
MMDB_entry_data_list_s *entry_data_list = NULL;
|
||||
int status = -1;
|
||||
|
||||
if ((status = MMDB_get_entry_data_list(&result.entry, &entry_data_list)) != MMDB_SUCCESS || entry_data_list == NULL)
|
||||
{
|
||||
MF_PrintSrvConsole("\n Could not retrieve data list - %s.\n\n", MMDB_strerror(status));
|
||||
return;
|
||||
}
|
||||
|
||||
const char *file = NULL;
|
||||
FILE *fp = NULL;
|
||||
|
||||
if (num_args > 3)
|
||||
{
|
||||
file = CMD_ARGV(3);
|
||||
fp = fopen(MF_BuildPathname("%s", file), "w");
|
||||
}
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
file = NULL;
|
||||
fp = stdout;
|
||||
}
|
||||
|
||||
fprintf(fp, "\n");
|
||||
MMDB_dump_entry_data_list(fp, entry_data_list, 2);
|
||||
fprintf(fp, "\n");
|
||||
|
||||
if (file)
|
||||
{
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
MMDB_free_entry_data_list(entry_data_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
MF_PrintSrvConsole("\n");
|
||||
MF_PrintSrvConsole(" Usage: geoip <command> [argument]\n");
|
||||
MF_PrintSrvConsole(" Commands:\n");
|
||||
MF_PrintSrvConsole(" version - display geoip database metadata\n");
|
||||
MF_PrintSrvConsole(" dump <ip> [output file] - dump all data from an IP address formatted in a JSON-ish fashion.\n");
|
||||
MF_PrintSrvConsole(" An output file is mod-based and if not provided, it will print in the console.\n");
|
||||
MF_PrintSrvConsole("\n");
|
||||
}
|
||||
}
|
||||
|
||||
bool loadDatabase()
|
||||
{
|
||||
if (HandleDB.filename) // Already loaded.
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *databases[] =
|
||||
{
|
||||
"City",
|
||||
"Country" // Is the default shipped database with AMXX.
|
||||
};
|
||||
|
||||
const char *modName = MF_GetModname();
|
||||
const char *dataDir = MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data");
|
||||
|
||||
char file[255];
|
||||
int status = -1;
|
||||
|
||||
for (size_t i = 0; i < ARRAYSIZE(databases); ++i)
|
||||
{
|
||||
// MF_BuildPathname not used because backslash
|
||||
// makes CreateFileMapping failing under windows.
|
||||
|
||||
UTIL_Format(file, sizeof(file) - 1, "%s/%s/GeoLite2-%s.mmdb", modName, dataDir, databases[i]);
|
||||
|
||||
status = MMDB_open(file, MMDB_MODE_MMAP, &HandleDB);
|
||||
|
||||
if (status == MMDB_SUCCESS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (status != MMDB_FILE_OPEN_ERROR)
|
||||
{
|
||||
MF_Log("Could not open %s - %s", file, MMDB_strerror(status));
|
||||
|
||||
if (status == MMDB_IO_ERROR)
|
||||
{
|
||||
MF_Log(" IO error: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status != MMDB_SUCCESS)
|
||||
{
|
||||
MF_Log("Could not find GeoIP2 databases. Disabled natives.");
|
||||
return false;
|
||||
}
|
||||
|
||||
MF_Log("Database info: %s %i.%i",
|
||||
HandleDB.metadata.description.descriptions[0]->description,
|
||||
HandleDB.metadata.binary_format_major_version,
|
||||
HandleDB.metadata.binary_format_minor_version);
|
||||
|
||||
// Retrieve supported languages.
|
||||
for (size_t i = 0; i < HandleDB.metadata.languages.count; i++)
|
||||
{
|
||||
LangList.append(ke::AString(HandleDB.metadata.languages.names[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
23
modules/geoip/geoip_main.h
Normal file
23
modules/geoip/geoip_main.h
Normal file
@@ -0,0 +1,23 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// GeoIP Module
|
||||
//
|
||||
|
||||
#ifndef _INCLUDE_GEOIPMAIN_H
|
||||
#define _INCLUDE_GEOIPMAIN_H
|
||||
|
||||
#include "maxminddb.h"
|
||||
#include "amxxmodule.h"
|
||||
|
||||
bool loadDatabase();
|
||||
void OnGeoipCommand();
|
||||
|
||||
#endif // _INCLUDE_GEOIPMAIN_H
|
413
modules/geoip/geoip_natives.cpp
Normal file
413
modules/geoip/geoip_natives.cpp
Normal file
@@ -0,0 +1,413 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// GeoIP Module
|
||||
//
|
||||
|
||||
#include "geoip_main.h"
|
||||
#include "geoip_natives.h"
|
||||
#include "geoip_util.h"
|
||||
|
||||
#include <am-string.h>
|
||||
#include <am-vector.h>
|
||||
|
||||
// native geoip_code2(const ip[], ccode[3]);
|
||||
// Deprecated.
|
||||
static cell AMX_NATIVE_CALL amx_geoip_code2(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "country", "iso_code", NULL };
|
||||
const char *code = lookupString(ip, path);
|
||||
|
||||
return MF_SetAmxString(amx, params[2], code ? code : "error", 3);
|
||||
}
|
||||
|
||||
// native geoip_code3(const ip[], result[4]);
|
||||
// Deprecated.
|
||||
static cell AMX_NATIVE_CALL amx_geoip_code3(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "country", "iso_code", NULL };
|
||||
const char *code = lookupString(ip, path);
|
||||
|
||||
for (size_t i = 0; i < ARRAYSIZE(GeoIPCountryCode); ++i)
|
||||
{
|
||||
if (!strncmp(code, GeoIPCountryCode[i], 2))
|
||||
{
|
||||
code = GeoIPCountryCode3[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return MF_SetAmxString(amx, params[2], code ? code : "error", 4);
|
||||
}
|
||||
|
||||
// native bool:geoip_code2_ex(const ip[], result[3]);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_code2_ex(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "country", "iso_code", NULL };
|
||||
const char *code = lookupString(ip, path);
|
||||
|
||||
if (!code)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
MF_SetAmxString(amx, params[2], code, 2);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// native bool:geoip_code3_ex(const ip[], result[4]);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_code3_ex(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "country", "iso_code", NULL };
|
||||
const char *code = lookupString(ip, path, &length);
|
||||
|
||||
if (!code)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAYSIZE(GeoIPCountryCode); ++i)
|
||||
{
|
||||
if (!strncmp(code, GeoIPCountryCode[i], 2))
|
||||
{
|
||||
code = GeoIPCountryCode3[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MF_SetAmxString(amx, params[2], code, 3);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// native geoip_country(const ip[], result[], len = 45);
|
||||
// Deprecated.
|
||||
static cell AMX_NATIVE_CALL amx_geoip_country(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "country", "names", "en", NULL };
|
||||
const char *country = lookupString(ip, path, &length);
|
||||
|
||||
if (!country)
|
||||
{
|
||||
return MF_SetAmxString(amx, params[2], "error", params[3]);
|
||||
}
|
||||
|
||||
return MF_SetAmxStringUTF8Char(amx, params[2], country, length, params[3] + 1);
|
||||
}
|
||||
|
||||
// native geoip_country_ex(const ip[], result[], len, id = -1);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_country_ex(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "country", "names", getLang(params[4]), NULL };
|
||||
const char *country = lookupString(ip, path, &length);
|
||||
|
||||
return MF_SetAmxStringUTF8Char(amx, params[2], country ? country : "", length, params[3] + 1);
|
||||
}
|
||||
|
||||
// native geoip_city(const ip[], result[], len, id = -1);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_city(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "city", "names", getLang(params[4]), NULL };
|
||||
const char *city = lookupString(ip, path, &length);
|
||||
|
||||
return MF_SetAmxStringUTF8Char(amx, params[2], city ? city : "", length, params[3] + 1);
|
||||
}
|
||||
|
||||
// native geoip_region_code(const ip[], result[], len);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_region_code(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
int finalLength = 0;
|
||||
char code[12]; // This should be largely enough to hold xx-yyyy and more if needed.
|
||||
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *pathCountry[] = { "country", "iso_code", NULL };
|
||||
const char *countryCode = lookupString(ip, pathCountry, &length);
|
||||
|
||||
if (countryCode)
|
||||
{
|
||||
finalLength = length + 1; // + 1 for dash.
|
||||
UTIL_Format(code, finalLength + 1, "%s-", countryCode); // + EOS.
|
||||
|
||||
const char *pathRegion[] = { "subdivisions", "0", "iso_code", NULL }; // First result.
|
||||
const char *regionCode = lookupString(ip, pathRegion, &length);
|
||||
|
||||
if (regionCode)
|
||||
{
|
||||
finalLength += length;
|
||||
strncat(code, regionCode, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
finalLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return MF_SetAmxString(amx, params[2], finalLength ? code : "", ke::Min(finalLength, params[3]));
|
||||
}
|
||||
|
||||
// native geoip_region_name(const ip[], result[], len, id = -1);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_region_name(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "subdivisions", "0", "names", getLang(params[4]), NULL }; // First result.
|
||||
const char *region = lookupString(ip, path, &length);
|
||||
|
||||
return MF_SetAmxStringUTF8Char(amx, params[2], region ? region : "", length, params[3] + 1);
|
||||
}
|
||||
|
||||
// native geoip_timezone(const ip[], result[], len);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_timezone(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "location", "time_zone", NULL };
|
||||
const char *timezone = lookupString(ip, path, &length);
|
||||
|
||||
return MF_SetAmxString(amx, params[2], timezone ? timezone : "", ke::Min(length, params[3]));
|
||||
}
|
||||
|
||||
// native geoip_latitude(const ip[]);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_latitude(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "location", "latitude", NULL };
|
||||
double latitude = lookupDouble(ip, path);
|
||||
|
||||
return amx_ftoc(latitude);
|
||||
}
|
||||
|
||||
// native geoip_longitude(const ip[]);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_longitude(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "location", "longitude", NULL };
|
||||
double longitude = lookupDouble(ip, path);
|
||||
|
||||
return amx_ftoc(longitude);
|
||||
}
|
||||
|
||||
// native Float:geoip_distance(Float:lat1, Float:lon1, Float:lat2, Float:lon2, system = SYSTEM_METRIC);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_distance(AMX *amx, cell *params)
|
||||
{
|
||||
float earthRadius = params[5] ? 3958.0 : 6370.997; // miles / km
|
||||
|
||||
float lat1 = amx_ctof(params[1]) * (M_PI / 180);
|
||||
float lon1 = amx_ctof(params[2]) * (M_PI / 180);
|
||||
float lat2 = amx_ctof(params[3]) * (M_PI / 180);
|
||||
float lon2 = amx_ctof(params[4]) * (M_PI / 180);
|
||||
|
||||
return amx_ftoc(earthRadius * acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1)));
|
||||
}
|
||||
|
||||
// native Continent:geoip_continent_code(const ip[], result[3] = "");
|
||||
static cell AMX_NATIVE_CALL amx_geoip_continent_code(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "continent", "code", NULL };
|
||||
const char *code = lookupString(ip, path, &length);
|
||||
|
||||
MF_SetAmxString(amx, params[2], code ? code : "", code ? 2 : 0);
|
||||
|
||||
return getContinentId(code);
|
||||
}
|
||||
|
||||
// native geoip_continent_name(const ip[], result[], len, id = -1);
|
||||
static cell AMX_NATIVE_CALL amx_geoip_continent_name(AMX *amx, cell *params)
|
||||
{
|
||||
int length;
|
||||
char *ip = stripPort(MF_GetAmxString(amx, params[1], 0, &length));
|
||||
|
||||
const char *path[] = { "continent", "names", getLang(params[4]), NULL };
|
||||
const char *continent = lookupString(ip, path, &length);
|
||||
|
||||
return MF_SetAmxStringUTF8Char(amx, params[2], continent ? continent : "", length, params[3] + 1);
|
||||
}
|
||||
|
||||
|
||||
AMX_NATIVE_INFO GeoipNatives[] =
|
||||
{
|
||||
{ "geoip_code2" , amx_geoip_code2 }, // Deprecated
|
||||
{ "geoip_code3" , amx_geoip_code3 }, // Deprecated
|
||||
|
||||
{ "geoip_code2_ex" , amx_geoip_code2_ex },
|
||||
{ "geoip_code3_ex" , amx_geoip_code3_ex },
|
||||
|
||||
{ "geoip_country" , amx_geoip_country }, // Deprecated
|
||||
{ "geoip_country_ex" , amx_geoip_country_ex },
|
||||
{ "geoip_city" , amx_geoip_city },
|
||||
|
||||
{ "geoip_region_code" , amx_geoip_region_code },
|
||||
{ "geoip_region_name" , amx_geoip_region_name },
|
||||
|
||||
{ "geoip_timezone" , amx_geoip_timezone },
|
||||
{ "geoip_latitude" , amx_geoip_latitude },
|
||||
{ "geoip_longitude" , amx_geoip_longitude },
|
||||
{ "geoip_distance" , amx_geoip_distance },
|
||||
|
||||
{ "geoip_continent_code", amx_geoip_continent_code },
|
||||
{ "geoip_continent_name", amx_geoip_continent_name },
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* GEOIP2 DATA EXAMPLE:
|
||||
*
|
||||
* {
|
||||
* "city": {
|
||||
* "confidence": 25,
|
||||
* "geoname_id": 54321,
|
||||
* "names": {
|
||||
* "de": "Los Angeles",
|
||||
* "en": "Los Angeles",
|
||||
* "es": "Los Ángeles",
|
||||
* "fr": "Los Angeles",
|
||||
* "ja": "ロサンゼルス市",
|
||||
* "pt-BR": "Los Angeles",
|
||||
* "ru": "Лос-Анджелес",
|
||||
* "zh-CN": "洛杉矶"
|
||||
* }
|
||||
* },
|
||||
* "continent": {
|
||||
* "code": "NA",
|
||||
* "geoname_id": 123456,
|
||||
* "names": {
|
||||
* "de": "Nordamerika",
|
||||
* "en": "North America",
|
||||
* "es": "América del Norte",
|
||||
* "fr": "Amérique du Nord",
|
||||
* "ja": "北アメリカ",
|
||||
* "pt-BR": "América do Norte",
|
||||
* "ru": "Северная Америка",
|
||||
* "zh-CN": "北美洲"
|
||||
*
|
||||
* }
|
||||
* },
|
||||
* "country": {
|
||||
* "confidence": 75,
|
||||
* "geoname_id": "6252001",
|
||||
* "iso_code": "US",
|
||||
* "names": {
|
||||
* "de": "USA",
|
||||
* "en": "United States",
|
||||
* "es": "Estados Unidos",
|
||||
* "fr": "États-Unis",
|
||||
* "ja": "アメリカ合衆国",
|
||||
* "pt-BR": "Estados Unidos",
|
||||
* "ru": "США",
|
||||
* "zh-CN": "美国"
|
||||
* }
|
||||
* },
|
||||
* "location": {
|
||||
* "accuracy_radius": 20,
|
||||
* "latitude": 37.6293,
|
||||
* "longitude": -122.1163,
|
||||
* "metro_code": 807,
|
||||
* "time_zone": "America/Los_Angeles"
|
||||
* },
|
||||
* "postal": {
|
||||
* "code": "90001",
|
||||
* "confidence": 10
|
||||
* },
|
||||
* "registered_country": {
|
||||
* "geoname_id": "6252001",
|
||||
* "iso_code": "US",
|
||||
* "names": {
|
||||
* "de": "USA",
|
||||
* "en": "United States",
|
||||
* "es": "Estados Unidos",
|
||||
* "fr": "États-Unis",
|
||||
* "ja": "アメリカ合衆国",
|
||||
* "pt-BR": "Estados Unidos",
|
||||
* "ru": "США",
|
||||
* "zh-CN": "美国"
|
||||
* }
|
||||
* },
|
||||
* "represented_country": {
|
||||
* "geoname_id": "6252001",
|
||||
* "iso_code": "US",
|
||||
* "names": {
|
||||
* "de": "USA",
|
||||
* "en": "United States",
|
||||
* "es": "Estados Unidos",
|
||||
* "fr": "États-Unis",
|
||||
* "ja": "アメリカ合衆国",
|
||||
* "pt-BR": "Estados Unidos",
|
||||
* "ru": "США",
|
||||
* "zh-CN": "美国"
|
||||
* },
|
||||
* "type": "military"
|
||||
* },
|
||||
* "subdivisions": [
|
||||
* {
|
||||
* "confidence": 50,
|
||||
* "geoname_id": 5332921,
|
||||
* "iso_code": "CA",
|
||||
* "names": {
|
||||
* "de": "Kalifornien",
|
||||
* "en": "California",
|
||||
* "es": "California",
|
||||
* "fr": "Californie",
|
||||
* "ja": "カリフォルニア",
|
||||
* "ru": "Калифорния",
|
||||
* "zh-CN": "加州"
|
||||
* }
|
||||
* }
|
||||
* ],
|
||||
* "traits": {
|
||||
* "autonomous_system_number": "1239",
|
||||
* "autonomous_system_organization": "Linkem IR WiMax Network",
|
||||
* "domain": "example.com",
|
||||
* "is_anonymous_proxy": true,
|
||||
* "is_transparent_proxy": true,
|
||||
* "isp": "Linkem spa",
|
||||
* "ip_address": "1.2.3.4",
|
||||
* "organization": "Linkem IR WiMax Network",
|
||||
* "user_type": "traveler",
|
||||
* },
|
||||
* "maxmind": {
|
||||
* "queries_remaining": "54321"
|
||||
* }
|
||||
* }
|
||||
*/
|
24
modules/geoip/geoip_natives.h
Normal file
24
modules/geoip/geoip_natives.h
Normal file
@@ -0,0 +1,24 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// GeoIP Module
|
||||
//
|
||||
|
||||
#ifndef _INCLUDE_GEOIPNATIVES_H
|
||||
#define _INCLUDE_GEOIPNATIVES_H
|
||||
|
||||
#include <am-string.h>
|
||||
#include <am-vector.h>
|
||||
|
||||
extern MMDB_s HandleDB;
|
||||
extern ke::Vector<ke::AString> LangList;
|
||||
extern AMX_NATIVE_INFO GeoipNatives[];
|
||||
|
||||
#endif // _INCLUDE_GEOIPNATIVES_H
|
283
modules/geoip/geoip_util.cpp
Normal file
283
modules/geoip/geoip_util.cpp
Normal file
@@ -0,0 +1,283 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// GeoIP Module
|
||||
//
|
||||
|
||||
#include "geoip_util.h"
|
||||
#include "geoip_natives.h"
|
||||
|
||||
const char GeoIPCountryCode[252][3] =
|
||||
{
|
||||
"AP", "EU", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN",
|
||||
"AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB",
|
||||
"BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO",
|
||||
"BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD",
|
||||
"CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR",
|
||||
"CU", "CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO",
|
||||
"DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ",
|
||||
"FK", "FM", "FO", "FR", "FX", "GA", "GB", "GD", "GE", "GF",
|
||||
"GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT",
|
||||
"GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID",
|
||||
"IE", "IL", "IN", "IO", "IQ", "IR", "IS", "IT", "JM", "JO",
|
||||
"JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW",
|
||||
"KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT",
|
||||
"LU", "LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML",
|
||||
"MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV",
|
||||
"MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI",
|
||||
"NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF",
|
||||
"PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW",
|
||||
"PY", "QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD",
|
||||
"SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO",
|
||||
"SR", "ST", "SV", "SY", "SZ", "TC", "TD", "TF", "TG", "TH",
|
||||
"TJ", "TK", "TM", "TN", "TO", "TL", "TR", "TT", "TV", "TW",
|
||||
"TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE",
|
||||
"VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "RS", "ZA",
|
||||
"ZM", "ME", "ZW", "A1", "A2", "O1", "AX", "GG", "IM", "JE",
|
||||
"BL", "MF"
|
||||
};
|
||||
|
||||
const char GeoIPCountryCode3[252][4] =
|
||||
{
|
||||
"AP", "EU", "AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", "ANT",
|
||||
"AGO", "AQ", "ARG", "ASM", "AUT", "AUS", "ABW", "AZE", "BIH", "BRB",
|
||||
"BGD", "BEL", "BFA", "BGR", "BHR", "BDI", "BEN", "BMU", "BRN", "BOL",
|
||||
"BRA", "BHS", "BTN", "BV", "BWA", "BLR", "BLZ", "CAN", "CC", "COD",
|
||||
"CAF", "COG", "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI",
|
||||
"CUB", "CPV", "CX", "CYP", "CZE", "DEU", "DJI", "DNK", "DMA", "DOM",
|
||||
"DZA", "ECU", "EST", "EGY", "ESH", "ERI", "ESP", "ETH", "FIN", "FJI",
|
||||
"FLK", "FSM", "FRO", "FRA", "FX", "GAB", "GBR", "GRD", "GEO", "GUF",
|
||||
"GHA", "GIB", "GRL", "GMB", "GIN", "GLP", "GNQ", "GRC", "GS", "GTM",
|
||||
"GUM", "GNB", "GUY", "HKG", "HM", "HND", "HRV", "HTI", "HUN", "IDN",
|
||||
"IRL", "ISR", "IND", "IO", "IRQ", "IRN", "ISL", "ITA", "JAM", "JOR",
|
||||
"JPN", "KEN", "KGZ", "KHM", "KIR", "COM", "KNA", "PRK", "KOR", "KWT",
|
||||
"CYM", "KAZ", "LAO", "LBN", "LCA", "LIE", "LKA", "LBR", "LSO", "LTU",
|
||||
"LUX", "LVA", "LBY", "MAR", "MCO", "MDA", "MDG", "MHL", "MKD", "MLI",
|
||||
"MMR", "MNG", "MAC", "MNP", "MTQ", "MRT", "MSR", "MLT", "MUS", "MDV",
|
||||
"MWI", "MEX", "MYS", "MOZ", "NAM", "NCL", "NER", "NFK", "NGA", "NIC",
|
||||
"NLD", "NOR", "NPL", "NRU", "NIU", "NZL", "OMN", "PAN", "PER", "PYF",
|
||||
"PNG", "PHL", "PAK", "POL", "SPM", "PCN", "PRI", "PSE", "PRT", "PLW",
|
||||
"PRY", "QAT", "REU", "ROU", "RUS", "RWA", "SAU", "SLB", "SYC", "SDN",
|
||||
"SWE", "SGP", "SHN", "SVN", "SJM", "SVK", "SLE", "SMR", "SEN", "SOM",
|
||||
"SUR", "STP", "SLV", "SYR", "SWZ", "TCA", "TCD", "TF", "TGO", "THA",
|
||||
"TJK", "TKL", "TKM", "TUN", "TON", "TLS", "TUR", "TTO", "TUV", "TWN",
|
||||
"TZA", "UKR", "UGA", "UM", "USA", "URY", "UZB", "VAT", "VCT", "VEN",
|
||||
"VGB", "VIR", "VNM", "VUT", "WLF", "WSM", "YEM", "YT", "SRB", "ZAF",
|
||||
"ZMB", "MNE", "ZWE", "A1", "A2", "O1", "ALA", "GGY", "IMN", "JEY",
|
||||
"BLM", "MAF"
|
||||
};
|
||||
|
||||
char *stripPort(char *ip)
|
||||
{
|
||||
char *tmp = strchr(ip, ':');
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
*tmp = '\0';
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
const char* stristr(const char* str, const char* substr)
|
||||
{
|
||||
register char *needle = (char *)substr;
|
||||
register char *prevloc = (char *)str;
|
||||
register char *haystack = (char *)str;
|
||||
|
||||
while (*haystack)
|
||||
{
|
||||
if (tolower(*haystack) == tolower(*needle))
|
||||
{
|
||||
haystack++;
|
||||
|
||||
if (!*++needle)
|
||||
{
|
||||
return prevloc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
haystack = ++prevloc;
|
||||
needle = (char *)substr;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool lookupByIp(const char *ip, const char **path, MMDB_entry_data_s *result)
|
||||
{
|
||||
int gai_error = 0, mmdb_error = 0;
|
||||
MMDB_lookup_result_s lookup = MMDB_lookup_string(&HandleDB, ip, &gai_error, &mmdb_error);
|
||||
|
||||
if (gai_error != 0 || mmdb_error != MMDB_SUCCESS || !lookup.found_entry)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MMDB_entry_data_s entry_data;
|
||||
MMDB_aget_value(&lookup.entry, &entry_data, path);
|
||||
|
||||
if (!entry_data.has_data)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
// Dirty fall back to default language ("en") in case provided user's language is not localized.
|
||||
|
||||
// Searh "names" position.
|
||||
while (path[i] && strcmp(path[i++], "names"));
|
||||
|
||||
// No localized entry or we use already default language.
|
||||
if (!path[i] || !strcmp(path[i], "en"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Overwrite user's language.
|
||||
path[i] = "en";
|
||||
|
||||
// Try again.
|
||||
gai_error = mmdb_error = 0;
|
||||
MMDB_aget_value(&lookup.entry, &entry_data, path);
|
||||
|
||||
if (!entry_data.has_data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*result = entry_data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *lookupString(const char *ip, const char **path, int *length)
|
||||
{
|
||||
static char buffer[256]; // This should be large enough for long name in UTF-8.
|
||||
MMDB_entry_data_s result;
|
||||
|
||||
if (!lookupByIp(ip, path, &result))
|
||||
{
|
||||
if (length)
|
||||
{
|
||||
*length = 0;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Let's avoid a crash in case we go over the buffer size.
|
||||
size_t maxLength = ke::Min((size_t)result.data_size, sizeof(buffer) - 1);
|
||||
|
||||
// Strings from database are not null terminated.
|
||||
memcpy(buffer, result.utf8_string, maxLength);
|
||||
buffer[maxLength] = '\0';
|
||||
|
||||
if (length)
|
||||
{
|
||||
*length = maxLength;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
double lookupDouble(const char *ip, const char **path)
|
||||
{
|
||||
MMDB_entry_data_s result;
|
||||
|
||||
if (!lookupByIp(ip, path, &result))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return result.double_value;
|
||||
}
|
||||
|
||||
int getContinentId(const char *code)
|
||||
{
|
||||
#define CONTINENT_UNKNOWN 0
|
||||
#define CONTINENT_AFRICA 1
|
||||
#define CONTINENT_ANTARCTICA 2
|
||||
#define CONTINENT_ASIA 3
|
||||
#define CONTINENT_EUROPE 4
|
||||
#define CONTINENT_NORTH_AMERICA 5
|
||||
#define CONTINENT_OCEANIA 6
|
||||
#define CONTINENT_SOUTH_AMERICA 7
|
||||
|
||||
int index = CONTINENT_UNKNOWN;
|
||||
|
||||
if (code)
|
||||
{
|
||||
switch (code[0])
|
||||
{
|
||||
case 'A':
|
||||
{
|
||||
switch (code[1])
|
||||
{
|
||||
case 'F': index = CONTINENT_AFRICA; break;
|
||||
case 'N': index = CONTINENT_ANTARCTICA; break;
|
||||
case 'S': index = CONTINENT_ASIA; break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'E': index = CONTINENT_EUROPE; break;
|
||||
case 'O': index = CONTINENT_OCEANIA; break;
|
||||
case 'N': index = CONTINENT_NORTH_AMERICA; break;
|
||||
case 'S': index = CONTINENT_SOUTH_AMERICA; break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
const char *getLang(int playerIndex)
|
||||
{
|
||||
static cvar_t *amxmodx_language = NULL;
|
||||
static cvar_t *amxmodx_cl_langs = NULL;
|
||||
|
||||
if (!amxmodx_language)
|
||||
amxmodx_language = CVAR_GET_POINTER("amx_language");
|
||||
|
||||
if (!amxmodx_cl_langs)
|
||||
amxmodx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
|
||||
|
||||
if (playerIndex >= 0 && amxmodx_cl_langs && amxmodx_language)
|
||||
{
|
||||
const char *value;
|
||||
const char *lang;
|
||||
|
||||
if (playerIndex == 0 || amxmodx_cl_langs->value <= 0 || !MF_IsPlayerIngame(playerIndex))
|
||||
{
|
||||
value = amxmodx_language->string;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = ENTITY_KEYVALUE(MF_GetPlayerEdict(playerIndex), "lang");
|
||||
}
|
||||
|
||||
if (value && *value)
|
||||
{
|
||||
for (size_t i = 0; i < LangList.length(); ++i)
|
||||
{
|
||||
lang = LangList.at(i).chars();
|
||||
|
||||
if (stristr(lang, value) != NULL)
|
||||
{
|
||||
return lang;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "en";
|
||||
}
|
33
modules/geoip/geoip_util.h
Normal file
33
modules/geoip/geoip_util.h
Normal file
@@ -0,0 +1,33 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// GeoIP Module
|
||||
//
|
||||
|
||||
#ifndef _INCLUDE_GEOIPUTIL_H
|
||||
#define _INCLUDE_GEOIPUTIL_H
|
||||
|
||||
#include "geoip_main.h"
|
||||
|
||||
char *stripPort(char *ip);
|
||||
|
||||
bool lookupByIp(const char *ip, const char **path, MMDB_entry_data_s *result);
|
||||
double lookupDouble(const char *ip, const char **path);
|
||||
const char *lookupString(const char *ip, const char **path, int *length = NULL);
|
||||
|
||||
int getContinentId(const char *code);
|
||||
const char *getLang(int playerIndex);
|
||||
|
||||
const char* stristr(const char* str, const char* substr);
|
||||
|
||||
extern const char GeoIPCountryCode[252][3];
|
||||
extern const char GeoIPCountryCode3[252][4];
|
||||
|
||||
#endif // _INCLUDE_GEOIPUTIL_H
|
505
modules/geoip/moduleconfig.h
Normal file
505
modules/geoip/moduleconfig.h
Normal file
@@ -0,0 +1,505 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
//
|
||||
// Module Config
|
||||
//
|
||||
|
||||
#ifndef __MODULECONFIG_H__
|
||||
#define __MODULECONFIG_H__
|
||||
|
||||
#include <amxmodx_version.h>
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "GeoIP"
|
||||
#define MODULE_VERSION AMXX_VERSION
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "GEOIP"
|
||||
#define MODULE_LIBRARY "geoip"
|
||||
#define MODULE_LIBCLASS ""
|
||||
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
|
||||
#define MODULE_RELOAD_ON_MAPCHANGE
|
||||
|
||||
#ifdef __DATE__
|
||||
#define MODULE_DATE __DATE__
|
||||
#else // __DATE__
|
||||
#define MODULE_DATE "Unknown"
|
||||
#endif // __DATE__
|
||||
|
||||
// metamod plugin?
|
||||
#define USE_METAMOD
|
||||
|
||||
// use memory manager/tester?
|
||||
// note that if you use this, you cannot construct/allocate
|
||||
// anything before the module attached (OnAmxxAttach).
|
||||
// be careful of default constructors using new/malloc!
|
||||
// #define MEMORY_TEST
|
||||
|
||||
// Unless you use STL or exceptions, keep this commented.
|
||||
// It allows you to compile without libstdc++.so as a dependency
|
||||
// #define NO_ALLOC_OVERRIDES
|
||||
|
||||
// Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself
|
||||
// #define NO_MSVC8_AUTO_COMPAT
|
||||
|
||||
/**
|
||||
* AMXX Init functions
|
||||
* Also consider using FN_META_*
|
||||
*/
|
||||
|
||||
/** AMXX query */
|
||||
//#define FN_AMXX_QUERY OnAmxxQuery
|
||||
|
||||
/** AMXX attach
|
||||
* Do native functions init here (MF_AddNatives)
|
||||
*/
|
||||
#define FN_AMXX_ATTACH OnAmxxAttach
|
||||
|
||||
/** AMXX Detach (unload) */
|
||||
#define FN_AMXX_DETACH OnAmxxDetach
|
||||
|
||||
/** All plugins loaded
|
||||
* Do forward functions init here (MF_RegisterForward)
|
||||
*/
|
||||
//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
|
||||
|
||||
/** All plugins are about to be unloaded */
|
||||
//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading
|
||||
|
||||
/** All plugins are now unloaded */
|
||||
//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded
|
||||
|
||||
|
||||
/**** METAMOD ****/
|
||||
// If your module doesn't use metamod, you may close the file now :)
|
||||
#ifdef USE_METAMOD
|
||||
// ----
|
||||
// Hook Functions
|
||||
// Uncomment these to be called
|
||||
// You can also change the function name
|
||||
|
||||
// - Metamod init functions
|
||||
// Also consider using FN_AMXX_*
|
||||
// Meta query
|
||||
//#define FN_META_QUERY OnMetaQuery
|
||||
// Meta attach
|
||||
//#define FN_META_ATTACH OnMetaAttach
|
||||
// Meta detach
|
||||
//#define FN_META_DETACH OnMetaDetach
|
||||
|
||||
// (wd) are Will Day's notes
|
||||
// - GetEntityAPI2 functions
|
||||
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
|
||||
// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */
|
||||
// #define FN_DispatchThink DispatchThink /* pfnThink() */
|
||||
// #define FN_DispatchUse DispatchUse /* pfnUse() */
|
||||
// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */
|
||||
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
|
||||
// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
|
||||
// #define FN_DispatchSave DispatchSave /* pfnSave() */
|
||||
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
|
||||
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
|
||||
// #define FN_SaveWriteFields SaveWriteFields /* pfnSaveWriteFields() */
|
||||
// #define FN_SaveReadFields SaveReadFields /* pfnSaveReadFields() */
|
||||
// #define FN_SaveGlobalState SaveGlobalState /* pfnSaveGlobalState() */
|
||||
// #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */
|
||||
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
|
||||
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
|
||||
// #define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
|
||||
// #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
|
||||
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
|
||||
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
||||
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
||||
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
|
||||
// #define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
|
||||
// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
|
||||
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
|
||||
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
|
||||
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
|
||||
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
|
||||
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
|
||||
// #define FN_PlayerCustomization PlayerCustomization /* pfnPlayerCustomization() Notifies .dll of new customization for player. */
|
||||
// #define FN_SpectatorConnect SpectatorConnect /* pfnSpectatorConnect() Called when spectator joins server */
|
||||
// #define FN_SpectatorDisconnect SpectatorDisconnect /* pfnSpectatorDisconnect() Called when spectator leaves the server */
|
||||
// #define FN_SpectatorThink SpectatorThink /* pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) */
|
||||
// #define FN_Sys_Error Sys_Error /* pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 */
|
||||
// #define FN_PM_Move PM_Move /* pfnPM_Move() (wd) SDK2 */
|
||||
// #define FN_PM_Init PM_Init /* pfnPM_Init() Server version of player movement initialization; (wd) SDK2 */
|
||||
// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */
|
||||
// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */
|
||||
// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */
|
||||
// #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */
|
||||
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
|
||||
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
|
||||
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
|
||||
// #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
|
||||
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
|
||||
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
|
||||
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
|
||||
// #define FN_CreateInstancedBaselines CreateInstancedBaselines /* pfnCreateInstancedBaselines() (wd) SDK2 */
|
||||
// #define FN_InconsistentFile InconsistentFile /* pfnInconsistentFile() (wd) SDK2 */
|
||||
// #define FN_AllowLagCompensation AllowLagCompensation /* pfnAllowLagCompensation() (wd) SDK2 */
|
||||
|
||||
// - GetEntityAPI2_Post functions
|
||||
// #define FN_GameDLLInit_Post GameDLLInit_Post
|
||||
// #define FN_DispatchSpawn_Post DispatchSpawn_Post
|
||||
// #define FN_DispatchThink_Post DispatchThink_Post
|
||||
// #define FN_DispatchUse_Post DispatchUse_Post
|
||||
// #define FN_DispatchTouch_Post DispatchTouch_Post
|
||||
// #define FN_DispatchBlocked_Post DispatchBlocked_Post
|
||||
// #define FN_DispatchKeyValue_Post DispatchKeyValue_Post
|
||||
// #define FN_DispatchSave_Post DispatchSave_Post
|
||||
// #define FN_DispatchRestore_Post DispatchRestore_Post
|
||||
// #define FN_DispatchObjectCollsionBox_Post DispatchObjectCollsionBox_Post
|
||||
// #define FN_SaveWriteFields_Post SaveWriteFields_Post
|
||||
// #define FN_SaveReadFields_Post SaveReadFields_Post
|
||||
// #define FN_SaveGlobalState_Post SaveGlobalState_Post
|
||||
// #define FN_RestoreGlobalState_Post RestoreGlobalState_Post
|
||||
// #define FN_ResetGlobalState_Post ResetGlobalState_Post
|
||||
// #define FN_ClientConnect_Post ClientConnect_Post
|
||||
// #define FN_ClientDisconnect_Post ClientDisconnect_Post
|
||||
// #define FN_ClientKill_Post ClientKill_Post
|
||||
// #define FN_ClientPutInServer_Post ClientPutInServer_Post
|
||||
// #define FN_ClientCommand_Post ClientCommand_Post
|
||||
// #define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post
|
||||
// #define FN_ServerActivate_Post ServerActivate_Post
|
||||
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
|
||||
// #define FN_PlayerPreThink_Post PlayerPreThink_Post
|
||||
// #define FN_PlayerPostThink_Post PlayerPostThink_Post
|
||||
// #define FN_StartFrame_Post StartFrame_Post
|
||||
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
|
||||
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
|
||||
// #define FN_GetGameDescription_Post GetGameDescription_Post
|
||||
// #define FN_PlayerCustomization_Post PlayerCustomization_Post
|
||||
// #define FN_SpectatorConnect_Post SpectatorConnect_Post
|
||||
// #define FN_SpectatorDisconnect_Post SpectatorDisconnect_Post
|
||||
// #define FN_SpectatorThink_Post SpectatorThink_Post
|
||||
// #define FN_Sys_Error_Post Sys_Error_Post
|
||||
// #define FN_PM_Move_Post PM_Move_Post
|
||||
// #define FN_PM_Init_Post PM_Init_Post
|
||||
// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post
|
||||
// #define FN_SetupVisibility_Post SetupVisibility_Post
|
||||
// #define FN_UpdateClientData_Post UpdateClientData_Post
|
||||
// #define FN_AddToFullPack_Post AddToFullPack_Post
|
||||
// #define FN_CreateBaseline_Post CreateBaseline_Post
|
||||
// #define FN_RegisterEncoders_Post RegisterEncoders_Post
|
||||
// #define FN_GetWeaponData_Post GetWeaponData_Post
|
||||
// #define FN_CmdStart_Post CmdStart_Post
|
||||
// #define FN_CmdEnd_Post CmdEnd_Post
|
||||
// #define FN_ConnectionlessPacket_Post ConnectionlessPacket_Post
|
||||
// #define FN_GetHullBounds_Post GetHullBounds_Post
|
||||
// #define FN_CreateInstancedBaselines_Post CreateInstancedBaselines_Post
|
||||
// #define FN_InconsistentFile_Post InconsistentFile_Post
|
||||
// #define FN_AllowLagCompensation_Post AllowLagCompensation_Post
|
||||
|
||||
// - GetEngineAPI functions
|
||||
// #define FN_PrecacheModel PrecacheModel
|
||||
// #define FN_PrecacheSound PrecacheSound
|
||||
// #define FN_SetModel SetModel
|
||||
// #define FN_ModelIndex ModelIndex
|
||||
// #define FN_ModelFrames ModelFrames
|
||||
// #define FN_SetSize SetSize
|
||||
// #define FN_ChangeLevel ChangeLevel
|
||||
// #define FN_GetSpawnParms GetSpawnParms
|
||||
// #define FN_SaveSpawnParms SaveSpawnParms
|
||||
// #define FN_VecToYaw VecToYaw
|
||||
// #define FN_VecToAngles VecToAngles
|
||||
// #define FN_MoveToOrigin MoveToOrigin
|
||||
// #define FN_ChangeYaw ChangeYaw
|
||||
// #define FN_ChangePitch ChangePitch
|
||||
// #define FN_FindEntityByString FindEntityByString
|
||||
// #define FN_GetEntityIllum GetEntityIllum
|
||||
// #define FN_FindEntityInSphere FindEntityInSphere
|
||||
// #define FN_FindClientInPVS FindClientInPVS
|
||||
// #define FN_EntitiesInPVS EntitiesInPVS
|
||||
// #define FN_MakeVectors MakeVectors
|
||||
// #define FN_AngleVectors AngleVectors
|
||||
// #define FN_CreateEntity CreateEntity
|
||||
// #define FN_RemoveEntity RemoveEntity
|
||||
// #define FN_CreateNamedEntity CreateNamedEntity
|
||||
// #define FN_MakeStatic MakeStatic
|
||||
// #define FN_EntIsOnFloor EntIsOnFloor
|
||||
// #define FN_DropToFloor DropToFloor
|
||||
// #define FN_WalkMove WalkMove
|
||||
// #define FN_SetOrigin SetOrigin
|
||||
// #define FN_EmitSound EmitSound
|
||||
// #define FN_EmitAmbientSound EmitAmbientSound
|
||||
// #define FN_TraceLine TraceLine
|
||||
// #define FN_TraceToss TraceToss
|
||||
// #define FN_TraceMonsterHull TraceMonsterHull
|
||||
// #define FN_TraceHull TraceHull
|
||||
// #define FN_TraceModel TraceModel
|
||||
// #define FN_TraceTexture TraceTexture
|
||||
// #define FN_TraceSphere TraceSphere
|
||||
// #define FN_GetAimVector GetAimVector
|
||||
// #define FN_ServerCommand ServerCommand
|
||||
// #define FN_ServerExecute ServerExecute
|
||||
// #define FN_engClientCommand engClientCommand
|
||||
// #define FN_ParticleEffect ParticleEffect
|
||||
// #define FN_LightStyle LightStyle
|
||||
// #define FN_DecalIndex DecalIndex
|
||||
// #define FN_PointContents PointContents
|
||||
// #define FN_MessageBegin MessageBegin
|
||||
// #define FN_MessageEnd MessageEnd
|
||||
// #define FN_WriteByte WriteByte
|
||||
// #define FN_WriteChar WriteChar
|
||||
// #define FN_WriteShort WriteShort
|
||||
// #define FN_WriteLong WriteLong
|
||||
// #define FN_WriteAngle WriteAngle
|
||||
// #define FN_WriteCoord WriteCoord
|
||||
// #define FN_WriteString WriteString
|
||||
// #define FN_WriteEntity WriteEntity
|
||||
// #define FN_CVarRegister CVarRegister
|
||||
// #define FN_CVarGetFloat CVarGetFloat
|
||||
// #define FN_CVarGetString CVarGetString
|
||||
// #define FN_CVarSetFloat CVarSetFloat
|
||||
// #define FN_CVarSetString CVarSetString
|
||||
// #define FN_AlertMessage AlertMessage
|
||||
// #define FN_EngineFprintf EngineFprintf
|
||||
// #define FN_PvAllocEntPrivateData PvAllocEntPrivateData
|
||||
// #define FN_PvEntPrivateData PvEntPrivateData
|
||||
// #define FN_FreeEntPrivateData FreeEntPrivateData
|
||||
// #define FN_SzFromIndex SzFromIndex
|
||||
// #define FN_AllocString AllocString
|
||||
// #define FN_GetVarsOfEnt GetVarsOfEnt
|
||||
// #define FN_PEntityOfEntOffset PEntityOfEntOffset
|
||||
// #define FN_EntOffsetOfPEntity EntOffsetOfPEntity
|
||||
// #define FN_IndexOfEdict IndexOfEdict
|
||||
// #define FN_PEntityOfEntIndex PEntityOfEntIndex
|
||||
// #define FN_FindEntityByVars FindEntityByVars
|
||||
// #define FN_GetModelPtr GetModelPtr
|
||||
// #define FN_RegUserMsg RegUserMsg
|
||||
// #define FN_AnimationAutomove AnimationAutomove
|
||||
// #define FN_GetBonePosition GetBonePosition
|
||||
// #define FN_FunctionFromName FunctionFromName
|
||||
// #define FN_NameForFunction NameForFunction
|
||||
// #define FN_ClientPrintf ClientPrintf
|
||||
// #define FN_ServerPrint ServerPrint
|
||||
// #define FN_Cmd_Args Cmd_Args
|
||||
// #define FN_Cmd_Argv Cmd_Argv
|
||||
// #define FN_Cmd_Argc Cmd_Argc
|
||||
// #define FN_GetAttachment GetAttachment
|
||||
// #define FN_CRC32_Init CRC32_Init
|
||||
// #define FN_CRC32_ProcessBuffer CRC32_ProcessBuffer
|
||||
// #define FN_CRC32_ProcessByte CRC32_ProcessByte
|
||||
// #define FN_CRC32_Final CRC32_Final
|
||||
// #define FN_RandomLong RandomLong
|
||||
// #define FN_RandomFloat RandomFloat
|
||||
// #define FN_SetView SetView
|
||||
// #define FN_Time Time
|
||||
// #define FN_CrosshairAngle CrosshairAngle
|
||||
// #define FN_LoadFileForMe LoadFileForMe
|
||||
// #define FN_FreeFile FreeFile
|
||||
// #define FN_EndSection EndSection
|
||||
// #define FN_CompareFileTime CompareFileTime
|
||||
// #define FN_GetGameDir GetGameDir
|
||||
// #define FN_Cvar_RegisterVariable Cvar_RegisterVariable
|
||||
// #define FN_FadeClientVolume FadeClientVolume
|
||||
// #define FN_SetClientMaxspeed SetClientMaxspeed
|
||||
// #define FN_CreateFakeClient CreateFakeClient
|
||||
// #define FN_RunPlayerMove RunPlayerMove
|
||||
// #define FN_NumberOfEntities NumberOfEntities
|
||||
// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer
|
||||
// #define FN_InfoKeyValue InfoKeyValue
|
||||
// #define FN_SetKeyValue SetKeyValue
|
||||
// #define FN_SetClientKeyValue SetClientKeyValue
|
||||
// #define FN_IsMapValid IsMapValid
|
||||
// #define FN_StaticDecal StaticDecal
|
||||
// #define FN_PrecacheGeneric PrecacheGeneric
|
||||
// #define FN_GetPlayerUserId GetPlayerUserId
|
||||
// #define FN_BuildSoundMsg BuildSoundMsg
|
||||
// #define FN_IsDedicatedServer IsDedicatedServer
|
||||
// #define FN_CVarGetPointer CVarGetPointer
|
||||
// #define FN_GetPlayerWONId GetPlayerWONId
|
||||
// #define FN_Info_RemoveKey Info_RemoveKey
|
||||
// #define FN_GetPhysicsKeyValue GetPhysicsKeyValue
|
||||
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
|
||||
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
|
||||
// #define FN_PrecacheEvent PrecacheEvent
|
||||
// #define FN_PlaybackEvent PlaybackEvent
|
||||
// #define FN_SetFatPVS SetFatPVS
|
||||
// #define FN_SetFatPAS SetFatPAS
|
||||
// #define FN_CheckVisibility CheckVisibility
|
||||
// #define FN_DeltaSetField DeltaSetField
|
||||
// #define FN_DeltaUnsetField DeltaUnsetField
|
||||
// #define FN_DeltaAddEncoder DeltaAddEncoder
|
||||
// #define FN_GetCurrentPlayer GetCurrentPlayer
|
||||
// #define FN_CanSkipPlayer CanSkipPlayer
|
||||
// #define FN_DeltaFindField DeltaFindField
|
||||
// #define FN_DeltaSetFieldByIndex DeltaSetFieldByIndex
|
||||
// #define FN_DeltaUnsetFieldByIndex DeltaUnsetFieldByIndex
|
||||
// #define FN_SetGroupMask SetGroupMask
|
||||
// #define FN_engCreateInstancedBaseline engCreateInstancedBaseline
|
||||
// #define FN_Cvar_DirectSet Cvar_DirectSet
|
||||
// #define FN_ForceUnmodified ForceUnmodified
|
||||
// #define FN_GetPlayerStats GetPlayerStats
|
||||
// #define FN_AddServerCommand AddServerCommand
|
||||
// #define FN_Voice_GetClientListening Voice_GetClientListening
|
||||
// #define FN_Voice_SetClientListening Voice_SetClientListening
|
||||
// #define FN_GetPlayerAuthId GetPlayerAuthId
|
||||
|
||||
// - GetEngineAPI_Post functions
|
||||
// #define FN_PrecacheModel_Post PrecacheModel_Post
|
||||
// #define FN_PrecacheSound_Post PrecacheSound_Post
|
||||
// #define FN_SetModel_Post SetModel_Post
|
||||
// #define FN_ModelIndex_Post ModelIndex_Post
|
||||
// #define FN_ModelFrames_Post ModelFrames_Post
|
||||
// #define FN_SetSize_Post SetSize_Post
|
||||
// #define FN_ChangeLevel_Post ChangeLevel_Post
|
||||
// #define FN_GetSpawnParms_Post GetSpawnParms_Post
|
||||
// #define FN_SaveSpawnParms_Post SaveSpawnParms_Post
|
||||
// #define FN_VecToYaw_Post VecToYaw_Post
|
||||
// #define FN_VecToAngles_Post VecToAngles_Post
|
||||
// #define FN_MoveToOrigin_Post MoveToOrigin_Post
|
||||
// #define FN_ChangeYaw_Post ChangeYaw_Post
|
||||
// #define FN_ChangePitch_Post ChangePitch_Post
|
||||
// #define FN_FindEntityByString_Post FindEntityByString_Post
|
||||
// #define FN_GetEntityIllum_Post GetEntityIllum_Post
|
||||
// #define FN_FindEntityInSphere_Post FindEntityInSphere_Post
|
||||
// #define FN_FindClientInPVS_Post FindClientInPVS_Post
|
||||
// #define FN_EntitiesInPVS_Post EntitiesInPVS_Post
|
||||
// #define FN_MakeVectors_Post MakeVectors_Post
|
||||
// #define FN_AngleVectors_Post AngleVectors_Post
|
||||
// #define FN_CreateEntity_Post CreateEntity_Post
|
||||
// #define FN_RemoveEntity_Post RemoveEntity_Post
|
||||
// #define FN_CreateNamedEntity_Post CreateNamedEntity_Post
|
||||
// #define FN_MakeStatic_Post MakeStatic_Post
|
||||
// #define FN_EntIsOnFloor_Post EntIsOnFloor_Post
|
||||
// #define FN_DropToFloor_Post DropToFloor_Post
|
||||
// #define FN_WalkMove_Post WalkMove_Post
|
||||
// #define FN_SetOrigin_Post SetOrigin_Post
|
||||
// #define FN_EmitSound_Post EmitSound_Post
|
||||
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
|
||||
// #define FN_TraceLine_Post TraceLine_Post
|
||||
// #define FN_TraceToss_Post TraceToss_Post
|
||||
// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post
|
||||
// #define FN_TraceHull_Post TraceHull_Post
|
||||
// #define FN_TraceModel_Post TraceModel_Post
|
||||
// #define FN_TraceTexture_Post TraceTexture_Post
|
||||
// #define FN_TraceSphere_Post TraceSphere_Post
|
||||
// #define FN_GetAimVector_Post GetAimVector_Post
|
||||
// #define FN_ServerCommand_Post ServerCommand_Post
|
||||
// #define FN_ServerExecute_Post ServerExecute_Post
|
||||
// #define FN_engClientCommand_Post engClientCommand_Post
|
||||
// #define FN_ParticleEffect_Post ParticleEffect_Post
|
||||
// #define FN_LightStyle_Post LightStyle_Post
|
||||
// #define FN_DecalIndex_Post DecalIndex_Post
|
||||
// #define FN_PointContents_Post PointContents_Post
|
||||
// #define FN_MessageBegin_Post MessageBegin_Post
|
||||
// #define FN_MessageEnd_Post MessageEnd_Post
|
||||
// #define FN_WriteByte_Post WriteByte_Post
|
||||
// #define FN_WriteChar_Post WriteChar_Post
|
||||
// #define FN_WriteShort_Post WriteShort_Post
|
||||
// #define FN_WriteLong_Post WriteLong_Post
|
||||
// #define FN_WriteAngle_Post WriteAngle_Post
|
||||
// #define FN_WriteCoord_Post WriteCoord_Post
|
||||
// #define FN_WriteString_Post WriteString_Post
|
||||
// #define FN_WriteEntity_Post WriteEntity_Post
|
||||
// #define FN_CVarRegister_Post CVarRegister_Post
|
||||
// #define FN_CVarGetFloat_Post CVarGetFloat_Post
|
||||
// #define FN_CVarGetString_Post CVarGetString_Post
|
||||
// #define FN_CVarSetFloat_Post CVarSetFloat_Post
|
||||
// #define FN_CVarSetString_Post CVarSetString_Post
|
||||
// #define FN_AlertMessage_Post AlertMessage_Post
|
||||
// #define FN_EngineFprintf_Post EngineFprintf_Post
|
||||
// #define FN_PvAllocEntPrivateData_Post PvAllocEntPrivateData_Post
|
||||
// #define FN_PvEntPrivateData_Post PvEntPrivateData_Post
|
||||
// #define FN_FreeEntPrivateData_Post FreeEntPrivateData_Post
|
||||
// #define FN_SzFromIndex_Post SzFromIndex_Post
|
||||
// #define FN_AllocString_Post AllocString_Post
|
||||
// #define FN_GetVarsOfEnt_Post GetVarsOfEnt_Post
|
||||
// #define FN_PEntityOfEntOffset_Post PEntityOfEntOffset_Post
|
||||
// #define FN_EntOffsetOfPEntity_Post EntOffsetOfPEntity_Post
|
||||
// #define FN_IndexOfEdict_Post IndexOfEdict_Post
|
||||
// #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post
|
||||
// #define FN_FindEntityByVars_Post FindEntityByVars_Post
|
||||
// #define FN_GetModelPtr_Post GetModelPtr_Post
|
||||
// #define FN_RegUserMsg_Post RegUserMsg_Post
|
||||
// #define FN_AnimationAutomove_Post AnimationAutomove_Post
|
||||
// #define FN_GetBonePosition_Post GetBonePosition_Post
|
||||
// #define FN_FunctionFromName_Post FunctionFromName_Post
|
||||
// #define FN_NameForFunction_Post NameForFunction_Post
|
||||
// #define FN_ClientPrintf_Post ClientPrintf_Post
|
||||
// #define FN_ServerPrint_Post ServerPrint_Post
|
||||
// #define FN_Cmd_Args_Post Cmd_Args_Post
|
||||
// #define FN_Cmd_Argv_Post Cmd_Argv_Post
|
||||
// #define FN_Cmd_Argc_Post Cmd_Argc_Post
|
||||
// #define FN_GetAttachment_Post GetAttachment_Post
|
||||
// #define FN_CRC32_Init_Post CRC32_Init_Post
|
||||
// #define FN_CRC32_ProcessBuffer_Post CRC32_ProcessBuffer_Post
|
||||
// #define FN_CRC32_ProcessByte_Post CRC32_ProcessByte_Post
|
||||
// #define FN_CRC32_Final_Post CRC32_Final_Post
|
||||
// #define FN_RandomLong_Post RandomLong_Post
|
||||
// #define FN_RandomFloat_Post RandomFloat_Post
|
||||
// #define FN_SetView_Post SetView_Post
|
||||
// #define FN_Time_Post Time_Post
|
||||
// #define FN_CrosshairAngle_Post CrosshairAngle_Post
|
||||
// #define FN_LoadFileForMe_Post LoadFileForMe_Post
|
||||
// #define FN_FreeFile_Post FreeFile_Post
|
||||
// #define FN_EndSection_Post EndSection_Post
|
||||
// #define FN_CompareFileTime_Post CompareFileTime_Post
|
||||
// #define FN_GetGameDir_Post GetGameDir_Post
|
||||
// #define FN_Cvar_RegisterVariable_Post Cvar_RegisterVariable_Post
|
||||
// #define FN_FadeClientVolume_Post FadeClientVolume_Post
|
||||
// #define FN_SetClientMaxspeed_Post SetClientMaxspeed_Post
|
||||
// #define FN_CreateFakeClient_Post CreateFakeClient_Post
|
||||
// #define FN_RunPlayerMove_Post RunPlayerMove_Post
|
||||
// #define FN_NumberOfEntities_Post NumberOfEntities_Post
|
||||
// #define FN_GetInfoKeyBuffer_Post GetInfoKeyBuffer_Post
|
||||
// #define FN_InfoKeyValue_Post InfoKeyValue_Post
|
||||
// #define FN_SetKeyValue_Post SetKeyValue_Post
|
||||
// #define FN_SetClientKeyValue_Post SetClientKeyValue_Post
|
||||
// #define FN_IsMapValid_Post IsMapValid_Post
|
||||
// #define FN_StaticDecal_Post StaticDecal_Post
|
||||
// #define FN_PrecacheGeneric_Post PrecacheGeneric_Post
|
||||
// #define FN_GetPlayerUserId_Post GetPlayerUserId_Post
|
||||
// #define FN_BuildSoundMsg_Post BuildSoundMsg_Post
|
||||
// #define FN_IsDedicatedServer_Post IsDedicatedServer_Post
|
||||
// #define FN_CVarGetPointer_Post CVarGetPointer_Post
|
||||
// #define FN_GetPlayerWONId_Post GetPlayerWONId_Post
|
||||
// #define FN_Info_RemoveKey_Post Info_RemoveKey_Post
|
||||
// #define FN_GetPhysicsKeyValue_Post GetPhysicsKeyValue_Post
|
||||
// #define FN_SetPhysicsKeyValue_Post SetPhysicsKeyValue_Post
|
||||
// #define FN_GetPhysicsInfoString_Post GetPhysicsInfoString_Post
|
||||
// #define FN_PrecacheEvent_Post PrecacheEvent_Post
|
||||
// #define FN_PlaybackEvent_Post PlaybackEvent_Post
|
||||
// #define FN_SetFatPVS_Post SetFatPVS_Post
|
||||
// #define FN_SetFatPAS_Post SetFatPAS_Post
|
||||
// #define FN_CheckVisibility_Post CheckVisibility_Post
|
||||
// #define FN_DeltaSetField_Post DeltaSetField_Post
|
||||
// #define FN_DeltaUnsetField_Post DeltaUnsetField_Post
|
||||
// #define FN_DeltaAddEncoder_Post DeltaAddEncoder_Post
|
||||
// #define FN_GetCurrentPlayer_Post GetCurrentPlayer_Post
|
||||
// #define FN_CanSkipPlayer_Post CanSkipPlayer_Post
|
||||
// #define FN_DeltaFindField_Post DeltaFindField_Post
|
||||
// #define FN_DeltaSetFieldByIndex_Post DeltaSetFieldByIndex_Post
|
||||
// #define FN_DeltaUnsetFieldByIndex_Post DeltaUnsetFieldByIndex_Post
|
||||
// #define FN_SetGroupMask_Post SetGroupMask_Post
|
||||
// #define FN_engCreateInstancedBaseline_Post engCreateInstancedBaseline_Post
|
||||
// #define FN_Cvar_DirectSet_Post Cvar_DirectSet_Post
|
||||
// #define FN_ForceUnmodified_Post ForceUnmodified_Post
|
||||
// #define FN_GetPlayerStats_Post GetPlayerStats_Post
|
||||
// #define FN_AddServerCommand_Post AddServerCommand_Post
|
||||
// #define FN_Voice_GetClientListening_Post Voice_GetClientListening_Post
|
||||
// #define FN_Voice_SetClientListening_Post Voice_SetClientListening_Post
|
||||
// #define FN_GetPlayerAuthId_Post GetPlayerAuthId_Post
|
||||
|
||||
// #define FN_OnFreeEntPrivateData OnFreeEntPrivateData
|
||||
// #define FN_GameShutdown GameShutdown
|
||||
// #define FN_ShouldCollide ShouldCollide
|
||||
|
||||
// #define FN_OnFreeEntPrivateData_Post OnFreeEntPrivateData_Post
|
||||
// #define FN_GameShutdown_Post GameShutdown_Post
|
||||
// #define FN_ShouldCollide_Post ShouldCollide_Post
|
||||
|
||||
|
||||
#endif // USE_METAMOD
|
||||
|
||||
#endif // __MODULECONFIG_H__
|
20
modules/geoip/msvc12/geoip.sln
Normal file
20
modules/geoip/msvc12/geoip.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geoip", "geoip.vcxproj", "{036FA046-A6BF-4D80-8986-71FDD1528B55}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{036FA046-A6BF-4D80-8986-71FDD1528B55}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{036FA046-A6BF-4D80-8986-71FDD1528B55}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{036FA046-A6BF-4D80-8986-71FDD1528B55}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{036FA046-A6BF-4D80-8986-71FDD1528B55}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
123
modules/geoip/msvc12/geoip.vcxproj
Normal file
123
modules/geoip/msvc12/geoip.vcxproj
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{036FA046-A6BF-4D80-8986-71FDD1528B55}</ProjectGuid>
|
||||
<RootNamespace>geoip</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_amxx</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_amxx</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public;..\..\..\public\amtl\include;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)geoip.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>$(OutDir)geoip.lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public;..\..\..\public\amtl\include;..\..\..\third_party\libmaxminddb;..\..\third_party\hashing;..\..\..\public\sdk;..\GeoIP2;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;GEOIP_EXPORTS;HAVE_STDINT_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<ImportLibrary>$(OutDir)geoip.lib</ImportLibrary>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\third_party\libmaxminddb\maxminddb.c" />
|
||||
<ClCompile Include="..\geoip_main.cpp" />
|
||||
<ClCompile Include="..\geoip_natives.cpp" />
|
||||
<ClCompile Include="..\geoip_util.cpp" />
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\third_party\libmaxminddb\maxminddb-compat-util.h" />
|
||||
<ClInclude Include="..\..\..\third_party\libmaxminddb\maxminddb.h" />
|
||||
<ClInclude Include="..\..\..\third_party\libmaxminddb\maxminddb_config.h" />
|
||||
<ClInclude Include="..\geoip_main.h" />
|
||||
<ClInclude Include="..\geoip_natives.h" />
|
||||
<ClInclude Include="..\geoip_util.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\geoip.inc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
73
modules/geoip/msvc12/geoip.vcxproj.filters
Normal file
73
modules/geoip/msvc12/geoip.vcxproj.filters
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Module SDK">
|
||||
<UniqueIdentifier>{a6d73610-c960-4557-87c5-2d1b137ed3b3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Module SDK\SDK Base">
|
||||
<UniqueIdentifier>{09aeab21-6873-491a-accf-e318d14c617d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Pawn Includes">
|
||||
<UniqueIdentifier>{f31e7815-11bd-4a86-899e-43f85dfdc067}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="GeoIP2">
|
||||
<UniqueIdentifier>{0bd4b9fb-f847-4fe5-af3e-9000fc854c5c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\geoip_util.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\geoip_main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\geoip_natives.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\third_party\libmaxminddb\maxminddb.c">
|
||||
<Filter>GeoIP2</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\geoip_util.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\geoip_natives.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\geoip_main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\third_party\libmaxminddb\maxminddb.h">
|
||||
<Filter>GeoIP2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\third_party\libmaxminddb\maxminddb_config.h">
|
||||
<Filter>GeoIP2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\third_party\libmaxminddb\maxminddb-compat-util.h">
|
||||
<Filter>GeoIP2</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\geoip.inc">
|
||||
<Filter>Pawn Includes</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
101
modules/geoip/version.rc
Normal file
101
modules/geoip/version.rc
Normal file
@@ -0,0 +1,101 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include <winresrc.h>
|
||||
#include <moduleconfig.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION AMXX_VERSION_FILE
|
||||
PRODUCTVERSION AMXX_VERSION_FILE
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "AMX Mod X"
|
||||
VALUE "FileDescription", "AMX Mod X"
|
||||
VALUE "FileVersion", AMXX_VERSION
|
||||
VALUE "InternalName", MODULE_LIBRARY
|
||||
VALUE "LegalCopyright", "Copyright (c) AMX Mod X Dev Team"
|
||||
VALUE "OriginalFilename", MODULE_LIBRARY "_amxx.dll"
|
||||
VALUE "ProductName", MODULE_NAME
|
||||
VALUE "ProductVersion", AMXX_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
Reference in New Issue
Block a user