Basic Questions & Answers thread

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

  1. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,525
    133
    43
    SonLVL
    No. You can in fact put code and data anywhere you want to, although it's optimal to place related routines near each other because short and word sized branches take less ROM space and execution time than jumps.
    Yes, you should overwrite the file that already exists. As I said before, you can place data anywhere you want, but it would be good to place the new files near the one that already exists, which should look like this:
    Code (Text):
    1. Obj09_MapRUnc_345FA:    BINCLUDE "mappings/spriteDPLC/obj09.bin"
    You'll want to rename this label to 'Obj09_MapRUnc' as the guide says, and then put the other two files right under it.
    Tile data is located in the "art" folder, with different subfolders for different compression types. For object sprites, you will also need to work with the sprite mappings (found in mappings/sprite) and possibly DPLCs (found in mappings/spriteDPLC). Flex 2 is a great tool for editing sprites.
     
  2. E-122-Psi

    E-122-Psi

    Member
    2,092
    233
    43
    Okay, I've done that, but the child object still won't delete when the badnik is destroyed.

    I even tried adding a check in the child object's routine to delete if the parent object isn't onscreen, but it still stays where it is.

    EDIT: Never mind. Fixed. Thank you RandomName.
     
    Last edited: Feb 21, 2021
  3. Cioss

    Cioss

    Member
    7
    1
    3
    France
    Ok so basically I'm trying to move the Green Hill zone boss to LZ2, My rom builds. However when I go to the area the Bossfight is supposed to happen it crashes the game, And potentially glitches the level's tiles and clloses the emulator.
    This is one of the errors :
    [​IMG]

    Also here's the code : (Search for DLE_LZ2boss: )
    https://cdn.discordapp.com/attachments/686131371215028237/814822467293151272/DynamicLevelEvents.asm


    Also something else, How do I fix sonic's speed coming back to normal when I jump out of the water? I changed Sonic's speed, but when he touches the water once, his speed goes back to the undetied one
     
    Last edited: Feb 26, 2021
  4. Rlan

    Rlan

    Oldbie
    209
    34
    28
    I’m keen on messing around with Game Gear sprite hacking, specifically Coca Cola Kid as it’s somewhat based on the engines for some Sonic games. I’ve looked around a bit but bit confused by which programs i can use to edit sprites and palettes for a GG game. Any suggestions here?
     
  5. Cioss

    Cioss

    Member
    7
    1
    3
    France
    https://segaretro.org/Retro_Graphics_Toolkit This what you lookin' for ?
     
  6. MarkeyJester

    MarkeyJester

    Vague Memories Resident Jester
    2,059
    158
    43
    Japan
    When you reach the coordinates, that routine to load the boss and set PLC art to load; it's being ran over and over, every frame rather than once only. The PLC is being requested over and over, and it's filling up the queue beyond its capacity, and overflowing into other work RAM areas.

    The reason why GHZ act 3 does not crash, is because the third act has a second jump table (a sub-table if you will) specifically for handling the events procedurally. In the boss code you can see it adds 2 to "v_dle_routine". This "v_dle_routine" is used to reference each address in GHZ 3's table, it increments in steps of 2, after 2 is added, GHZ 3 runs a different routine, one that does not load the boss again.

    You don't have such a jump table, so that add 2 to "v_dle_routine" does nothing, and the routine is ran again the next frame, and the frame after, etc, etc.

    ---------------------------

    For the water, there is a subroutine the Sonic object calls for setting his speed when in and out of water, the original disassembly called the subroutine "Sonic_Water".
     
  7. Fadaway

    Fadaway

    Member
    179
    28
    28
    How easy would it be for someone with very minimal hacking skills to put the 2013 Hidden Palace Zone (100% complete and working with Taxman's badniks and zone-specific gimmicks) into an original Sonic 2 ROM so that original Mega Drive/Genesis owners (or Mini owners) can play this zone in an original game?

    I have noodled around with palette hacking on Sonic 1 before and changing layouts, but this would be a totally different beast.

    Any recommendations on where to start? Someone has to do this eventually.
     
    Last edited: Mar 1, 2021
  8. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,525
    133
    43
    SonLVL
    You want the boss with that? Importing the level's art and layout should be pretty easy (if there's an API for reading Retro Engine levels I could probably even rig up some kind of converter tool), porting the objects from the prototype is also fairly simple, but bosses are not an easy thing to make in the slightest. Do you have any programming experience?
     
  9. Fadaway

    Fadaway

    Member
    179
    28
    28
    I was great at HTML and CSS back in the day. Not so much with games. Never really tried diving too deep into it yet but I'm a fast learner. Obviously, the boss would be difficult. But that would be the last thing to really get right. I usually don't have the time for game hacking, but for a project like this, I would make some time to figure it out. My hacking experience is limited to avail hacking utilities, and I did a Super Mario World hack once that was labor intensive but never released on the internet. It wasn't just Lunar Magic, but obviously that tool helped a lot.
     
  10. SyntaxTsu

    SyntaxTsu

    Member
    125
    52
    28
    Actually I think there would be a lot of VRAM issues with just a plain port. When I was working on my hack, it took quite a bit of trickery to get the loops and Stegway in at the same time, whilst maintaining other stuff like monitors, spikes, springs and water. I’m not sure how practical this idea is, but you could dedicate an area of RAM to tiles to swap in and out on demand. I used something similar in my own hack, not for level tiles, but for the ability to alternate between the art of RedZ and BBat and the art of Aquis and Octus.

    For a 2013 HPZ port, I’d do swapping of BBat for Jellygnite, and I’d have a section which can alternate between the large downward convex slope, the curved slopes, the water slides and the 27 degree platforms.

    You also might want to consider how to deal with the backing walls. In the 2013 HPZ, they tessalate the green and purple backing walls together, but in the original palette, they’re actually on completely separate palette lines. I dealt with this issue by choosing one colour (purple) to stick with, but it might be possible to use sprites to get the same trick done.
     
    Last edited: Mar 2, 2021
    • Like Like x 1
    • Agree Agree x 1
    • List
  11. Rlan

    Rlan

    Oldbie
    209
    34
    28
    That's more the editing part - I don't think you can actually load up a ROM and export the sprites from it, right? Is there a better solution for that part on a Game Gear?
     
  12. Glitch

    Glitch

    Tech Member
    163
    3
    18
    Player sprite tiles will be uncompressed in ROM so you should be able to find those with something like Tile Layer Pro. AspectEdit can export both the uncompressed & compressed stuff, if you know where to find it:

    upload_2021-3-3_23-2-21.png
    upload_2021-3-3_22-53-19.png
    The easiest way to find compressed tileset addresses is to load the ROM into Emulicious, enable the debugger and put a breakpoint on address $1EE9. This is the start of the tile loading function - called "Load Tiles" in the Sonic 2 disassembly and the code is basically the same. When the breakpoint hits the address of the tileset data will be in the HL register. Adjust that address for whatever bank is loaded into that slot (the memory viewer can help with this) and then use that address as the "Offset" when loading into AspectEdit.

    After successfully loading a tileset you'll get a bunch of black boxes. You'll need to load a palette to render the tiles properly.
     
  13. Cioss

    Cioss

    Member
    7
    1
    3
    France
    I'm having trouble with pattern load cues, for moving GHZ3 boss to LZ, I've pretty much fixed everything, However for some reason, only the chain remains glitched, And I don't know how to fix it, knowing the chain sprite is with the GHZ ball sprite
    [​IMG]E
    This is what the boss pattern load cues look like :
    Code (Text):
    1.  
    2. PLC_Boss:    dc.w ((PLC_Bossend-PLC_Boss-2)/7)-1
    3.         plcm    Nem_Ball, $7540        ; giant    ball
    4.         plcm    Nem_Eggman, $8000    ; Eggman main patterns
    5.         plcm    Nem_Weapons, $8D80    ; Eggman's weapons
    6.         plcm    Nem_Cork, $A000        ; cork block
    7.         plcm    Nem_Bomb, $A300        ; bomb enemy ((gets overwritten)
    8.         plcm    Nem_SlzSpike, $A300    ; spikeball ((SLZ boss)
    9.         plcm    Nem_Exhaust, $A540    ; exhaust flame
    10.     PLC_Bossend:
    11.  
    This is what the LZ pattern load cues look like :
    Code (Text):
    1.  
    2. PLC_LZ:        dc.w ((PLC_LZ2-PLC_LZ-2)/6)-1
    3.         plcm    Nem_LZ,0        ; LZ main patterns
    4.         plcm    Nem_LzBlock1, $3C00    ; block
    5.         plcm    Nem_LzBlock2, $3E00    ; blocks
    6.         plcm    Nem_Splash, $4B20    ; waterfalls and splash
    7.         plcm    Nem_Water, $6000    ; water    surface
    8.         plcm    Nem_LzSpikeBall, $6200    ; spiked ball
    9.         plcm    Nem_FlapDoor, $6500    ; flapping door
    10.         plcm    Nem_Bubbles, $6900    ; bubbles and numbers
    11.         plcm    Nem_LzBlock3, $7780    ; block
    12.         plcm    Nem_LzDoor1, $7880    ; vertical door
    13.         plcm    Nem_Harpoon, $7980    ; harpoon
    14.         plcm    Nem_Basaran, $9700    ; burrobot enemy
    15.  
    16. PLC_LZ2:    dc.w ((PLC_LZ2end-PLC_LZ2-2)/6)-1
    17.         plcm    Nem_LzPole, $7BC0    ; pole that breaks
    18.         plcm    Nem_LzDoor2, $7CC0    ; large    horizontal door
    19.         plcm    Nem_LzWheel, $7EC0    ; wheel
    20.         plcm    Nem_Gargoyle, $5D20    ; gargoyle head
    21.         if Revision=0
    22.         plcm    Nem_LzSonic, $8800    ; Sonic    holding    his breath
    23.         else
    24.         endc
    25.         plcm    Nem_LzPlatfm, $89E0    ; rising platform
    26.         plcm    Nem_Orbinaut, $8CE0    ; orbinaut enemy
    27.         plcm    Nem_Jaws, $90C0        ; jaws enemy
    28.         plcm    Nem_LzSwitch, $A1E0    ; switch
    29.         plcm    Nem_Cork, $A000        ; cork block
    30.         plcm    Nem_Spikes, $A360    ; spikes
    31.         plcm    Nem_HSpring, $A460    ; horizontal spring
    32.         plcm    Nem_VSpring, $A660    ; vertical spring
    33.     PLC_LZ2end:
    34.  
    (Can't figure out how to make the code be assembly language and not normal text lol)

    Something else I realised, Is that if you die at the boss, have you checkpoint be underwater. and come back, The boss's mappings will be all broken.

    also yes that's clifford the big red dog
     
    Last edited: Mar 7, 2021
  14. Robjoe

    Robjoe

    Member
    Peeking at the VDP in a stock S1 ROM reveals that the GHZ boss's chain actually lands at $7000, which is right in the middle of the bubble tiles in LZ. Now, I'm not sure if you've rearranged anything in your own project, but in the original game at least, the chain doesn't actually seem to be connected to the wrecking ball art. I'm not intimately familiar with S1's PLC setups, admittedly, but I'm guessing the chain is actually loaded via one of GHZ's general PLC's, as it's actually used by the swinging platforms as well. The GHZ boss's PLC was made with the assumption that the chain would already be present at $7000.

    I would say you could get your new boss PLC loading the chain at $7000, which would work for the boss's sake, but you seem to have water in your arena there, so it's going to overwrite the bubbles and you'll have the reverse problem. To get around this, find something in VRAM that won't be needed once the boss loads up, and throw the chain tiles there. Assuming you haven't moved anything , I recommend $7600, as that's where the air bubble spawner tiles are, and I doubt you've placed any of those in your arena if it's just a little pool.

    Once you have you have the chain tiles overwriting something unnecessary however, you're going to need to get the boss looking in the right place for them. My best guess is that the boss is specifically coded to load those tiles from $7000, so you'll need to go through its code and find the instruction responsible for that, and update it accordingly.
     
  15. Cioss

    Cioss

    Member
    7
    1
    3
    France
    Thanks for the help, I fixed it simply by reloadinh the tiles for the LZ spiked ball.

    Also update about the boss's mappingq being broken, Apparently it's not just for the underwater checkpoint, So if you die and come back from a checkpoint, The boss tiles will be broken.
     
  16. E-122-Psi

    E-122-Psi

    Member
    2,092
    233
    43
    I'm getting a weird bug in Sonic 2 where Act 1 of a certain level loads the rings of Act 1 AND Act 2. Any idea what might cause that?
     
  17. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,525
    133
    43
    SonLVL
    The ring layout data for act 1 is missing the terminator. You can either add two FF bytes to the end of the file, or put a dc.w $FFFF inbetween the two bincludes.
     
  18. Cioss

    Cioss

    Member
    7
    1
    3
    France
    Does anyone know how to make a background scroll automatically, Kinda like the GHZ clouds.
     
  19. E-122-Psi

    E-122-Psi

    Member
    2,092
    233
    43
    I'm trying to reinstate the breakable walls from Sonic 1 into Sonic 2 (as they are still leftover in the game). I have gotten them working, however, I want them to be breakable while spinning or attacking them in the air as well. In Sonic 1 this was as easy as commenting out the branch for if Sonic was pushing into the object, but S2 seems to have altered the routine in some way as it won't budge in this regard. Any idea what to do here?
     
  20. Pyrochrome

    Pyrochrome

    Member
    3
    0
    1
    Can anyone give me some information about the tile/palette formats the 32x uses? There's virtually no information anywhere on file formats for this thing. How similar are they to the formats the Genesis VDP uses?