1.1 --- a/tools/installer/SelectGame.cpp Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,169 +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 -
1.14 -void UpdateGameListBox(HWND hDlg, game_list_t *gl)
1.15 -{
1.16 - HWND lbox = GetDlgItem(hDlg, IDC_SELGAME_LIST);
1.17 -
1.18 - SendMessage(lbox, LB_RESETCONTENT, 0, 0);
1.19 -
1.20 - for (unsigned int i = 0; i < gl->game_count; i++)
1.21 - {
1.22 - LRESULT res = SendMessage(lbox,
1.23 - LB_ADDSTRING,
1.24 - 0,
1.25 - (LPARAM)g_games.game_list[gl->games[i]].name);
1.26 -
1.27 - if (res == LB_ERR || res == LB_ERRSPACE)
1.28 - {
1.29 - continue;
1.30 - }
1.31 -
1.32 - SendMessage(lbox, LB_SETITEMDATA, i, gl->games[i]);
1.33 - }
1.34 -
1.35 - UpdateWindow(lbox);
1.36 -}
1.37 -
1.38 -#include "windowsx.h"
1.39 -
1.40 -INT_PTR CALLBACK ChooseGameHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
1.41 -{
1.42 - switch (message)
1.43 - {
1.44 - case WM_INITDIALOG:
1.45 - {
1.46 - HWND cbox = GetDlgItem(hDlg, IDC_SELGROUP_ACCOUNT);
1.47 - SendMessage(cbox, CB_RESETCONTENT, 0, 0);
1.48 - for (unsigned int i = 0; i < g_game_group->list_count; i++)
1.49 - {
1.50 - LRESULT res = SendMessage(cbox,
1.51 - CB_ADDSTRING,
1.52 - 0,
1.53 - (LPARAM)g_game_group->lists[i]->root_name);
1.54 - if (res == CB_ERR || res == CB_ERRSPACE)
1.55 - {
1.56 - continue;
1.57 - }
1.58 - SendMessage(cbox, CB_SETITEMDATA, i, (LPARAM)g_game_group->lists[i]);
1.59 - }
1.60 - SendMessage(cbox, CB_SETCURSEL, 0, 0);
1.61 - UpdateWindow(cbox);
1.62 - UpdateGameListBox(hDlg, g_game_group->lists[0]);
1.63 -
1.64 - SetToGlobalPosition(hDlg);
1.65 -
1.66 - return (INT_PTR)TRUE;
1.67 - }
1.68 - case WM_COMMAND:
1.69 - {
1.70 - if (LOWORD(wParam) == ID_SELGAME_EXIT
1.71 - || LOWORD(wParam) == ID_CLOSE)
1.72 - {
1.73 - return AskToExit(hDlg);
1.74 - }
1.75 - else if (LOWORD(wParam) == ID_SELGAME_BACK)
1.76 - {
1.77 - UpdateGlobalPosition(hDlg);
1.78 - EndDialog(hDlg, (INT_PTR)DisplayChooseMethod);
1.79 - return (INT_PTR)TRUE;
1.80 - }
1.81 - else if (LOWORD(wParam) == IDC_SELGROUP_ACCOUNT)
1.82 - {
1.83 - if (HIWORD(wParam) == CBN_SELCHANGE)
1.84 - {
1.85 - HWND cbox = (HWND)lParam;
1.86 - LRESULT cursel = SendMessage(cbox, CB_GETCURSEL, 0, 0);
1.87 -
1.88 - if (cursel == LB_ERR)
1.89 - {
1.90 - break;
1.91 - }
1.92 -
1.93 - LRESULT data = SendMessage(cbox, CB_GETITEMDATA, cursel, 0);
1.94 - if (data == CB_ERR)
1.95 - {
1.96 - break;
1.97 - }
1.98 -
1.99 - game_list_t *gl = (game_list_t *)data;
1.100 - UpdateGameListBox(hDlg, gl);
1.101 - }
1.102 - break;
1.103 - }
1.104 - else if (LOWORD(wParam) == IDC_SELGAME_LIST)
1.105 - {
1.106 - if (HIWORD(wParam) == LBN_SELCHANGE)
1.107 - {
1.108 - HWND lbox = (HWND)lParam;
1.109 - LRESULT cursel = SendMessage(lbox, LB_GETCURSEL, 0, 0);
1.110 -
1.111 - selected_game_index = -1;
1.112 -
1.113 - if (cursel == LB_ERR)
1.114 - {
1.115 - break;
1.116 - }
1.117 -
1.118 - LRESULT item = SendMessage(lbox, LB_GETITEMDATA, cursel, 0);
1.119 - if (item == LB_ERR)
1.120 - {
1.121 - break;
1.122 - }
1.123 -
1.124 - selected_game_index = (int)item;
1.125 -
1.126 - HWND button = GetDlgItem(hDlg, ID_SELGAME_NEXT);
1.127 - EnableWindow(button, TRUE);
1.128 - }
1.129 - }
1.130 - else if (LOWORD(wParam) == ID_SELGAME_NEXT)
1.131 - {
1.132 - if (selected_game_index == -1)
1.133 - {
1.134 - break;
1.135 - }
1.136 -
1.137 - g_LocalCopier.SetOutputPath(g_games.game_list[selected_game_index].game_path);
1.138 - SetInstallMethod(&g_LocalCopier);
1.139 -
1.140 - UpdateGlobalPosition(hDlg);
1.141 - EndDialog(hDlg, (INT_PTR)DisplayPerformInstall);
1.142 -
1.143 - return (INT_PTR)TRUE;
1.144 - }
1.145 - break;
1.146 - }
1.147 - case WM_DESTROY:
1.148 - {
1.149 - ReleaseGameDB();
1.150 - break;
1.151 - }
1.152 - }
1.153 -
1.154 - return (INT_PTR)FALSE;
1.155 -}
1.156 -
1.157 -void *DisplaySelectGame(HWND hWnd)
1.158 -{
1.159 - INT_PTR val;
1.160 -
1.161 - if ((val = DialogBox(
1.162 - g_hInstance,
1.163 - MAKEINTRESOURCE(IDD_SELECT_GAME),
1.164 - hWnd,
1.165 - ChooseGameHandler)) == -1)
1.166 - {
1.167 - return NULL;
1.168 - }
1.169 -
1.170 - return (void *)val;
1.171 -}
1.172 -