kion-dgl / Miku-Legends-2

Source Code for Writing files to the Megaman Legends 2 format to replace Megaman with Miku
https://kion-dgl.github.io/Miku-Legends-2/
GNU General Public License v3.0
5 stars 1 forks source link

Update Apron MegaMan with Miku #40

Closed kion-dgl closed 2 months ago

kion-dgl commented 3 months ago

Need to update the npc data for this

image

kion-dgl commented 2 months ago

I think the place to start is to figure where the model and texture are. And then figure out how much space we have to work with.

We know from the scene flag in memory that we're working with scene 03. We can list out the files in that scene, which gives us the following.

ST0301.BIN  ST0303.BIN  ST0305.BIN  ST03T.BIN   
ST0302.BIN  ST0304.BIN  ST03.BIN

We know the texture should be in ST03T.BIN. And looking through the archives, the model is likely in ST0305.BIN. But it seems to make sense to write a test to make sure we can see the models in that archive.

ST03T.BIN Body

Offset 0x43000 ST03T BIN-043000-true

ST03T.BIN Face

Offset 0x46000 ST03T BIN-046000-true

Tools

We can use a prior tool as a reference: https://github.com/kion-dgl/Dash2-Toolkit

And we also have the id for the MegaMan mesh.

  {
    "name": "Megaman in Apron",
    "id": "0x001c20"
  }
kion-dgl commented 2 months ago

This is concerning. I didn't have any intention of updating this scene. I replaced the face, but why the whole head is its own mystery.

image

What makes this painful is how long it takes to wait to see this scene in the opening. I think the first priority here is to use save states to see if we can either preview the model, or track down when the data gets loaded in.

kion-dgl commented 2 months ago

It looks like EBD files are copied into 0x013c800 in memory, and then they're also copied into 0x124800, which would explain why my save state viewer wasn't picking it up.

When we dump the memory, we find the model is in ST03.BIN at offset 0xb48c.

When dumping the memory from save staes, what we find is the game starts with scene 2 act 0, scene 2 act 1, scene 2 act 2 which takes place in the sulfur bottom before loading the Flutter scene with MegaMan and Roll.

Which means we have a couple options for debuging. First we might need to write the texture to the ROM, but after that we can use save states to debug the model.

It's also worth noting that the file ends at 0x152008 in memory. Which we need to go and figure out how much space we have in ST03.BIN to work with (probably not a lot). Though it's worth noting that nothing comes up in memory until 0x0154800.

kion-dgl commented 2 months ago

In terms of ST03.BIN, it looks like the data could be compressed. It looks like there's full length, sectors on disk followed by bitfield size. This is the top of the file.

image

And this is the end, which ends with 0xffff

image

Also i didn't get any hits until i shortened the needle for my search as the header for the ebd file starts normal and gets more compressed.

This is somewhat good news as it indicates that as along as I can successfully shift everything down, it should have enough room to repack everything into the file.

This means that i need to confirm where the palette and textures are, and then make edits to confirm where the model is. After that we can start doing tests for the model.

I think the next test I want to write are checking the decompression for ST03.BIN, followed by tracking down and rendering the textures for apron MegaMan.

kion-dgl commented 2 months ago

Looks like I've managed to confirm the files. Surprisingly or unsurprisingly the game duplicates everything and loads it in as needed.

Scene 3 Act 0

image

Scene 3 Act 5

image

Right now, I think the next step is to start with Scene 3 act 5, get a save state and see if we can push all of the other models back to make more room.