Hacking Phantasy Star Portable 2 Infinity - English Translation

RisingHopperZeroOne

Well-Known Member
Newcomer
Joined
Jul 31, 2019
Messages
70
Trophies
0
Age
40
XP
257
Country
Australia
One again, as asked previously, there are no plans to distribute this at any point.
Also the .fpb structure for 1 is different if I remember correctly.

Seems like an undub would be a pain to make.
Out of interest have you got a link to the project?
Sorry but I don't, I saw it on a rom site years ago but the comments said it wasn't finished, same with 2.
I tried finding it again but I can't. It would be nice to have though since because it was on the psp, they didn't provide dual audio.
 

JamRules

.....
OP
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
Sorry but I don't, I saw it on a rom site years ago but the comments said it wasn't finished, same with 2.
I tried finding it again but I can't. It would be nice to have though since because it was on the psp, they didn't provide dual audio.

Okay, fair enough.
Anyone know if 1 US has voicing in all the scenes that the JP version had?
 

RisingHopperZeroOne

Well-Known Member
Newcomer
Joined
Jul 31, 2019
Messages
70
Trophies
0
Age
40
XP
257
Country
Australia
Well, 2 US only voices the movies, though I know 1 has at least some of the text scenes dubbed. If I remember rightly there was content cut on the JP version, but not sure.
Seems like it would be difficult to make an undub though.
Is it not possible to unpack the fpb for both the japanese and us game, copy the japanese files over and repack? Is the game programmed differently? Sorry if this is a hard question to answer briefly.
 

JamRules

.....
OP
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
Is it not possible to unpack the fpb for both the japanese and us game, copy the japanese files over and repack? Is the game programmed differently? Sorry if this is a hard question to answer briefly.
My fear is that the game would be programmed differently, or that there would be various pointers that need updating, but maybe that is not the case.
 
Last edited by JamRules,

Kion

Member
Newcomer
Joined
Sep 2, 2019
Messages
18
Trophies
0
Age
35
Location
Fuji-shi, Shizuoka
Website
dashgl.com
XP
143
Country
Japan
No, you could be right but it's not possible to test since gasetools doesn't work with either game for someone to make it.

Poking out of interest. I was able to get gasetools to compile, unpack the fpb file, and then extract the 'old' nbl archive type. Which aspects of packing and unpacking are you referring to when you indicate that gasetools doesn't work?
 

RisingHopperZeroOne

Well-Known Member
Newcomer
Joined
Jul 31, 2019
Messages
70
Trophies
0
Age
40
XP
257
Country
Australia
Poking out of interest. I was able to get gasetools to compile, unpack the fpb file, and then extract the 'old' nbl archive type. Which aspects of packing and unpacking are you referring to when you indicate that gasetools doesn't work?
I tried the windows version here https://github.com/Shadowth117/gasetoolsWin and I couldn't get it to unpack anything, it just hangs.
 

Kion

Member
Newcomer
Joined
Sep 2, 2019
Messages
18
Trophies
0
Age
35
Location
Fuji-shi, Shizuoka
Website
dashgl.com
XP
143
Country
Japan
I tried the windows version here https://github.com/Shadowth117/gasetoolsWin and I couldn't get it to unpack anything, it just hangs.

As a side note I can confirm the linux version works (at least for unpacking), so you might try setting up a VM. As for hanging, I had that issue, and the problem was that the the "file.fpb" archive that gasetools unpacks can take sometime to go through the entire file, so you might try waiting until it writes some files or crashes. Though at most it should be about two to four minutes, and that's running on a crappy fanless notebook with 4GB of memory.
 

RisingHopperZeroOne

Well-Known Member
Newcomer
Joined
Jul 31, 2019
Messages
70
Trophies
0
Age
40
XP
257
Country
Australia
As a side note I can confirm the linux version works (at least for unpacking), so you might try setting up a VM. As for hanging, I had that issue, and the problem was that the the "file.fpb" archive that gasetools unpacks can take sometime to go through the entire file, so you might try waiting until it writes some files or crashes. Though at most it should be about two to four minutes, and that's running on a crappy fanless notebook with 4GB of memory.
I know the linux version works, haven't heard anyone say anything about the windows version.
I see, I'll give it another try and see if it works.

Just wondering can you repack with the tools cause I couldn't find anything about it in the readme.

EDIT: Maybe I'm using it wrong but I can't get anything to unpack.

Is this correct fpb.exe file.fpb output_folder ?
 
Last edited by RisingHopperZeroOne,

JamRules

.....
OP
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
I know the linux version works, haven't heard anyone say anything about the windows version. I see, I'll give it another try and see if it works.

Just wondering can you repack with the tools cause I couldn't find anything about it in the readme.

EDIT: Maybe I'm using it wrong but I can't get anything to unpack.

Is this correct fpb.exe file.fpb output_folder ?

The Windows version works, or at least used to, as I used it way back in the day.
Edit: don’t remember where I got the windows one but I thought it was a version by essen.

As mentioned before that tool uses brute force to split up the files, which is okay for trying to take it apart and view the contents but not for rebuilding it. It also misses splitting at files that don’t have a magic of NMLL if I remember correctly.
 
