Copyright (c) 2001, Loki software, inc.
All rights reserved.
-Redistribution and use in source and binary forms, with or without modification,
+Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
-Redistributions of source code must retain the above copyright notice, this list
+Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
-Neither the name of Loki software nor the names of its contributors may be used
-to endorse or promote products derived from this software without specific prior
-written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Neither the name of Loki software nor the names of its contributors may be used
+to endorse or promote products derived from this software without specific prior
+written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//-----------------------------------------------------------------------------
#include "stream_version.h"
-static void saxStartElement(message_info_t *data, const xmlChar *name, const xmlChar **attrs)
+static void saxStartElement(message_info_t *data, const xmlChar *name, const xmlChar **attrs)
{
if (data->ignore_depth == 0)
{
}
else if (strcmp((char*)attrs[1],Q3MAP_STREAM_VERSION) != 0)
{
- Sys_FPrintf(SYS_ERR,
+ Sys_FPrintf(SYS_ERR,
"This version of Radiant reads version %s debug streams, I got an incoming connection with version %s\n"
"Please make sure your versions of Radiant and q3map are matching.\n", Q3MAP_STREAM_VERSION, (char*)attrs[1]);
abortStream(data);
{
data->msg_level = atoi ((char *)attrs[1]);
}
- else if (strcmp ((char *)name, "polyline") == 0)
+ else if (strcmp ((char *)name, "polyline") == 0)
// polyline has a particular status .. right now we only use it for leakfile ..
{
data->bGeometry = true;
data->pGeometry = &g_pointfile;
- data->pGeometry->saxStartElement (data, name, attrs);
+ data->pGeometry->saxStartElement( data, name, attrs );
}
else if (strcmp ((char *)name, "select") == 0)
{
CSelectMsg *pSelect = new CSelectMsg();
data->bGeometry = true;
data->pGeometry = pSelect;
- data->pGeometry->saxStartElement (data, name, attrs);
+ data->pGeometry->saxStartElement( data, name, attrs );
}
else if (strcmp ((char *)name, "pointmsg") == 0)
{
CPointMsg *pPoint = new CPointMsg();
data->bGeometry = true;
data->pGeometry = pPoint;
- data->pGeometry->saxStartElement (data, name, attrs);
+ data->pGeometry->saxStartElement( data, name, attrs );
}
else if (strcmp ((char *)name, "windingmsg") == 0)
{
CWindingMsg *pWinding = new CWindingMsg();
data->bGeometry = true;
data->pGeometry = pWinding;
- data->pGeometry->saxStartElement (data, name, attrs);
+ data->pGeometry->saxStartElement( data, name, attrs );
}
else
{
data->recurse++;
}
-static void saxEndElement(message_info_t *data, const xmlChar *name)
-{
- data->recurse--;
- // we are out of an ignored chunk
- if (data->recurse == data->ignore_depth)
- {
- data->ignore_depth = 0;
- return;
- }
- if (data->bGeometry)
- {
- data->pGeometry->saxEndElement (data, name);
- // we add the object to the debug window
- if (!data->bGeometry)
- {
- g_DbgDlg.Push (data->pGeometry);
- }
- }
- if (data->recurse == data->stop_depth)
- {
+static void saxEndElement(message_info_t *data, const xmlChar *name) {
+ data->recurse--;
+ // we are out of an ignored chunk
+ if ( data->recurse == data->ignore_depth ) {
+ data->ignore_depth = 0;
+ return;
+ }
+ if ( data->bGeometry ) {
+ data->pGeometry->saxEndElement( data, name );
+ // we add the object to the debug window
+ if ( !data->bGeometry ) {
+ g_DbgDlg.Push( data->pGeometry );
+ }
+ }
+ if ( data->recurse == data->stop_depth ) {
#ifdef _DEBUG
- Sys_Printf ("Received error msg .. shutting down..\n");
+ Sys_Printf ("Received error msg .. shutting down..\n");
#endif
- g_pParentWnd->GetWatchBSP()->Reset();
- // tell there has been an error
- if (g_pParentWnd->GetWatchBSP()->HasBSPPlugin ())
- g_BSPFrontendTable.m_pfnEndListen(2);
- return;
- }
+ g_pParentWnd->GetWatchBSP()->Reset();
+ // tell there has been an error
+ if ( g_pParentWnd->GetWatchBSP()->HasBSPPlugin() ) {
+ g_BSPFrontendTable.m_pfnEndListen( 2 );
+ }
+ return;
+ }
}
static void saxCharacters(message_info_t *data, const xmlChar *ch, int len)
{
char saxMsgBuffer[4096];
va_list args;
-
+
va_start(args, msg);
vsprintf (saxMsgBuffer, msg, args);
va_end(args);
{
char saxMsgBuffer[4096];
va_list args;
-
+
va_start(args, msg);
vsprintf (saxMsgBuffer, msg, args);
va_end(args);
static void saxFatal(void *ctx, const char *msg, ...)
{
char buffer[4096];
-
+
va_list args;
-
+
va_start(args, msg);
vsprintf (buffer, msg, args);
va_end(args);
}
#endif
Sys_Printf("Setting up\n");
- Net_Setup();
- m_pListenSocket = Net_ListenSocket(39000);
+ if( !Net_Setup() )
+ return false;
+
+ m_pListenSocket = Net_ListenSocket(39000);
if (m_pListenSocket == NULL)
return false;
+
Sys_Printf("Listening...\n");
return true;
}
-void CWatchBSP::DoEBeginStep()
-{
- Reset();
- if (SetupListening() == false)
- {
- CString msg;
- msg = "Failed to get a listening socket on port 39000.\nTry running with BSP monitoring disabled if you can't fix this.\n";
- Sys_Printf (msg);
- gtk_MessageBox (g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR);
- return;
- }
- // set the timer for timeouts and step cancellation
- g_timer_reset( m_pTimer );
- g_timer_start( m_pTimer );
-
- if (!m_bBSPPlugin)
- {
- Sys_Printf("=== running BSP command ===\n%s\n", g_ptr_array_index( m_pCmd, m_iCurrentStep ) );
-
- if (!Q_Exec(NULL, (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep ), NULL, true ))
- {
- CString msg;
- msg = "Failed to execute the following command: ";
- msg += (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep );
- msg += "\nCheck that the file exists and that you don't run out of system resources.\n";
- Sys_Printf(msg);
- gtk_MessageBox(g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR );
- return;
- }
- // re-initialise the debug window
- if (m_iCurrentStep == 0)
- g_DbgDlg.Init();
- }
- m_eState = EBeginStep;
+void CWatchBSP::DoEBeginStep() {
+ Reset();
+ if ( !SetupListening() ) {
+ CString msg;
+ msg = "Failed to get a listening socket on port 39000.\nTry running with BSP monitoring disabled if you can't fix this.\n";
+ Sys_Printf( msg );
+ gtk_MessageBox( g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR );
+ return;
+ }
+ // set the timer for timeouts and step cancellation
+ g_timer_reset( m_pTimer );
+ g_timer_start( m_pTimer );
+
+ if ( !m_bBSPPlugin ) {
+ Sys_Printf( "=== running BSP command ===\n%s\n", g_ptr_array_index( m_pCmd, m_iCurrentStep ) );
+
+ if ( !Q_Exec( NULL, (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep ), NULL, true ) ) {
+ CString msg;
+ msg = "Failed to execute the following command: ";
+ msg += (char *)g_ptr_array_index( m_pCmd, m_iCurrentStep );
+ msg += "\nCheck that the file exists and that you don't run out of system resources.\n";
+ Sys_Printf( msg );
+ gtk_MessageBox( g_pParentWnd->m_pWidget, msg, "BSP monitoring", MB_OK | MB_ICONERROR );
+ return;
+ }
+ // re-initialise the debug window
+ if ( m_iCurrentStep == 0 ) {
+ g_DbgDlg.Init();
+ }
+ }
+ m_eState = EBeginStep;
}
void CWatchBSP::RoutineProcessing()
{
Sys_Printf("Connected.\n");
// prepare the message info struct for diving in
- memset (&m_message_info, 0, sizeof(message_info_s));
+ memset (&m_message_info, 0, sizeof(message_info_s));
// a dumb flag to make sure we init the push parser context when first getting a msg
m_bNeedCtxtInit = true;
m_eState = EWatching;
// build the command line
cmd = g_pGameDescription->mEnginePath.GetBuffer();
// this is game dependant
- //!\todo Read the engine binary name from a config file.
- if (g_pGameDescription->mGameFile == "wolf.game")
- {
- if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
- {
- // MP
-#if defined(WIN32)
- cmd += "WolfMP.exe";
-#elif defined(__linux__)
- cmd += "wolfmp";
-#elif defined(__APPLE__)
- cmd += "wolfmp.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- else
- {
- // SP
-#if defined(WIN32)
- cmd += "WolfSP.exe";
-#elif defined(__linux__)
- cmd += "wolfsp";
-#elif defined(__APPLE__)
- cmd += "wolfsp.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- } else if (g_pGameDescription->mGameFile == "et.game")
- {
-#if defined(WIN32)
- cmd += "et.exe";
-#elif defined(__linux__)
- cmd += "et";
-#elif defined(__APPLE__)
- cmd += "et.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- // RIANT
- // JK2 HACK
- else if (g_pGameDescription->mGameFile == "jk2.game")
- {
- if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
- {
- // MP
-#if defined(WIN32)
- cmd += "jk2MP.exe";
-#elif defined(__linux__)
- cmd += "jk2mp";
-#elif defined(__APPLE__)
- cmd += "jk2mp.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- else
- {
- // SP
-#if defined(WIN32)
- cmd += "jk2SP.exe";
-#elif defined(__linux__)
- cmd += "jk2sp";
-#elif defined(__APPLE__)
- cmd += "jk2sp.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- }
- // TTimo
- // JA HACK
- else if (g_pGameDescription->mGameFile == "ja.game")
- {
- if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
- {
- // MP
-#if defined(WIN32)
- cmd += "jamp.exe";
-#elif !defined(__linux__) && !defined(__APPLE__)
-#error "WTF are you compiling on"
-#endif
- }
- else
- {
- // SP
-#if defined(WIN32)
- cmd += "jasp.exe";
-#elif !defined(__linux__) && !defined(__APPLE__)
-#error "WTF are you compiling on"
-#endif
- }
- }
- // RIANT
- // STVEF HACK
- else if (g_pGameDescription->mGameFile == "stvef.game")
- {
- if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
- {
- // MP
-#if defined(WIN32)
- cmd += "stvoyHM.exe";
-#elif defined(__linux__)
- cmd += "stvoyHM";
-#elif defined(__APPLE__)
- cmd += "stvoyHM.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- else
- {
- // SP
-#if defined(WIN32)
- cmd += "stvoy.exe";
-#elif defined(__linux__)
- cmd += "stvoy";
-#elif defined(__APPLE__)
- cmd += "stvoy.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- }
- // RIANT
- // SOF2 HACK
- else if (g_pGameDescription->mGameFile == "sof2.game")
+ if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
{
- if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
- {
- // MP
-#if defined(WIN32)
- cmd += "sof2MP.exe";
-#elif defined(__linux__)
- cmd += "b00gus";
-#elif defined(__APPLE__)
- cmd += "sof2MP.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
- else
- {
- // SP
-#if defined(WIN32)
- cmd += "sof2.exe";
-#elif defined(__linux__)
- cmd += "b00gus";
-#elif defined(__APPLE__)
- cmd += "sof2.app";
-#else
-#error "WTF are you compiling on"
-#endif
- }
+ // MP
+ cmd += g_pGameDescription->mMultiplayerEngine.GetBuffer();
}
else
{
+ // SP
cmd += g_pGameDescription->mEngine.GetBuffer();
}
#ifdef _WIN32
// NOTE: we are using unix pathnames and CreateProcess doesn't like / in the program path
+ // FIXME: This isn't true anymore, doesn't it?
FindReplace( cmd, "/", "\\" );
#endif
Str cmdline;
- if ( (g_pGameDescription->mGameFile == "q2.game") || (g_pGameDescription->mGameFile == "heretic2.game") )
+ if ( g_pGameDescription->quake2 )
{
cmdline = ". +exec radiant.cfg +map ";
cmdline += m_sBSPName;
}
else
{
- // SP
+ // SP
cmdline += "+set nextmap \"spdevmap ";
cmdline += m_sBSPName;
cmdline += "\"";
{
Sys_Printf("WatchBSP got a monitoring request while not idling...\n");
// prompt the user, should we cancel the current process and go ahead?
- if (gtk_MessageBox(g_pParentWnd->m_pWidget, "I am already monitoring a BSP process.\nDo you want me to override and start a new compilation?",
+ if (gtk_MessageBox(g_pParentWnd->m_pWidget, "I am already monitoring a BSP process.\nDo you want me to override and start a new compilation?",
"BSP process monitoring", MB_YESNO ) == IDYES)
{
// disconnect and set EIdle state