Example #1
0
//
// Process next BrowseToSolution
//
void SharedUtil::ProcessPendingBrowseToSolution ( void )
{
    SString strType, strMessageBoxMessage;
    int bAskQuestion;

    // Get args from the registry
    CArgMap argMap;
    argMap.SetFromString ( GetApplicationSetting ( "pending-browse-to-solution" ) );
    argMap.Get ( "type", strType );
    argMap.Get ( "message", strMessageBoxMessage );
    argMap.Get ( "bAskQuestion", bAskQuestion );

    // Check if anything to do
    if ( strType.empty () )
        return;

    ClearPendingBrowseToSolution ();

    // Show message box if required
    if ( !strMessageBoxMessage.empty () )
        MessageBox ( 0, strMessageBoxMessage, "Error", MB_OK|MB_ICONEXCLAMATION );

    // Ask question if required, and then launch URL
    if ( !bAskQuestion || IDYES == MessageBox( 0, "Do you want to see some on-line help about this problem ?", "MTA: San Andreas", MB_ICONQUESTION|MB_YESNO ) )
    {
        SString strQueryURL = GetApplicationSetting ( "trouble-url" );
        if ( strQueryURL == "" )
            strQueryURL = TROUBLE_URL1;
        strQueryURL = strQueryURL.Replace ( "%VERSION%", GetApplicationSetting ( "mta-version-ext" ) );
        strQueryURL = strQueryURL.Replace ( "%ID%", GetApplicationSetting ( "serial" ) );
        strQueryURL = strQueryURL.Replace ( "%TROUBLE%", strType );
        ShellExecuteNonBlocking ( "open", strQueryURL.c_str () );
    }
}
Example #2
0
int DoWinMain ( HINSTANCE hLauncherInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
    AddUtf8FileHooks();

#if defined(_DEBUG) 
    SharedUtil_Tests ();
#endif

    //
    // Init
    //

    // Let install manager figure out what MTASA path to use
    GetInstallManager()->SetMTASAPathSource( lpCmdLine );

    // Start logging.....now
    BeginEventLog();

    // Start localization if possible
    InitLocalization( false );

    // Handle commands from the installer
    HandleSpecialLaunchOptions();

    // Check MTA is launched only once
    HandleDuplicateLaunching();

    // Show logo
    ShowSplash( g_hInstance );

    // Other init stuff
    ClearPendingBrowseToSolution();


    //
    // Update
    //

    // Continue any update procedure
    SString strCmdLine = GetInstallManager()->Continue();


    //
    // Launch
    //

    // Ensure localization is started
    InitLocalization( true );

    // Setup/test various counters and flags for monitoring problems
    PreLaunchWatchDogs();

    // Stuff
    HandleCustomStartMessage();
    ForbodenProgramsMessage();
    CycleEventLog();
    BsodDetectionPreLaunch();
    MaybeShowCopySettingsDialog ();

    // Make sure GTA is not running
    HandleIfGTAIsAlreadyRunning();

    // Find GTA path to use
    ValidateGTAPath();

    // Maybe warn user if no anti-virus running
    CheckAntiVirusStatus();

    // Ensure logo is showing
    ShowSplash( g_hInstance );

    // Check MTA files look good
    CheckDataFiles();
    CheckLibVersions();

    // Go for launch
    int iReturnCode = LaunchGame( strCmdLine );

    PostRunWatchDogs( iReturnCode );

    //
    // Quit
    //

    HandleOnQuitCommand();

    // Maybe show help if trouble was encountered
    ProcessPendingBrowseToSolution();

    AddReportLog ( 1044, SString ( "* End (0x%X)* pid:%d", iReturnCode, GetCurrentProcessId() ) );

    RemoveUtf8FileHooks();
    return iReturnCode;
}