Last edited by JamRules,

RisingHopperZeroOne

Well-Known Member
Newcomer
Joined
Jul 31, 2019
Messages
70
Trophies
0
Age
40
XP
257
Country
Australia
The Windows version works, or at least used to, as I used it way back in the day.
Edit: don’t remember where I got the windows one but I thought it was a version by essen.

As mentioned before that tool uses brute force to split up the files, which is okay for trying to take it apart and view the contents but not for rebuilding it. It also misses splitting at files that don’t have a magic of NMLL if I remember correctly.
Ah, well I guess it's better to wait for someone that cares enough to make proper tools then. Thanks for the explanation.
 
  • Like
Reactions: JamRules

JamRules

.....
OP
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
Ah, well I guess it's better to wait for someone that cares enough to make proper tools then. Thanks for the explanation.

I haven't looked as I'll need to dig out the game but if it's similar to PSP2i then my guess is the .fpb file contains audio files with a magic of RIFF. If PSP1 has proper dubbing unlike PSP2 then both the US and JP versions would have this, so potentially you could swap the RIFF files over. As a proof of concept you could use some sort of hex edit tool to do this but that would be a chore, you'll also need to find a suitable file where you know the point in the game it plays.
This only works if the audio files happen to be the same/similar size between the US and JP version which I wouldn't rely on, so you'll probably want to find out the format for the header and re-arrange the file pointers.
Then my guess is there must be pointers somewhere so the game knows which audio to load, whether or not these would need updating to know the size of the audio file I don't know but it may be a possibility.
 

Kion

Member
Newcomer
Joined
Sep 2, 2019
Messages
18
Trophies
0
Age
35
Location
Fuji-shi, Shizuoka
Website
dashgl.com
XP
143
Country
Japan
Ah, well I guess it's better to wait for someone that cares enough to make proper tools then. Thanks for the explanation.

I don't know if I would call this "proper", but in terms of simple pragmatic tools that work, I tried translating essen's fpb C program to nodejs, and I was able to unpack the nmll archive with his nbl tool. So i think the output should be the same.

Code:
/*
 * @author - Benjamin Collins - [email protected]
 * Adapted from : https://github.com/essen/gasetools
 * License : GPL 3.0
 */

"use strict";

const fs = require('fs');
console.log(process.argv);

if(process.argv.length !== 3) {
   console.error("Usage: node %s file.fpb", process.argv[1]);
   process.exit();
}
https://github.com/essen/gasetools
let ext = process.argv[2].split(".").pop();
if(ext !== "fpb") {
   console.error("Usage: node %s file.fpb", process.argv[1]);
   process.exit();
}

try {
   var src = fs.readFileSync(process.argv[2]);
} catch(err) {
   console.error("Error: could not open %s for reading", process.argv[2]);
   console.log(err);
   process.exit();
}

const NBL_ID_NMLL = 0x4C4C4D4E;
const NBL_ID_NMLB = 0x424C4D4E;
const NBL_ID_TMLL = 0x4C4C4D54;

const nbl = [];

for(let i = 0; i < src.length - 4; i+= 0x10) {
   let dword = src.readUInt32LE(i);
   if(dword !== NBL_ID_NMLL && dword !== NBL_ID_NMLB) {
       continue;
   }
   nbl.push(i);
}
nbl.push(src.length);

for(let i = 0; i < nbl.length - 1; i++) {

   let dst = src.subarray(nbl[i], nbl[i + 1]);
   let num = i.toString();
   while(num.length < 5) {
       num = "0" + num;
   }
 
   let name;
   if(dst[5]) {
       name = "nmll-"+num+"-new-format.nbl";
   } else {
       name = "nmll-"+num+".nbl";
   }

   fs.writeFileSync(name, dst);
}

You can save the code as "fpb.js". Install nodejs, on windows there should be an "add to path" option in the install which allows you to run node from the normal cmd console. Put fpb.js and the psp2i file.fpb into the same folder and run:

Code:
node fpb.js file.fpb

And after a few seconds you should have about ten thousand .nbl files populating the directory. You can run

Code:
mkdir out
mv *.nbl out

If you want to clean up the files and put the output in it's own out folder. As for the output there should be two kind of nbl files. the normal nmll-08894.nbl and then the "new" nmll-11408-new-format.nbl. I don't know what the difference between the new and normal files is, but I think essen's nbl tool only works on the normal files, and not the new ones. Either way you can test with nmll-08894.nbl which should contain the drop models like ob_xxx_drop_meseta.unj.
 
  • Like
Reactions: JamRules

JamRules

.....
OP
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
I don't know if I would call this "proper", but in terms of simple pragmatic tools that work, I tried translating essen's fpb C program to nodejs, and I was able to unpack the nmll archive with his nbl tool. So i think the output should be the same.

Code:
/*
 * @author - Benjamin Collins - [email protected]
 * Adapted from : https://github.com/essen/gasetools
 * License : GPL 3.0
 */

"use strict";

const fs = require('fs');
console.log(process.argv);

