dd_bool DD_Unix_Init(void) { dd_bool failed = true; memset(&app, 0, sizeof(app)); // We wish to use U.S. English formatting for time and numbers. setlocale(LC_ALL, "en_US.UTF-8"); DD_InitCommandLine(); Library_Init(); // Determine our basedir and other global paths. determineGlobalPaths(&app); if(!DD_EarlyInit()) { Sys_MessageBox(MBT_ERROR, DOOMSDAY_NICENAME, "Error during early init.", 0); } #ifdef __CLIENT__ else if(!initDGL()) { Sys_MessageBox(MBT_ERROR, DOOMSDAY_NICENAME, "Error initializing DGL.", 0); } #endif else { // Everything okay so far. failed = false; } return !failed; }
//----------------------------------------------------------------------------- // Purpose: Handles there being an error setting up the video mode // Output : Returns true on if the engine should restart, false if it should quit //----------------------------------------------------------------------------- InitReturnVal_t CEngineAPI::HandleSetModeError() { // show an error, see if the user wants to restart if ( CommandLine()->FindParm( "-safe" ) ) { Sys_MessageBox( "Failed to set video mode.\n\nThis game has a minimum requirement of DirectX 7.0 compatible hardware.\n", "Video mode error", false ); return INIT_FAILED; } if ( CommandLine()->FindParm( "-autoconfig" ) ) { if ( Sys_MessageBox( "Failed to set video mode - falling back to safe mode settings.\n\nGame will now restart with the new video settings.", "Video - safe mode fallback", true )) { CommandLine()->AppendParm( "-safe", NULL ); return (InitReturnVal_t)INIT_RESTART; } return INIT_FAILED; } if ( Sys_MessageBox( "Failed to set video mode - resetting to defaults.\n\nGame will now restart with the new video settings.", "Video mode warning", true ) ) { CommandLine()->AppendParm( "-autoconfig", NULL ); return (InitReturnVal_t)INIT_RESTART; } return INIT_FAILED; }
//----------------------------------------------------------------------------- // BugReporter_GetInterfaces // //----------------------------------------------------------------------------- bool BugReporter_GetInterfaces() { if ( !g_bug_pReporter1 ) { g_bug_pReporter1 = BugReporter_LoadDLL( BUG_REPORTER_DLLNAME_1, &g_bug_hBugReporter1 ); if ( !g_bug_pReporter1 ) { Sys_MessageBox( BUG_ERRORTITLE, "PVCS intialization failed!\n" ); } } if ( !g_bug_pReporter2 ) { g_bug_pReporter2 = BugReporter_LoadDLL( BUG_REPORTER_DLLNAME_2, &g_bug_hBugReporter2 ); if ( !g_bug_pReporter2 ) { Sys_MessageBox( BUG_ERRORTITLE, "BugBait intialization failed!\n" ); } } if ( g_bug_pReporter1 ) { // determine submitter name ConsoleWindowPrintf( BUG_COLOR, "Bug Reporter: PVCS Username: '******' Display As: '%s'\n", g_bug_pReporter1->GetUserName(), g_bug_pReporter1->GetUserName_Display() ); } if ( g_bug_pReporter2 ) { // determine submitter name ConsoleWindowPrintf( BUG_COLOR, "Bug Reporter: BugBait Username: '******' Display As: '%s'\n", g_bug_pReporter2->GetUserName(), g_bug_pReporter2->GetUserName_Display() ); } BugReporter_SelectReporter( NULL ); // See if we can see the bug repository right now char fn[MAX_PATH]; V_snprintf( fn, sizeof( fn ), "%s/%s", GetRepositoryURL(), REPOSITORY_VALIDATION_FILE ); Sys_NormalizePath( fn, false ); FILE *fp = fopen( fn, "rb" ); if ( fp ) { ConsoleWindowPrintf( BUG_COLOR, "PVCS Repository '%s'\n", GetRepositoryURL() ); fclose( fp ); } else { Sys_MessageBox( BUG_ERRORTITLE, "Unable to see '%s', check permissions and network connectivity.\n", fn ); return false; } // success return true; }
//----------------------------------------------------------------------------- // BugReporter_LoadDLL // //----------------------------------------------------------------------------- IBugReporter *BugReporter_LoadDLL( const char *pDLLName, HMODULE *phModule ) { HMODULE hModule; IBugReporter *pBugReporter; *phModule = NULL; hModule = LoadLibrary( pDLLName ); if ( !hModule ) { Sys_MessageBox( BUG_ERRORTITLE, "Could not open '%s'\n", pDLLName ); return NULL; } FARPROC pCreateInterface = GetProcAddress( hModule, CREATEINTERFACE_PROCNAME ); if ( !pCreateInterface ) { Sys_MessageBox( BUG_ERRORTITLE, "Missing '%s' interface for '%s'\n", CREATEINTERFACE_PROCNAME, pDLLName ); return NULL; } pBugReporter = (IBugReporter *)((CreateInterfaceFn)pCreateInterface)( INTERFACEVERSION_BUGREPORTER, NULL ); if ( !pBugReporter ) { Sys_MessageBox( BUG_ERRORTITLE, "Missing interface '%s' for '%s'\n", INTERFACEVERSION_BUGREPORTER, pDLLName ); return NULL; } bool bSuccess = pBugReporter->Init( NULL ); if ( !bSuccess ) { return NULL; } *phModule = hModule; return pBugReporter; }
//----------------------------------------------------------------------------- // ConfigDlg_Ping // //----------------------------------------------------------------------------- BOOL ConfigDlg_Ping( HWND hwnd ) { char xboxName[MAX_XBOXNAMELEN]; BOOL canConnect; char* args[1]; xboxName[0] = '\0'; GetDlgItemText( hwnd, IDC_CONFIG_XBOXNAME, xboxName, MAX_XBOXNAMELEN ); // ignore ping to current connection if ( !stricmp( g_xboxName, xboxName ) ) { if ( g_connectedToXBox ) { Sys_MessageBox( "Ping", "Already Connected To: '%s'", xboxName ); return true; } } // terminate any current connection lc_disconnect( 0, NULL ); // trial connect args[0] = xboxName; canConnect = lc_connect( 1, args ); if ( !canConnect ) Sys_MessageBox( "Ping FAILURE", "Could Not Connect To: %s", xboxName ); else Sys_MessageBox( "Ping SUCCESS", "Connection Valid To: %s", g_xboxName ); if ( canConnect ) lc_disconnect( 0, NULL ); return canConnect; }
static int showCriticalMessage(const char* msg) { Sys_MessageBox(MBT_WARNING, DOOMSDAY_NICENAME, msg, 0); return 0; #if 0 #ifdef WIN32 #ifdef UNICODE wchar_t buf[256]; #else char buf[256]; #endif int ret; Window *wnd = Window::main(); DENG_ASSERT(wnd != 0); HWND hWnd = (HWND) wnd->nativeHandle(); if(!hWnd) { DD_Win32_SuspendMessagePump(true); MessageBox(HWND_DESKTOP, TEXT("Sys_CriticalMessage: Main window not available."), NULL, MB_ICONERROR | MB_OK); DD_Win32_SuspendMessagePump(false); return false; } ShowCursor(TRUE); ShowCursor(TRUE); DD_Win32_SuspendMessagePump(true); GetWindowText(hWnd, buf, 255); ret = (MessageBox(hWnd, WIN_STRING(msg), buf, MB_OK | MB_ICONEXCLAMATION) == IDYES); DD_Win32_SuspendMessagePump(false); ShowCursor(FALSE); ShowCursor(FALSE); return ret; #else fprintf(stderr, "--- %s\n", msg); return 0; #endif #endif }
//----------------------------------------------------------------------------- // ExcludePathsDlg_SaveChanges // //----------------------------------------------------------------------------- void ExcludePathsDlg_SaveChanges( HWND hWnd ) { g_ExcludePaths.Purge(); HWND hWndTree = GetDlgItem( hWnd, IDC_PATHS_TREE ); ExcludePathsDlg_BuildExcludeList_r( hWndTree, TreeView_GetRoot( hWndTree ), 0, "" ); char szPath[MAX_PATH]; V_ComposeFileName( g_localPath, EXCLUDEPATHS_FILE, szPath, sizeof( szPath ) ); if ( !g_ExcludePaths.Count() ) { // no exclude paths unlink( szPath ); } else { FILE *fp = fopen( szPath, "wt" ); if ( !fp ) { Sys_MessageBox( "Error", "Could not open '%s' for writing\n", szPath ); return; } fprintf( fp, "// Auto-Generated by VXConsole - DO NOT MODIFY!\n" ); for ( int i = 0; i < g_ExcludePaths.Count(); i++ ) { // strip expected root path const char *pPath = g_ExcludePaths[i].String(); pPath += strlen( ROOT_NAME ); if ( !pPath[0] ) { // special code for root fprintf( fp, "*\n" ); break; } fprintf( fp, "\"\\%s\"\n", pPath ); } fclose( fp ); } }
//----------------------------------------------------------------------------- // NotImplementedYet // //----------------------------------------------------------------------------- void NotImplementedYet() { Sys_MessageBox( "Attention!", "Sorry, Not Implemented Yet." ); }
//----------------------------------------------------------------------------- // BugDlg_Submit // //----------------------------------------------------------------------------- bool BugDlg_Submit( HWND hWnd ) { char title[1024]; char miscInfo[1024]; char basename[MAX_PATH]; char filename[MAX_PATH]; char positionName[MAX_PATH]; char orientationName[MAX_PATH]; char buildName[MAX_PATH]; char mapName[MAX_PATH]; bool bSuccess = false; sprintf( positionName, "%f %f %f", g_bug_mapInfo.position[0], g_bug_mapInfo.position[1], g_bug_mapInfo.position[2] ); SetDlgItemText( g_bug_hWnd, IDC_BUG_POSITION_LABEL, positionName ); sprintf( orientationName, "%f %f %f", g_bug_mapInfo.angle[0], g_bug_mapInfo.angle[1], g_bug_mapInfo.angle[2] ); SetDlgItemText( g_bug_hWnd, IDC_BUG_ORIENTATION_LABEL, orientationName ); sprintf( buildName, "%d", g_bug_mapInfo.build ); SetDlgItemText( g_bug_hWnd, IDC_BUG_BUILD_LABEL, buildName ); V_FileBase( g_bug_mapInfo.mapPath, mapName, sizeof( mapName ) ); char *pExtension = V_stristr( mapName, ".bsp" ); if ( pExtension ) { *pExtension = '\0'; } pExtension = V_stristr( mapName, ".360" ); if ( pExtension ) { *pExtension = '\0'; } V_snprintf( miscInfo, sizeof( miscInfo ), "skill %d", g_bug_mapInfo.skill ); // Stuff bug data files up to server g_bug_pReporter->StartNewBugReport(); g_bug_pReporter->SetOwner( g_bug_pReporter->GetUserNameForDisplayName( g_bug_szOwner ) ); g_bug_pReporter->SetSubmitter( NULL ); if ( mapName[0] ) V_snprintf( title, sizeof( title ), "%s: %s", mapName, g_bug_szTitle ); else V_snprintf( title, sizeof( title ), "%s", g_bug_szTitle ); g_bug_pReporter->SetTitle( title ); g_bug_pReporter->SetDescription( g_bug_szDescription ); g_bug_pReporter->SetLevel( mapName ); g_bug_pReporter->SetPosition( positionName ); g_bug_pReporter->SetOrientation( orientationName ); g_bug_pReporter->SetBuildNumber( buildName ); g_bug_pReporter->SetSeverity( g_bug_szSeverity ); g_bug_pReporter->SetPriority( g_bug_szPriority ); g_bug_pReporter->SetArea( g_bug_szArea ); g_bug_pReporter->SetMapNumber( g_bug_szMapNumber ); g_bug_pReporter->SetReportType( g_bug_szReportType ); g_bug_pReporter->SetMiscInfo( miscInfo ); g_bug_pReporter->SetDriverInfo( "" ); g_bug_pReporter->SetExeName( "" ); g_bug_pReporter->SetGameDirectory( "" ); g_bug_pReporter->SetRAM( 0 ); g_bug_pReporter->SetCPU( 0 ); g_bug_pReporter->SetProcessor( "" ); g_bug_pReporter->SetDXVersion( 0, 0, 0, 0 ); g_bug_pReporter->SetOSVersion( "" ); g_bug_pReporter->ResetIncludedFiles(); g_bug_pReporter->SetZipAttachmentName( "" ); if ( g_bug_szScreenshot[0] ) { if ( g_bug_bCompressScreenshot ) { BugDlg_CompressScreenshot(); } // strip the fully qualified path into filename only Sys_StripPath( g_bug_szScreenshot, basename, sizeof( basename ) ); V_snprintf( filename, sizeof( filename ), "%s/BugId/%s", GetRepositoryURL(), basename ); Sys_NormalizePath( filename, false ); g_bug_pReporter->SetScreenShot( filename ); } if ( g_bug_szSavegame[0] ) { // strip the fully qualified path into filename only Sys_StripPath( g_bug_szSavegame, basename, sizeof( basename ) ); V_snprintf( filename, sizeof( filename ), "%s/BugId/%s", GetRepositoryURL(), basename ); Sys_NormalizePath( filename, false ); g_bug_pReporter->SetSaveGame( filename ); } if ( g_bug_szBSPName[0] ) { // strip the fully qualified path into filename only Sys_StripPath( g_bug_szBSPName, basename, sizeof( basename ) ); V_snprintf( filename, sizeof( filename ), "%s/BugId/%s", GetRepositoryURL(), basename ); Sys_NormalizePath( filename, false ); g_bug_pReporter->SetBSPName( filename ); } int bugID = -1; bSuccess = g_bug_pReporter->CommitBugReport( bugID ); if ( bSuccess ) { if ( !BugDlg_UploadBugSubmission( bugID, g_bug_szSavegame, g_bug_szScreenshot, g_bug_szBSPName, NULL ) ) { Sys_MessageBox( BUG_ERRORTITLE, "Unable to upload files to bug repository!\n" ); bSuccess = false; } } else { Sys_MessageBox( BUG_ERRORTITLE, "Unable to post bug report to database!\n" ); } if ( bSuccess ) { if ( g_Games[g_bug_GameType].bUsesSystem1 ) { ConsoleWindowPrintf( BUG_COLOR, "Bug Reporter: PVCS submission succeeded for bug! (%d)\n", bugID ); } else { ConsoleWindowPrintf( BUG_COLOR, "Bug Reporter: BugBait submission succeeded for bug!\n" ); } } else { ConsoleWindowPrintf( XBX_CLR_RED, "Bug Reporter: Submission failed\n" ); } return bSuccess; }