Users browsing this thread: 1 Guest(s)
Issue with SwdTech Speed Patch
11-24-2017, 02:45 AM
Hey guys. I'm having an issue trying to get Cyan's SwdTech gauge to work faster. I've tried 2 different patches for this:
- Cyan's Sword Tech Gauge Speed Up which gives a general boost in speed to the gauge plus extra for each tech learned.
- Selectable Blitz/SwdTech Patch which is basically self explanatory. Each SwdTech and Blitz is able to be selected from a menu similar to how Dance works.
I can live with getting either of these to work, but it seems they're only compatible with ROM v1.0. I use 1.1 currently (I heard it's fixed the malevolent Sketch bug?)
So here's where I think the problem lies in the first patch listed. Since it modifies the least amount of bytes:
The patch changes the byte at C1/7D8A: EE827B to jump to C1/FFF2 where it uses 14 bytes of code:
v1.1 only has 8 bytes free in this section of code. So the patch ends up over-writing what is needed for the game:
The idea I had (which was unsuccessful so far) was to have the code jump to a different location with more free space. But wouldn't I need to jump to a different bank for this, requiring a "long address"? I tried using the 3 bytes at C1/7D8A to jump to C1/FFF8, which is where the free space seems to start in 1.1. Then use that space to run a JSL 4-bytes to jump to something like bank C0 or C3. This just caused by game to reset or glitch out when I used SwdTech.
Is what I'm trying possible with this patch? Can I relocate the patch's code to a different bank?
I guess another valid question would be: Is there a sketch fix for 1.0. Last thing I want is my game freezing up on the 3rd Ultros fight or to not be able to use Sketch at all.
Thanks in advanced (perhaps this is why the 24-bit monster HP wouldn't work for the same reason...)
- Cyan's Sword Tech Gauge Speed Up which gives a general boost in speed to the gauge plus extra for each tech learned.
- Selectable Blitz/SwdTech Patch which is basically self explanatory. Each SwdTech and Blitz is able to be selected from a menu similar to how Dance works.
I can live with getting either of these to work, but it seems they're only compatible with ROM v1.0. I use 1.1 currently (I heard it's fixed the malevolent Sketch bug?)
So here's where I think the problem lies in the first patch listed. Since it modifies the least amount of bytes:
The patch changes the byte at C1/7D8A: EE827B to jump to C1/FFF2 where it uses 14 bytes of code:
v1.1 only has 8 bytes free in this section of code. So the patch ends up over-writing what is needed for the game:
The idea I had (which was unsuccessful so far) was to have the code jump to a different location with more free space. But wouldn't I need to jump to a different bank for this, requiring a "long address"? I tried using the 3 bytes at C1/7D8A to jump to C1/FFF8, which is where the free space seems to start in 1.1. Then use that space to run a JSL 4-bytes to jump to something like bank C0 or C3. This just caused by game to reset or glitch out when I used SwdTech.
Is what I'm trying possible with this patch? Can I relocate the patch's code to a different bank?
I guess another valid question would be: Is there a sketch fix for 1.0. Last thing I want is my game freezing up on the 3rd Ultros fight or to not be able to use Sketch at all.
Thanks in advanced (perhaps this is why the 24-bit monster HP wouldn't work for the same reason...)
11-24-2017, 03:54 AM
@assassin has written a Sketch Bug fix for 1.0 that actually SAVES 7 bytes rather than using seven more -- I found it at Master ZED's page, it's there towards the bottom. It's also included in most if not all of the major bugfix compilations.
The idea of using that free space to JSL somewhere else is sound, though, if you do want to keep working on v1.1. (... Although if you want to keep using more patches, I highly recommend using 1.0 instead for greater patch compatibility.) The thing to remember is that when you JSL, you need to RTL -- my first thought as to why the game is crashing on you is that you ended the subroutine with an RTS instead.
When you jump to a subroutine, the game stores the address you... return to? I believe it adds the bytes, so if you JSR at C3/2330, it pushes $2333, not $2330, to the stack. When you JSL, it pushes THREE bytes -- in this case, it would push all of $C32333. Similarly, RTS only pulls two bytes from the stack, while RTL pulls three -- the game doesn't track whether you JSL or JSR, it relies on you to code the return properly. If you JSL from bank C1 into C3, but then RTS at the end of your new code, the game will jump to that address in C3.
So basically what you'd do in your case is JSR to C1/FFF8, JSL to your new code in bank C3, RTL back to C1/FFFC, and RTS back to where you started from.
tl;dr: Use assassin's patch on 1.0 and work from there, but also, yes, you can add new code to a different bank if necessary, just make sure you're returning properly.
The idea of using that free space to JSL somewhere else is sound, though, if you do want to keep working on v1.1. (... Although if you want to keep using more patches, I highly recommend using 1.0 instead for greater patch compatibility.) The thing to remember is that when you JSL, you need to RTL -- my first thought as to why the game is crashing on you is that you ended the subroutine with an RTS instead.
When you jump to a subroutine, the game stores the address you... return to? I believe it adds the bytes, so if you JSR at C3/2330, it pushes $2333, not $2330, to the stack. When you JSL, it pushes THREE bytes -- in this case, it would push all of $C32333. Similarly, RTS only pulls two bytes from the stack, while RTL pulls three -- the game doesn't track whether you JSL or JSR, it relies on you to code the return properly. If you JSL from bank C1 into C3, but then RTS at the end of your new code, the game will jump to that address in C3.
So basically what you'd do in your case is JSR to C1/FFF8, JSL to your new code in bank C3, RTL back to C1/FFFC, and RTS back to where you started from.
tl;dr: Use assassin's patch on 1.0 and work from there, but also, yes, you can add new code to a different bank if necessary, just make sure you're returning properly.
11-24-2017, 04:20 AM
Wow. That worked perfectly!!! Thanks man!
For now I don't have any further patches to add so I'll stick with it in the mean time. Been battling this swdtech thing for weeks.
For now I don't have any further patches to add so I'll stick with it in the mean time. Been battling this swdtech thing for weeks.
to be sure, my Sketch Bug fix is incomplete:
http://mnrogar.slickproductions.org/phpB...f=3&t=1010
(seen via https://www.ff6hacking.com/forums/thread...l#pid35060)
anybody up for beta testing my Bank C1 changes?
the SwordTech Speedup patch is pretty small, so the method you two discussed can easily convert it to work on FF3us 1.1.
Selectable Blitz/SwdTech Patch is considerably more involved, but has the benefit of included source code.
http://mnrogar.slickproductions.org/phpB...f=3&t=1010
(seen via https://www.ff6hacking.com/forums/thread...l#pid35060)
anybody up for beta testing my Bank C1 changes?
the SwordTech Speedup patch is pretty small, so the method you two discussed can easily convert it to work on FF3us 1.1.
Selectable Blitz/SwdTech Patch is considerably more involved, but has the benefit of included source code.
11-24-2017, 01:53 PM
I was able to change SwdTech speed on 1.1 rom by changing 03 to 00 (can be 02 or 01 but 00 is fastest) at offset C1/7D86 (location without header). This solution is rather simple and doesn't use freespace. 00 is about .53sec (32/60fps) per Swdtech and stays the same whatever you've learned 1 or 8 techniques.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)