summaryrefslogtreecommitdiff
path: root/PE
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-19 21:17:07 +0000
committerpixel <pixel>2003-12-19 21:17:07 +0000
commitdc5101a46405b2d19892c3fde00268ef0344ddaf (patch)
tree460df3fea22d6896cbd0a8eec6d688058bc24f98 /PE
parent4f83eff719566c8b343daf2bf5c8c6a4c4398408 (diff)
Changes of the day
Diffstat (limited to 'PE')
-rw-r--r--PE/compil.lex16
-rw-r--r--PE/pe-hack.lua96
2 files changed, 57 insertions, 55 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,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