don't click here

Basic Questions & Answers thread

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

  1. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    I have effectively done both. I moved Sonic & Tails to the top of the uncompressed art section, and moved all the collision binaries to later in the file.

    with that said, now I'm doing is trying to clean up my code and use a better method. I have renamed the collision variable like this:

    Code (Text):
    1. ColCurveMapS1:  BINCLUDE    "GHZ/Angles.bin"
    2. ColCurveMapS2:  BINCLUDE    "collision/Curve and resistance mapping.bin"
    3.     even
    4. ;--------------------------------------------------------------------------------------
    5. ; Collision arrays
    6. ;--------------------------------------------------------------------------------------
    7. ColArrayS1: BINCLUDE        "GHZ/Collision.bin"
    8. ColArray2S1:    BINCLUDE        "GHZ/CollisionR.bin"
    9.     even
    10. ColArrayS2: BINCLUDE    "collision/Collision array 1.bin"
    11. ColArray2S2:    BINCLUDE    "collision/Collision array 2.bin"
    12.     even
    and then in the s2constants.asm file, I've added this:

    Code (Text):
    1. ColCurveMap = ColCurveMapS2
    2. ColArray    = ColArrayS2
    3. ColArray2   = ColArray2S2
    to make it load Sonic 2's collision by default. That works, but here's where the problem comes into play: I decided to put the place to change the ColArray in Level_MainLoop, right before the Rings Manager. Here's the code I have that doesn't work:]

    Code (Text):
    1.     cmpi.b  #$01,(Current_Zone).w   ; is it GHZ?
    2.     bne.s   +           ; if not, branch
    3.         ColCurveMap = ColCurveMapS1
    4.         ColArray    = ColArrayS1
    5.         ColArray2   = ColArray2S1
    6. +
    It calls this an invalid OPCode... What am I doing wrong?
     
  2. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
    What you're doing there, is creating assembler constants. This means two things: one, they can only be assigned to once; and two, they only exist within the assembler.

    What you need to do if you want to use that method, is find space in the RAM declarations for three longword-sized variables, then use move.l #ColCurveMapS1,(ColCurveMap).w. You also have to add a branch in the code for when the level is not GHZ, and put S2's collision data in there. You'll also have to edit all code that references the collision so they dereference the pointer in the RAM variable, rather that just taking its address.
     
  3. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    Okay, forgive my simple mindedness, but here's what I have done:

    in the s2Constants, I deleted the old ones and instead put this in a different location, making use of some empty space in RAM:
    Code (Text):
    1. ColCurveMap:            ds.l    1   ;Collision Slope Map
    2. ColArray:               ds.l    1   ;Collision Array 1
    3. ColArray2:              ds.l    1   ;Collision Array 2
    And then in Level_Level_MainLoop:
    Code (Text):
    1.     ;Initialize Collision
    2.     move.l ColCurveMapS2,(ColCurveMap).l
    3.     move.l ColArrayS2,(ColArray).l
    4.     move.l ColArray2S2,(ColArray2).l
    (Haven't added the check for GHZ yet because I want to make sure it works in the first place).
    It still builds fine and everything, but there is a problem. namely, the collision doesn't actually work. So, my next question is about this part:

    Could you explain this in a little bit more detail?

    Also, I found these different variables that are used, do I need to mess with them at all?

    Collision_addr (1 Longword)
    Primary_Collision (300 bytes)
    Secondary_Collision (300 bytes)
     
  4. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
    First off, you seem to have forgotten the # before the labels, which causes them to move the data at that address, rather than the address itself.

    For your first question, from a quick glance it looks like all references to the collision data are of the format lea (address).l,aN. You simply need to change the lea to move.l, which changes the effect from moving the address to aN to moving the longword at the address to aN (dereferencing the pointer).

    For your second, those are all related to the collision indexes, which should be fine if you got them converted and imported with the rest of the level's data.
     
  5. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    I did as you said, and it now *kind of* works. The level has tangibility, but contact with most slopes besides simple linear ones results in glitching.
    I have added the # symbols to the original references, so that's not the issue.

    Also, I've tried both "move.l ColArray,a2" or likewise, and "move.l (ColArray).l,a2" and likewise. I've done this for all the references to ColArray,ColArray2, and ColCurveMap. Any idea what's wrong still?
     
  6. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
    I don't think I can help you with just the information you've given me. Perhaps you could zip up your disassembly (or at least s2.asm and s2.constants.asm) and PM me a link?
     
  7. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
    Double-posting because I have looked at the code and discovered the answer: for whatever reason, certain spots in the disassembly use ColArray+$1000, when they should be using ColArray2. A simple Find/Replace will fix it.
     
  8. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    okay, so it's fixed completely now, and I even got the alternate collision working even! Thank you very much for your help!

    Not to mention now there's no glitchy-graphics in the spindash, and I'm using a method that's not horribly inefficient.

    But... The +1000 thing wasn't something I did... Why was it done that way?
     
  9. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
    I can only assume that originally, the two collision arrays were treated as one large array, and not all the references were updated when they got split.
     
  10. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    That's the only thing that would make sense to me... Should the original dissasembly be modified to just use ColArray2 instead, or is that considered inappropriate to make a tweak like that?

    Regardless, I've got another question that's part of something I haven't yet done. I've been wanting to port the Sonic 1 sound Driver into my hack, for many obvious reasons, but I have an issue. The guide is broken, as discussed on its talk page, and is also not meant for the HG dissasembly. Normally I have no trouble figuring out what goes were and getting everything to work as I did with the Sonic 3k Rings Manager, but this driver apparently references a RAM location that is named in the Xenowhirl and hg disassemblies, and I have no idea how to figure out what it should be. Plus there are a few flakey details which are also mentioned in the talk page.

    Any advice on what I should do for this? If I can get Sonic 1's Sound Driver ported in, it would be a major gateway for being able to use songs I'd rather use over the ones in Sonic 2, or even stepping up to use a fanmade driver.

    With that said, I have one more question: will the Sonic 2 Clone Driver affect the sounds of Sonic 1/3k/2Beta songs imported into the game?
     
  11. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
  12. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    Okay, so for my level, I've been wanting to make the stakes that go on the sides of the bridge. Ideally, I want to use an objects that already exists, in this case, object 71. I'm quite confused on how it works though. As far as I can tell, the mappings and stuff are here:

    Code (Text):
    1. Obj71_InitData:
    2.     objsubdecl 3, Obj11_MapUnc_FC28,  make_art_tile(ArtTile_ArtNem_HPZ_Bridge,3,0), 4, 1
    3.     objsubdecl 0, Obj71_MapUnc_11396, make_art_tile(ArtTile_ArtNem_HPZ_Unk,3,1), $10, 1
    4.     objsubdecl 0, Obj71_MapUnc_11576, make_art_tile(ArtTile_ArtNem_HPZOrb,2,0), $10, 1
    That's all well and good, except I really don't know what all these numbers mean, besides the conventional ones used in setting up mappings. does anyone else know what to make of this?
     
  13. Glaber

    Glaber

    Has Beaten Sonic Genesis for GBA Oldbie
    Say, an interesting question came to mind. since we have ways of getting Dreamcast DLC onto a VMU without an internet connection for the system, can the same method with a home brew vmu manager be used to get the DLC onto an emulated one?

    EDIT: IT WOOOORKED! I can rip the mellinum Ring now!
     
  14. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    Okay, so editing mappings isn't hard when they're stored externally, and even when they're stored internally, it's usually not that bad...

    But how do I edit the Sonic 2 title card mappings besides just text in the HG dissasembly? I've been trying to edit the title card's main appearance, and I can't get anything to display right besides text..
     
  15. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
    Well first you have to extract the mappings from the disassembly (obviously), then you have to create a VRAM dump at the title card to use as the art file in SonMapEd. The title card object's art_tile is 0, so the mappings refer to tiles starting at tile 0.

    Of course, if you use SonMapEd, it'll ignore all the original labels and make new ones, which will break the end of level mappings.

    And there's the fact that most of the title card is actually solid blocks of color, created by programmatically altering plane A's tilemap in VRAM.
     
  16. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    with what I'm trying to do, that mostly won't matter, and realistically if I want to do it cheaply, I'll only really need to edit one object, and with that being the case, this will, in theory be easy enough.

    EDIT: Okay, so now the part I edited The yellow part at the bottom) is leveling the screen earlier than I want. I want it to leave the screen when the zone text does... Any help?
     
  17. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    Another day means another issue, and this time the fun is Sonic 2's sound driver.

    What does it mean by "The other bank"? Will moving some songs cause issues?

    What I've done was simply port in a single song over another.
     
  18. MainMemory

    MainMemory

    Has-Been Modder Tech Member
    4,820
    412
    63
    Myself
    I would recommend moving sound effects to their own bank. Just before SoundIndex, insert the lines
    Code (ASM):
    1.     align $8000
    2. soundBankStart  := *
    3.  
    That should give you plenty of space for music and sfx.
     
  19. Caverns 4

    Caverns 4

    Member
    346
    0
    16
    Sonic: Retold
    That worked great, thanks!

    1:How can I properly extend the sound test to allow numbers $00 - FF instead of just $80-$FF? There's a guide for Sonic 2 on the wiki, but that assumes I've ported the Sonic 1 sound driver in, and I can't... Ignore that question, I've figured it out.

    2:Also, if anyone knows anything about porting in Sonic 2 Beta songs, I would appreciate the help. a friend of mine knows how to port in music from Sonic 1, but I guess Sonic 2 Beta is a little different.

    3: Also, there's a bug in the game with object 1A (The collapsing platform) when in it's default form (The GHZ ledge), if the player stands on it when it collapses, their Y position shifts down by 16 or so pixels without warning.. Does anyone know how to fix this?
     
  20. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    3) I can't see this bug. Where abouts did you notice this?