don't click here

Basic Questions & Answers thread

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

  1. Moon Alien

    Moon Alien

    Member
    5
    0
    0
    SonMapEd did the trick : https://imgur.com/a/TWTb7vQ

    I think those barriers gave me the most headaches, I pretty much fixed every other major issue accordingly, so I think I almost have a bug-fixed version of Sonic 2 I'm satisfied with, in order to start doing the fun stuff.

    Grateful for the advice.
     
  2. Prototype

    Prototype

    Member
    296
    68
    28
    So, I've been looking to mod Mania Plus to refresh it a little. The game is super fun, but I want a bit more variety. I'm not entirely sure how to go about that, though. Is there a simple mod loader or something like that? Where do I start?
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
  4. Prototype

    Prototype

    Member
    296
    68
    28
    Thanks! I haven't had a chance to check it out yet, but I will soon. One thing I gotta ask, because I'm clueless, when it comes to modding Mania, can you outright add content like more levels, etc.? Or is it more a case of replacing the existing level slots with custom data and recreating levels. I'm not really sure how the data structure works.

    I don't know if it's ever been done, but it would be pretty neat to just add ALL the classic Sonic levels and essentially recreate the S123k trilogy as a coherent package.
     
  5. TheInvisibleSun

    TheInvisibleSun

    OVER THE TOP TECHNO-BLAST Member
    1,626
    193
    43
    Buffalo, NY, USA
    The Water
    It's kind of being done:

    http://youtu.be/nqdj2HgSFhY

    I think they might do more.
     
  6. Moon Alien

    Moon Alien

    Member
    5
    0
    0
    I'm trying to import Knuckles in Sonic using this guide : http://info.sonicretro.org/SCHG_How-to:Port_Knuckles_into_Sonic_2

    I ended up with an invisible debug mode that couldn't be turned off with B. In other words, you couldn't see Knuckles or even the rings before you wanted to put it in, but the rings or the other objects could be seen once inserted by pressing C. If I try to bypass Debug Mode by force (AKA : If Knuckles is main character, do not activate Debug Mode at all), the game freezes on the stage title card, I assume it might have to do with a faulty connection to Knuckles' graphics files, but all those seem fine. Obviously, the compiler had no issues, because I have a working ROM, but no Knuckles.

    I made sure that every step was followed, I even went back and modified some of the code. I did modify a piece of code where Tails Alone could use Debug mode beforehand (http://forums.sonicretro.org/index.php?showtopic=29029&st=15&p=692574&#entry692574), if that's relevant. Is there an extra step left out of the guide to connect in Knuckles' graphics properly or possibly a modification to the code that might make everything not work properly?
     
  7. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    Have you altered the RAM layout in your hack? Knuckles' code from the KiS2 disasm uses hard addresses, which will cause all kinds of unpleasant effects if you add/delete/move any variables in S2's RAM allocations. To fix it, you'll have to go through and swap out the addresses for the appropriate labels. The SCHG RAM Editing page or a listing file from a clean disasm can help with this.
     
  8. Kane

    Kane

    Member
    1
    0
    1
    I'm having a little trouble here~

    So recently I have ported the Sonic 2 level select to Sonic 1, and I was successful. However, today I tried to port the Sonic 3 sound driver to Sonic 1, And I get these errors:

    C:\USERS\USER\DESKTOP\SONIC ROM HACK\S1DISASM-MASTER\_INCOBJ\09 SONIC IN SPECIAL STAGE.ASM(424) : Error : Label '@nojump' multiply defined
    @nojump:
    C:\USERS\USER\DESKTOP\SONIC ROM HACK\S1DISASM-MASTER\S2_MENU.ASM(33) : Error : Label 'emerald_snd' multiply defined
    emerald_snd = $0093
    C:\USERS\USER\DESKTOP\SONIC ROM HACK\S1DISASM-MASTER\S2_MENU.ASM(39) : Warning : Instruction has been word aligned
    move.b #stop_sound,d0
    C:\USERS\USER\DESKTOP\SONIC ROM HACK\S1DISASM-MASTER\S2_MENU.ASM(125) : Error : Illegal value (64416)
    lea $fba0(a2),a2
    C:\USERS\USER\DESKTOP\SONIC ROM HACK\S1DISASM-MASTER\S2_MENU.ASM(465) : Error : Illegal value (783000)
    move.b #emerald_snd,d0

    I spent almost an hour trying to fix these errors, and I had no such luck. Help?
     
  9. Dandy

    Dandy

    Member
    Is there any way to disable bilinear filtering in the Steam version of Sonic CD? None of the video filter options in the game's settings actually get rid of the ugly blur.
     
  10. silent.creature

    silent.creature

    Silent Creature Member
    18
    0
    0
    Brazil
    Studying both to work and to get back to some stopped hobbies...
    My keyboard gave me a pain.

    If this question should be make as a specific topic, let me know, please.

    While trying to make a proper extension of Level Layout indexes under Sonic 2, I'm having difficulties to understand the procedure
    Code (Text):
    1. loadLevelLayout
    . I'm using Sonic 2 Git disassembly.

    The first part, which consists of
    Code (Text):
    1.  
    2. moveq #0,d0
    3. move.w (Current_ZoneAndAct).w,d0
    4. ror.b #1,d0
    5. lsr.w #6,d0
    6.  
    converts a Zone-Act reference to a word-offset index (example: for ARZ2, it is $3E). Then, it does
    Code (Text):
    1.  
    2. lea (Off_Level).l,a0
    3. move.w (a0,d0.w),d0
    4. lea (a0,d0.l),a0
    5. lea (Level_Layout).w,a1
    6. jmpto (KosDec).l, JmpTo_KosDec
    7.  
    which means loading first pointer (EHZ1 layout) onto a0, then moving the proper pointer to d0, load it onto a0 and decompress it onto Level_Layout.

    But in
    Code (Text):
    1. sub_E4A2
    , we have
    Code (Text):
    1.  
    2. moveq #0,d0
    3. move.w (Current_ZoneAndAct).w,d0
    4. ror.b #1,d0
    5. lsr.w #5,d0
    6. add.w d1,d0
    7.  
    which converts a Zone-Act reference to a long-offset index, and, depending of the case, it increases #2 on this index (example: for ARZ2, it yields $7C or $7E). Then, it does this:
    Code (Text):
    1.  
    2. lea (Off_Level).l,a1
    3. move.w (a1,d0.w),d0
    4. lea (a1,d0.l),a1
    5.  
    In other terms, it loads what onto a1, since
    Code (Text):
    1. Off_Level
    has, at most, $22 entries ($44 bytes)?

    Or did I misunderstood it?
     
  11. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    sub_E4A2 is part of the leftover code from Sonic 1's level layout loading. It has twice as many indexes because each act has a separate FG and BG pointer. loadLevelLayout ends with the jump to KosDec, nothing after that is executed.
     
  12. silent.creature

    silent.creature

    Silent Creature Member
    18
    0
    0
    Brazil
    Studying both to work and to get back to some stopped hobbies...
    Thank you for pointing this out.
     
  13. Wafer

    Wafer

    Find me on Twitter instead Member
    255
    75
    28
    Can anyone point me at an assembler (and ideally command options) that can build andlab's Spinball disasm? asw throws the toys out of the pram in about 5 different ways, most glaringly a lack of support for dcb.x and single quotes, and asm68k falls over the aligns.

    Edit: Ah. I just read the header and figured out that it probably targets GAS? YAY.


    Okay, new question, same topic. I've included the align macro in the Sonic Spinball disasm and fixed up a bunch of build errors in asm68k, but it wouldn't load in GENS. I went back to an "unfixed" version of the disasm, and looking at the .lst and comparing it to the ROM in hex, I can see that some of the LEAs are coming out at 6 bytes length when they should be only 4 bytes, see below example:

    Code (Text):
    1. 00000210                            loc_210:                                ; DATA XREF: ROM:000042E8?o
    2. 00000210                                                                    ; ROM:0001444C?o ...
    3. 00000210 4BF9 0000 0000                             lea     SetupValues,a5
    4. 00000216                            loc_214:                                ; DATA XREF: ROM:000C2DB4?o
    5. 00000216 4C9D 00E0                                  movem.w (a5)+,d5-d7
    loc_214 is in $216! The ROM would be exactly $200 bigger than it should be according to the .lst, and taking a quick glance at a search for LEAs in the .lst I don't think they alone can account for this - most of them are 4 bytes long.

    Any clues what could be causing this? I'm using the same build options as the Sonic 1 repo.
     
  14. Clownacy

    Clownacy

    Tech Member
    1,053
    581
    93
    The lea needs its size explicitly setting. The assembler seems to be defaulting to (SetupValues).l, but SetupValues(pc) sounds like what you're looking for.
     
  15. Fred

    Fred

    Taking a break Oldbie
    1,563
    117
    43
    Portugal
    Sonic 3 Unlocked
    Yeah, my guess is the version of IDA that was used to make the disassembly failed to output the addressing mode for those instructions. I ran into the same problem when making the S3 disassembly, and ended up having to write a program that disassembles those instructions (as well as JMP and JSR and anything else that might alternate between longword and PC-relative addressing) and rewrites those lines with the appropriate notation.
     
  16. Wafer

    Wafer

    Find me on Twitter instead Member
    255
    75
    28
    Thanks for the response, peeps. It validates the time I'm spending writing a Python script to correct the opcodes from the binary.
     
  17. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    FWIW, the most recent version of IDA Pro finally fixed that issue.
     
  18. Digimaks

    Digimaks

    Member
    4
    0
    0
    My first Sonic 1 hack
    Hello everyone, I recently joined the forum for Sonic hacking. Thanks for letting me on board, and thanks for the speed shoes!
    This is useful thread, yet haven't seen post since 2011? Odd.
    Anyways, Since it's open and for newbies, I guess can I ask around.

    So I am interested in adding more objects to the game (with future plans to expand Sonic 1 with additional zone, but that's much later). So looking in s1disasm (Hithub?) _incObj folder, there are objects indexed from 0A through 8C. Is that a list limit, or I can add brand new asm object with number starting from 90? In that case, can the object number/ID go 100 and up, or two digit number is the limit?

    Also, I see blank asm's in the list - can they be re-purposed for whatever objects I want to add, or those are reserved for the game utilitarian purposes?
    I tried to copy and paste Yardin code into blank 4F.asm, and all I got was no ROM build. :rolleyes:
     
  19. Wafer

    Wafer

    Find me on Twitter instead Member
    255
    75
    28
    As someone who only started hacking about 18 months ago, I'd highly recommend you start with something a bit less complicated than adding your own objects. The How-to Guide is a great place to start.

    For objects, the first best resource is the wiki's object editing page. Look for unused object or empty slots, the object pointers go up to FF in Sonic 2 and I'm pretty certain it's the same for Sonic 1, so anything above 8C is fair game (EDIT: Per MainMemory's reply, the object manager won't allow you to place objects over 80). There's a bunch of places you will probably need to hook up your code for the object to actually do anything, and that's a bit beyond the scope of a forum post. The guide for porting Knuckles is for Sonic 2 and is something of an extreme example, but it's the best write-up I've found for adding or porting new objects.

    When a build fails, you can check errors.log to find out why it failed.

    As you noted, this thread isn't very active. Depending on the scope of your questions, you might find that the basic questions thread is more likely to get you an answer.
     
  20. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    There is a caveat with Sonic 1's object layout format: objects with ID $80 and above cannot be placed in levels, as the high bit of the ID byte is used to signify that the object should remember when it's been destroyed. You can move certain objects such as the HUD and title card to later slots to be able to add more objects in levels, or change the object manager to use the Sonic 2 format, which doesn't have that limitation.

    The reason copypasting the Yadrin code didn't work is probably because you ended up with duplicate labels; except for local labels (beginning with @), all labels must be unique across the entire code base.

    As mentioned before, questions like these are really meant to be posted in the Basic Q&A thread.