don't click here

Basic Questions & Answers thread

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

  1. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    Back again. So I'm following the GitHub portion of this guide to port S2 level art loading to S1 and I'm using KensSharp 1.2 from Clownacy for the decomp/comp. I've decompressed the main 8x8 .bin level art files. That's where I'm at right now. Easy.

    But before I go further, I want to use "Superfast Kos, v2" rather than the original. Can I just swap out the Kosinski Decompression.asm in my _inc folder with the newer version under the same name?

    And on another note, when I compress my .bin files to Kosinski, will they work hand-in-hand with the updated decomp algorithm? And before I get any more annoying, what exactly is Kosinski+ compression in KensSharp (is it actually for the same newer algorithm)? I'm interested in compressing to that if I can.

    I'm too many years too late onto the hacking scene. But I'm really feeling it right now and I'm so close to finishing the project I've been working on little by little for the past month. :v:
     
  2. Clownacy

    Clownacy

    Tech Member
    1,060
    607
    93
    I think the credit for KENSSharp more belongs to FraGag and flamewing than me.

    You should be able to swap out the decompressor without any problems. Just make sure you're using the one suited for your assembler (asm68k and AS require their own versions).

    I think the decompressor you linked to might be out of date. The latest version is kept on GitHub these days.

    Kosinski files should work with any Kosinski decompressor. Otherwise they wouldn't be Kosinski decompressors in the first place.

    Kosinski+ is an enhanced (but binary-incompatible) version of Kosinski. Kosinski's format is pretty unoptimised for the 68k. If anything, I think it was made for the x86. Kosinski+ tweaks Kosinski's format to get the maximum decompression speed possible without sacrificing compression size, but that means Kosinski+ files won't work with regular Kosinski decompressors.

    Though I should point out, Kosinski+ is a little fragmented right now. Not too long ago, the format was changed again. So technically there are two different version of Kosinski+ now, which aren't compatible with each other. The latest version of the decompressor on GitHub is for the second version, but KENSSharp only supports the first version. This link should take you to the last version of the decompressor to support the original Kosinski+. Eventually, if the format doesn't change again, KENSSharp will be updated to support version 2.
     
  3. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    Thanks for the lengthy explanation. In that case I'll stick with the KosDec from GitHub since it's the updated version by vladikcomper & friends like I wanted. It should work just fine with the latest S1 GitHub disasm and it's a vast improvement over Nemesis anyway. Thanks for the help.
     
  4. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    I have a problem that I do not know how to solve, I added the green hill zone in Sonic 2, I also added the collision of Sonic 1, everything works well except the loops, does anyone know what I can do for the loops to work
     
  5. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    Did you import the level with proper dual-layer collision for the loops? Did you add the pathswapper objects? Copy them from another level if you don't know how to set them up.
     
  6. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    Yes, but it doesn't work.
     
  7. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    So yeah... I followed the GitHub portion of the guide to a 'T' from start to finish and have a few snags for some reason not mentioned in the guide.


    First off:

    Does "comment out" mean to delete, erase and/or remove?

    ; ---------------------------------------------------------------------------
    ; Pattern load cues - Green Hill
    ; ---------------------------------------------------------------------------
    PLC_GHZ: dc.w ((PLC_GHZ2-PLC_GHZ-2)/6)-1
    plcm Nem_GHZ_1st, 0 ; GHZ main patterns <---------- REMOVE THESE LINES?
    plcm Nem_GHZ_2nd, $39A0 ; GHZ secondary patterns <---- REMOVE THESE LINES?
    plcm Nem_Stalk, $6B00 ; flower stalk
    plcm Nem_PplRock, $7A00 ; purple rock
    plcm Nem_Crabmeat, $8000 ; crabmeat enemy
    plcm Nem_Buzz, $8880 ; buzz bomber enemy

    Because I removed them for all instances as stated above.

    And then:

    That line gives me this build error: SONIC.ASM(5136) : Error : Symbol 'queuedmatransfer' not defined

    However, if I remove that line I get 0 errors, BUT instead get a build with garbled level art in every level. So what's with this QueueDMATransfer? How do I define it and why am I get garbled art? What do I really need to do in Pattern Load Cues? I followed everything as stated from start to finish. This is not rocket science so what am I missing?
     
  8. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,245
    1,415
    93
    your mom
    You'll need to implement the DMA queue that Sonic 2/3K uses to implement what you want. There's actually a guide for it in the spindash in Sonic 1 tutorial (part 3), though I think that's targeted for Hivebrain. Shouldn't be too difficult to apply to the GitHub disassembly.
     
  9. Clownacy

    Clownacy

    Tech Member
    1,060
    607
    93
    Ugh. In another example of Shadow05 butchering one of my guides, he helpfully decided to remove this little tidbit from the GitHub section:

     
  10. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    Yes but which .asm am I editing and inputting all of that from the QueueDMATransfer guide?

    I can't find those labels in any file because that's probably what they're call in the Hivebrain disasm. I can't pinpoint where I'm supposed to cut/paste any of it.
     
  11. Clownacy

    Clownacy

    Tech Member
    1,060
    607
    93
  12. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    I'm gonna pull my hair out. Which file do I edit? Some of these guides fail to include a simple statement of "Open ____.asm and after routine ____, paste this:"

    It shouldn't be expected that everyone already knows where in the 50K lines of code that "loc_D50" is located.

    That earlier addition of the DMA_68KtoVRAM in part 2 of the Spin Dash guide is completely obsolete since the part 3 DMA queue guide has you paste over the entire routine you just added in part 2. The only thing I need to know is which file am I editing this into that has the label ShowVDPGraphics (to paste the DMA queue after it) and loc_D50 (to add 2 lines of code as mentioned in guide part 2 to call upon Process_DMA)?

    I'm just doing all of this to load my level art with Kosinski.
     
  13. SonicoOurico

    SonicoOurico

    Member
    19
    0
    0
    I know I've asked this question before, but it's just that I do not know what to do anymore, Tails does not carry Sonic.
    Here is the code:
    Code (Text):
    1.  Tails_Carry_Sonic:
    2.  tst.b  (a2)
    3.  beq.w  loc_14534
    4.  cmpi.b #4,routine(a1)
    5.  bcc.w  loc_14466
    6.  btst   #1,Status(a1)
    7.  beq.w  loc_1445A
    8.  move.w ($FFFFF300).w,d1
    9.  cmp.w  x_vel(a1),d1
    10.  bne.s  loc_1445A
    11.  move.w ($FFFFF400).w,d1
    12.  cmp.w  y_vel(a1),d1
    13.  bne.s  loc_14460
    14.  tst.b  obj_control(a1)
    15.  bmi.s  loc_1446A
    16.  andi.b #$70,d0
    17.  beq.w  loc_14474
    18.  clr.b  obj_control(a1)
    19.  clr.b  (a2)
    20.  move.b #$12,1(a2)
    21.  andi.w #$F00,d0
    22.  beq.w  loc_14410
    23.  move.b #$3C,1(a2)
    24.  
    25. loc_14410: ; CODE XREF: Tails_Carry_Sonic+4Cj
    26.  btst   #$A,d0
    27.  beq.s  loc_1441C
    28.  move.w #-$200,x_vel(a1)
    29.  
    30. loc_1441C: ; CODE XREF: Tails_Carry_Sonic+5Aj
    31.  btst   #$B,d0
    32.  beq.s  loc_14428
    33.  move.w #$200,x_vel(a1)
    34.  
    35. loc_14428: ; CODE XREF: Tails_Carry_Sonic+66j
    36.  move.w #-$380,y_vel(a1)
    37.  bset   #1,Status(a1)
    38.  move.b #1,jumping(a1)
    39.  move.b #$E,y_radius(a1)
    40.  move.b #7,x_radius(a1)
    41.  move.b #2,anim(a1)
    42.  bset   #2,Status(a1)
    43.  bclr   #4,Status(a1)
    44.  rts   
    45. ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    46.  
    47. loc_1445A: ; CODE XREF: Tails_Carry_Sonic+16j
    48. ; Tails_Carry_Sonic+22j
    49.  move.w #-$100,y_vel(a1)
    50.  
    51. loc_14460: ; CODE XREF: Tails_Carry_Sonic+2Cj
    52.  move.b #0,jumping(a1)
    53.  
    54. loc_14466: ; CODE XREF: Tails_Carry_Sonic+Cj
    55.  clr.b  obj_control(a1)
    56.  
    57. loc_1446A: ; CODE XREF: Tails_Carry_Sonic+32j
    58.  clr.b  (a2)
    59.  move.b #$3C,1(a2)
    60.  rts   
    61. ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    62.  
    63. loc_14474: ; CODE XREF: Tails_Carry_Sonic+38j
    64.  move.w x_pos(a0),x_pos(a1)
    65.  move.w y_pos(a0),y_pos(a1)
    66.  addi.w #$1C,y_pos(a1)
    67.  
    68. loc_14492: ; CODE XREF: Tails_Carry_Sonic+D0j
    69.  andi.b #-4,render_flags(a1)
    70.  andi.b #-2,Status(a1)
    71.  move.b Status(a0),d0
    72.  andi.b #1,d0
    73.  or.b   d0,render_flags(a1)
    74.  or.b   d0,Status(a1)
    75.  
    76. loc_144BA: ; CODE XREF: Tails_Carry_Sonic+F8j
    77.  subq.b #1,anim_frame_duration(a1)
    78.  bpl.s  loc_144F8
    79.  move.b #$B,anim_frame_duration(a1)
    80.  moveq  #0,d1
    81.  move.b anim_frame(a1),d1
    82.  addq.b #1,anim_frame(a1)
    83.  move.b byte_14522(pc,d1.w),d0
    84.  cmpi.b #-1,d0
    85.  bne.s  loc_144E4
    86.  move.b #0,anim_frame(a1)
    87.  move.b byte_14522(pc),d0
    88.  
    89. loc_144E4: ; CODE XREF: Tails_Carry_Sonic+11Ej
    90.  move.b d0,mapping_frame(a1)
    91.  moveq  #0,d0
    92.  move.b mapping_frame(a1),d0
    93.  move.l a2,-(sp)
    94.  jsr    Tails_Carry_LoadPLC
    95.  movea.l    (sp)+,a2
    96.  
    97. loc_144F8: ; CODE XREF: Tails_Carry_Sonic+104j
    98.  move.w x_vel(a0),($FFFFB018).w
    99.  move.w x_vel(a0),($FFFFF300).w
    100.  move.w y_vel(a0),($FFFFB01A).w
    101.  move.w y_vel(a0),($FFFFF400).w
    102.  movem.l    d0-a6,-(sp)
    103.  lea    (Maincharacter).w,a0
    104.  bsr.w  Sonic_DoLevelCollision
    105.  movem.l    (sp)+,d0-a6
    106.  rts   
    107. ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    108. byte_14522: dc.b $91 ; DATA XREF: Tails_Carry_Sonic+126t
    109.  dc.b $91
    110.  dc.b $90
    111.  dc.b $90
    112.  dc.b $90
    113.  dc.b $90
    114.  dc.b $90
    115.  dc.b $90
    116.  dc.b $92
    117.  dc.b $92
    118.  dc.b $92
    119.  dc.b $92
    120.  dc.b $92
    121.  dc.b $92
    122.  dc.b $91
    123.  dc.b $91
    124.  dc.b $FF
    125.  dc.b 0
    126. ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    127.  
    128. loc_14534: ; CODE XREF: Tails_Carry_Sonic+2j
    129.  tst.b  1(a2)
    130.  beq.s  loc_14542
    131.  subq.b #1,1(a2)
    132.  bne.w  locret_1459C
    133.  
    134. loc_14542: ; CODE XREF: Tails_Carry_Sonic+17Ej
    135.  move.w x_pos(a1),d0
    136.  sub.w  x_pos(a0),d0
    137.  addi.w #$10,d0
    138.  cmpi.w #$20,d0
    139.  bcc.w  locret_1459C
    140.  move.w y_pos(a1),d1
    141.  sub.w  y_pos(a0),d1
    142.  subi.w #$20,d1
    143.  
    144. loc_1456C: ; CODE XREF: Tails_Carry_Sonic+1ACj
    145.  cmpi.w #$10,d1
    146.  bcc.w  locret_1459C
    147.  tst.b  obj_control(a1)
    148.  bne.s  locret_1459C
    149.  cmpi.b #4,routine(a1)
    150.  bcc.s  locret_1459C
    151.  tst.w  (Debug_placement_mode).w
    152.  bne.s  locret_1459C
    153.  tst.b  Spindash_flag(a1)
    154.  bne.s  locret_1459C
    155.  bsr.s  sub_1459E
    156.  moveq  #$4A,d0
    157.  jsr    (Play_Sound_2).l
    158.  move.b #1,(a2)
    159.  
    160. locret_1459C: ; CODE XREF: Tails_Carry_Sonic+184j
    161. ; Tails_Carry_Sonic+198j ...
    162.  rts   
    163. ; End of function Tails_Carry_Sonic
    164.  
    165.  
    166. ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B  R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
    167.  
    168.  
    169. sub_1459E: ; CODE XREF: ROM:00013FEAp
    170. ; ROM:000140F6p ...
    171.  clr.w  x_vel(a1)
    172.  clr.w  y_vel(a1)
    173.  clr.w  inertia(a1)
    174.  clr.w  anim(a1)
    175.  move.w x_pos(a0),x_pos(a1)
    176.  move.w y_pos(a0),y_pos(a1)
    177.  addi.w #$1C,y_pos(a1)
    178.  move.w #$2200,anim(a1)
    179.  move.b #0,anim_frame_duration(a1)
    180.  move.b #0,anim_frame(a1)
    181.  move.b #3,obj_control(a1)
    182.  bset   #1,Status(a1)
    183.  bclr   #4,Status(a1)
    184.  move.b #0,spindash_flag(a1)
    185.  andi.b #-4,render_flags(a1)
    186.  andi.b #-2,Status(a1)
    187.  move.b Status(a0),d0
    188.  andi.b #1,d0
    189.  or.b   d0,render_flags(a1)
    190.  or.b   d0,Status(a1)
    191.  move.w x_vel(a0),($FFFFF300).w
    192.  move.w x_vel(a0),x_vel(a1)
    193.  move.w y_vel(a0),($FFFFF400).w
    194.  move.w y_vel(a0),y_vel(a1)
    195.  eori.b #2,render_flags(a1)
    196.  
    197. locret_14630: ; CODE XREF: sub_1459E+84j
    198.  rts   
    199. ; End of function sub_1459E
     
  14. Wafer

    Wafer

    Find me on Twitter instead Member
    255
    75
    28
    Is there an extra step involved in loading the title screen menu art for Sonic 2 into SonMapEd beyond loading the mappings and art? I can see the tiles, and the mappings seem to be the right shape, but the frames just look like speckled garbage. What am I missing?

    Any help is appreciated.

    EDIT: Nevermind, I had a poke at the mapping file in hex and I get it now. It references more than one art file so I guess it would need a VRAM dump to view in SonMapEd.
     
  15. Fred

    Fred

    Taking a break Oldbie
    1,563
    117
    43
    Portugal
    Sonic 3 Unlocked
    No, only that you have a basic grasp of your text editor and how to locate a particular string within a file or group of files.

    The refactor you're attempting to do is not a particularly easy task. If you're willing to try something of that magnitude, then you are most definitely expected to stumble a few times and teach yourself along the way -- the sort of guide you describe often teaches nothing and leads to the sea of Megamix clones we had a decade ago. The wiki already too often leans towards that kind of tutorial.
     
  16. Knucklez

    Knucklez

    I love 2B 'n' ass. Member
    687
    21
    18
    I get your point Neo and you're right. I've been stumbling here and there since my hacking experience = several weeks. I understand the editor I'm using though. I've managed to get the Kosinski to work and see the difference in loading times but I'm getting GHZ with moderate amount of garbled art and the rest of the levels entirely garbled to death.

    I don't know what's up. It's only frustrating because I'm following a guide with the mentality/expectation that it's as simple and straightforward as it is being presented. I'll figure it out unless anyone else can offer suggestions. I guess I can't complain when countless others have had to figure this all out from scratch so... thanks everybody.
     
  17. WhoWhatWhenWhale

    WhoWhatWhenWhale

    Member
    5
    0
    1
    Hello! I'm making a Sonic 1 romhack and I have a question about how the game handles collision.
    I've been trying to find out how the game detects when Sonic hits a wall when airborne, but I can't seem to find out how (or more importantly, where) it does it. I think it has something to do with the findwall routine, but that seems to only be triggered in Sonic_Floor.asm. It would also help if someone could explain how the game detects the angle of a surface. The reason I'm trying to find out how these work is because I'm attempting to
    allow Sonic to run on any surface, kind of like in that cool fan-game Eggman Hates Furries.

    Thanks in advance! I hope I'm not asking for too much!
     
  18. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,245
    1,415
    93
    your mom
    When airborne, it handles collision in Sonic_Floor (great label name, I know). In that routine, it checks the direction Sonic is moving at and handles collision accordingly. (Moving down checks wall and floor collision, moving up checks wall and ceiling collision, and moving left and right checks for ceiling and floor, and collision for whichever wall Sonic is going towards).

    Sonic_HitWall is the routine that checks for wall collision on Sonic's left side. sub_14EB4 is the same thing but for the right side. Sonic_HitFloor checks for floor collision and Sonic_DontRunOnWalls checks for ceiling collision.

    As for angle detection, each 16x16 block has an assigned "collision block" (as I like to call them), with each collision block having a hardcoded angle value, meaning that it's not calculated in game.
     
  19. rata

    rata

    Member
    690
    73
    28
    Argentina
    Trying to be useful somehow.
    correct me if I'm wrong, but I think I've translated spindash how-to to github disamb.
     
  20. NyaNyaLily

    NyaNyaLily

    Member
    88
    29
    18
    I've been busy trying to change the level title card, but I've ran into an issue, which I don't know how to fix.

    Here are the title card's mappings I created:
    [68k]M_Card_Oval: dc.b $27 ; Oval
    dc.b 0, 0, 0, $68, 0
    dc.b 8, 0, 0, $68, 0
    dc.b $0A, 0, 0, $68, 0
    dc.b $10, 0, 0, $68, 0
    dc.b $18, 0, 0, $68, 0
    dc.b $1A, 0, 0, $68, 0
    dc.b $20, 0, 0, $68, 0
    dc.b $28, 0, 0, $68, 0
    dc.b $2A, 0, 0, $68, 0
    dc.b $30, 0, 0, $68, 0
    dc.b $38, 0, 0, $68, 0
    dc.b $3A, 0, 0, $68, 0
    dc.b $40, 0, 0, $68, 0
    dc.b $48, 0, 0, $68, 0
    dc.b $4A, 0, 0, $68, 0
    dc.b $50, 0, 0, $68, 0
    dc.b $58, 0, 0, $68, 0
    dc.b $5A, 0, 0, $68, 0
    dc.b $60, 0, 0, $68, 0
    dc.b $68, 0, 0, $68, 0
    dc.b $6A, 0, 0, $68, 0
    dc.b $70, 0, 0, $68, 0
    dc.b $78, 0, 0, $68, 0
    dc.b $7A, 0, 0, $68, 0
    dc.b $80, 0, 0, $68, 0
    dc.b $88, 0, 0, $68, 0
    dc.b $8A, 0, 0, $68, 0
    dc.b 0, 1, 0, $66, $08
    dc.b $10, 1, 0, $66, $08
    dc.b $20, 1, 0, $66, $08
    dc.b $30, 1, 0, $66, $08
    dc.b $40, 1, 0, $66, $08
    dc.b $50, 1, 0, $66, $08
    dc.b $60, 1, 0, $66, $08
    dc.b $70, 1, 0, $66, $08
    dc.b $80, 1, 0, $66, $08
    dc.b $90, 1, 0, $66, $08
    dc.b $A0, 1, 0, $66, $08
    dc.b $B0, 1, 0, $66, $08[/68k]
    (I know it's quite big, but I only had 3 tiles of VRAM left, so I had to constantly repeat the same tiles over and over again whilst slightly changing the tile's position every time :specialed:/>/>).

    Now, the issue is that not all of these tiles show up in-game.

    [​IMG]

    As seen, the mappings cut off at a certain distance.
    I don't exactly understand what's happening here, am I running into a sprite-size limit?

    Edit: put the (quite large) image in a spoiler tag.