Hacking Trying to convert a .bin file to an image

AnonymousWaddleDee

Member
OP
Newcomer
Joined
Jul 13, 2023
Messages
15
Trophies
0
Age
22
XP
101
Country
United States
Hello, I'm here to ask another question for my Apollo Justice: Ace Attorney (DS) project.

Apollo Justice has two folders, cpac_2d.bin for various 2D assets and cpac_3d.bin for (presumably) 3D assets. However, there's a certain image that I've been looking for (a UI button), and I found that it was stored in cpac_3d.bin. Assuming that the developers aren't just messing with me, that must mean that this UI button, which I thought was a 2D image, is actually 3D. So my working theory is that it's a texture on a flat model to make the button's animations easier. The 3D folder has two subarchives. The second is the standard model, texture, and animation formats, but the first is all this .bin format that I can't figure out.

The problem is that it's not any known SDK or other format, it's a generic .bin file, and it has no magic ID. The format of the .bin file is simple, like this:
- A 0x14 byte header with information about header length, palette offset, palette size, and image length. I haven't been able to interpret what the first four bytes of the header are for, but they correspond to the image length.*

- The pixel data of length specified in the header, either 4bpp or 8bpp.

- The palette comes at the bottom of the file. It's usually 0xC0 long, containing six different individual palettes for the button to use in its animations.

My question is, what kind of file am I looking at, and how do I convert it into the UI button I see in-game? Could it be a texture on a flat model, or is it a 2D image even though it's in the 3D folder? It's worth noting that the format is similar to other 2D images in the game, but unlike those, the image converter program from the phoenix-tools github project isn't able to convert it into an image. It produces something with the correct colors, but which is completely illegible and looks nothing like the UI button actually does. I'm planning to write my own conversion program so I can edit it, but I need to know what type of file this is first. I have minimal experience with 3D, if this actually is 3D, so I'm a little stuck.

I'd appreciate any help. Let me know if you need more information.


*I've seen these correspondences between the first four bytes of the header and image length in bytes. At first I assumed this part of the header was for dimensions, but the first example rules that out, because a dimension can't be 0.
03 00 00 00 = 0x20
03 04 01 00 = 0x400
03 04 02 00 = 0x800
03 05 02 00 = 0x1000
03 05 03 00 = 0x2000
04 05 03 00 = 0x4000
03 05 05 00 = 0x8000
04 05 05 00 = 0x10000
Post automatically merged:

I wanted to add a slightly related question, since I mentioned 3D: what's the best way to import a custom model into a ROM? I know converting to .nsbmd format isn't easy, but what are the options?
 
Last edited by AnonymousWaddleDee,
  • Like
Reactions: Drymay

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: Not just from aging.