Mini-tutorials Thread

Discussion in 'Tutorials' started by EpsilionDubwool, Feb 16, 2021.

Tags:
  1. TheInvisibleSun

    TheInvisibleSun Visible Member

    Joined:
    Jul 2, 2013
    Messages:
    413
    Location:
    Buffalo, NY, USA
    This is a nice guide, but there is a small, probably insignificant oversight; since the time resets, then getting the time bonus becomes very easy, depending on the situation. Depending on the hack, it might make sense to set the timer to a particular time, (like 5 minutes or something) to avoid inadvertently rewarding the time over. Again, it's probably insignificant, but I felt it was worth mentioning.
     
  2. Giovanni

    Giovanni It's Joevanni, not Geovanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    280
    Location:
    Italy
    It's true, the oversight does exist in the original games as well. I have taken advantage of it myself in Sonic 2, using the last checkpoint of one of the Metropolis acts to gain 50000 points and trivialize the effect of the time over. One could set up a flag that nullifies the time bonus when set. Might write up something later once I get home...
     
  3. RobiWanKenobi

    RobiWanKenobi Python Developer Member

    Joined:
    Sep 10, 2022
    Messages:
    35
    Location:
    United States
    To make the sonic 2 drums sound like the sonic 1 prototype drums, go into s2.sounddriver.asm and go to
    zDACMasterPlaylist
    you will see these lines

    Code:
        db    id(zDACPtr_Sample1),17h        ; 81h
        db    id(zDACPtr_Sample2),1        ; 82h
        db    id(zDACPtr_Sample3),6        ; 83h
        db    id(zDACPtr_Sample4),8        ; 84h
        db    id(zDACPtr_Sample5),1Bh        ; 85h
        db    id(zDACPtr_Sample6),0Ah        ; 86h
        db    id(zDACPtr_Sample7),1Bh        ; 87h
        db    id(zDACPtr_Sample5),12h        ; 88h
        db    id(zDACPtr_Sample5),15h        ; 89h
        db    id(zDACPtr_Sample5),1Ch        ; 8Ah
        db    id(zDACPtr_Sample5),1Dh        ; 8Bh
        db    id(zDACPtr_Sample6),2        ; 8Ch
        db    id(zDACPtr_Sample6),5        ; 8Dh
        db    id(zDACPtr_Sample6),8        ; 8Eh
        db    id(zDACPtr_Sample7),8        ; 8Fh
        db    id(zDACPtr_Sample7),0Bh        ; 90h
        db    id(zDACPtr_Sample7),12h        ; 91h
    
    to lower their pitch, you add numbers to them, to make them sound like the sonic 1 prototype drums, replace it with this
    Code:
        db    id(zDACPtr_Sample1),19h        ; 81h
        db    id(zDACPtr_Sample2),6        ; 82h
        db    id(zDACPtr_Sample3),6    ; 83h
        db    id(zDACPtr_Sample4),8        ; 84h
        db    id(zDACPtr_Sample5),20h        ; 85h
        db    id(zDACPtr_Sample6),0Fh        ; 86h
        db    id(zDACPtr_Sample7),20h        ; 87h
        db    id(zDACPtr_Sample5),17h        ; 88h
        db    id(zDACPtr_Sample5),1Ah        ; 89h
        db    id(zDACPtr_Sample5),22h        ; 8Ah
        db    id(zDACPtr_Sample5),23h        ; 8Bh
        db    id(zDACPtr_Sample6),0Ch        ; 8Ch
        db    id(zDACPtr_Sample6),0Ah        ; 8Dh
        db    id(zDACPtr_Sample6),0Dh        ; 8Eh
        db    id(zDACPtr_Sample7),0Dh        ; 8Fh
        db    id(zDACPtr_Sample7),0Bh        ; 90h
        db    id(zDACPtr_Sample7),12h        ; 91h
    
    then build your rom
    Sample 1 is the Kick
    Sample 2 is the Snare
    Sample 3 is the Clap
    Sample 4 is the Record Scratch from MTZ
    Sample 5 is the Timpani
    Sample 6 is the Toms
    Sample 7 is the Bongo from MCZ
     
    Last edited: Dec 4, 2022
    EddyTF and Hame like this.
  4. Hame

    Hame Newcomer Prospect

    Joined:
    Jan 12, 2021
    Messages:
    10
    Location:
    Spain
    Green hill death bug (Github)

    if you have gone at high speed on the first level of green hill it will have happened to you that you died because of too much speed


    To fix this it's easy, open DynamicLevelEvents inside the _inc folder, go to "DLE_GHZ1:" without the quotes and copy this code

    Code:
    DLE_GHZ1:
    
            move.w    #$300,(v_limitbtm1).w ; set lower y-boundary
            move.w    #$300,(v_limitbtm2).w ; set lower y-boundary; <----- insert this.
            cmpi.w    #$1780,(v_screenposx).w ; has the camera reached $1780 on x-axis?
            bcs.s    locret_6E08    ; if not, branch
            move.w    #$400,(v_limitbtm1).w ; set lower y-boundary; <----- insert this.
            move.w    #$400,(v_limitbtm2).w ; set lower y-boundary  
    locret_6E08:
            rts    
    and ready the camera will go faster

     
    Last edited: Nov 15, 2022
    EddyTF likes this.
  5. faith

    faith Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    1,212
    Your videos are set to private. They should be unlisted. Funnily enough, this is almost 1:1 how Sonic Jam fixes it, except it doesn't put in this:
     
    JGamer2151 likes this.
  6. Hame

    Hame Newcomer Prospect

    Joined:
    Jan 12, 2021
    Messages:
    10
    Location:
    Spain
    thanks for the warning
     
  7. EddyTF

    EddyTF #romhacker Member

    Joined:
    Jan 9, 2022
    Messages:
    54
    Location:
    Russia
    How to stop or change the scrolling speed of the background on the title screen in Sonic 1

    Good day! Today I will show you another guide. Many rom hackers, more advanced than me, know how to do this, but still, it will be useful for someone who is just starting his hacking activity. We want beginners to do good hacks;) So, let's begin. I will give a guide for as many as three disassembles: Hivebrain 2005, GitHub and SVN.

    Hivebrain 2005:

    Looking for loc_317C: and see:

    Code:
    loc_317C:
            move.b    #4,($FFFFF62A).w
            bsr.w    DelayProgram
            jsr    ObjectsLoad
            bsr.w    DeformBgLayer
            jsr    BuildSprites
            bsr.w    PalCycle_Title
            bsr.w    RunPLC_RAM
            move.w    ($FFFFD008).w,d0
            addq.w    #2,d0
            move.w    d0,($FFFFD008).w ; move    Sonic to the right
            cmpi.w    #$1C00,d0    ; has Sonic object passed x-position $1C00?
            bcs.s    Title_ChkRegion    ; if not, branch
            move.b    #0,($FFFFF600).w ; go to Sega screen
            rts
    So, we need this line here:

    Code:
    addq.w    #2,d0
    Here you can change the speed from 1 to 8. Unfortunately, it is impossible to do more. (forget my words, this can be done simply by replacing addq.w #2,d0 with addi.w #2,d0. Thanks to Inferno Gear for the advice.) So, just change to these numbers and that's it. The scrolling speed will change. If you want to stop scrolling completely, then do not change the value to 0 in any case, otherwise the compiler will give this error: (forget it all, guys lol)

    Code:
    S1 HIVEBRAIN 2005 DISASM\SONIC1.ASM(3266) : Error : Illegal value (0)
     addq.w #0,d0
    So, comment out or delete this line here addq.w #2,d0. But I advise you to comment.

    GitHub/SVN:

    Many rom hackers know that GitHub disassembly was built on SVN disassembly, so both there and there, the code is the same.

    And so, look for Tit_MainLoop:
    (both in SVN and in GitHub everything is completely the same)

    and we see it:

    Code:
    Tit_MainLoop:
            move.b    #4,(v_vbla_routine).w
            bsr.w    WaitForVBla
            jsr    (ExecuteObjects).l
            bsr.w    DeformLayers
            jsr    (BuildSprites).l
            bsr.w    PCycle_Title
            bsr.w    RunPLC
            move.w    (v_objspace+obX).w,d0
            addq.w    #2,d0
            move.w    d0,(v_objspace+obX).w ; move Sonic to the right
            cmpi.w    #$1C00,d0    ; has Sonic object passed $1C00 on x-axis?
            blo.s    Tit_ChkRegion    ; if not, branch
    
            move.b    #id_Sega,(v_gamemode).w ; go to Sega screen
            rts
    And we will need exactly the same line addq.w #2,d0 and you know what to do with it. Done. Compile and check, everything works ;>

    EDIT: idk
     
    Last edited: Nov 19, 2022
    Dark Shamil Khan and Nik Pi like this.
  8. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    128
    Location:
    Sky Base Zone, South Island
    ... actually, this is completely false, as all that the line does is change the X position of the object in Sonic's slot, determining the current camera position.

    In order to do more, change it from addq to addi. This will be slightly slower but allow you to add more than 8 at a time.
     
    EddyTF likes this.
  9. EddyTF

    EddyTF #romhacker Member

    Joined:
    Jan 9, 2022
    Messages:
    54
    Location:
    Russia
    @Inferno oh! I didn't even know about it. Thank you, I'll know now, cap;)
     
    Inferno likes this.
  10. faith

    faith Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    1,212
    EDIT: Nevermind.
     
    nineko likes this.
  11. Nik Pi

    Nik Pi Well-Known Member Member

    Joined:
    Feb 14, 2022
    Messages:
    67
    Location:
    Kazakhstan
    How to make camera moving with you when you dead like in Sonic 2 beta 4 and 5 (Sonic 2 GitHub disasm):

    Find it:
    Code:
    CheckGameOver:
    And comment this line:
    Code:
    move.b    #1,(Scroll_lock).w
    Done

    How to restore burned death animation (Sonic 2 GitHub disasm):
    Find
    Code:
    KillCharacter:
    And before this:
    Code:
    move.b    #AniIDSonAni_Death,anim(a0)
    Insert this:
    Code:
    cmpi.b  #$31,(a2); Test for object ID (Lava in MTZ and HTZ)
        beq.s    Pizdec; Is it? Go to this label
        cmpi.b  #$95,(a2); Test for object ID (Soul in HTZ)
        beq.s    Pizdec; Go to this label
    This code checks object that hurts you, and make you go to this (should be placed before Touch_Special):

    Code:
    Pizdec:
        move.b    #AniIDSonAni_DeathBW,anim(a0)
        bset    #high_priority_bit,art_tile(a0)
        move.w    #SndID_Hurt,d0
        jsr    (PlaySound).l
    +
        moveq    #-1,d0
        rts
    It's should work:
    s2built_005.png



    It's all! If you had any questions- ask me ;)
     
    Dark Shamil Khan likes this.
  12. RobiWanKenobi

    RobiWanKenobi Python Developer Member

    Joined:
    Sep 10, 2022
    Messages:
    35
    Location:
    United States
    Very Mini Tutorial: How to unlock sonic and tails directional control after a roll jump
    in Sonic_RollJump and Tails_RollJump, there is this line

    Code:
    bset    #4,status(a0)    ; set the rolling+jumping flag
    remove it for each character
    when you build, sonic and tails will be able to change directions after a roll jump.
    For best results, also remove the air speed cap https://info.sonicretro.org/SCHG_How-to:Remove_the_Air_Speed_Cap
     
    Last edited: Dec 31, 2022
    Nik Pi likes this.
  13. faith

    faith Well-Known Member Member

    Joined:
    Aug 26, 2013
    Messages:
    1,212
    It should be noted that if you don't remove the air speed cap, then if you hold left or right while in the air, and you're going really fast, then the speed cap will kick in and ruin your momentum. The roll jump flag basically helps maintain the momentum by locking your controls, and thus disallowing the speed cap from ever kicking in.

    For example, in Sonic 1. With roll jump lock + air speed cap:
    [​IMG]

    No roll jump lock + air speed cap kept in:
    [​IMG]

    So, yeah, remove the air speed cap, too. :p
     
    JGamer2151 and TheInvisibleSun like this.
  14. JGamer2151

    JGamer2151 Active Member Member

    Joined:
    Dec 1, 2020
    Messages:
    36
    That is really interesting. This also happened in Sonic 2, as I have played that a couple of times now, and did notice this air-speed cap issue when I did the same thing you mentioned when roll-jumping causes you to get locked at that air speed cap, especially when jumping after spindashing or jumping while gaining momentum on a slope.

    It seems that while the ground speed cap is removed in Sonic 2, the air speed cap was retained. There is a guide on Retro that explains how to remove the air speed cap. Sonic 3, Sonic & Knuckles, and Sonic 3 & Knuckles removed the air speed cap from Sonic 2 for the same purpose.
     
  15. Dark Shamil Khan

    Dark Shamil Khan TASer lol Member

    Joined:
    Nov 7, 2021
    Messages:
    62
    Location:
    Pakistan
    Have you ever felt that doing the Level Order in Sonic 1 2005 disasm is hard by doing hex editing? Then look no further than this easy way to do a Level Order.
    If you hate doing hex editing that thing, then this is for you!
    So go to "LevelOrder", and remove the old level order which is a binary file with the "even" as well. Don't remove the label "LevelOrder". Otherwise you'd get build errors.
    It would look something like this:
    Code:
    LevelOrder:
       incbin misc/lvl_ord.bin
        even
    Now paste this code which simplifies it from Hex to Assembly.
    Code:
     ; Green Hill Zone
            dc.b 0, 1    ; Act 1
            dc.b 0, 2    ; Act 2
            dc.b 2, 0    ; Act 3
            dc.b 0, 0
    
            ; Labyrinth Zone
            dc.b 1, 1    ; Act 1
            dc.b 1, 2    ; Act 2
            dc.b 3, 0    ; Act 3
            dc.b 5, 2    ; Scrap Brain Zone Act 3
    
            ; Marble Zone
            dc.b 2, 1    ; Act 1
            dc.b 2, 2    ; Act 2
            dc.b 4, 0    ; Act 3
            dc.b 0, 0
    
            ; Star Light Zone
            dc.b 3, 1    ; Act 1
            dc.b 3, 2    ; Act 2
            dc.b 5, 0    ; Act 3
            dc.b 0, 0
    
            ; Spring Yard Zone
            dc.b 4, 1    ; Act 1
            dc.b 4, 2    ; Act 2
            dc.b 1, 0    ; Act 3
            dc.b 0, 0
    
            ; Scrap Brain Zone
            dc.b 5, 1    ; Act 1
            dc.b 1, 3    ; Act 2
            dc.b 0, 0    ; Final Zone
            dc.b 0, 0
            even
    Now if you don't know what's happening here. Essentially, the first number represents the zone and second number represents the act.
    And where the act is zero, means that stage will play after the act.

    Like let's say I want spring yard to play after GHZ. I'll make dc.b 2, 0 to dc.b 4,0. So now after I beat act 3 of GHZ. SYZ would play. How cool is that?!?!?

    Also the zones are in 0 to 5.
    Like how shown here. 0 is GHZ, 1 is LZ, 2 is MZ, 3 is SLZ, 4 is SYZ and 5 is SBZ.
    No credits should be given. It's a simple thing you could do.

    Oh and btw to those who are using the GitHub disassembly, you already have that in Object 3A. And those who are using the ReadySonic disasm. You can use this tutorial.
    Have fun!
    Edit: fixed some stuff, see the message below.
     
    Last edited: Jan 17, 2023
    JGamer2151 likes this.
  16. Giovanni

    Giovanni It's Joevanni, not Geovanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    280
    Location:
    Italy
    The guide itself is, essentially, an unequated version of this guide. It also forgets to mention one key pointer.

    The guide fails to mention that the LevelOrder label should be preserved. The second block of code, which lacks the LevelOrder label, may accidentally suggest that it should be removed, which is incorrect, as by doing so, it will cause the assembler to stop recognizing the level order, resulting in building errors.

    It's a pretty simple fix, though. All that really needs to be done is adding the "LevelOrder:" label back, right above the second block of code. Now, I don't like being that guy, but I still feel it should have been mentioned.
     
  17. Dark Shamil Khan

    Dark Shamil Khan TASer lol Member

    Joined:
    Nov 7, 2021
    Messages:
    62
    Location:
    Pakistan
    Ah, I forgot to mention about that. But yeah, I should've mentioned that. Thanks for the warning.
    And I never saw that tutorial as well so uhh.
     
  18. EddyTF

    EddyTF #romhacker Member

    Joined:
    Jan 9, 2022
    Messages:
    54
    Location:
    Russia
    How to implement music/sound in Level Select, as in Sonic 2 in Sonic 1 (Hivebrain 2005, GitHub/SVN)

    Good day!

    Today I will tell you how to insert music into Level Select to make it look better. It's very easy. Let's get started. As usual, I'm doing a mini-guide on several Sonic 1 showdowns - Hivebrain 2005, GitHub and SVN.

    Hivebrain 2005:

    So, we are looking for:
    Code:
    LevelSelect:


    Well, and before this subroutine we put this code:
    Code:
    LSMusicLoader:
            move.b    #$XX,d0 ; replace with a slot with music (any one you want)
            bsr.w    PlaySound_Special ; EddyTF: this "Level Select OST" branch lol
    That's all. Compile and test. The function is successfully enabled and works)

    GitHub/SVN:

    Looking for:
    Code:
    LevelSelect:


    This is the same as in Hive 2005 Disasm, oddly enough)

    And before that we insert something like this:
    Code:
    LSMusicLoader:
            move.b    #bgm_XX,d0 ; insert the name of any music (that you want to play)
            bsr.w    PlaySound_Special ; EddyTF: fuck i'm writing this again idk
    And everything. Everything should work fine.

    I hope my mini-guide was useful.
     
    Nik Pi and Dark Shamil Khan like this.
  19. Dark Shamil Khan

    Dark Shamil Khan TASer lol Member

    Joined:
    Nov 7, 2021
    Messages:
    62
    Location:
    Pakistan
    EddyTF likes this.
  20. EddyTF

    EddyTF #romhacker Member

    Joined:
    Jan 9, 2022
    Messages:
    54
    Location:
    Russia
    @Dark Shamil Khan Oh! To be honest, I didn't even know about this lol, but nevertheless this is my personal method. It also works, but is located in a completely different place. Thanks for the advice)
     
    Dark Shamil Khan likes this.