diff options
| -rw-r--r-- | VP-isowork.lua | 96 | ||||
| -rw-r--r-- | VP-jp-in-us.lua | 2333 | ||||
| -rw-r--r-- | VP-process.lua | 55 | 
3 files changed, 2451 insertions, 33 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 + diff --git a/VP-jp-in-us.lua b/VP-jp-in-us.lua new file mode 100644 index 0000000..6b6c790 --- /dev/null +++ b/VP-jp-in-us.lua @@ -0,0 +1,2333 @@ +VP_jp_in_us = { +    [9] = 9, +    [10] = 10, +    [11] = 11, +    [12] = 12, +    [13] = 13, +    [14] = 14, +    [15] = 15, +    [16] = 16, +    [17] = 17, +    [18] = 18, +    [19] = 19, +    [20] = 20, +    [21] = 21, +    [22] = 22, +    [23] = 23, +    [24] = 24, +    [25] = 25, +    [26] = 26, +    [27] = 27, +    [28] = 28, +    [29] = 29, +    [30] = 30, +    [31] = 31, +    [32] = 32, +    [33] = 33, +    [34] = 34, +    [35] = 35, +    [36] = 36, +    [37] = 37, +    [38] = 38, +    [39] = 39, +    [40] = 40, +    [41] = 41, +    [42] = 42, +    [43] = 43, +    [44] = 44, +    [45] = 45, +    [46] = 46, +    [47] = 47, +    [48] = 48, +    [49] = 49, +    [50] = 50, +    [51] = 51, +    [52] = 52, +    [53] = 53, +    [54] = 54, +    [55] = 55, +    [56] = 56, +    [57] = 57, +    [58] = 58, +    [59] = 59, +    [60] = 60, +    [61] = 61, +    [62] = 62, +    [63] = 63, +    [64] = 64, +    [65] = 65, +    [66] = 66, +    [67] = 67, +    [68] = 68, +    [69] = 69, +    [70] = 70, +    [71] = 71, +    [72] = 72, +    [73] = 73, +    [74] = 74, +    [75] = 75, +    [76] = 76, +    [77] = 77, +    [78] = 78, +    [79] = 79, +    [80] = 80, +    [81] = 81, +    [82] = 82, +    [83] = 83, +    [84] = 84, +    [85] = 85, +    [86] = 86, +    [87] = 87, +    [88] = 88, +    [89] = 89, +    [90] = 90, +    [91] = 91, +    [92] = 92, +    [93] = 93, +    [94] = 94, +    [95] = 95, +    [96] = 96, +    [97] = 97, +    [98] = 98, +    [99] = 99, +    [100] = 100, +    [101] = 101, +    [102] = 102, +    [103] = 103, +    [104] = 104, +    [105] = 105, +    [106] = 106, +    [107] = 107, +    [108] = 108, +    [109] = 109, +    [110] = 110, +    [111] = 111, +    [112] = 112, +    [113] = 113, +    [114] = 114, +    [115] = 115, +    [116] = 116, +    [117] = 117, +    [118] = 118, +    [119] = 119, +    [120] = 120, +    [121] = 121, +    [122] = 122, +    [123] = 123, +    [124] = 124, +    [125] = 125, +    [126] = 126, +    [127] = 127, +    [128] = 128, +    [129] = 129, +    [130] = 130, +    [131] = 131, +    [132] = 132, +    [133] = 133, +    [134] = 134, +    [135] = 135, +    [136] = 136, +    [137] = 137, +    [138] = 138, +    [139] = 139, +    [140] = 140, +    [141] = 141, +    [142] = 142, +    [143] = 143, +    [144] = 144, +    [145] = 145, +    [146] = 146, +    [147] = 147, +    [148] = 148, +    [149] = 149, +    [150] = 150, +    [151] = 151, +    [152] = 152, +    [153] = 153, +    [154] = 154, +    [155] = 155, +    [156] = 156, +    [157] = 157, +    [158] = 158, +    [159] = 159, +    [160] = 160, +    [161] = 161, +    [162] = 162, +    [163] = 163, +    [164] = 164, +    [165] = 165, +    [166] = 166, +    [167] = 167, +    [168] = 168, +    [169] = 169, +    [170] = 170, +    [171] = 171, +    [172] = 172, +    [173] = 173, +    [174] = 174, +    [175] = 175, +    [176] = 176, +    [177] = 177, +    [178] = 178, +    [179] = 179, +    [180] = 180, +    [181] = 181, +    [182] = 182, +    [183] = 183, +    [184] = 184, +    [185] = 185, +    [186] = 186, +    [187] = 187, +    [188] = 188, +    [189] = 189, +    [190] = 190, +    [191] = 191, +    [192] = 192, +    [193] = 193, +    [194] = 194, +    [195] = 195, +    [196] = 196, +    [197] = 197, +    [198] = 198, +    [199] = 199, +    [200] = 200, +    [201] = 201, +    [202] = 202, +    [203] = 203, +    [204] = 204, +    [205] = 205, +    [206] = 206, +    [207] = 207, +    [208] = 208, +    [209] = 209, +    [210] = 210, +    [211] = 211, +    [212] = 212, +    [213] = 213, +    [214] = 214, +    [215] = 215, +    [216] = 216, +    [217] = 217, +    [218] = 218, +    [219] = 219, +    [220] = 220, +    [221] = 221, +    [222] = 222, +    [223] = 223, +    [224] = 224, +    [225] = 225, +    [226] = 226, +    [227] = 227, +    [228] = 228, +    [229] = 229, +    [230] = 230, +    [231] = 231, +    [232] = 232, +    [233] = 233, +    [234] = 234, +    [235] = 235, +    [236] = 236, +    [237] = 237, +    [238] = 238, +    [239] = 239, +    [240] = 240, +    [241] = 241, +    [242] = 242, +    [243] = 243, +    [244] = 244, +    [245] = 245, +    [246] = 246, +    [247] = 247, +    [248] = 248, +    [249] = 249, +    [250] = 250, +    [251] = 251, +    [252] = 252, +    [253] = 253, +    [254] = 254, +    [255] = 255, +    [256] = 256, +    [257] = 257, +    [258] = 258, +    [259] = 259, +    [260] = 260, +    [261] = 261, +    [262] = 262, +    [263] = 263, +    [264] = 264, +    [265] = 265, +    [266] = 266, +    [267] = 267, +    [268] = 268, +    [269] = 269, +    [270] = 270, +    [271] = 271, +    [272] = 272, +    [273] = 273, +    [274] = 274, +    [275] = 275, +    [276] = 276, +    [277] = 277, +    [278] = 278, +    [279] = 279, +    [280] = 280, +    [281] = 281, +    [282] = 282, +    [283] = 283, +    [284] = 284, +    [285] = 285, +    [286] = 286, +    [287] = 287, +    [288] = 288, +    [289] = 289, +    [290] = 290, +    [291] = 291, +    [292] = 292, +    [293] = 293, +    [294] = 294, +    [295] = 295, +    [296] = 296, +    [297] = 297, +    [298] = 298, +    [299] = 299, +    [300] = 300, +    [301] = 301, +    [302] = 302, +    [303] = 303, +    [304] = 304, +    [305] = 305, +    [306] = 306, +    [307] = 307, +    [308] = 308, +    [309] = 309, +    [310] = 310, +    [311] = 311, +    [312] = 312, +    [313] = 313, +    [314] = 314, +    [315] = 315, +    [316] = 316, +    [317] = 317, +    [318] = 318, +    [319] = 319, +    [320] = 320, +    [321] = 321, +    [322] = 322, +    [323] = 323, +    [324] = 324, +    [325] = 325, +    [326] = 326, +    [327] = 327, +    [328] = 328, +    [329] = 329, +    [330] = 330, +    [331] = 331, +    [332] = 332, +    [333] = 333, +    [334] = 334, +    [335] = 335, +    [336] = 336, +    [337] = 337, +    [338] = 338, +    [339] = 339, +    [340] = 340, +    [341] = 341, +    [342] = 342, +    [343] = 343, +    [344] = 344, +    [345] = 345, +    [346] = 346, +    [347] = 347, +    [348] = 364, +    [349] = 365, +    [350] = 382, +    [351] = 383, +    [352] = 396, +    [353] = 397, +    [354] = 398, +    [355] = 399, +    [356] = 400, +    [357] = 401, +    [358] = 420, +    [359] = 421, +    [360] = 426, +    [361] = 427, +    [362] = 428, +    [363] = 429, +    [364] = 430, +    [365] = 431, +    [366] = 432, +    [367] = 433, +    [368] = 434, +    [369] = 435, +    [370] = 436, +    [371] = 437, +    [372] = 438, +    [373] = 439, +    [374] = 440, +    [375] = 441, +    [376] = 442, +    [377] = 443, +    [378] = 444, +    [379] = 445, +    [380] = 446, +    [381] = 447, +    [382] = 448, +    [383] = 449, +    [384] = 450, +    [385] = 451, +    [386] = 452, +    [387] = 453, +    [388] = 454, +    [389] = 455, +    [390] = 456, +    [391] = 457, +    [392] = 458, +    [393] = 459, +    [394] = 460, +    [395] = 461, +    [396] = 462, +    [397] = 463, +    [398] = 464, +    [399] = 465, +    [400] = 466, +    [401] = 467, +    [402] = 468, +    [403] = 469, +    [404] = 470, +    [405] = 471, +    [406] = 472, +    [407] = 473, +    [408] = 474, +    [409] = 475, +    [410] = 476, +    [411] = 477, +    [412] = 478, +    [413] = 479, +    [414] = 480, +    [415] = 481, +    [416] = 482, +    [417] = 483, +    [418] = 484, +    [419] = 485, +    [420] = 486, +    [421] = 487, +    [422] = 488, +    [423] = 489, +    [424] = 490, +    [425] = 491, +    [426] = 492, +    [427] = 493, +    [428] = 494, +    [429] = 495, +    [430] = 496, +    [431] = 497, +    [432] = 498, +    [433] = 499, +    [434] = 500, +    [435] = 501, +    [436] = 502, +    [437] = 503, +    [438] = 504, +    [439] = 505, +    [440] = 506, +    [441] = 507, +    [442] = 508, +    [443] = 509, +    [444] = 510, +    [445] = 511, +    [446] = 512, +    [447] = 513, +    [448] = 514, +    [449] = 515, +    [450] = 516, +    [451] = 517, +    [452] = 518, +    [453] = 519, +    [454] = 520, +    [455] = 521, +    [456] = 522, +    [457] = 523, +    [458] = 524, +    [459] = 525, +    [460] = 526, +    [461] = 527, +    [462] = 528, +    [463] = 529, +    [464] = 530, +    [465] = 531, +    [466] = 532, +    [467] = 533, +    [468] = 534, +    [469] = 535, +    [470] = 536, +    [471] = 537, +    [472] = 538, +    [473] = 539, +    [474] = 540, +    [475] = 541, +    [476] = 542, +    [477] = 543, +    [478] = 544, +    [479] = 545, +    [480] = 546, +    [481] = 547, +    [482] = 548, +    [483] = 549, +    [484] = 550, +    [485] = 551, +    [486] = 552, +    [487] = 553, +    [488] = 554, +    [489] = 555, +    [490] = 556, +    [491] = 557, +    [492] = 558, +    [493] = 559, +    [494] = 560, +    [495] = 561, +    [496] = 562, +    [497] = 563, +    [498] = 564, +    [499] = 565, +    [500] = 566, +    [501] = 567, +    [502] = 568, +    [503] = 569, +    [504] = 570, +    [505] = 571, +    [506] = 572, +    [507] = 573, +    [508] = 574, +    [509] = 575, +    [510] = 576, +    [511] = 577, +    [512] = 578, +    [513] = 579, +    [514] = 580, +    [515] = 581, +    [516] = 582, +    [517] = 583, +    [518] = 584, +    [519] = 585, +    [520] = 586, +    [521] = 587, +    [522] = 588, +    [523] = 589, +    [524] = 590, +    [525] = 591, +    [526] = 592, +    [527] = 593, +    [528] = 594, +    [529] = 595, +    [530] = 596, +    [531] = 597, +    [532] = 598, +    [533] = 599, +    [534] = 600, +    [535] = 601, +    [536] = 602, +    [537] = 603, +    [538] = 604, +    [539] = 605, +    [540] = 606, +    [541] = 607, +    [542] = 608, +    [543] = 609, +    [544] = 610, +    [545] = 611, +    [546] = 612, +    [547] = 613, +    [548] = 614, +    [549] = 615, +    [550] = 616, +    [551] = 617, +    [552] = 618, +    [553] = 619, +    [554] = 620, +    [555] = 621, +    [556] = 622, +    [557] = 623, +    [558] = 624, +    [559] = 625, +    [560] = 626, +    [561] = 627, +    [562] = 628, +    [563] = 629, +    [564] = 630, +    [565] = 631, +    [566] = 632, +    [567] = 633, +    [568] = 634, +    [569] = 635, +    [570] = 636, +    [571] = 637, +    [572] = 638, +    [573] = 639, +    [574] = 640, +    [575] = 641, +    [576] = 642, +    [577] = 643, +    [578] = 644, +    [579] = 645, +    [580] = 646, +    [581] = 647, +    [582] = 648, +    [583] = 649, +    [584] = 650, +    [585] = 651, +    [586] = 652, +    [587] = 653, +    [588] = 654, +    [589] = 655, +    [590] = 656, +    [591] = 657, +    [592] = 658, +    [593] = 659, +    [594] = 660, +    [595] = 661, +    [596] = 662, +    [597] = 663, +    [598] = 664, +    [599] = 665, +    [600] = 666, +    [601] = 667, +    [602] = 668, +    [603] = 669, +    [604] = 670, +    [605] = 671, +    [606] = 672, +    [607] = 673, +    [608] = 674, +    [609] = 675, +    [610] = 676, +    [611] = 677, +    [612] = 678, +    [613] = 679, +    [614] = 680, +    [615] = 681, +    [616] = 682, +    [617] = 683, +    [619] = 685, +    [620] = 686, +    [621] = 687, +    [622] = 688, +    [623] = 689, +    [624] = 690, +    [625] = 691, +    [626] = 692, +    [627] = 693, +    [628] = 694, +    [629] = 695, +    [630] = 696, +    [631] = 697, +    [632] = 698, +    [633] = 699, +    [634] = 700, +    [635] = 701, +    [636] = 702, +    [637] = 703, +    [638] = 704, +    [639] = 705, +    [640] = 706, +    [641] = 707, +    [642] = 708, +    [643] = 709, +    [644] = 710, +    [645] = 711, +    [646] = 712, +    [647] = 713, +    [648] = 714, +    [649] = 715, +    [650] = 716, +    [651] = 717, +    [652] = 718, +    [653] = 719, +    [654] = 720, +    [655] = 721, +    [656] = 722, +    [657] = 723, +    [658] = 724, +    [659] = 725, +    [660] = 726, +    [661] = 727, +    [662] = 728, +    [663] = 729, +    [664] = 730, +    [665] = 731, +    [666] = 732, +    [667] = 733, +    [668] = 734, +    [669] = 735, +    [670] = 736, +    [671] = 737, +    [672] = 738, +    [673] = 739, +    [674] = 740, +    [675] = 741, +    [676] = 742, +    [677] = 743, +    [678] = 744, +    [679] = 745, +    [680] = 746, +    [681] = 747, +    [682] = 748, +    [683] = 749, +    [684] = 750, +    [685] = 751, +    [686] = 752, +    [687] = 753, +    [688] = 754, +    [689] = 755, +    [690] = 756, +    [691] = 757, +    [692] = 758, +    [693] = 759, +    [694] = 760, +    [695] = 761, +    [696] = 762, +    [697] = 763, +    [698] = 764, +    [699] = 765, +    [700] = 766, +    [701] = 767, +    [702] = 768, +    [703] = 769, +    [704] = 770, +    [705] = 771, +    [706] = 772, +    [707] = 773, +    [708] = 774, +    [709] = 775, +    [710] = 776, +    [711] = 777, +    [712] = 778, +    [713] = 779, +    [714] = 780, +    [715] = 781, +    [716] = 782, +    [717] = 783, +    [718] = 784, +    [719] = 785, +    [720] = 786, +    [721] = 787, +    [722] = 788, +    [723] = 789, +    [724] = 790, +    [725] = 791, +    [726] = 792, +    [727] = 793, +    [728] = 794, +    [729] = 795, +    [730] = 796, +    [731] = 797, +    [732] = 798, +    [733] = 799, +    [734] = 800, +    [735] = 801, +    [736] = 802, +    [737] = 803, +    [738] = 804, +    [739] = 805, +    [740] = 806, +    [741] = 807, +    [742] = 808, +    [743] = 809, +    [744] = 810, +    [745] = 811, +    [746] = 812, +    [747] = 813, +    [748] = 814, +    [749] = 815, +    [750] = 816, +    [751] = 817, +    [752] = 818, +    [753] = 819, +    [754] = 820, +    [755] = 821, +    [756] = 822, +    [757] = 823, +    [758] = 824, +    [759] = 825, +    [760] = 826, +    [761] = 827, +    [762] = 828, +    [763] = 829, +    [764] = 830, +    [765] = 831, +    [766] = 832, +    [767] = 833, +    [768] = 834, +    [769] = 835, +    [770] = 836, +    [771] = 837, +    [772] = 838, +    [773] = 839, +    [774] = 840, +    [775] = 841, +    [776] = 842, +    [777] = 843, +    [778] = 844, +    [779] = 845, +    [780] = 846, +    [781] = 847, +    [782] = 848, +    [783] = 849, +    [784] = 850, +    [785] = 851, +    [786] = 852, +    [787] = 853, +    [788] = 854, +    [789] = 855, +    [790] = 856, +    [791] = 857, +    [792] = 858, +    [793] = 859, +    [794] = 860, +    [795] = 861, +    [796] = 862, +    [797] = 863, +    [798] = 864, +    [799] = 865, +    [800] = 866, +    [801] = 867, +    [802] = 868, +    [803] = 869, +    [804] = 870, +    [805] = 871, +    [806] = 872, +    [807] = 873, +    [808] = 874, +    [809] = 875, +    [810] = 876, +    [811] = 877, +    [812] = 878, +    [813] = 879, +    [814] = 880, +    [815] = 881, +    [816] = 882, +    [817] = 883, +    [818] = 884, +    [819] = 885, +    [820] = 886, +    [821] = 887, +    [822] = 888, +    [823] = 889, +    [824] = 890, +    [825] = 891, +    [826] = 892, +    [827] = 893, +    [828] = 894, +    [829] = 895, +    [830] = 896, +    [831] = 897, +    [832] = 898, +    [833] = 899, +    [834] = 900, +    [835] = 901, +    [836] = 902, +    [837] = 903, +    [838] = 904, +    [839] = 905, +    [840] = 906, +    [841] = 907, +    [842] = 908, +    [843] = 909, +    [844] = 910, +    [845] = 911, +    [846] = 912, +    [847] = 913, +    [848] = 914, +    [849] = 915, +    [850] = 916, +    [851] = 917, +    [852] = 918, +    [853] = 919, +    [854] = 920, +    [855] = 921, +    [856] = 922, +    [857] = 923, +    [858] = 924, +    [859] = 925, +    [860] = 926, +    [861] = 927, +    [862] = 928, +    [863] = 929, +    [864] = 930, +    [865] = 931, +    [866] = 932, +    [867] = 933, +    [868] = 934, +    [869] = 935, +    [870] = 936, +    [871] = 937, +    [872] = 938, +    [873] = 939, +    [874] = 940, +    [875] = 941, +    [876] = 942, +    [877] = 943, +    [878] = 944, +    [879] = 945, +    [880] = 946, +    [881] = 947, +    [882] = 948, +    [883] = 949, +    [884] = 950, +    [885] = 951, +    [886] = 952, +    [887] = 953, +    [888] = 954, +    [889] = 955, +    [890] = 956, +    [891] = 957, +    [892] = 958, +    [893] = 959, +    [894] = 960, +    [895] = 961, +    [896] = 962, +    [897] = 963, +    [898] = 964, +    [899] = 965, +    [900] = 966, +    [901] = 967, +    [902] = 968, +    [903] = 969, +    [904] = 970, +    [905] = 971, +    [906] = 972, +    [907] = 973, +    [908] = 974, +    [909] = 975, +    [910] = 984, +    [911] = 985, +    [912] = 997, +    [913] = 998, +    [914] = 999, +    [915] = 1000, +    [916] = 1001, +    [917] = 1002, +    [918] = 1003, +    [919] = 1004, +    [920] = 1005, +    [921] = 1006, +    [922] = 1007, +    [923] = 1027, +    [924] = 1028, +    [925] = 1029, +    [926] = 1030, +    [927] = 1031, +    [928] = 1032, +    [929] = 1033, +    [930] = 1034, +    [931] = 1035, +    [932] = 1036, +    [933] = 1037, +    [934] = 1038, +    [935] = 1039, +    [936] = 1040, +    [937] = 1041, +    [938] = 1042, +    [939] = 1043, +    [940] = 1044, +    [941] = 1045, +    [942] = 1046, +    [943] = 1047, +    [944] = 1048, +    [945] = 1049, +    [946] = 1050, +    [947] = 1051, +    [948] = 1052, +    [949] = 1053, +    [950] = 1054, +    [951] = 1055, +    [952] = 1056, +    [953] = 1057, +    [954] = 1058, +    [955] = 1059, +    [956] = 1060, +    [957] = 1061, +    [958] = 1062, +    [959] = 1063, +    [960] = 1064, +    [961] = 1065, +    [962] = 1066, +    [963] = 1067, +    [964] = 1068, +    [965] = 1069, +    [966] = 1070, +    [967] = 1071, +    [968] = 1072, +    [969] = 1077, +    [970] = 1083, +    [971] = 1085, +    [972] = 1095, +    [973] = 1096, +    [974] = 1097, +    [975] = 1098, +    [976] = 1099, +    [977] = 1100, +    [978] = 1101, +    [979] = 1102, +    [980] = 1103, +    [981] = 1104, +    [982] = 1105, +    [983] = 1106, +    [984] = 1107, +    [985] = 1108, +    [986] = 1109, +    [987] = 1110, +    [988] = 1111, +    [989] = 1112, +    [990] = 1113, +    [991] = 1114, +    [992] = 1115, +    [993] = 1116, +    [994] = 1117, +    [995] = 1118, +    [996] = 1119, +    [997] = 1120, +    [998] = 1121, +    [999] = 1122, +    [1000] = 1123, +    [1001] = 1124, +    [1002] = 1125, +    [1003] = 1126, +    [1004] = 1127, +    [1005] = 1128, +    [1006] = 1129, +    [1007] = 1130, +    [1008] = 1131, +    [1009] = 1132, +    [1010] = 1133, +    [1011] = 1134, +    [1012] = 1135, +    [1013] = 1136, +    [1014] = 1137, +    [1015] = 1138, +    [1016] = 1139, +    [1017] = 1140, +    [1018] = 1141, +    [1019] = 1142, +    [1020] = 1143, +    [1526] = 1649, +    [1527] = 1650, +    [1528] = 1651, +    [1529] = 1652, +    [1530] = 1653, +    [1531] = 1654, +    [1532] = 1655, +    [1533] = 1656, +    [1534] = 1657, +    [1535] = 1658, +    [1536] = 1659, +    [1537] = 1660, +    [1538] = 1661, +    [1539] = 1662, +    [1540] = 1663, +    [1541] = 1664, +    [1542] = 1665, +    [1543] = 1666, +    [1544] = 1667, +    [1545] = 1668, +    [1546] = 1669, +    [1547] = 1670, +    [1548] = 1671, +    [1549] = 1672, +    [1550] = 1673, +    [1551] = 1674, +    [1552] = 1675, +    [1553] = 1676, +    [1554] = 1677, +    [1555] = 1678, +    [1556] = 1679, +    [1557] = 1680, +    [1558] = 1681, +    [1559] = 1682, +    [1560] = 1683, +    [1561] = 1684, +    [1562] = 1685, +    [1563] = 1686, +    [1564] = 1687, +    [1565] = 1688, +    [1566] = 1689, +    [1567] = 1690, +    [1568] = 1691, +    [1569] = 1692, +    [1570] = 1693, +    [1571] = 1694, +    [1572] = 1695, +    [1573] = 1696, +    [1574] = 1697, +    [1575] = 1698, +    [1576] = 1699, +    [1577] = 1700, +    [1578] = 1701, +    [1579] = 1702, +    [1580] = 1703, +    [1581] = 1704, +    [1582] = 1705, +    [1583] = 1706, +    [1584] = 1707, +    [1585] = 1708, +    [1586] = 1709, +    [1587] = 1710, +    [1588] = 1711, +    [1589] = 1712, +    [1590] = 1713, +    [1591] = 1714, +    [1592] = 1715, +    [1593] = 1716, +    [1594] = 1717, +    [1595] = 1718, +    [1596] = 1719, +    [1597] = 1720, +    [1598] = 1721, +    [1599] = 1722, +    [1600] = 1723, +    [1601] = 1724, +    [1602] = 1725, +    [1603] = 1726, +    [1604] = 1727, +    [1605] = 1728, +    [1606] = 1729, +    [1607] = 1730, +    [1608] = 1731, +    [1609] = 1732, +    [1610] = 1733, +    [1611] = 1734, +    [1612] = 1735, +    [1613] = 1736, +    [1614] = 1737, +    [1615] = 1738, +    [1616] = 1739, +    [1617] = 1740, +    [1618] = 1741, +    [1619] = 1742, +    [1620] = 1743, +    [1621] = 1744, +    [1622] = 1745, +    [1623] = 1746, +    [1624] = 1747, +    [1625] = 1748, +    [1626] = 1749, +    [1627] = 1750, +    [1628] = 1751, +    [1629] = 1752, +    [1630] = 1753, +    [1631] = 1754, +    [1632] = 1755, +    [1633] = 1756, +    [1634] = 1757, +    [1635] = 1758, +    [1636] = 1759, +    [1637] = 1760, +    [1662] = 1785, +    [1663] = 1786, +    [1664] = 1787, +    [1665] = 1788, +    [1666] = 1789, +    [1667] = 1790, +    [1668] = 1791, +    [1669] = 1792, +    [1670] = 1793, +    [1671] = 1794, +    [1672] = 1795, +    [1673] = 1796, +    [1674] = 1797, +    [1675] = 1798, +    [1676] = 1799, +    [1677] = 1800, +    [1678] = 1801, +    [1679] = 1802, +    [1680] = 1803, +    [1681] = 1804, +    [1682] = 1805, +    [1683] = 1806, +    [1684] = 1807, +    [1685] = 1808, +    [1686] = 1809, +    [1687] = 1810, +    [1705] = 1828, +    [1706] = 1829, +    [1707] = 1830, +    [1708] = 1831, +    [1709] = 1832, +    [1710] = 1833, +    [1711] = 1834, +    [1712] = 1835, +    [1713] = 1836, +    [1714] = 1837, +    [1715] = 1838, +    [1716] = 1839, +    [1717] = 1840, +    [1718] = 1841, +    [1719] = 1842, +    [1720] = 1843, +    [1721] = 1844, +    [1722] = 1845, +    [1723] = 1846, +    [1724] = 1847, +    [1725] = 1848, +    [1726] = 1849, +    [1727] = 1850, +    [1728] = 1851, +    [1729] = 1852, +    [1730] = 1853, +    [1731] = 1854, +    [1732] = 1855, +    [1733] = 1856, +    [1734] = 1857, +    [1735] = 1858, +    [1736] = 1859, +    [1737] = 1860, +    [1738] = 1861, +    [1739] = 1862, +    [1740] = 1863, +    [1741] = 1864, +    [1742] = 1865, +    [1743] = 1866, +    [1744] = 1867, +    [1745] = 1868, +    [1746] = 1869, +    [1747] = 1870, +    [1748] = 1871, +    [1749] = 1872, +    [1750] = 1873, +    [1751] = 1874, +    [1752] = 1875, +    [1753] = 1876, +    [1754] = 1877, +    [1755] = 1878, +    [1756] = 1879, +    [1757] = 1880, +    [1758] = 1881, +    [1759] = 1882, +    [1760] = 1883, +    [1761] = 1884, +    [1762] = 1885, +    [1763] = 1886, +    [1764] = 1887, +    [1765] = 1888, +    [1766] = 1889, +    [1767] = 1890, +    [1768] = 1891, +    [1769] = 1892, +    [1770] = 1893, +    [1771] = 1894, +    [1772] = 1895, +    [1773] = 1896, +    [1774] = 1897, +    [1775] = 1898, +    [1776] = 1899, +    [1777] = 1900, +    [1778] = 1901, +    [1779] = 1902, +    [1780] = 1903, +    [1781] = 1904, +    [1782] = 1905, +    [1783] = 1906, +    [1784] = 1907, +    [1785] = 1908, +    [1786] = 1909, +    [1787] = 1910, +    [1788] = 1911, +    [1789] = 1912, +    [1790] = 1913, +    [1791] = 1914, +    [1792] = 1915, +    [1793] = 1916, +    [1794] = 1917, +    [1795] = 1918, +    [1796] = 1919, +    [1797] = 1920, +    [1798] = 1921, +    [1799] = 1922, +    [1800] = 1923, +    [1801] = 1924, +    [1802] = 1925, +    [1803] = 1926, +    [1804] = 1927, +    [1805] = 1928, +    [1811] = 1934, +    [1812] = 1935, +    [1813] = 1936, +    [1814] = 1937, +    [1815] = 1938, +    [1816] = 1939, +    [1817] = 1940, +    [1818] = 1941, +    [1819] = 1942, +    [1820] = 1943, +    [1821] = 1944, +    [1822] = 1945, +    [1823] = 1946, +    [1824] = 1946, +    [1825] = 1947, +    [1826] = 1948, +    [1827] = 1949, +    [1828] = 1950, +    [1829] = 1951, +    [1830] = 1952, +    [1831] = 1953, +    [1832] = 1954, +    [1833] = 1955, +    [1834] = 1956, +    [1835] = 1957, +    [1836] = 1958, +    [1837] = 1959, +    [1838] = 1960, +    [1840] = 1963, +    [1841] = 1964, +    [1842] = 1965, +    [1843] = 1966, +    [1844] = 1967, +    [1845] = 1968, +    [1846] = 1969, +    [1847] = 1970, +    [1848] = 1971, +    [1849] = 1972, +    [1850] = 1973, +    [1851] = 1974, +    [1852] = 1975, +    [1855] = 1978, +    [1856] = 1979, +    [1857] = 1980, +    [1858] = 1981, +    [1859] = 1982, +    [1860] = 1983, +    [1861] = 1984, +    [1862] = 1985, +    [1863] = 1986, +    [1864] = 1987, +    [1865] = 1988, +    [1866] = 1989, +    [1869] = 1992, +    [1870] = 1993, +    [1871] = 1994, +    [1872] = 1995, +    [1873] = 1996, +    [1874] = 1997, +    [1875] = 1998, +    [1876] = 1999, +    [1877] = 2000, +    [1878] = 2001, +    [1879] = 2002, +    [1880] = 2003, +    [1883] = 2006, +    [1884] = 2007, +    [1885] = 2008, +    [1886] = 2009, +    [1887] = 2010, +    [1888] = 2011, +    [1889] = 2012, +    [1890] = 2013, +    [1891] = 2014, +    [1892] = 2015, +    [1893] = 2016, +    [1894] = 2017, +    [1897] = 2020, +    [1898] = 2021, +    [1899] = 2022, +    [1900] = 2023, +    [1901] = 2024, +    [1902] = 2025, +    [1903] = 2026, +    [1904] = 2027, +    [1905] = 2028, +    [1906] = 2029, +    [1907] = 2030, +    [1908] = 2031, +    [1911] = 2034, +    [1912] = 2035, +    [1913] = 2036, +    [1914] = 2037, +    [1915] = 2038, +    [1916] = 2039, +    [1917] = 2040, +    [1918] = 2041, +    [1919] = 2042, +    [1920] = 2043, +    [1921] = 2044, +    [1922] = 2045, +    [1923] = 2046, +    [1926] = 2049, +    [1927] = 2050, +    [1928] = 2051, +    [1929] = 2052, +    [1930] = 2053, +    [1931] = 2054, +    [1932] = 2055, +    [1933] = 2056, +    [1934] = 2057, +    [1935] = 2058, +    [1936] = 2059, +    [1937] = 2060, +    [1938] = 2061, +    [1941] = 2064, +    [1942] = 2065, +    [1943] = 2066, +    [1944] = 2067, +    [1945] = 2068, +    [1946] = 2069, +    [1947] = 2070, +    [1948] = 2071, +    [1949] = 2072, +    [1950] = 2073, +    [1951] = 2074, +    [1952] = 2075, +    [1953] = 2076, +    [1956] = 2079, +    [1957] = 2080, +    [1958] = 2081, +    [1959] = 2082, +    [1960] = 2083, +    [1961] = 2084, +    [1962] = 2085, +    [1963] = 2086, +    [1964] = 2087, +    [1965] = 2088, +    [1966] = 2089, +    [1967] = 2090, +    [1970] = 2093, +    [1971] = 2094, +    [1972] = 2095, +    [1973] = 2096, +    [1974] = 2097, +    [1975] = 2098, +    [1976] = 2099, +    [1977] = 2100, +    [1978] = 2101, +    [1979] = 2102, +    [1980] = 2103, +    [1981] = 2104, +    [1982] = 2105, +    [1985] = 2108, +    [2018] = 2141, +    [2019] = 2142, +    [2020] = 2143, +    [2021] = 2144, +    [2022] = 2145, +    [2023] = 2146, +    [2024] = 2147, +    [2025] = 2148, +    [2026] = 2149, +    [2027] = 2150, +    [2028] = 2151, +    [2029] = 2152, +    [2030] = 2153, +    [2031] = 2154, +    [2032] = 2155, +    [2033] = 2156, +    [2034] = 2157, +    [2035] = 2158, +    [2036] = 2159, +    [2037] = 2160, +    [2038] = 2161, +    [2039] = 2162, +    [2040] = 2163, +    [2041] = 2164, +    [2042] = 2165, +    [2043] = 2166, +    [2044] = 2167, +    [2045] = 2168, +    [2046] = 2169, +    [2047] = 2170, +    [2048] = 2171, +    [2049] = 2172, +    [2050] = 2173, +    [2051] = 2174, +    [2052] = 2175, +    [2053] = 2176, +    [2054] = 2177, +    [2055] = 2178, +    [2056] = 2179, +    [2057] = 2180, +    [2058] = 2181, +    [2059] = 2182, +    [2060] = 2183, +    [2061] = 2184, +    [2062] = 2185, +    [2063] = 2186, +    [2064] = 2187, +    [2065] = 2188, +    [2066] = 2189, +    [2067] = 2190, +    [2068] = 2191, +    [2069] = 2192, +    [2070] = 2193, +    [2071] = 2194, +    [2072] = 2195, +    [2073] = 2196, +    [2074] = 2197, +    [2075] = 2198, +    [2076] = 2199, +    [2077] = 2200, +    [2078] = 2201, +    [2079] = 2202, +    [2080] = 2203, +    [2081] = 2204, +    [2082] = 2205, +    [2083] = 2206, +    [2084] = 2207, +    [2085] = 2208, +    [2086] = 2209, +    [2087] = 2210, +    [2088] = 2211, +    [2089] = 2212, +    [2090] = 2213, +    [2091] = 2214, +    [2092] = 2215, +    [2093] = 2216, +    [2094] = 2217, +    [2095] = 2218, +    [2096] = 2219, +    [2097] = 2220, +    [2098] = 2221, +    [2099] = 2222, +    [2100] = 2223, +    [2101] = 2224, +    [2102] = 2225, +    [2103] = 2226, +    [2104] = 2227, +    [2105] = 2228, +    [2106] = 2229, +    [2107] = 2230, +    [2108] = 2231, +    [2109] = 2232, +    [2110] = 2233, +    [2111] = 2234, +    [2112] = 2235, +    [2113] = 2236, +    [2114] = 2237, +    [2115] = 2238, +    [2116] = 2239, +    [2117] = 2240, +    [2118] = 2241, +    [2119] = 2242, +    [2120] = 2243, +    [2121] = 2244, +    [2122] = 2245, +    [2123] = 2246, +    [2124] = 2247, +    [2125] = 2248, +    [2126] = 2249, +    [2127] = 2250, +    [2128] = 2251, +    [2129] = 2252, +    [2130] = 2253, +    [2131] = 2254, +    [2132] = 2255, +    [2133] = 2256, +    [2134] = 2257, +    [2135] = 2258, +    [2136] = 2259, +    [2137] = 2260, +    [2138] = 2261, +    [2139] = 2262, +    [2140] = 2263, +    [2141] = 2264, +    [2142] = 2265, +    [2143] = 2266, +    [2144] = 2267, +    [2145] = 2268, +    [2146] = 2269, +    [2147] = 2270, +    [2148] = 2271, +    [2149] = 2272, +    [2150] = 2273, +    [2151] = 2274, +    [2152] = 2275, +    [2153] = 2276, +    [2154] = 2277, +    [2155] = 2278, +    [2156] = 2279, +    [2157] = 2280, +    [2158] = 2281, +    [2159] = 2282, +    [2160] = 2283, +    [2161] = 2284, +    [2162] = 2285, +    [2163] = 2286, +    [2164] = 2287, +    [2165] = 2288, +    [2166] = 2289, +    [2167] = 2290, +    [2168] = 2291, +    [2169] = 2292, +    [2170] = 2293, +    [2171] = 2294, +    [2172] = 2295, +    [618] = 684, +    [1021] = 2223, +    [4] = 4, +    [6] = 6, +    [2212] = 2335, +    [2213] = 2336, +    [2214] = 2337, +    [2215] = 2338, +    [2216] = 2339, +    [2217] = 2340, +    [2218] = 2341, +    [2219] = 2342, +    [2220] = 2343, +    [2221] = 2344, +    [2222] = 2345, +    [2223] = 2346, +    [2224] = 2347, +    [2225] = 2348, +    [2226] = 2349, +    [2227] = 2350, +    [2228] = 2351, +    [2229] = 2352, +    [2230] = 2353, +    [2231] = 2354, +    [2232] = 2355, +    [2233] = 2356, +    [2234] = 2357, +    [2235] = 2358, +    [2236] = 2359, +    [2237] = 2360, +    [2238] = 2361, +    [2239] = 2362, +    [2240] = 2363, +    [2241] = 2364, +    [2242] = 2365, +    [2243] = 2366, +    [2244] = 2367, +    [2245] = 2368, +    [2246] = 2369, +    [2247] = 2370, +    [2248] = 2371, +    [2249] = 2372, +    [2250] = 2373, +    [2251] = 2374, +    [2252] = 2375, +    [2253] = 2376, +    [2254] = 2377, +    [2255] = 2378, +    [2256] = 2379, +    [2257] = 2380, +    [2258] = 2381, +    [2259] = 2382, +    [2260] = 2383, +    [2261] = 2384, +    [2262] = 2385, +    [2263] = 2386, +    [2264] = 2387, +    [2265] = 2388, +    [2266] = 2389, +    [2267] = 2390, +    [2268] = 2391, +    [2269] = 2392, +    [2270] = 2393, +    [2271] = 2394, +    [2272] = 2395, +    [2273] = 2396, +    [2274] = 2397, +    [2275] = 2398, +    [2276] = 2399, +    [2277] = 2400, +    [2278] = 2401, +    [2279] = 2402, +    [2280] = 2403, +    [2281] = 2404, +    [2282] = 2405, +    [2283] = 2406, +    [2284] = 2407, +    [2285] = 2408, +    [2286] = 2409, +    [2287] = 2410, +    [2288] = 2411, +    [2289] = 2412, +    [2290] = 2413, +    [2291] = 2414, +    [2320] = 2443, +    [2321] = 2444, +    [2322] = 2445, +    [2323] = 2446, +    [2324] = 2447, +    [2325] = 2448, +    [2326] = 2449, +    [2327] = 2450, +    [2328] = 2451, +    [2329] = 2452, +    [2330] = 2453, +    [2331] = 2454, +    [2332] = 2455, +    [2333] = 2456, +    [2334] = 2457, +    [2335] = 2458, +    [2336] = 2459, +    [2337] = 2460, +    [2338] = 2461, +    [2339] = 2462, +    [2340] = 2463, +    [2341] = 2464, +    [2342] = 2465, +    [2343] = 2466, +    [2344] = 2467, +    [2345] = 2468, +    [2346] = 2469, +    [2347] = 2470, +    [2348] = 2471, +    [2349] = 2472, +    [2350] = 2473, +    [2351] = 2474, +    [2352] = 2475, +    [2353] = 2476, +    [2354] = 2477, +    [2355] = 2478, +    [2356] = 2479, +    [2357] = 2480, +    [2358] = 2481, +    [2359] = 2482, +    [2360] = 2483, +    [2361] = 2484, +    [2362] = 2485, +    [2363] = 2486, +    [2364] = 2487, +    [2365] = 2488, +    [2366] = 2489, +    [2367] = 2490, +    [2368] = 2491, +    [2369] = 2492, +    [2370] = 2493, +    [2371] = 2494, +    [2372] = 2495, +    [2373] = 2496, +    [2374] = 2497, +    [2375] = 2498, +    [2376] = 2499, +    [2377] = 2500, +    [2378] = 2501, +    [2379] = 2502, +    [2380] = 2503, +    [2381] = 2504, +    [2382] = 2505, +    [2383] = 2506, +    [2384] = 2507, +    [2385] = 2508, +    [2386] = 2509, +    [2387] = 2510, +    [2388] = 2511, +    [2389] = 2512, +    [2390] = 2513, +    [2391] = 2514, +    [2392] = 2515, +    [2393] = 2516, +    [2394] = 2517, +    [2395] = 2518, +    [2396] = 2519, +    [2397] = 2520, +    [2398] = 2521, +    [2399] = 2522, +    [2400] = 2523, +    [2401] = 2524, +    [2402] = 2525, +    [2403] = 2526, +    [2404] = 2527, +    [2405] = 2528, +    [2406] = 2529, +    [2407] = 2530, +    [2408] = 2531, +    [2409] = 2532, +    [2410] = 2533, +    [2411] = 2534, +    [2412] = 2535, +    [2413] = 2536, +    [2414] = 2537, +    [2415] = 2538, +    [2416] = 2539, +    [2417] = 2540, +    [2418] = 2541, +    [2419] = 2542, +    [2420] = 2543, +    [2421] = 2544, +    [2422] = 2545, +    [2423] = 2546, +    [2424] = 2547, +    [2425] = 2548, +    [2426] = 2549, +    [2427] = 2550, +    [2428] = 2551, +    [2429] = 2552, +    [2430] = 2553, +    [2431] = 2554, +    [2432] = 2555, +    [2433] = 2556, +    [2434] = 2557, +    [2435] = 2558, +    [2436] = 2559, +    [2437] = 2560, +    [2438] = 2561, +    [2439] = 2562, +    [2440] = 2563, +    [2441] = 2564, +    [2442] = 2565, +    [2443] = 2566, +    [2444] = 2567, +    [2445] = 2568, +    [2446] = 2569, +    [2447] = 2570, +    [2448] = 2571, +    [2449] = 2572, +    [2450] = 2573, +    [2451] = 2574, +    [2452] = 2575, +    [2453] = 2576, +    [2454] = 2577, +    [2455] = 2578, +    [2456] = 2579, +    [2457] = 2580, +    [2458] = 2581, +    [2459] = 2582, +    [2460] = 2583, +    [2461] = 2584, +    [2462] = 2585, +    [2463] = 2586, +    [2464] = 2587, +    [2465] = 2588, +    [2466] = 2589, +    [2467] = 2590, +    [2468] = 2591, +    [2469] = 2592, +    [2470] = 2593, +    [2471] = 2594, +    [2472] = 2595, +    [2473] = 2596, +    [2474] = 2597, +    [2475] = 2598, +    [2476] = 2599, +    [2477] = 2600, +    [2478] = 2601, +    [2479] = 2602, +    [2480] = 2603, +    [2481] = 2604, +    [2482] = 2605, +    [2483] = 2606, +    [2484] = 2607, +    [2485] = 2608, +    [2486] = 2609, +    [2487] = 2610, +    [2488] = 2611, +    [2489] = 2612, +    [2490] = 2613, +    [2491] = 2614, +    [2492] = 2615, +    [2493] = 2616, +    [2494] = 2617, +    [2495] = 2618, +    [2496] = 2619, +    [2497] = 2620, +    [2498] = 2621, +    [2499] = 2622, +    [2500] = 2623, +    [2501] = 2624, +    [2502] = 2625, +    [2503] = 2626, +    [2504] = 2627, +    [2505] = 2628, +    [2506] = 2629, +    [2507] = 2630, +    [2508] = 2631, +    [2509] = 2632, +    [2510] = 2633, +    [2511] = 2634, +    [2512] = 2635, +    [2513] = 2636, +    [2514] = 2637, +    [2515] = 2638, +    [2516] = 2639, +    [2517] = 2640, +    [2518] = 2641, +    [2519] = 2642, +    [2520] = 2643, +    [2521] = 2644, +    [2522] = 2645, +    [2523] = 2646, +    [2524] = 2647, +    [2525] = 2648, +    [2526] = 2649, +    [2527] = 2650, +    [2528] = 2651, +    [2529] = 2652, +    [2530] = 2653, +    [2531] = 2654, +    [2532] = 2655, +    [2533] = 2656, +    [2534] = 2657, +    [2535] = 2658, +    [2536] = 2659, +    [2537] = 2660, +    [2538] = 2661, +    [2539] = 2662, +    [2540] = 2663, +    [2541] = 2664, +    [2542] = 2665, +    [2543] = 2666, +    [2544] = 2667, +    [2545] = 2668, +    [2546] = 2669, +    [2547] = 2670, +    [2548] = 2671, +    [2549] = 2672, +    [2550] = 2673, +    [2551] = 2674, +    [2552] = 2675, +    [2553] = 2676, +    [2554] = 2677, +    [2555] = 2678, +    [2556] = 2679, +    [2557] = 2680, +    [2558] = 2681, +    [2559] = 2682, +    [2560] = 2683, +    [2561] = 2684, +    [2562] = 2685, +    [2563] = 2686, +    [2564] = 2687, +    [2565] = 2688, +    [2566] = 2689, +    [2567] = 2690, +    [2568] = 2691, +    [2569] = 2692, +    [2570] = 2693, +    [2571] = 2694, +    [2572] = 2695, +    [2573] = 2696, +    [2574] = 2697, +    [2575] = 2698, +    [2576] = 2699, +    [2577] = 2700, +    [2578] = 2701, +    [2579] = 2702, +    [2580] = 2703, +    [2581] = 2704, +    [2582] = 2705, +    [2583] = 2706, +    [2584] = 2707, +    [2585] = 2708, +    [2586] = 2709, +    [2587] = 2710, +    [2588] = 2711, +    [2589] = 2712, +    [2590] = 2713, +    [2591] = 2714, +    [2592] = 2715, +    [2593] = 2716, +    [2594] = 2717, +    [2595] = 2718, +    [2596] = 2719, +    [2597] = 2720, +    [2598] = 2721, +    [2599] = 2722, +    [2600] = 2723, +    [2601] = 2724, +    [2602] = 2725, +    [2603] = 2726, +    [2604] = 2727, +    [2605] = 2728, +    [2606] = 2729, +    [2607] = 2730, +    [2608] = 2731, +    [2609] = 2732, +    [2610] = 2733, +    [2611] = 2734, +    [2612] = 2735, +    [2613] = 2736, +    [2614] = 2737, +    [2615] = 2738, +    [2616] = 2739, +    [2617] = 2740, +    [2618] = 2741, +    [2619] = 2742, +    [2620] = 2743, +    [2621] = 2744, +    [2622] = 2745, +    [2623] = 2746, +    [2624] = 2747, +    [2625] = 2748, +    [2626] = 2749, +    [2627] = 2750, +    [2628] = 2751, +    [2629] = 2752, +    [2630] = 2753, +    [2631] = 2754, +    [2632] = 2755, +    [2633] = 2756, +    [2634] = 2757, +    [2635] = 2758, +    [2636] = 2759, +    [2637] = 2760, +    [2638] = 2761, +    [2639] = 2762, +    [2640] = 2763, +    [2641] = 2764, +    [2642] = 2765, +    [2643] = 2766, +    [2644] = 2767, +    [2645] = 2768, +    [2646] = 2769, +    [2647] = 2770, +    [2648] = 2771, +    [2649] = 2772, +    [2650] = 2773, +    [2651] = 2774, +    [2652] = 2775, +    [2653] = 2776, +    [2654] = 2777, +    [2655] = 2778, +    [2656] = 2779, +    [2657] = 2780, +    [2658] = 2781, +    [2659] = 2782, +    [2660] = 2783, +    [2661] = 2784, +    [2662] = 2785, +    [2663] = 2786, +    [2664] = 2787, +    [2665] = 2788, +    [2666] = 2789, +    [2667] = 2790, +    [2668] = 2791, +    [2669] = 2792, +    [2670] = 2793, +    [2671] = 2794, +    [2672] = 2795, +    [2673] = 2796, +    [2674] = 2797, +    [2675] = 2798, +    [2676] = 2799, +    [2677] = 2800, +    [2678] = 2801, +    [2679] = 2802, +    [2680] = 2803, +    [2681] = 2804, +    [2682] = 2805, +    [2683] = 2806, +    [2684] = 2807, +    [2685] = 2808, +    [2686] = 2809, +    [2687] = 2810, +    [2688] = 2811, +    [2689] = 2812, +    [2690] = 2813, +    [2691] = 2814, +    [2692] = 2815, +    [2693] = 2816, +    [2694] = 2817, +    [2695] = 2818, +    [2696] = 2819, +    [2697] = 2820, +    [2698] = 2821, +    [2699] = 2822, +    [2700] = 2823, +    [2701] = 2824, +    [2702] = 2825, +    [2703] = 2826, +    [2704] = 2827, +    [2705] = 2828, +    [2706] = 2829, +    [2707] = 2830, +    [2708] = 2831, +    [2709] = 2832, +    [2710] = 2833, +    [2711] = 2834, +    [2712] = 2835, +    [2713] = 2836, +    [2714] = 2837, +    [2715] = 2838, +    [2716] = 2839, +    [2717] = 2840, +    [2718] = 2841, +    [2719] = 2842, +    [2720] = 2843, +    [2721] = 2844, +    [2722] = 2845, +    [2723] = 2846, +    [2724] = 2847, +    [2725] = 2848, +    [2726] = 2849, +    [2727] = 2850, +    [2728] = 2851, +    [2729] = 2852, +    [2730] = 2853, +    [2731] = 2854, +    [2732] = 2855, +    [2733] = 2856, +    [2734] = 2857, +    [2735] = 2858, +    [2736] = 2859, +    [2737] = 2860, +    [2738] = 2861, +    [2739] = 2862, +    [2740] = 2863, +    [2741] = 2864, +    [2742] = 2865, +    [2743] = 2866, +    [2744] = 2867, +    [2745] = 2868, +    [2746] = 2869, +    [2747] = 2870, +    [2748] = 2871, +    [2749] = 2872, +    [2750] = 2873, +    [2751] = 2874, +    [2752] = 2875, +    [2753] = 2876, +    [2754] = 2877, +    [2755] = 2878, +    [2756] = 2879, +    [2757] = 2880, +    [2758] = 2881, +    [2759] = 2882, +    [2760] = 2883, +    [2761] = 2884, +    [2762] = 2885, +    [2763] = 2886, +    [2764] = 2887, +    [2765] = 2888, +    [2766] = 2889, +    [2767] = 2890, +    [2768] = 2891, +    [2769] = 2892, +    [2770] = 2893, +    [2771] = 2894, +    [2772] = 2895, +    [2773] = 2896, +    [2774] = 2897, +    [2775] = 2898, +    [2776] = 2899, +    [2777] = 2900, +    [2778] = 2901, +    [2779] = 2902, +    [2780] = 2903, +    [2781] = 2904, +    [2782] = 2905, +    [2783] = 2906, +    [2784] = 2907, +    [2785] = 2908, +    [2786] = 2909, +    [2787] = 2910, +    [2788] = 2911, +    [2789] = 2912, +    [2790] = 2913, +    [2791] = 2914, +    [2792] = 2915, +    [2793] = 2916, +    [2794] = 2917, +    [2795] = 2918, +    [2796] = 2919, +    [2797] = 2920, +    [2798] = 2921, +    [2799] = 2922, +    [2800] = 2923, +    [2801] = 2924, +    [2802] = 2925, +    [2803] = 2926, +    [2804] = 2927, +    [2805] = 2928, +    [2806] = 2929, +    [2807] = 2930, +    [2808] = 2931, +    [2809] = 2932, +    [2810] = 2933, +    [2811] = 2934, +    [2812] = 2935, +    [2813] = 2936, +    [2814] = 2937, +    [2815] = 2938, +    [2816] = 2939, +    [2817] = 2940, +    [2818] = 2941, +    [2819] = 2942, +    [2821] = 2944, +    [2840] = 2963, +    [2841] = 2964, +    [2857] = 2980, +    [2870] = 2993, +    [2871] = 2994, +    [2872] = 2995, +    [2873] = 2996, +    [2874] = 2997, +    [2875] = 2998, +    [2876] = 2999, +    [2877] = 3000, +    [2880] = 3003, +    [2884] = 3007, +    [2937] = 3060, +    [3005] = 3128, +    [3016] = 3139, +    [3130] = 3253, +    [3131] = 3254, +    [3132] = 3255, +    [3133] = 3256, +    [3134] = 3257, +    [3135] = 3258, +    [3136] = 3259, +    [3137] = 3260, +    [3138] = 3261, +    [3139] = 3262, +    [3140] = 3263, +    [3141] = 3264, +    [3142] = 3265, +    [3143] = 3266, +    [3144] = 3267, +    [3145] = 3268, +    [3146] = 3269, +    [3147] = 3270, +    [3148] = 3271, +    [3149] = 3272, +    [3150] = 3273, +    [3151] = 3274, +    [3152] = 3275, +    [3153] = 3276, +    [3154] = 3277, +    [3155] = 3278, +    [3156] = 3279, +    [3157] = 3280, +    [3158] = 3281, +    [3159] = 3282, +    [3160] = 3283, +    [3161] = 3284, +    [3162] = 3285, +    [3163] = 3286, +    [3164] = 3287, +    [3165] = 3288, +    [3166] = 3289, +    [3167] = 3290, +    [3168] = 3291, +    [3169] = 3292, +    [3170] = 3293, +    [3171] = 3294, +    [3172] = 3295, +    [3173] = 3296, +    [3174] = 3297, +    [3175] = 3298, +    [3176] = 3299, +    [3177] = 3300, +    [3178] = 3301, +    [3179] = 3302, +    [3180] = 3303, +    [3181] = 3304, +    [3182] = 3305, +    [3183] = 3306, +    [3184] = 3307, +    [3185] = 3308, +    [3186] = 3309, +    [3187] = 3310, +    [3188] = 3311, +    [3189] = 3312, +    [3190] = 3313, +    [3191] = 3314, +    [3192] = 3315, +    [3193] = 3316, +    [3194] = 3317, +    [3195] = 3318, +    [3196] = 3319, +    [3197] = 3320, +    [3198] = 3321, +    [3199] = 3322, +    [3200] = 3323, +    [3201] = 3324, +    [3202] = 3325, +    [3203] = 3326, +    [3204] = 3327, +    [3205] = 3328, +    [3206] = 3329, +    [3207] = 3330, +    [3208] = 3331, +    [3209] = 3332, +    [3210] = 3333, +    [3211] = 3334, +    [3212] = 3335, +    [3213] = 3336, +    [3214] = 3337, +    [3215] = 3338, +    [3216] = 3339, +    [3217] = 3340, +    [3218] = 3341, +    [3219] = 3342, +    [3220] = 3343, +    [3221] = 3344, +    [3222] = 3345, +    [3223] = 3346, +    [3224] = 3347, +    [3225] = 3348, +    [3226] = 3349, +    [3227] = 3350, +    [3228] = 3351, +    [3229] = 3352, +    [3230] = 3353, +    [3231] = 3354, +    [3232] = 3355, +    [3233] = 3356, +    [3234] = 3357, +    [3235] = 3358, +    [3236] = 3359, +    [3237] = 3360, +    [3238] = 3361, +    [3239] = 3362, +    [3240] = 3363, +    [3241] = 3364, +    [3242] = 3365, +    [3243] = 3366, +    [3244] = 3367, +    [3245] = 3368, +    [3246] = 3369, +    [3247] = 3370, +    [3248] = 3371, +    [3249] = 3372, +    [3250] = 3373, +    [3251] = 3374, +    [3252] = 3375, +    [3253] = 3376, +    [3254] = 3377, +    [3255] = 3378, +    [3256] = 3379, +    [3257] = 3380, +    [3258] = 3381, +    [3259] = 3382, +    [3260] = 3383, +    [3261] = 3384, +    [3262] = 3385, +    [3263] = 3386, +    [3264] = 3387, +    [3265] = 3388, +    [3266] = 3389, +    [3267] = 3390, +    [3268] = 3391, +    [3269] = 3392, +    [3270] = 3393, +    [3271] = 3394, +    [3272] = 3395, +    [3273] = 3396, +    [3274] = 3397, +    [3275] = 3398, +    [3276] = 3399, +    [3277] = 3400, +    [3278] = 3401, +    [3279] = 3402, +    [3280] = 3403, +    [3281] = 3404, +    [3282] = 3405, +    [3283] = 3406, +    [3284] = 3407, +    [3285] = 3408, +    [3286] = 3409, +    [3287] = 3410, +    [3288] = 3411, +    [3289] = 3412, +    [3290] = 3413, +    [3291] = 3414, +    [3292] = 3415, +    [3293] = 3416, +    [3294] = 3417, +    [3295] = 3418, +    [3296] = 3419, +    [3297] = 3420, +    [3298] = 3421, +    [4795] = 4912, +} + diff --git a/VP-process.lua b/VP-process.lua index e4bd97d..f4c9bb0 100644 --- a/VP-process.lua +++ b/VP-process.lua @@ -6,6 +6,7 @@ load "VP-fontwork.lua"  load "VP-roomwork.lua"  load "VP-miscwork.lua"  load "VP-textwork.lua" +load "VP-jp-in-us.lua"  --restrict = {  --    [3610] = true, @@ -28,7 +29,14 @@ got_cd1 = false  got_cd2 = false  got_us = false  got_jp = false +got_eu = false  got_psp = false +got_add_cd1 = false +got_add_cd2 = false +got_add_us = false +got_add_jp = false +got_add_eu = false +got_add_psp = false  pspval1_sec = nil  psp_dirtrees = {} @@ -41,8 +49,6 @@ current_file = nil  extra_glyphs_file = nil  extra_glyphs = {} -globals = {} -  biggest_pad = 0  lookup_rooms = nil @@ -66,7 +72,7 @@ function dump_mkdir(dir) if dump_mode then mkdir(dir) end end  function log(str)      print(str) -    log_file:write(str .. "\n") +    if log_file then log_file:write(str .. "\n") end  end  function alignment(size, align) @@ -202,7 +208,7 @@ function do_dump(i)      return restrict[i]  end -function process_files(index, map, iso, iso_full, cindex) +function process_files(index, map, iso, iso_full, cindex, index_add, jp_in_us)      print("Processing files...")      local file_in, sig, is_slz, o, mode, dir, ftype      for i = 1, (num_entries - 1) do @@ -225,8 +231,14 @@ function process_files(index, map, iso, iso_full, cindex)              dump_mkdir("DUMP/" .. dir)              current_file = i              local file_out -            if not dump_mode and not do_dump(i) then +            if not dump_mode and not do_dump(i) and not jp_in_us then                  file_out = file_in +            elseif jp_in_us then +                local lookup = jp_in_us[i] +                if lookup then +                    log("JP-in-US: replacing file " .. i .. " by file " .. lookup) +                    file_out = index_add[lookup].cd:cdfile(index_add[lookup].sector, index_add[lookup].size * sec_sizes[mode]) +                end              elseif not ftype then                  file_out = process_single_file("DUMP/" .. dir .. string.format("/%04i", i), file_in, file_in:getsize(), ext)              elseif ftype == "arcgfx" then @@ -246,14 +258,17 @@ function process_files(index, map, iso, iso_full, cindex)  end  function main(...) -    local cd, cd2, iso_out = startup(...) +    local cd, cd2, iso_out, cd3, cd4 = startup(...)      iso_identify(cd)      if cd2 then iso_identify(cd2) end +    if cd3 then iso_identify(cd3, true) end +    if cd4 then iso_identify(cd4, true) end +    if not jp_in_us and not slz_decomp then error "luaslz module not found." end      local false_sect = Buffer(true)      false_sect:writeU8(0)      load_glyphes()      dump_mkdir "DUMP" -    log_file = Output "log.txt" +    _, log_file = pcall(Output, "log.txt")      local index, fkey, skey, fr, sr = load_index(cd)      if cd2 then          local index2 = load_index(cd2) @@ -261,13 +276,32 @@ function main(...)              if not index[k] then index[k] = v end          end      end -    for k, v in pairs(VP_maintypes) do -        dump_mkdir("DUMP/" .. v) +    local index_add +    if cd3 then +        index_add = load_index(cd3) +    end +    if cd4 and index_add then +        local index2_add = load_index(cd4) +        for k, v in pairs(index2_add) do +            if not index_add[k] then index_add[k] = v end +        end +    end +    if dump_mode then +        for k, v in pairs(VP_maintypes) do +            dump_mkdir("DUMP/" .. v) +        end      end      local iso_full = true      for i = 1, (num_files - 1) do          if not index[i] then iso_full = false end      end +    local iso_add_full = false +    if index_add then +        iso_add_full = true +        for i = 1, (num_files - 1) do +            if not index_add[i] then iso_add_full = false end +        end +    end      local iso, cindex      if not dump_mode then          iso = prepare_out(iso_out) @@ -277,7 +311,7 @@ function main(...)          lookup_rooms = Output "DUMP/GAME/rooms.lua"          lookup_rooms:write "rooms_lookup = {\n"      end -    process_files(index, VP_map, iso, iso_full, cindex) +    process_files(index, VP_map, iso, iso_full, cindex, index_add, jp_in_us and VP_jp_in_us or nil)      if dump_mode then          local o = Output "DUMP/GAME/rooms.xml"          o:write('<roomscripts>\n') @@ -303,3 +337,4 @@ function main(...)      log("Biggest pad = " .. biggest_pad)      log_file:destroy()  end +  | 
