tools/installer/SelectGame.cpp
branchsourcemod-1.1.0
changeset 2283 03a67e41afbc
parent 1951 c7b4237fff50
child 2287 017a725c9d17
     1.1 --- a/tools/installer/SelectGame.cpp	Fri Mar 28 06:21:34 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,138 +0,0 @@
     1.4 -#include "InstallerMain.h"
     1.5 -#include "InstallerUtil.h"
     1.6 -#include "SelectGame.h"
     1.7 -#include "GamesList.h"
     1.8 -#include "ChooseMethod.h"
     1.9 -#include "PerformInstall.h"
    1.10 -#include "LocalCopyMethod.h"
    1.11 -
    1.12 -int selected_game_index = -1;
    1.13 -mod_info_t **game_sel_list = NULL;
    1.14 -unsigned int game_sel_count = 0;
    1.15 -
    1.16 -void AppendSelectableGame(mod_info_t *mod)
    1.17 -{
    1.18 -	if (game_sel_list == NULL)
    1.19 -	{
    1.20 -		game_sel_list = 
    1.21 -			(mod_info_t **)malloc(sizeof(mod_info_t *) * (game_sel_count + 1));
    1.22 -	}
    1.23 -	else
    1.24 -	{
    1.25 -		game_sel_list = 
    1.26 -			(mod_info_t **)realloc(game_sel_list, 
    1.27 -			sizeof(mod_info_t *) * (game_sel_count + 1));
    1.28 -	}
    1.29 -
    1.30 -	game_sel_list[game_sel_count++] = mod;
    1.31 -}
    1.32 -
    1.33 -INT_PTR CALLBACK ChooseGameHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    1.34 -{
    1.35 -	switch (message)
    1.36 -	{
    1.37 -	case WM_INITDIALOG:
    1.38 -		{
    1.39 -			HWND lbox = GetDlgItem(hDlg, IDC_SELGAME_LIST);
    1.40 -
    1.41 -			for (unsigned int i = 0; i < g_mod_count; i++)
    1.42 -			{
    1.43 -				LRESULT res = SendMessage(lbox,
    1.44 -					LB_ADDSTRING,
    1.45 -					0,
    1.46 -					(LPARAM)g_mod_list[i].name);
    1.47 -
    1.48 -				if (res == LB_ERR || res == LB_ERRSPACE)
    1.49 -				{
    1.50 -					continue;
    1.51 -				}
    1.52 -
    1.53 -				AppendSelectableGame(&g_mod_list[i]);
    1.54 -			}
    1.55 -
    1.56 -			UpdateWindow(lbox);
    1.57 -			
    1.58 -			return (INT_PTR)TRUE;
    1.59 -		}
    1.60 -	case WM_COMMAND:
    1.61 -		{
    1.62 -			if (LOWORD(wParam) == ID_SELGAME_EXIT
    1.63 -				|| LOWORD(wParam) == ID_CLOSE)
    1.64 -			{
    1.65 -				return AskToExit(hDlg);
    1.66 -			}
    1.67 -			else if (LOWORD(wParam) == ID_SELGAME_BACK)
    1.68 -			{
    1.69 -				EndDialog(hDlg, (INT_PTR)DisplayChooseMethod);
    1.70 -				return (INT_PTR)TRUE;
    1.71 -			}
    1.72 -			else if (LOWORD(wParam) == IDC_SELGAME_LIST)
    1.73 -			{
    1.74 -				if (HIWORD(wParam) == LBN_SELCHANGE)
    1.75 -				{
    1.76 -					HWND lbox = (HWND)lParam;
    1.77 -					LRESULT cursel = SendMessage(lbox, LB_GETCURSEL, 0, 0);
    1.78 -
    1.79 -					selected_game_index = -1;
    1.80 -
    1.81 -					if (cursel == LB_ERR)
    1.82 -					{
    1.83 -						break;
    1.84 -					}
    1.85 -
    1.86 -					if (cursel >= (LRESULT)g_mod_count)
    1.87 -					{
    1.88 -						break;
    1.89 -					}
    1.90 -
    1.91 -					selected_game_index = (int)cursel;
    1.92 -
    1.93 -					HWND button = GetDlgItem(hDlg, ID_SELGAME_NEXT);
    1.94 -					EnableWindow(button, TRUE);
    1.95 -				}
    1.96 -			}
    1.97 -			else if (LOWORD(wParam) == ID_SELGAME_NEXT)
    1.98 -			{
    1.99 -				if (selected_game_index == -1)
   1.100 -				{
   1.101 -					break;
   1.102 -				}
   1.103 -
   1.104 -				g_LocalCopier.SetOutputPath(game_sel_list[selected_game_index]->mod_path);
   1.105 -				SetInstallMethod(&g_LocalCopier);
   1.106 -
   1.107 -				EndDialog(hDlg, (INT_PTR)DisplayPerformInstall);
   1.108 -
   1.109 -				return (INT_PTR)TRUE;
   1.110 -			}
   1.111 -			break;
   1.112 -		}
   1.113 -	case WM_DESTROY:
   1.114 -		{
   1.115 -			ReleaseGamesList();
   1.116 -			free(game_sel_list);
   1.117 -			game_sel_list = NULL;
   1.118 -			game_sel_count = 0;
   1.119 -			break;
   1.120 -		}
   1.121 -	}
   1.122 -
   1.123 -	return (INT_PTR)FALSE;
   1.124 -}
   1.125 -
   1.126 -void *DisplaySelectGame(HWND hWnd)
   1.127 -{
   1.128 -	INT_PTR val;
   1.129 -	
   1.130 -	if ((val = DialogBox(
   1.131 -		g_hInstance, 
   1.132 -		MAKEINTRESOURCE(IDD_SELECT_GAME),
   1.133 -		hWnd,
   1.134 -		ChooseGameHandler)) == -1)
   1.135 -	{
   1.136 -		return NULL;
   1.137 -	}
   1.138 -
   1.139 -	return (void *)val;
   1.140 -}
   1.141 -