mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-19 12:42:26 +00:00
Merge 273cb928bf6a5a6d37c45c9dcc461076680949a8 into 9ea71dd94f7fb2f6f36214abb5ece55626459b35
This commit is contained in:
commit
9e8d39fe2c
@ -38,9 +38,6 @@ using namespace std;
|
||||
#include <windows.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
|
||||
@ -24,9 +24,6 @@
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#include <string>
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <process.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
@ -73,6 +71,7 @@ EQEMuLog::~EQEMuLog() {
|
||||
}
|
||||
|
||||
bool EQEMuLog::open(LogIDs id) {
|
||||
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
@ -88,36 +87,39 @@ bool EQEMuLog::open(LogIDs id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char exename[200] = "";
|
||||
std::string filename = FileNames[id];
|
||||
|
||||
const EQEmuExePlatform &platform = GetExecutablePlatform();
|
||||
|
||||
if(platform == ExePlatformWorld) {
|
||||
snprintf(exename, sizeof(exename), "_world");
|
||||
filename.append("_world");
|
||||
} else if(platform == ExePlatformZone) {
|
||||
snprintf(exename, sizeof(exename), "_zone");
|
||||
filename.append("_zone");
|
||||
} else if(platform == ExePlatformLaunch) {
|
||||
snprintf(exename, sizeof(exename), "_launch");
|
||||
filename.append("_launch");
|
||||
} else if(platform == ExePlatformUCS) {
|
||||
snprintf(exename, sizeof(exename), "_ucs");
|
||||
filename.append("_ucs");
|
||||
} else if(platform == ExePlatformQueryServ) {
|
||||
snprintf(exename, sizeof(exename), "_queryserv");
|
||||
filename.append("_queryserv");
|
||||
} else if(platform == ExePlatformSharedMemory) {
|
||||
snprintf(exename, sizeof(exename), "_shared_memory");
|
||||
filename.append("_shared_memory");
|
||||
}
|
||||
|
||||
char filename[200];
|
||||
#ifndef NO_PIDLOG
|
||||
snprintf(filename, sizeof(filename), "%s%s_%04i.log", FileNames[id], exename, getpid());
|
||||
#else
|
||||
snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
|
||||
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
|
||||
// Visual Studio 2010 doesn't have std::to_string(int) but it does have one for
|
||||
// long long. Oh well, it works fine and formats perfectly acceptably.
|
||||
filename.append(std::to_string((long long)getpid()));
|
||||
#endif
|
||||
fp[id] = fopen(filename, "a");
|
||||
filename.append(".log");
|
||||
fp[id] = fopen(filename.c_str(), "a");
|
||||
if (!fp[id]) {
|
||||
cerr << "Failed to open log file: " << filename << endl;
|
||||
std::cerr << "Failed to open log file: " << filename << std::endl;
|
||||
pLogStatus[id] |= 4; // set file state to error
|
||||
return false;
|
||||
}
|
||||
fputs("---------------------------------------------\n",fp[id]);
|
||||
write(id, "Starting Log: %s", filename);
|
||||
write(id, "Starting Log: %s", filename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -326,6 +328,7 @@ bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
|
||||
};
|
||||
|
||||
bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) {
|
||||
|
||||
if (!logFileValid) {
|
||||
#if EQDEBUG >= 10
|
||||
cerr << "Error: Dump() from null pointer"<<endl;
|
||||
@ -350,36 +353,45 @@ bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 ski
|
||||
|
||||
write(id, "Dumping Packet: %i", size);
|
||||
// Output as HEX
|
||||
int j = 0; char* ascii = new char[cols+1]; memset(ascii, 0, cols+1);
|
||||
uint32 i;
|
||||
for(i=skip; i<size; i++) {
|
||||
if ((i-skip)%cols==0) {
|
||||
if (i != skip)
|
||||
writeNTS(id, dofile, " | %s\n", ascii);
|
||||
writeNTS(id, dofile, "%4i: ", i-skip);
|
||||
memset(ascii, 0, cols+1);
|
||||
j = 0;
|
||||
|
||||
int beginningOfLineOffset = 0;
|
||||
uint32 indexInData;
|
||||
std::string asciiOutput;
|
||||
|
||||
for(indexInData=skip; indexInData<size; indexInData++) {
|
||||
if ((indexInData-skip)%cols==0) {
|
||||
if (indexInData != skip)
|
||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||
writeNTS(id, dofile, "%4i: ", indexInData-skip);
|
||||
asciiOutput.clear();
|
||||
beginningOfLineOffset = 0;
|
||||
}
|
||||
else if ((i-skip)%(cols/2) == 0) {
|
||||
else if ((indexInData-skip)%(cols/2) == 0) {
|
||||
writeNTS(id, dofile, "- ");
|
||||
}
|
||||
writeNTS(id, dofile, "%02X ", (unsigned char)data[i]);
|
||||
writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]);
|
||||
|
||||
if (data[i] >= 32 && data[i] < 127)
|
||||
ascii[j++] = data[i];
|
||||
if (data[indexInData] >= 32 && data[indexInData] < 127)
|
||||
{
|
||||
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
|
||||
// Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long
|
||||
// version.
|
||||
asciiOutput.append(std::to_string((long long)data[indexInData]));
|
||||
}
|
||||
else
|
||||
ascii[j++] = '.';
|
||||
{
|
||||
asciiOutput.append(".");
|
||||
}
|
||||
}
|
||||
uint32 k = ((i-skip)-1)%cols;
|
||||
uint32 k = ((indexInData-skip)-1)%cols;
|
||||
if (k < 8)
|
||||
writeNTS(id, dofile, " ");
|
||||
for (uint32 h = k+1; h < cols; h++) {
|
||||
writeNTS(id, dofile, " ");
|
||||
}
|
||||
writeNTS(id, dofile, " | %s\n", ascii);
|
||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||
if (dofile)
|
||||
fflush(fp[id]);
|
||||
safe_delete_array(ascii);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -436,6 +448,3 @@ void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) {
|
||||
SetCallback((LogIDs)r, proc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2013 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -45,22 +45,9 @@
|
||||
#ifndef _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#if (_MSC_VER < 1300)
|
||||
#include <new>
|
||||
#include <memory>
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
// VS6 doesn't like the length of STL generated names: disabling
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#ifndef EQDEBUG_H
|
||||
#define EQDEBUG_H
|
||||
|
||||
@ -82,6 +69,7 @@
|
||||
|
||||
#include "logsys.h"
|
||||
#include "common_profile.h"
|
||||
|
||||
#ifdef ZONE
|
||||
#include "../zone/zone_profile.h"
|
||||
#endif
|
||||
@ -160,5 +148,7 @@ public:
|
||||
LARGE_INTEGER tmp;
|
||||
int64* p;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -29,9 +29,6 @@
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
|
||||
@ -68,9 +68,6 @@ typedef const char Const_char; //for perl XS
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
typedef void ThreadReturnType;
|
||||
@ -80,8 +77,8 @@ typedef const char Const_char; //for perl XS
|
||||
#define THREAD_RETURN(x) return(x);
|
||||
#endif
|
||||
|
||||
#define safe_delete(d) if(d) { delete d; d=0; }
|
||||
#define safe_delete_array(d) if(d) { delete[] d; d=0; }
|
||||
#define safe_delete(d) if(d) { delete d; d=nullptr; }
|
||||
#define safe_delete_array(d) if(d) { delete[] d; d=nullptr; }
|
||||
#define L32(i) ((uint32) i)
|
||||
#define H32(i) ((uint32) (i >> 32))
|
||||
#define L16(i) ((uint16) i)
|
||||
|
||||
@ -31,9 +31,6 @@ using namespace std;
|
||||
#include <winsock.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else // Pyro: fix for linux
|
||||
|
||||
@ -20,9 +20,6 @@ using namespace std;
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
|
||||
@ -49,9 +49,6 @@ using namespace std;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
@ -47,9 +47,6 @@ using namespace std;
|
||||
#ifdef _WINDOWS
|
||||
#include <process.h>
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#include <conio.h>
|
||||
|
||||
@ -28,12 +28,9 @@ Child of the Mob class.
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
#include "masterentity.h"
|
||||
|
||||
@ -25,12 +25,9 @@ target to center around.
|
||||
|
||||
#include "../common/debug.h"
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
#include "masterentity.h"
|
||||
|
||||
@ -28,19 +28,16 @@ using namespace std;
|
||||
|
||||
// for windows compile
|
||||
#ifdef _WINDOWS
|
||||
#define abs64 _abs64
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define abs64 _abs64
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#define abs64 abs
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include "../common/unix.h"
|
||||
#define abs64 abs
|
||||
#endif
|
||||
|
||||
extern volatile bool RunLoops;
|
||||
|
||||
@ -29,9 +29,6 @@
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
|
||||
@ -32,9 +32,6 @@
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
|
||||
@ -49,12 +49,9 @@ using namespace std;
|
||||
#include "QuestParserCollection.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
extern Zone* zone;
|
||||
|
||||
12
zone/net.cpp
12
zone/net.cpp
@ -33,14 +33,12 @@ using namespace std;
|
||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
using namespace std;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <conio.h>
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#include <conio.h>
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
volatile bool RunLoops = true;
|
||||
|
||||
@ -28,12 +28,9 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
#include "../common/packet_functions.h"
|
||||
#include "../common/packet_dump.h"
|
||||
|
||||
@ -27,16 +27,13 @@
|
||||
using namespace std;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <process.h>
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <process.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
@ -29,9 +29,6 @@ using namespace std;
|
||||
#include <process.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#if (_MSC_VER < 1500)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user