summaryrefslogtreecommitdiff
path: root/VP-isowork.lua
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2010-02-01 11:06:28 -0800
committerPixel <pixel@nobis-crew.org>2010-02-01 11:06:28 -0800
commitda10d1225e30f1fba8e58d38b634a40e832250d4 (patch)
treea382050b5a408fe418c90df7ef10c3e0b9da3383 /VP-isowork.lua
parent962e686e6793ab98e4bb39d0b07873398262f553 (diff)
Tentatively adding the jp-in-us portion.
Diffstat (limited to 'VP-isowork.lua')
-rw-r--r--VP-isowork.lua96
1 files changed, 73 insertions, 23 deletions
diff --git a/VP-isowork.lua b/VP-isowork.lua
index a5976ad..7f507cb 100644
--- a/VP-isowork.lua
+++ b/VP-isowork.lua
@@ -22,22 +22,41 @@ function prepare_out(file_out)
return iso
end
-function startup(file_in, file_in2, iso_out)
+function startup(file_in, file_in2, iso_out, file_in3, file_in4)
+ local cdutil, cdutil2, cdutil3, cdutil4
if not loadmodule then error("This can only be used with lua-interface...") end
loadmodule "lualibs"
loadmodule "luahandle"
loadmodule "luacd"
- loadmodule "luaslz"
+ pcall(loadmodule, "luaslz")
loadmodule "luahttp"
loadmodule "luaxml"
- globals[1] = cdabstract(file_in or "VP-SQUISH.bin")
--- globals[1] = dvdabstract(file_in or "VP-PSP-EUR.iso")
- local cdutil = cdutils(globals[1])
+ local r, v
+ r, v = pcall(cdabstract, file_in or "VP-SQUISH.bin")
+ if not r then
+ v = dvdabstract(file_in or "VP-PSP-EUR.iso")
+ end
+ cdutil = cdutils(v)
+ cdutil.iso_in = v
if file_in2 then
- globals[2] = cdabstract(file_in2)
- local cdutil2 = cdutils(globals[2])
+ v = cdabstract(file_in2)
+ cdutil2 = cdutils(v)
+ cdutil2.iso_in = v
+ end
+ if file_in3 then
+ r, v = pcall(cdabstract, file_in3)
+ if not r then
+ v = dvdabstract(file_in3)
+ end
+ cdutil3 = cdutils(v)
+ cdutil3.iso_in = v
+ end
+ if file_in4 then
+ v = cdabstract(file_in4)
+ cdutil4 = cdutils(v)
+ cdutil4.iso_in = v
end
- return cdutil, cdutil2, iso_out
+ return cdutil, cdutil2, iso_out, cdutil3, cdutil4
end
anti_cd_swap_hack = {
@@ -47,7 +66,7 @@ anti_cd_swap_hack = {
[0x2820] = { 0x00, 0x00, 0x00, 0x00 },
}
-function iso_identify(cdutil)
+function iso_identify(cdutil, additionnal)
local slusdirentuscd1 = cdutil:findpath "/SLUS_011.56;1"
local slusdirentuscd2 = cdutil:findpath "/SLUS_011.79;1"
local slusdirentjpcd1 = cdutil:findpath "/SLPM_863_79;1"
@@ -58,45 +77,74 @@ function iso_identify(cdutil)
local pspdataf = cdutil:cdfile(pspdata)
local umddata = pspdataf:read()
if umddata == "ULUS-10107|400F6E7A41D6C586|0001|G" then
- got_us = true
+ if not additionnal then got_us = true else got_add_us = true end
elseif umddata == "ULES-00724|2A9CD5DEEA986357|0001|G" then
- got_eu = true
+ if not additionnal then got_eu = true else got_add_eu = true end
elseif umddata == "ULJM-05101|7862BF3F2632E5B5|0001|G" then
- got_jp = true
+ if not additionnal then got_jp = true else got_add_jp = true end
else
error "Wrong PSP iso."
end
- got_psp = true
+ if not additionnal then
+ got_psp = true
+ got_cd1 = true
+ got_cd2 = true
+ else
+ got_add_psp = true
+ got_add_cd1 = true
+ got_add_cd2 = true
+ end
end
- if slusdirentuscd1 and got_cd1 then error "Got twice CD1." end
- if slusdirentuscd2 and got_cd2 then error "Got twice CD2." end
+ if slusdirentuscd1 and got_cd1 and not additionnal then error "Got twice CD1." end
+ if slusdirentuscd2 and got_cd2 and not additionnal then error "Got twice CD2." end
+ if slusdirentuscd1 and got_add_cd1 and additionnal then error "Got twice CD1." end
+ if slusdirentuscd2 and got_add_cd2 and additionnal then error "Got twice CD2." end
+
+ if (slusdirentuscd1 or slusdirentuscd2) and not additionnal then got_us = true end
+ if (slusdirentjpcd1 or slusdirentjpcd2) and not additionnal then got_jp = true end
+ if (slusdirentuscd1 or slusdirentjpcd1) and not additionnal then got_cd1 = true end
+ if (slusdirentuscd2 or slusdirentjpcd2) and not additionnal then got_cd2 = true end
- if slusdirentuscd1 or slusdirentuscd2 then got_us = true end
- if slusdirentjpcd1 or slusdirentjpcd2 then got_jp = true end
- if slusdirentuscd1 or slusdirentjpcd1 then got_cd1 = true end
- if slusdirentuscd2 or slusdirentjpcd2 then got_cd2 = true end
+ if (slusdirentuscd1 or slusdirentuscd2) and additionnal then got_add_us = true end
+ if (slusdirentjpcd1 or slusdirentjpcd2) and additionnal then got_add_jp = true end
+ if (slusdirentuscd1 or slusdirentjpcd1) and additionnal then got_add_cd1 = true end
+ if (slusdirentuscd2 or slusdirentjpcd2) and additionnal then got_add_cd2 = true end
- if slusdirentsquished then
+ if slusdirentsquished and not additionnal then
got_cd1 = true
got_cd2 = true
-- let's fallback...
got_us = true
end
+ if slusdirentsquished and additionnal then
+ got_add_cd1 = true
+ got_add_cd2 = true
+ -- let's fallback...
+ got_add_jp = true
+ end
+
if not slusent then
slusent = slusdirentuscd1 or slusdirentuscd2 or slusdirentjpcd1 or slusdirentjpcd2 or slusdirentsquished
end
if got_us and got_jp then error "2 isos must from the same version of the game." end
+ if got_add_us and got_add_jp then error "2 isos must from the same version of the game." end
+
+ if got_us and got_add_jp and got_cd1 and got_cd2 and got_add_cd1 and got_add_cd2 then
+ jp_in_us = true
+ end
+
+ -- should check for PSP / PSX mixup...
end
function build_basic(iso, cdutil, iso_full)
local cp = function(path, name, dirtree) copyfile(path, name, dirtree, iso, cdutil) end
iso:foreword(cdutil)
local pvd = createpvd(cdutil)
- pvd.volid = "VP-FR"
+ pvd.volid = jp_in_us and "VP-JP-US" or "VP-FR"
local root = iso:setbasics(pvd)
dirent = cdutil:findpath "/"
root:setbasicsxa()
@@ -136,7 +184,8 @@ function build_basic(iso, cdutil, iso_full)
psp_dirtrees.PSPVAL1:setbasicsxa()
dummy:destroy()
else
- local systemcnfstring = "BOOT=cdrom:\\VP-FR.EXE;1\r\nTCB=4\r\nEVENT=16\r\nSTACK=801fff00\r\n"
+ local systemcnfstring
+ systemcnfstring = jp_in_us and "BOOT=cdrom:\\VP-JP-US.EXE;1\r\nTCB=4\r\nEVENT=16\r\nSTACK=801fff00\r\n" or "BOOT=cdrom:\\VP-FR.EXE;1\r\nTCB=4\r\nEVENT=16\r\nSTACK=801fff00\r\n"
local systemcnf = Buffer()
local slus = Buffer(true)
slus:copyfrom(cdutil:cdfile(slusdirent))
@@ -149,7 +198,7 @@ function build_basic(iso, cdutil, iso_full)
end
apply_hacks(slz3_patch, slus)
slus:seek(0)
- iso:createfile(root, "VP-FR.EXE", slus, slusdirent):setbasicsxa()
+ iso:createfile(root, jp_in_us and "VP-JP-US.EXE" or "VP-FR.EXE", slus, slusdirent):setbasicsxa()
slus:seek(0)
local readme = Buffer()
readme:write("Readme...")
@@ -161,3 +210,4 @@ function build_basic(iso, cdutil, iso_full)
end
end
end
+