diff options
Diffstat (limited to 'PE/reinsert.cpp')
-rw-r--r-- | PE/reinsert.cpp | 52 |
1 files changed, 42 insertions, 10 deletions
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; |