Discussion in 'Sega Dreamcast Development and Research' started by Renard, Oct 3, 2018.
We can almost do our music stage for samba de amigo with your tools
Thanks - but I think I'm halfway there.
I believe I've completely documented the "Amigo"blocks (difficulty levels) EASY, NORM, HARD, SUPR. One could create a level editor for this (with audio sync and player movements) without problems.
Amigo blocks DA_E, DA_N, DA_H and DA_S are the equivalent in hustle mode, and very similar in format, but I'm not sure about the meaning of a few bits (probably related to the speed of the movements). Still, creating / editing hustle mode levels should not be difficult.
I didn't spend much time with HEAD, CAM_ and ACT_ blocks, though. They seem to handle camera position and movements, as well as "actors" and "extras". There's some debug code in the game that could shed a light on this - I've seen mentions of "stand, jump, side_step, fr_bk_step, act_bakuten, act_object" (BTW, "bakuten" is "backflip" in Japanese). To create/edit the background animations, these blocks must be understood.
I noticed that for the same song in both DC & Wii (Bamboleo):
Amigo blocks are almost identical (at least in format)
HEAD blocks are identical
half of the ACT_ blocks are identical, the others have a few bits slightly different
CAM_ blocks are VERY different (at least in content)
So, to complete the reverse engineering of Amigo files, we need to understand a few bits of Amigo blocks and the meaning of HEAD, CAM_ and ACT_ blocks. My current workflow is:
Dump an Amigo file with amigo_explorer.py
Play & record the gameplay
Trim the video so it will start at "frame 0" (which is the 1st frame after fading to black)
Play the video with ffplay and follow along with the dump (timing on both is in the same format)
Notice what happens in the video and correlate with the values in the dump
If anyone wants to help with that, I'd be grateful.
P.S.: I also would love to have native Python libraries to read & write files (such as AFS, PVR, TPL, ...) to automate file conversions and thus translation of the game. I could do it all manually with currently available tools, but that's not fun - and such libraries would help in other projects as well.
If anyone is interested, check out the Kaitai Struct Web IDE, where you can load a .ksy file (defining a file structure), load a file (such as a DC .AMG Amigo file) and see the data being mapped to the structure that you can edit in real time. It would be a great reverse engineering tool just for that, but it also can create code to parse the structure in many different languages as well! So if anyone could contribute with a Kaitai Struct file format as well, it would be awesome!
P.P.S.: I tried using the Null DC debugger, but the debugger seems to be buggy! Does anyone recommend another emulator with a debugger (that works)?
As you can see in the video above, I replaced "Tubthumping" with "Arriba Allez" with v. 0.2 of amg_explorer, and even the animations work correctly!
I described (almost) completely the .AMG format, both in text format and in Kaitai Struct files. Please see https://github.com/AltoRetrato/samba-de-amigo-2k_modding for details.
This means that song conversion is basically done! I didn't test anything besides what's in the video, though, so bug reports, bug fixes and suggestions are welcome.
Edit: First bug report is from me. Only afterwards I noticed the game seems to be a bit out of sync, and hustle mode crashed the emulator. Oh well, back to the drawing board (but only when I get some free time)...
You are working very well
I've finally been able to play around a bit with Kaitai. I'm really impressed, this is a fantastic tool. Combined with the documentation you already wrote, this is absolutely bonkers!
Edit: also, Hustle mode (raw import from the Wii data) crashes the real hardware too in my tests, not just the emulator.
Please show us when you can
Hey FunKing! I tried to "build" a very very basic song "editor" (in LibreOffice Calc) to generate the 0s and 1s making song "packets" from scratch (ie. https://github.com/AltoRetrato/samb...amba de Amigo ver. 2000 - AMG file format.txt line 126). This quickly turned into a weird endeavor, as I'm afraid I don't understand how the "frames" metric is supposed to work.
I had the impression that it was about the number of in-game frames since the beginning of the song (since the game runs at a fixed 60Hz, this seems to make sense, but how can the engine handle PAL 50Hz mode then?); however that number grows too large so fast that I now realize it probably is not the case. By chance, have you looked into this yet?
It's been so long that I had to read the file format description again! But you are correct, songs start at frame 0, and if an action (Amigo command, camera position, actor dance move, ...) appears 1 s since the song started, it would at frame 60. I don't know how the game deals with PAL format (I haven't checked that), but it could easily interpolate or convert the values (e.g., "pal frame #" = ("ntsc frame" * 5) / 6).
Each frame number appears as a double word - i.e., it can range from 0 to 65535. This means that the maximum song duration in seconds would be 65535 / 60, or 1092 seconds (a bit more than 18 minutes). That's more than enough for any song in the game.
Yes clearly enough ^^
Now I'm running into a stupid issue. I used to be able to repack the game data after modifications in a .nrg format, and mount it using Alcohol 120% to test the image in NullDC. At this point my computer fails at creating virtual drives for reasons unknown whatever the software I try to use, so I'm kinda stuck.
please use .nrg format
Maybe discjuggler will be better ?
Try another emulator that doesn't require a drive : Reicast, Demul,Redream.
As far as i remember, NullDC can read a dreamcast iso without a virtual drive, so what's the point about that ?
negative both demul and nulldc cant read .nrg. solution uninstall all virtual devices try daemon tools you have to add the virtual bdrom drive
Yeah it's a bug in the Alcohol software, I have the same issue about making virtual drives. I went to the official Alcohol forums and it seems there is an issue with the latest Windows 10, and they ask to use the Portable Version until this bug will be fixed. I tested it and it works.
Thanks for the hint! Unfortunately it doesn't work on my machine, I probably broke something. I'll likely quickly set up a VM for that task later on as I can't just reinstall my machine as of now, it shouldn't be too much of an issue.
A friend of mine is currently working on a web-based song editor. He's done fantastic work so far but it's not yet ready (it doesn't create valid .amg files as it's unfinished). If it works, this will speed up song creation by a lot
Limitations: no hustle mode, no actors, no cameras, no menu edition - the goal is just to swap existing files on the disc, for now. I'll need to figure out how to edit the menu textures the change the song names directly there; it's not the prettiest approach (saves will become a complete mess if you have an existing file on a VMU for instance) but it's a relatively fast one.
I really wish to try this version with wii musics import :-(
But the web looks very good !
Separate names with a comma.