summaryrefslogtreecommitdiff
path: root/PE/pe-hack.lua
diff options
context:
space:
mode:
Diffstat (limited to 'PE/pe-hack.lua')
-rw-r--r--PE/pe-hack.lua44
1 files changed, 24 insertions, 20 deletions
diff --git a/PE/pe-hack.lua b/PE/pe-hack.lua
index de19586..6e5965a 100644
--- a/PE/pe-hack.lua
+++ b/PE/pe-hack.lua
@@ -1,19 +1,20 @@
-- Parasite Eve's french patch
--- $Id: pe-hack.lua,v 1.7 2003-12-26 19:05:30 pixel Exp $
+-- $Id: pe-hack.lua,v 1.8 2003-12-28 13:07:52 pixel Exp $
function mainpatch()
- local dirent, pvd, root, is_cd1, is_cd2, slusname, fmvdir, systemcnfstring, inslus, slus, peimg, pesect, tim, startsect, fmvdirtree, xadirtree, falsesect, i, picts, pict
+ local dirent, slusdirent, pvd, root, is_cd1, is_cd2, slusname, fmvdir, systemcnfstring, inslus, slus, peimg, pesect, tim, startsect, slussect, fmvdirtree, xadirtree, falsesect, i, picts, pict
- dirent = cdutil:findpath "/SLUS_006.62;1" or cdutil:findpath "/SLUS_006.68;1" or error "Not a Parasite Eve CD"
+ slusdirent = 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)
print "Identifying CD..."
- if (dirent.id == "SLUS_006.62;1") then
+ if (slusdirent.id == "SLUS_006.62;1") then
print "CD is Parasite Eve CD1"
pvd.volid = "PE-FR-CD1"
slusname = "PE-FR.CD1"
+-- slusname = "SLUS_006.62"
fmvdir = "FMV1"
is_cd1 = true
is_cd2 = false
@@ -21,28 +22,33 @@ function mainpatch()
print "CD is Parasite Eve CD2"
pvd.volid = "PE-FR-CD2"
slusname = "PE-FR.CD2"
+-- slusname = "SLUS_006.68"
fmvdir = "FMV2"
is_cd1 = false
is_cd2 = true
end
root = iso:setbasics(pvd)
- systemcnfstring = "BOOT=cdrom:\\" .. slusname .. [[;1
-TCB=4
-EVENT=16
-STACK=801fff00
-]]
+ systemcnfstring = "BOOT=cdrom:\\" .. slusname .. ";1\r\nTCB=4\r\nEVENT=16\r\nSTACK=801fff00\r\n"
systemcnf = Buffer()
systemcnf:write(systemcnfstring)
- iso:createfile(root, "SYSTEM.CNF", systemcnf, dirent)
+ dirent = cdutil:findpath("/SYSTEM.CNF;1")
+-- iso:createfile(root, "SYSTEM.CNF", cdfile(cdutil, dirent), dirent)
+ iso:createfile(root, "SYSTEM.CNF", systemcnf, slusdirent)
print "Reading CD's slus file"
- inslus = cdfile(cdutil, dirent)
+ inslus = cdfile(cdutil, slusdirent)
-- inslus = Input("PE-SLUS00662-patched-debug-room.exe")
slus = Buffer(true)
slus:copyfrom(inslus)
apply_hacks(slus_hacks, slus)
+
+ slussect = iso:getdispsect()
+ print("Reserving space for SLUS file at sector " .. slussect)
+ slus:seek(0)
+ iso:createfile(root, slusname, slus, slusdirent):setbasicsxa()
+ slus:seek(0)
dirent = cdutil:findpath "/"
root:setbasicsxa()
@@ -56,14 +62,16 @@ STACK=801fff00
startsect = iso:createfile(root, "PE.TIM", tim, dirent).sector
print "Compiling IMG file"
do_img_file(slus, startsect, pesect)
+-- iso:createfile(root, "PE.IMG", peimg, dirent)
print "Writing final main file"
slus:seek(0)
- iso:createfile(root, slusname, slus):setbasicsxa()
+ iso:putfile(slus, -1, slussect)
print "Copying FMV directory"
dirent = cdutil:findpath("/" .. fmvdir)
fmvdirtree = iso:createdir(root, fmvdir, 1, dirent)
+ fmvdirtree:setbasicsxa()
fmvdirtree.hardhide = true
iso:copydir(fmvdirtree, cdutil, dirent)
@@ -71,6 +79,7 @@ STACK=801fff00
print "Copying xastream directory"
dirent = cdutil:findpath("/XASTREAM")
xadirtree = iso:createdir(root, "XASTREAM", 1, dirent)
+ xadirtree:setbasicsxa()
xadirtree.hardhide = true
iso:copydir(xadirtree, cdutil, dirent)
end
@@ -85,12 +94,7 @@ STACK=801fff00
end
falsesect = {}
-
- for i = 1, 13500, 1 do
- iso:createsector(falsesect, MODE2_FORM1)
- end
-
- for i = 1, 150, 1 do
+ for i = 1, 148, 1 do
iso:createsector(falsesect, MODE2)
end
@@ -184,11 +188,11 @@ function do_img_file(slus, startsect, pesect)
end
iso:putfile(file3)
end
- print("Putting room " .. i .. " from sector " .. sect3[i] .. " to sector " .. s1)
+ print("Putting room " .. i .. " from sector " .. sect3[i] .. " to sector " .. s1 + startsect)
tab3[i] = s1
sizes1[i] = s2 - s1
sizes2[i] = s3 - s2
- sizes3[i] = iso:getdispsect() - s3
+ sizes3[i] = iso:getdispsect() - s3 - startsect
end
slus:wseek(0x838da)