diff options
author | pixel <pixel> | 2003-12-19 21:17:07 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-12-19 21:17:07 +0000 |
commit | dc5101a46405b2d19892c3fde00268ef0344ddaf (patch) | |
tree | 460df3fea22d6896cbd0a8eec6d688058bc24f98 | |
parent | 4f83eff719566c8b343daf2bf5c8c6a4c4398408 (diff) |
Changes of the day
-rw-r--r-- | PE/compil.lex | 16 | ||||
-rw-r--r-- | PE/pe-hack.lua | 96 | ||||
-rw-r--r-- | cd-tool.cpp | 15 | ||||
-rw-r--r-- | str-player.cpp | 20 |
4 files changed, 78 insertions, 69 deletions
diff --git a/PE/compil.lex b/PE/compil.lex index 76d3dbe..cda7fa0 100644 --- a/PE/compil.lex +++ b/PE/compil.lex @@ -2,10 +2,16 @@ #define yputc(a) putc(a, yyout) #include "table.h" + int oldpt = -1; + %% "<PT"[[:digit:]]+">\n" { int d = atoi(yytext + 3); + if (d != (oldpt + 1)) { + fprintf(stderr, "Pointeur incorrect ligne %i: %i\n", yylineno, d); + } + oldpt = d; yputc(0xfe); yputc(d); } @@ -15,14 +21,10 @@ yputc(d); } -"<TAG0>" { - yputc(0xfb); - yputc(0); -} - -"<TAG1>" { +"<TAG"[[:digit:]]+">" { + int d = atoi(yytext + 4); yputc(0xfb); - yputc(1); + yputc(d); } "<CHOICES "[[:digit:]]+">\n" { diff --git a/PE/pe-hack.lua b/PE/pe-hack.lua index 9de8e09..f7a943a 100644 --- a/PE/pe-hack.lua +++ b/PE/pe-hack.lua @@ -1,7 +1,7 @@ function mainpatch() - local dirent, pvd, root, is_cd1, is_cd2, slusname, fmvdir, systemcnfstring, inslus, slus, peimg, pesect, tim, startsect, fmvdirtree, falsesect, i + local dirent, pvd, root, is_cd1, is_cd2, slusname, fmvdir, systemcnfstring, inslus, slus, peimg, pesect, tim, startsect, fmvdirtree, xadirtree, falsesect, i - dirent = cdutil:findpath "/SLUS_006.62;1" or cdutil:findpath "/SLUS_006.68;1" or error "Not a Parasite Eve CD" + dirent = cdutil:findpath "/SLUS_006.62;1" or cdutil:findpath "/SLUS_006.68;1" or error "Not a Parasite Eve CD" iso:foreword(cdutil) pvd = createpvd(cdutil) @@ -63,6 +63,14 @@ STACK=801fff00 fmvdirtree = iso:createdir(root, fmvdir, 1, dirent) fmvdirtree.hardhide = true iso:copydir(fmvdirtree, cdutil, dirent) + + if (is_cd2) then + print "Copying xastream directory" + dirent = cdutil:findpath("/XASTREAM") + xadirtree = iso:createdir(root, "XASTREAM", 1, dirent) + xadirtree.hardhide = true + iso:copydir(xadirtree, cdutil, dirent) + end print "Finalizing CD" iso:createfile(root, "README.TXT", Input("readme.txt")):setbasicsxa() @@ -76,18 +84,7 @@ STACK=801fff00 end function do_img_file(slus, startsect, pesect) - local i, j, sect1, tab1, sect2, tab2, sect3, tab3, sizes1, sizes2, sizes3, sect, file, file1, file2, file3, songsect, b1, b2, b3, b4, lastsect, s1, s2, s3, str - - sect1 = {} - tab1 = {} - sect2 = {} - tab2 = {} - sect3 = {} - tab3 = {} - sizes1 = {} - sizes2 = {} - sizes3 = {} - + local i, j, sect1, tab1, sect2, tab2, sect3, tab3, sizes1, sizes2, sizes3, sect, file, file1, file2, file3, songsect, b1, b2, b3, b4, lastsect, s1, s2, s3, str = 0, 0, {}, {}, {}, {}, {}, {}, {}, {}, {} print "Putting various files" slus:seek(0x838da) @@ -168,10 +165,7 @@ function do_img_file(slus, startsect, pesect) if (file3) then if (groups[i] ~= nil) then str = string.format("%02i", groups[i]) - print("Script is from group " .. str) file3 = patch_room(file3, Input("scripts/c/" .. str .. ".out"), i) - else - print("Room has no script") end iso:putfile(file3) end @@ -215,23 +209,22 @@ function do_img_file(slus, startsect, pesect) end function patch_map(sector, size) - local map, font, buff + local map, font, names, buff - map = cdfile(cdutil, sector, size) font = Input("font.tim") + names = Input("names.tim") buff = Buffer(true) - buff:copyfrom(map) - buff:wseek(8) + buff:writeU32(8) + buff:writeU32(font:getsize() + 8) buff:copyfrom(font) + buff:copyfrom(names) + return buff end function patch_day1(sector, size) - local day1, buffs, offs, i, trad, r + local day1, buffs, offs, i, trad, r = nil, {}, {} - buffs = {} - offs = {} - day1 = cdfile(cdutil, sector, size) for i = 1, 4, 1 do @@ -270,13 +263,13 @@ function patch_day1(sector, size) end function patch_room(_room, _script, nb) - local r, truescriptsize, scriptsize, enlargment, room, script, roomsize, ptrptrs, ptrscriptptrs, oldscriptsize, scriptptr, rest, t, i, nbptrs + local r, truescriptsize, scriptsize, enlargment, room, script, roomsize, ptrptrs, ptrscriptptrs, oldscriptsize, scriptptr, rest, t, i, nbptrs, add script = Buffer(true) script:copyfrom(_script) buffer_pad(script) - r = Buffer(true) + r = Buffer() truescriptsize = _script:getsize() scriptsize = script:getsize() @@ -287,6 +280,8 @@ function patch_room(_room, _script, nb) room:copyfrom(_room, roomsize) room:seek(ptrptrs + 32) ptrscriptsptr = andB(room:readU32(), 0xfffff) + add = andB(room:readU32(), 0xfffff) + add = (andB(room:readU32(), 0xfffff) - add) / 4 room:seek(ptrscriptsptr + 8) oldscriptsize = room:readU32() scriptptr = andB(room:readU32(), 0xfffff) @@ -315,30 +310,29 @@ function patch_room(_room, _script, nb) r:copyfrom(room, ptrscriptsptr - room:tell() + 8) r:writeU32(truescriptsize) room:readU32() - for i = 1, 3, 1 do - t = room:readU32() - r:writeU32(t) + r:writeU32(room:readU32()) + for i = 1, add, 1 do + r:writeU32(room:readU32()) end nbptrs = (roomsize - room:tell()) / 12 for i = 1, nbptrs, 1 do + r:writeU32(room:readU32()) t = room:readU32() - r:writeU32(t) - t = room:readU32() - r:writeU32(orB(andB(t, 0xfff00000), andB(t, 0xfffff) + enlargment)) - t = room:readU32() - r:writeU32(t) + r:writeU32(orB(shl(shr(t, 20), 20), andB(t, 0xfffff) + enlargment)) + r:writeU32(room:readU32()) end - r:copyto(Output("output/room-" .. hex(nb, "%04i") .. ".bin")) - r:seek(0) +-- r:copyto(Output("output/room-" .. hex(nb, "%04i") .. ".bin")) +-- r:seek(0) return r end function apply_hacks(hacks, file) local k, v, i, h + for k, v in pairs(slus_hacks) do for i, h in ipairs(v) do file[k + i - 1] = h @@ -362,7 +356,7 @@ end files = { [10] = "font.tim", - [70] = "menu.bin", + [70] = "mainmenu.bin", [72] = patch_map, [76] = patch_day1, } @@ -418,7 +412,7 @@ slus_hacks = { -- Text "Failed to escape" [0x81dad] = { 0x15, 0x44, 0x38, 0x43, 0x34, 0x0f, 0x4d, 0x32, - 0x37, 0x44, 0x4d, 0x34, 0xff }, + 0x37, 0x3e, 0x44, 0x4d, 0x34, 0xff }, -- Text "Can't escape!" [0x81dca] = { 0x15, 0x44, 0x38, 0x43, 0x34, 0x0f, 0x38, 0x3c, @@ -427,19 +421,25 @@ slus_hacks = { -- Font width table - [0x81ea1] = { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 8, 11, 14, - 9, 8, 7, 8, 7, 7, 8, 9, 6, 7, 9, 8, 11, 9, 7, 8, - 7, 9, 7, 7, 9, 9, 11, 7, 9, 7, 9, 4, 7, 6, 4, 4, - 8, 8, 7, 7, 7, 7, 8, 9, 5, 4, 8, 5, 11, 9, 7, 8, - 8, 7, 6, 5, 9, 9, 11, 7, 9, 6, 4, 4, 7, 7, 7, 7, - 7, 7, 7, 7, 5, 5, 7, 7, 9, 9, 9, 7, 11, 11, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + [0x81ea1] = { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, + 6, 8, 11, 14, 9, 8, 7, 8, 7, 7, 8, 9, + 6, 7, 9, 8, 11, 9, 7, 8, 7, 9, 7, 7, + 9, 9, 11, 7, 9, 7, 9, 4, 7, 6, 4, 4, + 8, 8, 7, 7, 7, 7, 8, 9, 5, 4, 8, 5, + 11, 9, 7, 8, 8, 7, 6, 5, 9, 9, 11, 7, + 9, 6, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, + 5, 5, 7, 7, 9, 9, 9, 7, 11, 11, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, -- PE.BIN filename extension [0x01b4c] = { 0x54, 0x49, 0x4d }, + +-- Debug room +-- [0x2f888] = { }, } groups = { diff --git a/cd-tool.cpp b/cd-tool.cpp index ad283a4..67f1d2d 100644 --- a/cd-tool.cpp +++ b/cd-tool.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: cd-tool.cpp,v 1.20 2003-12-11 16:53:42 pixel Exp $ */ +/* $Id: cd-tool.cpp,v 1.21 2003-12-19 21:17:07 pixel Exp $ */ #include <getopt.h> #include <stdio.h> @@ -55,6 +55,7 @@ struct option long_options[] = { {"force", 0, NULL, 'f'}, {"verbose", 0, NULL, 'v'}, {"debug", 0, NULL, 'g'}, + {"archive", 1, NULL, 'a'}, {0, 0, NULL, 0 } }; @@ -103,7 +104,9 @@ void showhelp(void) { " extract <file> <addr> <size> - extract some sectors to <file>\n" " insert-file <file> <path> - insert the file to <path>\n" " insert <file> <addr> - insert some sectors at <addr>\n" +#if 0 " copy <isofile> - copy to another iso\n" +#endif " lua <luascript> - interpret single LUA script\n" " luapatch <luapatch> <file> - create a new iso file using the LUA script\n" " luacomp <luascript> <file> - compile a LUA script\n" @@ -111,6 +114,7 @@ void showhelp(void) { "Additional options:\n" " -v for verbose mode.\n" " -g for LUA compiling debug mode (ie, no stripping)\n" +" -a to load an additionnal archive file\n" " -h for this help page\n" , argv[0]); } @@ -138,7 +142,7 @@ virtual int startup() throw (GeneralException) { verbosity = M_WARNING; - while ((c = getopt_long(argc, argv, "Hhm:p:fvg", long_options, NULL)) != EOF) { + while ((c = getopt_long(argc, argv, "Hhm:p:fvga:", long_options, NULL)) != EOF) { switch (c) { case 'h': case 'H': @@ -160,6 +164,9 @@ virtual int startup() throw (GeneralException) { case 'g': debug = true; break; + case 'a': + new Archive(optarg); + break; } } @@ -233,7 +240,7 @@ virtual int startup() throw (GeneralException) { } printm(M_STATUS, "Reading path %s to file %s.\n", arg2, arg1); #if 0 - cdutil->read_file(file, type, dir->Sector, dir->Size); + cdutil->read_file(file, dir->Size, type, dir->Sector); #else cdfile * f = new cdfile(cdutil, dir, type); printm(M_STATUS, f->GetName()); @@ -253,7 +260,7 @@ virtual int startup() throw (GeneralException) { sector = atoi(argv[optind++]); file = new Output(arg1); printm(M_STATUS, "Reading %i bytes from sector %i to file %s.\n", size, sector, arg1); - cdutil->read_file(file, type, sector, size); + cdutil->read_file(file, size, type, sector); } else if (!strcmp(argv[optind], "insert-file")) { cdutils::DirEntry dir, * d; unsigned char * buffer; diff --git a/str-player.cpp b/str-player.cpp index b1a814a..d13b706 100644 --- a/str-player.cpp +++ b/str-player.cpp @@ -75,19 +75,19 @@ void process_one_sector(Handle * f) { f->read(sector, 2336); h = (STR_Header *) ((Byte *) sector + 8); -/* + printm(M_INFO, "SubHeader: FN = %x, CN = %x, SM = %x, CI = %x: ", sector[0], sector[1], sector[2], sector[3]); printm(M_BARE, "SubHeader FN : %x\n", sector[0]); printm(M_BARE, "SubHeader CN : %x\n", sector[1]); printm(M_BARE, "SubHeader SM : %x\n", sector[2]); printm(M_BARE, "SubHeader CI : %x\n", sector[3]); -*/ + if ((channel != -1) && (channel != sector[1])) return; if ((sector[2] == 0x48) || (sector[2] == 0x42)) { -/* printm(M_BARE, "Video sector\n"); + printm(M_BARE, "Video sector\n"); printm(M_BARE, "Status : %04x\n", h->StSTATUS); printm(M_BARE, "Type : %04x\n", h->StTYPE); printm(M_BARE, "Sector Offset: %i\n", h->StSECTOR_OFFSET); @@ -98,7 +98,7 @@ void process_one_sector(Handle * f) { printm(M_BARE, "Movie Height : %i\n", h->StMOVIE_HEIGHT); printm(M_BARE, "Movie HeadM : %08x\n", h->StMOVIE_HEADM); printm(M_BARE, "Movie HeadV : %08x\n", h->StMOVIE_HEADV); - printm(M_BARE, "Channels : %04x\n", h->Channels); */ + printm(M_BARE, "Channels : %04x\n", h->Channels); if (h->StSECTOR_OFFSET == 0) { video = (Byte *) malloc(h->StSECTOR_SIZE * 2016); if (!screen) { @@ -118,14 +118,14 @@ void process_one_sector(Handle * f) { if (h->StSECTOR_SIZE == (h->StSECTOR_OFFSET + 1)) { // Frame finished. -// printm(M_BARE, "End of Frame.\n"); + printm(M_BARE, "End of Frame.\n"); Uint8 * buffer = ((Uint8 *) screen->pixels); if (SDL_MUSTLOCK(screen)) if (SDL_LockSurface(screen) < 0) exit(1); -// printm(M_BARE, "Width: %i, Height: %i - bpp: %i\n", width, height, bpp); + printm(M_BARE, "Width: %i, Height: %i - bpp: %i\n", width, height, bpp); bs_decode_rgb24(buffer, (bs_header_t *) video, width, height, 0); // fwrite(screen->pixels, 3, width * height, stdout); @@ -140,9 +140,9 @@ void process_one_sector(Handle * f) { int locked = 0; SoundSector * buffer = (SoundSector *) sector; -/* printm(M_BARE, "Audio sector\n"); + printm(M_BARE, "Audio sector\n"); printm(M_BARE, "Frequency: %i\n", xahalfhz(buffer) ? 18900 : 37800); - printm(M_BARE, "Channels : %s\n", xastereo(buffer) ? "stereo" : "mono"); */ + printm(M_BARE, "Channels : %s\n", xastereo(buffer) ? "stereo" : "mono"); // fwrite(sector + 8, 1, 2324, stdout); while (audio_len > 0) { @@ -187,9 +187,9 @@ void process_one_sector(Handle * f) { saveXaDecode(xachannel(buffer)); } else { -// printm(M_BARE, "Unknow sector\n"); + printm(M_BARE, "Unknow sector\n"); } -// printm(M_BARE, "---------------------------------\n\n"); + printm(M_BARE, "---------------------------------\n\n"); } virtual int startup() throw (GeneralException) { |