Language…
27 users online: 1UPdudes,  Anorakun, Araylea, ASMagician Maks, Blizzard Buffalo, Boosius, Buflen, CosmicTiff, Emera1ds, FLIO, HamOfJustice, JakesBRjust,  KungFuFurby, lordkronos100, MegacesarCG, MegaSonic1999, Metro Shroomin, MiracleWater, moldormyaboy30000, ocked, ProjectPoison_, ShoopDaWhoop, signature_steve, StrykeTH, thatwaterblockrk, TheMorganah, Wry Bones - Guests: 101 - Bots: 142
Users: 66,311 (2,254 active)
Latest user: Senhor Cx

someone help me on a patch

Good morning everybody! I'm currently working on a project called "Sonic CD SNES Edition", and I came across a patch created by Burning Loaf that implements the time travel mechanic present in Sonic CD. The patch itself is nearly perfect however there is a bug that is giving me trouble. When I teleport myself falling to go to the future or the past, the character (in this case, Sonic) ends up dying. I've tried to solve this problem myself, but my familiarity with ASM is limited, and I don't know anyone who can help me. I have already contacted the creator of the patch, however, his project has been discontinued. Given this scenario, my only remaining option is to ask you guys for help. I'm about to complete my hack, and anyone who can help me fix the bug I'll credit the person.
Where can we find the patch? It doesn't seem to be listed among Burning Loaf's submissions on SMWCentral.

Also, what do you mean by "When I teleport myself falling to go to the future or the past"? I'm not familiar with Sonic, so a little explanation on the mechanic might help me understand the problem a little better.
ROM Hack Manager - SMW Resources - SMW Toolbox
Originally posted by zuccha
Where can we find the patch? It doesn't seem to be listed among Burning Loaf's submissions on SMWCentral.

Also, what do you mean by "When I teleport myself falling to go to the future or the past"? I'm not familiar with Sonic, so a little explanation on the mechanic might help me understand the problem a little better.


regarding the patch it has been discontinued but its link is here https://www.smwcentral.net/?p=viewthread&t=120459 good mechanics of sonic cd is about picking up a sign to go to the past or to the future and run up to a certain speed and then you are teleported whatever, I can record the problem and send it to you
The first thing that comes to mind is this. In CD.asm there is this table

Code
levelList:
;	| present | past | bad F | good F |
dw	   $0105,  $0025,  $0026,  $0027
dw	   $0106,  $0028,  $0029,  $002A
dw	   $01CB,  $002B,  $002C,  $002D

The table defines from which levels you can travel to past and future. If you are trying to travel from a level other than $0105, $0106, or $01CB the game is going to crash. So, if you want to travel from another level, you'll have to add it to the list, with all its past and futures. For example, let's say we want to have level $0001 as the present, and $0030, $0031, and $0032 as its past and futures respectively, you would have to modify the table as follows

Code
levelList:
;	| present | past | bad F | good F |
dw	   $0105,  $0025,  $0026,  $0027
dw	   $0106,  $0028,  $0029,  $002A
dw	   $01CB,  $002B,  $002C,  $002D
dw	   $0001,  $0030,  $0031,  $0032	; <- Add this line

