don't click here

Basic Questions & Answers thread

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

  1. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Dumb question:

    In Sonic 2, how do you check for an objects orientation? Is it the same as checking Sonic's?

    For example, if I wanted to check if it was upside down and branch to a different code if it was, how would I go about checking which way the object is facing?
     
  2. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    Pretty much. render_flags is the SST you want to be looking at. Assuming the object is a0:

    Code (ASM):
    1.     btst    #1,render_flags(a0)         ; Is object upside-down?
    2.     beq.s   +                   ; If it isn't, branch
    3.     ; So object is upside-down
    4.     ...
    5.     ...
    6.  
    7. +   ; So object is NOT upside-down
    8.     ...

    This is from the top of my head as not at home, but I'm sure this is right.


    EDIT: I tested for #0 accidently. I'm sure it's meant to be #1. Changed.
     
  3. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Oh, I see. I was testing for #1,Status(a0), which happens to work for horizontal mirroring, but render_flags makes sense.

    How about making it more complex though? Say I want the same effect for if it's upside down AND backwards?
     
  4. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,691
    281
    63
    SonLVL
    If you want to test multiple bits at the same time, you want to copy the value to a data register, perform an and operation with a mask that has the bits you're checking set to 1 (in this case, something like andi.b #3,d0), then compare it to whatever combination of bits you're looking for (0 is right/up, 1 is left/up, 2 is right/upside-down, 3 is left/upside-down).
    So in total, something like:
    Code (Text):
    1. move.b render_flags(a0),d0
    2. andi.b #3,d0
    3. cmpi.b #3,d0
    4. bne.s $$notflipped
    5. ; code here
    6. $$notflipped:
     
  5. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    Also for future reference:

    render_flags #0 clear = right
    render_flags #0 set = left
    render_flags #1 clear = upside
    render_flags #1 set = upside-down


    When bit testing (btst), it's checking to see if it's clear. So:

    Code (ASM):
    1.        btst    #1,render_flags(a0)                     ; Is object upside-down?
    2.         beq.s   +                                       ; If it isn't, branch
    The btst command is checking if it's clear. If it is clear (equals), it will branch. So if the object upside, it will branch. If #1 has been set, it won't branch, meaning the object is upside-down.
     
  6. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    Thanks to both of you for those explanations. I understand it now. :)
     
  7. Glisp

    Glisp

    That one weird guy that does stuff. Member
    1,278
    1
    16
    Bloomington, IN
    None at the moment I'm afraid.
    I need someone to please reupload adxencd. The link Herm the Germ gave me is giving me a 404 which means that it's down. =(
     
  8. Hitaxas

    Hitaxas

    Retro 80's themed Twitch streamer ( on hiatus) Member
    The program that converts WAV to ADX? I just ran a google search and a few clicks I found this link: http://www.mediafire.com/?xyejnqom5mt

    I haven't tested it, but I found the link from a tutorial on hacking a dbz game for PS2. lol
     
  9. Glisp

    Glisp

    That one weird guy that does stuff. Member
    1,278
    1
    16
    Bloomington, IN
    None at the moment I'm afraid.
    Thanks for the link.

    Edit: Strange, I still can't get it to loop. Any idea what I might be doing wrong?
     
  10. Herm the Germ

    Herm the Germ

    Hmm, not bad. Well done, doctor! Member
    1,482
    0
    0
    Dresden, Saxony, Germany
    MIDI-to-SMPS-conversions, mostly. Takin' requests, too.
    Sorry about that adxencd-link, it should work now, even though the point's moot by now. :v:

    Maybe if you show us step-by-step what yer doing, I might be able to tell where things might go awry for looping purposes.
     
  11. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,053
    876
    93
    Long-term happiness
    There's no space between the -lps & -lpe and the actual values for them, this threw me at first.

    Like, if your LPS value is 2000 and your LPE is 50000 on a file called a.wav, your command would be:

    Code (Text):
    1. adxencd.exe a.wav -lps2000 -lpe50000
     
  12. Glisp

    Glisp

    That one weird guy that does stuff. Member
    1,278
    1
    16
    Bloomington, IN
    None at the moment I'm afraid.
    well, adxencd/whatever the actual name is, closes the second I open it unless I click and drag a .wav file over the icon and after that, it just converts it. So I'm not really sure if I'm missing a step or what. PES does something similar but the interface is more userfriendly. Strangely, checking the looping feature in PES doesn't seem to help. Granted, PES was designed with some crappy Soccer PC game in mind but it did work sort of. The music track will play in Sonic heroes (when converted to ADX with either program) but once it gets to the end where it should loop, the music track doesn't loop over, it just stops.
     
  13. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,053
    876
    93
    Long-term happiness
    ...it's a command line program, you need to specifically open it from a cmd window otherwise it'll open and then immediately shut, as you've not passed it any arguments. In Windows 7, you can go to the directory in Explorer that adxencd is in, hold down shift, right click an empty area and click "Open Command Window here" - you then get the window you can type the above example command into. Make sure the .wav is in the same directory as the encoder.
     
  14. Glisp

    Glisp

    That one weird guy that does stuff. Member
    1,278
    1
    16
    Bloomington, IN
    None at the moment I'm afraid.
    Weird... I don't seem to have the open in command line option in the right click menu... Any idea how to enable it? I'm using Windows 7 64-bit.
     
  15. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,053
    876
    93
    Long-term happiness
    You sure you're holding shift?


    Failing that, just go start --> type in "cmd" in the search box --> click the cmd.exe icon in the top left --> navigate to the folder that the EXE is in, THEN use the instructions. use "cd" to change the directory that you're in in the command prompt -
    Code (Text):
    1. cd /
    will be a good start as it will get you to the root of the drive, then you can
    Code (Text):
    1. cd whatever_directory
    one at a time down the path until you reach it. Type
    Code (Text):
    1. D:
    if you need to switch to for example the D:\ partition on your setup.
     
  16. Glisp

    Glisp

    That one weird guy that does stuff. Member
    1,278
    1
    16
    Bloomington, IN
    None at the moment I'm afraid.
    Thank you Overlord. You've been a big help. Strangely, holding shift doesn't seem to make the option come up either... odd... I'll try the other way. Thanks again.

    Edit: Now I just have to figure out how to get the loop numbering right...
     
  17. E-122-Psi

    E-122-Psi

    Member
    2,457
    593
    93
    Does anyone have an advisable method to edit the Sonic 3 title art of Sonic. I heard PlaneED is a good choice but I have no idea how to calculate it into the program since I don't know the art's measurements and details.
     
  18. Beltway

    Beltway

    The most grateful Sonic fan of all time this week Member
    1,621
    152
    43
    Sega of Darkest Peru
    Artwork and classes
    Sorry to bump, but...

    Do .gym files allow you to record the song without the sound effects included? I tried doing that by recording .VGM via Kega Fusion, but it had the sound effects included.

    Problem is that this song is the final boss fight of S2RR, so I can't record the beginning of the song properly, because of the Silver Sonic hovering noise always dropping in. >:/
     
  19. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,053
    876
    93
    Long-term happiness
    Friendly tip from someone who still has a few GYM files - in 2013, if you're still creating GYM files, you're doing it so, SO wrong. VGM has superseded it in every way. And both have the same style of recording, so a GYM would still have SFX in.
     
  20. Beltway

    Beltway

    The most grateful Sonic fan of all time this week Member
    1,621
    152
    43
    Sega of Darkest Peru
    Artwork and classes
    If you record in .wav, will it have the sound effects included?