Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. SuperSayian Zrise

    SuperSayian Zrise Well-Known Member Member

    Joined:
    May 10, 2021
    Messages:
    52
    I'm sorry, but I have a slight problem:
    [​IMG]
    My game crashes after going to Zone 07 01 (act 2) and I dc.w'd the level order myself and I have a green sonic ssrg screen. I'm not sure if those have anything to do with this but it just crashes even though the zone uses GHZ's level resize and stuff besides the palette. Here is the code:
    Code:
    sub_6BD6:                ; XREF: sub_6ADA; sub_6B06
            lea    ($FFFFB000).w,a1
            add.w    4(a3),d4
            add.w    (a3),d5
            move.w    d4,d3
            lsr.w    #1,d3
            andi.w    #$380,d3
            lsr.w    #3,d5
            move.w    d5,d0
            lsr.w    #5,d0
            andi.w    #$7F,d0
            add.w    d3,d0
            moveq    #-1,d3
            move.b    (a4,d0.w),d3
            beq.s    locret_6C1E
            subq.b    #1,d3
            andi.w    #$7F,d3
            ror.w    #7,d3
            add.w    d4,d4
            andi.w    #$1E0,d4
            andi.w    #$1E,d5
            add.w    d4,d3
            add.w    d5,d3
            movea.l    d3,a0
            move.w    (a0),d3
            andi.w    #$3FF,d3
            lsl.w    #3,d3
            adda.w    d3,a1
    
    locret_6C1E:
            rts  
    ; End of function sub_6BD6
    
    Very quick edit: I don't know how to read these crash handlers. Any help?
     
  2. Spicy Bread SSR

    Spicy Bread SSR You can call me Mal if you like Member

    Joined:
    Feb 27, 2021
    Messages:
    17
    Location:
    Green Hills, Australia
    Obj3A (act results) might be your issue. It has a level order array somewhere in the code, so the game can transition into a new stage. I'll provide an example (Github)
    Code:
    ; ---------------------------------------------------------------------------
    ; Level    order array
    ; ---------------------------------------------------------------------------
    LevelOrder:
            ; Green Hill Zone
            dc.b id_GHZ, 1    ; Act 1
            dc.b id_GHZ, 2    ; Act 2
            dc.b id_MZ, 0    ; Act 3
            dc.b 0, 0
    
            ; Labyrinth Zone
            dc.b id_LZ, 1    ; Act 1
            dc.b id_LZ, 2    ; Act 2
            dc.b id_SLZ, 0    ; Act 3
            dc.b id_SBZ, 2    ; Scrap Brain Zone Act 3
    
            ; Marble Zone
            dc.b id_MZ, 1    ; Act 1
            dc.b id_MZ, 2    ; Act 2
            dc.b id_SYZ, 0    ; Act 3
            dc.b 0, 0
    
            ; Star Light Zone
            dc.b id_SLZ, 1    ; Act 1
            dc.b id_SLZ, 2    ; Act 2
            dc.b id_SBZ, 0    ; Act 3
            dc.b 0, 0
    
            ; Spring Yard Zone
            dc.b id_SYZ, 1    ; Act 1
            dc.b id_SYZ, 2    ; Act 2
            dc.b id_LZ, 0    ; Act 3
            dc.b 0, 0
    
            ; Scrap Brain Zone
            dc.b id_SBZ, 1    ; Act 1
            dc.b id_LZ, 3    ; Act 2
            dc.b 0, 0    ; Final Zone
            dc.b 0, 0
            even
            zonewarning LevelOrder,8         ; also probably not here in hivebrain
    ; ============================================
    Since I'm assuming your using Hivebrain, id_GHZ might be 0. Your new level would most likely be 8 since the ending and special stage are 6 and 7 respectively (though as inferno said, your new level is probably 7), but the act results don't go beyond Scrap Brain (which is 5), so the game used data from the object itself, resulting in a crash. If you already added filler data for the special stage and ending to get level 8 to work, then your issue might be that you used dc.w, when the code is designed for dc.b
    Edit: Due to how I phrased it, it made it seem like the special stage was represented as 6.
     
    Last edited: Sep 29, 2021
    SuperSayian Zrise likes this.
  3. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    97
    Location:
    Sky Base Zone, South Island
    Actually... Special Stages aren't in Level Slot 6. That's the ending. Special Stages are their own separate thing. The only reason they have a zone constant for them in the GitHub disasm is so that the level select knows what ID links to jumping to the Special Stage gamemode from level select only. New zones would start at ID Slot 7.

    However, I think we should look at the caller here, aka where we branched to the module from. It only jumps into random stuff due to the Dynamic Screen Events routine. We'd actually need to see this. Either there's a mess up there or you are correct and we are jumping to an incorrect level.
     
    Last edited: Sep 28, 2021
  4. SuperSayian Zrise

    SuperSayian Zrise Well-Known Member Member

    Joined:
    May 10, 2021
    Messages:
    52
    Well, I tried to simply change the .w to a .b and It doesn't even build. (Probably because it uses 2 (00)'s which I am sure is a word.) And then I tried to put it right after Green Hill act 1 and it worked??? So the problem has nothing to do with these zones or whatever. Just with that sub_6BD6. Then I tried to change one of the ones listed to a byte and keep everything else word. Then the game crashed and it had something to do with Obj18_Nudge. And I'm very sure the module that came with it is wrong or something. Because, I could not find it in my assembly.
    (Yeah I'm giving up.)
    Note: I actually fixed the level order to what it has been before. After the crash of Obj18_Nudge. Also, this is hivebrain 2005 ASM68K disassembly.
    If you need my level structure here it is:
    Code:
    ; ---------------------------------------------------------------------------
    ; Level    order array
    ; ---------------------------------------------------------------------------
    LevelOrder:
                    dc.w GHZ2
                    dc.w GHZ3
                    dc.w RPZ1
                    dc.w RPZ2
                    dc.w RPZ3
                    dc.w MZ1
                    dc.w MZ2
                    dc.w MZ3
                    dc.w SYZ1
                    dc.w SYZ2
                    dc.w SYZ3
                    dc.w LZ1
                    dc.w LZ2
                    dc.w LZ3
                    dc.w SLZ1
                    dc.w SLZ2
                    dc.w SLZ3
                    dc.w SBZ1
                    dc.w SBZ2
                    dc.w SBZ3
                       even
     
  5. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    97
    Location:
    Sky Base Zone, South Island
    ... you do realize that this has to be in 4 act (due to S1 having 4 acts per zone) chunks in zone ID order, right? Assuming RPZ is in Slot 07, and that you have done no level ID rearranging, your level order should look like this:
    Code:
    ; ---------------------------------------------------------------------------
    ; Level    order array
    ; ---------------------------------------------------------------------------
    LevelOrder:
                    dc.w GHZ2
                    dc.w GHZ3
                    dc.w RPZ1
                    dc.w GHZ1
    
                    dc.w LZ2
                    dc.w LZ3
                    dc.w SLZ1
                    dc.w GHZ1
    
                    dc.w MZ2
                    dc.w MZ3
                    dc.w SYZ1
                    dc.w GHZ1
    
                    dc.w SLZ2
                    dc.w SLZ3
                    dc.w SBZ1
                    dc.w GHZ1
    
                    dc.w SYZ2
                    dc.w SYZ3
                    dc.w LZ1
                    dc.w GHZ1
    
                    dc.w SBZ2
                    dc.w SBZ3
                    dc.w GHZ1
                    dc.w GHZ1
    
                    dc.w GHZ1
                    dc.w GHZ1
                    dc.w GHZ1
                    dc.w GHZ1
    
                    dc.w RPZ2
                    dc.w RPZ3
                    dc.w MZ1
                    dc.w GHZ1
                       even
     
    Last edited: Sep 29, 2021
  6. SuperSayian Zrise

    SuperSayian Zrise Well-Known Member Member

    Joined:
    May 10, 2021
    Messages:
    52
    I wish it was easier to edit in the first place. And I can see why the game will jump to GHZ act 1 after "SBZ3". But for any level outside of that level like the game jumping to RPZ1 >>> RPZ2 is a bit confusing. Because it for whatever reason jumps to GHZ1 but never actually jumps to it. Like how does the game even know not to jump to it? Most of the text I can kinda see how. It "dc.w's" to RPZ1 and after goes RPZ2. And its like telling the game to jump to the next act of a zone somewhat like a label or whatever its called. And I don't understand how this helped the devs more then just making it simple. Also, tell me if you want credit for this. If you don't then ok.
    edit: When I said: "I wish it was easier to edit in the first place." Is simply talking about the bin file.
    edit2: The lorded thing was cool. But I used Inferno's method because I tried to add a zone 07 to lorded and the level ids are built in the program I think. Which means I got crashes.
     
    Last edited: Oct 1, 2021
  7. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,869
    Location:
    italy
    *cough*
     

    Attached Files:

  8. SuperSayian Zrise

    SuperSayian Zrise Well-Known Member Member

    Joined:
    May 10, 2021
    Messages:
    52
    The only reason I can't use it is because it requires a dll file and I can't find any from the microsoft website. And if I did it will be in a question someone asks then someone provides the most sketchy link even if it says its from microsoft.com I just can't trust it unless I find it on the actual thing on the website.
    edit: I used Inferno's method. And is explained in my upper post which your post is in between.
     
    Last edited: Oct 1, 2021
  9. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,869
    Location:
    italy
    I just tried to look for it, and indeed it appears that Microsoft took down the KB page with the relevant download.

    The file itself, however, is still on Microsoft's servers, and you can safely download it from this direct link: http://download.microsoft.com/download/vb50pro/utility/1/win98/EN-US/Msvbvm50.exe

    You trusted me when you downloaded the program I wrote, you can trust me when I tell you that the link above is legit.