diff options
-rw-r--r-- | PE/reinsert.cpp | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/PE/reinsert.cpp b/PE/reinsert.cpp index b8db512..0e63d2d 100644 --- a/PE/reinsert.cpp +++ b/PE/reinsert.cpp @@ -79,17 +79,46 @@ int patch_img(cdutils * cd) { delete menu; int mapi = *((short *)(slus + index + 71 * 2)); - Handle * map = new Input("71/0071.out"); + int smap = *((short *)(slus + index + 72 * 2)) - mapi; + smap *= 2048; + Byte * map = (Byte *) malloc(smap); printm(M_INFO, "Ecriture de la carte...\n"); - cd->write_file(map, GUESS, mapi + d_pe1.Sector); - delete map; - + cd->read_datas(map, GUESS, mapi + d_pe1.Sector, smap); + fonte = new Input("fonte.tim"); + fonte->read(map + 8, fonte->GetSize()); + delete fonte; + cd->write_datas(map, GUESS, mapi + d_pe1.Sector, smap); + free(map); + +#if 1 int jour1i = *((short *)(slus + index + 75 * 2)); - Handle * Jour1 = new Input("75/0075.out"); + int sjour1 = *((short *)(slus + index + 76 * 2)) - jour1i; + sjour1 *= 2048; + Byte * jour1 = (Byte *) malloc(sjour1); printm(M_INFO, "Ecriture de la fin du jour 1...\n"); - cd->write_file(Jour1, GUESS, jour1i + d_pe1.Sector); - delete Jour1; - + cd->read_datas(jour1, GUESS, jour1i + d_pe1.Sector, sjour1); + Handle * jour1text = new Input("scripts/c/map.out"); + 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)); + Handle * jour1 = new Input("75/0075.out"); + printm(M_INFO, "Ecriture de la fin du jour 1...\n"); + cd->write_file(jour1, GUESS, jour1i + d_pe1.Sector); + delete jour1; +#endif + for (i = 1; i <= 20; i++) { Input groupe(String().set("groupe-%02i.txt", i)); c = 0; |