diff options
-rw-r--r-- | PE/reinsert-res.h | 7 | ||||
-rw-r--r-- | PE/reinsert.cpp | 52 | ||||
-rw-r--r-- | PE/reinsert.rc | 13 |
3 files changed, 53 insertions, 19 deletions
diff --git a/PE/reinsert-res.h b/PE/reinsert-res.h index 41773fb..797517a 100644 --- a/PE/reinsert-res.h +++ b/PE/reinsert-res.h @@ -4,8 +4,9 @@ //
#define IDI_ICON 101
#define IDD_ABOUT 102
-#define IDC_LIST1 1001
-#define IDC_LIST 1001
+#define IDC_FILLOUT 1005
+#define IDC_FILLIN 1006
+#define IDC_CUSTOM1 1007
// Next default values for new objects
//
@@ -13,7 +14,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1002
+#define _APS_NEXT_CONTROL_VALUE 1008
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/PE/reinsert.cpp b/PE/reinsert.cpp index c44354d..da6225b 100644 --- a/PE/reinsert.cpp +++ b/PE/reinsert.cpp @@ -5,6 +5,7 @@ #include "cdutils.h" #include "reinsert-res.h" +#include <afxres.h> #define index 0x838da @@ -12,23 +13,55 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- Base::printm(M_INFO, "AboutDlgProc: uMsg = %i (0x%x)\n", uMsg, uMsg);
+ Base::printm(M_STATUS, "AboutDlgProc: uMsg = %i (0x%x)\n", uMsg, uMsg);
switch(uMsg)
{
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
- case IDCANCEL: EndDialog(hW,FALSE);return TRUE;
- case IDOK: EndDialog(hW,FALSE);return TRUE;
+ case IDCANCEL: DestroyWindow(hW);return TRUE;
+ case IDOK: DestroyWindow(hW);return TRUE;
}
}
}
return FALSE;
}
+void LaisserSouffler(HWND Dlg) {
+ LPMSG msg;
+
+ UpdateWindow(Dlg);
+ while (PeekMessage(msg, NULL, 0, 0, PM_REMOVE) != 0) {
+ TranslateMessage(msg);
+ DispatchMessage(msg);
+ }
+}
+
+void UpdateProgress(HWND Dlg, float percent) {
+ RECT r;
+ HWND ctrl = GetDlgItem(Dlg, IDC_FILLOUT);
+
+ GetWindowRect(ctrl, &r);
+ r.right -= r.left;
+ r.bottom -= r.top;
+ ScreenToClient(Dlg, (LPPOINT)&r);
+ r.top += 2;
+ r.left += 2;
+ r.right -= 5;
+ r.bottom -= 5;
+
+ ctrl = GetDlgItem(Dlg, IDC_FILLIN);
+
+ r.right = percent * r.right / 100;
+ MoveWindow(ctrl, r.left, r.top, r.right, r.bottom, TRUE);
+ InvalidateRect(ctrl, NULL, TRUE);
+ UpdateWindow(Dlg);
+}
CODE_BEGINS +HWND Dlg; + virtual int startup() throw (GeneralException) { Handle * ir; Handle * iw; @@ -36,7 +69,8 @@ virtual int startup() throw (GeneralException) { verbosity = M_INFO; - DialogBox(0, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), AboutDlgProc); + ShowWindow(Dlg = CreateDialog(0, MAKEINTRESOURCE(IDD_ABOUT), GetActiveWindow(), AboutDlgProc), SW_SHOWDEFAULT); + UpdateProgress(Dlg, 0); ir = new Input("PE1.bin"); iw = new Output("PE1.bin", 0, 0); @@ -48,7 +82,7 @@ virtual int startup() throw (GeneralException) { delete cd; delete iw; delete ir; - + return 0; ir = new Input("PE2.bin"); @@ -70,7 +104,7 @@ int patch_img(cdutils * cd) { int groupes[100][20]; int counts[20]; - verbosity = M_INFO; + verbosity = M_STATUS; d_slus = cd->find_path("/SLUS_006.62;1"); @@ -123,15 +157,11 @@ int patch_img(cdutils * cd) { int sjour1text = jour1text->GetSize(); if (sjour1text & 3) sjour1text = (sjour1text & (~3)) + 4; int pjour1text = *((Uint32 *)(jour1 + 8)) - sjour1text; - printf("sj1t = %08x, x = %08x, pj1t = %08x\n", sjour1text, *((Uint32 *)(jour1 + 8)), pjour1text); if (pjour1text < 0) throw GeneralException("Texte trop grand!\n"); *((Uint32 *)(jour1 + 4)) = pjour1text; jour1text->read(jour1 + pjour1text, jour1text->GetSize()); delete jour1text; cd->write_datas(jour1, GUESS, jour1i + d_pe1.Sector, sjour1); - Handle * jout = new Output("75.out"); - jout->write(jour1, sjour1); - delete jout; free(jour1); #else int jour1i = *((short *)(slus + index + 75 * 2)); @@ -159,6 +189,8 @@ int patch_img(cdutils * cd) { f->read(script, f->GetSize()); printm(M_INFO, "Groupe %i...\n", i); for (c = 0; c < counts[i]; c++) { + UpdateProgress(Dlg, i * 5.0); + LaisserSouffler(Dlg); int sector, s1, s2, s3, r, size, size2, sizes[2], tptr, uptr, aptr, asiz, maxsize; r = groupes[c][i] - 1; unsigned char * room; diff --git a/PE/reinsert.rc b/PE/reinsert.rc index 38e482d..82b9a28 100644 --- a/PE/reinsert.rc +++ b/PE/reinsert.rc @@ -113,14 +113,15 @@ END // Dialog
//
-IDD_ABOUT DIALOGEX 0, 0, 335, 223
+IDD_ABOUT DIALOGEX 0, 0, 209, 68
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
-CAPTION "Dialog"
+CAPTION "Patch en cours..."
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,278,7,50,14
- PUSHBUTTON "Cancel",IDCANCEL,278,24,50,14
+ CONTROL "",IDC_FILLOUT,"Static",SS_ETCHEDFRAME,7,30,195,31
+ CONTROL "",IDC_FILLIN,"Static",SS_GRAYRECT,13,36,181,20
+ LTEXT "Progression:",IDC_STATIC,19,17,132,10
END
@@ -135,9 +136,9 @@ BEGIN IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 328
+ RIGHTMARGIN, 202
TOPMARGIN, 7
- BOTTOMMARGIN, 216
+ BOTTOMMARGIN, 61
END
END
#endif // APSTUDIO_INVOKED
|