From f36ea8259f3c42798511887bc8d870f00bbaa9a1 Mon Sep 17 00:00:00 2001 From: pixel Date: Thu, 23 Dec 2004 02:32:54 +0000 Subject: Latests LuaPatch dev'n'fixes --- luapatch.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 3 deletions(-) (limited to 'luapatch.cpp') diff --git a/luapatch.cpp b/luapatch.cpp index add1d63..8208a20 100644 --- a/luapatch.cpp +++ b/luapatch.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: luapatch.cpp,v 1.11 2004-12-21 22:41:02 pixel Exp $ */ +/* $Id: luapatch.cpp,v 1.12 2004-12-23 02:32:54 pixel Exp $ */ #define PARASITE_EVE_INI \ "[patch]\n" \ @@ -29,7 +29,9 @@ #define OPEN_PATCH_INI(warn) \ try { \ - config_file = new Input("patch.ini"); \ + Input * t_config_file = new Input("patch.ini"); \ + config_file = new Buffer(true); \ + t_config_file->copyto(config_file); \ } \ catch (IOGeneral e) { \ if (warn) \ @@ -113,6 +115,7 @@ bool canprobe; bool fromdrive = false; bool rebuild = false; bool patch_loaded = false; +bool have_info = false; int current_option = 0; String option_variable; @@ -224,6 +227,16 @@ static bool LoadPatch(HWND hW) { return false; } + try { + char c; + Input i("readme.txt"); + i.read(&c, 1); + have_info = true; + } + catch (IOGeneral e) { + have_info = false; + } + options = cfg["patch"]["options"].to_int(); delete config_file; @@ -333,6 +346,49 @@ static BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar return FALSE; } +static BOOL CALLBACK InfosDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { + RECT r; + POINT p; + int bwidth, bheight, wsize; + HWND button; + + switch (uMsg) { + case WM_INITDIALOG: + translate(IDD_INFOS, hW); + + button = GetDlgItem(hW, IDOK); + GetWindowRect(button, &r); + p.x = r.left; + p.y = r.top; + ScreenToClient(hW, &p); + bwidth = r.right - r.left; + bheight = r.bottom - r.top; + GetWindowRect(hW, &r); + wsize = r.right - r.left; + MoveWindow(button, wsize / 2 - bwidth / 2, p.y, bwidth, bheight, TRUE); + if (have_info) { + Input i("readme.txt"); + Buffer b(true); + String s, t; + i.copyto(&b); + while (!b.IsClosed()) { + b >> t; + s += t + "\r\n"; + } + SetDlgItemText(hW, IDC_INFOS, s.to_charp()); + } + return TRUE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: + EndDialog(hW, 0); + return TRUE; + } + break; + } + return FALSE; +} + static void set_options_dlg(HWND hW) { int i, n; HWND control; @@ -465,6 +521,10 @@ static BOOL CALLBACK FileSelectDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM DialogBox(0, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), AboutDlgProc); return TRUE; + case IDC_INFOS: + DialogBox(0, MAKEINTRESOURCE(IDD_INFOS), + GetActiveWindow(), InfosDlgProc); + return TRUE; case IDC_OPTIONS: DialogBox(0, MAKEINTRESOURCE(IDD_OPTIONS), GetActiveWindow(), OptionsDlgProc); @@ -515,6 +575,9 @@ static BOOL CALLBACK FileSelectDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM if (options) EnableWindow(GetDlgItem(hW, IDC_OPTIONS), true); + + if (have_info) + EnableWindow(GetDlgItem(hW, IDC_INFOS), true); } else { SetDlgItemText(hW, IDC_PATCH, ""); } @@ -580,7 +643,7 @@ virtual int startup(void) throw (GeneralException) { Output * o; cdutils * cdutil; Handle * iso_r; - Handle * iso_w; + Handle * iso_w = 0; isobuilder * b; if (rebuild) { -- cgit v1.2.3