don't click here

Basic Questions & Answers thread

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

  1. Selbi

    Selbi

    The Euphonic Mess Member
    1,497
    48
    28
    Northern Germany
    Sonic ERaZor
    Well, I would need to watch the VRAM, but I would also need to number of the tile, my curser is currently hovering over. KMod lacks of that feature.
     
  2. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    More S1 pallette related questions:

    * I'd like the Try Again/End screens to load a separate pallette from the ending cutscene itself, at which point would I edit for this change (I've tried it at different points but it either doesn't change the pallette or f*** up the sprites altogether).

    * Is there a way to change which pallette line a sprite mapping uses without changing it's layer order? I edited the lighting balls in the Final Zone to use the first pallette line rather than the second and now you can see them fall inside the walls and disappear where the animation ends.
     
  3. GT Koopa

    GT Koopa

    Member
    2,021
    18
    18
    Elgin, IL
    Flicky Turncoat DX, T.L.W.S. Vs M.G.W.
    You know what would be nice to have on the wiki? Subroutines. Like have a description of each one, what it does, how to set it up in your code so it activates correctly, and what to be ready for when it finishes. For example Sonic 1's DeleteObject.


    I also want Malevolence's Simple Boss that he posted on Sofia, if possible. I PM'd him however it has been a few days (I assume he is away from viewing Retro right now, busy etc) so I wonder if anyone else had saved it.


    In short I want to know how stuff works more than what is explained in the how to work with objects tutorial.

    Edit:

    Code (ASM):
    1.     jsr ChkObjOnScreen
    2.    
    3.     tst d0
    4.     bne.w   DeleteObject
    I don't know why this doesn't work.
     
  4. StephenUK

    StephenUK

    Liquor in the front, poker in the rear Tech Member
    1,678
    0
    16
    Manchester, UK
    Quackshot Disassembly
    I use DebuGens for watching VRAM and general debugging. Never had a problem with it as far as getting information goes, and it can dump various files such as the VRAM, CRAM etc. It doesn't give the tile number by hovering over it, but its easy enough to work out by the VRAM location on the left of the tile rows.
     



  5. Why does this bug happen? How can I fix it? The wiki page states that it was fixed in S2K, however, the code for the object is exactly the same.
     
  6. FraGag

    FraGag

    Tech Member
    What happens is that an object with ID $97 (Rexon's head) has its routine counter set to $A, although its last routine is 8. I think routine 8 is used when the head is destroyed. There are a few places where the routine counter is incremented by 2:
    Code (ASM):
    1.     addq.b    #2,routine(a0)
    In particular, at loc_37454, there's a call to loc_3750C, which can set the routine counter to 8, and then increments the routine counter by 2 if the counter at objoff_2A(a0) is -1, so it's really a matter of timing.
     
  7. Selbi

    Selbi

    The Euphonic Mess Member
    1,497
    48
    28
    Northern Germany
    Sonic ERaZor
    Wouldn't it be much easier to just like duplicate the last line in the routine counter? I mean this one (in off_373DE):

    Code (ASM):
    1.         dc.w loc_374F4-off_373DE; 4
    For me it works just fine now.
     
  8. Kyuu

    Kyuu

    Memory Access Violation Member
    Well, I just got back into hacking again, and after failing with building my rom because I renamed a folder ( :v: ) I decided to try adding dynamic pallets to see what I could remember.

    I managed to create the separate pallet files and the like, but just realized I have no idea what subroutine controls loading pallets.

    Only thing I can find is this:

    Code (Text):
    1. Level_LoadPal:
    2.         move.w    #$1E,($FFFFFE14).w
    3.         move    #$2300,sr
    4.         moveq    #3,d0
    5.         bsr.w    PalLoad2   ; load Sonic's pallet line
    6.         cmpi.b    #1,($FFFFFE10).w; is level LZ?
    7.         bne.s    Level_GetBgm   ; if not, branch
    8.         moveq    #$F,d0       ; pallet number    $0F (LZ)
    9.         cmpi.b    #3,($FFFFFE11).w; is act number 3?
    10.         bne.s    Level_WaterPal   ; if not, branch
    11.         moveq    #$10,d0       ; pallet number    $10 (SBZ3)
    I'm using the 2005 disassembly mainly because I'm already used to its structure (and I'm far too lazy to move my work over to the SVN disassembly). Can someone give me a pointer (no pun intended) as to where I should start with pallet loading? Thanks. :)
     
  9. FraGag

    FraGag

    Tech Member
    Palettes are loaded by the PalLoad* routines (PalLoad1, PalLoad2, PalLoad3_Water and PalLoad4_Water). They load one or more palette lines according to the data in _inc\Pallet pointers.asm. Each entry is made up of a longword pointing to the palette data, a word indicating at what RAM address the palette will be loaded and a word indicating how many longwords to load (number of colors / 2 - 1). Palette animation is done in PalCycle_Load.
     
  10. Kyuu

    Kyuu

    Memory Access Violation Member
    Ah, thanks. I managed to get the game to load the new pallets I had this time, but on the wrong levels now (because I accidentally incremented the offset of the pallets outside GHZ).

    From my understanding, what PalLoad* does is check the value of d0 and add #3 to it, giving the pallet offset, correct? If that's the case I think I have an idea to go with from here.
     
  11. FraGag

    FraGag

    Tech Member
    No, it shifts the value to the left by 3 bits, which has the effect of multiplying it by 8 (because each entry in the table takes up 8 bytes). The first entry is the SEGA palette, so by moving 0 to d0, it will load the SEGA palette.

    The palette that is loaded for a level is specified in _inc\Main level load blocks.asm (it's the last byte on each dc.b line). If you want to load a different palette for each act, you'll have to come up with another mechanism.
     
  12. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    I've never hacked a rom a day in my life.

    So, in layman's terms, can someone answer a few questions for me?

    1) Is it possible to put Sonic 3-style level transitions into Sonic 2? If so, how?

    2) Are Sonic 3 style level transitions possible in Sonic 2? If so, how?

    3) Are "infinite loop" areas like the fall in Metropolis Zone editable? If so, how?

    4) Is the a step-by-step walkthrough for editing with SonED2 anywhere? Just out of curiosity.

    Thanks for your time fellas
     
  13. PsychoSk8r

    PsychoSk8r

    PsychedelAnt | Tone Turner Oldbie
    2,641
    57
    28
    Birmingham, UK
    30 Day Project: Revisited.A New Release!
    1 & 2: Yes, but with lots of ASM work.
    3: Yes, you can edit it in SonED2, though if you want to stop the endless looping, you'll need to edit the correct parts in ASM.
    4: SCHG:SonED2_Manual
     
  14. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    Just realized 1 and 2 are the same. Whoops. That SonED2 manual doesn't have any pictures to go along with explanations, so it's kinda hard to figure out if its something I could even feasibly wrap my head around without downloading SonED2 and going through the effort of figuring out how to split Sonic 2 and all that jazz.
     
  15. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,192
    406
    63
    Japan
    Porting a specific something from one Megadrive/Genesis game to another is most likely 90% possible, regardless of the differences between the two, porting can be done in any shape or form, therefore the answer to all of your questions from 1 to 3 are "Yes", "How?" well that is down to how much research and work you're will to through at it.
     
  16. Aerosol

    Aerosol

    Not here. Moderator
    11,163
    573
    93
    Not where I want to be.
    Sonic (?): Coming summer of 2055...?
    Like I said, I've never hacked a day before in my life, so I shove in the right direction is all I'm asking for. Like PsychoSk8er's ASM tip.

    Do you know where those routines might be found in the Sonic 3 disassembly, MarkeyJester?
     
  17. The infinite fall parts are acheived by setting the horizontal boundary to -100. then once you're at the bottom you'll be at the top, etc
     
  18. FraGag

    FraGag

    Tech Member
    Fixed.
     
  19. E-122-Psi

    E-122-Psi

    Member
    2,470
    612
    93
    Is it possible to program commands for diagonal buttons (eg. 'Is forward up/forward down being pressed?').
     
  20. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,192
    406
    63
    Japan
    Code (ASM):
    1.         #%SACBRLDU
    S = Start
    B = B
    C = C
    A = A
    R = Right
    L = Left
    D = Down
    U = Up

    Code (ASM):
    1.         move.b  ($FFFFF602).w,d0                ; load control buttons
    2.         andi.b  #%00001010,d0                   ; get only right and down button presses
    3.         cmp.b   #%00001010,d0                   ; are right and down both pressed?
    4.         beq.s   DiagonalButtonIsPressed             ; if so, branch
    Edit: Correcting button bit codes as stated by FraGag below.