diff options
-rw-r--r-- | luapatch-languages.h | 5 | ||||
-rw-r--r-- | luapatch-res.h | 7 | ||||
-rw-r--r-- | luapatch.cpp | 69 | ||||
-rw-r--r-- | luapatch.rc | 177 |
4 files changed, 166 insertions, 92 deletions
diff --git a/luapatch-languages.h b/luapatch-languages.h index 99063f6..89bd708 100644 --- a/luapatch-languages.h +++ b/luapatch-languages.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: luapatch-languages.h,v 1.4 2004-12-21 22:41:02 pixel Exp $ */ +/* $Id: luapatch-languages.h,v 1.5 2004-12-23 02:32:54 pixel Exp $ */ enum strings_e { ISOFILEPATCH, @@ -47,6 +47,7 @@ struct texts_t { struct texts_t t_english[] = { {-1, IDD_ABOUT, "About..."}, {-1, IDD_OPTIONS, "Options"}, + {-1, IDD_INFOS, "Informations"}, {IDC_ABOUTTEXT, IDD_ABOUT, "LuaPatch version 0.4.0\n" "Hand made special MFC version\n\n" @@ -56,10 +57,12 @@ struct texts_t t_english[] = { "http://www.nobis-crew.org/"}, {IDOK, IDD_ABOUT, "OK"}, {IDOK, IDD_OPTIONS, "OK"}, + {IDOK, IDD_INFOS, "OK"}, {IDOK, IDD_FILESELECT, "OK"}, {IDCANCEL, IDD_FILESELECT, "Quit"}, {IDC_ABOUT, IDD_FILESELECT, "About"}, {IDC_OPTIONS, IDD_FILESELECT, "Options"}, + {IDC_INFOS, IDD_FILESELECT, "Infos"}, {IDC_ST_SOURCETYPE, IDD_FILESELECT, "Source type:"}, {IDC_ST_SOURCE, IDD_FILESELECT, "Source:"}, {IDC_ST_DEST, IDD_FILESELECT, "Destination file:"}, diff --git a/luapatch-res.h b/luapatch-res.h index f010ab3..b3b60e2 100644 --- a/luapatch-res.h +++ b/luapatch-res.h @@ -7,6 +7,7 @@ #define ID_FILE_QUIT 104
#define IDI_ICON 105
#define IDD_OPTIONS 107
+#define IDD_INFOS 109
#define IDC_ABOUTTEXT 1001
#define IDC_ABOUT 1003
#define IDC_ST_SOURCETYPE 1004
@@ -26,14 +27,16 @@ #define IDC_ST_PATCH_TITLE 1018
#define IDC_TITLE 1020
#define IDC_ST_TITLE 1020
+#define IDC_INFOS 1023
+#define IDC_EDIT1 1027
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 108
+#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1022
+#define _APS_NEXT_CONTROL_VALUE 1028
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
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) { diff --git a/luapatch.rc b/luapatch.rc index caf7682..406c3ec 100644 --- a/luapatch.rc +++ b/luapatch.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL //
IDD_OPTIONS DIALOGEX 0, 0, 186, 81
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
- WS_SYSMENU
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+ WS_CAPTION | WS_SYSMENU
CAPTION "Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
@@ -38,6 +38,58 @@ BEGIN WS_VSCROLL | WS_TABSTOP
END
+IDD_FILESELECT DIALOGEX 0, 0, 188, 194
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+ WS_CAPTION | WS_SYSMENU
+CAPTION "LuaPatch"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,58,173,50,14,BS_FLAT
+ PUSHBUTTON "Quit",IDCANCEL,131,173,50,14,BS_FLAT
+ PUSHBUTTON "About",IDC_ABOUT,7,173,50,14,BS_FLAT
+ LTEXT "Source type:",IDC_ST_SOURCETYPE,7,7,174,11,WS_DISABLED
+ COMBOBOX IDC_SOURCETYPE,7,18,174,78,CBS_DROPDOWNLIST |
+ CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Source:",IDC_ST_SOURCE,7,40,174,8,WS_DISABLED
+ COMBOBOX IDC_DRIVE,7,50,174,55,CBS_DROPDOWNLIST | CBS_SORT | NOT
+ WS_VISIBLE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Destination file:",IDC_ST_DEST,7,73,174,8,WS_DISABLED
+ EDITTEXT IDC_DEST,7,84,156,14,ES_AUTOHSCROLL | WS_DISABLED
+ PUSHBUTTON "...",IDC_DEST_SELECT,166,84,15,14,WS_DISABLED
+ LTEXT "Patch file:",IDC_ST_PATCH,7,110,174,8
+ EDITTEXT IDC_PATCH,7,121,156,14,ES_AUTOHSCROLL
+ PUSHBUTTON "...",IDC_PATCH_SELECT,166,121,15,14
+ EDITTEXT IDC_SOURCE,7,49,156,14,ES_AUTOHSCROLL | WS_DISABLED
+ PUSHBUTTON "...",IDC_SOURCE_SELECT,166,49,15,14,WS_DISABLED
+ LTEXT "",IDC_ST_PATCH_TITLE,7,144,174,8
+ PUSHBUTTON "Options",IDC_OPTIONS,131,156,50,14,BS_FLAT |
+ WS_DISABLED
+ PUSHBUTTON "Infos",IDC_INFOS,7,156,50,14,BS_FLAT | WS_DISABLED
+END
+
+IDD_ABOUT DIALOGEX 0, 0, 215, 106
+STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER |
+ WS_POPUP | WS_CAPTION
+EXSTYLE WS_EX_PALETTEWINDOW
+CAPTION "About..."
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,7,85,50,14,BS_CENTER | BS_FLAT
+ CTEXT "LuaPatch version 0.4.0\nHand made special MFC version\n\nA CD patching system\n\nCopyrignt © 2003-2005 Nicolas ""Pixel"" Noble / NOBIS\n\nhttp://www.nobis-crew.org/luapatch/\nhttp://www.nobis-crew.org/",
+ IDC_ABOUTTEXT,7,7,201,77
+END
+
+IDD_INFOS DIALOGEX 0, 0, 479, 302
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
+ WS_CAPTION | WS_SYSMENU
+CAPTION "Informations"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,165,281,50,14,BS_CENTER | BS_FLAT
+ EDITTEXT IDC_INFOS,7,7,465,268,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_READONLY | WS_VSCROLL | WS_HSCROLL
+END
+
/////////////////////////////////////////////////////////////////////////////
//
@@ -54,9 +106,46 @@ BEGIN TOPMARGIN, 7
BOTTOMMARGIN, 74
END
+
+ IDD_FILESELECT, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 181
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 187
+ END
+
+ IDD_ABOUT, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 208
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 99
+ END
+
+ IDD_INFOS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 472
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 295
+ END
END
#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_FILESELECT DLGINIT
+BEGIN
+ IDC_SOURCETYPE, 0x403, 6, 0
+0x7771, 0x2065, 0x002e,
+ 0
+END
+
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
@@ -148,96 +237,12 @@ END /////////////////////////////////////////////////////////////////////////////
//
-// Dialog
-//
-
-IDD_FILESELECT DIALOGEX 0, 0, 188, 194
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_CAPTION | WS_SYSMENU
-CAPTION "LuaPatch"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,58,173,50,14,BS_FLAT
- PUSHBUTTON "Quit",IDCANCEL,131,173,50,14,BS_FLAT
- PUSHBUTTON "About",IDC_ABOUT,7,173,50,14,BS_FLAT
- LTEXT "Source type:",IDC_ST_SOURCETYPE,7,7,174,11,WS_DISABLED
- COMBOBOX IDC_SOURCETYPE,7,18,174,78,CBS_DROPDOWNLIST |
- CBS_AUTOHSCROLL | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
- LTEXT "Source:",IDC_ST_SOURCE,7,40,174,8,WS_DISABLED
- COMBOBOX IDC_DRIVE,7,50,174,55,CBS_DROPDOWNLIST | CBS_SORT | NOT
- WS_VISIBLE | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
- LTEXT "Destination file:",IDC_ST_DEST,7,73,174,8,WS_DISABLED
- EDITTEXT IDC_DEST,7,84,156,14,ES_AUTOHSCROLL | WS_DISABLED
- PUSHBUTTON "...",IDC_DEST_SELECT,166,84,15,14,WS_DISABLED
- LTEXT "Patch file:",IDC_ST_PATCH,7,110,174,8
- EDITTEXT IDC_PATCH,7,121,156,14,ES_AUTOHSCROLL
- PUSHBUTTON "...",IDC_PATCH_SELECT,166,121,15,14
- EDITTEXT IDC_SOURCE,7,49,156,14,ES_AUTOHSCROLL | WS_DISABLED
- PUSHBUTTON "...",IDC_SOURCE_SELECT,166,49,15,14,WS_DISABLED
- LTEXT "",IDC_ST_PATCH_TITLE,7,147,174,8
- PUSHBUTTON "Options",IDC_OPTIONS,131,158,50,14,BS_FLAT |
- WS_DISABLED
-END
-
-IDD_ABOUT DIALOGEX 0, 0, 215, 106
-STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER |
- WS_POPUP | WS_CAPTION
-EXSTYLE WS_EX_PALETTEWINDOW
-CAPTION "About..."
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,7,85,50,14,BS_CENTER | BS_FLAT
- CTEXT "LuaPatch version 0.4.0\nHand made special MFC version\n\nA CD patching system\n\nCopyrignt © 2003-2005 Nicolas ""Pixel"" Noble / NOBIS\n\nhttp://www.nobis-crew.org/luapatch/\nhttp://www.nobis-crew.org/",
- IDC_ABOUTTEXT,7,7,201,77
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_FILESELECT, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 181
- TOPMARGIN, 7
- BOTTOMMARGIN, 187
- END
-
- IDD_ABOUT, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 208
- TOPMARGIN, 7
- BOTTOMMARGIN, 99
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON ICON "cdrom.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog Info
-//
-
-IDD_FILESELECT DLGINIT
-BEGIN
- IDC_SOURCETYPE, 0x403, 6, 0, 0x7771, 0x2065, 0x002e, 0
-END
-
#endif // Neutral (Sys. Default) resources
/////////////////////////////////////////////////////////////////////////////
|