don't click here

Basic Questions & Answers thread

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

  1. Brainulator


    Regular garden-variety member Member
    Hivebrain made a macro for ASM68K which permits such editing, in a file called "GM_Title.asm". This is how it's implemented (partially edited for clarity):
    Code (Text):
    1. ; ---------------------------------------------------------------------------
    2. ; Level select menu text strings
    3. ; ---------------------------------------------------------------------------
    4. lsline:        macro
    5.         ls_str:    equs \1
    6.         rept strlen(\1)
    7.         ls_chr:    substr ,1,"\ls_str"
    8.         ls_str:    substr 2,,"\ls_str"
    9.         if instr("YZ","\ls_chr")
    10.             dc.b "\ls_chr"-$4A            ; Y and Z gfx are stored before A
    11.         elseif instr(" ","\ls_chr")
    12.             dc.b $FF                ; space = $FF
    13.         else
    14.             dc.b "\ls_chr"-$30
    15.         endc
    16.         endr
    17.         endm
    19. LevSel_Strings:
    20.         lsline "GREEN HILL ZONE  STAGE 1"
    21.         lsline "                 STAGE 2"
    22.         lsline "                 STAGE 3"
    23.         if Revision=0
    24.         lsline "LABYRINTH ZONE   STAGE 1"
    25.         lsline "                 STAGE 2"
    26.         lsline "                 STAGE 3"
    27.         lsline "MARBLE ZONE      STAGE 1"
    28.         lsline "                 STAGE 2"
    29.         lsline "                 STAGE 3"
    30.         lsline "STAR LIGHT ZONE  STAGE 1"
    31.         lsline "                 STAGE 2"
    32.         lsline "                 STAGE 3"
    33.         lsline "SPRING YARD ZONE STAGE 1"
    34.         lsline "                 STAGE 2"
    35.         lsline "                 STAGE 3"
    36.         else
    37.         lsline "MARBLE ZONE      STAGE 1"
    38.         lsline "                 STAGE 2"
    39.         lsline "                 STAGE 3"
    40.         lsline "SPRING YARD ZONE STAGE 1"
    41.         lsline "                 STAGE 2"
    42.         lsline "                 STAGE 3"
    43.         lsline "LABYRINTH ZONE   STAGE 1"
    44.         lsline "                 STAGE 2"
    45.         lsline "                 STAGE 3"
    46.         lsline "STAR LIGHT ZONE  STAGE 1"
    47.         lsline "                 STAGE 2"
    48.         lsline "                 STAGE 3"
    49.         endc
    50.         lsline "SCRAP BRAIN ZONE STAGE 1"
    51.         lsline "                 STAGE 2"
    52.         lsline "                 STAGE 3"
    53.         lsline "FINAL ZONE              "
    54.         lsline "SPECIAL STAGE           "
    55.         lsline "SOUND SELECT            "
    56.         even
    Note that both REV00 and REV01 are included here; if the "Revision" variable doesn't exist, you must stick to one or the other. Also note that error messages in Sonic 1 do not use this system.
  2. XPointZPoint


    That's no good! Member
    After a bit of thinking, I'm using the SONIC TEAM PRESENTS screen as the message. If the SCD is present, STP object is loaded into memory. If not, skip over the STP object.

    The message says "CD BONUS UNLOCKD" (I couldn't fit an E in unlocked)
    Code (Text):
    1. . . .
    2. Title_ClrPallet:
    3.         move.l    d0,(a1)+
    4.         dbf    d1,Title_ClrPallet ; fill pallet with 0    (black)
    6.         moveq    #3,d0        ; load Sonic's pallet
    7.         bsr.w    PalLoad1
    8.         jsr    FindMCDBIOS            ; Find the MCD's BIOS
    9.         bcs.s    Title_Cont            ; If it wasn't found, branch
    10.         move.b    #$8A,($FFFFD080).w ; load "SONIC TEAM PRESENTS"    object
    11.         move.b    #0,($FFFFFFD0).w
    12.         jsr    ObjectsLoad
    13.         jsr    BuildSprites
    14.         bra        Title_Cont
    15.         rts
    17. Title_Cont:
    18.         bsr.w    Pal_FadeTo
    19.         move    #$2700,sr
    20.         move.l    #$40000001,($C00004).l
    21.         lea    (Nem_TitleFg).l,a0 ; load title    screen patterns
    22.         bsr.w    NemDec
    23.         move.l    #$60000001,($C00004).l
    24.         lea    (Nem_TitleSonic).l,a0 ;    load Sonic title screen    patterns
    25. . . .
  3. XPointZPoint


    That's no good! Member
    Final question (I promise I'll stop lol), how can you port the S2 options screen to S1? It'll be a preferences screen. When you press B on the title screen, it goes to the options menu. A starts the game. And for dev purposes, C enters level select. (in a final version, an SRAM menu)
    Last edited: Jul 8, 2022
  4. theoretically you could copy the S2 options screen code, gfx, vars and everything like that, and make adjustments to it so it works in S1?
    S1 doesn't have a companion like S3 where S3 (alone) had the leftover code for the options menu and you could port that code to S1 but i'd think that would be way more trouble than it's worth, probably just use S2's code. (not tested)
  5. After following this guide to fix Sonic 2's speed bugs, one of Super Sonic's sprites has turned into a garbled mess (as seen in the attached screenshot). Since it is one of many code changes/insertions I've made, I understand that I likely need to insert an even macro somewhere, but I have absolutely no clue where to do so.

    Attached Files:

  6. Devon


    I am lost in you Tech Member
    I think you have fallen victim to the Genesis' DMA boundary bug. If I recall correctly, in a DMA, it only actually increments the lower 16 bits of the source address when copying data, and with DMAs from 68000 memory being in units of words, it makes it so that a single transfer has to remain within a $20000 byte size boundary.

    You can either:
    • Move the graphics data to fit within a $20000 byte size region.
    • Split the DMA transfer into 2 if it detects that it crosses a boundary. The S3K disassembly includes code to do that (at the start of
      Add_To_DMA_Queue). You can also install flamewing's Ultra DMA Queue.
  7. Hexinator


    Hex Member
    I'm new to hackin' using flex 2 to edit the graphics of the game, however, i only know sonic's mappings, cues, and offsets, how do i edit other stuff like badniks?, also when i edit a level in SonLVL, i delete all the tiles and replace them, also deleting all the objects, which causes the signpost to bug out
  8. Devon


    I am lost in you Tech Member
    Most object graphics are compressed in Nemesis, so you'll need to set that in Flex 2. They also don't use DPLCs, do you don't need to set them up for those.


    As for the signpost, I assume that you're placing it earlier in the level and it's causing Sonic to zip forward. In that case, you need to go into LevelSizeArray (assuming you are using the GitHub disassembly) and edit the level boundaries to match up with the new signpost location. Each line in the array corresponds to an individual level's boundaries. You'll wanna edit the 3rd value (i.e. $24BF for GHZ1) to change the right level boundary.

    Just for future reference:

    "Proto leftover" and "Camera Y 'bias'" should be left as their default values. A "top" value of $FF00 means that the level vertically wraps around when you go past the top or bottom, and the "bottom" value in that case should always be $800.
    Last edited: Jul 11, 2022
  9. Hexinator


    Hex Member
    Looks like sonic may have painted himself :
    Also, do you know how to change the foreground stuff? (like the sonic the hedgehog text in the title screen)
    Last edited: Jul 11, 2022
  10. Installing the Ultra DMA Queue with Use128kbSafeDMA appears to have worked around the problem. Thank you! :>
  11. MainMemory


    Kate the Wolf Tech Member
    You can use SonPLN, which you can get from the SonLVL Updater, or here. An INI file is included with the GitHub disassembly.
  12. Hexinator


    Hex Member
    Is there an ini for the hivebrain disassembly?
  13. MainMemory


    Kate the Wolf Tech Member
    Someone has probably made one, but I don't have it.
  14. Hexinator


    Hex Member
    What about changing the life icon? (also the name) need to change them to tails
  15. Does SonLVL offer a means to change the priority of a single block within a given level chunk? I cannot find a means to change priority for anything other than individual tiles, and then only for EVERY single instance of said tile.
  16. MarkeyJester


    Time to Grow Up. Resident Jester
    It is not possible to specify the priority of a block on a chunk, the chunk data has no bits specified for priority of the blocks it maps. Only the blocks have priority bits for the tiles.

    No level editor can offer the function as it is a limitation of the engine's level data format itself, not the level editor.

    As an alternate solution; you could duplicate the block, and set one block's tiles to high priority and the other to low. It'll cost you a block, but it's your only reasonable way of controlling priority at that level via the chunks, without resorting to an engine format modification.
  17. I attempted this, but it resulted in the entire level loading garbage tiles. Also thought about deleting or repurposing an unused block, but its EHZ/HTZ I'm working with, and I'm not sure if there are any blocks that are unused in both.

    And solved my own problem. Identified a tile unused in all four zones and repurposed it for what I needed. :>
    Last edited by a moderator: Jul 14, 2022
  18. where is/what is the name of the DMA68kToVRAM label in 2005 Hivebrain disassembly of s1?
  19. Devon


    I am lost in you Tech Member
    Sonic 1 does not have a DMA queue. You have to port it yourself. Part 3 of the spindash guide has a section for doing just that properly (part 2 also does it, but it's done in a very fucky way that I cannot recommend).
  20. Nik Pi

    Nik Pi

    How I can insert new sprites in S3K? When I try to build it- DPLC shows to me a lot of errors (something like 'too much frames')