don't click here

Basic Questions & Answers thread

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

  1. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    It sounds like the code for pressing start is not in the loop and is just above it. So when you press start, it branches to whereever and skipping important stuff. Maybe posting where you've put it to press start command and some code above/below it so we can spot it out. Otherwise, no idea.
     
  2. RetroKoH

    RetroKoH

    Member
    1,728
    107
    43
    S1Fixed: A successor to ReadySonic
    This is what I've edited to skip the SEGA sound. It is located in sounddriver.asm in the Mercurial disasm. It jumps to a subroutine called ReadJoypad. just below this is the VDP Set up game. I don't know if pressing start early is triggering this or not. As MJ stated, he, and likely no one else has encountered this.
    Code (Text):
    1.  
    2.  
    3. PlaySega: ; Sound_E1
    4.                 lea (SegaPCM).l,a2          ; Load the SEGA PCM sample into a2. It's important that we use a2 since a0 and a1 are going to be used up ahead when reading the joypad ports
    5.         move.l  #(SegaPCM_End-SegaPCM),d3   ; Load the size of the SEGA PCM sample into d3
    6.         move.b  #$2A,($A04000).l        ; $A04000 = $2A -> Write to DAC channel
    7. PlayPCM_Loop:
    8.         move.b  (a2)+,($A04001).l       ; Write the PCM data (contained in a2) to $A04001 (YM2612 register D0)
    9.         move.w  #$14,d0             ; Write the pitch ($14 in this case) to d0
    10.         dbf d0,*                ; Decrement d0; jump to itself if not 0. (for pitch control, avoids playing the sample too fast)
    11.         sub.l   #1,d3               ; Subtract 1 from the PCM sample size
    12.         beq.s   return_PlayPCM          ; If d3 = 0, we finished playing the PCM sample, so stop playing, leave this loop, and unfreeze the 68K
    13.         lea (v_jpadhold1).w,a0      ; address where JoyPad states are written
    14.         lea ($A10003).l,a1          ; address where JoyPad states are read from
    15.         jsr (ReadJoypad).w          ; Read only the first joypad port. It's important that we do NOT do the two ports, we don't have the cycles for that
    16.         btst    #7,(v_jpadhold1).w      ; Check for Start button
    17.         bne.s   return_PlayPCM          ; If start is pressed, stop playing, leave this loop, and unfreeze the 68K
    18.         bra.s   PlayPCM_Loop            ; Otherwise, continue playing PCM sample
    19. return_PlayPCM:
    20.         addq.w  #4,sp
    21.         rts
    22.  
    I think I have pinpointed the issue to pressing start early on both the SEGA screen and the title screen early... though I still don't really know why. I haven't tampered with much else, save for the fact that I implemented Mercury's centisecond timer into my hack... it was after this that I started to notice this issue, though it is possible that is coincidence and has nothing to do with it, as Mercury is unaware of such a bug as well. I am describing it the best I can. I will try to do anything I can on Gens ReRecord to maybe see if I notice anything different between no errors, and when the errors occur. What I think is happening is that when I press start rapidly and skip right through, the art, or PLC, or something for the HUD and ring sprites are NOT loading correctly, or at all... and thus they never appear in the game, though the objects still exist and function properly.


    Messed about some more. The problem has ZERO to do with the SEGA sound after all, as MJ suggested. It is merely a result of pressing start at the title screen right away. I will look at the code there, and report back if I need help.
     
  3. TehKaker

    TehKaker

    Member
    12
    0
    1
    Hello everyone.

    From the past week, I had the idea to remake a pokemon game.

    Everything was ok until yesterday, when I had to write the scrolling system.
    The hardest part of this, is when I must do the map renewing code, to simulate a bigger map.
    I'm stuck trying to program this part. I have no idea which formula I can follow to do this.
    Can you at least give me a clue about this, please?

    Thanks, and excuse my possible bad english.
     
  4. RetroKoH

    RetroKoH

    Member
    1,728
    107
    43
    S1Fixed: A successor to ReadySonic
    Sonic 2's Floor_ChkTile uses a premade table. Is it feasible or worth while to do the same thing for Sonic 1's sub FindNearestTile?
    ALSO, I have removed the Floor_LogUnk subroutines from Sonic's 1 and 2. I assume this will cause no problems? I have run into none thus far...
     
  5. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber

    Not at home, so this is from the top of my head.


    I've never looked into Sonic 1's Find nearest tile, but IIRC, I remember that Sonic 2's table way is faster, so it's probably worth a try. I mean, there's no harm trying is there?


    As for Floor_LogUnk, it's not in my S2R either, so you're safe there (for Sonic 2 at least; no idea about Sonic 1).
     
  6. Endri

    Endri

    Officer I don't have my drivers license with me. C Tech Member
    Sonic 1 is stupid, because it calculates the location of the tile every time. Even though Sonic 2 approach is much more elegant, it is hardly worth doing the same thing with Sonic 1 because the improvements in performance would be barely noticiable anyways (unless you somehow have reached a bottleneck in your project, though I could see where it could reduce slowdowns when losing rings when a lot more of objects are on the screen).
     
  7. Chris Highwind

    Chris Highwind

    Member
    2,101
    18
    18
    Statesville, NC
    Slacking
    So I've decided to take up the mantle and find what I call the White World Trigger that causes the stages to look white with the Unleashed renderer in Generations. I've managed to find my way into the exe file where the subroutines are located, but here is where I hit a snag: I do not know how to properly disassemble an exe file. Is the process the same as disassembling a Genesis ROM?
     
  8. TehKaker

    TehKaker

    Member
    12
    0
    1
    I have a simple question: Does anyone of you know where I can get images? Images with full level layouts from Sonic Advance 2/3, without resizing.
     
  9. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,249
    509
    93
    Japan
    I actually have a question in response to the above question, how "does" one create an image of a 3D layout? Do you have something like three perspectives in one image to depict the three dimensions?

    Edit: woops, I read that as adventures, not advance, but my question will remain as I am curious to know.
     
  10. pablodrago

    pablodrago

    Member
    34
    0
    0
    BS AS
    I hope this help:
    http://www.soniccenter.org/maps/sonic_advance_2
    http://www.soniccenter.org/maps/sonic_advance_3
    (not sure if links to other pages are allowed)
    EDIT: sorry I didn't read the resizing part
     
  11. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    I was going to post them links too, but he said without re-sizing. Zoom in on then pictures and they're all pix-elated.
     
  12. TheInvisibleSun

    TheInvisibleSun

    OVER THE TOP TECHNO-BLAST Member
    1,636
    197
    43
    Buffalo, NY, USA
    The Water
    You would draw it like one would draw a building, or any place in real life; you draw a series of plans (top-down images), sections (cut through images), and elevations of the level layout. If more detail is necessary, one could draw an axonometric projection, or even a perspective drawing. Prima Games did this to great effect for Adventure and Adventure 2 in their strategy guides for both games.
     
  13. Elektro-Omega

    Elektro-Omega

    Mushroom Hill'in Member
    400
    2
    0
    UK
    -
    Random quick question.

    When doing a programming project and including third party libraries, am I right in thinking this created dependencies that requires the user to install the additional packages before they can run your application?

    Also, if the previous statement is true, how do you get rid of dependencies? Is there a neater way of wrapping them or do you need to write it yourself?
     
  14. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    A question that I'm hoping someone has experience this before in Sonic 2:

    [​IMG]

    I have discovered a bug in my hack (and unfortunately, it exists in my back-up as well) that there is a slight chance that as soon as the signpost stops spinning, the game suddenly pauses itself (about 50% chance of it occurring). I can un-pause it by pressing start and the game will carry on like normal. It only seems to happen at this point (in any level). It never happens after a boss, only when the signpost stops spinning, and doesn't always happen.


    I haven't touch the signpost in a long time, nor the "End of level" object, nor Sonic's celebration code either, so I think it's something else causing it. What though, I do not know.



    When I look at the 68k debugger in Regen, it seems to be stuck under the "DelayProgram:" label:

    Code (ASM):
    1. -   tst.b   (Delay_Time).w
    2.     bne.s   -
    But I can un-pause it anytime, so maybe it's getting branched here from "PauseGame:"


    Anyone have any idea?
     
  15. Alriightyman

    Alriightyman

    I am back... from the dead! Tech Member
    357
    11
    18
    Somewhere in hot, death Florida
    0101001101101111011011100110100101100011 00000010: 0101001100000011 01000101011001000110100101110100011010010110111101101110
    My guess is an address in RAM lets say the byte before the pause address is being set as a word and overwriting the pause flag. If that makes sense. Try moving the Game_paused address somewhere else that is not being used.
     
  16. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber

    One of the first things I checked =P

    I moved the paueflag RAM to an empty space where it cannot be touched by anything else ($FFFFF200).w and it still happens. I search throughout the ASM file to see if anything is setting the RAM itself, but no.

    Funnily enough, if I make Tails fly and carry Sonic, when the signpost stops spinning, the game won't pause, but it waits for Sonic to hit the floor to celebrate before moving on. As Soon as Sonic does touch the floor, again, sometimes it pauses. This really made me think that it's the celebration code or the "end of level" code. But both of these codes get used at the end of bosses with Egg prisons and it never pauses then.

    So I thought it was the signpost, but I put the original signpost code back in from Sonic 2 but still happens. This is more of a "have you experience this?" one to be solved =/
     
  17. RetroKoH

    RetroKoH

    Member
    1,728
    107
    43
    S1Fixed: A successor to ReadySonic
    Is there another spot in the RAM that is changing when this occurs? And also does this occur in the build you sent me before, or was this after a more recent edit?
    I didn't notice it but I can certainly check.

    ALSO is it possible that this could somehow be something the emulator is doing? (Even IF that were somehow the case... I guess you'd want to fix it.)
     
  18. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    Aggghhhhhhghghgh!!!!


    It was a huge school-boy error! Too long to explain. Long-story-short, "Ctrl_1_Logical" wasn't being cleared properly, and made the start button active for 1 frame, causing the game to pause. Thanks for posting anyway.




    It doesn't exist in your build.
     
  19. RetroKoH

    RetroKoH

    Member
    1,728
    107
    43
    S1Fixed: A successor to ReadySonic
    Can someone explain to me how exactly the Oscillatory Routines in Sonic 1 work? I've figured out where each value is, and have a rough idea of how they work, based on viewing them in the RAM watcher, and I've also sorted the info together in my asm file and have a grasp of what it does... but how exactly does it work?

    What I've gotten so far, and please correct me if I'm incorrect or mistaken:
    Each oscillatory value is 2 separate words that work together. The first is a value that goes up to a certain value, and then drops back down to a certain value. The closer it is to its destination value, the slower it increments/decrements, the further away, the quicker.
    The second word consistently increments/decrements by $02. When the signed value is negative, the first word is decreasing in value. When the signed value is positive, the first word is increasing in value.


    I have added comments to the table, that include the offset of each oscillating value, and its baselines located in the .bin file.
    <asm>

    @settings: ; frequency, amplitude, ID, .bin Baselines
    dc.w 2, $10 ; +2, 00 80 00 00
    dc.w 2, $18 ; +6, 00 80 00 00
    dc.w 2, $20 ; +$A, 00 80 00 00
    dc.w 2, $30 ; +$E, 00 80 00 00
    dc.w 4, $20 ; +$12, 00 80 00 00
    dc.w 8, 8 ; +$16, 00 80 00 00
    dc.w 8, $40 ; +$1A, 00 80 00 00
    dc.w 4, $40 ; +$1E, 00 80 00 00
    dc.w 2, $50 ; +$22, 00 80 00 00
    dc.w 2, $50 ; +$26, 50 f0 01 1e
    dc.w 2, $20 ; +$2A, 20 80 00 b4
    dc.w 3, $30 ; +$2E, 30 80 01 1e
    dc.w 5, $50 ; +$32, 50 80 01 c2
    dc.w 7, $70 ; +$36, 70 80 02 76
    dc.w 2, $10 ; +$3A, 00 80 00 00
    dc.w 2, $10 ; +$3E, 00 80 00 00
    even
    </asm>


    I ask because I need to emulate this in my engine for some of the objects, and don't know how to properly emulate said routine.
     
  20. Mr Lange

    Mr Lange

    A wise guy eh. I know how to DEAL with wise guys. Member
    1,286
    11
    18
    The Land of Waldos
    Sonic Utopia, Sonic Overture
    Something I've always wondered, despite having played the original games all my life I've never quite been sure of this.
    Is there a limit to how many rings Sonic will drop? For example, the game will never generate more than 50 even if he has more than that.
    Is there a limit to rings generated and if so how much?