summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MSVC/Tools/Tools.vcproj12
-rw-r--r--MSVC/Tools/master.mak4
-rw-r--r--PE/pepatch-res.h10
-rw-r--r--PE/pepatch.cpp44
-rw-r--r--cdrom.icobin0 -> 11078 bytes
-rw-r--r--luapatch-res.h34
-rw-r--r--luapatch.cpp580
-rw-r--r--luapatch.rc221
-rw-r--r--nmakefile6
9 files changed, 902 insertions, 9 deletions
diff --git a/MSVC/Tools/Tools.vcproj b/MSVC/Tools/Tools.vcproj
index b2aef74..43bb39e 100644
--- a/MSVC/Tools/Tools.vcproj
+++ b/MSVC/Tools/Tools.vcproj
@@ -47,6 +47,15 @@
RelativePath="..\..\crypto-search.cpp">
</File>
<File
+ RelativePath="..\..\luapatch-res.h">
+ </File>
+ <File
+ RelativePath="..\..\luapatch.cpp">
+ </File>
+ <File
+ RelativePath="..\..\luapatch.rc">
+ </File>
+ <File
RelativePath="..\..\lzss-main.cpp">
</File>
<File
@@ -165,6 +174,9 @@
RelativePath="Links.htm"
DeploymentContent="TRUE">
</File>
+ <File
+ RelativePath="..\..\cdrom.ico">
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/MSVC/Tools/master.mak b/MSVC/Tools/master.mak
index 4243a99..511c6c4 100644
--- a/MSVC/Tools/master.mak
+++ b/MSVC/Tools/master.mak
@@ -150,7 +150,9 @@ _RMDIR=deltree /y
#default compile and link for c++ files building an exe
#note: name.obj and name.exe must match
.obj.exe:
- $(_LINK) $(_LFLAGS) $(_LIBS) $**
+ if not exist $*.res $(_LINK) /SUBSYSTEM:CONSOLE $(_LFLAGS) $(_LIBS) $*.obj
+ if exist $*.res $(_LINK) /SUBSYSTEM:CONSOLE $(_LFLAGS) $(_LIBS) $*.obj $*.res
+ if exist $*.paq copy /b $*.exe+$*.paq $*.exe
#default compile and link for c++ files building a dll
.obj.dll:
diff --git a/PE/pepatch-res.h b/PE/pepatch-res.h
index 22e77f3..7559d25 100644
--- a/PE/pepatch-res.h
+++ b/PE/pepatch-res.h
@@ -4,7 +4,7 @@
//
#define IDI_ICON 101
#define IDD_PROGRESS 102
-#define IDB_AYA 103
+#define IDB_AYA 103
#define IDD_ABOUT 104
#define IDC_FILLOUT1 1001
#define IDC_FILLIN1 1002
@@ -13,17 +13,17 @@
#define IDC_INFO1 1005
#define IDC_INFO2 1006
#define IDC_INFO3 1007
-
-#define IDC_PALFIX 1011
+#define IDC_PALFIX 1011
#define IDC_ABOUT 1012
+#define IDC_CUSTOM1 1013
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 105
+#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1013
+#define _APS_NEXT_CONTROL_VALUE 1014
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/PE/pepatch.cpp b/PE/pepatch.cpp
index be67faf..80e6154 100644
--- a/PE/pepatch.cpp
+++ b/PE/pepatch.cpp
@@ -1,7 +1,51 @@
+#include <Output.h>
#include <Main.h>
+#include "pepatch-res.h"
+
+BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ Base::printm(M_STATUS, "AboutDlgProc: uMsg = %i (0x%x)\n", uMsg, uMsg);
+ switch (uMsg) {
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL: DestroyWindow(hW); return TRUE;
+ case IDOK: DestroyWindow(hW); return TRUE;
+ }
+ }
+ return FALSE;
+}
CODE_BEGINS
virtual int startup() throw (GeneralException) {
+ verbosity = M_INFO;
+ HBITMAP bmp;
+ Output * out = new Output("TestBmp.bmp");
+ char buffer[2048];
+ DWORD readed;
+
+ DialogBox(0, MAKEINTRESOURCE(IDD_ABOUT),
+ GetActiveWindow(), 0);
+// ShowWindow(CreateDialog(0, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), AboutDlgProc), SW_SHOWDEFAULT);
+ bmp = LoadBitmap(0, MAKEINTRESOURCE(IDB_AYA));
+
+ do {
+ if (!ReadFile(bmp, buffer, 2048, &readed, 0)) {
+ DWORD dwErrCode = GetLastError();
+ LPVOID lpMsgBuf;
+ if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpMsgBuf, 0, NULL ))
+ throw GeneralException("Gave up on reading CD: unknown error");
+ String errmsg = (LPCTSTR) lpMsgBuf;
+ LocalFree(lpMsgBuf);
+ throw GeneralException("Got error " + errmsg);
+ }
+ printm(M_INFO, "Read %i bytes\n", readed);
+ out->write(buffer, readed);
+ } while (readed != 0);
+
return 0;
}
CODE_ENDS
diff --git a/cdrom.ico b/cdrom.ico
new file mode 100644
index 0000000..5450afa
--- /dev/null
+++ b/cdrom.ico
Binary files differ
diff --git a/luapatch-res.h b/luapatch-res.h
new file mode 100644
index 0000000..2abf630
--- /dev/null
+++ b/luapatch-res.h
@@ -0,0 +1,34 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by luapatch.rc
+//
+#define IDD_FILESELECT 101
+#define IDD_ABOUT 102
+#define ID_FILE_QUIT 104
+#define IDI_ICON 105
+#define IDC_ABOUTTEXT 1001
+#define IDC_ABOUT 1003
+#define IDC_ST_SOURCETYPE 1004
+#define IDC_SOURCETYPE 1007
+#define IDC_ST_SOURCE 1008
+#define IDC_DRIVE 1009
+#define IDC_DEST 1010
+#define IDC_DEST_SELECT 1011
+#define IDC_ST_DEST 1012
+#define IDC_PATCH 1013
+#define IDC_ST_PATCH 1014
+#define IDC_PATCH_SELECT 1015
+#define IDC_SOURCE 1016
+#define IDC_SOURCEFILE_SELECT 1017
+#define IDC_SOURCE_SELECT 1017
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 107
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1015
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/luapatch.cpp b/luapatch.cpp
new file mode 100644
index 0000000..b234d2a
--- /dev/null
+++ b/luapatch.cpp
@@ -0,0 +1,580 @@
+#include <windowsx.h>
+
+#include <Input.h>
+#include <Output.h>
+#include <BLua.h>
+#include <LuaHandle.h>
+#include <Main.h>
+
+#include "cdabstract.h"
+#include "cdutils.h"
+#include "isobuilder.h"
+#include "luacd.h"
+
+#include "luapatch-res.h"
+
+static int myprint(lua_State * _L) {
+ Lua * L = Lua::find(_L);
+ String t = L->tostring();
+
+ Base::printm(M_BARE, t + "\n");
+
+ return 0;
+}
+
+bool Verify(HWND);
+
+enum strings_e {
+ ISOFILE,
+ CDDRIVE,
+ ISOSOURCE,
+ ISODEST,
+ PATCH,
+ NO_DESTINATION,
+ NO_SOURCE,
+ NO_PATCH,
+ MSGERROR,
+};
+
+bool quit = false;
+bool canprobe;
+bool fromdrive = false;
+
+String source, dest, patch;
+
+struct texts_t {
+ int id;
+ int owner;
+ char * str;
+};
+
+struct texts_t t_english[] = {
+ {ISOFILE, 0, "Iso file"},
+ {CDDRIVE, 0, "CD drive"},
+ {ISODEST, 0, "2352-raw image (*.bin)\0*.BIN\0\0\0"},
+ {ISOSOURCE, 0, "2352-raw image (*.bin, *.iso, *.img)\0*.BIN;*.ISO;*.IMG\0\0\0"},
+ {PATCH, 0, "PAQ Archive (*.paq)\0*.PAQ\0\0\0"},
+ {MSGERROR, 0, "Error"},
+ {NO_DESTINATION, 0, "No destination file."},
+ {NO_SOURCE, 0, "No source file."},
+ {NO_PATCH, 0, "No patch file."},
+ {-1, 0}
+};
+
+struct texts_t t_french[] = {
+ {IDC_ABOUTTEXT, IDD_ABOUT,
+"LuaPatch version 0.3.0\n"
+"Version artisanale spéciale MFC \"Eve\"\n\n"
+"Un système de patch de CD\n\n"
+"Copyrignt © 2003-2004 Nicolas \"Pixel\" Noble / NOBIS\n\n"
+"http://www.nobis-crew.org/luapatch/\n"
+"http://www.nobis-crew.org/"},
+ {IDCANCEL, IDD_FILESELECT, "Quitter"},
+ {IDC_ABOUT, IDD_FILESELECT, "A propos"},
+ {IDC_ST_SOURCETYPE, IDD_FILESELECT, "Type de source:"},
+ {IDC_ST_DEST, IDD_FILESELECT, "Fichier de destination:"},
+ {IDC_ST_PATCH, IDD_FILESELECT, "Fichier de patch:"},
+ {ISOFILE, 0, "Fichier Iso"},
+ {CDDRIVE, 0, "Lecteur CD"},
+ {ISODEST, 0, "Image ISO 2352-raw (*.bin)\0*.BIN\0\0\0"},
+ {ISOSOURCE, 0, "Image ISO 2352-raw (*.bin, *.iso, *.img)\0*.BIN;*.ISO;*.IMG\0\0\0"},
+ {PATCH, 0, "Archive PAQ (*.paq)\0*.PAQ\0\0\0"},
+ {MSGERROR, 0, "Erreur"},
+ {NO_DESTINATION, 0, "Pas de fichier de destination."},
+ {NO_SOURCE, 0, "Pas de fichier source."},
+ {NO_PATCH, 0, "Pas de fichier patch."},
+ {-1, 0}
+};
+
+struct texts_t t_german[] = {
+#if 0
+ {IDC_ABOUTTEXT, IDD_ABOUT,
+"LuaPatch version 0.3.0\n"
+"Version artisanale spéciale MFC \"Eve\"\n\n"
+"Un système de patch de CD\n\n"
+"Copyrignt © 2003-2004 Nicolas \"Pixel\" Noble / NOBIS\n\n"
+"http://www.nobis-crew.org/luapatch/\n"
+"http://www.nobis-crew.org/"},
+#endif
+ {-1, 0}
+};
+
+struct trad_t {
+ int langid;
+ struct texts_t * trad;
+};
+
+struct trad_t trads[] = {
+ {LANG_NEUTRAL, t_english},
+ {LANG_FRENCH, t_french},
+ {LANG_GERMAN, t_german},
+ {-1, 0}
+};
+
+int langid;
+
+enum {
+ DEST_SELECT,
+ SOURCE_SELECT,
+ PATCH_SELECT,
+};
+
+void translate(int ownerid, HWND hW) {
+ struct trad_t * t;
+ struct texts_t * txt;
+
+ for (t = trads; t->trad && t->langid != langid; t++);
+
+ if (!t->trad)
+ return;
+
+ for (txt = t->trad; txt->str; txt++) {
+ if (txt->owner == ownerid)
+ SetDlgItemText(hW, txt->id, txt->str);
+ }
+}
+
+const char * GetString(int id) {
+ struct trad_t * t;
+ struct texts_t * txt;
+ int oldlangid = langid;
+ const char * r;
+
+ for (t = trads; t->trad && t->langid != langid; t++);
+
+ if (!t->trad) {
+ oldlangid = langid;
+ langid = LANG_NEUTRAL;
+ r = GetString(id);
+ langid = oldlangid;
+ return r;
+ }
+
+ for (txt = t->trad; txt->str; txt++) {
+ if ((txt->owner == 0) && (txt->id == id))
+ return txt->str;
+ }
+
+ if (langid == LANG_NEUTRAL)
+ return NULL;
+
+ oldlangid = langid;
+ langid = LANG_NEUTRAL;
+ r = GetString(id);
+ langid = oldlangid;
+ return r;
+}
+
+void ChooseFile(HWND hW, int iFType) {
+ OPENFILENAME ofn;
+ char szB[260];
+ BOOL b;
+
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = hW;
+ ofn.hInstance = NULL;
+
+ switch (iFType) {
+ case DEST_SELECT:
+ ofn.lpstrFilter = GetString(ISODEST);
+ GetDlgItemText(hW, IDC_DEST, szB, 259);
+ break;
+ case SOURCE_SELECT:
+ ofn.lpstrFilter = GetString(ISOSOURCE);
+ GetDlgItemText(hW, IDC_SOURCE, szB, 259);
+ break;
+ case PATCH_SELECT:
+ ofn.lpstrFilter = GetString(PATCH);
+ GetDlgItemText(hW, IDC_PATCH, szB, 259);
+ break;
+ }
+
+ ofn.lpstrCustomFilter=NULL;
+ ofn.nMaxCustFilter=0;
+ ofn.nFilterIndex=0;
+
+ ofn.lpstrFile = szB;
+ ofn.nMaxFile = 259;
+ ofn.lpstrFileTitle = NULL;
+ ofn.nMaxFileTitle = 0;
+ ofn.lpstrInitialDir = NULL;
+ ofn.lpstrTitle = NULL;
+
+ ofn.nFileOffset=0;
+ ofn.nFileExtension=0;
+ ofn.lpstrDefExt=0;
+ ofn.lCustData=0;
+ ofn.lpfnHook=NULL;
+ ofn.lpTemplateName=NULL;
+
+ if (iFType == DEST_SELECT) {
+ ofn.Flags = OFN_CREATEPROMPT |
+ OFN_NOCHANGEDIR |
+ OFN_HIDEREADONLY |
+ OFN_OVERWRITEPROMPT;
+ b = GetSaveFileName(&ofn);
+ } else {
+ ofn.Flags = OFN_FILEMUSTEXIST |
+ OFN_NOCHANGEDIR |
+ OFN_HIDEREADONLY;
+ b = GetOpenFileName(&ofn);
+ }
+
+ if (b) {
+ switch (iFType) {
+ case DEST_SELECT:
+ SetDlgItemText(hW, IDC_DEST, szB);
+ break;
+ case SOURCE_SELECT:
+ SetDlgItemText(hW, IDC_SOURCE, szB);
+ break;
+ case PATCH_SELECT:
+ SetDlgItemText(hW, IDC_PATCH, szB);
+ break;
+ }
+ }
+}
+
+BOOL CALLBACK AboutDlgProc(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_ABOUT, 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);
+ break;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK: EndDialog(hW, 0); return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+BOOL CALLBACK FileSelectDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+ RECT r;
+ POINT p;
+ int bwidth, bheight, wsize;
+ HWND button, control;
+
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ translate(IDD_FILESELECT, hW);
+
+ control = GetDlgItem(hW, IDC_SOURCETYPE);
+ ComboBox_ResetContent(control);
+
+ ComboBox_AddString(control, GetString(ISOFILE));
+ ComboBox_SetCurSel(control, 0);
+ if (canprobe) {
+ ComboBox_AddString(control, GetString(CDDRIVE));
+ ComboBox_SetCurSel(control, 1);
+
+ control = GetDlgItem(hW, IDC_DRIVE);
+
+ std::vector<String> p;
+ p = cdabstract::probe();
+
+ for (std::vector<String>::iterator i = p.begin(); i != p.end(); i++) {
+ ComboBox_AddString(control, i->to_charp());
+ }
+ ComboBox_SetCurSel(control, 0);
+ fromdrive = true;
+ ShowWindow(GetDlgItem(hW, IDC_DRIVE), SW_SHOW);
+ ShowWindow(GetDlgItem(hW, IDC_SOURCE), SW_HIDE);
+ ShowWindow(GetDlgItem(hW, IDC_SOURCE_SELECT), SW_HIDE);
+ } else {
+ EnableWindow(control, false);
+ }
+
+ 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);
+ break;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ if (Verify(hW))
+ EndDialog(hW, 0);
+ return TRUE;
+ case IDCANCEL:
+ EndDialog(hW, 0);
+ quit = true;
+ return TRUE;
+ case IDC_ABOUT:
+ DialogBox(0, MAKEINTRESOURCE(IDD_ABOUT),
+ GetActiveWindow(), AboutDlgProc);
+ return TRUE;
+ case IDC_SOURCETYPE:
+ if (HIWORD(wParam) != CBN_SELCHANGE)
+ return FALSE;
+ if (ComboBox_GetCurSel(GetDlgItem(hW, IDC_SOURCETYPE))) {
+ fromdrive = true;
+ ShowWindow(GetDlgItem(hW, IDC_DRIVE), SW_SHOW);
+ ShowWindow(GetDlgItem(hW, IDC_SOURCE), SW_HIDE);
+ ShowWindow(GetDlgItem(hW, IDC_SOURCE_SELECT), SW_HIDE);
+ } else {
+ fromdrive = false;
+ ShowWindow(GetDlgItem(hW, IDC_DRIVE), SW_HIDE);
+ ShowWindow(GetDlgItem(hW, IDC_SOURCE), SW_SHOW);
+ ShowWindow(GetDlgItem(hW, IDC_SOURCE_SELECT), SW_SHOW);
+ }
+ break;
+ case IDC_SOURCE_SELECT:
+ ChooseFile(hW, SOURCE_SELECT);
+ break;
+ case IDC_PATCH_SELECT:
+ ChooseFile(hW, PATCH_SELECT);
+ break;
+ case IDC_DEST_SELECT:
+ ChooseFile(hW, DEST_SELECT);
+ break;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+bool Verify(HWND hW) {
+ char szB[260];
+
+ GetDlgItemText(hW, IDC_DEST, szB, 259);
+ if (!szB[0]) {
+ MessageBox(hW, GetString(NO_DESTINATION), GetString(MSGERROR), MB_OK | MB_ICONERROR);
+ return false;
+ }
+ dest = szB;
+
+ GetDlgItemText(hW, IDC_PATCH, szB, 259);
+ if (!szB[0]) {
+ MessageBox(hW, GetString(NO_PATCH), GetString(MSGERROR), MB_OK | MB_ICONERROR);
+ return false;
+ }
+ patch = szB;
+
+ GetDlgItemText(hW, IDC_SOURCE, szB, 259);
+ if (!szB[0] && !fromdrive) {
+ MessageBox(hW, GetString(NO_SOURCE), GetString(MSGERROR), MB_OK | MB_ICONERROR);
+ return false;
+ }
+ if (fromdrive) {
+ GetDlgItemText(hW, IDC_DRIVE, szB, 259);
+ source = String("cd:") + szB;
+ } else {
+ source = szB;
+ }
+
+ return true;
+}
+
+CODE_BEGINS
+virtual int startup(void) throw (GeneralException) {
+ verbosity = M_INFO;
+ printm(M_BARE, "LuaPatch (C) 2004 Nicolas \"Pixel\" Noble - front-end starting.\n");
+
+ int lang;
+ lang = GetUserDefaultLangID();
+ langid = PRIMARYLANGID(lang);
+
+ canprobe = cdabstract::canprobe();
+
+ DialogBox(0, MAKEINTRESOURCE(IDD_FILESELECT),
+ GetActiveWindow(), FileSelectDlgProc);
+
+ if (quit)
+ exit(0);
+
+ Output * o;
+ cdutils * cdutil;
+ Handle * iso_r;
+
+ cdutil = new cdutils(iso_r = cdabstract::open_cd(source));
+ isobuilder * b = new isobuilder(o = new Output(dest));
+
+ Lua * L = new Lua();
+ L->open_base();
+ L->open_math();
+ L->open_string();
+ L->open_table();
+ LuaInput::pushconstruct(L);
+ LuaOutput::pushconstruct(L);
+ LuaBuffer::pushconstruct(L);
+ CD_PUSHSTATICS(L);
+ L->push("print");
+ L->push(myprint);
+ L->settable(LUA_GLOBALSINDEX);
+
+ Luacdutils lcdutil(cdutil);
+ L->push("cdutil");
+ lcdutil.push(L);
+ L->setvar();
+ Luaisobuilder liso(b);
+ L->push("iso");
+ liso.push(L);
+ L->setvar();
+ new Archive(patch);
+ L->load(&Input("main"));
+
+ delete b;
+ delete o;
+ delete cdutil;
+ delete iso_r;
+
+ return 0;
+}
+CODE_ENDS
+
+#if 0
+ String message;
+ char bleh[256];
+ switch (uMsg) {
+case 0x0000: message="WM_NULL"; break;
+case 0x0001: message="WM_CREATE"; break;
+case 0x0002: message="WM_DESTROY"; break;
+case 0x0003: message="WM_MOVE"; break;
+case 0x0005: message="WM_SIZE"; break;
+case 0x0006: message="WM_ACTIVATE"; break;
+case 0x0007: message="WM_SETFOCUS"; break;
+case 0x0008: message="WM_KILLFOCUS"; break;
+case 0x000A: message="WM_ENABLE"; break;
+case 0x000B: message="WM_SETREDRAW"; break;
+case 0x000C: message="WM_SETTEXT"; break;
+case 0x000D: message="WM_GETTEXT"; break;
+case 0x000E: message="WM_GETTEXTLENGTH"; break;
+case 0x000F: message="WM_PAINT"; break;
+case 0x0010: message="WM_CLOSE"; break;
+case 0x0011: message="WM_QUERYENDSESSION"; break;
+case 0x0013: message="WM_QUERYOPEN"; break;
+case 0x0016: message="WM_ENDSESSION"; break;
+case 0x0012: message="WM_QUIT"; break;
+case 0x0014: message="WM_ERASEBKGND"; break;
+case 0x0015: message="WM_SYSCOLORCHANGE"; break;
+case 0x0018: message="WM_SHOWWINDOW"; break;
+case 0x001A: message="WM_WININICHANGE"; break;
+case 0x001B: message="WM_DEVMODECHANGE"; break;
+case 0x001C: message="WM_ACTIVATEAPP"; break;
+case 0x001D: message="WM_FONTCHANGE"; break;
+case 0x001E: message="WM_TIMECHANGE"; break;
+case 0x001F: message="WM_CANCELMODE"; break;
+case 0x0020: message="WM_SETCURSOR"; break;
+case 0x0021: message="WM_MOUSEACTIVATE"; break;
+case 0x0022: message="WM_CHILDACTIVATE"; break;
+case 0x0023: message="WM_QUEUESYNC"; break;
+case 0x0024: message="WM_GETMINMAXINFO"; break;
+case 0x0026: message="WM_PAINTICON"; break;
+case 0x0027: message="WM_ICONERASEBKGND"; break;
+case 0x0028: message="WM_NEXTDLGCTL"; break;
+case 0x002A: message="WM_SPOOLERSTATUS"; break;
+case 0x002B: message="WM_DRAWITEM"; break;
+case 0x002C: message="WM_MEASUREITEM"; break;
+case 0x002D: message="WM_DELETEITEM"; break;
+case 0x002E: message="WM_VKEYTOITEM"; break;
+case 0x002F: message="WM_CHARTOITEM"; break;
+case 0x0030: message="WM_SETFONT"; break;
+case 0x0031: message="WM_GETFONT"; break;
+case 0x0032: message="WM_SETHOTKEY"; break;
+case 0x0033: message="WM_GETHOTKEY"; break;
+case 0x0037: message="WM_QUERYDRAGICON"; break;
+case 0x0039: message="WM_COMPAREITEM"; break;
+case 0x003D: message="WM_GETOBJECT"; break;
+case 0x0041: message="WM_COMPACTING"; break;
+case 0x0044: message="WM_COMMNOTIFY"; break;
+case 0x0046: message="WM_WINDOWPOSCHANGING"; break;
+case 0x0047: message="WM_WINDOWPOSCHANGED"; break;
+case 0x0048: message="WM_POWER"; break;
+case 0x004A: message="WM_COPYDATA"; break;
+case 0x004B: message="WM_CANCELJOURNAL"; break;
+case 0x004E: message="WM_NOTIFY"; break;
+case 0x0050: message="WM_INPUTLANGCHANGEREQUEST"; break;
+case 0x0051: message="WM_INPUTLANGCHANGE"; break;
+case 0x0052: message="WM_TCARD"; break;
+case 0x0053: message="WM_HELP"; break;
+case 0x0054: message="WM_USERCHANGED"; break;
+case 0x0055: message="WM_NOTIFYFORMAT"; break;
+case 0x007B: message="WM_CONTEXTMENU"; break;
+case 0x007C: message="WM_STYLECHANGING"; break;
+case 0x007D: message="WM_STYLECHANGED"; break;
+case 0x007E: message="WM_DISPLAYCHANGE"; break;
+case 0x007F: message="WM_GETICON"; break;
+case 0x0080: message="WM_SETICON"; break;
+case 0x0081: message="WM_NCCREATE"; break;
+case 0x0082: message="WM_NCDESTROY"; break;
+case 0x0083: message="WM_NCCALCSIZE"; break;
+case 0x0084: message="WM_NCHITTEST"; break;
+case 0x0085: message="WM_NCPAINT"; break;
+case 0x0086: message="WM_NCACTIVATE"; break;
+case 0x0087: message="WM_GETDLGCODE"; break;
+case 0x0088: message="WM_SYNCPAINT"; break;
+case 0x00A0: message="WM_NCMOUSEMOVE"; break;
+case 0x00A1: message="WM_NCLBUTTONDOWN"; break;
+case 0x00A2: message="WM_NCLBUTTONUP"; break;
+case 0x00A3: message="WM_NCLBUTTONDBLCLK"; break;
+case 0x00A4: message="WM_NCRBUTTONDOWN"; break;
+case 0x00A5: message="WM_NCRBUTTONUP"; break;
+case 0x00A6: message="WM_NCRBUTTONDBLCLK"; break;
+case 0x00A7: message="WM_NCMBUTTONDOWN"; break;
+case 0x00A8: message="WM_NCMBUTTONUP"; break;
+case 0x00A9: message="WM_NCMBUTTONDBLCLK"; break;
+case 0x00AB: message="WM_NCXBUTTONDOWN"; break;
+case 0x00AC: message="WM_NCXBUTTONUP"; break;
+case 0x00AD: message="WM_NCXBUTTONDBLCLK"; break;
+case 0x00FF: message="WM_INPUT"; break;
+case 0x0100: message="WM_KEYFIRST"; break;
+case 0x0101: message="WM_KEYUP"; break;
+case 0x0102: message="WM_CHAR"; break;
+case 0x0103: message="WM_DEADCHAR"; break;
+case 0x0104: message="WM_SYSKEYDOWN"; break;
+case 0x0105: message="WM_SYSKEYUP"; break;
+case 0x0106: message="WM_SYSCHAR"; break;
+case 0x0107: message="WM_SYSDEADCHAR"; break;
+case 0x0109: message="WM_UNICHAR"; break;
+case 0x0108: message="WM_KEYLAST"; break;
+case 0x010D: message="WM_IME_STARTCOMPOSITION"; break;
+case 0x010E: message="WM_IME_ENDCOMPOSITION"; break;
+case 0x010F: message="WM_IME_COMPOSITION"; break;
+case 0x0110: message="WM_INITDIALOG"; break;
+case 0x0111: message="WM_COMMAND"; break;
+case 0x0112: message="WM_SYSCOMMAND"; break;
+case 0x0113: message="WM_TIMER"; break;
+case 0x0114: message="WM_HSCROLL"; break;
+case 0x0115: message="WM_VSCROLL"; break;
+case 0x0116: message="WM_INITMENU"; break;
+case 0x0117: message="WM_INITMENUPOPUP"; break;
+case 0x011F: message="WM_MENUSELECT"; break;
+case 0x0120: message="WM_MENUCHAR"; break;
+case 0x0121: message="WM_ENTERIDLE"; break;
+case 0x0122: message="WM_MENURBUTTONUP"; break;
+case 0x0123: message="WM_MENUDRAG"; break;
+case 0x0124: message="WM_MENUGETOBJECT"; break;
+case 0x0125: message="WM_UNINITMENUPOPUP"; break;
+case 0x0126: message="WM_MENUCOMMAND"; break;
+case 0x0127: message="WM_CHANGEUISTATE"; break;
+case 0x0128: message="WM_UPDATEUISTATE"; break;
+case 0x0129: message="WM_QUERYUISTATE"; break;
+default: message="Unknown"; break;
+ }
+ sprintf(bleh, " (0x%04x)\n", uMsg);
+ message = "AboutDlgProc: uMsg = " + message + bleh;
+ Base::printm(M_STATUS, message);
+#endif
diff --git a/luapatch.rc b/luapatch.rc
new file mode 100644
index 0000000..003f590
--- /dev/null
+++ b/luapatch.rc
@@ -0,0 +1,221 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "luapatch-res.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "luapatch-res.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral (Sys. Default) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,3,0,0
+ PRODUCTVERSION 0,3,0,0
+ FILEFLAGSMASK 0x37L
+#ifdef _DEBUG
+ FILEFLAGS 0x21L
+#else
+ FILEFLAGS 0x20L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "Comments", "LuaPatcher - CD Patching system"
+ VALUE "CompanyName", "NOBIS - http://www.nobis-crew.org/"
+ VALUE "FileDescription", "LuaPatcher - Système de patch de CD"
+ VALUE "FileVersion", "0, 3, 0, 0"
+ VALUE "InternalName", "Eve"
+ VALUE "LegalCopyright", "Copyright © 2003-2003 Nicolas ""Pixel"" Noble / NOBIS"
+ VALUE "OriginalFilename", "Melissa"
+ VALUE "ProductName", "LuaPatch"
+ VALUE "ProductVersion", "0, 3, 0, 0"
+ VALUE "SpecialBuild", "Eve"
+ END
+ BLOCK "040c04b0"
+ BEGIN
+ VALUE "Comments", "LuaPatcher - Système de patch de CD"
+ VALUE "CompanyName", "NOBIS - http://www.nobis-crew.org/"
+ VALUE "FileDescription", "NOBIS - http://www.nobis-crew.org/"
+ VALUE "FileVersion", "0, 3, 0, 0"
+ VALUE "InternalName", "Eve"
+ VALUE "LegalCopyright", "Copyright © 2003-2003 Nicolas ""Pixel"" Noble / NOBIS"
+ VALUE "OriginalFilename", "Mélissa"
+ VALUE "ProductName", "LuaPatch"
+ VALUE "ProductVersion", "0, 3, 0, 0"
+ VALUE "SpecialBuild", "Eve"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200, 0x40c, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_FILESELECT DIALOGEX 0, 0, 188, 167
+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,146,50,14
+ PUSHBUTTON "Quit",IDCANCEL,131,146,50,14
+ PUSHBUTTON "About",IDC_ABOUT,7,146,50,14
+ LTEXT "Source type:",IDC_ST_SOURCETYPE,7,7,174,11
+ COMBOBOX IDC_SOURCETYPE,7,18,174,78,CBS_DROPDOWNLIST |
+ CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Source:",IDC_ST_SOURCE,7,40,174,8
+ COMBOBOX IDC_DRIVE,7,50,174,55,CBS_DROPDOWNLIST | CBS_SORT | NOT
+ WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Destination file:",IDC_ST_DEST,7,73,174,8
+ EDITTEXT IDC_DEST,7,84,156,14,ES_AUTOHSCROLL
+ PUSHBUTTON "...",IDC_DEST_SELECT,166,84,15,14
+ 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
+ PUSHBUTTON "...",IDC_SOURCE_SELECT,166,49,15,14
+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.3.0\nHand made special MFC version ""Eve""\n\nA CD patching system\n\nCopyrignt © 2003-2004 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, 160
+ 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
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/nmakefile b/nmakefile
index 1bb867c..f5f4817 100644
--- a/nmakefile
+++ b/nmakefile
@@ -1,15 +1,15 @@
_CCFLAGS = /I includes /I generic\include /I generic\lib\lua\include /I ..\zlib /I msvc/getopt
!IFDEF DEBUG
-_LIBS = "MSVC\Baltisot - generic\Debug\Baltisot - generic.lib" "MSVC\PSX-Bundle - library\Debug\PSX-Bundle - library.lib" ..\zlib\dll32\zlib.lib ..\zlib\static32\zlibstat.lib
+_LIBS = "MSVC\Baltisot - generic\Debug\Baltisot - generic.lib" "MSVC\PSX-Bundle - library\Debug\PSX-Bundle - library.lib" ..\zlib\dll32\zlib.lib ..\zlib\static32\zlibstat.lib comdlg32.lib user32.lib
!ELSE
-_LIBS = "MSVC\Baltisot - generic\Release\Baltisot - generic.lib" "MSVC\PSX-Bundle - library\Release\PSX-Bundle - library.lib" ..\zlib\dll32\zlib.lib ..\zlib\static32\zlibstat.lib
+_LIBS = "MSVC\Baltisot - generic\Release\Baltisot - generic.lib" "MSVC\PSX-Bundle - library\Release\PSX-Bundle - library.lib" ..\zlib\dll32\zlib.lib ..\zlib\static32\zlibstat.lib comdlg32.lib user32.lib
!ENDIF
!include MSVC\Tools\master.mak
#------------------------------------------------------------------
-TARGETS = bgrep.exe cd-tool.exe crypto-search.exe lzss-main.exe
+TARGETS = bgrep.exe cd-tool.exe crypto-search.exe lzss-main.exe luapatch.res luapatch.exe
SUBDIRS = Xenogears PE
all : $(TARGETS)