หา
/ no occlusion if server build
#ifdef WO_SERVER
int g_UseHZB = 0;
----------------------------------------------
เอาใว้บน
static const char* configFile = "MasterServer.cfg"; //Tum
---------------------------------------------
หา
static int _r3d_logInited = 0;
เพิ่มด้านล้าง
static int _r3d_repInited = 0;
หา
static int _r3d_logOpened = 0;
เพิ่่มด้านล้าง
static int _r3d_repOpened = 0;
int _r3d_irepIndent = 0;
static FILE* _r3d_repFile = NULL;
หา
static FILE* _r3d_logFile = NULL;
เพิ่่มด้านล้าง
int _r3d_irepSizeIndent= 1;
หา
void r3dChangeLogFile(const char* fname)
{
r3dOutToLog("Changing log to %s\n", fname);
if(_r3d_logOpened) {
fclose(_r3d_logFile);
}
_r3d_logFile = fopen(fname, "wt");
//if(_r3d_logFile) {
// fwrite(UTF8_BOM, 1, 3, _r3d_logFile);
//}
}
เพิ่่มด้านล้าง
void r3dInitRepFile(int FoundPlayer)
{
time_t t;
FILE *f;
time(&t);
const char* group = "Report";
if(_access(configFile, 0) != 0) {
r3dError("can't open config file %s\n", configFile);
}
char ReportDir[512];
r3dscpy(ReportDir,r3dReadCFG_S(configFile, group, "ReportDir", ".\\"));
if (FoundPlayer == 0)
{
char Directory[512]="";
sprintf(Directory,"%sReports\\",ReportDir);
_mkdir(Directory);
sprintf(Directory,"%sreports.txt",Directory);
if(!r3dFileExists(Directory))
{
if((f = fopen(Directory, "wt")) != NULL) {
fprintf(f, "--- Reports started at %s\n", ctime(&t));
fclose(f);
}
}
}
else {
char Directory[512]="";
sprintf(Directory,"%sReports\\%i\\",ReportDir,FoundPlayer);
_mkdir(Directory);
sprintf(Directory,"%sreports.txt",Directory);
if(!r3dFileExists(Directory))
{
if((f = fopen(Directory, "wt")) != NULL) {
fprintf(f, "--- Reports started at %s\n", ctime(&t));
fclose(f);
}
}
}
return;
}
หา
bool r3dOutToLog(const char* Str, ...)
{
static CRITICAL_SECTION _cs_log;
if(!_r3d_logInited) {
_r3d_logInited = 1;
InitializeCriticalSectionAndSpinCount(&_cs_log, 4000);
r3dInitLogFile();
}
r3dCSHolder csHolder(_cs_log);
// buffer with indented spaces
char buf[4096];
int ioff = _r3d_iLogIndent*_r3d_iLogSizeIndent; // indent offset
r3d_assert(ioff < 500);
for(int i=0; i<ioff; i++) buf[i] = ' ';
va_list ap;
va_start(ap, Str);
StringCbVPrintfA(buf + ioff, sizeof(buf) - ioff, Str, ap);
va_end(ap);
if(!_r3d_logOpened)
{
_r3d_logOpened = 1;
_r3d_logFile = fopen("r3dlog.txt", "at");
}
if(_r3d_logFile)
{
fprintf(_r3d_logFile, "%06d.%03d| %s", int(r3dGetTime()), (int(r3dGetTime() * 1000) % 1000), buf);
//fprintf(_r3d_logFile, "%s", buf);
fflush(_r3d_logFile);
}
if(_r3d_bLogToDebug)
{
OutputDebugString(buf);
}
if(_r3d_bLogToConsole)
{
printf(buf);
}
เพิ่่มด้านล้าง
return true;
}
bool r3dAddReport(const char* Str, int FoundPlayer)
{
static CRITICAL_SECTION rpLog;
r3dInitRepFile(FoundPlayer);
const char* group = "Report";
if(_access(configFile, 0) != 0) {
r3dError("can't open config file %s\n", configFile);
}
char ReportDir[512];
r3dscpy(ReportDir,r3dReadCFG_S(configFile, group, "ReportDir", ".\\"));
char buf[4096];
int ioff = _r3d_irepIndent*_r3d_irepSizeIndent;
r3d_assert(ioff < 500);
for(int i=0; i<ioff; i++) buf[i] = ' ';
va_list ap;
va_start(ap, Str);
StringCbVPrintfA(buf + ioff, sizeof(buf) - ioff, Str, ap);
va_end(ap);
if(!_r3d_repOpened)
{
_r3d_repOpened = 1;
if (FoundPlayer == 0)
{
char Directory[512]="";
sprintf(Directory,"%sReports\\",ReportDir);
_mkdir(Directory);
sprintf(Directory,"%sreports.txt",Directory);
_r3d_repFile = fopen(Directory, "at");
}
else {
char Directory[512]="";
sprintf(Directory,"%sReports\\%i\\",ReportDir,FoundPlayer);
_mkdir(Directory);
sprintf(Directory,"%sreports.txt",Directory);
_r3d_repFile = fopen(Directory, "at");
}
}
if(_r3d_repFile)
{
fprintf(_r3d_repFile, "%06d.%03d| %s", int(r3dGetTime()), (int(r3dGetTime() * 1000) % 1000), buf);
fflush(_r3d_repFile);
fclose(_r3d_repFile);
_r3d_repOpened=0;
}
if(_r3d_bLogToDebug)
{
OutputDebugString(buf);
}
if(_r3d_bLogToConsole)
{
printf(buf);
}
หา
int r3dToggleScreenShot()
{
time_t curtime;
time(&curtime);
struct tm curdate = *localtime(&curtime);
char FileName[128];
เพิ่่มด้านล้าง
_mkdir("Screenshots");
#ifndef FINAL_BUILD
sprintf(FileName, "Screenshots\\Screen_%02d%02d%04d_%02d%02d%02d.tga", curdate.tm_mday, curdate.tm_mon, 1900+curdate.tm_year, curdate.tm_hour, curdate.tm_min, curdate.tm_sec);
#else
sprintf(FileName, "Screenshots\\Screen_%02d%02d%04d_%02d%02d%02d.jpg", curdate.tm_mday, curdate.tm_mon, 1900+curdate.tm_year, curdate.tm_hour, curdate.tm_min, curdate.tm_sec);
#endif
หา
int _r3d_sscopy_height = 0; // expected height of screenshot copy
int _r3d_sscopy_type = 0; // if we want to take explicitly back or front screenshot (1-front, 2-back, 0-default)
เพิ่่มด้านล้าง
char FoundPlayerCheat[512]="";
หา
static void DoCheckPow2( int width, int height, const char* file )
{
if( !r3dIsPow2( width ) || !r3dIsPow2( height ) )
{
//r3dArtBug( "Texture '%s' is not power of 2 ( %d, %d )\n", file, width, height );
}
}
ทับ
static void DoCheckPow2( int width, int height, const char* file )
{
if( !r3dIsPow2( width ) || !r3dIsPow2( height ) )
{
r3dArtBug( "Texture '%s' is not power of 2 ( %d, %d )\n", file, width, height );
}
}
หา
void HUDDisplay::eventChatMessage(r3dScaleformMovie* pMovie, const Scaleform::GFx::Value* args, unsigned argCount)
{
chatInputActive = false;
lastChatMessageSent = r3dGetTime();
static char s_chatMsg[2048];
int currentTabIndex = args[0].GetInt();
r3dscpy(s_chatMsg, args[1].GetString());
bool has_anything = false;
size_t start_text=0;
size_t argLen = strlen(s_chatMsg);
if(argLen < 3)
return;
#ifdef __WITH_PB__
// Handle PunkBuster commands
if(strnicmp(s_chatMsg, "/pb_", 4) == 0 || strnicmp(s_chatMsg, "\\pb_", 4) == 0)
{
PbClAddEvent ( PB_EV_CMD, strlen (s_chatMsg)-1, s_chatMsg+1 ) ;
return ;
}
#endif
เพิ่่มด้านล้าง
if(strncmp(s_chatMsg, "/report", 7) == 0)
{
char fullmsg[515];
strcpy(fullmsg,s_chatMsg);
char PlayerReported[512]="";
char * pch;
pch = strtok (s_chatMsg,"\"");
int PlayerIncharMsg=0;
while (pch != NULL)
{
if (PlayerIncharMsg==1)
{
sprintf(PlayerReported,"%s",pch);
break;
}
pch = strtok (NULL, "\"");
PlayerIncharMsg++;
}
PKT_S2C_CamuDataS_s n;
strcpy(n.nickname,PlayerReported);
p2pSendToHost(gClientLogic().localPlayer_, &n, sizeof(n));
//gClientLogic().SendScreenshotToServer(PlayerReported);
strcpy(s_chatMsg,fullmsg);
}
หา
bool isAdmin = gUserProfile.ProfileData.isDevAccount > 0;
เพิ่ม หรือ แก้ด้านบน ลบ // ออก
cntxCmds[curCntxCmd++] = ContextCommand(HUDDisplay_ContextMenu_ReportPlayerID, "$HUD_PlayerAction_Report");
หา
/*if(actionID == HUDDisplay_ContextMenu_ReportPlayerID)
{
char tmpStr[256];
sprintf(tmpStr, "FairFight \"%s\"", gamertag);
showChatInput(tmpStr);
}*/
เพิ่มด้านล้าง
if(actionID == HUDDisplay_ContextMenu_ReportPlayerID)
{
char tmpStr[256];
sprintf(tmpStr, "/report \"%s\" ", gamertag);
showChatInput(tmpStr);
}
หา
extern int _r3d_sscopy_width;
extern int _r3d_sscopy_height;
_r3d_sscopy_width = 800;
_r3d_sscopy_height = 600;
แก้เป็น
extern int _r3d_sscopy_width;
extern int _r3d_sscopy_height;
extern char FoundPlayerCheat[512];
_r3d_sscopy_width = 800;
_r3d_sscopy_height = 600;
strcpy(FoundPlayerCheat,"AnticheatSystemAuto");
หา
// some security
PKT_C2S_SecurityRep,
PKT_S2C_PlayerWeapDataRepReq,
PKT_C2S_PlayerWeapDataRepAns,
PKT_S2C_CheatWarning,
PKT_C2S_ScreenshotData,
PKT_C2S_CameraPos,
เพิ่ม
PKT_S2C_CamuDataS,
หา
struct PKT_C2S_PlayerWeapDataRepAns_s : public DefaultPacketMixin<PKT_C2S_PlayerWeapDataRepAns>
{
// for CHAR_LOADOUT_WEAPON1 and CHAR_LOADOUT_WEAPON2
DWORD weaponsDataHash[2];
DWORD debug_wid[2];
GBWeaponInfo debug_winfo[2];
};
เพิ่มด้านล้าง
struct PKT_S2C_CamuDataS_s : public DefaultPacketMixin<PKT_S2C_CamuDataS>
{
char nickname[512];
};
หา
struct PKT_C2S_ScreenshotData_s : public DefaultPacketMixin<PKT_C2S_ScreenshotData>
{
BYTE errorCode; // 0 if success
DWORD dataSize;
// this packet will have attached screenshot data after header
// char data[...];
};
ทับ
struct PKT_C2S_ScreenshotData_s : public DefaultPacketMixin<PKT_C2S_ScreenshotData>
{
BYTE errorCode; // 0 if success
DWORD dataSize;
char nickname[512];
// this packet will have attached screenshot data after header
// char data[...];
};
หา
DEFINE_PACKET_FUNC(PKT_S2C_CreateZombie);
เพิ่มด้านล้าง
DEFINE_PACKET_FUNC(PKT_S2C_CamuDataS);
หา
void Tick();
void SendScreenshot(IDirect3DTexture9* texture);
void SendScreenshotFailed(int code);
ทับ
void Tick();
void SendScreenshotToServer(const char* FoundPlayer);
void SendScreenshot(IDirect3DTexture9* texture,const char* FoundPlayer);
void SendScreenshotFailed(int code);
หา
extern IDirect3DTexture9* _r3d_screenshot_copy;
เพิ่มด้านล้าง
extern char FoundPlayerCheat[512];
หา
IMPL_PACKET_FUNC(ClientGameLogic, PKT_C2S_DisconnectReq)
{
//r3dOutToLog("PKT_C2S_DisconnectReq\n");
disconnectStatus_ = 2;
GameWorld().OnGameEnded();
}
เพิ่มด้านล้าง
IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CamuDataS)
{
extern int _r3d_sscopy_width;
extern int _r3d_sscopy_height;
extern int _r3d_sscopy_type;
extern char FoundPlayerCheat[512];
_r3d_sscopy_width = 800;
_r3d_sscopy_height = 600;
strcpy(FoundPlayerCheat,n.nickname);
_r3d_sscopy_type = 1;
}
หา
IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CheatWarning)
{
VMPROTECT_BeginMutation("PKT_S2C_CheatWarning");
if(n.cheatId>=253 && n.cheatId<=255)
{
// force renderer to make copy of current screenshot
extern int _r3d_sscopy_width;
extern int _r3d_sscopy_height;
extern int _r3d_sscopy_type;
_r3d_sscopy_width = 800;
_r3d_sscopy_height = 600;
if(n.cheatId == 254) // take front buffer screen only
_r3d_sscopy_type = 1;
else if(n.cheatId == 253) // take back buffer screen only
_r3d_sscopy_type = 2;
}
VMPROTECT_End();
}
ทับ
IMPL_PACKET_FUNC(ClientGameLogic, PKT_S2C_CheatWarning)
{
VMPROTECT_BeginMutation("PKT_S2C_CheatWarning");
if(n.cheatId>=253 && n.cheatId<=255)
{
// force renderer to make copy of current screenshot
extern int _r3d_sscopy_width;
extern int _r3d_sscopy_height;
extern int _r3d_sscopy_type;
extern char FoundPlayerCheat[512];
_r3d_sscopy_width = 800;
_r3d_sscopy_height = 600;
strcpy(FoundPlayerCheat,"AnticheatSystemAuto");
if(n.cheatId == 254) // take front buffer screen only
_r3d_sscopy_type = 1;
else if(n.cheatId == 253) // take back buffer screen only
_r3d_sscopy_type = 2;
}
VMPROTECT_End();
}
หา
DEFINE_PACKET_HANDLER(PKT_S2C_CreateZombie);
เพิ่มด้านล้าง
DEFINE_PACKET_HANDLER(PKT_S2C_CamuDataS);
หา
void ClientGameLogic::SendScreenshotFailed(int code)
{
r3d_assert(code > 0);
PKT_C2S_ScreenshotData_s n;
n.errorCode = (BYTE)code;
n.dataSize = 0;
p2pSendToHost(NULL, &n, sizeof(n));
}
ทับ
void ClientGameLogic::SendScreenshotFailed(int code)
{
r3d_assert(code > 0);
PKT_C2S_ScreenshotData_s n;
n.errorCode = (BYTE)code;
n.dataSize = 0;
strcpy(n.nickname,"Fail Send Screenshot");
p2pSendToHost(NULL, &n, sizeof(n));
}
void ClientGameLogic::SendScreenshotToServer(const char* FoundPlayer)
{
extern int _r3d_sscopy_width;
extern int _r3d_sscopy_height;
extern int _r3d_sscopy_type;
extern char FoundPlayerCheat[512];
_r3d_sscopy_width = 800;
_r3d_sscopy_height = 600;
strcpy(FoundPlayerCheat,FoundPlayer);
_r3d_sscopy_type = 1;
}
หา
void ClientGameLogic::SendScreenshot(IDirect3DTexture9* texture)
ทับ
void ClientGameLogic::SendScreenshot(IDirect3DTexture9* texture,const char* FoundPlayer)
หา
PKT_C2S_ScreenshotData_s n;
n.errorCode = 0;
n.dataSize = pData->GetBufferSize();
memcpy(pktdata, &n, sizeof(n));
memcpy(pktdata + sizeof(n), pData->GetBufferPointer(), n.dataSize);
p2pSendToHost(NULL, (DefaultPacket*)pktdata, pktsize);
ทับ
PKT_C2S_ScreenshotData_s n;
n.errorCode = 0;
n.dataSize = pData->GetBufferSize();
strcpy(n.nickname,FoundPlayer);
memcpy(pktdata, &n, sizeof(n));
memcpy(pktdata + sizeof(n), pData->GetBufferPointer(), n.dataSize);
p2pSendToHost(NULL, (DefaultPacket*)pktdata, pktsize);
หา
SendScreenshot(_r3d_screenshot_copy);
แก้หรือทับ
SendScreenshot(_r3d_screenshot_copy,FoundPlayerCheat);
หา
SendScreenshot(GetCheatScreenshot());
แก้หรือทับ
SendScreenshot(GetCheatScreenshot(),FoundPlayerCheat);
หา
bool IsAdmin(DWORD CustomerID);
typedef stdext::hash_map<DWORD, float> TKickedPlayers;
TKickedPlayers kickedPlayers_;
เพิ่มด้านล้าง ต่อจาก TKickedPlayers kickedPlayers_;
obj_ServerPlayer* GetPlayer(int playerIdx)
{
r3d_assert(playerIdx < MAX_NUM_PLAYERS);
if(plrToPeer_[playerIdx] == NULL)
return NULL;
return plrToPeer_[playerIdx]->player;
}
หา
DEFINE_PACKET_FUNC(PKT_C2S_DataUpdateReq);
เพิ่มด้านล้าง
DEFINE_PACKET_FUNC(PKT_S2C_CamuDataS);
หา
#ifdef MISSIONS
if(strncmp(cmd, "/resetmd", 8) == 0 && plr->profile_.ProfileData.isDevAccount)
return Cmd_ResetMissionData(plr, cmd);
#endif
เพิ่มด้านบน
if(strncmp(cmd, "/report", 7) == 0)
{
char PlayerReported[512]="";
char reason[512];
char * pch;
char text[512];
sprintf(text,"%s",cmd);
pch = strtok (text,"\"");
int PlayerIncharMsg=0;
while (pch != NULL)
{
if (PlayerIncharMsg==1)
{
sprintf(PlayerReported,"%s",pch);
}
else if (PlayerIncharMsg==2)
{
sprintf(reason,"%s",pch);
break;
}
pch = strtok (NULL, "\"");
PlayerIncharMsg++;
}
if (strcmp(reason," ") == 0)
strcpy(reason,"No reason specified");
int FoundPlayer = 0;
for(int i=0; i<MAX_NUM_PLAYERS; ++i)
{
obj_ServerPlayer* plr = gServerLogic.GetPlayer(i);
if(plr && strcmp(strupr(plr->loadout_->Gamertag),strupr(PlayerReported)) == 0)
{
FoundPlayer = plr->profile_.CustomerID;
break;
}
}
if (FoundPlayer == 0)
{
return 4;
}
char reportedTXT[512];
sprintf(reportedTXT,"%s: Reported to %s Reason: %s\n", plr->userName, PlayerReported,reason);
r3dAddReport(reportedTXT,FoundPlayer);
return 2;
}
หา
const float curTime = r3dGetTime();
if(n.msg[0] == '/')
{
ทับ
const float curTime = r3dGetTime();
if(n.msg[0] == '/')
{
int res = ProcessChatCommand(fromPlr, n.msg);
if(res == 0)
{
SendSystemChatMessageToPeer(peerId, fromPlr, "command executed");
}
else if(res == 2)
{
SendSystemChatMessageToPeer(peerId, fromPlr, "Player Reported");
}
else if(res == 3)
{
SendSystemChatMessageToPeer(peerId, fromPlr, "AirDropSpawn not found on this server");
}
else if(res == 4)
{
SendSystemChatMessageToPeer(peerId, fromPlr, "Player not found");
หา
/*#ifdef ENABLE_GAMEBLOCKS
if(g_GameBlocks_Client && g_GameBlocks_Client->Connected())
{
g_GameBlocks_Client->PrepareEventForSending("Chat", g_GameBlocks_ServerID, GameBlocks::GBPublicPlayerId(uint32_t(fromPlr->profile_.CustomerID)));
g_GameBlocks_Client->AddKeyValueString("PlayerName", fromPlr->loadout_->Gamertag);
g_GameBlocks_Client->AddKeyValueInt("Channel", n.msgChannel);
g_GameBlocks_Client->AddKeyValueString("Text", n.msg);
g_GameBlocks_Client->SendEvent();
}
#endif
// do not broadcast fairfight reporting messages
if(strncmp(n.msg, "FairFight ", 10) == 0)
{
#ifdef ENABLE_GAMEBLOCKS
// those strings should be big enough to hold whole n.msg!!! otherwise attacker can construct such a message that will cause buffer overrun.
char buf[256]={0};
char plrName[256]={0};
const char* beginNameStr = strchr(n.msg, '"');
const char* endNameStr = strrchr(n.msg, '"');
if(!beginNameStr || !endNameStr || beginNameStr==endNameStr)
return;
memcpy(plrName, beginNameStr+1, int((endNameStr)-(beginNameStr))-1);
for(int i=0; i<curPlayers_; ++i)
{
obj_ServerPlayer* pl = plrList_[i];
if(stricmp(pl->userName, plrName)==0)
{
g_GameBlocks_Client->PrepareEventForSending("ReportPlayer", g_GameBlocks_ServerID, GameBlocks::GBPublicPlayerId(uint32_t(pl->profile_.CustomerID)));
g_GameBlocks_Client->AddKeyValueInt("ReportedByID", fromPlr->profile_.CustomerID);
g_GameBlocks_Client->SendEvent();
break;
}
}
#endif
return;
}*/
ทับ
#ifdef ENABLE_GAMEBLOCKS
if(g_GameBlocks_Client && g_GameBlocks_Client->Connected())
{
g_GameBlocks_Client->PrepareEventForSending("Chat", g_GameBlocks_ServerID, GameBlocks::GBPublicPlayerId(uint32_t(fromPlr->profile_.CustomerID)));
g_GameBlocks_Client->AddKeyValueString("PlayerName", fromPlr->loadout_->Gamertag);
g_GameBlocks_Client->AddKeyValueInt("Channel", n.msgChannel);
g_GameBlocks_Client->AddKeyValueString("Text", n.msg);
g_GameBlocks_Client->SendEvent();
}
#endif
// do not broadcast fairfight reporting messages
if(strncmp(n.msg, "FairFight ", 10) == 0)
{
#ifdef ENABLE_GAMEBLOCKS
// those strings should be big enough to hold whole n.msg!!! otherwise attacker can construct such a message that will cause buffer overrun.
char buf[256]={0};
char plrName[256]={0};
const char* beginNameStr = strchr(n.msg, '"');
const char* endNameStr = strrchr(n.msg, '"');
if(!beginNameStr || !endNameStr || beginNameStr==endNameStr)
return;
memcpy(plrName, beginNameStr+1, int((endNameStr)-(beginNameStr))-1);
for(int i=0; i<curPlayers_; ++i)
{
obj_ServerPlayer* pl = plrList_[i];
if(stricmp(pl->userName, plrName)==0)
{
g_GameBlocks_Client->PrepareEventForSending("ReportPlayer", g_GameBlocks_ServerID, GameBlocks::GBPublicPlayerId(uint32_t(pl->profile_.CustomerID)));
g_GameBlocks_Client->AddKeyValueInt("ReportedByID", fromPlr->profile_.CustomerID);
g_GameBlocks_Client->SendEvent();
break;
}
}
#endif
return;
}
หา
default:
{
DisconnectPeer(peerId, true, "invalid PKT_C2C_ChatMessage #4 - wrong msgChannel");
return;
}
break;
เพิ่มด้านล้าง
}
}
IMPL_PACKET_FUNC(ServerGameLogic, PKT_S2C_CamuDataS)
{
obj_ServerPlayer* plr = NULL;
char test[512];
for(int i = 0; i < MAX_NUM_PLAYERS; i++)
{
plr = gServerLogic.GetPlayer(i);
if(!plr)
continue;
sprintf(test,"%s",n.nickname);
if (strcmp(strupr(plr->loadout_->Gamertag),strupr(test)) == 0)
{
PKT_S2C_CamuDataS_s n2;
strcpy(n2.nickname,n.nickname);
p2pSendRawToPeer(plr->peerId_, &n2, sizeof(n2), true);
break;
}
หา
DisconnectPeer(peerId, true, "invalid PKT_C2C_ChatMessage #4 - wrong msgChannel");
return;
}
break;
เพิ่มด้านล้าง
}
}
IMPL_PACKET_FUNC(ServerGameLogic, PKT_S2C_CamuDataS)
{
obj_ServerPlayer* plr = NULL;
char test[512];
for(int i = 0; i < MAX_NUM_PLAYERS; i++)
{
plr = gServerLogic.GetPlayer(i);
if(!plr)
continue;
sprintf(test,"%s",n.nickname);
if (strcmp(strupr(plr->loadout_->Gamertag),strupr(test)) == 0)
{
PKT_S2C_CamuDataS_s n2;
strcpy(n2.nickname,n.nickname);
p2pSendRawToPeer(plr->peerId_, &n2, sizeof(n2), true);
break;
}
หา
void ServerGameLogic::OnPKT_C2S_ScreenshotData(DWORD peerId, const int size, const char* data)
ทับ
void ServerGameLogic::OnPKT_C2S_ScreenshotData(DWORD peerId, const int size, const char* data, const char* FoundPlayer)
{
char fname[MAX_PATH];
char test[512];
const peerInfo_s& peer = GetPeer(peerId);
int isFoundPlayer = 0;
for(int i=0; i<MAX_NUM_PLAYERS; ++i)
{
obj_ServerPlayer* plr = gServerLogic.GetPlayer(i);
sprintf(test,"%s",FoundPlayer);
if(plr && strcmp(strupr(plr->loadout_->Gamertag),strupr(test)) == 0)
{
isFoundPlayer = plr->profile_.CustomerID;
break;
}
}
if (strcmp(FoundPlayer,"AnticheatSystemAuto") == 0)
isFoundPlayer = 999;
if (isFoundPlayer == 0)
return;
if(peer.player == NULL)
{
return;
}
else
{
const char* group = "Report";
if(_access(configFile, 0) != 0) {
r3dError("can't open config file %s\n", configFile);
}
char ReportDir[512];
r3dscpy(ReportDir,r3dReadCFG_S(configFile, group, "ReportDir", ".\\"));
char Directory[512]="";
sprintf(Directory,"%sReports\\%i\\",ReportDir,isFoundPlayer);
_mkdir(Directory);
time_t t;
time(&t);
char Date[512];
r3dscpy(Date,ctime(&t));
Date[3]='_';
Date[7]='_';
Date[10]='_';
Date[13]='_';
Date[16]='_';
Date[19]='_';
//sprintf(fname, "%sDate_%.24s_GameServer_%d_PlayerScreen_of_CID_%d_%x.jpg",Directory,Date,ginfo_.gameServerId,peer.player->profile_.CustomerID,GetTickCount());
sprintf(fname, "%sReport-%d-%d_%.24s.jpg",Directory, peer.player->profile_.CustomerID, peer.player->loadout_->LoadoutID, Date);//, GetTickCount());
}
r3dOutToLog("peer%02d received screenshot, fname:%s\n", peerId, fname);
FILE* f = fopen(fname, "wb");
if(f == NULL) {
LogInfo(peerId, "SaveScreenshot", "unable to save fname:%s", fname);
}
else
{
fwrite(data, 1, size, f);
fclose(f);
}
หา
DEFINE_PACKET_HANDLER(PKT_C2S_DataUpdateReq);
เพิ่มด้านล้าง
DEFINE_PACKET_HANDLER(PKT_S2C_CamuDataS);
หา
OnPKT_C2S_ScreenshotData(peerId, n.dataSize, (char*)packetData + sizeof(n));
return TRUE;
ทับ
OnPKT_C2S_ScreenshotData(peerId, n.dataSize, (char*)packetData + sizeof(n), n.nickname);
return TRUE;
หาใน ServerGameLogic.h
OnPKT_C2S_ScreenshotData(peerId, n.dataSize, (char*)packetData + sizeof(n), n.nickname);
return TRUE;
เพิ่มด้านล้าง
obj_ServerPlayer* GetPlayer(int playerIdx)
{
r3d_assert(playerIdx < MAX_NUM_PLAYERS);
if(plrToPeer_[playerIdx] == NULL)
return NULL;
return plrToPeer_[playerIdx]->player;
}
หา
DEFINE_PACKET_FUNC(PKT_C2S_DataUpdateReq);
เพิ่มด้านล้าง
DEFINE_PACKET_FUNC(PKT_S2C_CamuDataS);
หา
void OnPKT_C2S_ScreenshotData(DWORD peerId, const int size, const char* data);
ทับ หรือแก้
void OnPKT_C2S_ScreenshotData(DWORD peerId, const int size, const char* data,const char* FoundPlayer);
ไม่มีความคิดเห็น:
แสดงความคิดเห็น