示例#1
0
// manually connect to a server
void dlgMain::OnManualConnect(wxCommandEvent &event)
{
    wxString ted_result = _T("");
    wxTextEntryDialog ted(this, 
                            _T("Please enter IP Address and Port"), 
                            _T("Please enter IP Address and Port"),
                            _T("0.0.0.0:0"));
                            
    // show it
    ted.ShowModal();
    ted_result = ted.GetValue();
    
    wxString ped_result = _T("");
    wxPasswordEntryDialog ped(this, 
                            _T("Enter an optional password"), 
                            _T("Enter an optional password"),
                            _T(""));
                            
    ped.ShowModal();
    
    if (!ted_result.IsEmpty() && ted_result != _T("0.0.0.0:0"))
        LaunchGame(ted_result, 
                    launchercfg_s.odamex_directory, 
                    launchercfg_s.wad_paths,
                    ped.GetValue());
}
示例#2
0
// manually connect to a server
void dlgMain::OnManualConnect(wxCommandEvent &event)
{
    wxString ped_result;
    wxString ted_result;
    
    wxTextEntryDialog ted(this, wxT("Please enter IP Address and Port"), 
        wxT("Please enter IP Address and Port"), wxT("0.0.0.0:0"));

    wxPasswordEntryDialog ped(this, wxT("Enter an optional password"), 
        wxT("Enter an optional password"), wxT(""));

    // Keep asking for a valid ip/port number
    while (1)
    {
        if (ted.ShowModal() == wxID_CANCEL)
            return;
    
        ted_result = ted.GetValue();

        if (IsAddressValid(ted_result) == false)
        {
            wxMessageBox(wxT("Invalid IP address/Port number"));
            continue;
        }
        else
            break;
    }

    // Show password entry dialog
    if (ped.ShowModal() == wxID_CANCEL)
        return;
    
    LaunchGame(ted_result, launchercfg_s.odamex_directory, 
        launchercfg_s.wad_paths, ped.GetValue());
}
示例#3
0
// Launch button click
void dlgMain::OnLaunch(wxCommandEvent &event)
{
    wxString Password;
    wxString UsrPwHash;
    wxString SrvPwHash;
    wxInt32 i;
    
    i = GetSelectedServerArrayIndex();
    
    if (i == -1)
        return;

    // If the server is passworded, pop up a password entry dialog for them to
    // specify one before going any further
    SrvPwHash = QServer[i].Info.PasswordHash;

    if (SrvPwHash.IsEmpty() == false)
    {                           
        wxPasswordEntryDialog ped(this, wxT("Please enter a password"),
            wxT("This server is passworded"), wxT(""));
        
        SrvPwHash.MakeUpper();
        
        while (1)
        {          
            // Show the dialog box and get the resulting value
            ped.ShowModal();
        
            Password = ped.GetValue();
        
            // User possibly hit cancel or did not enter anything, just exit
            if (Password.IsEmpty())
                return;
            
            UsrPwHash = MD5SUM(Password);
            UsrPwHash.MakeUpper();
            
            // Do an MD5 comparison of the password with the servers one, if it
            // fails, keep asking the user to enter a valid password, otherwise 
            // dive out and connect to the server
            if (SrvPwHash != UsrPwHash)
            {
                wxMessageDialog Message(this, wxT("Incorrect password"), 
                    wxT("Incorrect password"), wxOK | wxICON_HAND);
                
                Message.ShowModal();
                
                // Reset the text so weird things don't happen
                ped.SetValue(wxT(""));
            }
            else
                break;
        }
    }
    
    LaunchGame(QServer[i].GetAddress(), launchercfg_s.odamex_directory,
        launchercfg_s.wad_paths, Password);
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
	switch(message) {
	case WM_CREATE:
		{ //LG
		g_hwndMain = hwnd;

		DWORD color = GetSysColor(COLOR_WINDOW);
		unsigned int c_r = 0, c_g = 0, c_b = 0;
		c_r = GetRValue(color);
		c_g = GetGValue(color);
		c_b = GetBValue(color);

		g_hbr = CreateSolidBrush(RGB(c_r-3, c_g-3, c_b-1));

		CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_INTERFACE), g_hwndMain, (DLGPROC)InterfaceProc);
		
		RECT rect;
		GetWindowRect(g_hwndInterface, &rect);
		AdjustWindowRect(&rect, g_dwWindowStyle, GetMenu(g_hwndMain) != NULL ? true : false);
		SetWindowPos(g_hwndMain, NULL, 0, 0, rect.right-rect.left, rect.bottom-rect.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREPOSITION);
		ShowWindow(g_hwndInterface, SW_SHOW);
		}
		return 0;

	case WM_COMMAND:
		switch(wParam) {
		case ID_HELP_ABOUT:
			{ //LG
				CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_ABOUT), g_hwndMain, (DLGPROC)AboutProc);
			}
			return 0;

		case ID_FILE_PLAYFF8:
			LaunchGame(g_lpCmdLine);
			return 0;
		case ID_FILE_EXIT:
			DestroyWindow(g_hwndMain);
		}
		break;

	case WM_DESTROY:
		DeleteObject(g_hbr);
		DestroyWindow(g_hwndInterface);

		PostQuitMessage(0);
		return 0;
	}
	return DefWindowProc(hwnd, message, wParam, lParam);
}
示例#5
0
void CLauncherWindow::BeforeNavigate(Framework::Win32::CWebBrowser::BEFORENAVIGATE_INFO* beforeNavigateInfo)
{
	const auto& navigateUrl = beforeNavigateInfo->navigateUrl;
	
	const int partSize = 256;
	TCHAR scheme[partSize];
	TCHAR hostName[partSize];
	TCHAR urlPath[partSize];

	URL_COMPONENTS components;
	memset(&components, 0, sizeof(URL_COMPONENTS));
	components.dwStructSize = sizeof(URL_COMPONENTS);
	components.lpszScheme		= scheme;
	components.dwSchemeLength	= partSize;
	components.lpszHostName		= hostName;
	components.dwHostNameLength	= partSize;
	components.lpszUrlPath		= urlPath;
	components.dwUrlPathLength	= partSize;

	BOOL result = InternetCrackUrl(navigateUrl.c_str(), 0, ICU_ESCAPE, &components);
	if(result == FALSE) return;

	if(_tcscmp(components.lpszScheme, _T("ffxiv"))) return;
	if(_tcscmp(components.lpszHostName, _T("login_success"))) return;

	auto parameters = GetUrlParameters(components.lpszUrlPath);

	auto sessionIdIterator = parameters.find(_T("sessionId"));
	if(sessionIdIterator != std::end(parameters))
	{
		auto sessionId = string_cast<std::string>(sessionIdIterator->second);
		try
		{
			LaunchGame(sessionId.c_str());
		}
		catch(const std::exception& except)
		{
			auto message = _T("Failed to launch game: ") + string_cast<std::tstring>(except.what());
			MessageBox(m_hWnd, message.c_str(), APP_NAME, MB_ICONERROR);
			LoadLoginPage();
			beforeNavigateInfo->cancel = true;
			return;
		}
	}
}
示例#6
0
void HelloWindow::MessageReceived(BMessage *message)
{ 
	char filename[512];
	//printf("recieved:%d\n",message);
	switch ( message->what )
	{			
		case	B_SIMPLE_DATA	:	{
									entry_ref ref;
									if( message->FindRef("refs", &ref) == B_OK )
										{
										strcpy (filename,"DynaMate - ");
										strcpy ((char *)filename+11,ref.name);
										SetTitle(filename);

										level[256]=255;
										load256(&ref,257,level);
										KillGame();
										KillTitle();
										LaunchGame();
										gameView->totalmoves=0; // added 981018
										}
									}
									break;
		case	LEVELCOMPLETE	:	{
									KillGame();
									uint16 temp=level[256]; //gamla rekordet
									if (totalmoves<level[256]){
										level[256]=totalmoves;
										saverec(level);
										level[256]=temp;
										}
									LaunchTitle();	
									}
									break;

   		case	LEVELABANDONED	:	{
									KillGame();
									LaunchTitle();
									}
									break;
 								
		default	:	BWindow::MessageReceived(message);
								break;
	}
}
示例#7
0
void HelloWindow::Zoom(BPoint punkt, float w, float h)
{
	if (SIZE==24){
		SIZE=16;
		ResizeTo(255,255);
	}else{
		ResizeTo(24*16-1,24*16-1);
		SIZE=24;
	}	

	if (gameView){
		KillGame();
		LaunchGame();		
	}else{
		KillTitle();
		LaunchTitle();
	}
}
示例#8
0
// Launch button click
void dlgMain::OnLaunch(wxCommandEvent &event)
{
    if (!m_LstCtrlServers->GetItemCount() || !m_LstCtrlServers->GetSelectedItemCount())
        return;
        
    wxInt32 i = m_LstCtrlServers->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
        
    wxListItem item;
    item.SetId(i);
    item.SetColumn(7);
    item.SetMask(wxLIST_MASK_TEXT);
        
    m_LstCtrlServers->GetItem(item);
        
    i = FindServer(item.GetText()); 

    wxPasswordEntryDialog ped(this, 
                            _T("Please enter a password"), 
                            _T("Server is passworded"),
                            _T(""));

    if (QServer[i].info.passworded)
    {                           
        ped.ShowModal();
        
        if (ped.GetValue().IsEmpty())
            return;
    }
    
    if (i > -1)
    {
        LaunchGame(QServer[i].GetAddress(), 
                    launchercfg_s.odamex_directory, 
                    launchercfg_s.wad_paths,
                    ped.GetValue());
    }
}
示例#9
0
// Quick-Launch button click
void dlgMain::OnQuickLaunch(wxCommandEvent &event)
{
	LaunchGame(_T(""), 
				launchercfg_s.odamex_directory, 
				launchercfg_s.wad_paths);
}
LRESULT CALLBACK InterfaceProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
	switch(message) {
	case WM_INITDIALOG:
		{ //LG
		g_hwndInterface = hwnd;

		memset(&g_config, 0, sizeof(g_config));
		g_config.fullscreen = TRUE;
		LoadConfig(g_config);

		//Populate controls
		HWND hwndDispMode = GetDlgItem(g_hwndInterface, IDC_DDDISPLAYMODE);
		for(UINT i = 0; i < displaymode_options_count; i++) {
			ComboBox_AddString(hwndDispMode, displaymode_options[i].name);
		}
		ComboBox_SetCurSel(hwndDispMode, g_config.displaymode);

		HWND hwndFSAA = GetDlgItem(g_hwndInterface, IDC_DDFSAA);
		for(UINT i = 0; i < fsaa_options_count; i++) {
			ComboBox_AddString(hwndFSAA, fsaa_options[i].name);
		}
		ComboBox_SetCurSel(hwndFSAA, g_config.fsaa);

		Button_SetCheck(GetDlgItem(g_hwndInterface, IDC_FULLSCREEN),
			(g_config.fullscreen ? BST_CHECKED : BST_UNCHECKED));

		Button_SetCheck(GetDlgItem(g_hwndInterface, IDC_8BITPFIX),
			(g_config.b8_paletted_textures_fix ? BST_CHECKED : BST_UNCHECKED));

		Button_SetCheck(GetDlgItem(g_hwndInterface, IDC_KEEP43AR),
			(!g_config.stretch_4_3_ar ? BST_CHECKED : BST_UNCHECKED));

		Button_SetCheck(GetDlgItem(g_hwndInterface, IDC_BLACKBARS),
			(g_config.eliminate_black_bars ? BST_CHECKED : BST_UNCHECKED));

		Button_SetCheck(GetDlgItem(g_hwndInterface, IDC_LFILTER),
			(g_config.force_texture_filtering ? BST_CHECKED : BST_UNCHECKED));

		Button_SetCheck(GetDlgItem(g_hwndInterface, IDC_ALPHA),
			(g_config.force_alpha_transparency ? BST_CHECKED : BST_UNCHECKED));

		Button_SetCheck(GetDlgItem(g_hwndInterface, IDC_EXPERTMODE),
			(g_config.expert_mode ? BST_CHECKED : BST_UNCHECKED));
		
		return true;
		}

	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDC_BTPLAY:
			LaunchGame(g_lpCmdLine);
			return TRUE;

		case IDC_DDDISPLAYMODE:
			g_config.displaymode = ComboBox_GetCurSel(GetDlgItem(g_hwndInterface, IDC_DDDISPLAYMODE));
			SaveConfig(g_config);
			return TRUE;

		case IDC_DDFSAA:
			g_config.fsaa = ComboBox_GetCurSel(GetDlgItem(g_hwndInterface, IDC_DDFSAA));
			SaveConfig(g_config);
			return TRUE;

		case IDC_FULLSCREEN:
			g_config.fullscreen = Button_GetCheck(GetDlgItem(g_hwndInterface, IDC_FULLSCREEN)) == BST_CHECKED;
			SaveConfig(g_config);
			return TRUE;

		case IDC_8BITPFIX:
			g_config.b8_paletted_textures_fix = Button_GetCheck(GetDlgItem(g_hwndInterface, IDC_8BITPFIX)) == BST_CHECKED;
			SaveConfig(g_config);
			return TRUE;

		case IDC_KEEP43AR:
			g_config.stretch_4_3_ar = Button_GetCheck(GetDlgItem(g_hwndInterface, IDC_KEEP43AR)) != BST_CHECKED;
			SaveConfig(g_config);
			return TRUE;

		case IDC_BLACKBARS:
			g_config.eliminate_black_bars = Button_GetCheck(GetDlgItem(g_hwndInterface, IDC_BLACKBARS)) == BST_CHECKED;
			SaveConfig(g_config);
			return TRUE;

		case IDC_LFILTER:
			g_config.force_texture_filtering = Button_GetCheck(GetDlgItem(g_hwndInterface, IDC_LFILTER)) == BST_CHECKED;
			SaveConfig(g_config);
			return TRUE;

		case IDC_ALPHA:
			g_config.force_alpha_transparency = Button_GetCheck(GetDlgItem(g_hwndInterface, IDC_ALPHA)) == BST_CHECKED;
			SaveConfig(g_config);
			return TRUE;

		case IDC_EXPERTMODE:
			g_config.expert_mode = Button_GetCheck(GetDlgItem(g_hwndInterface, IDC_EXPERTMODE)) == BST_CHECKED;
			SaveConfig(g_config);
			return TRUE;
		}


	//Sets background of child dialog boxes to transparent
	/*case WM_CTLCOLORDLG:
		{
		HDC hDC = (HDC)wParam;
		SetBkMode(hDC, TRANSPARENT);
		}
		return (INT_PTR)GetStockObject(HOLLOW_BRUSH);

	case WM_CTLCOLORBTN:
		return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);

	case WM_CTLCOLOREDIT:
		return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);

	case WM_CTLCOLORSTATIC:
		{
		HDC hDC = (HDC)wParam;
		SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
		SetBkMode(hDC, TRANSPARENT);
		}
		return (INT_PTR)g_hbr;
	*/
	}

	return FALSE;
}
示例#11
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;
}
示例#12
0
void LaunchTwoPlayerGame()
{
	LaunchGame(TwoPlayerApp);
}
示例#13
0
void LaunchOnePlayerGame()
{
	LaunchGame(OnePlayerApp);
}