if(process.argv.length !== 3) {
   console.error("Usage: node %s file.fpb", process.argv[1]);
   process.exit();
}
https://github.com/essen/gasetools
let ext = process.argv[2].split(".").pop();
if(ext !== "fpb") {
   console.error("Usage: node %s file.fpb", process.argv[1]);
   process.exit();
}

try {
   var src = fs.readFileSync(process.argv[2]);
} catch(err) {
   console.error("Error: could not open %s for reading", process.argv[2]);
   console.log(err);
   process.exit();
}

const NBL_ID_NMLL = 0x4C4C4D4E;
const NBL_ID_NMLB = 0x424C4D4E;
const NBL_ID_TMLL = 0x4C4C4D54;

const nbl = [];

for(let i = 0; i < src.length - 4; i+= 0x10) {
   let dword = src.readUInt32LE(i);
   if(dword !== NBL_ID_NMLL && dword !== NBL_ID_NMLB) {
       continue;
   }
   nbl.push(i);
}
nbl.push(src.length);

for(let i = 0; i < nbl.length - 1; i++) {

   let dst = src.subarray(nbl[i], nbl[i + 1]);
   let num = i.toString();
   while(num.length < 5) {
       num = "0" + num;
   }
 
   let name;
   if(dst[5]) {
       name = "nmll-"+num+"-new-format.nbl";
   } else {
       name = "nmll-"+num+".nbl";
   }

   fs.writeFileSync(name, dst);
}

You can save the code as "fpb.js". Install nodejs, on windows there should be an "add to path" option in the install which allows you to run node from the normal cmd console. Put fpb.js and the psp2i file.fpb into the same folder and run:

Code:
node fpb.js file.fpb

And after a few seconds you should have about ten thousand .nbl files populating the directory. You can run

Code:
mkdir out
mv *.nbl out

If you want to clean up the files and put the output in it's own out folder. As for the output there should be two kind of nbl files. the normal nmll-08894.nbl and then the "new" nmll-11408-new-format.nbl. I don't know what the difference between the new and normal files is, but I think essen's nbl tool only works on the normal files, and not the new ones. Either way you can test with nmll-08894.nbl which should contain the drop models like ob_xxx_drop_meseta.unj.

Interesting, thanks for posting.
How's it going with the models?

Also, Essen's original tool doesn't account for all of the possible file types, for example audio files as should have a magic of RIFF so you'll probably want to check for a const for that too e.g. 0x46464952.
 

Kion

Member
Newcomer
Joined
Sep 2, 2019
Messages
18
Trophies
0
Age
35
Location
Fuji-shi, Shizuoka
Website
dashgl.com
XP
143
Country
Japan
How's it going with the models?

I spent a day looking at the header to look for approaches for how to parse the model. Looks like the header has a pointer to the end of the file, which then has offsets to the material list, the vertex list, bones, and the other segments that I have the struct size for, but don't know what they do yet.

EEZfEJJU4AI9OS5.png EEZdm97U8AEC6nR.png EEZcztYUUAETcMm.png EEZb3kKU8AA8NC-.png

And then I used that information to start working on a tool that could load in files from the game, sort them by category, and then attempt to parse and display the model. Right now it's only working with the meseta model as I have the vertex format hard coded in. I'll test it with the green drop next to see if I can start scaling up the pattern.

Screenshot-2019-9-16 Psp2 Infinity.png


Also, Essen's original tool doesn't account for all of the possible file types, for example audio files as should have a magic of RIFF so you'll probably want to check for a const for that too e.g. 0x46464952.

Added a check for the RIFF magic number. To prevent the thread from getting filled up with ugly blocks of code, the repository link is here: https://gitlab.com/dashgl/psp2i/blob/master/unpack/fpb.js. Is RIFF the only other magic number to look for, or would it be worth writing a quick script to look for uint32_t's, with 3-4 uppercase ascii letters to see if there are potentially others that need to be handled?
 
  • Like
Reactions: JamRules

JamRules

.....
OP
Member
Joined
Jan 9, 2014
Messages
527
Trophies
1
XP
2,204
Country
United States
Nice.
Yeah, I would expect the vertex format to change. Not sure if it's helpful but I think there should be a fairly simple cuboid model in the nbl you pointed out before for a box of calorie mate (edit: ob_xxx_drop_calorie.unj) which is textured, since the texture is in the nbl.

There are actually other file formats in the fpb. A main one is a PACK format, but this is a header for pointing to nbl files so you’ll kind of still want to split at NMLL. There is also BIND but I don’t know what it’s for.

Edit: added images

is this still being worked on ?
Yep
 

Attachments

  • sl_lxx_calorie1.uvr.png
    sl_lxx_calorie1.uvr.png
    2.3 KB · Views: 189
  • sl_lxx_calorie2.uvr.png
    sl_lxx_calorie2.uvr.png
    2.6 KB · Views: 132
  • sl_lxx_calorie3.uvr.png
    sl_lxx_calorie3.uvr.png
    1.7 KB · Views: 142
Last edited by JamRules,
  • Like
Reactions: wakabayashy

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    realtimesave @ realtimesave: now I have 3 mig switch. going to return these 2 to aliexpress tho