Another possible culprit for the crash is free RAM. The patch uses the following RAM addresses: $60-$63, $0F3A-$0F3B, $0F3E-$0F41, $1487-$1488, $5C, $1473, and $1415-$1416. If any other patch you applied uses the same addresses, the two might conflict and invalidate each other (e.g., this patch might override what the other one has written in $1473, and when it tries to read the value it finds something it doesn't expect and crashes). To fix this problem, you'll need to check all patches you applied and see if they define some free RAM that's the same as the one used by the time travel patch: if they do, you'll have to look for an empty RAM address that is not being used by any other patch and is big enough (bytes) and replace the conflicting one.
ROM Hack Manager - SMW Resources - SMW Toolbox
Originally posted by zuccha
The first thing that comes to mind is this. In CD.asm there is this table

Code
levelList:
;	| present | past | bad F | good F |
dw	   $0105,  $0025,  $0026,  $0027
dw	   $0106,  $0028,  $0029,  $002A
dw	   $01CB,  $002B,  $002C,  $002D

well the problem itself is not that because i did everything that is asked the real problem is that when i teleport falling mario dies when the time travel ends wait a bit I'll send a video
The table defines from which levels you can travel to past and future. If you are trying to travel from a level other than $0105, $0106, or $01CB the game is going to crash. So, if you want to travel from another level, you'll have to add it to the list, with all its past and futures. For example, let's say we want to have level $0001 as the present, and $0030, $0031, and $0032 as its past and futures respectively, you would have to modify the table as follows

Code
levelList:
;	| present | past | bad F | good F |
dw	   $0105,  $0025,  $0026,  $0027
dw	   $0106,  $0028,  $0029,  $002A
dw	   $01CB,  $002B,  $002C,  $002D
dw	   $0001,  $0030,  $0031,  $0032	; <- Add this line

Another possible culprit for the crash is free RAM. The patch uses the following RAM addresses: $60-$63, $0F3A-$0F3B, $0F3E-$0F41, $1487-$1488, $5C, $1473, and $1415-$1416. If any other patch you applied uses the same addresses, the two might conflict and invalidate each other (e.g., this patch might override what the other one has written in $1473, and when it tries to read the value it finds something it doesn't expect and crashes). To fix this problem, you'll need to check all patches you applied and see if they define some free RAM that's the same as the one used by the time travel patch: if they do, you'll have to look for an empty RAM address that is not being used by any other patch and is big enough (bytes) and replace the conflicting one https://drive.google.com/file/d/1NSVBfPI57pbQfvUiSogYuCiMr22lM-vf/view?usp=sharing
.
From the video it looks like you are being teleported inside solid blocks, causing Sonic to die. When you time travel, the patch saves Sonic's current position; when it loads the past/future version of the level, it moves the player at the same coordinates, if there is something solid there, you will die. Do your time shifted levels have the same exact structure (i.e., the same placements of solid blocks)?
ROM Hack Manager - SMW Resources - SMW Toolbox
Originally posted by zuccha
From the video it looks like you are being teleported inside solid blocks, causing Sonic to die. When you time travel, the patch saves Sonic's current position; when it loads the past/future version of the level, it moves the player at the same coordinates, if there is something solid there, you will die. Do your time shifted levels have the same exact structure (i.e., the same placements of solid blocks)?
So yes, is there a way to turn off this save mechanic?
You can try to remove BNE + at line 546. Now after the time travel Sonic should land on the level entrance, not on the position where he was in the "present" level.
ROM Hack Manager - SMW Resources - SMW Toolbox
Originally posted by zuccha
You can try to remove BNE + at line 546. Now after the time travel Sonic should land on the level entrance, not on the position where he was in the "present" level.
I tested it here and now it stopped saving only the x-axis and not the y-axis speed
Originally posted by zuccha
I don't understand, what do you mean by that?
The game stopped saving the x position which is from right to left but it still saves the y position which is from top to bottom and consequently the problem persists
Ok, maybe I get it. After you teleport Sonic still has speed (and other things).

In addition to what I already pointed out, you'll also have to change the following lines

  • 579: From LDA !timeWarpRam to LDA #$00 (reset X position's high byte)
  • 593: From LDA !timeWarpRam to LDA #$00 (reset X speed)
  • 606: From LDA !timeWarpRam to LDA #$00 (reset Y speed)
  • 616: From LDA !timeWarpRam to LDA #$00 (use level entrance animation)
  • 625: From LDA !timeWarpRam to LDA #$00 (don't change player's direction)
  • 642: From LDX !timeWarpRam to LDX #$00 (reset p-speed, part 1)
  • 653: From LDX !timeWarpRam to LDX #$00 (reset p-speed, part 2)
  • 663: From LDA !timeWarpRam to LDA #$00 (reset screen Y position)
  • 683: From LDA !timeWarpRam to LDA #$00 (update screen positions)

After this you should teleport to the level entrance as if you entered it normally (hopefully there is nothing more to change and this works).

Anyway, in my opinion this sort of defeats the purpose of the patch, and it might just be easier to create an UberASM that teleports you to another level if you reach p-speed (which would be much easier and it shouldn't require any hijack).
ROM Hack Manager - SMW Resources - SMW Toolbox
Originally posted by zuccha
Ok, maybe I get it. After you teleport Sonic still has speed (and other things).

In addition to what I already pointed out, you'll also have to change the following lines

    Hmmm you're right I'll test it and if it doesn't work I'll try to do what you told me thank you very much for your attention
  • 579: From LDA !timeWarpRam to LDA #$00 (reset X position's high byte)
  • 593: From LDA !timeWarpRam to LDA #$00 (reset X speed)
  • 606: From LDA !timeWarpRam to LDA #$00 (reset Y speed)
  • 616: From LDA !timeWarpRam to LDA #$00 (use level entrance animation)
  • 625: From LDA !timeWarpRam to LDA #$00 (don't change player's direction)
  • 642: From LDX !timeWarpRam to LDX #$00 (reset p-speed, part 1)
  • 653: From LDX !timeWarpRam to LDX #$00 (reset p-speed, part 2)
  • 663: From LDA !timeWarpRam to LDA #$00 (reset screen Y position)
  • 683: From LDA !timeWarpRam to LDA #$00 (update screen positions)

After this you should teleport to the level entrance as if you entered it normally (hopefully there is nothing more to change and this works).

Anyway, in my opinion this sort of defeats the purpose of the patch, and it might just be easier to create an UberASM that teleports you to another level if you reach p-speed (which would be much easier and it shouldn't require any hijack).
Originally posted by zuccha
Did it work or not?

Yes it worked, thank you very much, by the way, what name can I use to credit you?
Good to know that it works! You can use zuccha, but you can also not credit me, it's fine :)
ROM Hack Manager - SMW Resources - SMW Toolbox