Demo Converter

Discussion in 'Engineering & Reverse Engineering' started by Mercury, Sep 13, 2010.

Thread Status:
Not open for further replies.
  1. Mercury

    Mercury

    His Name Is Sonic Tech Member
    You may have heard of this programme I made to convert GMV files into demo data that can be used in a Sonic disasm, but wondered where the hell to find it.

    Well, now that it's been tested and actually <a href="http://forums.sonicretro.org/index.php?s=&showtopic=19797&view=findpost&p=504835" target="_blank">used for a hack</a>, I thought it was time for a public release.

    Go <a href="http://intheshadeofawave.blogspot.com/p/hacking-tools.html#gmv2bin" target="_blank">here</a> for more info.

    The download includes the source, so if you know GML and need to make modifications, go wild!
     
  2. Selbi

    Selbi

    The Euphonic Mess Member
    1,485
    10
    18
    Northern Germany
    Sonic ERaZor
    To be honest, at first I was jealous when you got the Tech Member status. However, now I get why you are where you are: This is mind-fucking-blowing awesome and you deserve every single pixel of your green banner. =D
     
  3. MarkeyJester

    MarkeyJester

    A D V A N C E Resident Jester
    2,101
    230
    43
    Japan
    This will no doubt save a lot of time for many people out there who wish to create demo plays, nice going!
     
  4. Mercury

    Mercury

    His Name Is Sonic Tech Member
    <!--quoteo(post=505319:date=Sep 13 2010, 07:09 PM:name=Selbi)--><div class='quotetop'>QUOTE (Selbi @ Sep 13 2010, 07:09 PM) <a href="index.php?act=findpost&pid=505319">[​IMG]</a></div><div class='quotemain'><!--quotec-->To be honest, at first I was jealous when you got the Tech Member status. However, now I get why you are where you are: This is mind-fucking-blowing awesome and you deserve every single pixel of your green banner. =D<!--QuoteEnd--></div><!--QuoteEEnd-->
    Thanks, man. =)
     
  5. Selbi

    Selbi

    The Euphonic Mess Member
    1,485
    10
    18
    Northern Germany
    Sonic ERaZor
    Maybe I shouldn't ask, but I'm interested: What excactly does this program (technically seen)?
     
  6. <!--quoteo(post=505339:date=Sep 13 2010, 04:51 PM:name=Selbi)--><div class='quotetop'>QUOTE (Selbi @ Sep 13 2010, 04:51 PM) <a href="index.php?act=findpost&pid=505339">[​IMG]</a></div><div class='quotemain'><!--quotec-->Maybe I shouldn't ask, but I'm interested: What excactly does this program (technically seen)?<!--QuoteEnd--></div><!--QuoteEEnd-->
    Emulator movies are just logs of what controller buttons are pressed each frame, as are the demos in Sonic games. I haven't looked at Mercury's converter yet, but technically it should be just a matter of converting from the emulator format to the game format. IIRC, Sonic games use a compressed format composed of buttons+duration pairs, so that the same combination of buttons can be reused for up to 256 frames if it doesn't change in that time (it's a kind of RLE compression).

    Mercury, I have a question of my own: How does the game handle lag frames? I mean, the emulator will record buttons for all frames, but does the game read a new button combination even on lag frames? If it doesn't, there could be synchronization issues, right?
     
  7. E-122-Psi

    E-122-Psi

    Member
    2,273
    439
    63
    I've already given you my two cents about this program Mercury, but it has helped give my project that extra professional touch and I'm sure it will come in useful for many others. I can see a few people having a lot of fun with this in projects.
     
  8. Oh my, many thanks for this! :) Does this do 2P's controls as well? (I recon S1/S2's data is nearly the same, so is it possible to have two people playing in split screen mode)
     
  9. theocas

    theocas

    Tech Member
    346
    0
    16
    Wow... this is awesome! Forgive my ignorance, but where are the levels the demos are recorded for stored? I really want to show off different levels. Also, I get this strange error upon starting it:
    <a href="http://cl.ly/4e1d55b82afdc5e36674" target="_blank">http://cl.ly/4e1d55b82afdc5e36674</a>
    And once it finished starting, I get this screen instead of the programme:
    <a href="http://cl.ly/2498d52ebdb8322bcf6a" target="_blank">http://cl.ly/2498d52ebdb8322bcf6a</a>
    It's a good idea to fix that :)
     
  10. Mercury

    Mercury

    His Name Is Sonic Tech Member
    <!--quoteo(post=505437:date=Sep 13 2010, 10:10 PM:name=tokumaru)--><div class='quotetop'>QUOTE (tokumaru @ Sep 13 2010, 10:10 PM) <a href="index.php?act=findpost&pid=505437">[​IMG]</a></div><div class='quotemain'><!--quotec--><!--quoteo(post=505339:date=Sep 13 2010, 04:51 PM:name=Selbi)--><div class='quotetop'>QUOTE (Selbi @ Sep 13 2010, 04:51 PM) <a href="index.php?act=findpost&pid=505339">[​IMG]</a></div><div class='quotemain'><!--quotec-->Maybe I shouldn't ask, but I'm interested: What excactly does this program (technically seen)?<!--QuoteEnd--></div><!--QuoteEEnd-->
    Emulator movies are just logs of what controller buttons are pressed each frame, as are the demos in Sonic games. I haven't looked at Mercury's converter yet, but technically it should be just a matter of converting from the emulator format to the game format. IIRC, Sonic games use a compressed format composed of buttons+duration pairs, so that the same combination of buttons can be reused for up to 256 frames if it doesn't change in that time (it's a kind of RLE compression).
    <!--QuoteEnd--></div><!--QuoteEEnd-->
    Spot on. You remember correctly.

    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Mercury, I have a question of my own: How does the game handle lag frames? I mean, the emulator will record buttons for all frames, but does the game read a new button combination even on lag frames? If it doesn't, there could be synchronization issues, right?<!--QuoteEnd--></div><!--QuoteEEnd-->
    To my knowledge, Gens Rerecording doesn't record during dropped frames.

    There are a few times that I'm familiar with in the Sonic games when frames are dropped that don't accept input. (Most annoying is the Sonic CD title screen, because it makes entering the codes a pain.) At these times, the Gens Rerecording frame counter turns red and I don't think it records input. I could be wrong - but everything I tested synched up fine.

    <!--quoteo(post=505564:date=Sep 14 2010, 03:06 AM:name=Irixion)--><div class='quotetop'>QUOTE (Irixion @ Sep 14 2010, 03:06 AM) <a href="index.php?act=findpost&pid=505564">[​IMG]</a></div><div class='quotemain'><!--quotec-->Oh my, many thanks for this! :) Does this do 2P's controls as well? (I recon S1/S2's data is nearly the same, so is it possible to have two people playing in split screen mode)<!--QuoteEnd--></div><!--QuoteEEnd-->
    No, it doesn't. I basically forgot about player 2. If you give me a couple of days I can add the feature, though.

    <!--quoteo(post=505569:date=Sep 14 2010, 03:17 AM:name=theocas)--><div class='quotetop'>QUOTE (theocas @ Sep 14 2010, 03:17 AM) <a href="index.php?act=findpost&pid=505569">[​IMG]</a></div><div class='quotemain'><!--quotec-->Wow... this is awesome! Forgive my ignorance, but where are the levels the demos are recorded for stored? I really want to show off different levels. Also, I get this strange error upon starting it:
    <a href="http://cl.ly/4e1d55b82afdc5e36674" target="_blank">http://cl.ly/4e1d55b82afdc5e36674</a>
    And once it finished starting, I get this screen instead of the programme:
    <a href="http://cl.ly/2498d52ebdb8322bcf6a" target="_blank">http://cl.ly/2498d52ebdb8322bcf6a</a>
    It's a good idea to fix that :)<!--QuoteEnd--></div><!--QuoteEEnd-->
    My programme was made in Game Maker (which I suppose I should have mentioned earlier.) That looks like a compatibility issue with GM and your system; can you play any other GM games on your system? If so, then the error's on my end and I'll look into it.
     
  11. theocas

    theocas

    Tech Member
    346
    0
    16
    <!--quoteo(post=505783:date=Sep 14 2010, 11:39 AM:name=Mercury)--><div class='quotetop'>QUOTE (Mercury @ Sep 14 2010, 11:39 AM) <a href="index.php?act=findpost&pid=505783">[​IMG]</a></div><div class='quotemain'><!--quotec--><!--quoteo(post=505569:date=Sep 14 2010, 03:17 AM:name=theocas)--><div class='quotetop'>QUOTE (theocas @ Sep 14 2010, 03:17 AM) <a href="index.php?act=findpost&pid=505569">[​IMG]</a></div><div class='quotemain'><!--quotec-->Wow... this is awesome! Forgive my ignorance, but where are the levels the demos are recorded for stored? I really want to show off different levels. Also, I get this strange error upon starting it:
    <a href="http://cl.ly/4e1d55b82afdc5e36674" target="_blank">http://cl.ly/4e1d55b82afdc5e36674</a>
    And once it finished starting, I get this screen instead of the programme:
    <a href="http://cl.ly/2498d52ebdb8322bcf6a" target="_blank">http://cl.ly/2498d52ebdb8322bcf6a</a>
    It's a good idea to fix that :)<!--QuoteEnd--></div><!--QuoteEEnd-->
    My programme was made in Game Maker (which I suppose I should have mentioned earlier.) That looks like a compatibility issue with GM and your system; can you play any other GM games on your system? If so, then the error's on my end and I'll look into it.
    <!--QuoteEnd--></div><!--QuoteEEnd-->
    A few ones, but there are only one or two that work. May I ask why Game Maker was chosen to code this app in?
     
  12. Mercury

    Mercury

    His Name Is Sonic Tech Member
    <!--quoteo(post=505933:date=Sep 15 2010, 01:20 AM:name=theocas)--><div class='quotetop'>QUOTE (theocas @ Sep 15 2010, 01:20 AM) <a href="index.php?act=findpost&pid=505933">[​IMG]</a></div><div class='quotemain'><!--quotec-->May I ask why Game Maker was chosen to code this app in?<!--QuoteEnd--></div><!--QuoteEEnd-->
    I use it for everything, so it was convenient. Come to think of it, that's rather pathetic, because a GM game is over a megabyte, which is just overkill for something like this. Plus, the compatibility issues, blah blah blah. I guess I'm just lazy.
     
  13. Impish

    Impish

    Member
    Bwahaha I love that! You use game maker for hacking tools, thats great Mercury! Game maker is so versatile and easy to use, if inly it was faster and worked on linux.
     
  14. NeonSynth

    NeonSynth

    Previously 'SonicVaan' Member
    390
    1
    18
    Germany, W├╝rzburg
    Betatesting, Various hacking projects, programming synthesizers, music production
    Just a question, but how do I record when the level starts, when Gens Rerecording takes me back to the start of the game?
     
  15. nineko

    nineko

    I am the Holy Cat Tech Member
    6,143
    384
    63
    italy
    <!--quoteo(post=506634:date=Sep 16 2010, 05:20 PM:name=SonicVaan)--><div class='quotetop'>QUOTE (SonicVaan @ Sep 16 2010, 05:20 PM) <a href="index.php?act=findpost&pid=506634">[​IMG]</a></div><div class='quotemain'><!--quotec-->Just a question, but how do I record when the level starts, when Gens Rerecording takes me back to the start of the game?<!--QuoteEnd--></div><!--QuoteEEnd-->Record from now and make a savestate
    [​IMG]
    (Then ignore the savestate)

    Though I have to ask, during the private tech release it was mentioned that the recording must start at a precise moment or it won't sync. Given that I didn't try this yet, how is that handled? Should people manually keep an eye on a certain memory location in Gens Rerecording and wait until it reaches a certain value? (not leaking the ram address nor the value, sorry, this is up to Mercury and/or Marc)
     
  16. Mercury

    Mercury

    His Name Is Sonic Tech Member
    <!--quoteo(post=506637:date=Sep 16 2010, 04:29 PM:name=nineko)--><div class='quotetop'>QUOTE (nineko @ Sep 16 2010, 04:29 PM) <a href="index.php?act=findpost&pid=506637">[​IMG]</a></div><div class='quotemain'><!--quotec-->Though I have to ask, during the private tech release it was mentioned that the recording must start at a precise moment or it won't sync. Given that I didn't try this yet, how is that handled? Should people manually keep an eye on a certain memory location in Gens Rerecording and wait until it reaches a certain value?<!--QuoteEnd--></div><!--QuoteEEnd-->
    Yes, they should. I described this on the download page:
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Making Sure The GMV Begins Recording At The Right Time

    Because certain objects such as moving platforms follow a fixed schedule, it is important to make sure that your demo is synchronised properly. If it's even a few frames off, bad things will happen.

    The game will start reading the demo data immediately when the "game mode" (the byte in RAM at $00FFF600) changes from $8C to $0C - this signifies that the level proper has begun. Thus, you'll want to start recording any demos from that frame.

    Lucky for you, Gens Rerecording has frame advance and RAM watching features. Add a RAM watcher for $00FFF600, choose the level you want to record a demo for, and immediately pause emulation. Keeping an eye on the RAM watcher, frame advance until the value becomes $0C. Then, begin recording an input movie. After you've played for about 30 seconds or so (it doesn't matter if the demo runs a little overtime), stop the recording. The resulting GMV can then be converted with gmv2bin to make your demo!<!--QuoteEnd--></div><!--QuoteEEnd-->
     
  17. <!--quoteo(post=507181:date=Sep 17 2010, 04:34 PM:name=Mercury)--><div class='quotetop'>QUOTE (Mercury @ Sep 17 2010, 04:34 PM) <a href="index.php?act=findpost&pid=507181">[​IMG]</a></div><div class='quotemain'><!--quotec-->After you've played for about 30 seconds or so (it doesn't matter if the demo runs a little overtime)<!--QuoteEnd--></div><!--QuoteEEnd-->
    Do all demos run for the same amount of time on the Genesis games? I figured that since pausing demos doesn't make sense, the 'start' button could be used to indicate the end of the demo, so that they can all have different lengths. You know, since the real 'start' (pressed by the player) can end demos, ORing it with the 'start' from the demo is pretty simple. Of course I never checked if this was true, but that's how I did it in the NES game I'm making.
     
  18. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,130
    274
    63
    Lincs, UK
    TurBoa, S1RL
    <!--quoteo(post=507373:date=Sep 18 2010, 06:27 AM:name=tokumaru)--><div class='quotetop'>QUOTE (tokumaru @ Sep 18 2010, 06:27 AM) <a href="index.php?act=findpost&pid=507373">[​IMG]</a></div><div class='quotemain'><!--quotec-->Do all demos run for the same amount of time on the Genesis games? I figured that since pausing demos doesn't make sense, the 'start' button could be used to indicate the end of the demo, so that they can all have different lengths. You know, since the real 'start' (pressed by the player) can end demos, ORing it with the 'start' from the demo is pretty simple. Of course I never checked if this was true, but that's how I did it in the NES game I'm making.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Having START in the demos tend to mess them up. You're really better off without it.


    All demos run for a fixed length; however this length varies between games.

    Sonic 1 - slow fade after 30 seconds, game continues while fading.
    Sonic 2 - slow fade after 27 seconds, game continues while fading.
    Sonic 3K - quick fade after 30 seconds, game stops when fading starts.
     
  19. Mercury

    Mercury

    His Name Is Sonic Tech Member
    Just a quick message: It's been <a href="http://intheshadeofawave.blogspot.com/p/hacking-tools.html#gmv2bin" target="_blank">updated</a> to export Player 2's data, now, too. (I did some tests, nothing extensive, but it seemed to work fine.)

    Thanks for suggesting that feature, Irixion. =)
     
Thread Status:
Not open for further replies.