don't click here

Snow Bros and Dr. Robotnik's Mean Bean Machine

Discussion in 'General Sega Discussion' started by nineko, Jan 11, 2008.

  1. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Actually, that's a small mistake—the 4 3 2 1 format applies only to Sonic 2 voices. Voices in every other game use a 4 2 3 1 (IIRC) format. This is why switching all the bytes corresponding to those operators can "convert" a voice between S1 and S2 "format."
     
  2. nineko

    nineko

    I am the Holy Cat Tech Member
    6,346
    507
    93
    italy
    Yes, this is where the confusion came from.
    I tried to convert voices from Snow Bros and Dr. Robotnik's to Sonic 1, using a 1 2 3 4 to 4 2 3 1 code, and it didn't work. I later tried to do 1 2 3 4 to 1 3 2 4, and they worked fine. So there is a problem here, as it seems that Snow Bros and Dr. R's uses the same operand order as Sonic 2 (within a group of operands, as they are still sorted in different ways). Maybe the wiki is wrong, I'd like to hear Saxman's opinion on this, but I didn't see him online lately.


    Yes, I noticed that. I have a $7F as "fourth operator" if I do 1 2 3 4 to 1 3 2 4, another reason that leads me to think that either the wiki or your assumptions are wrong.
     
  3. Wiz

    Wiz

    Tech Member
    54
    0
    6
    Disassembling Shining Force II
    Ok, now that it's time for me to seriously go back to my studies, I'll stop my documentation polishing here for the moment and "release" what we've done so far :

    My IDA disassembly of the driver : I don't know if it will interest somebody, but here it is anyway ! I've done it with IDA Pro 5.2. I'm not an IDA specialist at all, so I'm sure it's not perfect, but I really would like to know if there are things that I haven't done properly, things that could be improved, so please don't hesitate to tell me if this disassembly sucks ! :D
    This was made from the Shining Force II version of the driver, so it has Shining Force II specific data, but the actual driver ASM code must be 99% similar in the other games using it.
    Please don't hesitate if you have questions about how the driver works and if my disassembly comments are not clear enough.

    The ASM file produced from my IDA disassembly : just in case somebody needs to look at the disassembly without having IDA Pro 5.2.

    Shining Force II's interesting offsets : ROM and Z80 RAM offsets, just to have a quick global view of how data is organized.

    The music format description : certainly the most interesting doc !

    The loop command description : it complements the music format doc. I still have to figure out the exact potential of the 2-3-4 loop commands. I'll look at how it's generally used when I have more time.

    The sfx format description : I explain the two SFX types and their layout. They use the same format as music.

    The samples doc : where they are stored, how they are loaded etc ...

    The YM Instrument doc and the PSG Instrument one


    Finally, a 7-zip file containing everything


    This should be already enough to write some tools related to cube/iwadare music/sfx/samples/instruments, I guess.

    Now I'll document myself about other music formats, and think about what can be done to import/export/edit/convert new songs in the cube/iwadare format.
    My first wish is to be able to import new songs in Shining Force II. For the moment I guess the best thing to do would be to wait for Shiru's TFM Music Maker project to split let the Megadrive-only version begin, and ask him to add an "export in cube/iwadare format" feature. But maybe it will not be that simple, since this format manages loops individually for each channel, so maybe I'll have to make a conversion tool myself ... I don't know ... I wish nineko would come back and explain me more about xm2smps, and why he chose XM and not another similar format like mod, midi or it, and how the program searches for loops to optimize data length ... Come on nineko, we need you here ! ^^

    Anyway, that's what I wanted to show, and I'm counting on you sonic retro people to tell me if I've forgotten things or if I've made mistakes :)
     
  4. nineko

    nineko

    I am the Holy Cat Tech Member
    6,346
    507
    93
    italy
    Two words of introduction. I know I requested to be banned from Sonic Retro, but I've been told that Wiz kept on researching on the Cube/Iwadare driver, so I thought it was fair to update him about my progress. Without his contact info, I had to ask Tweaker to unban me, and I really thank him for that; however, as my initial decision stands, I'm only going to post in this only topic.

    NOW, to my real point.

    Song 9 from Snow Bros
    Song 17 from Dr. Robotnik's Mean Bean Machine

    Yup, I can convert from Cube to SMPS. The converter is still quite buggy, but it works.

    Comment plz.

    edit: CAPS in the url aren't good
     
  5. Spanner

    Spanner

    The Tool Member
    One word:
    Wow.

    Seriously, you've done a great job on converting these Cube songs to the SMPS format. Please continue to do your good work!
     
  6. Wiz

    Wiz

    Tech Member
    54
    0
    6
    Disassembling Shining Force II
    Awww you came back for me :wub: :lol: ... Thanks a lot my hacking fellow, I sincerely appreciate your attention :yes:

    You say that your converter is still buggy but from what I've heard, your conversions seem flawless ! Of course the instruments are mostly different, but the events are identical. How great :D !!
    But didn't you have problems with my partial description of the loop commands ? Don't hesitate to tell me if you need more details here or in other places in my notes.
    Also about the loops, I'm not a specialist of other music formats so I'm curious to know : does the conversion make the new music considerably bigger, or can the SMPS format manage any kind of loops that Cube/Iwadare uses ?

    So, I guess that now you can have your famous Snow Bros tune imported in a Sonic hack ;) ! I hope to see this very soon, since it was the initial goal of this topic. Just to feel the satisfaction of reaching a goal that was explicitely set :D !

    Tweaker told me that you were also planning to implement the reverse conversion. Oh nineko, nineko nineko nineko :wub: ... I guess you already know how useful it would be for us, Shining Force II romhackers :D ! You are my hero ^_____^


    I can't wait to see new result from you work :) !
     
  7. nineko

    nineko

    I am the Holy Cat Tech Member
    6,346
    507
    93
    italy
    Actually, the voices are the same. What's missing is vibrato, pitch bends, volume.

    Your description was clear enough, you were completely right also about subcommands 2-3-4.

    Right now I'm unrolling all the internal loops, keeping only the big main loop, but I think it's possible to preserve something. I'm not very good when it comes to SMPS loops.

    Not sure when I'm going to use that song in a "real" hack, I'm planning to use it (along with other Cube songs) in soni2neko, my upcoming hack of Sonic 2, but I don't know when it's going to be completed. I can, however, already release a test Sonic 1 rom with that song in Green Hill if you want...

    What

    Yeah, I hope I can get something good out of this... My problem is always the same as before, my job eats all of my free time. But I'll do my best, now that I'm close to the goal.
     
  8. Flygon

    Flygon

    Member
    I assume he meant converting music from SMPS to Cube Idware.
     
  9. nineko

    nineko

    I am the Holy Cat Tech Member
    6,346
    507
    93
    italy
    Yeah, hence the "What", as I never said I'm going to make such a converter. I can't read from SMPS, end of story. And I can't write to cube, too.

    The converters I have ready and working are:
    XM to smps, Cube to smps, Cube to XM. Period. I thought about Cube to midi, but I dropped it as midi files are gay.

    The converters that will never exist are:
    smps to XM, smps to Cube, XM to cube¹, smps to midi.

    I hope this clarifies.

    --- notes ---
    1) I may try to work on this one if someone with better ASM knowledge than me manages to port the Cube driver to Sonic. I'd love to see that, as Cube is much² more powerful than smps.
    2) Very much
     
  10. Wiz

    Wiz

    Tech Member
    54
    0
    6
    Disassembling Shining Force II
    Ok, thanks for the clarification, I was indeed talking about SMPS to Cube conversion, but I must have misunderstood what Tweaker told me.

    Sorry for not having answered sooner and sorry for my future lack of responsiveness, as I've just finished my studies with projects and exams, and I've had to find a new appartment and prepare everything for my moving which just happened yesterday. These days I have some many things to take into account at the same time, it's a little bit crazy in my head ... Tomorrow I start my job (actually a working experience as part of my studies, which will continue as my job), and I won't have any internet connection in my new appartment for some time, so I won't be here to enjoy your next version of XM3SMPS on its release date.

    I'm very happy that you think Cube is more powerful than SMPS ! It means Shining Force II hacks will be able to have at least musics as good as the ones there are in Sonic hacks, and that's already something :drool:

    I would be very curious to see if a port of Cube for Sonic hacks would be feasible. I think I'll try to look at it if I find time, offline as well as online to get some docs about SMPS. (...... GAH LACK OF TIME FOR EVERYTHING, I'm getting crazy)

    Now I have to hurry make my bags and catch the train, so see you as soon as possible !
     
  11. nineko

    nineko

    I am the Holy Cat Tech Member
    6,346
    507
    93
    italy
    Proof of concept: the Genesis is completely capable to output songs with 6 FMs and 4 PSGs at the same time.
    We know that SMPS can't do that because of some kind of limitation (memory issues, Tweaker and Puto know that better than me so I won't try to explain as it's likely that I would be inaccurate), but Cube/Iwadare can.
    In this test song (that uses PSG1 and 2 by default) I mirrored FM2 (the lead channel) on PSG3, and I added crappy hi-hats on PSG4 (it's not easy to make good hi-hats with this driver, I admit that). It may sound wrong, but it's yet another proof of Cube's superiority over SMPS. Now plz someone port this driver to Sonic <.<

    Also relevant as it's probably the first successful reported attempt to edit by hand a song in this format.
     
  12. nineko

    nineko

    I am the Holy Cat Tech Member
    6,346
    507
    93
    italy
    [​IMG]Sorry for the 1 year 5 months 6 days bump, but I asked Scarred Sun beforehand.

    After all this time of hiatus I finally found some motivation to resume the research on the Cube driver. For now I'm not going to post the full extent of my work because several things still need to be fixed, but I've got something to share. I documented some locations in almost all the known Cube games, I'm leaving out only few of them (one of which is apparently unlicensed, even) but I might cover them soon. Not sure though.

    So here's what I've got, I tried to format things as nicely as possible (believe me when I say that my docs were much worse than this).
    The list uses this format: internal code, official name, number of song banks, bytes (decimal) per voice¹, location of the voice bank, pointer offset² for bank 1, location of bank 1, repeat for other banks:
    Code (Text):
    1. GM MK-1025 -00 Jewel Master&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 29 $77521&nbsp;&nbsp;$70000&nbsp;&nbsp;$78000
    2. GM MK-1138-50&nbsp;&nbsp;Zero Wing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 29 $C1483&nbsp;&nbsp;$C0000&nbsp;&nbsp;$C8000
    3. GM MK-1315 -00 Shining Force II&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 29 $1EB000 $1E8000 $1F0000 $1F0000 $1F8000
    4. GM MK-1353 -00 Landstalker&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 29 $1F8000 $1E8000 $1F0000 $1F0000 $1F8910
    5. GM MK-1706 -00 Dr. Robotnik's Mean Bean Machine&nbsp;&nbsp;&nbsp;&nbsp;1 29 $F8000&nbsp;&nbsp;$F0000&nbsp;&nbsp;$F937C
    6. GM T-081046-00 The Steel Empire (Koutetsu Teikoku) 1 29 $D14FD&nbsp;&nbsp;$D0000&nbsp;&nbsp;$D8000
    7. GM T-25123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8AE0
    12. GM T-48083 -00 Snow Bros.: Nick && Tom&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 29 $F8000&nbsp;&nbsp;$F0000&nbsp;&nbsp;$F937C
    13. GM MK-1312 -00 Shining Force&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 29 $178000 $168000 $170000 $170000 $178AE0
    14. GM T-11036 -00 Space Invaders '91&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 25 $38036&nbsp;&nbsp;$28000&nbsp;&nbsp;$34000
    15. GM T-144026-00 Crusader of Centy&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 29 $1F7000 $1E8000 $1F0000 $1F0000 $1F8000
    16. GM T-68013 -01 Galaxy Force II&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 29 $F14BD&nbsp;&nbsp;$F0000&nbsp;&nbsp;$F8000
    17. GM T-025143-02 Langrisser II&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 29 $1EE000 $1E0000 $1E8000 $1E8000 $1F0000 $1F0000 $1F8000
    18. GM T-49146 -00 Ys III: Wanderers from Ys&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 29 $F8000³ $E8000&nbsp;&nbsp;$F0740&nbsp;&nbsp;$F0000&nbsp;&nbsp;$F8740
    19. GM MK-1076 -00 Ranger-X&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 29 $F8000&nbsp;&nbsp;$E8000&nbsp;&nbsp;$F2000&nbsp;&nbsp;$F0000&nbsp;&nbsp;$F8AE0
    20. GM MK-1310&nbsp;&nbsp;00 Shining in the Darkness&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 29 $F2DA5&nbsp;&nbsp;$F0000&nbsp;&nbsp;$F8900
    21. GM G-005534-00 Lord Monarch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 29 $1ED000 $1E0000 $1E8000 $1E8000 $1F0000 $1F0000 $1F8000
    Notes:
    2) The "pointer offset", as I called it, is what you should add to the pointers to get the real location. Please remember that the pointers are byte swapped because this is a Z80 driver. So if you read 01 02, it's really a 0201, and if the offset is $10000, the song is at $10201.
    3) There is an identical bank also at $F0000, probably this is done to minimize bank switching.
    1) Most Cube games use 29 bytes per voice, effectively allowing to use the SSG-EG (though most of the voices don't use it). Granada and Space Invaders instead use 25 bytes per voice just like SMPS, which means that the SSG-EG isn't usable. To convert a Cube voice to SMPS (discarding the SSG-EG where present) you can use this Basic code (it works in both QB and VB; for Space Invaders and Granada replace 29 with 25):
    Code (Text):
    1. MID$(b$, 1, 1) = MID$(a$, 29, 1)
    2.  
    3. MID$(b$, 2, 1) = MID$(a$, 1, 1)
    4. MID$(b$, 3, 1) = MID$(a$, 3, 1)
    5. MID$(b$, 4, 1) = MID$(a$, 2, 1)
    6. MID$(b$, 5, 1) = MID$(a$, 4, 1)
    7.  
    8. MID$(b$, 6, 1) = MID$(a$, 9, 1)
    9. MID$(b$, 7, 1) = MID$(a$, 11, 1)
    10. MID$(b$, 8, 1) = MID$(a$, 10, 1)
    11. MID$(b$, 9, 1) = MID$(a$, 12, 1)
    12.  
    13. MID$(b$, 10, 1) = MID$(a$, 13, 1)
    14. MID$(b$, 11, 1) = MID$(a$, 15, 1)
    15. MID$(b$, 12, 1) = MID$(a$, 14, 1)
    16. MID$(b$, 13, 1) = MID$(a$, 16, 1)
    17.  
    18. MID$(b$, 14, 1) = MID$(a$, 17, 1)
    19. MID$(b$, 15, 1) = MID$(a$, 19, 1)
    20. MID$(b$, 16, 1) = MID$(a$, 18, 1)
    21. MID$(b$, 17, 1) = MID$(a$, 20, 1)
    22.  
    23. MID$(b$, 18, 1) = MID$(a$, 21, 1)
    24. MID$(b$, 19, 1) = MID$(a$, 23, 1)
    25. MID$(b$, 20, 1) = MID$(a$, 22, 1)
    26. MID$(b$, 21, 1) = MID$(a$, 24, 1)
    27.  
    28. MID$(b$, 22, 1) = MID$(a$, 5, 1)
    29. MID$(b$, 23, 1) = MID$(a$, 7, 1)
    30. MID$(b$, 24, 1) = MID$(a$, 6, 1)
    31. MID$(b$, 25, 1) = MID$(a$, 8, 1)
    This is just the top of the iceberg of what I want to do (or I already did? Surprise!), but for now it's all.
    Thanks to Wiz for his assistance once again.