summaryrefslogtreecommitdiff
path: root/luapatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'luapatch.cpp')
-rw-r--r--luapatch.cpp69
1 files changed, 66 insertions, 3 deletions
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) {