-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoding obj into Binary Format #7
Comments
For some reason I'm not seeing any change. I got the wrong texture it should be PL00T.BIN, I was encoding PL01T.BIN which is roll. As for the model, I need to make a few changes.
Also it looks like I'm targeting the roll model, so i'm going to need to update that too. |
Another change I could make is add a test to search for the subsections of the model from the rom and record the output. That would build in a version of run the tests to make sure you can run it before attempting to mod a rom. |
A few notes on encoding. We have the body which will always be the same. Then we have the head and shoes which will vary depending on the model type. Then we have left arm, buster, which we can point back to the shoulder, followed by buster and bullet(?) and last we have the right arm. The left and right arms should effectively have the same vertices, so potentially i could same space by pointing to the same list for each of them. const LIMBS = [
// Body
{
offset: 0x80,
names: [
"00_BODY",
"01_HIP",
"02_LEG_RIGHT_TOP",
"03_LEG_RIGHT_BOTTOM",
"04_LEG_LEFT_TOP",
"05_LEG_LEFT_BOTTOM",
],
},
// Head
{
offset: 0xb60,
names: ["10_HAIR", "11_FACE", "12_MOUTH"],
},
// Feet
{
offset: 0x1800,
names: ["20_NORM_RIGHT_FOOT", "21_NORM_LEFT_FOOT"],
},
// Left Arm
{
offset: 0x1dd0,
names: ["30_LEFT_SHOULDER", "31_LEFT_ARM", "32_LEFT_HAND"],
},
// Buster
{
offset: 0x2220,
names: ["40_LEFT_SHOULDER", "41_BUSTER", "42_BULLET_MAYBE"],
},
// Right Arm
{
offset: 0x26f0,
names: ["50_RIGHT_SHOULDER", "51_RIGHT_ARM", "52_RIGHT_HAND"],
},
// End Limbs
]; |
Looks like I tried to do too much too soon. When I try to load the game, it pretty much breaks. My best explanation is this is what happens when the game is trying to jump somewhere to try and reference a triangle or something it expects to be there but isn't, so the game uses a index it thinks is available but isn't. It looks like we're going to need to peal things back and try to sanity check what could be causing the problem, and then narrow down and troubleshoot what's going on. I think the first step to take here is to comment out everything except the first part of the body, and then use a hex editor to see if everything checks out as expected. |
After pulling out the hex editor, it looks like we have some problems with having the wrong counts. Now, we can at least see the body. But it's not without problems. The model doesn't show up at first, then i can move around a bit. Then the model shows, but the character stops moving. Which means the game is probably silently failing somewhere. This means there are three aspects to confirm here:
|
It turns out the problem was that i was clearing the entire file, and not just replacing the section for the model. Once I figured that out the model worked. Which is lucky that the game doesn't have any special code for how the offsets are treated. Which is good news for me as I wrote a function to optimize packing the code by seeing how much space can be put into available space first to pack as much as possible in. There's another optimization to do in code, which would be to see if similar meshes have the same vertices and then re-encode the faces on the models to use an updated vertex list which shares the same vertices. It might not be much compared to the size of the quads and triangles, but since there's not much space, every byte counts. Another optimization would be to remove the way the game breaks the models into small headers followed by sections of data. If I could update where the game points to for each mesh, then I could have one continuous area to pack information into, which would avoid the loss of having to leave space on the table if no buffer is able to fit in one of the sections. |
Now that we've one a sanity check on decoding and re-encoding information. The next step is to start building back content into the game. This is what I had previously, which is encoding the body and the face images followed by encoding all of the body.
This will effectively encode
PL00P010.BIN
. Which means that the easiest option would be to use this format and swap out the helmet and shoes as needed.The text was updated successfully, but these errors were encountered: