From 3f264097a76ea17d992113a0e86915cbcd76f550 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 2 Oct 2009 03:30:54 -0700 Subject: [PATCH] Removed unused files. --- tools/installer/CCriticalSection.h | 37 -- tools/installer/CFileList.cpp | 151 -------- tools/installer/CFileList.h | 40 -- tools/installer/ChooseMethod.cpp | 235 ------------ tools/installer/ChooseMethod.h | 11 - tools/installer/GamesList.cpp | 574 ---------------------------- tools/installer/GamesList.h | 72 ---- tools/installer/ICopyMethod.h | 25 -- tools/installer/InstallerMain.cpp | 142 ------- tools/installer/InstallerMain.h | 14 - tools/installer/InstallerUtil.cpp | 312 --------------- tools/installer/InstallerUtil.h | 20 - tools/installer/LocalCopyMethod.cpp | 167 -------- tools/installer/LocalCopyMethod.h | 29 -- tools/installer/PerformInstall.cpp | 438 --------------------- tools/installer/PerformInstall.h | 22 -- tools/installer/Resource.h | 65 ---- tools/installer/SelectGame.cpp | 169 -------- tools/installer/SelectGame.h | 8 - tools/installer/Welcome.cpp | 60 --- tools/installer/Welcome.h | 6 - tools/installer/installer.ico | Bin 23558 -> 0 bytes tools/installer/installer.rc | 222 ----------- tools/installer/installer.sln | 20 - tools/installer/installer.vcproj | 298 --------------- tools/installer/platform_headers.h | 33 -- 26 files changed, 3170 deletions(-) delete mode 100644 tools/installer/CCriticalSection.h delete mode 100644 tools/installer/CFileList.cpp delete mode 100644 tools/installer/CFileList.h delete mode 100644 tools/installer/ChooseMethod.cpp delete mode 100644 tools/installer/ChooseMethod.h delete mode 100644 tools/installer/GamesList.cpp delete mode 100644 tools/installer/GamesList.h delete mode 100644 tools/installer/ICopyMethod.h delete mode 100644 tools/installer/InstallerMain.cpp delete mode 100644 tools/installer/InstallerMain.h delete mode 100644 tools/installer/InstallerUtil.cpp delete mode 100644 tools/installer/InstallerUtil.h delete mode 100644 tools/installer/LocalCopyMethod.cpp delete mode 100644 tools/installer/LocalCopyMethod.h delete mode 100644 tools/installer/PerformInstall.cpp delete mode 100644 tools/installer/PerformInstall.h delete mode 100644 tools/installer/Resource.h delete mode 100644 tools/installer/SelectGame.cpp delete mode 100644 tools/installer/SelectGame.h delete mode 100644 tools/installer/Welcome.cpp delete mode 100644 tools/installer/Welcome.h delete mode 100644 tools/installer/installer.ico delete mode 100644 tools/installer/installer.rc delete mode 100644 tools/installer/installer.sln delete mode 100644 tools/installer/installer.vcproj delete mode 100644 tools/installer/platform_headers.h diff --git a/tools/installer/CCriticalSection.h b/tools/installer/CCriticalSection.h deleted file mode 100644 index bd54dae0..00000000 --- a/tools/installer/CCriticalSection.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_CRIT_SECT_H_ -#define _INCLUDE_INSTALLER_CRIT_SECT_H_ - -#include "platform_headers.h" - -class CCriticalSection -{ -public: - CCriticalSection() - { - InitializeCriticalSection(&m_crit); - } - ~CCriticalSection() - { - DeleteCriticalSection(&m_crit); - } - void Enter() - { - EnterCriticalSection(&m_crit); - } - bool TryEnter() - { - if (TryEnterCriticalSection(&m_crit)) - { - return true; - } - return false; - } - void Leave() - { - LeaveCriticalSection(&m_crit); - } -private: - CRITICAL_SECTION m_crit; -}; - -#endif //_INCLUDE_INSTALLER_CRIT_SECT_H_ diff --git a/tools/installer/CFileList.cpp b/tools/installer/CFileList.cpp deleted file mode 100644 index a11f5a34..00000000 --- a/tools/installer/CFileList.cpp +++ /dev/null @@ -1,151 +0,0 @@ -#include "CFileList.h" -#include "InstallerUtil.h" - -using namespace std; - -CFileList::CFileList(const TCHAR *name) : m_TotalSize(0), m_RecursiveSize(0), - m_bGotRecursiveSize(false) -{ - UTIL_Format(m_FolderName, sizeof(m_FolderName) / sizeof(TCHAR), _T("%s"), name); -} - -CFileList::~CFileList() -{ - list::iterator iter; - - for (iter = m_folder_list.begin(); - iter != m_folder_list.end(); - iter++) - { - delete (*iter); - } -} - -const TCHAR *CFileList::GetFolderName() -{ - return m_FolderName; -} - -void CFileList::AddFolder(CFileList *pFileList) -{ - m_folder_list.push_back(pFileList); -} - -void CFileList::AddFile(const TCHAR *name, unsigned __int64 size) -{ - CFileListEntry entry; - - UTIL_Format(entry.file, sizeof(entry.file) / sizeof(TCHAR), _T("%s"), name); - entry.size = size; - - m_file_list.push_back(entry); - m_TotalSize += size; -} - -unsigned __int64 CFileList::GetRecursiveSize() -{ - if (m_bGotRecursiveSize) - { - return m_RecursiveSize; - } - - m_RecursiveSize = m_TotalSize; - - list::iterator iter; - for (iter = m_folder_list.begin(); iter != m_folder_list.end(); iter++) - { - m_RecursiveSize += (*iter)->GetRecursiveSize(); - } - - m_bGotRecursiveSize = true; - - return m_RecursiveSize; -} - -const TCHAR *CFileList::PeekCurrentFile() -{ - if (m_file_list.empty()) - { - return NULL; - } - - return m_file_list.begin()->file; -} - -void CFileList::PopCurrentFile() -{ - m_file_list.erase(m_file_list.begin()); -} - -CFileList *CFileList::PeekCurrentFolder() -{ - if (m_folder_list.empty()) - { - return NULL; - } - - return *(m_folder_list.begin()); -} - -void CFileList::PopCurrentFolder() -{ - m_folder_list.erase(m_folder_list.begin()); -} - -void RecursiveBuildFileList(CFileList *file_list, const TCHAR *current_folder) -{ - HANDLE hFind; - WIN32_FIND_DATA fd; - TCHAR path[MAX_PATH]; - - UTIL_PathFormat(path, sizeof(path) / sizeof(TCHAR), _T("%s\\*.*"), current_folder); - - if ((hFind = FindFirstFile(path, &fd)) == INVALID_HANDLE_VALUE) - { - return; - } - - do - { - if (tstrcasecmp(fd.cFileName, _T(".")) == 0 - || tstrcasecmp(fd.cFileName, _T("..")) == 0) - { - continue; - } - - if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) - { - CFileList *pSubList = new CFileList(fd.cFileName); - - UTIL_PathFormat(path, - sizeof(path) / sizeof(TCHAR), - _T("%s\\%s"), - current_folder, - fd.cFileName); - - RecursiveBuildFileList(pSubList, path); - - file_list->AddFolder(pSubList); - } - else - { - LARGE_INTEGER li; - - li.LowPart = fd.nFileSizeLow; - li.HighPart = fd.nFileSizeHigh; - - file_list->AddFile(fd.cFileName, li.QuadPart); - } - } while (FindNextFile(hFind, &fd)); - - FindClose(hFind); -} - -CFileList *CFileList::BuildFileList(const TCHAR *name, const TCHAR *root_folder) -{ - CFileList *pFileList = new CFileList(name); - - RecursiveBuildFileList(pFileList, root_folder); - - return pFileList; -} diff --git a/tools/installer/CFileList.h b/tools/installer/CFileList.h deleted file mode 100644 index 9f7af183..00000000 --- a/tools/installer/CFileList.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _INCLUDE_FOLDER_LIST_H_ -#define _INCLUDE_FOLDER_LIST_H_ - -#include "platform_headers.h" -#include -#include - -struct CFileListEntry -{ - TCHAR file[MAX_PATH]; - unsigned __int64 size; -}; - -class CFileList -{ -public: - CFileList(const TCHAR *name); - ~CFileList(); -public: - CFileList *PeekCurrentFolder(); - void PopCurrentFolder(); - const TCHAR *PeekCurrentFile(); - void PopCurrentFile(); - const TCHAR *GetFolderName(); -public: - void AddFolder(CFileList *pFileList); - void AddFile(const TCHAR *name, unsigned __int64 size); - unsigned __int64 GetRecursiveSize(); -public: - static CFileList *BuildFileList(const TCHAR *name, const TCHAR *root_folder); -private: - std::list m_folder_list; - std::list m_file_list; - TCHAR m_FolderName[MAX_PATH]; - unsigned __int64 m_TotalSize; - unsigned __int64 m_RecursiveSize; - bool m_bGotRecursiveSize; -}; - -#endif //_INCLUDE_FOLDER_LIST_H_ diff --git a/tools/installer/ChooseMethod.cpp b/tools/installer/ChooseMethod.cpp deleted file mode 100644 index fa3fb2da..00000000 --- a/tools/installer/ChooseMethod.cpp +++ /dev/null @@ -1,235 +0,0 @@ -#include "InstallerMain.h" -#include "InstallerUtil.h" -#include "ChooseMethod.h" -#include "Welcome.h" -#include "GamesList.h" -#include "SelectGame.h" -#include "PerformInstall.h" -#include "LocalCopyMethod.h" - -game_group_t *g_game_group = NULL; -unsigned int method_chosen = 0; -TCHAR method_path[MAX_PATH]; - -bool SelectFolder(HWND hOwner) -{ - BROWSEINFO info; - LPITEMIDLIST pidlist; - TCHAR path[MAX_PATH]; - - if (FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) - { - return false; - } - - info.hwndOwner = hOwner; - info.pidlRoot = NULL; - info.pszDisplayName = path; - info.lpszTitle = _T("Select a game/mod folder"); - info.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE; - info.lpfn = NULL; - info.lParam = 0; - info.iImage = 0; - - if ((pidlist = SHBrowseForFolder(&info)) == NULL) - { - CoUninitialize(); - return false; - } - - /* This hellish code is from MSDN and translate shortcuts to real targets. - * God almighty, I wish Window used real symlinks. - */ - bool acquire_success = false; - bool is_link = false; - IShellFolder *psf = NULL; - LPCITEMIDLIST new_item_list; - HRESULT hr; - - hr = SHBindToParent(pidlist, IID_IShellFolder, (void **)&psf, &new_item_list); - if (SUCCEEDED(hr)) - { - IShellLink *psl = NULL; - - hr = psf->GetUIObjectOf(hOwner, 1, &new_item_list, IID_IShellLink, NULL, (void **)&psl); - if (SUCCEEDED(hr)) - { - LPITEMIDLIST new_item_list; - - hr = psl->GetIDList(&new_item_list); - if (SUCCEEDED(hr)) - { - is_link = true; - - hr = SHGetPathFromIDList(new_item_list, method_path); - if (SUCCEEDED(hr)) - { - acquire_success = true; - } - - CoTaskMemFree(new_item_list); - } - psl->Release(); - } - psf->Release(); - } - - if (!acquire_success && !is_link) - { - hr = SHGetPathFromIDList(pidlist, method_path); - if (SUCCEEDED(hr)) - { - acquire_success = true; - } - } - - /* That was awful. shoo, shoo, COM */ - CoTaskMemFree(pidlist); - CoUninitialize(); - - return acquire_success; -} - -INT_PTR CALLBACK ChooseMethodHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_COMMAND: - { - if (LOWORD(wParam) == ID_METHOD_BACK) - { - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, (INT_PTR)DisplayWelcome); - return (INT_PTR)TRUE; - } - else if (LOWORD(wParam) == ID_METHOD_EXIT - || LOWORD(wParam) == ID_CLOSE) - { - return AskToExit(hDlg); - } - else if (LOWORD(wParam) == IDC_METHOD_DED_SERVER - || LOWORD(wParam) == IDC_METHOD_ALONE_SERVER - || LOWORD(wParam) == IDC_METHOD_LISTEN_SERVER - || LOWORD(wParam) == IDC_METHOD_UPLOAD_FTP - || LOWORD(wParam) == IDC_METHOD_CUSTOM_FOLDER) - { - method_chosen = LOWORD(wParam); - HWND button = GetDlgItem(hDlg, ID_METHOD_NEXT); - EnableWindow(button, TRUE); - break; - } - else if (LOWORD(wParam) == ID_METHOD_NEXT) - { - unsigned int game_type = 0; - - switch (method_chosen) - { - case IDC_METHOD_DED_SERVER: - { - game_type = GAMES_DEDICATED; - break; - } - case IDC_METHOD_ALONE_SERVER: - { - game_type = GAMES_STANDALONE; - break; - } - case IDC_METHOD_LISTEN_SERVER: - { - game_type = GAMES_LISTEN; - break; - } - case IDC_METHOD_UPLOAD_FTP: - { - break; - } - case IDC_METHOD_CUSTOM_FOLDER: - { - int val; - - if (!SelectFolder(hDlg)) - { - break; - } - - val = IsValidFolder(method_path); - if (val != GAMEINFO_IS_USABLE) - { - DisplayBadFolderDialog(hDlg, val); - break; - } - - g_LocalCopier.SetOutputPath(method_path); - SetInstallMethod(&g_LocalCopier); - - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, (INT_PTR)DisplayPerformInstall); - } - } - - if (game_type != 0) - { - g_game_group = NULL; - - BuildGameDB(); - - if (game_type == GAMES_DEDICATED) - { - g_game_group = &g_games.dedicated; - } - else if (game_type == GAMES_LISTEN) - { - g_game_group = &g_games.listen; - } - else if (game_type == GAMES_STANDALONE) - { - g_game_group = &g_games.standalone; - } - - if (g_game_group == NULL) - { - return (INT_PTR)TRUE; - } - - if (g_game_group->list_count == 0) - { - DisplayBadGamesDialog(hDlg, g_game_group->error_code); - return (INT_PTR)TRUE; - } - - /* If we got a valid games list, we can display the next - * dialog box. - */ - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, (INT_PTR)DisplaySelectGame); - return (INT_PTR)TRUE; - } - } - break; - } - case WM_INITDIALOG: - { - SetToGlobalPosition(hDlg); - return (INT_PTR)TRUE; - } - } - - return (INT_PTR)FALSE; -} - -void *DisplayChooseMethod(HWND hWnd) -{ - INT_PTR val; - - if ((val = DialogBox( - g_hInstance, - MAKEINTRESOURCE(IDD_CHOOSE_METHOD), - hWnd, - ChooseMethodHandler)) == -1) - { - return NULL; - } - - return (void *)val; -} - diff --git a/tools/installer/ChooseMethod.h b/tools/installer/ChooseMethod.h deleted file mode 100644 index 4b1f2b21..00000000 --- a/tools/installer/ChooseMethod.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_CHOOSE_METHOD_H_ -#define _INCLUDE_INSTALLER_CHOOSE_METHOD_H_ - -#include "InstallerMain.h" -#include "GamesList.h" - -void *DisplayChooseMethod(HWND hWnd); - -extern game_group_t *g_game_group; - -#endif //_INCLUDE_INSTALLER_CHOOSE_METHOD_H_ diff --git a/tools/installer/GamesList.cpp b/tools/installer/GamesList.cpp deleted file mode 100644 index 340b8fc3..00000000 --- a/tools/installer/GamesList.cpp +++ /dev/null @@ -1,574 +0,0 @@ -#include "GamesList.h" -#include "InstallerUtil.h" -#include "InstallerMain.h" -#include - -game_database_t g_games = -{ - NULL, 0, - {NULL, 0, GAME_LIST_NO_GAMES}, - {NULL, 0, GAME_LIST_NO_GAMES}, - {NULL, 0, GAME_LIST_NO_GAMES} -}; - -valve_game_t valve_game_list[] = -{ - {_T("counter-strike source"), _T("cstrike"), SOURCE_ENGINE_2004}, - {_T("day of defeat source"), _T("dod"), SOURCE_ENGINE_2004}, - {_T("half-life 2 deathmatch"), _T("hl2mp"), SOURCE_ENGINE_2004}, - {_T("half-life deathmatch source"), _T("hl1mp"), SOURCE_ENGINE_2004}, - {_T("team fortress 2"), _T("tf"), SOURCE_ENGINE_2007}, - {NULL, NULL, 0}, -}; - -valve_game_t valve_server_list[] = -{ - {_T("source dedicated server"), NULL, SOURCE_ENGINE_2004}, - {_T("source 2007 dedicated server"), NULL, SOURCE_ENGINE_2007}, - {NULL, NULL, 0}, -}; - -int IsValidFolder(const TCHAR *path) -{ - DWORD attr; - TCHAR gameinfo_file[MAX_PATH]; - - UTIL_PathFormat(gameinfo_file, sizeof(gameinfo_file), _T("%s\\gameinfo.txt"), path); - - if ((attr = GetFileAttributes(gameinfo_file)) == INVALID_FILE_ATTRIBUTES) - { - return GAMEINFO_DOES_NOT_EXIST; - } - - if ((attr & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY) - { - return GAMEINFO_IS_READ_ONLY; - } - - if ((attr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) - { - return GAMEINFO_DOES_NOT_EXIST; - } - - return GAMEINFO_IS_USABLE; -} - -void DisplayBadFolderDialog(HWND hDlg, int reason) -{ - TCHAR message_string[255]; - UINT resource; - - if (reason == GAMEINFO_DOES_NOT_EXIST) - { - resource = IDS_NO_GAMEINFO; - } - else if (reason == GAMEINFO_IS_READ_ONLY) - { - resource = IDS_READONLY_GAMEINFO; - } - else - { - return; - } - - if (LoadString(g_hInstance, - resource, - message_string, - sizeof(message_string) / sizeof(TCHAR) - ) == 0) - { - return; - } - - MessageBox(hDlg, - message_string, - _T("SourceMod Installer"), - MB_OK|MB_ICONWARNING); -} - -game_list_t *MakeGameList(const TCHAR *name) -{ - game_list_t *gl = (game_list_t *)malloc(sizeof(game_list_t)); - - UTIL_Format(gl->root_name, - sizeof(gl->root_name) / sizeof(TCHAR), - _T("%s"), - name); - gl->game_count = 0; - gl->games = NULL; - - return gl; -} - -void AttachGameListToGroup(game_group_t *group, game_list_t *gl) -{ - if (group->lists == NULL) - { - group->lists = (game_list_t **)malloc(sizeof(game_list_t *)); - } - else - { - group->lists = (game_list_t **)realloc(group->lists, - sizeof(game_list_t *) * (group->list_count + 1)); - } - - group->lists[group->list_count] = gl; - group->list_count++; -} - -void AttachModToGameList(game_list_t *gl, unsigned int mod_id) -{ - if (gl->games == NULL) - { - gl->games = (unsigned int *)malloc(sizeof(unsigned int)); - } - else - { - gl->games = (unsigned int *)realloc(gl->games, - sizeof(unsigned int) * (gl->game_count + 1)); - } - - gl->games[gl->game_count] = mod_id; - gl->game_count++; -} - -unsigned int AddModToList(game_database_t *db, const game_info_t *mod_info) -{ - /* Check if a matching game already exists */ - for (unsigned int i = 0; i < db->game_count; i++) - { - if (tstrcasecmp(mod_info->game_path, db->game_list[i].game_path) == 0) - { - return i; - } - } - - if (db->game_list == NULL) - { - db->game_list = (game_info_t *)malloc(sizeof(game_info_t)); - } - else - { - db->game_list = (game_info_t *)realloc(db->game_list, - sizeof(game_info_t) * (db->game_count + 1)); - } - - memcpy(&db->game_list[db->game_count], mod_info, sizeof(game_info_t)); - db->game_count++; - - return db->game_count - 1; -} - -bool TryToAddMod(const TCHAR *path, int eng_type, game_database_t *db, unsigned int *id) -{ - FILE *fp; - TCHAR gameinfo_path[MAX_PATH]; - - UTIL_PathFormat(gameinfo_path, - sizeof(gameinfo_path), - _T("%s\\gameinfo.txt"), - path); - - if ((fp = _tfopen(gameinfo_path, _T("rt"))) == NULL) - { - return false; - } - - int pos; - char buffer[512]; - char key[256], value[256]; - while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL) - { - if ((pos = BreakStringA(buffer, key, sizeof(key))) == -1) - { - continue; - } - if ((pos = BreakStringA(&buffer[pos], value, sizeof(value))) == -1) - { - continue; - } - if (strcmp(key, "game") == 0) - { - game_info_t mod; - unsigned int got_id; - - AnsiToUnicode(value, mod.name, sizeof(mod.name)); - UTIL_Format(mod.game_path, sizeof(mod.game_path), _T("%s"), path); - mod.source_engine = eng_type; - - got_id = AddModToList(db, &mod); - - if (id != NULL) - { - *id = got_id; - } - - fclose(fp); - - return true; - } - } - - fclose(fp); - - return false; -} - -void AddModsFromFolder(const TCHAR *path, - int eng_type, - game_database_t *db, - game_list_t *gl) -{ - HANDLE hFind; - WIN32_FIND_DATA fd; - TCHAR temp_path[MAX_PATH]; - TCHAR search_path[MAX_PATH]; - unsigned int mod_id; - - UTIL_Format(search_path, - sizeof(search_path), - _T("%s\\*.*"), - path); - - if ((hFind = FindFirstFile(search_path, &fd)) == INVALID_HANDLE_VALUE) - { - return; - } - - do - { - if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) - { - continue; - } - - if (tstrcasecmp(fd.cFileName, _T(".")) == 0 - || tstrcasecmp(fd.cFileName, _T("..")) == 0) - { - continue; - } - - UTIL_PathFormat(temp_path, - sizeof(temp_path), - _T("%s\\%s"), - path, - fd.cFileName); - if (TryToAddMod(temp_path, eng_type, db, &mod_id)) - { - AttachModToGameList(gl, mod_id); - } - } while (FindNextFile(hFind, &fd)); - - FindClose(hFind); -} - -void GetSteamGames(game_database_t *db) -{ - HKEY hkPath; - DWORD dwLen, dwType; - HANDLE hFind; - WIN32_FIND_DATA fd; - TCHAR temp_path[MAX_PATH]; - TCHAR steam_path[MAX_PATH]; - TCHAR steamapps_path[MAX_PATH]; - - if (RegOpenKeyEx(HKEY_CURRENT_USER, - _T("Software\\Valve\\Steam"), - 0, - KEY_READ, - &hkPath) != ERROR_SUCCESS) - { - db->listen.error_code = GAME_LIST_CANT_READ; - db->dedicated.error_code = GAME_LIST_CANT_READ; - return; - } - - dwLen = sizeof(steam_path) / sizeof(TCHAR); - if (RegQueryValueEx(hkPath, - _T("SteamPath"), - NULL, - &dwType, - (LPBYTE)steam_path, - &dwLen) != ERROR_SUCCESS) - { - RegCloseKey(hkPath); - db->listen.error_code = GAME_LIST_CANT_READ; - db->dedicated.error_code = GAME_LIST_CANT_READ; - return; - } - - UTIL_PathFormat(steamapps_path, - sizeof(steamapps_path) / sizeof(TCHAR), - _T("%s\\steamapps\\*.*"), - steam_path); - - if ((hFind = FindFirstFile(steamapps_path, &fd)) == INVALID_HANDLE_VALUE) - { - RegCloseKey(hkPath); - db->listen.error_code = GAME_LIST_CANT_READ; - db->dedicated.error_code = GAME_LIST_CANT_READ; - return; - } - - do - { - if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) - { - continue; - } - - if (tstrcasecmp(fd.cFileName, _T(".")) == 0 - || tstrcasecmp(fd.cFileName, _T("..")) == 0) - { - continue; - } - - /* If we get a folder called "SourceMods," look for third party mods */ - if (tstrcasecmp(fd.cFileName, _T("SourceMods")) == 0) - { - game_list_t *gl = MakeGameList(_T("Third-Party Games")); - - UTIL_PathFormat(temp_path, - sizeof(temp_path) / sizeof(TCHAR), - _T("%s\\steamapps\\%s"), - steam_path, - fd.cFileName); - - AddModsFromFolder(temp_path, SOURCE_ENGINE_UNKNOWN, db, gl); - - if (gl->game_count) - { - AttachGameListToGroup(&db->listen, gl); - } - else - { - free(gl); - } - } - else - { - /* Look for listenserver games */ - game_list_t *gl = MakeGameList(fd.cFileName); - - for (unsigned int i = 0; valve_game_list[i].folder != NULL; i++) - { - unsigned int mod_id; - UTIL_PathFormat(temp_path, - sizeof(temp_path) / sizeof(TCHAR), - _T("%s\\steamapps\\%s\\%s\\%s"), - steam_path, - fd.cFileName, - valve_game_list[i].folder, - valve_game_list[i].subfolder); - if (TryToAddMod(temp_path, valve_game_list[i].eng_type, db, &mod_id)) - { - AttachModToGameList(gl, mod_id); - } - } - - if (gl->game_count) - { - AttachGameListToGroup(&db->listen, gl); - } - else - { - free(gl); - } - - /* Look for dedicated games */ - gl = MakeGameList(fd.cFileName); - - for (unsigned int i = 0; valve_server_list[i].folder != NULL; i++) - { - UTIL_PathFormat(temp_path, - sizeof(temp_path) / sizeof(TCHAR), - _T("%s\\steamapps\\%s\\%s"), - steam_path, - fd.cFileName, - valve_server_list[i].folder); - AddModsFromFolder(temp_path, valve_server_list[i].eng_type, db, gl); - } - - if (gl->game_count) - { - AttachGameListToGroup(&db->dedicated, gl); - } - else - { - free(gl); - } - } - - } while (FindNextFile(hFind, &fd)); - - FindClose(hFind); - RegCloseKey(hkPath); -} - -void GetStandaloneGames(game_database_t *db) -{ - HKEY hkPath; - DWORD dwLen, dwType, dwAttr; - TCHAR temp_path[MAX_PATH]; - TCHAR hlds_path[MAX_PATH]; - game_list_t *games_standalone; - - if (RegOpenKeyEx(HKEY_CURRENT_USER, - _T("Software\\Valve\\HLServer"), - 0, - KEY_READ, - &hkPath) != ERROR_SUCCESS) - { - db->standalone.error_code = GAME_LIST_CANT_READ; - return; - } - - dwLen = sizeof(hlds_path) / sizeof(TCHAR); - if (RegQueryValueEx(hkPath, - _T("InstallPath"), - NULL, - &dwType, - (LPBYTE)hlds_path, - &dwLen) != ERROR_SUCCESS) - { - RegCloseKey(hkPath); - db->standalone.error_code = GAME_LIST_CANT_READ; - return; - } - - /* Make sure there is a "srcds.exe" file */ - UTIL_PathFormat(temp_path, - sizeof(temp_path) / sizeof(TCHAR), - _T("%s\\srcds.exe"), - hlds_path); - dwAttr = GetFileAttributes(temp_path); - if (dwAttr == INVALID_FILE_ATTRIBUTES) - { - db->standalone.error_code = GAME_LIST_HALFLIFE1; - return; - } - - games_standalone = MakeGameList(_T("Standalone")); - - /* If there is an "orangebox" sub folder, we can make a better guess - * at the engine state. - */ - UTIL_PathFormat(temp_path, - sizeof(temp_path) / sizeof(TCHAR), - _T("%s\\orangebox"), - hlds_path); - dwAttr = GetFileAttributes(temp_path); - if (dwAttr != INVALID_FILE_ATTRIBUTES - && ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) - { - AddModsFromFolder(temp_path, SOURCE_ENGINE_2007, db, games_standalone); - } - - /* Add everything from the server */ - AddModsFromFolder(hlds_path, SOURCE_ENGINE_2004, db, games_standalone); - - if (games_standalone->game_count) - { - AttachGameListToGroup(&db->standalone, games_standalone); - } - else - { - free(games_standalone); - } - - RegCloseKey(hkPath); -} - -void DisplayBadGamesDialog(HWND hWnd, int reason) -{ - TCHAR message[256]; - UINT idc = 0; - - if (reason == GAME_LIST_CANT_READ) - { - idc = IDS_GAME_FAIL_READ; - } - else if (reason == GAME_LIST_HALFLIFE1) - { - idc = IDS_GAME_FAIL_HL1; - } - else if (reason == GAME_LIST_NO_GAMES) - { - idc = IDS_GAME_FAIL_NONE; - } - else - { - return; - } - - if (LoadString(g_hInstance, - idc, - message, - sizeof(message) / sizeof(TCHAR)) == 0) - { - return; - } - - MessageBox(hWnd, - message, - _T("SourceMod Installer"), - MB_OK|MB_ICONWARNING); -} - -int _ModIdCompare(const void *item1, const void *item2) -{ - unsigned int mod_id1 = *(unsigned int *)item1; - unsigned int mod_id2 = *(unsigned int *)item2; - - return tstrcasecmp(g_games.game_list[mod_id1].name, g_games.game_list[mod_id2].name); -} - -int _GroupCompare(const void *item1, const void *item2) -{ - game_list_t *g1 = *(game_list_t **)item1; - game_list_t *g2 = *(game_list_t **)item2; - - return tstrcasecmp(g1->root_name, g2->root_name); -} - -void SortGameGroup(game_group_t *group) -{ - qsort(group->lists, group->list_count, sizeof(game_list_t *), _GroupCompare); - - for (unsigned int i = 0; i < group->list_count; i++) - { - qsort(group->lists[i]->games, - group->lists[i]->game_count, - sizeof(unsigned int), - _ModIdCompare); - } -} - -void BuildGameDB() -{ - ReleaseGameDB(); - GetStandaloneGames(&g_games); - GetSteamGames(&g_games); - SortGameGroup(&g_games.dedicated); - SortGameGroup(&g_games.listen); - SortGameGroup(&g_games.standalone); -} - -void ReleaseGameGroup(game_group_t *group) -{ - for (unsigned int i = 0; i < group->list_count; i++) - { - free(group->lists[i]->games); - free(group->lists[i]); - } - free(group->lists); -} - -void ReleaseGameDB() -{ - ReleaseGameGroup(&g_games.dedicated); - ReleaseGameGroup(&g_games.listen); - ReleaseGameGroup(&g_games.standalone); - free(g_games.game_list); - memset(&g_games, 0, sizeof(g_games)); -} diff --git a/tools/installer/GamesList.h b/tools/installer/GamesList.h deleted file mode 100644 index 2242575a..00000000 --- a/tools/installer/GamesList.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_GAMES_LIST_H_ -#define _INCLUDE_INSTALLER_GAMES_LIST_H_ - -#include "platform_headers.h" - -#define GAMEINFO_IS_USABLE 0 -#define GAMEINFO_DOES_NOT_EXIST 1 -#define GAMEINFO_IS_READ_ONLY 2 - -#define GAME_LIST_HALFLIFE1 -2 -#define GAME_LIST_CANT_READ -1 -#define GAME_LIST_NO_GAMES 0 - -#define GAMES_DEDICATED 1 -#define GAMES_LISTEN 2 -#define GAMES_STANDALONE 3 - -#define SOURCE_ENGINE_UNKNOWN 0 -#define SOURCE_ENGINE_2004 1 -#define SOURCE_ENGINE_2007 2 - -struct valve_game_t -{ - const TCHAR *folder; - const TCHAR *subfolder; - int eng_type; -}; - -/* One game */ -struct game_info_t -{ - TCHAR name[128]; - TCHAR game_path[MAX_PATH]; - int source_engine; -}; - -/* A list of games under one "account" */ -struct game_list_t -{ - TCHAR root_name[128]; - unsigned int *games; - unsigned int game_count; -}; - -/* A list of accounts */ -struct game_group_t -{ - game_list_t **lists; - unsigned int list_count; - int error_code; -}; - -/* All games on the system */ -struct game_database_t -{ - game_info_t *game_list; - unsigned int game_count; - game_group_t dedicated; - game_group_t listen; - game_group_t standalone; -}; - -int IsValidFolder(const TCHAR *path); -void DisplayBadFolderDialog(HWND hWnd, int reason); - -void BuildGameDB(); -void ReleaseGameDB(); -void DisplayBadGamesDialog(HWND hWnd, int reason); - -extern game_database_t g_games; - -#endif //_INCLUDE_INSTALLER_GAMES_LIST_H_ diff --git a/tools/installer/ICopyMethod.h b/tools/installer/ICopyMethod.h deleted file mode 100644 index cd1c0e03..00000000 --- a/tools/installer/ICopyMethod.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_COPY_METHOD_H_ -#define _INCLUDE_INSTALLER_COPY_METHOD_H_ - -#include "platform_headers.h" - -class ICopyProgress -{ -public: - virtual void StartingNewFile(const TCHAR *filename) =0; - virtual void UpdateProgress(size_t bytes, size_t total_bytes) =0; - virtual void FileDone(size_t file_size) =0; -}; - -class ICopyMethod -{ -public: - virtual bool CheckForExistingInstall() =0; - virtual void TrackProgress(ICopyProgress *pProgress) =0; - virtual bool SetCurrentFolder(const TCHAR *path, TCHAR *buffer, size_t maxchars) =0; - virtual bool SendFile(const TCHAR *path, TCHAR *buffer, size_t maxchars) =0; - virtual bool CreateFolder(const TCHAR *name, TCHAR *buffer, size_t maxchars) =0; - virtual void CancelCurrentCopy() =0; -}; - -#endif //_INCLUDE_INSTALLER_COPY_METHOD_H_ diff --git a/tools/installer/InstallerMain.cpp b/tools/installer/InstallerMain.cpp deleted file mode 100644 index 3c18f5a7..00000000 --- a/tools/installer/InstallerMain.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include "InstallerMain.h" -#include "Welcome.h" - -#define WMU_INIT_INSTALLER WM_USER+1 - -HINSTANCE g_hInstance; -NEXT_DIALOG next_dialog = DisplayWelcome; -POINT g_GlobalPosition; - -void UpdateGlobalPosition(HWND hWnd) -{ - WINDOWINFO wi; - - wi.cbSize = sizeof(WINDOWINFO); - if (GetWindowInfo(hWnd, &wi)) - { - g_GlobalPosition.x = wi.rcWindow.left; - g_GlobalPosition.y = wi.rcWindow.top; - } -} - -void SetToGlobalPosition(HWND hWnd) -{ - WINDOWINFO wi; - - wi.cbSize = sizeof(WINDOWINFO); - if (GetWindowInfo(hWnd, &wi)) - { - MoveWindow(hWnd, - g_GlobalPosition.x, - g_GlobalPosition.y, - wi.rcWindow.right - wi.rcWindow.left, - wi.rcWindow.bottom - wi.rcWindow.top, - TRUE); - } -} - -LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WMU_INIT_INSTALLER: - { - UpdateGlobalPosition(hWnd); - while (next_dialog != NULL) - { - next_dialog = (NEXT_DIALOG)next_dialog(hWnd); - } - PostQuitMessage(0); - break; - } - case WM_DESTROY: - { - PostQuitMessage(0); - break; - } - default: - { - return DefWindowProc(hWnd, message, wParam, lParam); - } - } - - return 0; -} - -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) -{ - WNDCLASSEX wcex; - BOOL bRet; - - wcex.cbSize = sizeof(wcex); - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = MainWndProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_INSTALLER)); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); - wcex.lpszMenuName = _T("InstallerMenu"); - wcex.lpszClassName = _T("Installer"); - wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); - - if (!RegisterClassEx(&wcex)) - { - return 1; - } - - INITCOMMONCONTROLSEX ccex; - ccex.dwSize = sizeof(ccex); - ccex.dwICC = ICC_BAR_CLASSES - |ICC_HOTKEY_CLASS - |ICC_LISTVIEW_CLASSES - |ICC_PROGRESS_CLASS - |ICC_WIN95_CLASSES - |ICC_TAB_CLASSES; - - if (!InitCommonControlsEx(&ccex)) - { - return 1; - } - - g_hInstance = hInstance; - - HWND hWnd = CreateWindow( - _T("Installer"), - _T("InstallerMain"), - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - (HWND)NULL, - (HMENU)NULL, - hInstance, - NULL); - if (hWnd == NULL) - { - return 1; - } - - ShowWindow(hWnd, SW_HIDE); - UpdateWindow(hWnd); - - PostMessage(hWnd, WMU_INIT_INSTALLER, 0, 0); - - MSG msg; - while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) - { - if (bRet == -1) - { - return 1; - } - else - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - return (int)msg.wParam; -} diff --git a/tools/installer/InstallerMain.h b/tools/installer/InstallerMain.h deleted file mode 100644 index e98f316d..00000000 --- a/tools/installer/InstallerMain.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_H_ -#define _INCLUDE_INSTALLER_H_ - -#include "platform_headers.h" -#include "Resource.h" - -void UpdateGlobalPosition(HWND hWnd); -void SetToGlobalPosition(HWND hWnd); - -typedef void *(*NEXT_DIALOG)(HWND); - -extern HINSTANCE g_hInstance; - -#endif //_INCLUDE_INSTALLER_H_ diff --git a/tools/installer/InstallerUtil.cpp b/tools/installer/InstallerUtil.cpp deleted file mode 100644 index 64ebca83..00000000 --- a/tools/installer/InstallerUtil.cpp +++ /dev/null @@ -1,312 +0,0 @@ -#include "InstallerUtil.h" -#include "InstallerMain.h" -#include -#include - -int tstrcasecmp(const TCHAR *str1, const TCHAR *str2) -{ -#if defined _UNICODE - return _wcsicmp(str1, str2); -#else - return _stricmp(str1, str2); -#endif -} - -size_t AnsiToUnicode(const char *str, wchar_t *buffer, size_t maxchars) -{ - if (maxchars < 1) - { - return 0; - } - - size_t total = - (size_t)MultiByteToWideChar(CP_UTF8, - 0, - str, - -1, - buffer, - (int)maxchars); - - return total; -} - -bool IsWhiteSpaceA(const char *stream) -{ - char c = *stream; - if (c & (1<<7)) - { - return false; - } - else - { - return isspace(c) != 0; - } -} - -int BreakStringA(const char *str, char *out, size_t maxchars) -{ - const char *inptr = str; - while (*inptr != '\0' && IsWhiteSpaceA(inptr)) - { - inptr++; - } - - if (*inptr == '\0') - { - if (maxchars) - { - *out = '\0'; - } - return -1; - } - - const char *start, *end = NULL; - - bool quoted = (*inptr == '"'); - if (quoted) - { - inptr++; - start = inptr; - /* Read input until we reach a quote. */ - while (*inptr != '\0' && *inptr != '"') - { - /* Update the end point, increment the stream. */ - end = inptr++; - } - /* Read one more token if we reached an end quote */ - if (*inptr == '"') - { - inptr++; - } - } - else - { - start = inptr; - /* Read input until we reach a space */ - while (*inptr != '\0' && !IsWhiteSpaceA(inptr)) - { - /* Update the end point, increment the stream. */ - end = inptr++; - } - } - - /* Copy the string we found, if necessary */ - if (end == NULL) - { - if (maxchars) - { - *out = '\0'; - } - } - else if (maxchars) - { - char *outptr = out; - maxchars--; - for (const char *ptr=start; - (ptr <= end) && ((unsigned)(outptr - out) < (maxchars)); - ptr++, outptr++) - { - *outptr = *ptr; - } - *outptr = '\0'; - } - - /* Consume more of the string until we reach non-whitespace */ - while (*inptr != '\0' && IsWhiteSpaceA(inptr)) - { - inptr++; - } - - return (int)(inptr - str); -} - -size_t UTIL_Format(TCHAR *buffer, size_t count, const TCHAR *fmt, ...) -{ - va_list ap; - size_t len; - - va_start(ap, fmt); - len = UTIL_FormatArgs(buffer, count, fmt, ap); - va_end(ap); - - if (len >= count) - { - len = count - 1; - buffer[len] = '\0'; - } - - return len; -} - -size_t UTIL_FormatArgs(TCHAR *buffer, size_t count, const TCHAR *fmt, va_list ap) -{ - size_t len = _vsntprintf(buffer, count, fmt, ap); - - if (len >= count) - { - len = count - 1; - buffer[len] = '\0'; - } - - return len; -} - -size_t UTIL_PathFormat(TCHAR *buffer, size_t count, const TCHAR *fmt, ...) -{ - va_list ap; - size_t len; - - va_start(ap, fmt); - len = UTIL_FormatArgs(buffer, count, fmt, ap); - va_end(ap); - - for (size_t i = 0; i < len; i++) - { - if (buffer[i] == '/') - { - buffer[i] = '\\'; - } - } - - return len; -} - -const TCHAR *GetFileFromPath(const TCHAR *path) -{ - size_t len = _tcslen(path); - - for (size_t i = len - 1; - i >= 0 && i < len; - i--) - { - if (path[i] == '\\' || path[i] == '/') - { - return &path[i+1]; - } - } - - return NULL; -} - -void GenerateErrorMessage(DWORD err, TCHAR *buffer, size_t maxchars) -{ - if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - buffer, - (DWORD)maxchars, - NULL) == 0) - { - UTIL_Format(buffer, maxchars, _T("Unknown error")); - } -} - -INT_PTR AskToExit(HWND hWnd) -{ - TCHAR verify_exit[100]; - - if (LoadString(g_hInstance, - IDS_VERIFY_EXIT, - verify_exit, - sizeof(verify_exit) / sizeof(TCHAR) - ) == 0) - { - return (INT_PTR)FALSE; - } - - int val = MessageBox( - hWnd, - _T("Are you sure you want to exit?"), - _T("SourceMod Installer"), - MB_YESNO|MB_ICONQUESTION); - - if (val == 0 || val == IDYES) - { - UpdateGlobalPosition(hWnd); - EndDialog(hWnd, NULL); - return (INT_PTR)TRUE; - } - - return (INT_PTR)FALSE; -} - -size_t UTIL_GetFileSize(const TCHAR *file_path) -{ - HANDLE hFile; - - if ((hFile = CreateFile(file_path, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL)) - != INVALID_HANDLE_VALUE) - { - LARGE_INTEGER size; - - if (GetFileSizeEx(hFile, &size)) - { - CloseHandle(hFile); - return (size_t)size.QuadPart; - } - - CloseHandle(hFile); - } - - return 0; -} - -#if 0 -size_t UTIL_GetFolderSize(const TCHAR *basepath) -{ - HANDLE hFind; - WIN32_FIND_DATA fd; - TCHAR search_path[MAX_PATH]; - size_t total = 0; - - UTIL_PathFormat(search_path, - sizeof(search_path) / sizeof(TCHAR), - _T("%s\\*.*"), - basepath); - - if ((hFind = FindFirstFile(search_path, &fd)) == INVALID_HANDLE_VALUE) - { - return 0; - } - - do - { - if (tstrcasecmp(fd.cFileName, _T(".")) == 0 - || tstrcasecmp(fd.cFileName, _T("..")) == 0) - { - continue; - } - - if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) - { - UTIL_PathFormat(search_path, - sizeof(search_path) / sizeof(TCHAR), - _T("%s\\%s"), - basepath, - fd.cFileName); - total += UTIL_GetFolderSize(search_path); - } - else - { - UTIL_PathFormat(search_path, - sizeof(search_path) / sizeof(TCHAR), - _T("%s\\%s"), - basepath, - fd.cFileName); - - total += UTIL_GetFileSize(search_path); - } - } while (FindNextFile(hFind, &fd)); - - FindClose(hFind); - - return total; -} -#endif diff --git a/tools/installer/InstallerUtil.h b/tools/installer/InstallerUtil.h deleted file mode 100644 index 19daa6cd..00000000 --- a/tools/installer/InstallerUtil.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_UTIL_H_ -#define _INCLUDE_INSTALLER_UTIL_H_ - -#include "platform_headers.h" - -bool IsWhiteSpaceA(const char *stream); -size_t UTIL_FormatArgs(TCHAR *buffer, size_t count, const TCHAR *fmt, va_list ap); -size_t UTIL_Format(TCHAR *buffer, size_t count, const TCHAR *fmt, ...); -size_t UTIL_PathFormat(TCHAR *buffer, size_t count, const TCHAR *fmt, ...); -int tstrcasecmp(const TCHAR *str1, const TCHAR *str2); -int BreakStringA(const char *str, char *out, size_t maxchars); -size_t AnsiToUnicode(const char *str, wchar_t *buffer, size_t maxchars); -const TCHAR *GetFileFromPath(const TCHAR *path); -void GenerateErrorMessage(DWORD err, TCHAR *buffer, size_t maxchars); -size_t UTIL_GetFileSize(const TCHAR *file_path); -size_t UTIL_GetFolderSize(const TCHAR *basepath); - -INT_PTR AskToExit(HWND hWnd); - -#endif //_INCLUDE_INSTALLER_UTIL_H_ diff --git a/tools/installer/LocalCopyMethod.cpp b/tools/installer/LocalCopyMethod.cpp deleted file mode 100644 index 9ccc2391..00000000 --- a/tools/installer/LocalCopyMethod.cpp +++ /dev/null @@ -1,167 +0,0 @@ -#include "InstallerUtil.h" -#include "LocalCopyMethod.h" - -LocalCopyMethod g_LocalCopier; - -DWORD CALLBACK CopyProgressRoutine(LARGE_INTEGER TotalFileSize, - LARGE_INTEGER TotalBytesTransferred, - LARGE_INTEGER StreamSize, - LARGE_INTEGER StreamBytesTransferred, - DWORD dwStreamNumber, - DWORD dwCallbackReason, - HANDLE hSourceFile, - HANDLE hDestinationFile, - LPVOID lpData) -{ - ICopyProgress *progress = (ICopyProgress *)lpData; - - progress->UpdateProgress((size_t)TotalBytesTransferred.QuadPart, - (size_t)TotalFileSize.QuadPart); - - return PROGRESS_CONTINUE; -} - -LocalCopyMethod::LocalCopyMethod() -{ - m_pProgress = NULL; -} - -void LocalCopyMethod::SetOutputPath(const TCHAR *path) -{ - UTIL_PathFormat(m_OutputPath, - sizeof(m_OutputPath) / sizeof(TCHAR), - _T("%s"), - path); - - UTIL_PathFormat(m_CurrentPath, - sizeof(m_CurrentPath) / sizeof(TCHAR), - _T("%s"), - path); -} - -void LocalCopyMethod::TrackProgress(ICopyProgress *pProgress) -{ - m_pProgress = pProgress; -} - -bool LocalCopyMethod::CreateFolder(const TCHAR *name, TCHAR *buffer, size_t maxchars) -{ - TCHAR path[MAX_PATH]; - - UTIL_PathFormat(path, - sizeof(path) / sizeof(TCHAR), - _T("%s\\%s"), - m_CurrentPath, - name); - - if (CreateDirectory(path, NULL)) - { - return true; - } - - DWORD error = GetLastError(); - if (error == ERROR_ALREADY_EXISTS) - { - return true; - } - - GenerateErrorMessage(error, buffer, maxchars); - - return false; -} - -bool LocalCopyMethod::SetCurrentFolder(const TCHAR *path, TCHAR *buffer, size_t maxchars) -{ - if (path == NULL) - { - UTIL_PathFormat(m_CurrentPath, - sizeof(m_CurrentPath) / sizeof(TCHAR), - _T("%s"), - m_OutputPath); - } - else - { - UTIL_PathFormat(m_CurrentPath, - sizeof(m_CurrentPath) / sizeof(TCHAR), - _T("%s\\%s"), - m_OutputPath, - path); - } - - return true; -} - -bool LocalCopyMethod::SendFile(const TCHAR *path, TCHAR *buffer, size_t maxchars) -{ - const TCHAR *filename = GetFileFromPath(path); - - if (filename == NULL) - { - UTIL_Format(buffer, maxchars, _T("Invalid filename")); - return false; - } - - TCHAR new_path[MAX_PATH]; - UTIL_PathFormat(new_path, - sizeof(new_path) / sizeof(TCHAR), - _T("%s\\%s"), - m_CurrentPath, - filename); - - m_bCancelStatus = FALSE; - - if (m_pProgress != NULL) - { - m_pProgress->StartingNewFile(filename); - } - - if (CopyFileEx(path, - new_path, - m_pProgress ? CopyProgressRoutine : NULL, - m_pProgress, - &m_bCancelStatus, - 0) == 0) - { - /* Delete the file in case it was a partial copy */ - DeleteFile(new_path); - - GenerateErrorMessage(GetLastError(), buffer, maxchars); - - return false; - } - - if (m_pProgress != NULL) - { - m_pProgress->FileDone(UTIL_GetFileSize(path)); - } - - return true; -} - -void LocalCopyMethod::CancelCurrentCopy() -{ - m_bCancelStatus = TRUE; -} - -bool LocalCopyMethod::CheckForExistingInstall() -{ - TCHAR path[MAX_PATH]; - - UTIL_PathFormat(path, - sizeof(path) / sizeof(TCHAR), - _T("%s\\addons\\sourcemod"), - m_CurrentPath); - if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES) - { - UTIL_PathFormat(path, - sizeof(path) / sizeof(TCHAR), - _T("%s\\cfg\\sourcemod"), - m_CurrentPath); - if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES) - { - return false; - } - } - - return true; -} diff --git a/tools/installer/LocalCopyMethod.h b/tools/installer/LocalCopyMethod.h deleted file mode 100644 index b82f8573..00000000 --- a/tools/installer/LocalCopyMethod.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _INCLUDE_INSTALL_LOCAL_COPY_METHOD_H_ -#define _INCLUDE_INSTALL_LOCAL_COPY_METHOD_H_ - -#include "platform_headers.h" -#include "ICopyMethod.h" - -class LocalCopyMethod : public ICopyMethod -{ -public: - LocalCopyMethod(); -public: - virtual void TrackProgress(ICopyProgress *pProgress); - virtual bool SetCurrentFolder(const TCHAR *path, TCHAR *buffer, size_t maxchars); - virtual bool SendFile(const TCHAR *path, TCHAR *buffer, size_t maxchars); - virtual bool CreateFolder(const TCHAR *name, TCHAR *buffer, size_t maxchars); - virtual void CancelCurrentCopy(); - virtual bool CheckForExistingInstall(); -public: - void SetOutputPath(const TCHAR *path); -private: - ICopyProgress *m_pProgress; - TCHAR m_OutputPath[MAX_PATH]; - TCHAR m_CurrentPath[MAX_PATH]; - BOOL m_bCancelStatus; -}; - -extern LocalCopyMethod g_LocalCopier; - -#endif //_INCLUDE_INSTALL_LOCAL_COPY_METHOD_H_ diff --git a/tools/installer/PerformInstall.cpp b/tools/installer/PerformInstall.cpp deleted file mode 100644 index 0e07bd9b..00000000 --- a/tools/installer/PerformInstall.cpp +++ /dev/null @@ -1,438 +0,0 @@ -#include "InstallerMain.h" -#include "InstallerUtil.h" -#include "PerformInstall.h" -#include "CCriticalSection.h" - -#define WMU_INSTALLER_DONE WM_USER+2 -#define PBAR_RANGE_HIGH 100 -#define PBAR_RANGE_LOW 0 - -ICopyMethod *g_pCopyMethod = NULL; -HANDLE g_hCopyThread = NULL; -copy_thread_args_t g_thread_args = {NULL, NULL, NULL, false, false}; -CCriticalSection g_update_window; - -class TrackProgress : public ICopyProgress -{ -public: - void Initialize(HWND hTextBar, HWND hCurBar, HWND hTotalBar, size_t total_size) - { - m_hTextBar = hTextBar; - m_hCurBar = hCurBar; - m_hTotalBar = hTotalBar; - m_TotalSize = total_size; - m_TotalDone = 0; - RedrawProgressBars(0.0, 0.0); - } - void Finished() - { - RedrawProgressBars(100.0, 100.0); - } -public: - void StartingNewFile(const TCHAR *filename) - { - TCHAR buffer[255]; - - if (g_update_window.TryEnter()) - { - UTIL_Format(buffer, sizeof(buffer) / sizeof(TCHAR), _T("Copying: %s"), filename); - SendMessage(m_hTextBar, WM_SETTEXT, 0, (LPARAM)buffer); - UpdateWindow(m_hTextBar); - g_update_window.Leave(); - } - } - void UpdateProgress(size_t bytes, size_t total_bytes) - { - float fCur = (float)bytes / (float)total_bytes; - float fTotal = ((float)m_TotalDone + (float)bytes) / (float)m_TotalSize; - RedrawProgressBars(fCur, fTotal); - } - void FileDone(size_t total_size) - { - m_TotalDone += total_size; - RedrawProgressBars(0.0, (float)m_TotalDone / (float)m_TotalSize); - } -private: - void RedrawProgressBar(HWND hBar, float fPerc) - { - /* Get a percentage point in the range */ - float fPointInRange = (float)(PBAR_RANGE_HIGH - PBAR_RANGE_LOW) * fPerc; - int iPointInRange = (int)fPointInRange; - - /* Scale it */ - iPointInRange += PBAR_RANGE_LOW; - - if (g_update_window.TryEnter()) - { - SendMessage(hBar, - PBM_SETPOS, - iPointInRange, - 0); - g_update_window.Leave(); - } - } - void RedrawProgressBars(float fCurrent, float fTotal) - { - RedrawProgressBar(m_hCurBar, fCurrent); - RedrawProgressBar(m_hTotalBar, fTotal); - } -private: - size_t m_TotalSize; - size_t m_TotalDone; - HWND m_hTextBar; - HWND m_hCurBar; - HWND m_hTotalBar; -} s_ProgressTracker; - -void CancelPerformInstall() -{ - delete g_thread_args.pFileList; - g_thread_args.pFileList = NULL; -} - -void SetInstallMethod(ICopyMethod *pCopyMethod) -{ - g_pCopyMethod = pCopyMethod; -} - -bool CopyStructureRecursively(ICopyMethod *pCopyMethod, - CFileList *pFileList, - const TCHAR *basepath, - const TCHAR *local_path, - TCHAR *errbuf, - size_t maxchars) -{ - TCHAR file_path[MAX_PATH]; - const TCHAR *file; - CFileList *pSubList; - - if (!pCopyMethod->SetCurrentFolder(local_path, errbuf, maxchars)) - { - return false; - } - - /* Copy files */ - while ((file = pFileList->PeekCurrentFile()) != NULL) - { - if (local_path == NULL) - { - UTIL_PathFormat(file_path, - sizeof(file_path) / sizeof(TCHAR), - _T("%s\\%s"), - basepath, - file); - } - else - { - UTIL_PathFormat(file_path, - sizeof(file_path) / sizeof(TCHAR), - _T("%s\\%s\\%s"), - basepath, - local_path, - file); - } - - if (!pCopyMethod->SendFile(file_path, errbuf, maxchars)) - { - return false; - } - - pFileList->PopCurrentFile(); - } - - /* Now copy folders */ - while ((pSubList = pFileList->PeekCurrentFolder()) != NULL) - { - if (g_thread_args.m_bIsUpgrade) - { - /* :TODO: put this somewhere else because it technically - * means the progress bars get calculated wrong - */ - if (tstrcasecmp(pSubList->GetFolderName(), _T("cfg")) == 0 - || tstrcasecmp(pSubList->GetFolderName(), _T("configs")) == 0) - { - pFileList->PopCurrentFolder(); - continue; - } - } - - /* Try creating the folder */ - if (!pCopyMethod->CreateFolder(pSubList->GetFolderName(), errbuf, maxchars)) - { - return false; - } - - TCHAR new_local_path[MAX_PATH]; - if (local_path == NULL) - { - UTIL_PathFormat(new_local_path, - sizeof(new_local_path) / sizeof(TCHAR), - _T("%s"), - pSubList->GetFolderName()); - } - else - { - UTIL_PathFormat(new_local_path, - sizeof(new_local_path) / sizeof(TCHAR), - _T("%s\\%s"), - local_path, - pSubList->GetFolderName()); - } - - if (!CopyStructureRecursively(pCopyMethod, - pSubList, - basepath, - new_local_path, - errbuf, - maxchars)) - { - return false; - } - - pFileList->PopCurrentFolder(); - - /* Set the current folder again for the next operation */ - if (!pCopyMethod->SetCurrentFolder(local_path, errbuf, maxchars)) - { - return false; - } - } - - return true; -} - -DWORD WINAPI T_CopyFiles(LPVOID arg) -{ - bool result = - CopyStructureRecursively(g_thread_args.pCopyMethod, - g_thread_args.pFileList, - g_thread_args.basepath, - NULL, - g_thread_args.error, - sizeof(g_thread_args.error) / sizeof(TCHAR)); - - PostMessage(g_thread_args.hWnd, WMU_INSTALLER_DONE, result ? TRUE : FALSE, 0); - - return 0; -} - -bool StartFileCopy(HWND hWnd) -{ - g_thread_args.m_bWasCancelled = false; - g_thread_args.hWnd = hWnd; - if ((g_hCopyThread = CreateThread(NULL, - 0, - T_CopyFiles, - NULL, - 0, - NULL)) - == NULL) - { - MessageBox( - hWnd, - _T("Could not initialize copy thread."), - _T("SourceMod Installer"), - MB_OK|MB_ICONERROR); - return false; - } - return true; -} - -void StopFileCopy() -{ - g_thread_args.m_bWasCancelled = true; - g_pCopyMethod->CancelCurrentCopy(); - - if (g_hCopyThread != NULL) - { - g_update_window.Enter(); - WaitForSingleObject(g_hCopyThread, INFINITE); - g_update_window.Leave(); - CloseHandle(g_hCopyThread); - g_hCopyThread = NULL; - } -} - -bool RequestCancelInstall(HWND hWnd) -{ - StopFileCopy(); - - int val = MessageBox( - hWnd, - _T("Are you sure you want to cancel the install?"), - _T("SourceMod Installer"), - MB_YESNO|MB_ICONQUESTION); - - if (val == IDYES) - { - return true; - } - - if (g_thread_args.pFileList == NULL) - { - return false; - } - - /* Start the thread, note our return value is opposite */ - return !StartFileCopy(hWnd); -} - -bool StartInstallProcess(HWND hWnd) -{ - if (g_pCopyMethod->CheckForExistingInstall()) - { - int val = MessageBox( - hWnd, - _T("It looks like a previous SourceMod installation exists. Select \"Yes\" to skip copying configuration files. Select \"No\" to perform a full re-install."), - _T("SourceMod Installer"), - MB_YESNO|MB_ICONQUESTION); - - if (val == 0 || val == IDYES) - { - g_thread_args.m_bIsUpgrade = true; - } - else - { - g_thread_args.m_bIsUpgrade = false; - } - } - -#if 0 - TCHAR cur_path[MAX_PATH]; - if (_tgetcwd(cur_path, sizeof(cur_path)) == NULL) - { - MessageBox( - hWnd, - _T("Could not locate current directory!"), - _T("SourceMod Installer"), - MB_OK|MB_ICONERROR); - return false; - } -#endif - -#if 0 - UTIL_PathFormat(source_path, - sizeof(source_path) / sizeof(TCHAR), - _T("%s\\files"), - cur_path); -#else - UTIL_PathFormat(g_thread_args.basepath, - sizeof(g_thread_args.basepath) / sizeof(TCHAR), - _T("C:\\real\\done\\base")); -#endif - - if (GetFileAttributes(g_thread_args.basepath) == INVALID_FILE_ATTRIBUTES) - { - MessageBox( - hWnd, - _T("Could not locate the source installation files!"), - _T("SourceMod Installer"), - MB_OK|MB_ICONERROR); - return false; - } - - delete g_thread_args.pFileList; - g_thread_args.pFileList = CFileList::BuildFileList(_T(""), g_thread_args.basepath); - - s_ProgressTracker.Initialize( - GetDlgItem(hWnd, IDC_PROGRESS_CURCOPY), - GetDlgItem(hWnd, IDC_PROGRESS_CURRENT), - GetDlgItem(hWnd, IDC_PROGRESS_TOTAL), - (size_t)g_thread_args.pFileList->GetRecursiveSize()); - g_pCopyMethod->TrackProgress(&s_ProgressTracker); - g_thread_args.pCopyMethod = g_pCopyMethod; - - return StartFileCopy(hWnd); -} - -INT_PTR CALLBACK PerformInstallHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_INITDIALOG: - { - SetToGlobalPosition(hDlg); - return (INT_PTR)TRUE; - } - case WM_COMMAND: - { - if (LOWORD(wParam) == ID_INSTALL_CANCEL - || LOWORD(wParam) == ID_CLOSE) - { - if (RequestCancelInstall(hDlg)) - { - CancelPerformInstall(); - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, NULL); - } - return (INT_PTR)TRUE; - } - else if (LOWORD(wParam) == ID_INSTALL_START) - { - HWND hButton = GetDlgItem(hDlg, ID_INSTALL_START); - EnableWindow(hButton, FALSE); - StartInstallProcess(hDlg); - } - break; - } - case WMU_INSTALLER_DONE: - { - if (wParam == TRUE) - { - s_ProgressTracker.Finished(); - MessageBox(hDlg, - _T("SourceMod was successfully installed! Please visit http://www.sourcemod.net/ for documentation."), - _T("SourceMod Installer"), - MB_OK); - CancelPerformInstall(); - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, NULL); - return (INT_PTR)TRUE; - } - else if (!g_thread_args.m_bWasCancelled) - { - TCHAR buffer[500]; - - UTIL_Format(buffer, - sizeof(buffer) / sizeof(TCHAR), - _T("Encountered error: %s"), - g_thread_args.error); - int res = MessageBox(hDlg, - buffer, - _T("SourceMod Installer"), - MB_ICONERROR|MB_RETRYCANCEL); - - if (res == IDRETRY) - { - StartFileCopy(hDlg); - } - else - { - CancelPerformInstall(); - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, NULL); - return (INT_PTR)TRUE; - } - } - break; - } - } - - return (INT_PTR)FALSE; -} - -void *DisplayPerformInstall(HWND hWnd) -{ - INT_PTR val; - - if ((val = DialogBox( - g_hInstance, - MAKEINTRESOURCE(IDD_PERFORM_INSTALL), - hWnd, - PerformInstallHandler)) == -1) - { - return NULL; - } - - return (void *)val; -} diff --git a/tools/installer/PerformInstall.h b/tools/installer/PerformInstall.h deleted file mode 100644 index 63081dee..00000000 --- a/tools/installer/PerformInstall.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _INCLUDE_PERFORM_INSTALL_H_ -#define _INCLUDE_PERFORM_INSTALL_H_ - -#include "InstallerMain.h" -#include "ICopyMethod.h" -#include "CFileList.h" - -struct copy_thread_args_t -{ - ICopyMethod *pCopyMethod; - CFileList *pFileList; - HWND hWnd; - bool m_bIsUpgrade; - bool m_bWasCancelled; - TCHAR basepath[MAX_PATH]; - TCHAR error[255]; -}; - -void *DisplayPerformInstall(HWND hWnd); -void SetInstallMethod(ICopyMethod *pCopyMethod); - -#endif //_INCLUDE_PERFORM_INSTALL_H_ diff --git a/tools/installer/Resource.h b/tools/installer/Resource.h deleted file mode 100644 index 7ab83304..00000000 --- a/tools/installer/Resource.h +++ /dev/null @@ -1,65 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by installer.rc -// -#define ID_CLOSE 2 -#define IDD_INSTALLER_DIALOG 102 -#define IDS_APP_TITLE 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDI_INSTALLER 107 -#define IDI_SMALL 108 -#define IDC_INSTALLER 109 -#define IDR_MAINFRAME 128 -#define IDD_WELCOME 130 -#define IDD_CHOOSE_METHOD 132 -#define IDS_NO_GAMEINFO 132 -#define IDS_READONLY_GAMEINFO 133 -#define IDS_GAME_FAIL_HL1 134 -#define IDS_GAME_FAIL_READ 135 -#define IDS_GAME_FAIL_NONE 136 -#define IDS_VERIFY_EXIT 137 -#define ID_WELCOME_NEXT 1001 -#define IDC_WELCOME_PANEL 1002 -#define IDC_METHOD_TEXT 1003 -#define ID_WELCOME_EXIT 1003 -#define ID_METHOD_NEXT 1004 -#define ID_METHOD_EXIT 1005 -#define ID_METHOD_BACK 1006 -#define IDC_METHOD_DED_SERVER 1007 -#define IDC_METHOD_LISTEN_SERVER 1008 -#define IDC_SELGAME_LIST 1008 -#define IDC_METHOD_ALONE_SERVER 1009 -#define IDC_PROGRESS_CURRENT 1009 -#define IDC_METHOD_CUSTOM_FOLDER 1010 -#define IDC_PROGRESS_TOTAL 1010 -#define IDC_METHOD_UPLOAD_FTP 1011 -#define ID_SELGAME_NEXT 1012 -#define ID_SELGAME_EXIT 1013 -#define ID_SELGAME_BACK 1014 -#define IDC_SELGAME_TEXT 1015 -#define IDC_SELGAME_PANEL 1016 -#define IDD_SELECT_GAME 1017 -#define IDD_PERFORM_INSTALL 1018 -#define ID_INSTALL_CANCEL 1019 -#define IDC_INSTALL_PANEL 1020 -#define IDC_INSTALL_TEXT 1021 -#define IDC_COMBO3 1021 -#define IDC_SELGROUP_ACCOUNT 1021 -#define ID_INSTALL_START 1022 -#define IDC_PROGRESS_CURCOPY 1023 -#define IDC_STATIC -1 -#define IDC_WELCOME_TEXT -1 -#define IDC_METHOD_PANEL -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 133 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1022 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/tools/installer/SelectGame.cpp b/tools/installer/SelectGame.cpp deleted file mode 100644 index d90153e5..00000000 --- a/tools/installer/SelectGame.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#include "InstallerMain.h" -#include "InstallerUtil.h" -#include "SelectGame.h" -#include "GamesList.h" -#include "ChooseMethod.h" -#include "PerformInstall.h" -#include "LocalCopyMethod.h" - -int selected_game_index = -1; - -void UpdateGameListBox(HWND hDlg, game_list_t *gl) -{ - HWND lbox = GetDlgItem(hDlg, IDC_SELGAME_LIST); - - SendMessage(lbox, LB_RESETCONTENT, 0, 0); - - for (unsigned int i = 0; i < gl->game_count; i++) - { - LRESULT res = SendMessage(lbox, - LB_ADDSTRING, - 0, - (LPARAM)g_games.game_list[gl->games[i]].name); - - if (res == LB_ERR || res == LB_ERRSPACE) - { - continue; - } - - SendMessage(lbox, LB_SETITEMDATA, i, gl->games[i]); - } - - UpdateWindow(lbox); -} - -#include "windowsx.h" - -INT_PTR CALLBACK ChooseGameHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_INITDIALOG: - { - HWND cbox = GetDlgItem(hDlg, IDC_SELGROUP_ACCOUNT); - SendMessage(cbox, CB_RESETCONTENT, 0, 0); - for (unsigned int i = 0; i < g_game_group->list_count; i++) - { - LRESULT res = SendMessage(cbox, - CB_ADDSTRING, - 0, - (LPARAM)g_game_group->lists[i]->root_name); - if (res == CB_ERR || res == CB_ERRSPACE) - { - continue; - } - SendMessage(cbox, CB_SETITEMDATA, i, (LPARAM)g_game_group->lists[i]); - } - SendMessage(cbox, CB_SETCURSEL, 0, 0); - UpdateWindow(cbox); - UpdateGameListBox(hDlg, g_game_group->lists[0]); - - SetToGlobalPosition(hDlg); - - return (INT_PTR)TRUE; - } - case WM_COMMAND: - { - if (LOWORD(wParam) == ID_SELGAME_EXIT - || LOWORD(wParam) == ID_CLOSE) - { - return AskToExit(hDlg); - } - else if (LOWORD(wParam) == ID_SELGAME_BACK) - { - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, (INT_PTR)DisplayChooseMethod); - return (INT_PTR)TRUE; - } - else if (LOWORD(wParam) == IDC_SELGROUP_ACCOUNT) - { - if (HIWORD(wParam) == CBN_SELCHANGE) - { - HWND cbox = (HWND)lParam; - LRESULT cursel = SendMessage(cbox, CB_GETCURSEL, 0, 0); - - if (cursel == LB_ERR) - { - break; - } - - LRESULT data = SendMessage(cbox, CB_GETITEMDATA, cursel, 0); - if (data == CB_ERR) - { - break; - } - - game_list_t *gl = (game_list_t *)data; - UpdateGameListBox(hDlg, gl); - } - break; - } - else if (LOWORD(wParam) == IDC_SELGAME_LIST) - { - if (HIWORD(wParam) == LBN_SELCHANGE) - { - HWND lbox = (HWND)lParam; - LRESULT cursel = SendMessage(lbox, LB_GETCURSEL, 0, 0); - - selected_game_index = -1; - - if (cursel == LB_ERR) - { - break; - } - - LRESULT item = SendMessage(lbox, LB_GETITEMDATA, cursel, 0); - if (item == LB_ERR) - { - break; - } - - selected_game_index = (int)item; - - HWND button = GetDlgItem(hDlg, ID_SELGAME_NEXT); - EnableWindow(button, TRUE); - } - } - else if (LOWORD(wParam) == ID_SELGAME_NEXT) - { - if (selected_game_index == -1) - { - break; - } - - g_LocalCopier.SetOutputPath(g_games.game_list[selected_game_index].game_path); - SetInstallMethod(&g_LocalCopier); - - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, (INT_PTR)DisplayPerformInstall); - - return (INT_PTR)TRUE; - } - break; - } - case WM_DESTROY: - { - ReleaseGameDB(); - break; - } - } - - return (INT_PTR)FALSE; -} - -void *DisplaySelectGame(HWND hWnd) -{ - INT_PTR val; - - if ((val = DialogBox( - g_hInstance, - MAKEINTRESOURCE(IDD_SELECT_GAME), - hWnd, - ChooseGameHandler)) == -1) - { - return NULL; - } - - return (void *)val; -} - diff --git a/tools/installer/SelectGame.h b/tools/installer/SelectGame.h deleted file mode 100644 index 3030b04d..00000000 --- a/tools/installer/SelectGame.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_SELECT_GAME_H_ -#define _INCLUDE_INSTALLER_SELECT_GAME_H_ - -#include "InstallerMain.h" - -void *DisplaySelectGame(HWND hWnd); - -#endif //_INCLUDE_INSTALLER_SELECT_GAME_H_ diff --git a/tools/installer/Welcome.cpp b/tools/installer/Welcome.cpp deleted file mode 100644 index 7f4337f8..00000000 --- a/tools/installer/Welcome.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "InstallerMain.h" -#include "Welcome.h" -#include "ChooseMethod.h" - -bool g_bIsFirstRun = true; - -INT_PTR CALLBACK WelcomeHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_INITDIALOG: - { - if (!g_bIsFirstRun) - { - SetToGlobalPosition(hDlg); - } - else - { - g_bIsFirstRun = false; - } - return (INT_PTR)TRUE; - } - case WM_COMMAND: - { - if (LOWORD(wParam) == ID_WELCOME_EXIT - || LOWORD(wParam) == ID_CLOSE) - { - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, NULL); - return (INT_PTR)TRUE; - } - else if (LOWORD(wParam) == ID_WELCOME_NEXT) - { - UpdateGlobalPosition(hDlg); - EndDialog(hDlg, (INT_PTR)DisplayChooseMethod); - return (INT_PTR)TRUE; - } - break; - } - } - - return (INT_PTR)FALSE; -} - -void *DisplayWelcome(HWND hWnd) -{ - INT_PTR val; - - if ((val = DialogBox( - g_hInstance, - MAKEINTRESOURCE(IDD_WELCOME), - hWnd, - WelcomeHandler)) == -1) - { - return NULL; - } - - return (void *)val; -} - diff --git a/tools/installer/Welcome.h b/tools/installer/Welcome.h deleted file mode 100644 index b09ce483..00000000 --- a/tools/installer/Welcome.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_WELCOME_H_ -#define _INCLUDE_INSTALLER_WELCOME_H_ - -void *DisplayWelcome(HWND hWnd); - -#endif //_INCLUDE_INSTALLER_WELCOME_H_ diff --git a/tools/installer/installer.ico b/tools/installer/installer.ico deleted file mode 100644 index d551aa3aaf80adf9b7760e2eb8de95a5c3e53df6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23558 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/installer/platform_headers.h b/tools/installer/platform_headers.h deleted file mode 100644 index 096fd307..00000000 --- a/tools/installer/platform_headers.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _INCLUDE_INSTALLER_PLATFORM_HEADERS_H_ -#define _INCLUDE_INSTALLER_PLATFORM_HEADERS_H_ - -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - -// C RunTime Header Files -#include -#include -#include -#include -#include -#include - -#endif //_INCLUDE_INSTALLER_PLATFORM_HEADERS_H_