don't click here

Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.


  1. Go to the spikes code, do the opposite of what the remove spike bug guide tells you to do, so remove a few lines.




    Most likely errors, open up your build.bat in notepad, and add 'pause' at the end. Run it again, it'll say if you have any errors.





    Use playsound #sound effect number

    It could be different in s1, to double check look at any playsound you can find, or anything similar. It follows the same rule
     
  2. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    The game froze because you branch from Obj2E_ChkGoggles to Obj2E_ChkGoggles so it's stuck in an infinite loop. Assuming that 8 is the last monitor subtype you have, you should branch to the end.

    Obj2E_ChkGoggles:
    cmpi.b #8,d0 ; does monitor contain Googles?
    bne.s Obj2E_ChkEnd
    move.w #$1E,($FFFFFE14).w ; Add Oxygen to Sonic
    move.w #$AD,d0
    jmp (PlaySound_Special).l ; play collecting bubble sound
     
  3. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    To add a sound effect, the following bit of code will do fine:
    Code (ASM):
    1.         moveq   #$xx,d0
    2.         jsr PlaySound
    ...where xx is the sound test ID of what you want to play. Pretty simple.

    EDIT: Fuck, new page. Beaten :colbert:
     
  4. Anthall

    Anthall

    Spambot Member
    235
    0
    0
    Leicester, UK
    Sonic the Hedgehog - The Final Showdown
    Thank you.

    There is only one problem though:

    When I compile the ROM I get this error:


    SN 68k version 2.53

    C:\USERS\ANTHONY HALL\DESKTOP\HACKING PROJECT\HIVEBRAIN\SONIC1.ASM(12668) : Erro
    r : Symbol 'obj2e_chkend' not defined

    Assembly completed.
    1 error(s) from 47598 lines in 0.14 seconds
    Lightning's ROM Padder

    Reported Size: 0 Reported Checksum: 0
    Size applied: 7F Checksum Applied: 0
    Press any key to continue . . .

    Any ideas why obj2e_chkend is not defined?
     
  5. SMTP

    SMTP

    Tech Member
    obj2e_chkend I think was an example he used. You'd have to make that your self...
     
  6. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
    No, obj2e_chkend exists in a clean disassembly, he probably removed it by mistake. For this reason I'm not going to paste here what to put there, even if I could. He should download another clean disassembly and fix that.
     
  7. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Besides that, I'm pretty sure the routine is nothing but an rts, anyway. Just define the label and slap an rts in there. Sorted.
     
  8. Anthall

    Anthall

    Spambot Member
    235
    0
    0
    Leicester, UK
    Sonic the Hedgehog - The Final Showdown
    Sorry, I'm not very experienced at this.

    What do you mean, you have to make it your self?

    EDIT: Tweaker, What should I define the label?

    Thanks
     
  9. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Defining a label is basically sticking the name of the routine with a colon at the end. You'd want to make something like this:
    Code (ASM):
    1. Obj2E_ChkEnd:
    2.         rts
    ...and stick it below the end of Obj2E_ChkGoggles. That should sort everything out.
     
  10. Anthall

    Anthall

    Spambot Member
    235
    0
    0
    Leicester, UK
    Sonic the Hedgehog - The Final Showdown
    Sorry, but the file still doesn't compile (Your probably getting bored...Sorry :colbert: ),

    Here is the code I presently got:

    ; ===========================================================================

    Obj2E_ChkGoggles:
    cmpi.b #8,d0 ; does monitor contain Googles?
    bne.s Obj2E_ChkEnd
    rts
    move.w #$1E,($FFFFFE14).w ; Add Oxygen to Sonic
    move.w #$AD,d0
    jmp (PlaySound_Special).l ; play collecting bubble sound
    ; ===========================================================================

    I then tried using Tweaker's advice:

    ; ===========================================================================

    Obj2E_ChkGoggles:
    cmpi.b #8,d0 ; does monitor contain Googles?
    move.w #$1E,($FFFFFE14).w ; Add Oxygen to Sonic
    move.w #$AD,d0
    jmp (PlaySound_Special).l ; play collecting bubble sound
    bne.s Obj2E_ChkEnd
    rts
    ; ===========================================================================

    and for both attempts I got:

    The batch file output is:


    SN 68k version 2.53

    C:\USERS\ANTHONY HALL\DESKTOP\HACKING PROJECT\HIVEBRAIN\SONIC1.ASM(12668) : Erro
    r : Symbol 'obj2e_chkend' not defined

    Assembly completed.
    1 error(s) from 47599 lines in 0.22 seconds
    Lightning's ROM Padder

    Reported Size: 0 Reported Checksum: 0
    Size applied: 7F Checksum Applied: 0
    Press any key to continue . . .

    For the first code, and for the second code it was exactly the same (Apart from the line No of course)
     
  11. Adam2k7

    Adam2k7

    22
    0
    0
    Walsall UK
    Sonic Adventures EX, Sonic 2 Redemption Edition
    I think you have to define the label then the program can call it - try this......
    Code (ASM):
    1. ; ===========================================================================
    2.  
    3. Obj2E_ChkGoggles:
    4. cmpi.b #8,d0 ; does monitor contain Googles?
    5. move.w #$1E,($FFFFFE14).w ; Add Oxygen to Sonic
    6. move.w #$AD,d0
    7. jmp (PlaySound_Special).l ; play collecting bubble sound
    8. bne.s Obj2E_ChkEnd
    9.  
    10. Obj2E_ChkEnd:
    11. rts
    12. ; ===========================================================================
    13.  
     
  12. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Whoa, you're confusing me now! Haha.

    Okay, what you're going to want is something like this:
    Code (ASM):
    1. Obj2E_ChkGoggles:
    2.         cmpi.b #8,d0 ; does monitor contain Googles?
    3.         bne.s Obj2E_ChkEnd  ; if not, stop checking for different monitor types
    4.         move.w #$FFFF,($FFFFFE14).w ; Add Oxygen to Sonic
    5.         move.w #$AD,d0  ; move bubble collecting sound to d0
    6.         jmp (PlaySound_Special).l ; play collecting bubble sound
    7.  
    8. Obj2E_ChkEnd:
    9.         rts
    Let me explain the flow of the code. The first thing we're doing is checking if the monitor contains the Goggles subtype. If it does, then it's going to skip over that branch to Obj2E_ChkEnd, which will ONLY execute if the monitor is not the Goggles subtype. That routine will pop the stack, backing out of the monitor code entirely as it should.

    The code after that branch is the stuff you wrote. It's going to set Sonic's oxygen level, as well as play the bubble collection sound. Once these two instructions are completed, it will then move onto the next routine, which is Obj2E_ChkEnd. As before, this will pop the stack and exit the monitor code. This is the correct flow of logic—once everything is done executing, it backs out so it doesn't attempt to execute unrelated code (or sometimes data, which can obviously not be exectuted).

    The code you wrote was wrong the first time because you set an rts before your custom code could execute. This means that any additions you made were null and void, and were never even parsed. The second code you wrote was wrong because it checks if the monitor is Goggle, but never exits if it's not. This would make it so any subtypes added after this monitor would always have the Goggle monitor effect, which is something you don't want.

    Anyway, the code I wrote should work fine; I also took the liberty of maxing out the oxygen level so it appears to be infinite. Is there anything you still don't understand that I can explain to you?
     
  13. Anthall

    Anthall

    Spambot Member
    235
    0
    0
    Leicester, UK
    Sonic the Hedgehog - The Final Showdown
    Ok, I tried both Tweaker's and Adam2k7's code scripts, and Adam2k7's script states that there is a "Zero Branch Length" and Tweaker's code results in the monitor still freezing the game.

    Should I post the whole monitor code from Obj2E (Monitor source code)?

    Thanks

    EDIT: I thing I was wondering:
    If I can get the monitor working, If I set the monitor to give Sonic half the air of an air bubble, If I break the monitor with full oxygen (Which I will call one unit), will I have one and a half units (It adds air), or will I have only half a unit (Overwrites the air Sonic had before breaking the box)?
     
  14. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    OH, I know the problem. That was extremely stupid of me to overlook.

    Change the jmp to PlaySound to a jsr. That should handle everything.
     
  15. Anthall

    Anthall

    Spambot Member
    235
    0
    0
    Leicester, UK
    Sonic the Hedgehog - The Final Showdown
    What should the line be exactly, I tried three diffrent combinations, and only one compiled which still froze the game when I hit the monitor, the code I wrote was:


    jsr (PlaySound_Special).l ; play collecting bubble sound

    In the code I added the S Block which gives Sonic 50 rings, and a Robotnik which hurts Sonic

    Will any of that affect the code?
     
  16. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Actually, you know what, I think I might know what the problem is. Did you edit Obj2E_ChkS at all? You need to edit that to recognize the new monitor code.

    Try going to Obj2E_ChkS, and replacing that and the Obj2E_ChkGoggles you tried to put in before. This should sort everything out.
    Code (ASM):
    1. ; ===========================================================================
    2.  
    3. Obj2E_ChkS:
    4.         cmpi.b  #7,d0       ; does monitor contain 'S'
    5.         bne.s   Obj2E_ChkGoggles
    6.         rts
    7. ; ===========================================================================
    8.  
    9. Obj2E_ChkGoggles:
    10.         cmpi.b #8,d0 ; does monitor contain Googles?
    11.         bne.s Obj2E_ChkEnd  ; if not, stop checking for different monitor types
    12.         move.w #$FFFF,($FFFFFE14).w ; Add Oxygen to Sonic
    13.         move.w #$AD,d0  ; move bubble collecting sound to d0
    14.         jmp (PlaySound).l ; play collecting bubble sound
    15.  
    16. Obj2E_ChkEnd:
    17.         rts
    18. ; ===========================================================================
     
  17. Spanner

    Spanner

    The Tool Member
    Here's an example of a working bubble monitor, I used the ring monitor but change the references to the goggles monitor:
    Code (ASM):
    1.  
    2.  
    3. Obj2E_ChkRings:
    4.         move.w  ($FFFFF646).w,d0
    5.         cmp.w   $C(a0),d0   ; is Sonic above the water?
    6.         beq     Obj2E_Chk3End
    7.         cmpi.b #8,d0 ; does monitor contain Googles?
    8.         bne.s Obj2E_Chk2End ; if not, stop checking for different monitor types
    9.         move.w #$FFFF,($FFFFFE14).w ; Add Oxygen to Sonic
    10.         bcs     Obj2E_BubbleSound
    11.        
    12. Obj2E_BubbleSound      
    13.         jsr     ResumeMusic ; cancel countdown music
    14.         move.w  #$AD,d0
    15.         jmp (PlaySound_Special).l ; play collecting bubble sound
    16.         lea ($FFFFD000).w,a1
    17.  
    18. Obj2E_Chk3End:
    19.         rts
    For some reason, it's only working at various times.
     
  18. Anthall

    Anthall

    Spambot Member
    235
    0
    0
    Leicester, UK
    Sonic the Hedgehog - The Final Showdown
    Ahhh....
    Brilliant it works now!
    Thanks Tweaker!

    EDIT: Never mind solved it.

    Thanks
     
  19. Tweaker

    Tweaker

    Banned
    12,387
    2
    0
    Do you mind pasting your original S monitor code? I don't mind editing the bit I have to adapt to your edits. :colbert:
     
  20. Anthall

    Anthall

    Spambot Member
    235
    0
    0
    Leicester, UK
    Sonic the Hedgehog - The Final Showdown
    Nevermind I solved it. I now know that bne.s means GOTO

    There is only two problems.
    1. When I get a bubble, the immunity to drowning is removed.
    2. When Sonic exits the water, the immunity of drowning is removed.

    Anyway Thanks for everything.