How to record demos

Discussion in 'Tutorials Archive' started by Gardeguey, Oct 6, 2010.

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

    Gardeguey Well-Known Member Member

    Joined:
    Aug 6, 2010
    Messages:
    82
    Location:
    México
    NOTE: THIS IS NOT COMPATIBLE WITH THE 6-PAD GUIDE


    Requirements:

    • Sonic 1 2005 disasm
    • Hex editor



    Instructions:

    • In built.bat replace everything with this: ("pause" is optional)


      Code:
      @echo off
      
      asm68k /p /o ae- /e DemoRecord=0 sonic1.asm, s1built.bin
      
      fixheadr.exe s1built.bin
      
      pause
    • Copy the file build.bat, rename to "build_demo.bat", and change "DemoRecord=0" to "DemoRecord=1"



    In sonic1.asm:

    • You will need to enable SRAM, go to "SRAMSupport:" replace:

      Code:
      SRAMSupport:    dc.l $20202020        ; change to $5241E020 to create    SRAM
              dc.l $20202020        ; SRAM start
              dc.l $20202020        ; SRAM end
      
      With this:

      Code:
                      dc.b "RA",$E8,$20
      		dc.l $200000
      		dc.l $203FFF
      
    • Go to "PlayLevel:" and replace:

      Code:
              move.b    #$8,($FFFFF600).w ; set    screen mode to $08
      
      With this:

      Code:
          if DemoRecord=1
              move.b    #$8,($FFFFF600).w ; set    screen mode to $08
          else
              move.b    #$C,($FFFFF600).w ; set    screen mode to $0C (level)
          endif
      
    • Now go to "Level_Demo", replace:

      Code:
      Level_Demo:
              move.b    1(a1),($FFFFF792).w ; load key press duration
              subq.b    #1,($FFFFF792).w ; subtract 1 from duration
      
      With this:

      Code:
      Level_Demo:
          if DemoRecord=0
              move.b    1(a1),($FFFFF792).w    ; load key press duration
              subq.b    #1,($FFFFF792).w    ; subtract 1 from duration
              bcc    Level_Demo_NullPress
              move.b    3(a1),($FFFFF792).w
              addq.w    #2,($FFFFF790).w
      Level_Demo_NullPress:
          endif
      
    • Go to "MoveSonicInDemo" and replace everything until "MoveDemo_On" with this:

      Code:
      MoveSonicInDemo:
          if DemoRecord=0
              tst.w    ($FFFFFFF0).w    ; is demo mode on?
              bne.s    MoveDemo_On    ; if yes, branch
              rts
          endif
      
      ; ===========================================================================
      
      ; This is an unused subroutine for recording a demo
      
      MoveDemo_Record:
          ;    lea    ($80000).l,a1
              lea    ($200400).l,a1
              move.w    ($FFFFF790).w,d0
              adda.w    d0,a1
              move.b    ($FFFFF604).w,d0
              cmp.b    (a1),d0
              bne.s    loc_3FFA
              addq.b    #1,1(a1)
              cmpi.b    #$FF,1(a1)
              beq.s    loc_3FFA
              rts    
      ; ===========================================================================
      
      loc_3FFA:                ; XREF: MoveDemo_Record
              move.b    d0,2(a1)
              move.b    #0,3(a1)
              addq.w    #2,($FFFFF790).w
              andi.w    #$3FF,($FFFFF790).w
              rts    
      ; ===========================================================================
      
      (To fix the demo playback, use the FraGag's guide in Retro Here)


    • Build the ROM with "build_demo.bat", Now start playing the level until you see the fadeout
    • Open the Hex editor, and open s1built.srm, go to $400 (skip the first two $FF bytes)
    • Copy the data until the end of the .srm file
    • In the demodata folder, Open the Hex editor the respective demo level file, for example: if you recorded the demo in GHZ, open "i_ghz.bin"
    • Delete everything from the demo file and paste the demo data from the .srm file, Then save
    • Now build the ROM with "build.bat", and test the recorded demo
    • If the demo plays correctly, Done. (and if not, try again)
     
    Nat The Porcupine likes this.
  2. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    I'm definitely using this guide. Really useful. Thanks for that, many people will be able to record demos... I've been waiting for thid about one year. Nice work =)
     
  3. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    You have no idea on how it will be useful for me. Thank you very much! <_<
     
  4. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Wait... About half of this code isn't even needed. In No-Name I just removed a few RTS, and changed an adress and voila.
     
  5. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    He made it so you can use demo recording depending on which build.bat you use but still only using one sonic1.asm.
     
  6. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Ah, I can just add an rts and disable demo recording?
     
  7. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Enabling demo recording is useless if you don't know how to use the output or where to find it (which is the SRAM in this case). DO you know how to do that with your rts only thing?
     
  8. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Yeah, I was the one that came up with the solution in the beginning, GenesisFan64 just made it more user friendly I suppose.
     
  9. SamplingMastersNix

    SamplingMastersNix 64-bit Sonic Hacking Novice Member

    Joined:
    Feb 13, 2010
    Messages:
    54
    Location:
    Madison, MS
    I don't see:



    move.b #$8,($FFFFF600).w ; set screen mode to $08



    anywhere near "PlayLevel:". All I see is something similar:



    move.b #$C,($FFFFF600).w ; set screen mode to $0C (level)



    Is this the same thing?


    EDIT: Camera will not scroll down. I tried to record a demo of my new GHZ Layout I made in SonED2, but when I used the S-Tube, Sonic dies, demo ends. Who knows how to fix that camera bug?
     
    Last edited by a moderator: Oct 31, 2010
Thread Status:
Not open for further replies.