don't click here

Basic Questions & Answers thread

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

  1. Ell678

    Ell678

    Am I Annoying You? Member
    2,382
    25
    28
    Barrow, England
    Sonic Incursion
    Due to me being utterly incompetent with anything to do with ASM and such, I made a layout without them for the time being. Would have been nice, but I'l definitely use them properly in the future :thumbsup:

    Another dumb question, I want to completely remove the 'water gushing' sections in Labyrinth / SBZ3. In my layout, suddenly Sonic begins flying through the water due to him entering the space where the gush used to be. I looked in the code, is it this segment?
    Code (ASM):
    1. yrinth Zone "wind tunnels"  subroutine
    2. ; ---------------------------------------------------------------------------
    3.  
    4. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    5.  
    6.  
    7. LZWindTunnels:              ; XREF: LZWaterEffects
    8.         tst.w   ($FFFFFE08).w   ; is debug mode being used?
    9.         bne.w   locret_3F0A ; if yes, branch
    10.         lea (LZWind_Data).l,a2
    11.         moveq   #0,d0
    12.         move.b  ($FFFFFE11).w,d0
    13.         lsl.w   #3,d0
    14.         adda.w  d0,a2
    15.         moveq   #0,d1
    16.         tst.b   ($FFFFFE11).w
    17.         bne.s   loc_3E56
    18.         moveq   #1,d1
    19.         subq.w  #8,a2
    20.  
    21. loc_3E56:
    22.         lea ($FFFFD000).w,a1
    23.  
    24. LZWind_Loop:
    25.         move.w  8(a1),d0
    26.         cmp.w   (a2),d0
    27.         bcs.w   loc_3EF4
    28.         cmp.w   4(a2),d0
    29.         bcc.w   loc_3EF4
    30.         move.w  $C(a1),d2
    31.         cmp.w   2(a2),d2
    32.         bcs.s   loc_3EF4
    33.         cmp.w   6(a2),d2
    34.         bcc.s   loc_3EF4
    35.         move.b  ($FFFFFE0F).w,d0
    36.         andi.b  #$3F,d0
    37.         bne.s   loc_3E90
    38.         move.w  #$D0,d0
    39.         jsr (PlaySound_Special).l ; play rushing water sound
    40.  
    41. loc_3E90:
    42.         tst.b   ($FFFFF7C9).w
    43.         bne.w   locret_3F0A
    44.         cmpi.b  #4,$24(a1)
    45.         bcc.s   loc_3F06
    46.         move.b  #1,($FFFFF7C7).w
    47.         subi.w  #$80,d0
    48.         cmp.w   (a2),d0
    49.         bcc.s   LZWind_Move
    50.         moveq   #2,d0
    51.         cmpi.b  #1,($FFFFFE11).w
    52.         bne.s   loc_3EBA
    53.         neg.w   d0
    54.  
    55. loc_3EBA:
    56.         add.w   d0,$C(a1)
    57.  
    58. LZWind_Move:
    59.         addq.w  #4,8(a1)
    60.         move.w  #$400,$10(a1)   ; move Sonic horizontally
    61.         move.w  #0,$12(a1)
    62.         move.b  #$F,$1C(a1) ; use floating animation
    63.         bset    #1,$22(a1)
    64.         btst    #0,($FFFFF602).w ; is up pressed?
    65.         beq.s   LZWind_MoveDown ; if not, branch
    66.         subq.w  #1,$C(a1)   ; move Sonic up
    67.  
    68. LZWind_MoveDown:
    69.         btst    #1,($FFFFF602).w ; is down being pressed?
    70.         beq.s   locret_3EF2 ; if not, branch
    71.         addq.w  #1,$C(a1)   ; move Sonic down
    72.  
    73. locret_3EF2:
    74.         rts
    75. ; ===========================================================================
    76.  
    77. loc_3EF4:               ; XREF: LZWindTunnels
    78.         addq.w  #8,a2
    79.         dbf d1,LZWind_Loop
    80.         tst.b   ($FFFFF7C7).w
    81.         beq.s   locret_3F0A
    82.         move.b  #0,$1C(a1)
    83.  
    84. loc_3F06:
    85.         clr.b   ($FFFFF7C7).w
    86.  
    87. locret_3F0A:
    88.         rts
    89. ; End of function LZWindTunnels
    90.  
    91. ; ===========================================================================
    92.         dc.w $A80, $300, $C10, $380
    93. LZWind_Data:    dc.w $F80, $100, $1410, $180, $460, $400, $710, $480, $A20
    94.         dc.w $600, $1610, $6E0, $C80, $600, $13D0, $680
    95.                     ; XREF: LZWindTunnels
    96.         even
    If I added an rts command to the start of each of them sections, would that stop them all together?
     
  2. Selbi

    Selbi

    The Euphonic Mess Member
    1,517
    105
    43
    Northern Germany
    Sonic ERaZor
    + - Why don't you try it out before posting? =P  
    Basically, that would do it, but it's also enough if you just put an rts at the beginning of LZWindTunnels, as all the other routines of it are impossible to get reached now anyway.
     
  3. Mercury

    Mercury

    His Name Is Sonic Tech Member
    1,740
    21
    18
    Location Location
    AeStHete
    When you get around to them, I'll be glad to help. :)
     
  4. Volpino

    Volpino

    Things are looking up! Member
    1,207
    0
    0
    A secret. >:3
    Well, sorry to bring this up after so long but I tried redownloading the files and now it doesn't crash but it gives me no files...
     
  5. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,250
    510
    93
    Japan
    OK, I've written something here which you should be able to use provided you have a megadrive emulator to run it on.

    Inside you'll see an assembly source, DAC.bin is the compressed sample you want to decompress, replace it with whatever lossy compressed sample you want, when done, run "Assemble.bat" (Hoping that the assembler can run on your 64-bit system as I don't know =$), and it'll build "Rom.bin", run that rom on a megadrive emulator, it'll decompress the sample, then the screen will turn green and start playing that sample uncompressed in a loop. Next up, make a savestate, open the savestate with a hex editor, your sample will be stored uncompressed from 00002478 to 00012478 in that savestate.
     
  6. McGuirk

    McGuirk

    The Egg-Man Cometh. Member
    Golden, Sir!

    A thousand thanks!

    Quick question, however. What rate are the decompressed samples at? Somewhere near 22Khz is sounding about right currently.
     
  7. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,250
    510
    93
    Japan
    well the pitch is set to $1B and it appears to be playing at the correct pitch, and $1B is the standard stall time for 22.050hz, so I would asume that yes, it is, unless it plays quicker and higher pitch than normal, to which it would be lower.
     
  8. Volpino

    Volpino

    Things are looking up! Member
    1,207
    0
    0
    A secret. >:3
    Well, either my post was missed or everyone's tired of me. :v:

    I redownloaded the stuff and ran the split file, it doesn't crash anymore, but it gives me no folders. Before, it just gave me empty folders and crashed.
     
  9. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,418
    492
    63
    Lincs, UK
    TurBoa, S1RL
    I really have no idea then, Volpino. We're probably missing something obvious.

    I have a question of my own: I'm trying to write a custom camera routine, and while I can get objects to respond in exactly the way I want them to, the tiles get corrupted. Am I putting it in the wrong place/order, and if so, where should I put it?
     
  10. Only thing I can suggest is, make sure it's called s2, and is a binary file. Do not call it s2.bin. .bin is the extension.
     
  11. nineko

    nineko

    I am the Holy Cat Tech Member
    6,369
    524
    93
    italy
    Objection. It depends if he has Explorer set to display file extensions or not, and if the .bin extension is known to his system. For example I've set my Explorer to ALWAYS show file extensions, so that file MUST be called s2.bin for me. Assuming that everyone has Explorer set to hide file extensions is a wrong assumption which can lead to errors if your post will be referenced by other people in the future. So here's how it works (in XP; it might be different in Vista and 7): open any Explorer windows and go to Tools -> Folder Options -> View -> Hide extension for known file types.
    If that checkbox is checked, and .bin is a known file extension to your system, your file should appear as s2 in the Explorer window
    If that checkbox is checked, but .bin is not a known file extension to your system, your file should appear as s2.bin in the Explorer window
    If that checkbox is not checked, your file should appear as s2.bin in the Explorer window.
    Please integrate/confirm these directions for Vista/7.

    Personally I don't get why that option is available in the first place, as I don't get what benefit you obtain by hiding file extensions, I actually think it's counterproductive. It's something that annoys me, and I always disable it when I have to use a computer which has that option set.
     
  12. Volpino

    Volpino

    Things are looking up! Member
    1,207
    0
    0
    A secret. >:3
    The box is checked and the file just appears as s2. I guess that means I'm doing it right?
     
  13. nineko

    nineko

    I am the Holy Cat Tech Member
    6,369
    524
    93
    italy
    Try putting it in a folder near the root, it might be a problem with old applications expecting 8.3 filenames.
    Good: C:\disasm
    Bad: C:\documents and settings\yourname\desktop\let's hack sonic 2!!!\disasm

    And just as a test, uncheck that option for a moment and make sure it's displayed as s2.bin; you can check that option again once you've verified this.

    Furthermore, you can open split.bat in notepad and add "PAUSE" (without quotes) on a new line at the end of the file so it will give you the time to read the error(s) it's giving. It's also possible to get the output to be logged to a file but it requires further editing of the batch file so I'm not advising you to do so.

    Also I might be stating the obvious, s2(.bin) is a renamed Sonic 2 Rom which was in bin format to begin with, if you're using a Sonic 2 Rom which was in smd format then it won't work and you'll need another rom or to convert your one from smd to bin.
     
  14. Volpino

    Volpino

    Things are looking up! Member
    1,207
    0
    0
    A secret. >:3
    I unchecked the box, now it's just displayed as s2. When I hover over it, it says "Type: File" so I tried renaming it and then the program would run and give me folders, but they were empty again.

    I'm pretty sure it's a bin file, I remember trying to find a BIN file because the SMD file I had wasn't working but I have no idea how to convert files.

    It is near the C drive. It's as close to it as I can put it.
     
  15. nineko

    nineko

    I am the Holy Cat Tech Member
    6,369
    524
    93
    italy
    Good that you could get the filename issue sorted, at least. As I said, that checkbox only brings confusion to the mix.

    Now try adding "PAUSE" to the batch file to see if there are meaningful warnings/errors in the output.
    Just right click on the batch file and click on Edit. Then add a line at the end by pressing enter, and add "PAUSE" without quotes. Then save, run again.
     
  16. Volpino

    Volpino

    Things are looking up! Member
    1,207
    0
    0
    A secret. >:3
    It says: ERROR: couldn't open romfile "s2.bin"
     
  17. Spanner

    Spanner

    I used to do things... Member
    3,364
    182
    43
    United Kingdom
    I wish I knew...
    If you renamed the SMD to a BIN, stop right there. From what I know they have different headers or something...

    If you can't find a BIN (which you should if you look carefully), you can use smd2bin to convert a SMD to a BIN. I think ESEII also has that feature too, but I'm unsure.
     
  18. nineko

    nineko

    I am the Holy Cat Tech Member
    6,369
    524
    93
    italy
    This is really weird. Also sorry for the delay but technically I'm at work and I'm not even supposed to post here :v:
    Open a command prompt from Start -> Programs -> Accessories -> Command Prompt
    It should say C:\documents and settings\yourname
    Type "CD\" without quotes and press enter
    It should say C:\
    Type "CD " without quotes, don't forget the space, and don't press enter yet
    Open an Explorer window on the folder where you have your split.bat and s2.bin files
    Click on the folder icon in the top left of the Explorer window, drag it to the command prompt and drop it in any place. The complete path of that folder should now appear after the "CD " you typed before (e.g. "CD c:\disasm")
    Press enter
    Type "DIR /s > file.txt" without quotes and press enter
    Type "notepad file.txt" without quotes and press enter
    It should open a notepad with some stuff written in it. Copy it all and paste it here. Feel free to hide sensitive information from the path but do not alter filenames.
     
  19. Volpino

    Volpino

    Things are looking up! Member
    1,207
    0
    0
    A secret. >:3
    Well, first, what came up in the notepad was a wall of text that could have ended in China and when I tried to copy it and paste it in the browser, it froze my browser and I had to restart it...
     
  20. nineko

    nineko

    I am the Holy Cat Tech Member
    6,369
    524
    93
    italy
    Then you're doing something wrong.
    When you type the "DIR /s > file.txt", what path do you see in the Command Prompt? It should say "C:\disasm>" or something like that. If it says "C:\>" you got the previous command wrong.
    When you drag and drop the little folder icon from the explorer window to the Command Prompt make sure it adds some text after the "CD " you previously typed. I'd let you enter the path by hand but I'm not sure if you're familiar with DOS command so I thought drag and drop was the easiest option.