Merge branch 'RocketersAlex-fixstuff'

This commit is contained in:
SLAwww 2016-03-31 01:54:24 +03:00
commit d8424a3042
9 changed files with 1256 additions and 83 deletions

2
.gitignore vendored
View File

@ -39,6 +39,8 @@ Debug/
*.sdf *.sdf
*.map *.map
*.opensdf *.opensdf
*.pdb
*.sbr
*.suo *.suo
*.tlog *.tlog
*.ipch *.ipch

View File

@ -111,7 +111,9 @@ functions:
// provide info for GameAgent enumeration // provide info for GameAgent enumeration
export virtual void GetGameAgentPlayerInfo( INDEX iPlayer, CTString &strOut) { }; export virtual void GetGameAgentPlayerInfo( INDEX iPlayer, CTString &strOut) { };
// provide info for MSLegacy enumeration
export virtual void GetMSLegacyPlayerInf( INDEX iPlayer, CTString &strOut) { };
// create a checksum value for sync-check // create a checksum value for sync-check
export void ChecksumForSync(ULONG &ulCRC, INDEX iExtensiveSyncCheck) export void ChecksumForSync(ULONG &ulCRC, INDEX iExtensiveSyncCheck)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif #endif
extern CTString ga_strServer; extern CTString ga_strServer;
extern CTString ga_strMSLegacy;
extern BOOL ga_bMSLegacy;
/// Initialize GameAgent. /// Initialize GameAgent.
extern void GameAgent_ServerInit(void); extern void GameAgent_ServerInit(void);
@ -36,6 +38,10 @@ extern void GameAgent_EnumTrigger(BOOL bInternet);
extern void GameAgent_EnumUpdate(void); extern void GameAgent_EnumUpdate(void);
/// Cancel the GameAgent serverlist enumeration. /// Cancel the GameAgent serverlist enumeration.
extern void GameAgent_EnumCancel(void); extern void GameAgent_EnumCancel(void);
///
DWORD WINAPI _MS_Thread(LPVOID lpParam);
///
DWORD WINAPI _LocalNet_Thread(LPVOID lpParam);
/// Server request structure. Primarily used for getting server pings. /// Server request structure. Primarily used for getting server pings.
class CServerRequest { class CServerRequest {

View File

@ -0,0 +1,185 @@
/*
GSMSALG 0.3.3
by Luigi Auriemma
e-mail: aluigi@autistici.org
web: aluigi.org
INTRODUCTION
============
With the name Gsmsalg I define the challenge-response algorithm needed
to query the master servers that use the Gamespy "secure" protocol (like
master.gamespy.com for example).
This algorithm is not only used for this type of query but also in other
situations like the so called "Gamespy Firewall Probe Packet" and the
master server hearbeat that is the challenge string sent by the master
servers of the games that use the Gamespy SDK when game servers want to
be included in the online servers list (UDP port 27900).
HOW TO USE
==========
The function needs 4 parameters:
- dst: the destination buffer that will contain the calculated
response. Its length is 4/3 of the challenge size so if the
challenge is 6 bytes long, the response will be 8 bytes long
plus the final NULL byte which is required (to be sure of the
allocated space use 89 bytes or "((len * 4) / 3) + 3")
if this parameter is NULL the function will allocate the
memory for a new one automatically
- src: the source buffer containing the challenge string received
from the server.
- key: the gamekey or any other text string used as algorithm's
key, usually it is the gamekey but "might" be another thing
in some cases. Each game has its unique Gamespy gamekey which
are available here:
http://aluigi.org/papers/gslist.cfg
- enctype: are supported 0 (plain-text used in old games, heartbeat
challenge respond, enctypeX and more), 1 (Gamespy3D) and 2
(old Gamespy Arcade or something else).
The return value is a pointer to the destination buffer.
EXAMPLE
=======
#include "MSLegacy.h"
char *dest;
dest = gsseckey(
NULL, // dest buffer, NULL for auto allocation
"ABCDEF", // the challenge received from the server
"kbeafe", // kbeafe of Doom 3 and enctype set to 0
0); // enctype 0
LICENSE
=======
Copyright 2004,2005,2006,2007,2008 Luigi Auriemma
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
http://www.gnu.org/licenses/gpl.txt
*/
#ifdef PRAGMA_ONCE
#pragma once
#endif
/* function gsvalfunc */
unsigned char gsvalfunc(u_char reg) {
if(reg < 0x1a) return u_char (reg + 'A');
if(reg < 0x34) return u_char (reg + 'G');
if(reg < 0x3e) return u_char (reg - 4);
if(reg == 0x3e) return u_char('+');
if(reg == 0x3f) return u_char ('/');
return u_char(0);
}
/* function gsseckey */
unsigned char *gsseckey(u_char *secure, u_char *key, int enctype) {
static u_char validate[9];
u_char secbuf[7],
buff[256],
*ptr,
*ptrval,
*sec,
*k,
tmp1,
tmp2,
ebx,
i,
ecx,
edx,
edi;
i = 0;
ptr = buff;
do { *ptr++ = i++; } while(i); /* 256 times */
ptr = buff;
k = (unsigned char*) memcpy(secbuf, key, 6); /* good if key is not NULLed */
k[6] = edx = i = 0;
do { /* 256 times */
if(!*k) k = secbuf;
edx = *ptr + edx + *k;
/* don't use the XOR exchange optimization!!! */
/* ptrval is used only for faster code */
ptrval = buff + edx;
tmp1 = *ptr;
*ptr = *ptrval;
*ptrval = tmp1;
ptr++; k++; i++;
} while(i);
sec = (unsigned char *) memcpy(secbuf, secure, 6);
sec[6] = edi = ebx = 0;
do { /* 6 times */
edi = edi + *sec + 1;
ecx = ebx + buff[edi];
ebx = ecx;
/* don't use the XOR exchange optimization!!! */
/* ptr and ptrval are used only for faster code */
ptr = buff + edi;
ptrval = buff + ebx;
tmp1 = *ptr;
*ptr = *ptrval;
*ptrval = tmp1;
ecx = tmp1 + *ptr;
*sec++ ^= buff[ecx];
} while(*sec);
if(enctype == 2) {
ptr = key;
sec = secbuf;
do { /* 6 times */
*sec++ ^= *ptr++;
} while(*sec);
}
sec = secbuf;
ptrval = validate;
for(i = 0; i < 2; i++) {
tmp1 = *sec++;
tmp2 = *sec++;
*ptrval++ = gsvalfunc(tmp1 >> 2);
*ptrval++ = gsvalfunc(((tmp1 & 3) << 4) + (tmp2 >> 4));
tmp1 = *sec++;
*ptrval++ = gsvalfunc(((tmp2 & 0xf) << 2) + (tmp1 >> 6));
*ptrval++ = gsvalfunc(tmp1 & 0x3f);
}
*ptrval = 0x00;
return(validate);
}
/* function resolv */
u_int resolv(char *host) {
struct hostent *hp;
u_int host_ip;
host_ip = inet_addr(host);
if(host_ip == INADDR_NONE) {
hp = gethostbyname(host);
if(!hp) {
return (NULL);
} else host_ip = *(u_int *)(hp->h_addr);
}
return(host_ip);
}
/* end functions */

View File

@ -331,7 +331,7 @@ static void NetworkInfo(void)
for(INDEX iplb=0; iplb<_pNetwork->ga_srvServer.srv_aplbPlayers.Count(); iplb++) { for(INDEX iplb=0; iplb<_pNetwork->ga_srvServer.srv_aplbPlayers.Count(); iplb++) {
CPlayerBuffer &plb = _pNetwork->ga_srvServer.srv_aplbPlayers[iplb]; CPlayerBuffer &plb = _pNetwork->ga_srvServer.srv_aplbPlayers[iplb];
if (plb.plb_Active) { if (plb.plb_Active) {
CPrintF(" %2d(%2d):'%s'@client%2d: (%dact)\n", CPrintF(" %2d(%2d):'%s'@client%2d: (%dact)\n",
iplb, plb.plb_Index, plb.plb_pcCharacter.GetNameForPrinting(), iplb, plb.plb_Index, plb.plb_pcCharacter.GetNameForPrinting(),
plb.plb_iClient, plb.plb_abReceived.GetCount()); plb.plb_iClient, plb.plb_abReceived.GetCount());
} }
@ -341,7 +341,7 @@ static void NetworkInfo(void)
CSessionSocket &sso = _pNetwork->ga_srvServer.srv_assoSessions[iSession]; CSessionSocket &sso = _pNetwork->ga_srvServer.srv_assoSessions[iSession];
if (sso.sso_bActive) { if (sso.sso_bActive) {
CPrintF(" %2d:'%s'\n", iSession, _cmiComm.Server_GetClientName(iSession)), CPrintF(" %2d:'%s'\n", iSession, _cmiComm.Server_GetClientName(iSession)),
CPrintF(" buffer: %dblk=%dk\n", CPrintF(" buffer: %dblk=%dk\n",
sso.sso_nsBuffer.GetUsedBlocks(), sso.sso_nsBuffer.GetUsedBlocks(),
sso.sso_nsBuffer.GetUsedMemory()/1024); sso.sso_nsBuffer.GetUsedMemory()/1024);
CPrintF(" state:"); CPrintF(" state:");
@ -359,7 +359,7 @@ static void NetworkInfo(void)
CPrintF(" not a server\n"); CPrintF(" not a server\n");
} }
CPrintF("Session state:\n"); CPrintF("Session state:\n");
CPrintF(" buffer: (%dblk)%dk\n", CPrintF(" buffer: (%dblk)%dk\n",
_pNetwork->ga_sesSessionState.ses_nsGameStream.GetUsedBlocks(), _pNetwork->ga_sesSessionState.ses_nsGameStream.GetUsedBlocks(),
_pNetwork->ga_sesSessionState.ses_nsGameStream.GetUsedMemory()/1024); _pNetwork->ga_sesSessionState.ses_nsGameStream.GetUsedMemory()/1024);
CPrintF(" last processed tick: %g\n", _pNetwork->ga_sesSessionState.ses_tmLastProcessedTick); CPrintF(" last processed tick: %g\n", _pNetwork->ga_sesSessionState.ses_tmLastProcessedTick);
@ -377,11 +377,11 @@ static void NetworkInfo(void)
} }
if (TIMER_PROFILING) { if (TIMER_PROFILING) {
CTString strNetProfile; CTString strNetProfile;
_pfNetworkProfile.Report(strNetProfile); _pfNetworkProfile.Report(strNetProfile);
CPrintF(strNetProfile); CPrintF(strNetProfile);
} }
} }
static void ListPlayers(void) static void ListPlayers(void)
@ -432,7 +432,7 @@ static void KickByName(const CTString &strName, const CTString &strReason)
if (!_pNetwork->IsServer()) { if (!_pNetwork->IsServer()) {
CPrintF( TRANS("Only server can kick people!\n")); CPrintF( TRANS("Only server can kick people!\n"));
return; return;
} }
for(INDEX iplb=0; iplb<_pNetwork->ga_srvServer.srv_aplbPlayers.Count(); iplb++) { for(INDEX iplb=0; iplb<_pNetwork->ga_srvServer.srv_aplbPlayers.Count(); iplb++) {
CPlayerBuffer &plb = _pNetwork->ga_srvServer.srv_aplbPlayers[iplb]; CPlayerBuffer &plb = _pNetwork->ga_srvServer.srv_aplbPlayers[iplb];
if (plb.plb_Active && plb.plb_pcCharacter.GetNameForPrinting().Undecorated().Matches(strName)) { if (plb.plb_Active && plb.plb_pcCharacter.GetNameForPrinting().Undecorated().Matches(strName)) {
@ -462,8 +462,8 @@ static void StockInfo(void)
INDEX ctCachedShadows=0, ctDynamicShadows=0, ctFlatShadows=0; INDEX ctCachedShadows=0, ctDynamicShadows=0, ctFlatShadows=0;
SLONG slStaticMemory=0, slDynamicMemory=0, slUploadMemory=0; SLONG slStaticMemory=0, slDynamicMemory=0, slUploadMemory=0;
SLONG slShdBytes=0, slSlackMemory=0, slFlatMemory=0; SLONG slShdBytes=0, slSlackMemory=0, slFlatMemory=0;
INDEX ct256=0, ct128=0, ct64=0, ct32=0, ct16=0; INDEX ct256=0, ct128=0, ct64=0, ct32=0, ct16=0;
SLONG sl256Memory=0, sl128Memory=0, sl64Memory=0, sl32Memory=0, sl16Memory=0; SLONG sl256Memory=0, sl128Memory=0, sl64Memory=0, sl32Memory=0, sl16Memory=0;
if( _pGfx!=NULL) if( _pGfx!=NULL)
{ {
@ -533,15 +533,15 @@ static void StockInfo(void)
// report shadow layers and world geometry memory usage // report shadow layers and world geometry memory usage
FOREACHINDYNAMICARRAY( pwo->wo_baBrushes.ba_abrBrushes, CBrush3D, itbr) // for all brush entities in the world FOREACHINDYNAMICARRAY( pwo->wo_baBrushes.ba_abrBrushes, CBrush3D, itbr) // for all brush entities in the world
{ {
// skip brush without entity // skip brush without entity
if( itbr->br_penEntity==NULL) continue; if( itbr->br_penEntity==NULL) continue;
// for each mip // for each mip
FOREACHINLIST( CBrushMip, bm_lnInBrush, itbr->br_lhBrushMips, itbm) FOREACHINLIST( CBrushMip, bm_lnInBrush, itbr->br_lhBrushMips, itbm)
{ {
// for each sector in the brush mip // for each sector in the brush mip
FOREACHINDYNAMICARRAY( itbm->bm_abscSectors, CBrushSector, itbsc) FOREACHINDYNAMICARRAY( itbm->bm_abscSectors, CBrushSector, itbsc)
{ {
// add sector class memory usage to polygons memory // add sector class memory usage to polygons memory
ctSectors++; ctSectors++;
@ -564,7 +564,7 @@ static void StockInfo(void)
// for each polygon in sector // for each polygon in sector
ctPolys += itbsc->bsc_abpoPolygons.Count(); ctPolys += itbsc->bsc_abpoPolygons.Count();
FOREACHINSTATICARRAY( itbsc->bsc_abpoPolygons, CBrushPolygon, itbpo) { FOREACHINSTATICARRAY( itbsc->bsc_abpoPolygons, CBrushPolygon, itbpo) {
CBrushPolygon &bpo = *itbpo; CBrushPolygon &bpo = *itbpo;
slPlyBytes += bpo.GetUsedMemory(); slPlyBytes += bpo.GetUsedMemory();
// count in the shadow layers (if any) // count in the shadow layers (if any)
@ -588,7 +588,7 @@ static void StockInfo(void)
const FLOAT fAstBytes = dToMB * _pAnimSetStock->CalculateUsedMemory(); const FLOAT fAstBytes = dToMB * _pAnimSetStock->CalculateUsedMemory();
const FLOAT fShaBytes = dToMB * _pShaderStock->CalculateUsedMemory(); const FLOAT fShaBytes = dToMB * _pShaderStock->CalculateUsedMemory();
const FLOAT fSkaBytes = dToMB * _pSkeletonStock->CalculateUsedMemory(); const FLOAT fSkaBytes = dToMB * _pSkeletonStock->CalculateUsedMemory();
CPrintF("\nStock information:\n"); CPrintF("\nStock information:\n");
CPrintF(" Textures: %5d (%5.2f MB)\n", _pTextureStock->GetTotalCount(), fTexBytes); CPrintF(" Textures: %5d (%5.2f MB)\n", _pTextureStock->GetTotalCount(), fTexBytes);
CPrintF(" ShadowMaps: %5d (%5.2f MB)\n", ctCachedShadows, slShdBytes*dToMB); CPrintF(" ShadowMaps: %5d (%5.2f MB)\n", ctCachedShadows, slShdBytes*dToMB);
@ -747,7 +747,7 @@ void CNetworkLibrary::Init(const CTString &strGameID)
_pShell->DeclareSymbol("user void RemIPMask(CTString);", &RemIPMask); _pShell->DeclareSymbol("user void RemIPMask(CTString);", &RemIPMask);
_pShell->DeclareSymbol("user void AddNameMask(CTString);", &AddNameMask); _pShell->DeclareSymbol("user void AddNameMask(CTString);", &AddNameMask);
_pShell->DeclareSymbol("user void RemNameMask(CTString);", &RemNameMask); _pShell->DeclareSymbol("user void RemNameMask(CTString);", &RemNameMask);
_pShell->DeclareSymbol("user FLOAT dem_tmTimer;", &ga_fDemoTimer); _pShell->DeclareSymbol("user FLOAT dem_tmTimer;", &ga_fDemoTimer);
_pShell->DeclareSymbol("user FLOAT dem_fSyncRate;", &ga_fDemoSyncRate); _pShell->DeclareSymbol("user FLOAT dem_fSyncRate;", &ga_fDemoSyncRate);
@ -854,7 +854,7 @@ void CNetworkLibrary::Init(const CTString &strGameID)
_pShell->DeclareSymbol("user FLOAT phy_fCollisionCacheAhead;", &phy_fCollisionCacheAhead); _pShell->DeclareSymbol("user FLOAT phy_fCollisionCacheAhead;", &phy_fCollisionCacheAhead);
_pShell->DeclareSymbol("user FLOAT phy_fCollisionCacheAround;", &phy_fCollisionCacheAround); _pShell->DeclareSymbol("user FLOAT phy_fCollisionCacheAround;", &phy_fCollisionCacheAround);
_pShell->DeclareSymbol("persistent user INDEX inp_iKeyboardReadingMethod;", &inp_iKeyboardReadingMethod); _pShell->DeclareSymbol("persistent user INDEX inp_iKeyboardReadingMethod;", &inp_iKeyboardReadingMethod);
_pShell->DeclareSymbol("persistent user INDEX inp_bAllowMouseAcceleration;", &inp_bAllowMouseAcceleration); _pShell->DeclareSymbol("persistent user INDEX inp_bAllowMouseAcceleration;", &inp_bAllowMouseAcceleration);
_pShell->DeclareSymbol("persistent user FLOAT inp_fMouseSensitivity;", &inp_fMouseSensitivity); _pShell->DeclareSymbol("persistent user FLOAT inp_fMouseSensitivity;", &inp_fMouseSensitivity);
@ -874,7 +874,7 @@ void CNetworkLibrary::Init(const CTString &strGameID)
_pShell->DeclareSymbol("persistent user FLOAT inp_f2ndMousePrecisionFactor;", &inp_f2ndMousePrecisionFactor); _pShell->DeclareSymbol("persistent user FLOAT inp_f2ndMousePrecisionFactor;", &inp_f2ndMousePrecisionFactor);
_pShell->DeclareSymbol("persistent user FLOAT inp_f2ndMousePrecisionThreshold;", &inp_f2ndMousePrecisionThreshold); _pShell->DeclareSymbol("persistent user FLOAT inp_f2ndMousePrecisionThreshold;", &inp_f2ndMousePrecisionThreshold);
_pShell->DeclareSymbol("persistent user FLOAT inp_f2ndMousePrecisionTimeout;", &inp_f2ndMousePrecisionTimeout); _pShell->DeclareSymbol("persistent user FLOAT inp_f2ndMousePrecisionTimeout;", &inp_f2ndMousePrecisionTimeout);
_pShell->DeclareSymbol("persistent user INDEX inp_bMsgDebugger;", &inp_bMsgDebugger); _pShell->DeclareSymbol("persistent user INDEX inp_bMsgDebugger;", &inp_bMsgDebugger);
_pShell->DeclareSymbol("persistent user INDEX inp_iMButton4Up;", &inp_iMButton4Up); _pShell->DeclareSymbol("persistent user INDEX inp_iMButton4Up;", &inp_iMButton4Up);
_pShell->DeclareSymbol("persistent user INDEX inp_iMButton4Dn;", &inp_iMButton4Dn); _pShell->DeclareSymbol("persistent user INDEX inp_iMButton4Dn;", &inp_iMButton4Dn);
@ -887,6 +887,8 @@ void CNetworkLibrary::Init(const CTString &strGameID)
_pShell->DeclareSymbol("persistent user INDEX wed_bUseGenericTextureReplacement;", &wed_bUseGenericTextureReplacement); _pShell->DeclareSymbol("persistent user INDEX wed_bUseGenericTextureReplacement;", &wed_bUseGenericTextureReplacement);
_pShell->DeclareSymbol("user CTString ga_strServer;", &ga_strServer); _pShell->DeclareSymbol("user CTString ga_strServer;", &ga_strServer);
_pShell->DeclareSymbol("user CTString ga_strMSLegacy;", &ga_strMSLegacy);
_pShell->DeclareSymbol("user INDEX ga_bMSLegacy;", &ga_bMSLegacy);
_pShell->DeclareSymbol("INDEX pwoCurrentWorld;", &_pwoCurrentWorld); _pShell->DeclareSymbol("INDEX pwoCurrentWorld;", &_pwoCurrentWorld);
} }
@ -971,7 +973,7 @@ void CNetworkLibrary::AutoAdjustSettings(void)
* remember to keep this routine up to date with CNetworkLibrary::Read() * remember to keep this routine up to date with CNetworkLibrary::Read()
*/ */
void CNetworkLibrary::StartPeerToPeer_t(const CTString &strSessionName, void CNetworkLibrary::StartPeerToPeer_t(const CTString &strSessionName,
const CTFileName &fnmWorld, ULONG ulSpawnFlags, const CTFileName &fnmWorld, ULONG ulSpawnFlags,
INDEX ctMaxPlayers, BOOL bWaitAllPlayers, INDEX ctMaxPlayers, BOOL bWaitAllPlayers,
void *pvSessionProperties) // throw char * void *pvSessionProperties) // throw char *
{ {
@ -1096,7 +1098,7 @@ void CNetworkLibrary::Save_t(const CTFileName &fnmGame) // throw char *
if (!ga_IsServer) { if (!ga_IsServer) {
throw TRANS("Cannot save game - not a server!\n"); throw TRANS("Cannot save game - not a server!\n");
} }
// create the file // create the file
CTFileStream strmFile; CTFileStream strmFile;
strmFile.Create_t(fnmGame); strmFile.Create_t(fnmGame);
@ -1154,7 +1156,7 @@ void CNetworkLibrary::Load_t(const CTFileName &fnmGame) // throw char *
// if starting in network // if starting in network
if (_cmiComm.IsNetworkEnabled()) { if (_cmiComm.IsNetworkEnabled()) {
// make default state data for creating deltas // make default state data for creating deltas
MakeDefaultState(ga_fnmWorld, ga_sesSessionState.ses_ulSpawnFlags, MakeDefaultState(ga_fnmWorld, ga_sesSessionState.ses_ulSpawnFlags,
ga_aubProperties); ga_aubProperties);
} }
// players will be connected later // players will be connected later
@ -1619,7 +1621,7 @@ void CNetworkLibrary::ChangeLevel_internal(void)
// destroy all entities that will cross level // destroy all entities that will cross level
ga_World.DestroyEntities(senToCross); ga_World.DestroyEntities(senToCross);
// if should remember old levels // if should remember old levels
if (ga_bNextRemember) { if (ga_bNextRemember) {
// remember current level // remember current level
@ -1684,7 +1686,7 @@ void CNetworkLibrary::ChangeLevel_internal(void)
// copy entities from temporary world into new one // copy entities from temporary world into new one
CEntitySelection senCrossed; CEntitySelection senCrossed;
ga_World.CopyEntities(wldTemp, senInTemp, ga_World.CopyEntities(wldTemp, senInTemp,
senCrossed, CPlacement3D(FLOAT3D(0,0,0), ANGLE3D(0,0,0))); senCrossed, CPlacement3D(FLOAT3D(0,0,0), ANGLE3D(0,0,0)));
// restore pointers to entities for all active player targets // restore pointers to entities for all active player targets
@ -1803,7 +1805,7 @@ static void SendAdminResponse(ULONG ulAdr, UWORD uwPort, ULONG ulCode, const CTS
strLine.OnlyFirstLine(); strLine.OnlyFirstLine();
str.RemovePrefix(strLine); str.RemovePrefix(strLine);
str.DeleteChar(0); str.DeleteChar(0);
if (strLine.Length()>0) { if (strLine.Length()>0) {
CNetworkMessage nm(MSG_EXTRA); CNetworkMessage nm(MSG_EXTRA);
nm<<CTString(0, "log %u %d %s\n", ulCode, iLineCt++, strLine); nm<<CTString(0, "log %u %d %s\n", ulCode, iLineCt++, strLine);
_pNetwork->SendBroadcast(nm, ulAdr, uwPort); _pNetwork->SendBroadcast(nm, ulAdr, uwPort);
@ -2326,7 +2328,7 @@ void CNetworkLibrary::AddNetGraphValue(enum NetGraphEntryType nget, FLOAT fLaten
// make default state for a network game // make default state for a network game
extern void NET_MakeDefaultState_t( extern void NET_MakeDefaultState_t(
const CTFileName &fnmWorld, ULONG ulSpawnFlags, void *pvSessionProperties, const CTFileName &fnmWorld, ULONG ulSpawnFlags, void *pvSessionProperties,
CTStream &strmState) // throw char * CTStream &strmState) // throw char *
{ {
// mute all sounds // mute all sounds
@ -2427,7 +2429,7 @@ void CNetworkLibrary::GameInactive(void)
FOREVER { FOREVER {
CNetworkMessage nmReceived; CNetworkMessage nmReceived;
//_cmiComm.Broadcast_Update(); // _cmiComm.Broadcast_Update();
ULONG ulFrom; ULONG ulFrom;
UWORD uwPort; UWORD uwPort;
BOOL bHasMsg = ReceiveBroadcast(nmReceived, ulFrom, uwPort); BOOL bHasMsg = ReceiveBroadcast(nmReceived, ulFrom, uwPort);
@ -2437,11 +2439,11 @@ void CNetworkLibrary::GameInactive(void)
break; break;
} }
/* This is handled by GameAgent. /* This is handled by GameAgent.
// if requesting enumeration and this is server and enumeration is allowed // if requesting enumeration and this is server and enumeration is allowed
if (nmReceived.GetType()==MSG_REQ_ENUMSERVERS if (nmReceived.GetType()==MSG_REQ_ENUMSERVERS
&& IsServer() && IsServer()
&& (ser_bEnumeration && ga_sesSessionState.ses_ctMaxPlayers>1)) { && (ser_bEnumeration && ga_sesSessionState.ses_ctMaxPlayers>1)) {
// create response // create response
CNetworkMessage nmEnum(MSG_SERVERINFO); CNetworkMessage nmEnum(MSG_SERVERINFO);
@ -2470,7 +2472,7 @@ void CNetworkLibrary::GameInactive(void)
void CNetworkLibrary::InitCRCGather(void) void CNetworkLibrary::InitCRCGather(void)
{ {
CRCT_ResetActiveList(); CRCT_ResetActiveList();
CRCT_bGatherCRCs = TRUE; CRCT_bGatherCRCs = TRUE;
CRCT_AddFile_t(CTString("Classes\\Player.ecl")); CRCT_AddFile_t(CTString("Classes\\Player.ecl"));
} }

View File

@ -76,7 +76,8 @@ public:
INDEX ns_ctMaxPlayers; // max number of players INDEX ns_ctMaxPlayers; // max number of players
CTString ns_strGameType; // game type CTString ns_strGameType; // game type
CTString ns_strMod; // active mod CTString ns_strMod; // active mod
CTString ns_strVer; // version CTString ns_strVer; // version
public: public:
void Copy(const CNetworkSession &nsOriginal); void Copy(const CNetworkSession &nsOriginal);

View File

@ -1956,7 +1956,24 @@ functions:
strKey.PrintF("ping_%d\x02%d\x03", iPlayer, INDEX(ceil(en_tmPing*1000.0f))); strKey.PrintF("ping_%d\x02%d\x03", iPlayer, INDEX(ceil(en_tmPing*1000.0f)));
strOut+=strKey; strOut+=strKey;
}; };
// provide info for MSLegacy enumeration
void GetMSLegacyPlayerInf( INDEX iPlayer, CTString &strOut)
{
CTString strKey;
strKey.PrintF("\\player_%d\\%s", iPlayer, (const char*)GetPlayerName());
strOut+=strKey;
if (GetSP()->sp_bUseFrags) {
strKey.PrintF("\\frags_%d\\%d", iPlayer, m_psLevelStats.ps_iKills);
strOut+=strKey;
} else {
strKey.PrintF("\\frags_%d\\%d", iPlayer, m_psLevelStats.ps_iScore);
strOut+=strKey;
}
strKey.PrintF("\\ping_%d\\%d", iPlayer, INDEX(ceil(en_tmPing*1000.0f)));
strOut+=strKey;
};
// check if message is in inbox // check if message is in inbox
BOOL HasMessage( const CTFileName &fnmMessage) BOOL HasMessage( const CTFileName &fnmMessage)
{ {

View File

@ -115,7 +115,7 @@ extern CTString sam_strModName = TRANS("- O P E N S O U R C E -");
#if _SE_DEMO #if _SE_DEMO
extern CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld"; extern CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld";
#else #else
extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld.wld"; extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld";
#endif #endif
extern CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld"; extern CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld";
extern CTString sam_strGameName = "serioussamse"; extern CTString sam_strGameName = "serioussamse";
@ -514,8 +514,8 @@ BOOL Init( HINSTANCE hInstance, int nCmdShow, CTString strCmdLine)
LoadAndForceTexture(_toLogoEAX, _ptoLogoEAX, CTFILENAME("Textures\\Logo\\LogoEAX.tex")); LoadAndForceTexture(_toLogoEAX, _ptoLogoEAX, CTFILENAME("Textures\\Logo\\LogoEAX.tex"));
// !! NOTE !! Re-enable these to allow mod support. // !! NOTE !! Re-enable these to allow mod support.
//LoadStringVar(CTString("Data\\Var\\Sam_Version.var"), sam_strVersion); LoadStringVar(CTString("Data\\Var\\Sam_Version.var"), sam_strVersion);
//LoadStringVar(CTString("Data\\Var\\ModName.var"), sam_strModName); LoadStringVar(CTString("Data\\Var\\ModName.var"), sam_strModName);
CPrintF(TRANS("Serious Sam version: %s\n"), sam_strVersion); CPrintF(TRANS("Serious Sam version: %s\n"), sam_strVersion);
CPrintF(TRANS("Active mod: %s\n"), sam_strModName); CPrintF(TRANS("Active mod: %s\n"), sam_strModName);
InitializeMenus(); InitializeMenus();
@ -612,6 +612,7 @@ void End(void)
pvpViewPort = NULL; pvpViewPort = NULL;
pdpNormal = NULL; pdpNormal = NULL;
} }
CloseMainWindow(); CloseMainWindow();
MainWindow_End(); MainWindow_End();
DestroyMenus(); DestroyMenus();
@ -1199,15 +1200,37 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
_pInput->DisableInput(); _pInput->DisableInput();
_pGame->StopGame(); _pGame->StopGame();
if (_fnmModToLoad!="") {
char strCmd [64] = {0};
char strParam [128] = {0};
STARTUPINFOA cif;
ZeroMemory(&cif,sizeof(STARTUPINFOA));
PROCESS_INFORMATION pi;
strcpy_s(strCmd,"SeriousSam.exe");
strcpy_s(strParam," +game ");
strcat_s(strParam,_fnmModToLoad.FileName());
if (_strModServerJoin!="") {
strcat_s(strParam," +connect ");
strcat_s(strParam,_strModServerJoin);
strcat_s(strParam," +quickjoin");
}
if (CreateProcessA(strCmd,strParam,NULL,NULL,FALSE,CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&cif,&pi) == FALSE)
{
MessageBox(0, L"error launching the Mod!\n", L"Serious Sam", MB_OK|MB_ICONERROR);
}
}
// invoke quit screen if needed // invoke quit screen if needed
if( _bQuitScreen && _fnmModToLoad=="") QuitScreenLoop(); if( _bQuitScreen && _fnmModToLoad=="") QuitScreenLoop();
End(); End();
return TRUE; return TRUE;
} }
/*
void CheckModReload(void) void CheckModReload(void)
{ {
if (_fnmModToLoad!="") { if (_fnmModToLoad!="") {
@ -1225,9 +1248,10 @@ void CheckModReload(void)
argv[5] = "+quickjoin"; argv[5] = "+quickjoin";
argv[6] = NULL; argv[6] = NULL;
} }
_execv(strCommand, argv); _execv(strCommand, argv);
} }
} }*/
void CheckTeaser(void) void CheckTeaser(void)
{ {
@ -1254,8 +1278,8 @@ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
CTSTREAM_BEGIN { CTSTREAM_BEGIN {
iResult = SubMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); iResult = SubMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
} CTSTREAM_END; } CTSTREAM_END;
CheckModReload(); //CheckModReload();
CheckTeaser(); CheckTeaser();