Removed unused files.
authorDavid Anderson <dvander@alliedmods.net>
Fri Oct 02 03:30:54 2009 -0700 (2009-10-02)
changeset 28131c1d433398d6
parent 2812 06bf8212ca46
child 2814 6016b23d2b4c
Removed unused files.
tools/installer/CCriticalSection.h
tools/installer/CFileList.cpp
tools/installer/CFileList.h
tools/installer/ChooseMethod.cpp
tools/installer/ChooseMethod.h
tools/installer/GamesList.cpp
tools/installer/GamesList.h
tools/installer/ICopyMethod.h
tools/installer/InstallerMain.cpp
tools/installer/InstallerMain.h
tools/installer/InstallerUtil.cpp
tools/installer/InstallerUtil.h
tools/installer/LocalCopyMethod.cpp
tools/installer/LocalCopyMethod.h
tools/installer/PerformInstall.cpp
tools/installer/PerformInstall.h
tools/installer/Resource.h
tools/installer/SelectGame.cpp
tools/installer/SelectGame.h
tools/installer/Welcome.cpp
tools/installer/Welcome.h
tools/installer/installer.ico
tools/installer/installer.rc
tools/installer/installer.sln
tools/installer/installer.vcproj
tools/installer/platform_headers.h
     1.1 --- a/tools/installer/CCriticalSection.h	Fri Oct 02 02:35:25 2009 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,37 +0,0 @@
     1.4 -#ifndef _INCLUDE_INSTALLER_CRIT_SECT_H_
     1.5 -#define _INCLUDE_INSTALLER_CRIT_SECT_H_
     1.6 -
     1.7 -#include "platform_headers.h"
     1.8 -
     1.9 -class CCriticalSection
    1.10 -{
    1.11 -public:
    1.12 -	CCriticalSection()
    1.13 -	{
    1.14 -		InitializeCriticalSection(&m_crit);
    1.15 -	}
    1.16 -	~CCriticalSection()
    1.17 -	{
    1.18 -		DeleteCriticalSection(&m_crit);
    1.19 -	}
    1.20 -	void Enter()
    1.21 -	{
    1.22 -		EnterCriticalSection(&m_crit);
    1.23 -	}
    1.24 -	bool TryEnter()
    1.25 -	{
    1.26 -		if (TryEnterCriticalSection(&m_crit))
    1.27 -		{
    1.28 -			return true;
    1.29 -		}
    1.30 -		return false;
    1.31 -	}
    1.32 -	void Leave()
    1.33 -	{
    1.34 -		LeaveCriticalSection(&m_crit);
    1.35 -	}
    1.36 -private:
    1.37 -	CRITICAL_SECTION m_crit;
    1.38 -};
    1.39 -
    1.40 -#endif //_INCLUDE_INSTALLER_CRIT_SECT_H_
     2.1 --- a/tools/installer/CFileList.cpp	Fri Oct 02 02:35:25 2009 -0700
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,151 +0,0 @@
     2.4 -#include "CFileList.h"
     2.5 -#include "InstallerUtil.h"
     2.6 -
     2.7 -using namespace std;
     2.8 -
     2.9 -CFileList::CFileList(const TCHAR *name) : m_TotalSize(0), m_RecursiveSize(0), 
    2.10 -	m_bGotRecursiveSize(false)
    2.11 -{
    2.12 -	UTIL_Format(m_FolderName, sizeof(m_FolderName) / sizeof(TCHAR), _T("%s"), name);
    2.13 -}
    2.14 -
    2.15 -CFileList::~CFileList()
    2.16 -{
    2.17 -	list<CFileList *>::iterator iter;
    2.18 -
    2.19 -	for (iter = m_folder_list.begin();
    2.20 -		 iter != m_folder_list.end();
    2.21 -		 iter++)
    2.22 -	{
    2.23 -		delete (*iter);
    2.24 -	}
    2.25 -}
    2.26 -
    2.27 -const TCHAR *CFileList::GetFolderName()
    2.28 -{
    2.29 -	return m_FolderName;
    2.30 -}
    2.31 -
    2.32 -void CFileList::AddFolder(CFileList *pFileList)
    2.33 -{
    2.34 -	m_folder_list.push_back(pFileList);
    2.35 -}
    2.36 -
    2.37 -void CFileList::AddFile(const TCHAR *name, unsigned __int64 size)
    2.38 -{
    2.39 -	CFileListEntry entry;
    2.40 -	
    2.41 -	UTIL_Format(entry.file, sizeof(entry.file) / sizeof(TCHAR), _T("%s"), name);
    2.42 -	entry.size = size;
    2.43 -
    2.44 -	m_file_list.push_back(entry);
    2.45 -	m_TotalSize += size;
    2.46 -}
    2.47 -
    2.48 -unsigned __int64 CFileList::GetRecursiveSize()
    2.49 -{
    2.50 -	if (m_bGotRecursiveSize)
    2.51 -	{
    2.52 -		return m_RecursiveSize;
    2.53 -	}
    2.54 -
    2.55 -	m_RecursiveSize = m_TotalSize;
    2.56 -
    2.57 -	list<CFileList *>::iterator iter;
    2.58 -	for (iter = m_folder_list.begin(); iter != m_folder_list.end(); iter++)
    2.59 -	{
    2.60 -		m_RecursiveSize += (*iter)->GetRecursiveSize();
    2.61 -	}
    2.62 -
    2.63 -	m_bGotRecursiveSize = true;
    2.64 -
    2.65 -	return m_RecursiveSize;
    2.66 -}
    2.67 -
    2.68 -const TCHAR *CFileList::PeekCurrentFile()
    2.69 -{
    2.70 -	if (m_file_list.empty())
    2.71 -	{
    2.72 -		return NULL;
    2.73 -	}
    2.74 -
    2.75 -	return m_file_list.begin()->file;
    2.76 -}
    2.77 -
    2.78 -void CFileList::PopCurrentFile()
    2.79 -{
    2.80 -	m_file_list.erase(m_file_list.begin());
    2.81 -}
    2.82 -
    2.83 -CFileList *CFileList::PeekCurrentFolder()
    2.84 -{
    2.85 -	if (m_folder_list.empty())
    2.86 -	{
    2.87 -		return NULL;
    2.88 -	}
    2.89 -
    2.90 -	return *(m_folder_list.begin());
    2.91 -}
    2.92 -
    2.93 -void CFileList::PopCurrentFolder()
    2.94 -{
    2.95 -	m_folder_list.erase(m_folder_list.begin());
    2.96 -}
    2.97 -
    2.98 -void RecursiveBuildFileList(CFileList *file_list, const TCHAR *current_folder)
    2.99 -{
   2.100 -	HANDLE hFind;
   2.101 -	WIN32_FIND_DATA fd;
   2.102 -	TCHAR path[MAX_PATH];
   2.103 -
   2.104 -	UTIL_PathFormat(path, sizeof(path) / sizeof(TCHAR), _T("%s\\*.*"), current_folder);
   2.105 -
   2.106 -	if ((hFind = FindFirstFile(path, &fd)) == INVALID_HANDLE_VALUE)
   2.107 -	{
   2.108 -		return;
   2.109 -	}
   2.110 -
   2.111 -	do
   2.112 -	{
   2.113 -		if (tstrcasecmp(fd.cFileName, _T(".")) == 0
   2.114 -			|| tstrcasecmp(fd.cFileName, _T("..")) == 0)
   2.115 -		{
   2.116 -			continue;
   2.117 -		}
   2.118 -
   2.119 -		if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
   2.120 -		{
   2.121 -			CFileList *pSubList = new CFileList(fd.cFileName);
   2.122 -
   2.123 -			UTIL_PathFormat(path,
   2.124 -				sizeof(path) / sizeof(TCHAR),
   2.125 -				_T("%s\\%s"), 
   2.126 -				current_folder,
   2.127 -				fd.cFileName);			
   2.128 -
   2.129 -			RecursiveBuildFileList(pSubList, path);
   2.130 -
   2.131 -			file_list->AddFolder(pSubList);
   2.132 -		}
   2.133 -		else
   2.134 -		{
   2.135 -			LARGE_INTEGER li;
   2.136 -
   2.137 -			li.LowPart = fd.nFileSizeLow;
   2.138 -			li.HighPart = fd.nFileSizeHigh;
   2.139 -
   2.140 -			file_list->AddFile(fd.cFileName, li.QuadPart);
   2.141 -		}
   2.142 -	} while (FindNextFile(hFind, &fd));
   2.143 -
   2.144 -	FindClose(hFind);
   2.145 -}
   2.146 -
   2.147 -CFileList *CFileList::BuildFileList(const TCHAR *name, const TCHAR *root_folder)
   2.148 -{
   2.149 -	CFileList *pFileList = new CFileList(name);
   2.150 -
   2.151 -	RecursiveBuildFileList(pFileList, root_folder);
   2.152 -
   2.153 -	return pFileList;
   2.154 -}
     3.1 --- a/tools/installer/CFileList.h	Fri Oct 02 02:35:25 2009 -0700
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,40 +0,0 @@
     3.4 -#ifndef _INCLUDE_FOLDER_LIST_H_
     3.5 -#define _INCLUDE_FOLDER_LIST_H_
     3.6 -
     3.7 -#include "platform_headers.h"
     3.8 -#include <list>
     3.9 -#include <vector>
    3.10 -
    3.11 -struct CFileListEntry
    3.12 -{
    3.13 -	TCHAR file[MAX_PATH];
    3.14 -	unsigned __int64 size;
    3.15 -};
    3.16 -
    3.17 -class CFileList
    3.18 -{
    3.19 -public:
    3.20 -	CFileList(const TCHAR *name);
    3.21 -	~CFileList();
    3.22 -public:
    3.23 -	CFileList *PeekCurrentFolder();
    3.24 -	void PopCurrentFolder();
    3.25 -	const TCHAR *PeekCurrentFile();
    3.26 -	void PopCurrentFile();
    3.27 -	const TCHAR *GetFolderName();
    3.28 -public:
    3.29 -	void AddFolder(CFileList *pFileList);
    3.30 -	void AddFile(const TCHAR *name, unsigned __int64 size);
    3.31 -	unsigned __int64 GetRecursiveSize();
    3.32 -public:
    3.33 -	static CFileList *BuildFileList(const TCHAR *name, const TCHAR *root_folder);
    3.34 -private:
    3.35 -	std::list<CFileList *> m_folder_list;
    3.36 -	std::list<CFileListEntry> m_file_list;
    3.37 -	TCHAR m_FolderName[MAX_PATH];
    3.38 -	unsigned __int64 m_TotalSize;
    3.39 -	unsigned __int64 m_RecursiveSize;
    3.40 -	bool m_bGotRecursiveSize;
    3.41 -};
    3.42 -
    3.43 -#endif //_INCLUDE_FOLDER_LIST_H_
     4.1 --- a/tools/installer/ChooseMethod.cpp	Fri Oct 02 02:35:25 2009 -0700
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,235 +0,0 @@
     4.4 -#include "InstallerMain.h"
     4.5 -#include "InstallerUtil.h"
     4.6 -#include "ChooseMethod.h"
     4.7 -#include "Welcome.h"
     4.8 -#include "GamesList.h"
     4.9 -#include "SelectGame.h"
    4.10 -#include "PerformInstall.h"
    4.11 -#include "LocalCopyMethod.h"
    4.12 -
    4.13 -game_group_t *g_game_group = NULL;
    4.14 -unsigned int method_chosen = 0;
    4.15 -TCHAR method_path[MAX_PATH];
    4.16 -
    4.17 -bool SelectFolder(HWND hOwner)
    4.18 -{
    4.19 -	BROWSEINFO info;
    4.20 -	LPITEMIDLIST pidlist;
    4.21 -	TCHAR path[MAX_PATH];
    4.22 -
    4.23 -	if (FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
    4.24 -	{
    4.25 -		return false;
    4.26 -	}
    4.27 -	
    4.28 -	info.hwndOwner = hOwner;
    4.29 -	info.pidlRoot = NULL;
    4.30 -	info.pszDisplayName = path;
    4.31 -	info.lpszTitle = _T("Select a game/mod folder");
    4.32 -	info.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
    4.33 -	info.lpfn = NULL;
    4.34 -	info.lParam = 0;
    4.35 -	info.iImage = 0;
    4.36 -
    4.37 -	if ((pidlist = SHBrowseForFolder(&info)) == NULL)
    4.38 -	{
    4.39 -		CoUninitialize();
    4.40 -		return false;
    4.41 -	}
    4.42 -
    4.43 -	/* This hellish code is from MSDN and translate shortcuts to real targets.
    4.44 -	 * God almighty, I wish Window used real symlinks.
    4.45 -	 */
    4.46 -	bool acquire_success = false;
    4.47 -	bool is_link = false;
    4.48 -	IShellFolder *psf = NULL;
    4.49 -	LPCITEMIDLIST new_item_list;
    4.50 -	HRESULT hr;
    4.51 -	
    4.52 -	hr = SHBindToParent(pidlist, IID_IShellFolder, (void **)&psf, &new_item_list);
    4.53 -	if (SUCCEEDED(hr))
    4.54 -	{
    4.55 -		IShellLink *psl = NULL;
    4.56 -
    4.57 -		hr = psf->GetUIObjectOf(hOwner, 1, &new_item_list, IID_IShellLink, NULL, (void **)&psl);
    4.58 -		if (SUCCEEDED(hr))
    4.59 -		{
    4.60 -			LPITEMIDLIST new_item_list;
    4.61 -
    4.62 -			hr = psl->GetIDList(&new_item_list);
    4.63 -			if (SUCCEEDED(hr))
    4.64 -			{
    4.65 -				is_link = true;
    4.66 -
    4.67 -				hr = SHGetPathFromIDList(new_item_list, method_path);
    4.68 -				if (SUCCEEDED(hr))
    4.69 -				{
    4.70 -					acquire_success = true;
    4.71 -				}
    4.72 -
    4.73 -				CoTaskMemFree(new_item_list);
    4.74 -			}
    4.75 -			psl->Release();
    4.76 -		}
    4.77 -		psf->Release();
    4.78 -	}
    4.79 -
    4.80 -	if (!acquire_success && !is_link)
    4.81 -	{
    4.82 -		hr = SHGetPathFromIDList(pidlist, method_path);
    4.83 -		if (SUCCEEDED(hr))
    4.84 -		{
    4.85 -			acquire_success = true;
    4.86 -		}
    4.87 -	}
    4.88 -
    4.89 -	/* That was awful.  shoo, shoo, COM */
    4.90 -	CoTaskMemFree(pidlist);
    4.91 -	CoUninitialize();
    4.92 -
    4.93 -	return acquire_success;
    4.94 -}
    4.95 -
    4.96 -INT_PTR CALLBACK ChooseMethodHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    4.97 -{
    4.98 -	switch (message)
    4.99 -	{
   4.100 -	case WM_COMMAND:
   4.101 -		{
   4.102 -			if (LOWORD(wParam) == ID_METHOD_BACK)
   4.103 -			{
   4.104 -				UpdateGlobalPosition(hDlg);
   4.105 -				EndDialog(hDlg, (INT_PTR)DisplayWelcome);
   4.106 -				return (INT_PTR)TRUE;
   4.107 -			}
   4.108 -			else if (LOWORD(wParam) == ID_METHOD_EXIT
   4.109 -					 || LOWORD(wParam) == ID_CLOSE)
   4.110 -			{
   4.111 -				return AskToExit(hDlg);
   4.112 -			}
   4.113 -			else if (LOWORD(wParam) == IDC_METHOD_DED_SERVER
   4.114 -					 || LOWORD(wParam) == IDC_METHOD_ALONE_SERVER
   4.115 -					 || LOWORD(wParam) == IDC_METHOD_LISTEN_SERVER
   4.116 -					 || LOWORD(wParam) == IDC_METHOD_UPLOAD_FTP
   4.117 -					 || LOWORD(wParam) == IDC_METHOD_CUSTOM_FOLDER)
   4.118 -			{
   4.119 -				method_chosen = LOWORD(wParam);
   4.120 -				HWND button = GetDlgItem(hDlg, ID_METHOD_NEXT);
   4.121 -				EnableWindow(button, TRUE);
   4.122 -				break;
   4.123 -			}
   4.124 -			else if (LOWORD(wParam) == ID_METHOD_NEXT)
   4.125 -			{
   4.126 -				unsigned int game_type = 0;
   4.127 -
   4.128 -				switch (method_chosen)
   4.129 -				{
   4.130 -				case IDC_METHOD_DED_SERVER:
   4.131 -					{
   4.132 -						game_type = GAMES_DEDICATED;
   4.133 -						break;
   4.134 -					}
   4.135 -				case IDC_METHOD_ALONE_SERVER:
   4.136 -					{
   4.137 -						game_type = GAMES_STANDALONE;
   4.138 -						break;
   4.139 -					}
   4.140 -				case IDC_METHOD_LISTEN_SERVER:
   4.141 -					{
   4.142 -						game_type = GAMES_LISTEN;
   4.143 -						break;
   4.144 -					}
   4.145 -				case IDC_METHOD_UPLOAD_FTP:
   4.146 -					{
   4.147 -						break;
   4.148 -					}
   4.149 -				case IDC_METHOD_CUSTOM_FOLDER:
   4.150 -					{
   4.151 -						int val;
   4.152 -
   4.153 -						if (!SelectFolder(hDlg))
   4.154 -						{
   4.155 -							break;
   4.156 -						}
   4.157 -						
   4.158 -						val = IsValidFolder(method_path);
   4.159 -						if (val != GAMEINFO_IS_USABLE)
   4.160 -						{
   4.161 -							DisplayBadFolderDialog(hDlg, val);
   4.162 -							break;
   4.163 -						}
   4.164 -
   4.165 -						g_LocalCopier.SetOutputPath(method_path);
   4.166 -						SetInstallMethod(&g_LocalCopier);
   4.167 -
   4.168 -						UpdateGlobalPosition(hDlg);
   4.169 -						EndDialog(hDlg, (INT_PTR)DisplayPerformInstall);
   4.170 -					}
   4.171 -				}
   4.172 -
   4.173 -				if (game_type != 0)
   4.174 -				{
   4.175 -					g_game_group = NULL;
   4.176 -
   4.177 -					BuildGameDB();
   4.178 -
   4.179 -					if (game_type == GAMES_DEDICATED)
   4.180 -					{
   4.181 -						g_game_group = &g_games.dedicated;
   4.182 -					}
   4.183 -					else if (game_type == GAMES_LISTEN)
   4.184 -					{
   4.185 -						g_game_group = &g_games.listen;
   4.186 -					}
   4.187 -					else if (game_type == GAMES_STANDALONE)
   4.188 -					{
   4.189 -						g_game_group = &g_games.standalone;
   4.190 -					}
   4.191 -					
   4.192 -					if (g_game_group == NULL)
   4.193 -					{
   4.194 -						return (INT_PTR)TRUE;
   4.195 -					}
   4.196 -
   4.197 -					if (g_game_group->list_count == 0)
   4.198 -					{
   4.199 -						DisplayBadGamesDialog(hDlg, g_game_group->error_code);
   4.200 -						return (INT_PTR)TRUE;
   4.201 -					}
   4.202 -
   4.203 -					/* If we got a valid games list, we can display the next 
   4.204 -					 * dialog box.
   4.205 -					 */
   4.206 -					UpdateGlobalPosition(hDlg);
   4.207 -					EndDialog(hDlg, (INT_PTR)DisplaySelectGame);
   4.208 -					return (INT_PTR)TRUE;
   4.209 -				}
   4.210 -			}
   4.211 -			break;
   4.212 -		}
   4.213 -	case WM_INITDIALOG:
   4.214 -		{
   4.215 -			SetToGlobalPosition(hDlg);
   4.216 -			return (INT_PTR)TRUE;
   4.217 -		}
   4.218 -	}
   4.219 -
   4.220 -	return (INT_PTR)FALSE;
   4.221 -}
   4.222 -
   4.223 -void *DisplayChooseMethod(HWND hWnd)
   4.224 -{
   4.225 -	INT_PTR val;
   4.226 -	
   4.227 -	if ((val = DialogBox(
   4.228 -		g_hInstance, 
   4.229 -		MAKEINTRESOURCE(IDD_CHOOSE_METHOD),
   4.230 -		hWnd,
   4.231 -		ChooseMethodHandler)) == -1)
   4.232 -	{
   4.233 -		return NULL;
   4.234 -	}
   4.235 -
   4.236 -	return (void *)val;
   4.237 -}
   4.238 -
     5.1 --- a/tools/installer/ChooseMethod.h	Fri Oct 02 02:35:25 2009 -0700
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,11 +0,0 @@
     5.4 -#ifndef _INCLUDE_INSTALLER_CHOOSE_METHOD_H_
     5.5 -#define _INCLUDE_INSTALLER_CHOOSE_METHOD_H_
     5.6 -
     5.7 -#include "InstallerMain.h"
     5.8 -#include "GamesList.h"
     5.9 -
    5.10 -void *DisplayChooseMethod(HWND hWnd);
    5.11 -
    5.12 -extern game_group_t *g_game_group;
    5.13 -
    5.14 -#endif //_INCLUDE_INSTALLER_CHOOSE_METHOD_H_
     6.1 --- a/tools/installer/GamesList.cpp	Fri Oct 02 02:35:25 2009 -0700
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,574 +0,0 @@
     6.4 -#include "GamesList.h"
     6.5 -#include "InstallerUtil.h"
     6.6 -#include "InstallerMain.h"
     6.7 -#include <stdio.h>
     6.8 -
     6.9 -game_database_t g_games = 
    6.10 -{
    6.11 -	NULL, 0, 
    6.12 -	{NULL, 0, GAME_LIST_NO_GAMES}, 
    6.13 -	{NULL, 0, GAME_LIST_NO_GAMES}, 
    6.14 -	{NULL, 0, GAME_LIST_NO_GAMES}
    6.15 -};
    6.16 -
    6.17 -valve_game_t valve_game_list[] = 
    6.18 -{
    6.19 -	{_T("counter-strike source"),		_T("cstrike"),	SOURCE_ENGINE_2004},
    6.20 -	{_T("day of defeat source"),		_T("dod"),		SOURCE_ENGINE_2004},
    6.21 -	{_T("half-life 2 deathmatch"),		_T("hl2mp"),	SOURCE_ENGINE_2004},
    6.22 -	{_T("half-life deathmatch source"),	_T("hl1mp"),	SOURCE_ENGINE_2004},
    6.23 -	{_T("team fortress 2"),				_T("tf"),		SOURCE_ENGINE_2007},
    6.24 -	{NULL,								NULL,			0},
    6.25 -};
    6.26 -
    6.27 -valve_game_t valve_server_list[] = 
    6.28 -{
    6.29 -	{_T("source dedicated server"),		NULL,			SOURCE_ENGINE_2004},
    6.30 -	{_T("source 2007 dedicated server"), NULL,			SOURCE_ENGINE_2007},
    6.31 -	{NULL,								NULL,			0},
    6.32 -};
    6.33 -
    6.34 -int IsValidFolder(const TCHAR *path)
    6.35 -{
    6.36 -	DWORD attr;
    6.37 -	TCHAR gameinfo_file[MAX_PATH];
    6.38 -
    6.39 -	UTIL_PathFormat(gameinfo_file, sizeof(gameinfo_file), _T("%s\\gameinfo.txt"), path);
    6.40 -
    6.41 -	if ((attr = GetFileAttributes(gameinfo_file)) == INVALID_FILE_ATTRIBUTES)
    6.42 -	{
    6.43 -		return GAMEINFO_DOES_NOT_EXIST;
    6.44 -	}
    6.45 -
    6.46 -	if ((attr & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY)
    6.47 -	{
    6.48 -		return GAMEINFO_IS_READ_ONLY;
    6.49 -	}
    6.50 -
    6.51 -	if ((attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
    6.52 -	{
    6.53 -		return GAMEINFO_DOES_NOT_EXIST;
    6.54 -	}
    6.55 -
    6.56 -	return GAMEINFO_IS_USABLE;
    6.57 -}
    6.58 -
    6.59 -void DisplayBadFolderDialog(HWND hDlg, int reason)
    6.60 -{
    6.61 -	TCHAR message_string[255];
    6.62 -	UINT resource;
    6.63 -
    6.64 -	if (reason == GAMEINFO_DOES_NOT_EXIST)
    6.65 -	{
    6.66 -		resource = IDS_NO_GAMEINFO;
    6.67 -	}
    6.68 -	else if (reason == GAMEINFO_IS_READ_ONLY)
    6.69 -	{
    6.70 -		resource = IDS_READONLY_GAMEINFO;
    6.71 -	}
    6.72 -	else
    6.73 -	{
    6.74 -		return;
    6.75 -	}
    6.76 -
    6.77 -	if (LoadString(g_hInstance,
    6.78 -		resource,
    6.79 -		message_string,
    6.80 -		sizeof(message_string) / sizeof(TCHAR)
    6.81 -		) == 0)
    6.82 -	{
    6.83 -		return;
    6.84 -	}
    6.85 -
    6.86 -	MessageBox(hDlg, 
    6.87 -		message_string, 
    6.88 -		_T("SourceMod Installer"),
    6.89 -		MB_OK|MB_ICONWARNING);
    6.90 -}
    6.91 -
    6.92 -game_list_t *MakeGameList(const TCHAR *name)
    6.93 -{
    6.94 -	game_list_t *gl = (game_list_t *)malloc(sizeof(game_list_t));
    6.95 -
    6.96 -	UTIL_Format(gl->root_name, 
    6.97 -		sizeof(gl->root_name) / sizeof(TCHAR),
    6.98 -		_T("%s"),
    6.99 -		name);
   6.100 -	gl->game_count = 0;
   6.101 -	gl->games = NULL;
   6.102 -
   6.103 -	return gl;
   6.104 -}
   6.105 -
   6.106 -void AttachGameListToGroup(game_group_t *group, game_list_t *gl)
   6.107 -{
   6.108 -	if (group->lists == NULL)
   6.109 -	{
   6.110 -		group->lists = (game_list_t **)malloc(sizeof(game_list_t *));
   6.111 -	}
   6.112 -	else
   6.113 -	{
   6.114 -		group->lists = (game_list_t **)realloc(group->lists,
   6.115 -			sizeof(game_list_t *) * (group->list_count + 1));
   6.116 -	}
   6.117 -
   6.118 -	group->lists[group->list_count] = gl;
   6.119 -	group->list_count++;
   6.120 -}
   6.121 -
   6.122 -void AttachModToGameList(game_list_t *gl, unsigned int mod_id)
   6.123 -{
   6.124 -	if (gl->games == NULL)
   6.125 -	{
   6.126 -		gl->games = (unsigned int *)malloc(sizeof(unsigned int));
   6.127 -	}
   6.128 -	else
   6.129 -	{
   6.130 -		gl->games = (unsigned int *)realloc(gl->games, 
   6.131 -			sizeof(unsigned int) * (gl->game_count + 1));
   6.132 -	}
   6.133 -
   6.134 -	gl->games[gl->game_count] = mod_id;
   6.135 -	gl->game_count++;
   6.136 -}
   6.137 -
   6.138 -unsigned int AddModToList(game_database_t *db, const game_info_t *mod_info)
   6.139 -{
   6.140 -	/* Check if a matching game already exists */
   6.141 -	for (unsigned int i = 0; i < db->game_count; i++)
   6.142 -	{
   6.143 -		if (tstrcasecmp(mod_info->game_path, db->game_list[i].game_path) == 0)
   6.144 -		{
   6.145 -			return i;
   6.146 -		}
   6.147 -	}
   6.148 -
   6.149 -	if (db->game_list == NULL)
   6.150 -	{
   6.151 -		db->game_list = (game_info_t *)malloc(sizeof(game_info_t));
   6.152 -	}
   6.153 -	else
   6.154 -	{
   6.155 -		db->game_list = (game_info_t *)realloc(db->game_list, 
   6.156 -			sizeof(game_info_t) * (db->game_count + 1));
   6.157 -	}
   6.158 -
   6.159 -	memcpy(&db->game_list[db->game_count], mod_info, sizeof(game_info_t));
   6.160 -	db->game_count++;
   6.161 -
   6.162 -	return db->game_count - 1;
   6.163 -}
   6.164 -
   6.165 -bool TryToAddMod(const TCHAR *path, int eng_type, game_database_t *db, unsigned int *id)
   6.166 -{
   6.167 -	FILE *fp;
   6.168 -	TCHAR gameinfo_path[MAX_PATH];
   6.169 -
   6.170 -	UTIL_PathFormat(gameinfo_path,
   6.171 -		sizeof(gameinfo_path),
   6.172 -		_T("%s\\gameinfo.txt"),
   6.173 -		path);
   6.174 -
   6.175 -	if ((fp = _tfopen(gameinfo_path, _T("rt"))) == NULL)
   6.176 -	{
   6.177 -		return false;
   6.178 -	}
   6.179 -
   6.180 -	int pos;
   6.181 -	char buffer[512];
   6.182 -	char key[256], value[256];
   6.183 -	while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
   6.184 -	{
   6.185 -		if ((pos = BreakStringA(buffer, key, sizeof(key))) == -1)
   6.186 -		{
   6.187 -			continue;
   6.188 -		}
   6.189 -		if ((pos = BreakStringA(&buffer[pos], value, sizeof(value))) == -1)
   6.190 -		{
   6.191 -			continue;
   6.192 -		}
   6.193 -		if (strcmp(key, "game") == 0)
   6.194 -		{
   6.195 -			game_info_t mod;
   6.196 -			unsigned int got_id;
   6.197 -
   6.198 -			AnsiToUnicode(value, mod.name, sizeof(mod.name));
   6.199 -			UTIL_Format(mod.game_path, sizeof(mod.game_path), _T("%s"), path);
   6.200 -			mod.source_engine = eng_type;
   6.201 -
   6.202 -			got_id = AddModToList(db, &mod);
   6.203 -
   6.204 -			if (id != NULL)
   6.205 -			{
   6.206 -				*id = got_id;
   6.207 -			}
   6.208 -
   6.209 -			fclose(fp);
   6.210 -
   6.211 -			return true;
   6.212 -		}
   6.213 -	}
   6.214 -
   6.215 -	fclose(fp);
   6.216 -
   6.217 -	return false;
   6.218 -}
   6.219 -
   6.220 -void AddModsFromFolder(const TCHAR *path,
   6.221 -					   int eng_type,
   6.222 -					   game_database_t *db,
   6.223 -					   game_list_t *gl)
   6.224 -{
   6.225 -	HANDLE hFind;
   6.226 -	WIN32_FIND_DATA fd;
   6.227 -	TCHAR temp_path[MAX_PATH];
   6.228 -	TCHAR search_path[MAX_PATH];
   6.229 -	unsigned int mod_id;
   6.230 -
   6.231 -	UTIL_Format(search_path,
   6.232 -		sizeof(search_path),
   6.233 -		_T("%s\\*.*"),
   6.234 -		path);
   6.235 -
   6.236 -	if ((hFind = FindFirstFile(search_path, &fd)) == INVALID_HANDLE_VALUE)
   6.237 -	{
   6.238 -		return;
   6.239 -	}
   6.240 -
   6.241 -	do 
   6.242 -	{
   6.243 -		if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
   6.244 -		{
   6.245 -			continue;
   6.246 -		}
   6.247 -
   6.248 -		if (tstrcasecmp(fd.cFileName, _T(".")) == 0
   6.249 -			|| tstrcasecmp(fd.cFileName, _T("..")) == 0)
   6.250 -		{
   6.251 -			continue;
   6.252 -		}
   6.253 -
   6.254 -		UTIL_PathFormat(temp_path,
   6.255 -			sizeof(temp_path),
   6.256 -			_T("%s\\%s"),
   6.257 -			path,
   6.258 -			fd.cFileName);
   6.259 -		if (TryToAddMod(temp_path, eng_type, db, &mod_id))
   6.260 -		{
   6.261 -			AttachModToGameList(gl, mod_id);
   6.262 -		}
   6.263 -	} while (FindNextFile(hFind, &fd));
   6.264 -
   6.265 -	FindClose(hFind);
   6.266 -}
   6.267 -
   6.268 -void GetSteamGames(game_database_t *db)
   6.269 -{
   6.270 -	HKEY hkPath;
   6.271 -	DWORD dwLen, dwType;
   6.272 -	HANDLE hFind;
   6.273 -	WIN32_FIND_DATA fd;
   6.274 -	TCHAR temp_path[MAX_PATH];
   6.275 -	TCHAR steam_path[MAX_PATH];
   6.276 -	TCHAR steamapps_path[MAX_PATH];
   6.277 -
   6.278 -	if (RegOpenKeyEx(HKEY_CURRENT_USER,
   6.279 -		_T("Software\\Valve\\Steam"),
   6.280 -		0,
   6.281 -		KEY_READ,
   6.282 -		&hkPath) != ERROR_SUCCESS)
   6.283 -	{
   6.284 -		db->listen.error_code = GAME_LIST_CANT_READ;
   6.285 -		db->dedicated.error_code = GAME_LIST_CANT_READ;
   6.286 -		return;
   6.287 -	}
   6.288 -
   6.289 -	dwLen = sizeof(steam_path) / sizeof(TCHAR);
   6.290 -	if (RegQueryValueEx(hkPath,
   6.291 -		_T("SteamPath"),
   6.292 -		NULL,
   6.293 -		&dwType,
   6.294 -		(LPBYTE)steam_path,
   6.295 -		&dwLen) != ERROR_SUCCESS)
   6.296 -	{
   6.297 -		RegCloseKey(hkPath);
   6.298 -		db->listen.error_code = GAME_LIST_CANT_READ;
   6.299 -		db->dedicated.error_code = GAME_LIST_CANT_READ;
   6.300 -		return;
   6.301 -	}
   6.302 -
   6.303 -	UTIL_PathFormat(steamapps_path,
   6.304 -		sizeof(steamapps_path) / sizeof(TCHAR),
   6.305 -		_T("%s\\steamapps\\*.*"),
   6.306 -		steam_path);
   6.307 -
   6.308 -	if ((hFind = FindFirstFile(steamapps_path, &fd)) == INVALID_HANDLE_VALUE)
   6.309 -	{
   6.310 -		RegCloseKey(hkPath);
   6.311 -		db->listen.error_code = GAME_LIST_CANT_READ;
   6.312 -		db->dedicated.error_code = GAME_LIST_CANT_READ;
   6.313 -		return;
   6.314 -	}
   6.315 -
   6.316 -	do 
   6.317 -	{
   6.318 -		if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
   6.319 -		{
   6.320 -			continue;
   6.321 -		}
   6.322 -
   6.323 -		if (tstrcasecmp(fd.cFileName, _T(".")) == 0
   6.324 -			|| tstrcasecmp(fd.cFileName, _T("..")) == 0)
   6.325 -		{
   6.326 -			continue;
   6.327 -		}
   6.328 -
   6.329 -		/* If we get a folder called "SourceMods," look for third party mods */
   6.330 -		if (tstrcasecmp(fd.cFileName, _T("SourceMods")) == 0)
   6.331 -		{
   6.332 -			game_list_t *gl = MakeGameList(_T("Third-Party Games"));
   6.333 -
   6.334 -			UTIL_PathFormat(temp_path,
   6.335 -				sizeof(temp_path) / sizeof(TCHAR),
   6.336 -				_T("%s\\steamapps\\%s"),
   6.337 -				steam_path,
   6.338 -				fd.cFileName);
   6.339 -
   6.340 -			AddModsFromFolder(temp_path, SOURCE_ENGINE_UNKNOWN, db, gl);
   6.341 -
   6.342 -			if (gl->game_count)
   6.343 -			{
   6.344 -				AttachGameListToGroup(&db->listen, gl);
   6.345 -			}
   6.346 -			else
   6.347 -			{
   6.348 -				free(gl);
   6.349 -			}
   6.350 -		}
   6.351 -		else
   6.352 -		{
   6.353 -			/* Look for listenserver games */
   6.354 -			game_list_t *gl = MakeGameList(fd.cFileName);
   6.355 -
   6.356 -			for (unsigned int i = 0; valve_game_list[i].folder != NULL; i++)
   6.357 -			{
   6.358 -				unsigned int mod_id;
   6.359 -				UTIL_PathFormat(temp_path,
   6.360 -					sizeof(temp_path) / sizeof(TCHAR),
   6.361 -					_T("%s\\steamapps\\%s\\%s\\%s"),
   6.362 -					steam_path,
   6.363 -					fd.cFileName,
   6.364 -					valve_game_list[i].folder,
   6.365 -					valve_game_list[i].subfolder);
   6.366 -				if (TryToAddMod(temp_path, valve_game_list[i].eng_type, db, &mod_id))
   6.367 -				{
   6.368 -					AttachModToGameList(gl, mod_id);
   6.369 -				}
   6.370 -			}
   6.371 -
   6.372 -			if (gl->game_count)
   6.373 -			{
   6.374 -				AttachGameListToGroup(&db->listen, gl);
   6.375 -			}
   6.376 -			else
   6.377 -			{
   6.378 -				free(gl);
   6.379 -			}
   6.380 -
   6.381 -			/* Look for dedicated games */
   6.382 -			gl = MakeGameList(fd.cFileName);
   6.383 -
   6.384 -			for (unsigned int i = 0; valve_server_list[i].folder != NULL; i++)
   6.385 -			{
   6.386 -				UTIL_PathFormat(temp_path,
   6.387 -					sizeof(temp_path) / sizeof(TCHAR),
   6.388 -					_T("%s\\steamapps\\%s\\%s"),
   6.389 -					steam_path,
   6.390 -					fd.cFileName,
   6.391 -					valve_server_list[i].folder);
   6.392 -				AddModsFromFolder(temp_path, valve_server_list[i].eng_type, db, gl);
   6.393 -			}
   6.394 -
   6.395 -			if (gl->game_count)
   6.396 -			{
   6.397 -				AttachGameListToGroup(&db->dedicated, gl);
   6.398 -			}
   6.399 -			else
   6.400 -			{
   6.401 -				free(gl);
   6.402 -			}
   6.403 -		}
   6.404 -
   6.405 -	} while (FindNextFile(hFind, &fd));
   6.406 -
   6.407 -	FindClose(hFind);
   6.408 -	RegCloseKey(hkPath);
   6.409 -}
   6.410 -
   6.411 -void GetStandaloneGames(game_database_t *db)
   6.412 -{
   6.413 -	HKEY hkPath;
   6.414 -	DWORD dwLen, dwType, dwAttr;
   6.415 -	TCHAR temp_path[MAX_PATH];
   6.416 -	TCHAR hlds_path[MAX_PATH];
   6.417 -	game_list_t *games_standalone;
   6.418 -
   6.419 -	if (RegOpenKeyEx(HKEY_CURRENT_USER,
   6.420 -		_T("Software\\Valve\\HLServer"),
   6.421 -		0,
   6.422 -		KEY_READ,
   6.423 -		&hkPath) != ERROR_SUCCESS)
   6.424 -	{
   6.425 -		db->standalone.error_code = GAME_LIST_CANT_READ;
   6.426 -		return;
   6.427 -	}
   6.428 -
   6.429 -	dwLen = sizeof(hlds_path) / sizeof(TCHAR);
   6.430 -	if (RegQueryValueEx(hkPath,
   6.431 -		_T("InstallPath"),
   6.432 -		NULL,
   6.433 -		&dwType,
   6.434 -		(LPBYTE)hlds_path,
   6.435 -		&dwLen) != ERROR_SUCCESS)
   6.436 -	{
   6.437 -		RegCloseKey(hkPath);
   6.438 -		db->standalone.error_code = GAME_LIST_CANT_READ;
   6.439 -		return;
   6.440 -	}
   6.441 -
   6.442 -	/* Make sure there is a "srcds.exe" file */
   6.443 -	UTIL_PathFormat(temp_path,
   6.444 -		sizeof(temp_path) / sizeof(TCHAR), 
   6.445 -		_T("%s\\srcds.exe"), 
   6.446 -		hlds_path);
   6.447 -	dwAttr = GetFileAttributes(temp_path);
   6.448 -	if (dwAttr == INVALID_FILE_ATTRIBUTES)
   6.449 -	{
   6.450 -		db->standalone.error_code = GAME_LIST_HALFLIFE1;
   6.451 -		return;
   6.452 -	}
   6.453 -
   6.454 -	games_standalone = MakeGameList(_T("Standalone"));
   6.455 -
   6.456 -	/* If there is an "orangebox" sub folder, we can make a better guess 
   6.457 -	 * at the engine state.
   6.458 -	 */
   6.459 -	UTIL_PathFormat(temp_path,
   6.460 -		sizeof(temp_path) / sizeof(TCHAR), 
   6.461 -		_T("%s\\orangebox"), 
   6.462 -		hlds_path);
   6.463 -	dwAttr = GetFileAttributes(temp_path);
   6.464 -	if (dwAttr != INVALID_FILE_ATTRIBUTES
   6.465 -		&& ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY))
   6.466 -	{
   6.467 -		AddModsFromFolder(temp_path, SOURCE_ENGINE_2007, db, games_standalone);
   6.468 -	}
   6.469 -
   6.470 -	/* Add everything from the server */
   6.471 -	AddModsFromFolder(hlds_path, SOURCE_ENGINE_2004, db, games_standalone);
   6.472 -
   6.473 -	if (games_standalone->game_count)
   6.474 -	{
   6.475 -		AttachGameListToGroup(&db->standalone, games_standalone);
   6.476 -	}
   6.477 -	else
   6.478 -	{
   6.479 -		free(games_standalone);
   6.480 -	}
   6.481 -
   6.482 -	RegCloseKey(hkPath);
   6.483 -}
   6.484 -
   6.485 -void DisplayBadGamesDialog(HWND hWnd, int reason)
   6.486 -{
   6.487 -	TCHAR message[256];
   6.488 -	UINT idc = 0;
   6.489 -
   6.490 -	if (reason == GAME_LIST_CANT_READ)
   6.491 -	{
   6.492 -		idc = IDS_GAME_FAIL_READ;
   6.493 -	}
   6.494 -	else if (reason == GAME_LIST_HALFLIFE1)
   6.495 -	{
   6.496 -		idc = IDS_GAME_FAIL_HL1;
   6.497 -	}
   6.498 -	else if (reason == GAME_LIST_NO_GAMES)
   6.499 -	{
   6.500 -		idc = IDS_GAME_FAIL_NONE;
   6.501 -	}
   6.502 -	else
   6.503 -	{
   6.504 -		return;
   6.505 -	}
   6.506 -
   6.507 -	if (LoadString(g_hInstance,
   6.508 -		idc,
   6.509 -		message,
   6.510 -		sizeof(message) / sizeof(TCHAR)) == 0)
   6.511 -	{
   6.512 -		return;
   6.513 -	}
   6.514 -
   6.515 -	MessageBox(hWnd, 
   6.516 -		message, 
   6.517 -		_T("SourceMod Installer"),
   6.518 -		MB_OK|MB_ICONWARNING);
   6.519 -}
   6.520 -
   6.521 -int _ModIdCompare(const void *item1, const void *item2)
   6.522 -{
   6.523 -	unsigned int mod_id1 = *(unsigned int *)item1;
   6.524 -	unsigned int mod_id2 = *(unsigned int *)item2;
   6.525 -
   6.526 -	return tstrcasecmp(g_games.game_list[mod_id1].name, g_games.game_list[mod_id2].name);
   6.527 -}
   6.528 -
   6.529 -int _GroupCompare(const void *item1, const void *item2)
   6.530 -{
   6.531 -	game_list_t *g1 = *(game_list_t **)item1;
   6.532 -	game_list_t *g2 = *(game_list_t **)item2;
   6.533 -
   6.534 -	return tstrcasecmp(g1->root_name, g2->root_name);
   6.535 -}
   6.536 -
   6.537 -void SortGameGroup(game_group_t *group)
   6.538 -{
   6.539 -	qsort(group->lists, group->list_count, sizeof(game_list_t *), _GroupCompare);
   6.540 -
   6.541 -	for (unsigned int i = 0; i < group->list_count; i++)
   6.542 -	{
   6.543 -		qsort(group->lists[i]->games,
   6.544 -			  group->lists[i]->game_count,
   6.545 -			  sizeof(unsigned int),
   6.546 -			  _ModIdCompare);
   6.547 -	}
   6.548 -}
   6.549 -
   6.550 -void BuildGameDB()
   6.551 -{
   6.552 -	ReleaseGameDB();
   6.553 -	GetStandaloneGames(&g_games);
   6.554 -	GetSteamGames(&g_games);
   6.555 -	SortGameGroup(&g_games.dedicated);
   6.556 -	SortGameGroup(&g_games.listen);
   6.557 -	SortGameGroup(&g_games.standalone);
   6.558 -}
   6.559 -
   6.560 -void ReleaseGameGroup(game_group_t *group)
   6.561 -{
   6.562 -	for (unsigned int i = 0; i < group->list_count; i++)
   6.563 -	{
   6.564 -		free(group->lists[i]->games);
   6.565 -		free(group->lists[i]);
   6.566 -	}
   6.567 -	free(group->lists);
   6.568 -}
   6.569 -
   6.570 -void ReleaseGameDB()
   6.571 -{
   6.572 -	ReleaseGameGroup(&g_games.dedicated);
   6.573 -	ReleaseGameGroup(&g_games.listen);
   6.574 -	ReleaseGameGroup(&g_games.standalone);
   6.575 -	free(g_games.game_list);
   6.576 -	memset(&g_games, 0, sizeof(g_games));
   6.577 -}
     7.1 --- a/tools/installer/GamesList.h	Fri Oct 02 02:35:25 2009 -0700
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,72 +0,0 @@
     7.4 -#ifndef _INCLUDE_INSTALLER_GAMES_LIST_H_
     7.5 -#define _INCLUDE_INSTALLER_GAMES_LIST_H_
     7.6 -
     7.7 -#include "platform_headers.h"
     7.8 -
     7.9 -#define GAMEINFO_IS_USABLE			0
    7.10 -#define GAMEINFO_DOES_NOT_EXIST		1
    7.11 -#define GAMEINFO_IS_READ_ONLY		2
    7.12 -
    7.13 -#define GAME_LIST_HALFLIFE1			-2
    7.14 -#define GAME_LIST_CANT_READ			-1
    7.15 -#define GAME_LIST_NO_GAMES			0
    7.16 -
    7.17 -#define GAMES_DEDICATED				1
    7.18 -#define GAMES_LISTEN				2
    7.19 -#define GAMES_STANDALONE			3
    7.20 -
    7.21 -#define SOURCE_ENGINE_UNKNOWN		0
    7.22 -#define SOURCE_ENGINE_2004			1
    7.23 -#define SOURCE_ENGINE_2007			2
    7.24 -
    7.25 -struct valve_game_t
    7.26 -{
    7.27 -	const TCHAR *folder;
    7.28 -	const TCHAR *subfolder;
    7.29 -	int eng_type;
    7.30 -};
    7.31 -
    7.32 -/* One game */
    7.33 -struct game_info_t
    7.34 -{
    7.35 -	TCHAR name[128];
    7.36 -	TCHAR game_path[MAX_PATH];
    7.37 -	int source_engine;
    7.38 -};
    7.39 -
    7.40 -/* A list of games under one "account" */
    7.41 -struct game_list_t
    7.42 -{
    7.43 -	TCHAR root_name[128];
    7.44 -	unsigned int *games;
    7.45 -	unsigned int game_count;
    7.46 -};
    7.47 -
    7.48 -/* A list of accounts */
    7.49 -struct game_group_t
    7.50 -{
    7.51 -	game_list_t **lists;
    7.52 -	unsigned int list_count;
    7.53 -	int error_code;
    7.54 -};
    7.55 -
    7.56 -/* All games on the system */
    7.57 -struct game_database_t
    7.58 -{
    7.59 -	game_info_t *game_list;
    7.60 -	unsigned int game_count;
    7.61 -	game_group_t dedicated;
    7.62 -	game_group_t listen;
    7.63 -	game_group_t standalone;
    7.64 -};
    7.65 -
    7.66 -int IsValidFolder(const TCHAR *path);
    7.67 -void DisplayBadFolderDialog(HWND hWnd, int reason);
    7.68 -
    7.69 -void BuildGameDB();
    7.70 -void ReleaseGameDB();
    7.71 -void DisplayBadGamesDialog(HWND hWnd, int reason);
    7.72 -
    7.73 -extern game_database_t g_games;
    7.74 -
    7.75 -#endif //_INCLUDE_INSTALLER_GAMES_LIST_H_
     8.1 --- a/tools/installer/ICopyMethod.h	Fri Oct 02 02:35:25 2009 -0700
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,25 +0,0 @@
     8.4 -#ifndef _INCLUDE_INSTALLER_COPY_METHOD_H_
     8.5 -#define _INCLUDE_INSTALLER_COPY_METHOD_H_
     8.6 -
     8.7 -#include "platform_headers.h"
     8.8 -
     8.9 -class ICopyProgress
    8.10 -{
    8.11 -public:
    8.12 -	virtual void StartingNewFile(const TCHAR *filename) =0;
    8.13 -	virtual void UpdateProgress(size_t bytes, size_t total_bytes) =0;
    8.14 -	virtual void FileDone(size_t file_size) =0;
    8.15 -};
    8.16 -
    8.17 -class ICopyMethod
    8.18 -{
    8.19 -public:
    8.20 -	virtual bool CheckForExistingInstall() =0;
    8.21 -	virtual void TrackProgress(ICopyProgress *pProgress) =0;
    8.22 -	virtual bool SetCurrentFolder(const TCHAR *path, TCHAR *buffer, size_t maxchars) =0;
    8.23 -	virtual bool SendFile(const TCHAR *path, TCHAR *buffer, size_t maxchars) =0;
    8.24 -	virtual bool CreateFolder(const TCHAR *name, TCHAR *buffer, size_t maxchars) =0;
    8.25 -	virtual void CancelCurrentCopy() =0;
    8.26 -};
    8.27 -
    8.28 -#endif //_INCLUDE_INSTALLER_COPY_METHOD_H_
     9.1 --- a/tools/installer/InstallerMain.cpp	Fri Oct 02 02:35:25 2009 -0700
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,142 +0,0 @@
     9.4 -#include "InstallerMain.h"
     9.5 -#include "Welcome.h"
     9.6 -
     9.7 -#define WMU_INIT_INSTALLER		WM_USER+1
     9.8 -
     9.9 -HINSTANCE g_hInstance;
    9.10 -NEXT_DIALOG next_dialog = DisplayWelcome;
    9.11 -POINT g_GlobalPosition;
    9.12 -
    9.13 -void UpdateGlobalPosition(HWND hWnd)
    9.14 -{
    9.15 -	WINDOWINFO wi;
    9.16 -
    9.17 -	wi.cbSize = sizeof(WINDOWINFO);
    9.18 -	if (GetWindowInfo(hWnd, &wi))
    9.19 -	{
    9.20 -		g_GlobalPosition.x = wi.rcWindow.left;
    9.21 -		g_GlobalPosition.y = wi.rcWindow.top;
    9.22 -	}
    9.23 -}
    9.24 -
    9.25 -void SetToGlobalPosition(HWND hWnd)
    9.26 -{
    9.27 -	WINDOWINFO wi;
    9.28 -	
    9.29 -	wi.cbSize = sizeof(WINDOWINFO);
    9.30 -	if (GetWindowInfo(hWnd, &wi))
    9.31 -	{
    9.32 -		MoveWindow(hWnd, 
    9.33 -			g_GlobalPosition.x, 
    9.34 -			g_GlobalPosition.y, 
    9.35 -			wi.rcWindow.right - wi.rcWindow.left,
    9.36 -			wi.rcWindow.bottom - wi.rcWindow.top,
    9.37 -			TRUE);
    9.38 -	}
    9.39 -}
    9.40 -
    9.41 -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    9.42 -{
    9.43 -	switch (message)
    9.44 -	{
    9.45 -	case WMU_INIT_INSTALLER:
    9.46 -		{
    9.47 -			UpdateGlobalPosition(hWnd);
    9.48 -			while (next_dialog != NULL)
    9.49 -			{
    9.50 -				next_dialog = (NEXT_DIALOG)next_dialog(hWnd);
    9.51 -			}
    9.52 -			PostQuitMessage(0);
    9.53 -			break;
    9.54 -		}
    9.55 -	case WM_DESTROY:
    9.56 -		{
    9.57 -			PostQuitMessage(0);
    9.58 -			break;
    9.59 -		}
    9.60 -	default:
    9.61 -		{
    9.62 -			return DefWindowProc(hWnd, message, wParam, lParam);
    9.63 -		}
    9.64 -	}
    9.65 -
    9.66 -	return 0;
    9.67 -}
    9.68 -
    9.69 -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    9.70 -{
    9.71 -	WNDCLASSEX wcex;
    9.72 -	BOOL bRet;
    9.73 -
    9.74 -	wcex.cbSize			= sizeof(wcex);
    9.75 -	wcex.style			= CS_HREDRAW | CS_VREDRAW;
    9.76 -	wcex.lpfnWndProc	= MainWndProc;
    9.77 -	wcex.cbClsExtra		= 0;
    9.78 -	wcex.cbWndExtra		= 0;
    9.79 -	wcex.hInstance		= hInstance;
    9.80 -	wcex.hIcon			= LoadIcon(hInstance, MAKEINTRESOURCE(IDI_INSTALLER));
    9.81 -	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
    9.82 -	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
    9.83 -	wcex.lpszMenuName	= _T("InstallerMenu");
    9.84 -	wcex.lpszClassName	= _T("Installer");
    9.85 -	wcex.hIconSm		= LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
    9.86 -
    9.87 -	if (!RegisterClassEx(&wcex))
    9.88 -	{
    9.89 -		return 1;
    9.90 -	}
    9.91 -
    9.92 -	INITCOMMONCONTROLSEX ccex;
    9.93 -	ccex.dwSize = sizeof(ccex);
    9.94 -	ccex.dwICC = ICC_BAR_CLASSES
    9.95 -		|ICC_HOTKEY_CLASS
    9.96 -		|ICC_LISTVIEW_CLASSES
    9.97 -		|ICC_PROGRESS_CLASS
    9.98 -		|ICC_WIN95_CLASSES
    9.99 -		|ICC_TAB_CLASSES;
   9.100 -
   9.101 -	if (!InitCommonControlsEx(&ccex))
   9.102 -	{
   9.103 -		return 1;
   9.104 -	}
   9.105 -
   9.106 -	g_hInstance = hInstance;
   9.107 -
   9.108 -	HWND hWnd = CreateWindow(
   9.109 -		_T("Installer"),
   9.110 -		_T("InstallerMain"),
   9.111 -		WS_OVERLAPPEDWINDOW,
   9.112 -		CW_USEDEFAULT,
   9.113 -		CW_USEDEFAULT,
   9.114 -		CW_USEDEFAULT,
   9.115 -		CW_USEDEFAULT,
   9.116 -		(HWND)NULL,
   9.117 -		(HMENU)NULL,
   9.118 -		hInstance,
   9.119 -		NULL);
   9.120 -	if (hWnd == NULL)
   9.121 -	{
   9.122 -		return 1;
   9.123 -	}
   9.124 -
   9.125 -	ShowWindow(hWnd, SW_HIDE);
   9.126 -	UpdateWindow(hWnd);
   9.127 -
   9.128 -	PostMessage(hWnd, WMU_INIT_INSTALLER, 0, 0);
   9.129 -
   9.130 -	MSG msg;
   9.131 -	while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0)
   9.132 -	{
   9.133 -		if (bRet == -1)
   9.134 -		{
   9.135 -			return 1;
   9.136 -		}
   9.137 -		else
   9.138 -		{
   9.139 -			TranslateMessage(&msg);
   9.140 -			DispatchMessage(&msg);
   9.141 -		}
   9.142 -	}
   9.143 -
   9.144 -	return (int)msg.wParam;
   9.145 -}
    10.1 --- a/tools/installer/InstallerMain.h	Fri Oct 02 02:35:25 2009 -0700
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,14 +0,0 @@
    10.4 -#ifndef _INCLUDE_INSTALLER_H_
    10.5 -#define _INCLUDE_INSTALLER_H_
    10.6 -
    10.7 -#include "platform_headers.h"
    10.8 -#include "Resource.h"
    10.9 -
   10.10 -void UpdateGlobalPosition(HWND hWnd);
   10.11 -void SetToGlobalPosition(HWND hWnd);
   10.12 -
   10.13 -typedef void *(*NEXT_DIALOG)(HWND);
   10.14 -
   10.15 -extern HINSTANCE g_hInstance;
   10.16 -
   10.17 -#endif //_INCLUDE_INSTALLER_H_
    11.1 --- a/tools/installer/InstallerUtil.cpp	Fri Oct 02 02:35:25 2009 -0700
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,312 +0,0 @@
    11.4 -#include "InstallerUtil.h"
    11.5 -#include "InstallerMain.h"
    11.6 -#include <stdio.h>
    11.7 -#include <windows.h>
    11.8 -
    11.9 -int tstrcasecmp(const TCHAR *str1, const TCHAR *str2)
   11.10 -{
   11.11 -#if defined _UNICODE
   11.12 -	return _wcsicmp(str1, str2);
   11.13 -#else
   11.14 -	return _stricmp(str1, str2);
   11.15 -#endif
   11.16 -}
   11.17 -
   11.18 -size_t AnsiToUnicode(const char *str, wchar_t *buffer, size_t maxchars)
   11.19 -{
   11.20 -	if (maxchars < 1)
   11.21 -	{
   11.22 -		return 0;
   11.23 -	}
   11.24 -
   11.25 -	size_t total = 
   11.26 -		(size_t)MultiByteToWideChar(CP_UTF8,
   11.27 -		0,
   11.28 -		str,
   11.29 -		-1,
   11.30 -		buffer,
   11.31 -		(int)maxchars);
   11.32 -
   11.33 -	return total;
   11.34 -}
   11.35 -
   11.36 -bool IsWhiteSpaceA(const char *stream)
   11.37 -{
   11.38 -	char c = *stream;
   11.39 -	if (c & (1<<7))
   11.40 -	{
   11.41 -		return false;
   11.42 -	}
   11.43 -	else
   11.44 -	{
   11.45 -		return isspace(c) != 0;
   11.46 -	}
   11.47 -}
   11.48 -
   11.49 -int BreakStringA(const char *str, char *out, size_t maxchars)
   11.50 -{
   11.51 -	const char *inptr = str;
   11.52 -	while (*inptr != '\0' && IsWhiteSpaceA(inptr))
   11.53 -	{
   11.54 -		inptr++;
   11.55 -	}
   11.56 -
   11.57 -	if (*inptr == '\0')
   11.58 -	{
   11.59 -		if (maxchars)
   11.60 -		{
   11.61 -			*out = '\0';
   11.62 -		}
   11.63 -		return -1;
   11.64 -	}
   11.65 -
   11.66 -	const char *start, *end = NULL;
   11.67 -
   11.68 -	bool quoted = (*inptr == '"');
   11.69 -	if (quoted)
   11.70 -	{
   11.71 -		inptr++;
   11.72 -		start = inptr;
   11.73 -		/* Read input until we reach a quote. */
   11.74 -		while (*inptr != '\0' && *inptr != '"')
   11.75 -		{
   11.76 -			/* Update the end point, increment the stream. */
   11.77 -			end = inptr++;
   11.78 -		}
   11.79 -		/* Read one more token if we reached an end quote */
   11.80 -		if (*inptr == '"')
   11.81 -		{
   11.82 -			inptr++;
   11.83 -		}
   11.84 -	}
   11.85 -	else
   11.86 -	{
   11.87 -		start = inptr;
   11.88 -		/* Read input until we reach a space */
   11.89 -		while (*inptr != '\0' && !IsWhiteSpaceA(inptr))
   11.90 -		{
   11.91 -			/* Update the end point, increment the stream. */
   11.92 -			end = inptr++;
   11.93 -		}
   11.94 -	}
   11.95 -
   11.96 -	/* Copy the string we found, if necessary */
   11.97 -	if (end == NULL)
   11.98 -	{
   11.99 -		if (maxchars)
  11.100 -		{
  11.101 -			*out = '\0';
  11.102 -		}
  11.103 -	}
  11.104 -	else if (maxchars)
  11.105 -	{
  11.106 -		char *outptr = out;
  11.107 -		maxchars--;
  11.108 -		for (const char *ptr=start;
  11.109 -			(ptr <= end) && ((unsigned)(outptr - out) < (maxchars));
  11.110 -			ptr++, outptr++)
  11.111 -			{
  11.112 -			*outptr = *ptr;
  11.113 -		}
  11.114 -		*outptr = '\0';
  11.115 -	}
  11.116 -
  11.117 -	/* Consume more of the string until we reach non-whitespace */
  11.118 -	while (*inptr != '\0' && IsWhiteSpaceA(inptr))
  11.119 -	{
  11.120 -		inptr++;
  11.121 -	}
  11.122 -
  11.123 -	return (int)(inptr - str);
  11.124 -}
  11.125 -
  11.126 -size_t UTIL_Format(TCHAR *buffer, size_t count, const TCHAR *fmt, ...)
  11.127 -{
  11.128 -	va_list ap;
  11.129 -	size_t len;
  11.130 -	
  11.131 -	va_start(ap, fmt);
  11.132 -	len = UTIL_FormatArgs(buffer, count, fmt, ap);
  11.133 -	va_end(ap);
  11.134 -
  11.135 -	if (len >= count)
  11.136 -	{
  11.137 -		len = count - 1;
  11.138 -		buffer[len] = '\0';
  11.139 -	}
  11.140 -
  11.141 -	return len;
  11.142 -}
  11.143 -
  11.144 -size_t UTIL_FormatArgs(TCHAR *buffer, size_t count, const TCHAR *fmt, va_list ap)
  11.145 -{
  11.146 -	size_t len = _vsntprintf(buffer, count, fmt, ap);
  11.147 -
  11.148 -	if (len >= count)
  11.149 -	{
  11.150 -		len = count - 1;
  11.151 -		buffer[len] = '\0';
  11.152 -	}
  11.153 -
  11.154 -	return len;
  11.155 -}
  11.156 -
  11.157 -size_t UTIL_PathFormat(TCHAR *buffer, size_t count, const TCHAR *fmt, ...)
  11.158 -{
  11.159 -	va_list ap;
  11.160 -	size_t len;
  11.161 -
  11.162 -	va_start(ap, fmt);
  11.163 -	len = UTIL_FormatArgs(buffer, count, fmt, ap);
  11.164 -	va_end(ap);
  11.165 -
  11.166 -	for (size_t i = 0; i < len; i++)
  11.167 -	{
  11.168 -		if (buffer[i] == '/')
  11.169 -		{
  11.170 -			buffer[i] = '\\';
  11.171 -		}
  11.172 -	}
  11.173 -
  11.174 -	return len;
  11.175 -}
  11.176 -
  11.177 -const TCHAR *GetFileFromPath(const TCHAR *path)
  11.178 -{
  11.179 -	size_t len = _tcslen(path);
  11.180 -
  11.181 -	for (size_t i = len - 1;
  11.182 -		 i >= 0 && i < len;
  11.183 -		 i--)
  11.184 -	{
  11.185 -		if (path[i] == '\\' || path[i] == '/')
  11.186 -		{
  11.187 -			return &path[i+1];
  11.188 -		}
  11.189 -	}
  11.190 -
  11.191 -	return NULL;
  11.192 -}
  11.193 -
  11.194 -void GenerateErrorMessage(DWORD err, TCHAR *buffer, size_t maxchars)
  11.195 -{
  11.196 -	if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
  11.197 -		NULL,
  11.198 -		err,
  11.199 -		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  11.200 -		buffer,
  11.201 -		(DWORD)maxchars,
  11.202 -		NULL) == 0)
  11.203 -	{
  11.204 -		UTIL_Format(buffer, maxchars, _T("Unknown error"));
  11.205 -	}
  11.206 -}
  11.207 -
  11.208 -INT_PTR AskToExit(HWND hWnd)
  11.209 -{
  11.210 -	TCHAR verify_exit[100];
  11.211 -
  11.212 -	if (LoadString(g_hInstance,
  11.213 -		IDS_VERIFY_EXIT,
  11.214 -		verify_exit,
  11.215 -		sizeof(verify_exit) / sizeof(TCHAR)
  11.216 -		) == 0)
  11.217 -	{
  11.218 -		return (INT_PTR)FALSE;
  11.219 -	}
  11.220 -
  11.221 -	int val = MessageBox(
  11.222 -		hWnd, 
  11.223 -		_T("Are you sure you want to exit?"), 
  11.224 -		_T("SourceMod Installer"), 
  11.225 -		MB_YESNO|MB_ICONQUESTION);
  11.226 -
  11.227 -	if (val == 0 || val == IDYES)
  11.228 -	{
  11.229 -		UpdateGlobalPosition(hWnd);
  11.230 -		EndDialog(hWnd, NULL);
  11.231 -		return (INT_PTR)TRUE;
  11.232 -	}
  11.233 -	
  11.234 -	return (INT_PTR)FALSE;
  11.235 -}
  11.236 -
  11.237 -size_t UTIL_GetFileSize(const TCHAR *file_path)
  11.238 -{
  11.239 -	HANDLE hFile;
  11.240 -
  11.241 -	if ((hFile = CreateFile(file_path, 
  11.242 -		GENERIC_READ,
  11.243 -		FILE_SHARE_READ,
  11.244 -		NULL,
  11.245 -		OPEN_EXISTING,
  11.246 -		FILE_ATTRIBUTE_NORMAL,
  11.247 -		NULL)) 
  11.248 -		!= INVALID_HANDLE_VALUE)
  11.249 -	{
  11.250 -		LARGE_INTEGER size;
  11.251 -
  11.252 -		if (GetFileSizeEx(hFile, &size))
  11.253 -		{
  11.254 -			CloseHandle(hFile);
  11.255 -			return (size_t)size.QuadPart;
  11.256 -		}
  11.257 -
  11.258 -		CloseHandle(hFile);
  11.259 -	}
  11.260 -
  11.261 -	return 0;
  11.262 -}
  11.263 -
  11.264 -#if 0
  11.265 -size_t UTIL_GetFolderSize(const TCHAR *basepath)
  11.266 -{
  11.267 -	HANDLE hFind;
  11.268 -	WIN32_FIND_DATA fd;
  11.269 -	TCHAR search_path[MAX_PATH];
  11.270 -	size_t total = 0;
  11.271 -
  11.272 -	UTIL_PathFormat(search_path,
  11.273 -		sizeof(search_path) / sizeof(TCHAR),
  11.274 -		_T("%s\\*.*"),
  11.275 -		basepath);
  11.276 -
  11.277 -	if ((hFind = FindFirstFile(search_path, &fd)) == INVALID_HANDLE_VALUE)
  11.278 -	{
  11.279 -		return 0;
  11.280 -	}
  11.281 -
  11.282 -	do
  11.283 -	{
  11.284 -		if (tstrcasecmp(fd.cFileName, _T(".")) == 0
  11.285 -			|| tstrcasecmp(fd.cFileName, _T("..")) == 0)
  11.286 -		{
  11.287 -			continue;
  11.288 -		}
  11.289 -
  11.290 -		if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
  11.291 -		{
  11.292 -			UTIL_PathFormat(search_path,
  11.293 -				sizeof(search_path) / sizeof(TCHAR),
  11.294 -				_T("%s\\%s"),
  11.295 -				basepath,
  11.296 -				fd.cFileName);
  11.297 -			total += UTIL_GetFolderSize(search_path);
  11.298 -		}
  11.299 -		else
  11.300 -		{
  11.301 -			UTIL_PathFormat(search_path,
  11.302 -				sizeof(search_path) / sizeof(TCHAR),
  11.303 -				_T("%s\\%s"),
  11.304 -				basepath,
  11.305 -				fd.cFileName);
  11.306 -
  11.307 -			total += UTIL_GetFileSize(search_path);
  11.308 -		}
  11.309 -	} while (FindNextFile(hFind, &fd));
  11.310 -
  11.311 -	FindClose(hFind);
  11.312 -
  11.313 -	return total;
  11.314 -}
  11.315 -#endif
    12.1 --- a/tools/installer/InstallerUtil.h	Fri Oct 02 02:35:25 2009 -0700
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,20 +0,0 @@
    12.4 -#ifndef _INCLUDE_INSTALLER_UTIL_H_
    12.5 -#define _INCLUDE_INSTALLER_UTIL_H_
    12.6 -
    12.7 -#include "platform_headers.h"
    12.8 -
    12.9 -bool IsWhiteSpaceA(const char *stream);
   12.10 -size_t UTIL_FormatArgs(TCHAR *buffer, size_t count, const TCHAR *fmt, va_list ap);
   12.11 -size_t UTIL_Format(TCHAR *buffer, size_t count, const TCHAR *fmt, ...);
   12.12 -size_t UTIL_PathFormat(TCHAR *buffer, size_t count, const TCHAR *fmt, ...);
   12.13 -int tstrcasecmp(const TCHAR *str1, const TCHAR *str2);
   12.14 -int BreakStringA(const char *str, char *out, size_t maxchars);
   12.15 -size_t AnsiToUnicode(const char *str, wchar_t *buffer, size_t maxchars);
   12.16 -const TCHAR *GetFileFromPath(const TCHAR *path);
   12.17 -void GenerateErrorMessage(DWORD err, TCHAR *buffer, size_t maxchars);
   12.18 -size_t UTIL_GetFileSize(const TCHAR *file_path);
   12.19 -size_t UTIL_GetFolderSize(const TCHAR *basepath);
   12.20 -
   12.21 -INT_PTR AskToExit(HWND hWnd);
   12.22 -
   12.23 -#endif //_INCLUDE_INSTALLER_UTIL_H_
    13.1 --- a/tools/installer/LocalCopyMethod.cpp	Fri Oct 02 02:35:25 2009 -0700
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,167 +0,0 @@
    13.4 -#include "InstallerUtil.h"
    13.5 -#include "LocalCopyMethod.h"
    13.6 -
    13.7 -LocalCopyMethod g_LocalCopier;
    13.8 -
    13.9 -DWORD CALLBACK CopyProgressRoutine(LARGE_INTEGER TotalFileSize,
   13.10 -								   LARGE_INTEGER TotalBytesTransferred,
   13.11 -								   LARGE_INTEGER StreamSize,
   13.12 -								   LARGE_INTEGER StreamBytesTransferred,
   13.13 -								   DWORD dwStreamNumber,
   13.14 -								   DWORD dwCallbackReason,
   13.15 -								   HANDLE hSourceFile,
   13.16 -								   HANDLE hDestinationFile,
   13.17 -								   LPVOID lpData)
   13.18 -{
   13.19 -	ICopyProgress *progress = (ICopyProgress *)lpData;
   13.20 -
   13.21 -	progress->UpdateProgress((size_t)TotalBytesTransferred.QuadPart,
   13.22 -		(size_t)TotalFileSize.QuadPart);
   13.23 -
   13.24 -	return PROGRESS_CONTINUE;
   13.25 -}
   13.26 -
   13.27 -LocalCopyMethod::LocalCopyMethod()
   13.28 -{
   13.29 -	m_pProgress = NULL;
   13.30 -}
   13.31 -
   13.32 -void LocalCopyMethod::SetOutputPath(const TCHAR *path)
   13.33 -{
   13.34 -	UTIL_PathFormat(m_OutputPath,
   13.35 -		sizeof(m_OutputPath) / sizeof(TCHAR),
   13.36 -		_T("%s"),
   13.37 -		path);
   13.38 -
   13.39 -	UTIL_PathFormat(m_CurrentPath,
   13.40 -		sizeof(m_CurrentPath) / sizeof(TCHAR),
   13.41 -		_T("%s"),
   13.42 -		path);
   13.43 -}
   13.44 -
   13.45 -void LocalCopyMethod::TrackProgress(ICopyProgress *pProgress)
   13.46 -{
   13.47 -	m_pProgress = pProgress;
   13.48 -}
   13.49 -
   13.50 -bool LocalCopyMethod::CreateFolder(const TCHAR *name, TCHAR *buffer, size_t maxchars)
   13.51 -{
   13.52 -	TCHAR path[MAX_PATH];
   13.53 -
   13.54 -	UTIL_PathFormat(path,
   13.55 -		sizeof(path) / sizeof(TCHAR),
   13.56 -		_T("%s\\%s"),
   13.57 -		m_CurrentPath,
   13.58 -		name);
   13.59 -
   13.60 -	if (CreateDirectory(path, NULL))
   13.61 -	{
   13.62 -		return true;
   13.63 -	}
   13.64 -
   13.65 -	DWORD error = GetLastError();
   13.66 -	if (error == ERROR_ALREADY_EXISTS)
   13.67 -	{
   13.68 -		return true;
   13.69 -	}
   13.70 -
   13.71 -	GenerateErrorMessage(error, buffer, maxchars);
   13.72 -
   13.73 -	return false;
   13.74 -}
   13.75 -
   13.76 -bool LocalCopyMethod::SetCurrentFolder(const TCHAR *path, TCHAR *buffer, size_t maxchars)
   13.77 -{
   13.78 -	if (path == NULL)
   13.79 -	{
   13.80 -		UTIL_PathFormat(m_CurrentPath,
   13.81 -			sizeof(m_CurrentPath) / sizeof(TCHAR),
   13.82 -			_T("%s"),
   13.83 -			m_OutputPath);
   13.84 -	}
   13.85 -	else
   13.86 -	{
   13.87 -		UTIL_PathFormat(m_CurrentPath,
   13.88 -			sizeof(m_CurrentPath) / sizeof(TCHAR),
   13.89 -			_T("%s\\%s"),
   13.90 -			m_OutputPath,
   13.91 -			path);
   13.92 -	}
   13.93 -
   13.94 -	return true;
   13.95 -}
   13.96 -
   13.97 -bool LocalCopyMethod::SendFile(const TCHAR *path, TCHAR *buffer, size_t maxchars)
   13.98 -{
   13.99 -	const TCHAR *filename = GetFileFromPath(path);
  13.100 -
  13.101 -	if (filename == NULL)
  13.102 -	{
  13.103 -		UTIL_Format(buffer, maxchars, _T("Invalid filename"));
  13.104 -		return false;
  13.105 -	}
  13.106 -
  13.107 -	TCHAR new_path[MAX_PATH];
  13.108 -	UTIL_PathFormat(new_path,
  13.109 -		sizeof(new_path) / sizeof(TCHAR),
  13.110 -		_T("%s\\%s"),
  13.111 -		m_CurrentPath,
  13.112 -		filename);
  13.113 -
  13.114 -	m_bCancelStatus = FALSE;
  13.115 -
  13.116 -	if (m_pProgress != NULL)
  13.117 -	{
  13.118 -		m_pProgress->StartingNewFile(filename);
  13.119 -	}
  13.120 -
  13.121 -	if (CopyFileEx(path,
  13.122 -		new_path,
  13.123 -		m_pProgress ? CopyProgressRoutine : NULL,
  13.124 -		m_pProgress,
  13.125 -		&m_bCancelStatus,
  13.126 -		0) == 0)
  13.127 -	{
  13.128 -		/* Delete the file in case it was a partial copy */
  13.129 -		DeleteFile(new_path);
  13.130 -
  13.131 -		GenerateErrorMessage(GetLastError(), buffer, maxchars);
  13.132 -
  13.133 -		return false;
  13.134 -	}
  13.135 -
  13.136 -	if (m_pProgress != NULL)
  13.137 -	{
  13.138 -		m_pProgress->FileDone(UTIL_GetFileSize(path));
  13.139 -	}
  13.140 -
  13.141 -	return true;
  13.142 -}
  13.143 -
  13.144 -void LocalCopyMethod::CancelCurrentCopy()
  13.145 -{
  13.146 -	m_bCancelStatus = TRUE;
  13.147 -}
  13.148 -
  13.149 -bool LocalCopyMethod::CheckForExistingInstall()
  13.150 -{
  13.151 -	TCHAR path[MAX_PATH];
  13.152 -
  13.153 -	UTIL_PathFormat(path,
  13.154 -		sizeof(path) / sizeof(TCHAR),
  13.155 -		_T("%s\\addons\\sourcemod"),
  13.156 -		m_CurrentPath);
  13.157 -	if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
  13.158 -	{
  13.159 -		UTIL_PathFormat(path,
  13.160 -			sizeof(path) / sizeof(TCHAR),
  13.161 -			_T("%s\\cfg\\sourcemod"),
  13.162 -			m_CurrentPath);
  13.163 -		if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
  13.164 -		{
  13.165 -			return false;
  13.166 -		}
  13.167 -	}
  13.168 -
  13.169 -	return true;
  13.170 -}
    14.1 --- a/tools/installer/LocalCopyMethod.h	Fri Oct 02 02:35:25 2009 -0700
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,29 +0,0 @@
    14.4 -#ifndef _INCLUDE_INSTALL_LOCAL_COPY_METHOD_H_
    14.5 -#define _INCLUDE_INSTALL_LOCAL_COPY_METHOD_H_
    14.6 -
    14.7 -#include "platform_headers.h"
    14.8 -#include "ICopyMethod.h"
    14.9 -
   14.10 -class LocalCopyMethod : public ICopyMethod
   14.11 -{
   14.12 -public:
   14.13 -	LocalCopyMethod();
   14.14 -public:
   14.15 -	virtual void TrackProgress(ICopyProgress *pProgress);
   14.16 -	virtual bool SetCurrentFolder(const TCHAR *path, TCHAR *buffer, size_t maxchars);
   14.17 -	virtual bool SendFile(const TCHAR *path, TCHAR *buffer, size_t maxchars);
   14.18 -	virtual bool CreateFolder(const TCHAR *name, TCHAR *buffer, size_t maxchars);
   14.19 -	virtual void CancelCurrentCopy();
   14.20 -	virtual bool CheckForExistingInstall();
   14.21 -public:
   14.22 -	void SetOutputPath(const TCHAR *path);
   14.23 -private:
   14.24 -	ICopyProgress *m_pProgress;
   14.25 -	TCHAR m_OutputPath[MAX_PATH];
   14.26 -	TCHAR m_CurrentPath[MAX_PATH];
   14.27 -	BOOL m_bCancelStatus;
   14.28 -};
   14.29 -
   14.30 -extern LocalCopyMethod g_LocalCopier;
   14.31 -
   14.32 -#endif //_INCLUDE_INSTALL_LOCAL_COPY_METHOD_H_
    15.1 --- a/tools/installer/PerformInstall.cpp	Fri Oct 02 02:35:25 2009 -0700
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,438 +0,0 @@
    15.4 -#include "InstallerMain.h"
    15.5 -#include "InstallerUtil.h"
    15.6 -#include "PerformInstall.h"
    15.7 -#include "CCriticalSection.h"
    15.8 -
    15.9 -#define WMU_INSTALLER_DONE		WM_USER+2
   15.10 -#define PBAR_RANGE_HIGH			100
   15.11 -#define PBAR_RANGE_LOW			0
   15.12 -
   15.13 -ICopyMethod *g_pCopyMethod = NULL;
   15.14 -HANDLE g_hCopyThread = NULL;
   15.15 -copy_thread_args_t g_thread_args = {NULL, NULL, NULL, false, false};
   15.16 -CCriticalSection g_update_window;
   15.17 -
   15.18 -class TrackProgress : public ICopyProgress
   15.19 -{
   15.20 -public:
   15.21 -	void Initialize(HWND hTextBar, HWND hCurBar, HWND hTotalBar, size_t total_size)
   15.22 -	{
   15.23 -		m_hTextBar = hTextBar;
   15.24 -		m_hCurBar = hCurBar;
   15.25 -		m_hTotalBar = hTotalBar;
   15.26 -		m_TotalSize = total_size;
   15.27 -		m_TotalDone = 0;
   15.28 -		RedrawProgressBars(0.0, 0.0);
   15.29 -	}
   15.30 -	void Finished()
   15.31 -	{
   15.32 -		RedrawProgressBars(100.0, 100.0);
   15.33 -	}
   15.34 -public:
   15.35 -	void StartingNewFile(const TCHAR *filename)
   15.36 -	{
   15.37 -		TCHAR buffer[255];
   15.38 -
   15.39 -		if (g_update_window.TryEnter())
   15.40 -		{
   15.41 -			UTIL_Format(buffer, sizeof(buffer) / sizeof(TCHAR), _T("Copying: %s"), filename);
   15.42 -			SendMessage(m_hTextBar, WM_SETTEXT, 0, (LPARAM)buffer);
   15.43 -			UpdateWindow(m_hTextBar);
   15.44 -			g_update_window.Leave();
   15.45 -		}
   15.46 -	}
   15.47 -	void UpdateProgress(size_t bytes, size_t total_bytes)
   15.48 -	{
   15.49 -		float fCur = (float)bytes / (float)total_bytes;
   15.50 -		float fTotal = ((float)m_TotalDone + (float)bytes) / (float)m_TotalSize;
   15.51 -		RedrawProgressBars(fCur, fTotal);
   15.52 -	}
   15.53 -	void FileDone(size_t total_size)
   15.54 -	{
   15.55 -		m_TotalDone += total_size;
   15.56 -		RedrawProgressBars(0.0, (float)m_TotalDone / (float)m_TotalSize);
   15.57 -	}
   15.58 -private:
   15.59 -	void RedrawProgressBar(HWND hBar, float fPerc)
   15.60 -	{
   15.61 -		/* Get a percentage point in the range */
   15.62 -		float fPointInRange = (float)(PBAR_RANGE_HIGH - PBAR_RANGE_LOW) * fPerc;
   15.63 -		int iPointInRange = (int)fPointInRange;
   15.64 -
   15.65 -		/* Scale it */
   15.66 -		iPointInRange += PBAR_RANGE_LOW;
   15.67 -
   15.68 -		if (g_update_window.TryEnter())
   15.69 -		{
   15.70 -			SendMessage(hBar,
   15.71 -				PBM_SETPOS,
   15.72 -				iPointInRange,
   15.73 -				0);
   15.74 -			g_update_window.Leave();
   15.75 -		}
   15.76 -	}
   15.77 -	void RedrawProgressBars(float fCurrent, float fTotal)
   15.78 -	{
   15.79 -		RedrawProgressBar(m_hCurBar, fCurrent);
   15.80 -		RedrawProgressBar(m_hTotalBar, fTotal);
   15.81 -	}
   15.82 -private:
   15.83 -	size_t m_TotalSize;
   15.84 -	size_t m_TotalDone;
   15.85 -	HWND m_hTextBar;
   15.86 -	HWND m_hCurBar;
   15.87 -	HWND m_hTotalBar;
   15.88 -} s_ProgressTracker;
   15.89 -
   15.90 -void CancelPerformInstall()
   15.91 -{
   15.92 -	delete g_thread_args.pFileList;
   15.93 -	g_thread_args.pFileList = NULL;
   15.94 -}
   15.95 -
   15.96 -void SetInstallMethod(ICopyMethod *pCopyMethod)
   15.97 -{
   15.98 -	g_pCopyMethod = pCopyMethod;
   15.99 -}
  15.100 -
  15.101 -bool CopyStructureRecursively(ICopyMethod *pCopyMethod,
  15.102 -							  CFileList *pFileList,
  15.103 -							  const TCHAR *basepath,
  15.104 -							  const TCHAR *local_path,
  15.105 -							  TCHAR *errbuf,
  15.106 -							  size_t maxchars)
  15.107 -{
  15.108 -	TCHAR file_path[MAX_PATH];
  15.109 -	const TCHAR *file;
  15.110 -	CFileList *pSubList;
  15.111 -
  15.112 -	if (!pCopyMethod->SetCurrentFolder(local_path, errbuf, maxchars))
  15.113 -	{
  15.114 -		return false;
  15.115 -	}
  15.116 -
  15.117 -	/* Copy files */
  15.118 -	while ((file = pFileList->PeekCurrentFile()) != NULL)
  15.119 -	{
  15.120 -		if (local_path == NULL)
  15.121 -		{
  15.122 -			UTIL_PathFormat(file_path,
  15.123 -				sizeof(file_path) / sizeof(TCHAR),
  15.124 -				_T("%s\\%s"),
  15.125 -				basepath,
  15.126 -				file);
  15.127 -		}
  15.128 -		else
  15.129 -		{
  15.130 -			UTIL_PathFormat(file_path,
  15.131 -				sizeof(file_path) / sizeof(TCHAR), 
  15.132 -				_T("%s\\%s\\%s"),
  15.133 -				basepath,
  15.134 -				local_path,
  15.135 -				file);
  15.136 -		}
  15.137 -
  15.138 -		if (!pCopyMethod->SendFile(file_path, errbuf, maxchars))
  15.139 -		{
  15.140 -			return false;
  15.141 -		}
  15.142 -
  15.143 -		pFileList->PopCurrentFile();
  15.144 -	}
  15.145 -
  15.146 -	/* Now copy folders */
  15.147 -	while ((pSubList = pFileList->PeekCurrentFolder()) != NULL)
  15.148 -	{
  15.149 -		if (g_thread_args.m_bIsUpgrade)
  15.150 -		{
  15.151 -			/* :TODO: put this somewhere else because it technically 
  15.152 -			 * means the progress bars get calculated wrong 
  15.153 -			 */
  15.154 -			if (tstrcasecmp(pSubList->GetFolderName(), _T("cfg")) == 0
  15.155 -				|| tstrcasecmp(pSubList->GetFolderName(), _T("configs")) == 0)
  15.156 -			{
  15.157 -				pFileList->PopCurrentFolder();
  15.158 -				continue;
  15.159 -			}
  15.160 -		}
  15.161 -
  15.162 -		/* Try creating the folder */
  15.163 -		if (!pCopyMethod->CreateFolder(pSubList->GetFolderName(), errbuf, maxchars))
  15.164 -		{
  15.165 -			return false;
  15.166 -		}
  15.167 -
  15.168 -		TCHAR new_local_path[MAX_PATH];
  15.169 -		if (local_path == NULL)
  15.170 -		{
  15.171 -			UTIL_PathFormat(new_local_path,
  15.172 -				sizeof(new_local_path) / sizeof(TCHAR),
  15.173 -				_T("%s"),
  15.174 -				pSubList->GetFolderName());
  15.175 -		}
  15.176 -		else
  15.177 -		{
  15.178 -			UTIL_PathFormat(new_local_path,
  15.179 -				sizeof(new_local_path) / sizeof(TCHAR),
  15.180 -				_T("%s\\%s"),
  15.181 -				local_path,
  15.182 -				pSubList->GetFolderName());
  15.183 -		}
  15.184 -
  15.185 -		if (!CopyStructureRecursively(pCopyMethod,
  15.186 -				pSubList,
  15.187 -				basepath, 
  15.188 -				new_local_path, 
  15.189 -				errbuf, 
  15.190 -				maxchars))
  15.191 -		{
  15.192 -			return false;
  15.193 -		}
  15.194 -
  15.195 -		pFileList->PopCurrentFolder();
  15.196 -
  15.197 -		/* Set the current folder again for the next operation */
  15.198 -		if (!pCopyMethod->SetCurrentFolder(local_path, errbuf, maxchars))
  15.199 -		{
  15.200 -			return false;
  15.201 -		}
  15.202 -	}
  15.203 -
  15.204 -	return true;
  15.205 -}
  15.206 -
  15.207 -DWORD WINAPI T_CopyFiles(LPVOID arg)
  15.208 -{
  15.209 -	bool result = 
  15.210 -		CopyStructureRecursively(g_thread_args.pCopyMethod,
  15.211 -		g_thread_args.pFileList,
  15.212 -		g_thread_args.basepath,
  15.213 -		NULL,
  15.214 -		g_thread_args.error,
  15.215 -		sizeof(g_thread_args.error) / sizeof(TCHAR));
  15.216 -
  15.217 -	PostMessage(g_thread_args.hWnd, WMU_INSTALLER_DONE, result ? TRUE : FALSE, 0);
  15.218 -
  15.219 -	return 0;
  15.220 -}
  15.221 -
  15.222 -bool StartFileCopy(HWND hWnd)
  15.223 -{
  15.224 -	g_thread_args.m_bWasCancelled = false;
  15.225 -	g_thread_args.hWnd = hWnd;
  15.226 -	if ((g_hCopyThread = CreateThread(NULL, 
  15.227 -		0, 
  15.228 -		T_CopyFiles, 
  15.229 -		NULL, 
  15.230 -		0,
  15.231 -		NULL))
  15.232 -		== NULL)
  15.233 -	{
  15.234 -		MessageBox(
  15.235 -			hWnd,
  15.236 -			_T("Could not initialize copy thread."),
  15.237 -			_T("SourceMod Installer"),
  15.238 -			MB_OK|MB_ICONERROR);
  15.239 -		return false;
  15.240 -	}
  15.241 -	return true;
  15.242 -}
  15.243 -
  15.244 -void StopFileCopy()
  15.245 -{
  15.246 -	g_thread_args.m_bWasCancelled = true;
  15.247 -	g_pCopyMethod->CancelCurrentCopy();
  15.248 -
  15.249 -	if (g_hCopyThread != NULL)
  15.250 -	{
  15.251 -		g_update_window.Enter();
  15.252 -		WaitForSingleObject(g_hCopyThread, INFINITE);
  15.253 -		g_update_window.Leave();
  15.254 -		CloseHandle(g_hCopyThread);
  15.255 -		g_hCopyThread = NULL;
  15.256 -	}
  15.257 -}
  15.258 -
  15.259 -bool RequestCancelInstall(HWND hWnd)
  15.260 -{
  15.261 -	StopFileCopy();
  15.262 -
  15.263 -	int val = MessageBox(
  15.264 -		hWnd,
  15.265 -		_T("Are you sure you want to cancel the install?"),
  15.266 -		_T("SourceMod Installer"),
  15.267 -		MB_YESNO|MB_ICONQUESTION);
  15.268 -
  15.269 -	if (val == IDYES)
  15.270 -	{
  15.271 -		return true;
  15.272 -	}
  15.273 -	
  15.274 -	if (g_thread_args.pFileList == NULL)
  15.275 -	{
  15.276 -		return false;
  15.277 -	}
  15.278 -
  15.279 -	/* Start the thread, note our return value is opposite */
  15.280 -	return !StartFileCopy(hWnd);
  15.281 -}
  15.282 -
  15.283 -bool StartInstallProcess(HWND hWnd)
  15.284 -{
  15.285 -	if (g_pCopyMethod->CheckForExistingInstall())
  15.286 -	{
  15.287 -		int val = MessageBox(
  15.288 -			hWnd, 
  15.289 -			_T("It looks like a previous SourceMod installation exists.  Select \"Yes\" to skip copying configuration files.  Select \"No\" to perform a full re-install."),
  15.290 -			_T("SourceMod Installer"), 
  15.291 -			MB_YESNO|MB_ICONQUESTION);
  15.292 -
  15.293 -		if (val == 0 || val == IDYES)
  15.294 -		{
  15.295 -			g_thread_args.m_bIsUpgrade = true;
  15.296 -		}
  15.297 -		else
  15.298 -		{
  15.299 -			g_thread_args.m_bIsUpgrade = false;
  15.300 -		}
  15.301 -	}
  15.302 -
  15.303 -#if 0
  15.304 -	TCHAR cur_path[MAX_PATH];
  15.305 -	if (_tgetcwd(cur_path, sizeof(cur_path)) == NULL)
  15.306 -	{
  15.307 -		MessageBox(
  15.308 -			hWnd,
  15.309 -			_T("Could not locate current directory!"),
  15.310 -			_T("SourceMod Installer"),
  15.311 -			MB_OK|MB_ICONERROR);
  15.312 -		return false;
  15.313 -	}
  15.314 -#endif
  15.315 -
  15.316 -#if 0
  15.317 -	UTIL_PathFormat(source_path,
  15.318 -		sizeof(source_path) / sizeof(TCHAR),
  15.319 -		_T("%s\\files"),
  15.320 -		cur_path);
  15.321 -#else
  15.322 -	UTIL_PathFormat(g_thread_args.basepath,
  15.323 -		sizeof(g_thread_args.basepath) / sizeof(TCHAR),
  15.324 -		_T("C:\\real\\done\\base"));
  15.325 -#endif
  15.326 -
  15.327 -	if (GetFileAttributes(g_thread_args.basepath) == INVALID_FILE_ATTRIBUTES)
  15.328 -	{
  15.329 -		MessageBox(
  15.330 -			hWnd,
  15.331 -			_T("Could not locate the source installation files!"),
  15.332 -			_T("SourceMod Installer"),
  15.333 -			MB_OK|MB_ICONERROR);
  15.334 -		return false;
  15.335 -	}
  15.336 -
  15.337 -	delete g_thread_args.pFileList;
  15.338 -	g_thread_args.pFileList = CFileList::BuildFileList(_T(""), g_thread_args.basepath);
  15.339 -
  15.340 -	s_ProgressTracker.Initialize(
  15.341 -		GetDlgItem(hWnd, IDC_PROGRESS_CURCOPY),
  15.342 -		GetDlgItem(hWnd, IDC_PROGRESS_CURRENT),
  15.343 -		GetDlgItem(hWnd, IDC_PROGRESS_TOTAL),
  15.344 -		(size_t)g_thread_args.pFileList->GetRecursiveSize());
  15.345 -	g_pCopyMethod->TrackProgress(&s_ProgressTracker);
  15.346 -	g_thread_args.pCopyMethod = g_pCopyMethod;
  15.347 -
  15.348 -	return StartFileCopy(hWnd);
  15.349 -}
  15.350 -
  15.351 -INT_PTR CALLBACK PerformInstallHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  15.352 -{
  15.353 -	switch (message)
  15.354 -	{
  15.355 -	case WM_INITDIALOG:
  15.356 -		{
  15.357 -			SetToGlobalPosition(hDlg);
  15.358 -			return (INT_PTR)TRUE;
  15.359 -		}
  15.360 -	case WM_COMMAND:
  15.361 -		{
  15.362 -			if (LOWORD(wParam) == ID_INSTALL_CANCEL
  15.363 -				|| LOWORD(wParam) == ID_CLOSE)
  15.364 -			{
  15.365 -				if (RequestCancelInstall(hDlg))
  15.366 -				{
  15.367 -					CancelPerformInstall();
  15.368 -					UpdateGlobalPosition(hDlg);
  15.369 -					EndDialog(hDlg, NULL);
  15.370 -				}
  15.371 -				return (INT_PTR)TRUE;
  15.372 -			}
  15.373 -			else if (LOWORD(wParam) == ID_INSTALL_START)
  15.374 -			{
  15.375 -				HWND hButton = GetDlgItem(hDlg, ID_INSTALL_START);
  15.376 -				EnableWindow(hButton, FALSE);
  15.377 -				StartInstallProcess(hDlg);
  15.378 -			}
  15.379 -			break;
  15.380 -		}
  15.381 -	case WMU_INSTALLER_DONE:
  15.382 -		{
  15.383 -			if (wParam == TRUE)
  15.384 -			{
  15.385 -				s_ProgressTracker.Finished();
  15.386 -				MessageBox(hDlg,
  15.387 -					_T("SourceMod was successfully installed!  Please visit http://www.sourcemod.net/ for documentation."),
  15.388 -					_T("SourceMod Installer"),
  15.389 -					MB_OK);
  15.390 -				CancelPerformInstall();
  15.391 -				UpdateGlobalPosition(hDlg);
  15.392 -				EndDialog(hDlg, NULL);
  15.393 -				return (INT_PTR)TRUE;
  15.394 -			}
  15.395 -			else if (!g_thread_args.m_bWasCancelled)
  15.396 -			{
  15.397 -				TCHAR buffer[500];
  15.398 -
  15.399 -				UTIL_Format(buffer, 
  15.400 -					sizeof(buffer) / sizeof(TCHAR), 
  15.401 -					_T("Encountered error: %s"),
  15.402 -					g_thread_args.error);
  15.403 -				int res = MessageBox(hDlg,
  15.404 -					buffer,
  15.405 -					_T("SourceMod Installer"),
  15.406 -					MB_ICONERROR|MB_RETRYCANCEL);
  15.407 -
  15.408 -				if (res == IDRETRY)
  15.409 -				{
  15.410 -					StartFileCopy(hDlg);
  15.411 -				}
  15.412 -				else
  15.413 -				{
  15.414 -					CancelPerformInstall();
  15.415 -					UpdateGlobalPosition(hDlg);
  15.416 -					EndDialog(hDlg, NULL);
  15.417 -					return (INT_PTR)TRUE;
  15.418 -				}
  15.419 -			}
  15.420 -			break;
  15.421 -		}
  15.422 -	}
  15.423 -
  15.424 -	return (INT_PTR)FALSE;
  15.425 -}
  15.426 -
  15.427 -void *DisplayPerformInstall(HWND hWnd)
  15.428 -{
  15.429 -	INT_PTR val;
  15.430 -
  15.431 -	if ((val = DialogBox(
  15.432 -		g_hInstance, 
  15.433 -		MAKEINTRESOURCE(IDD_PERFORM_INSTALL),
  15.434 -		hWnd,
  15.435 -		PerformInstallHandler)) == -1)
  15.436 -	{
  15.437 -		return NULL;
  15.438 -	}
  15.439 -
  15.440 -	return (void *)val;
  15.441 -}
    16.1 --- a/tools/installer/PerformInstall.h	Fri Oct 02 02:35:25 2009 -0700
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,22 +0,0 @@
    16.4 -#ifndef _INCLUDE_PERFORM_INSTALL_H_
    16.5 -#define _INCLUDE_PERFORM_INSTALL_H_
    16.6 -
    16.7 -#include "InstallerMain.h"
    16.8 -#include "ICopyMethod.h"
    16.9 -#include "CFileList.h"
   16.10 -
   16.11 -struct copy_thread_args_t
   16.12 -{
   16.13 -	ICopyMethod *pCopyMethod;
   16.14 -	CFileList *pFileList;
   16.15 -	HWND hWnd;
   16.16 -	bool m_bIsUpgrade;
   16.17 -	bool m_bWasCancelled;
   16.18 -	TCHAR basepath[MAX_PATH];
   16.19 -	TCHAR error[255];
   16.20 -};
   16.21 -
   16.22 -void *DisplayPerformInstall(HWND hWnd);
   16.23 -void SetInstallMethod(ICopyMethod *pCopyMethod);
   16.24 -
   16.25 -#endif //_INCLUDE_PERFORM_INSTALL_H_
    17.1 --- a/tools/installer/Resource.h	Fri Oct 02 02:35:25 2009 -0700
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,65 +0,0 @@
    17.4 -//{{NO_DEPENDENCIES}}
    17.5 -// Microsoft Visual C++ generated include file.
    17.6 -// Used by installer.rc
    17.7 -//
    17.8 -#define ID_CLOSE                        2
    17.9 -#define IDD_INSTALLER_DIALOG            102
   17.10 -#define IDS_APP_TITLE                   103
   17.11 -#define IDM_ABOUT                       104
   17.12 -#define IDM_EXIT                        105
   17.13 -#define IDI_INSTALLER                   107
   17.14 -#define IDI_SMALL                       108
   17.15 -#define IDC_INSTALLER                   109
   17.16 -#define IDR_MAINFRAME                   128
   17.17 -#define IDD_WELCOME                     130
   17.18 -#define IDD_CHOOSE_METHOD               132
   17.19 -#define IDS_NO_GAMEINFO                 132
   17.20 -#define IDS_READONLY_GAMEINFO           133
   17.21 -#define IDS_GAME_FAIL_HL1               134
   17.22 -#define IDS_GAME_FAIL_READ              135
   17.23 -#define IDS_GAME_FAIL_NONE              136
   17.24 -#define IDS_VERIFY_EXIT                 137
   17.25 -#define ID_WELCOME_NEXT                 1001
   17.26 -#define IDC_WELCOME_PANEL               1002
   17.27 -#define IDC_METHOD_TEXT                 1003
   17.28 -#define ID_WELCOME_EXIT                 1003
   17.29 -#define ID_METHOD_NEXT                  1004
   17.30 -#define ID_METHOD_EXIT                  1005
   17.31 -#define ID_METHOD_BACK                  1006
   17.32 -#define IDC_METHOD_DED_SERVER           1007
   17.33 -#define IDC_METHOD_LISTEN_SERVER        1008
   17.34 -#define IDC_SELGAME_LIST                1008
   17.35 -#define IDC_METHOD_ALONE_SERVER         1009
   17.36 -#define IDC_PROGRESS_CURRENT            1009
   17.37 -#define IDC_METHOD_CUSTOM_FOLDER        1010
   17.38 -#define IDC_PROGRESS_TOTAL              1010
   17.39 -#define IDC_METHOD_UPLOAD_FTP           1011
   17.40 -#define ID_SELGAME_NEXT                 1012
   17.41 -#define ID_SELGAME_EXIT                 1013
   17.42 -#define ID_SELGAME_BACK                 1014
   17.43 -#define IDC_SELGAME_TEXT                1015
   17.44 -#define IDC_SELGAME_PANEL               1016
   17.45 -#define IDD_SELECT_GAME                 1017
   17.46 -#define IDD_PERFORM_INSTALL             1018
   17.47 -#define ID_INSTALL_CANCEL               1019
   17.48 -#define IDC_INSTALL_PANEL               1020
   17.49 -#define IDC_INSTALL_TEXT                1021
   17.50 -#define IDC_COMBO3                      1021
   17.51 -#define IDC_SELGROUP_ACCOUNT            1021
   17.52 -#define ID_INSTALL_START                1022
   17.53 -#define IDC_PROGRESS_CURCOPY            1023
   17.54 -#define IDC_STATIC                      -1
   17.55 -#define IDC_WELCOME_TEXT                -1
   17.56 -#define IDC_METHOD_PANEL                -1
   17.57 -
   17.58 -// Next default values for new objects
   17.59 -// 
   17.60 -#ifdef APSTUDIO_INVOKED
   17.61 -#ifndef APSTUDIO_READONLY_SYMBOLS
   17.62 -#define _APS_NO_MFC                     1
   17.63 -#define _APS_NEXT_RESOURCE_VALUE        133
   17.64 -#define _APS_NEXT_COMMAND_VALUE         32771
   17.65 -#define _APS_NEXT_CONTROL_VALUE         1022
   17.66 -#define _APS_NEXT_SYMED_VALUE           110
   17.67 -#endif
   17.68 -#endif
    18.1 --- a/tools/installer/SelectGame.cpp	Fri Oct 02 02:35:25 2009 -0700
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,169 +0,0 @@
    18.4 -#include "InstallerMain.h"
    18.5 -#include "InstallerUtil.h"
    18.6 -#include "SelectGame.h"
    18.7 -#include "GamesList.h"
    18.8 -#include "ChooseMethod.h"
    18.9 -#include "PerformInstall.h"
   18.10 -#include "LocalCopyMethod.h"
   18.11 -
   18.12 -int selected_game_index = -1;
   18.13 -
   18.14 -void UpdateGameListBox(HWND hDlg, game_list_t *gl)
   18.15 -{
   18.16 -	HWND lbox = GetDlgItem(hDlg, IDC_SELGAME_LIST);
   18.17 -
   18.18 -	SendMessage(lbox, LB_RESETCONTENT, 0, 0);
   18.19 -
   18.20 -	for (unsigned int i = 0; i < gl->game_count; i++)
   18.21 -	{
   18.22 -		LRESULT res = SendMessage(lbox,
   18.23 -			LB_ADDSTRING,
   18.24 -			0,
   18.25 -			(LPARAM)g_games.game_list[gl->games[i]].name);
   18.26 -
   18.27 -		if (res == LB_ERR || res == LB_ERRSPACE)
   18.28 -		{
   18.29 -			continue;
   18.30 -		}
   18.31 -
   18.32 -		SendMessage(lbox, LB_SETITEMDATA, i, gl->games[i]);
   18.33 -	}
   18.34 -	
   18.35 -	UpdateWindow(lbox);
   18.36 -}
   18.37 -
   18.38 -#include "windowsx.h"
   18.39 -
   18.40 -INT_PTR CALLBACK ChooseGameHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   18.41 -{
   18.42 -	switch (message)
   18.43 -	{
   18.44 -	case WM_INITDIALOG:
   18.45 -		{
   18.46 -			HWND cbox = GetDlgItem(hDlg, IDC_SELGROUP_ACCOUNT);
   18.47 -			SendMessage(cbox, CB_RESETCONTENT, 0, 0);
   18.48 -			for (unsigned int i = 0; i < g_game_group->list_count; i++)
   18.49 -			{
   18.50 -				LRESULT res = SendMessage(cbox, 
   18.51 -					CB_ADDSTRING, 
   18.52 -					0, 
   18.53 -					(LPARAM)g_game_group->lists[i]->root_name);
   18.54 -				if (res == CB_ERR || res == CB_ERRSPACE)
   18.55 -				{
   18.56 -					continue;
   18.57 -				}
   18.58 -				SendMessage(cbox, CB_SETITEMDATA, i, (LPARAM)g_game_group->lists[i]);
   18.59 -			}
   18.60 -			SendMessage(cbox, CB_SETCURSEL, 0, 0);
   18.61 -			UpdateWindow(cbox);
   18.62 -			UpdateGameListBox(hDlg, g_game_group->lists[0]);
   18.63 -
   18.64 -			SetToGlobalPosition(hDlg);
   18.65 -			
   18.66 -			return (INT_PTR)TRUE;
   18.67 -		}
   18.68 -	case WM_COMMAND:
   18.69 -		{
   18.70 -			if (LOWORD(wParam) == ID_SELGAME_EXIT
   18.71 -				|| LOWORD(wParam) == ID_CLOSE)
   18.72 -			{
   18.73 -				return AskToExit(hDlg);
   18.74 -			}
   18.75 -			else if (LOWORD(wParam) == ID_SELGAME_BACK)
   18.76 -			{
   18.77 -				UpdateGlobalPosition(hDlg);
   18.78 -				EndDialog(hDlg, (INT_PTR)DisplayChooseMethod);
   18.79 -				return (INT_PTR)TRUE;
   18.80 -			}
   18.81 -			else if (LOWORD(wParam) == IDC_SELGROUP_ACCOUNT)
   18.82 -			{
   18.83 -				if (HIWORD(wParam) == CBN_SELCHANGE)
   18.84 -				{
   18.85 -					HWND cbox = (HWND)lParam;
   18.86 -					LRESULT cursel = SendMessage(cbox, CB_GETCURSEL, 0, 0);
   18.87 -
   18.88 -					if (cursel == LB_ERR)
   18.89 -					{
   18.90 -						break;
   18.91 -					}
   18.92 -
   18.93 -					LRESULT data = SendMessage(cbox, CB_GETITEMDATA, cursel, 0);
   18.94 -					if (data == CB_ERR)
   18.95 -					{
   18.96 -						break;
   18.97 -					}
   18.98 -
   18.99 -					game_list_t *gl = (game_list_t *)data;
  18.100 -					UpdateGameListBox(hDlg, gl);
  18.101 -				}
  18.102 -				break;
  18.103 -			}
  18.104 -			else if (LOWORD(wParam) == IDC_SELGAME_LIST)
  18.105 -			{
  18.106 -				if (HIWORD(wParam) == LBN_SELCHANGE)
  18.107 -				{
  18.108 -					HWND lbox = (HWND)lParam;
  18.109 -					LRESULT cursel = SendMessage(lbox, LB_GETCURSEL, 0, 0);
  18.110 -
  18.111 -					selected_game_index = -1;
  18.112 -
  18.113 -					if (cursel == LB_ERR)
  18.114 -					{
  18.115 -						break;
  18.116 -					}
  18.117 -
  18.118 -					LRESULT item = SendMessage(lbox, LB_GETITEMDATA, cursel, 0);
  18.119 -					if (item == LB_ERR)
  18.120 -					{
  18.121 -						break;
  18.122 -					}
  18.123 -
  18.124 -					selected_game_index = (int)item;
  18.125 -
  18.126 -					HWND button = GetDlgItem(hDlg, ID_SELGAME_NEXT);
  18.127 -					EnableWindow(button, TRUE);
  18.128 -				}
  18.129 -			}
  18.130 -			else if (LOWORD(wParam) == ID_SELGAME_NEXT)
  18.131 -			{
  18.132 -				if (selected_game_index == -1)
  18.133 -				{
  18.134 -					break;
  18.135 -				}
  18.136 -
  18.137 -				g_LocalCopier.SetOutputPath(g_games.game_list[selected_game_index].game_path);
  18.138 -				SetInstallMethod(&g_LocalCopier);
  18.139 -
  18.140 -				UpdateGlobalPosition(hDlg);
  18.141 -				EndDialog(hDlg, (INT_PTR)DisplayPerformInstall);
  18.142 -
  18.143 -				return (INT_PTR)TRUE;
  18.144 -			}
  18.145 -			break;
  18.146 -		}
  18.147 -	case WM_DESTROY:
  18.148 -		{
  18.149 -			ReleaseGameDB();
  18.150 -			break;
  18.151 -		}
  18.152 -	}
  18.153 -
  18.154 -	return (INT_PTR)FALSE;
  18.155 -}
  18.156 -
  18.157 -void *DisplaySelectGame(HWND hWnd)
  18.158 -{
  18.159 -	INT_PTR val;
  18.160 -	
  18.161 -	if ((val = DialogBox(
  18.162 -		g_hInstance, 
  18.163 -		MAKEINTRESOURCE(IDD_SELECT_GAME),
  18.164 -		hWnd,
  18.165 -		ChooseGameHandler)) == -1)
  18.166 -	{
  18.167 -		return NULL;
  18.168 -	}
  18.169 -
  18.170 -	return (void *)val;
  18.171 -}
  18.172 -
    19.1 --- a/tools/installer/SelectGame.h	Fri Oct 02 02:35:25 2009 -0700
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,8 +0,0 @@
    19.4 -#ifndef _INCLUDE_INSTALLER_SELECT_GAME_H_
    19.5 -#define _INCLUDE_INSTALLER_SELECT_GAME_H_
    19.6 -
    19.7 -#include "InstallerMain.h"
    19.8 -
    19.9 -void *DisplaySelectGame(HWND hWnd);
   19.10 -
   19.11 -#endif //_INCLUDE_INSTALLER_SELECT_GAME_H_
    20.1 --- a/tools/installer/Welcome.cpp	Fri Oct 02 02:35:25 2009 -0700
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,60 +0,0 @@
    20.4 -#include "InstallerMain.h"
    20.5 -#include "Welcome.h"
    20.6 -#include "ChooseMethod.h"
    20.7 -
    20.8 -bool g_bIsFirstRun = true;
    20.9 -
   20.10 -INT_PTR CALLBACK WelcomeHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   20.11 -{
   20.12 -	switch (message)
   20.13 -	{
   20.14 -	case WM_INITDIALOG:
   20.15 -		{
   20.16 -			if (!g_bIsFirstRun)
   20.17 -			{
   20.18 -				SetToGlobalPosition(hDlg);
   20.19 -			}
   20.20 -			else
   20.21 -			{
   20.22 -				g_bIsFirstRun = false;
   20.23 -			}
   20.24 -			return (INT_PTR)TRUE;
   20.25 -		}
   20.26 -	case WM_COMMAND:
   20.27 -		{
   20.28 -			if (LOWORD(wParam) == ID_WELCOME_EXIT
   20.29 -				|| LOWORD(wParam) == ID_CLOSE)
   20.30 -			{
   20.31 -				UpdateGlobalPosition(hDlg);
   20.32 -				EndDialog(hDlg, NULL);
   20.33 -				return (INT_PTR)TRUE;
   20.34 -			}
   20.35 -			else if (LOWORD(wParam) == ID_WELCOME_NEXT)
   20.36 -			{
   20.37 -				UpdateGlobalPosition(hDlg);
   20.38 -				EndDialog(hDlg, (INT_PTR)DisplayChooseMethod);
   20.39 -				return (INT_PTR)TRUE;
   20.40 -			}
   20.41 -			break;
   20.42 -		}
   20.43 -	}
   20.44 -
   20.45 -	return (INT_PTR)FALSE;
   20.46 -}
   20.47 -
   20.48 -void *DisplayWelcome(HWND hWnd)
   20.49 -{
   20.50 -	INT_PTR val;
   20.51 -	
   20.52 -	if ((val = DialogBox(
   20.53 -		g_hInstance, 
   20.54 -		MAKEINTRESOURCE(IDD_WELCOME),
   20.55 -		hWnd,
   20.56 -		WelcomeHandler)) == -1)
   20.57 -	{
   20.58 -		return NULL;
   20.59 -	}
   20.60 -
   20.61 -	return (void *)val;
   20.62 -}
   20.63 -
    21.1 --- a/tools/installer/Welcome.h	Fri Oct 02 02:35:25 2009 -0700
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,6 +0,0 @@
    21.4 -#ifndef _INCLUDE_INSTALLER_WELCOME_H_
    21.5 -#define _INCLUDE_INSTALLER_WELCOME_H_
    21.6 -
    21.7 -void *DisplayWelcome(HWND hWnd);
    21.8 -
    21.9 -#endif //_INCLUDE_INSTALLER_WELCOME_H_
    22.1 Binary file tools/installer/installer.ico has changed
    23.1 --- a/tools/installer/installer.rc	Fri Oct 02 02:35:25 2009 -0700
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,222 +0,0 @@
    23.4 -// Microsoft Visual C++ generated resource script.
    23.5 -//
    23.6 -#include "resource.h"
    23.7 -
    23.8 -#define APSTUDIO_READONLY_SYMBOLS
    23.9 -/////////////////////////////////////////////////////////////////////////////
   23.10 -//
   23.11 -// Generated from the TEXTINCLUDE 2 resource.
   23.12 -//
   23.13 -#define APSTUDIO_HIDDEN_SYMBOLS
   23.14 -#include "windows.h"
   23.15 -#undef APSTUDIO_HIDDEN_SYMBOLS
   23.16 -
   23.17 -/////////////////////////////////////////////////////////////////////////////
   23.18 -#undef APSTUDIO_READONLY_SYMBOLS
   23.19 -
   23.20 -/////////////////////////////////////////////////////////////////////////////
   23.21 -// English (U.S.) resources
   23.22 -
   23.23 -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
   23.24 -#ifdef _WIN32
   23.25 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
   23.26 -#pragma code_page(1252)
   23.27 -#endif //_WIN32
   23.28 -
   23.29 -/////////////////////////////////////////////////////////////////////////////
   23.30 -//
   23.31 -// Icon
   23.32 -//
   23.33 -
   23.34 -// Icon with lowest ID value placed first to ensure application icon
   23.35 -// remains consistent on all systems.
   23.36 -IDI_INSTALLER           ICON                    "installer.ico"
   23.37 -
   23.38 -/////////////////////////////////////////////////////////////////////////////
   23.39 -//
   23.40 -// Menu
   23.41 -//
   23.42 -
   23.43 -IDC_INSTALLER MENU 
   23.44 -BEGIN
   23.45 -    POPUP "&File"
   23.46 -    BEGIN
   23.47 -        MENUITEM "E&xit",                       IDM_EXIT
   23.48 -    END
   23.49 -    POPUP "&Help"
   23.50 -    BEGIN
   23.51 -        MENUITEM "&About ...",                  IDM_ABOUT
   23.52 -    END
   23.53 -END
   23.54 -
   23.55 -
   23.56 -/////////////////////////////////////////////////////////////////////////////
   23.57 -//
   23.58 -// Accelerator
   23.59 -//
   23.60 -
   23.61 -IDC_INSTALLER ACCELERATORS 
   23.62 -BEGIN
   23.63 -    "?",            IDM_ABOUT,              ASCII,  ALT
   23.64 -    "/",            IDM_ABOUT,              ASCII,  ALT
   23.65 -END
   23.66 -
   23.67 -
   23.68 -/////////////////////////////////////////////////////////////////////////////
   23.69 -//
   23.70 -// Dialog
   23.71 -//
   23.72 -
   23.73 -IDD_WELCOME DIALOGEX 0, 0, 244, 74
   23.74 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_CAPTION | WS_SYSMENU
   23.75 -EXSTYLE WS_EX_APPWINDOW
   23.76 -CAPTION "SourceMod Installer"
   23.77 -FONT 8, "MS Shell Dlg", 400, 0, 0x1
   23.78 -BEGIN
   23.79 -    DEFPUSHBUTTON   "&Next",ID_WELCOME_NEXT,191,58,50,14
   23.80 -    GROUPBOX        "",IDC_WELCOME_PANEL,2,3,239,51
   23.81 -    LTEXT           "Welcome to the SourceMod Installer.  This tool can be used to install SourcecMod to a local server/game installation, or upload SourceMod to a server via FTP.",IDC_WELCOME_TEXT,9,11,225,42
   23.82 -    DEFPUSHBUTTON   "E&xit",ID_WELCOME_EXIT,2,58,50,14
   23.83 -END
   23.84 -
   23.85 -IDD_CHOOSE_METHOD DIALOGEX 0, 0, 244, 130
   23.86 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CAPTION | WS_SYSMENU
   23.87 -EXSTYLE WS_EX_APPWINDOW
   23.88 -CAPTION "SourceMod Installer"
   23.89 -FONT 8, "MS Shell Dlg", 400, 0, 0x1
   23.90 -BEGIN
   23.91 -    PUSHBUTTON      "&Next",ID_METHOD_NEXT,191,113,50,14,WS_DISABLED
   23.92 -    PUSHBUTTON      "E&xit",ID_METHOD_EXIT,2,113,50,14
   23.93 -    GROUPBOX        "",IDC_METHOD_PANEL,2,3,239,108
   23.94 -    DEFPUSHBUTTON   "&Back",ID_METHOD_BACK,136,113,50,14
   23.95 -    GROUPBOX        "",IDC_METHOD_PANEL,17,30,181,69
   23.96 -    LTEXT           "Please select an installation method:",IDC_METHOD_TEXT,9,15,122,12
   23.97 -    CONTROL         "Steam Dedicated Server",IDC_METHOD_DED_SERVER,"Button",BS_AUTORADIOBUTTON,21,35,98,15
   23.98 -    CONTROL         "Steam Listen Server",IDC_METHOD_LISTEN_SERVER,"Button",BS_AUTORADIOBUTTON,21,46,93,16
   23.99 -    CONTROL         "Standalone Server",IDC_METHOD_ALONE_SERVER,"Button",BS_AUTORADIOBUTTON,21,58,93,16
  23.100 -    CONTROL         "Select Destination Folder",IDC_METHOD_CUSTOM_FOLDER,
  23.101 -                    "Button",BS_AUTORADIOBUTTON,21,70,95,16
  23.102 -    CONTROL         "Upload via FTP",IDC_METHOD_UPLOAD_FTP,"Button",BS_AUTORADIOBUTTON,21,82,94,16
  23.103 -END
  23.104 -
  23.105 -IDD_SELECT_GAME DIALOGEX 0, 0, 244, 148
  23.106 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CAPTION | WS_SYSMENU
  23.107 -EXSTYLE WS_EX_APPWINDOW
  23.108 -CAPTION "SourceMod Installer"
  23.109 -FONT 8, "MS Shell Dlg", 400, 0, 0x1
  23.110 -BEGIN
  23.111 -    PUSHBUTTON      "&Next",ID_SELGAME_NEXT,191,131,50,14,WS_DISABLED
  23.112 -    PUSHBUTTON      "E&xit",ID_SELGAME_EXIT,2,131,50,14
  23.113 -    GROUPBOX        "",IDC_SELGAME_PANEL,2,3,239,126
  23.114 -    DEFPUSHBUTTON   "&Back",ID_SELGAME_BACK,136,131,50,14
  23.115 -    LTEXT           "Please select a game from the list below.  If there are multiple accounts, you may select one from the combo-box.",IDC_SELGAME_TEXT,7,14,221,16
  23.116 -    LISTBOX         IDC_SELGAME_LIST,17,46,199,76,LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
  23.117 -    COMBOBOX        IDC_SELGROUP_ACCOUNT,17,32,133,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
  23.118 -END
  23.119 -
  23.120 -IDD_PERFORM_INSTALL DIALOGEX 0, 0, 243, 116
  23.121 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CAPTION | WS_SYSMENU
  23.122 -EXSTYLE WS_EX_APPWINDOW
  23.123 -CAPTION "SourceMod Installer"
  23.124 -FONT 8, "MS Shell Dlg", 400, 0, 0x1
  23.125 -BEGIN
  23.126 -    PUSHBUTTON      "&Cancel",ID_INSTALL_CANCEL,2,99,50,14
  23.127 -    GROUPBOX        "",IDC_INSTALL_PANEL,2,3,239,93
  23.128 -    LTEXT           "Click ""Install"" to begin copying the SourceMod files.",IDC_INSTALL_TEXT,9,15,175,13
  23.129 -    CONTROL         "",IDC_PROGRESS_CURRENT,"msctls_progress32",WS_BORDER | 0x1,5,50,232,17
  23.130 -    CONTROL         "",IDC_PROGRESS_TOTAL,"msctls_progress32",WS_BORDER | 0x1,5,73,232,17
  23.131 -    PUSHBUTTON      "&Install",ID_INSTALL_START,191,99,50,14
  23.132 -    LTEXT           "",IDC_PROGRESS_CURCOPY,9,34,175,11
  23.133 -END
  23.134 -
  23.135 -
  23.136 -#ifdef APSTUDIO_INVOKED
  23.137 -/////////////////////////////////////////////////////////////////////////////
  23.138 -//
  23.139 -// TEXTINCLUDE
  23.140 -//
  23.141 -
  23.142 -1 TEXTINCLUDE 
  23.143 -BEGIN
  23.144 -    "resource.h\0"
  23.145 -END
  23.146 -
  23.147 -2 TEXTINCLUDE 
  23.148 -BEGIN
  23.149 -    "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
  23.150 -    "#include ""windows.h""\r\n"
  23.151 -    "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
  23.152 -    "\0"
  23.153 -END
  23.154 -
  23.155 -3 TEXTINCLUDE 
  23.156 -BEGIN
  23.157 -    "\r\n"
  23.158 -    "\0"
  23.159 -END
  23.160 -
  23.161 -#endif    // APSTUDIO_INVOKED
  23.162 -
  23.163 -
  23.164 -/////////////////////////////////////////////////////////////////////////////
  23.165 -//
  23.166 -// DESIGNINFO
  23.167 -//
  23.168 -
  23.169 -#ifdef APSTUDIO_INVOKED
  23.170 -GUIDELINES DESIGNINFO 
  23.171 -BEGIN
  23.172 -    IDD_WELCOME, DIALOG
  23.173 -    BEGIN
  23.174 -        LEFTMARGIN, 2
  23.175 -        RIGHTMARGIN, 241
  23.176 -        TOPMARGIN, 3
  23.177 -        BOTTOMMARGIN, 72
  23.178 -    END
  23.179 -
  23.180 -    IDD_CHOOSE_METHOD, DIALOG
  23.181 -    BEGIN
  23.182 -        LEFTMARGIN, 2
  23.183 -        RIGHTMARGIN, 241
  23.184 -        TOPMARGIN, 3
  23.185 -        BOTTOMMARGIN, 127
  23.186 -    END
  23.187 -
  23.188 -    IDD_PERFORM_INSTALL, DIALOG
  23.189 -    BEGIN
  23.190 -        BOTTOMMARGIN, 113
  23.191 -    END
  23.192 -END
  23.193 -#endif    // APSTUDIO_INVOKED
  23.194 -
  23.195 -
  23.196 -/////////////////////////////////////////////////////////////////////////////
  23.197 -//
  23.198 -// String Table
  23.199 -//
  23.200 -
  23.201 -STRINGTABLE 
  23.202 -BEGIN
  23.203 -    IDS_NO_GAMEINFO         "The folder you selected does not appear to be a valid Half-Life 2 game/mod folder."
  23.204 -    IDS_READONLY_GAMEINFO   "The folder you selected may contain a valid Half-Life 2 game/mod, but its gameinfo.txt is read-only.  You must make it writable to continue."
  23.205 -    IDS_GAME_FAIL_HL1       "A Source dedicated server installation could not be found.  This may occur if you used the standalone server to install HLDS.  Try navigating to the folder manually."
  23.206 -    IDS_GAME_FAIL_READ      "Could not locate a valid Source installation.  Please make sure Steam is installed and its games have been run at least once."
  23.207 -    IDS_GAME_FAIL_NONE      "No Source games or mods were found.  Please make sure that Steam is installed and its games have been run at least once."
  23.208 -    IDS_VERIFY_EXIT         "Are you sure you want to exit?"
  23.209 -END
  23.210 -
  23.211 -#endif    // English (U.S.) resources
  23.212 -/////////////////////////////////////////////////////////////////////////////
  23.213 -
  23.214 -
  23.215 -
  23.216 -#ifndef APSTUDIO_INVOKED
  23.217 -/////////////////////////////////////////////////////////////////////////////
  23.218 -//
  23.219 -// Generated from the TEXTINCLUDE 3 resource.
  23.220 -//
  23.221 -
  23.222 -
  23.223 -/////////////////////////////////////////////////////////////////////////////
  23.224 -#endif    // not APSTUDIO_INVOKED
  23.225 -
    24.1 --- a/tools/installer/installer.sln	Fri Oct 02 02:35:25 2009 -0700
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,20 +0,0 @@
    24.4 -
    24.5 -Microsoft Visual Studio Solution File, Format Version 9.00
    24.6 -# Visual Studio 2005
    24.7 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer.vcproj", "{B2479B33-A265-423B-A996-F994546644F9}"
    24.8 -EndProject
    24.9 -Global
   24.10 -	GlobalSection(SolutionConfigurationPlatforms) = preSolution
   24.11 -		Debug|Win32 = Debug|Win32
   24.12 -		Release|Win32 = Release|Win32
   24.13 -	EndGlobalSection
   24.14 -	GlobalSection(ProjectConfigurationPlatforms) = postSolution
   24.15 -		{B2479B33-A265-423B-A996-F994546644F9}.Debug|Win32.ActiveCfg = Debug|Win32
   24.16 -		{B2479B33-A265-423B-A996-F994546644F9}.Debug|Win32.Build.0 = Debug|Win32
   24.17 -		{B2479B33-A265-423B-A996-F994546644F9}.Release|Win32.ActiveCfg = Release|Win32
   24.18 -		{B2479B33-A265-423B-A996-F994546644F9}.Release|Win32.Build.0 = Release|Win32
   24.19 -	EndGlobalSection
   24.20 -	GlobalSection(SolutionProperties) = preSolution
   24.21 -		HideSolutionNode = FALSE
   24.22 -	EndGlobalSection
   24.23 -EndGlobal
    25.1 --- a/tools/installer/installer.vcproj	Fri Oct 02 02:35:25 2009 -0700
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,298 +0,0 @@
    25.4 -<?xml version="1.0" encoding="Windows-1252"?>
    25.5 -<VisualStudioProject
    25.6 -	ProjectType="Visual C++"
    25.7 -	Version="8.00"
    25.8 -	Name="installer"
    25.9 -	ProjectGUID="{B2479B33-A265-423B-A996-F994546644F9}"
   25.10 -	RootNamespace="installer"
   25.11 -	Keyword="Win32Proj"
   25.12 -	>
   25.13 -	<Platforms>
   25.14 -		<Platform
   25.15 -			Name="Win32"
   25.16 -		/>
   25.17 -	</Platforms>
   25.18 -	<ToolFiles>
   25.19 -	</ToolFiles>
   25.20 -	<Configurations>
   25.21 -		<Configuration
   25.22 -			Name="Debug|Win32"
   25.23 -			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   25.24 -			IntermediateDirectory="$(ConfigurationName)"
   25.25 -			ConfigurationType="1"
   25.26 -			CharacterSet="1"
   25.27 -			>
   25.28 -			<Tool
   25.29 -				Name="VCPreBuildEventTool"
   25.30 -			/>
   25.31 -			<Tool
   25.32 -				Name="VCCustomBuildTool"
   25.33 -			/>
   25.34 -			<Tool
   25.35 -				Name="VCXMLDataGeneratorTool"
   25.36 -			/>
   25.37 -			<Tool
   25.38 -				Name="VCWebServiceProxyGeneratorTool"
   25.39 -			/>
   25.40 -			<Tool
   25.41 -				Name="VCMIDLTool"
   25.42 -			/>
   25.43 -			<Tool
   25.44 -				Name="VCCLCompilerTool"
   25.45 -				Optimization="0"
   25.46 -				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
   25.47 -				MinimalRebuild="true"
   25.48 -				BasicRuntimeChecks="3"
   25.49 -				RuntimeLibrary="1"
   25.50 -				UsePrecompiledHeader="0"
   25.51 -				WarningLevel="3"
   25.52 -				Detect64BitPortabilityProblems="true"
   25.53 -				DebugInformationFormat="4"
   25.54 -			/>
   25.55 -			<Tool
   25.56 -				Name="VCManagedResourceCompilerTool"
   25.57 -			/>
   25.58 -			<Tool
   25.59 -				Name="VCResourceCompilerTool"
   25.60 -			/>
   25.61 -			<Tool
   25.62 -				Name="VCPreLinkEventTool"
   25.63 -			/>
   25.64 -			<Tool
   25.65 -				Name="VCLinkerTool"
   25.66 -				AdditionalDependencies="comctl32.lib"
   25.67 -				LinkIncremental="2"
   25.68 -				GenerateDebugInformation="true"
   25.69 -				SubSystem="2"
   25.70 -				TargetMachine="1"
   25.71 -			/>
   25.72 -			<Tool
   25.73 -				Name="VCALinkTool"
   25.74 -			/>
   25.75 -			<Tool
   25.76 -				Name="VCManifestTool"
   25.77 -			/>
   25.78 -			<Tool
   25.79 -				Name="VCXDCMakeTool"
   25.80 -			/>
   25.81 -			<Tool
   25.82 -				Name="VCBscMakeTool"
   25.83 -			/>
   25.84 -			<Tool
   25.85 -				Name="VCFxCopTool"
   25.86 -			/>
   25.87 -			<Tool
   25.88 -				Name="VCAppVerifierTool"
   25.89 -			/>
   25.90 -			<Tool
   25.91 -				Name="VCWebDeploymentTool"
   25.92 -			/>
   25.93 -			<Tool
   25.94 -				Name="VCPostBuildEventTool"
   25.95 -			/>
   25.96 -		</Configuration>
   25.97 -		<Configuration
   25.98 -			Name="Release|Win32"
   25.99 -			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
  25.100 -			IntermediateDirectory="$(ConfigurationName)"
  25.101 -			ConfigurationType="1"
  25.102 -			CharacterSet="1"
  25.103 -			WholeProgramOptimization="1"
  25.104 -			>
  25.105 -			<Tool
  25.106 -				Name="VCPreBuildEventTool"
  25.107 -			/>
  25.108 -			<Tool
  25.109 -				Name="VCCustomBuildTool"
  25.110 -			/>
  25.111 -			<Tool
  25.112 -				Name="VCXMLDataGeneratorTool"
  25.113 -			/>
  25.114 -			<Tool
  25.115 -				Name="VCWebServiceProxyGeneratorTool"
  25.116 -			/>
  25.117 -			<Tool
  25.118 -				Name="VCMIDLTool"
  25.119 -			/>
  25.120 -			<Tool
  25.121 -				Name="VCCLCompilerTool"
  25.122 -				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
  25.123 -				RuntimeLibrary="2"
  25.124 -				UsePrecompiledHeader="2"
  25.125 -				WarningLevel="3"
  25.126 -				Detect64BitPortabilityProblems="true"
  25.127 -				DebugInformationFormat="3"
  25.128 -			/>
  25.129 -			<Tool
  25.130 -				Name="VCManagedResourceCompilerTool"
  25.131 -			/>
  25.132 -			<Tool
  25.133 -				Name="VCResourceCompilerTool"
  25.134 -			/>
  25.135 -			<Tool
  25.136 -				Name="VCPreLinkEventTool"
  25.137 -			/>
  25.138 -			<Tool
  25.139 -				Name="VCLinkerTool"
  25.140 -				LinkIncremental="1"
  25.141 -				GenerateDebugInformation="true"
  25.142 -				SubSystem="2"
  25.143 -				OptimizeReferences="2"
  25.144 -				EnableCOMDATFolding="2"
  25.145 -				TargetMachine="1"
  25.146 -			/>
  25.147 -			<Tool
  25.148 -				Name="VCALinkTool"
  25.149 -			/>
  25.150 -			<Tool
  25.151 -				Name="VCManifestTool"
  25.152 -			/>
  25.153 -			<Tool
  25.154 -				Name="VCXDCMakeTool"
  25.155 -			/>
  25.156 -			<Tool
  25.157 -				Name="VCBscMakeTool"
  25.158 -			/>
  25.159 -			<Tool
  25.160 -				Name="VCFxCopTool"
  25.161 -			/>
  25.162 -			<Tool
  25.163 -				Name="VCAppVerifierTool"
  25.164 -			/>
  25.165 -			<Tool
  25.166 -				Name="VCWebDeploymentTool"
  25.167 -			/>
  25.168 -			<Tool
  25.169 -				Name="VCPostBuildEventTool"
  25.170 -			/>
  25.171 -		</Configuration>
  25.172 -	</Configurations>
  25.173 -	<References>
  25.174 -	</References>
  25.175 -	<Files>
  25.176 -		<Filter
  25.177 -			Name="Source Files"
  25.178 -			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
  25.179 -			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
  25.180 -			>
  25.181 -			<File
  25.182 -				RelativePath=".\CFileList.cpp"
  25.183 -				>
  25.184 -			</File>
  25.185 -			<File
  25.186 -				RelativePath=".\GamesList.cpp"
  25.187 -				>
  25.188 -			</File>
  25.189 -			<File
  25.190 -				RelativePath=".\InstallerUtil.cpp"
  25.191 -				>
  25.192 -			</File>
  25.193 -			<File
  25.194 -				RelativePath=".\LocalCopyMethod.cpp"
  25.195 -				>
  25.196 -			</File>
  25.197 -		</Filter>
  25.198 -		<Filter
  25.199 -			Name="Header Files"
  25.200 -			Filter="h;hpp;hxx;hm;inl;inc;xsd"
  25.201 -			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
  25.202 -			>
  25.203 -			<File
  25.204 -				RelativePath=".\CCriticalSection.h"
  25.205 -				>
  25.206 -			</File>
  25.207 -			<File
  25.208 -				RelativePath=".\CFileList.h"
  25.209 -				>
  25.210 -			</File>
  25.211 -			<File
  25.212 -				RelativePath=".\GamesList.h"
  25.213 -				>
  25.214 -			</File>
  25.215 -			<File
  25.216 -				RelativePath=".\ICopyMethod.h"
  25.217 -				>
  25.218 -			</File>
  25.219 -			<File
  25.220 -				RelativePath=".\InstallerUtil.h"
  25.221 -				>
  25.222 -			</File>
  25.223 -			<File
  25.224 -				RelativePath=".\LocalCopyMethod.h"
  25.225 -				>
  25.226 -			</File>
  25.227 -			<File
  25.228 -				RelativePath=".\platform_headers.h"
  25.229 -				>
  25.230 -			</File>
  25.231 -			<File
  25.232 -				RelativePath=".\Resource.h"
  25.233 -				>
  25.234 -			</File>
  25.235 -		</Filter>
  25.236 -		<Filter
  25.237 -			Name="Resource Files"
  25.238 -			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
  25.239 -			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
  25.240 -			>
  25.241 -			<File
  25.242 -				RelativePath=".\installer.ico"
  25.243 -				>
  25.244 -			</File>
  25.245 -			<File
  25.246 -				RelativePath=".\installer.rc"
  25.247 -				>
  25.248 -			</File>
  25.249 -		</Filter>
  25.250 -		<Filter
  25.251 -			Name="Window Headers"
  25.252 -			>
  25.253 -			<File
  25.254 -				RelativePath=".\ChooseMethod.h"
  25.255 -				>
  25.256 -			</File>
  25.257 -			<File
  25.258 -				RelativePath=".\InstallerMain.h"
  25.259 -				>
  25.260 -			</File>
  25.261 -			<File
  25.262 -				RelativePath=".\PerformInstall.h"
  25.263 -				>
  25.264 -			</File>
  25.265 -			<File
  25.266 -				RelativePath=".\SelectGame.h"
  25.267 -				>
  25.268 -			</File>
  25.269 -			<File
  25.270 -				RelativePath=".\Welcome.h"
  25.271 -				>
  25.272 -			</File>
  25.273 -		</Filter>
  25.274 -		<Filter
  25.275 -			Name="Window Source"
  25.276 -			>
  25.277 -			<File
  25.278 -				RelativePath=".\ChooseMethod.cpp"
  25.279 -				>
  25.280 -			</File>
  25.281 -			<File
  25.282 -				RelativePath=".\InstallerMain.cpp"
  25.283 -				>
  25.284 -			</File>
  25.285 -			<File
  25.286 -				RelativePath=".\PerformInstall.cpp"
  25.287 -				>
  25.288 -			</File>
  25.289 -			<File
  25.290 -				RelativePath=".\SelectGame.cpp"
  25.291 -				>
  25.292 -			</File>
  25.293 -			<File
  25.294 -				RelativePath=".\Welcome.cpp"
  25.295 -				>
  25.296 -			</File>
  25.297 -		</Filter>
  25.298 -	</Files>
  25.299 -	<Globals>
  25.300 -	</Globals>
  25.301 -</VisualStudioProject>
    26.1 --- a/tools/installer/platform_headers.h	Fri Oct 02 02:35:25 2009 -0700
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,33 +0,0 @@
    26.4 -#ifndef _INCLUDE_INSTALLER_PLATFORM_HEADERS_H_
    26.5 -#define _INCLUDE_INSTALLER_PLATFORM_HEADERS_H_
    26.6 -
    26.7 -// Refer to MSDN for the latest info on corresponding values for different platforms.
    26.8 -#ifndef WINVER				// Allow use of features specific to Windows XP or later.
    26.9 -#define WINVER 0x0501		// Change this to the appropriate value to target other versions of Windows.
   26.10 -#endif
   26.11 -
   26.12 -#ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   
   26.13 -#define _WIN32_WINNT 0x0501	// Change this to the appropriate value to target other versions of Windows.
   26.14 -#endif						
   26.15 -
   26.16 -#ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
   26.17 -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
   26.18 -#endif
   26.19 -
   26.20 -#ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.
   26.21 -#define _WIN32_IE 0x0600	// Change this to the appropriate value to target other versions of IE.
   26.22 -#endif
   26.23 -
   26.24 -#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
   26.25 -// Windows Header Files:
   26.26 -#include <windows.h>
   26.27 -
   26.28 -// C RunTime Header Files
   26.29 -#include <stdlib.h>
   26.30 -#include <malloc.h>
   26.31 -#include <memory.h>
   26.32 -#include <tchar.h>
   26.33 -#include <commctrl.h>
   26.34 -#include <shlobj.h>
   26.35 -
   26.36 -#endif //_INCLUDE_INSTALLER_PLATFORM_HEADERS_H_