Aslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&topic=1831.15e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index74d3.htmlslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&board=21.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index74d3.html.zxxg^U.5OKtext/htmlISO-8859-1gzip8:.5Tue, 10 Mar 2020 20:27:59 GMT0 0Pxg^,.5 FF3us - 255 hours on timer

Author Topic: FF3us - 255 hours on timer  (Read 8642 times)

Imzogelmo

  • Ogopogo Aficianado
  • *
  • Posts: 241
  • Gender: Male
  • Ask me about my other job.
    • View Profile
    • NEPROMR
Re: FF3us - 255 hours on timer
« Reply #15 on: August 02, 2013, 04:13:26 PM »
Awesome work on the 255 hour timer. That's something I was hoping to do at some point, but never really got around to. I was even thinking of co-opting a byte somewhere to make a days counter, but for the reasons elaborated about finding another byte, I never did that either.

Also kudos to assassin on the bug fix!  :omghax:
5/31/16 - I have an assembly of the battle portion of C2, relocated to the F0 bank, which has both vanilla and patch code in my dropbox. I'll be updating it with additional patches as I have time. I will *not* be releasing it publicly, but ask me for the link and I'll share.

Leviathan Mist

  • Schizophrenic Madman
  • *
  • Posts: 362
  • Gender: Male
  • Game over.
    • View Profile
    • Retro Gaming Central
Re: FF3us - 255 hours on timer
« Reply #16 on: March 08, 2014, 05:04:56 PM »
I had an interesting idea, to convert the hours/minutes timer into a days counter. However, it would require that I increase the maximum variable for the frames counter from 60 to 240. I know there are subroutines all over the place which pull the frames variable, and I'm curious if anyone knows of any potential issues that might arise if this variable is expanded.

The plan would be as follows:

Set maximum frame count to 240.
Set maximum "seconds" variable (which now increments every 4 seconds) to 216.
Set maximum "minutes" variable (which now increments every 864 seconds) to 100.
Set maximum "hours" variable (which now increments every 86400 seconds) to 255.

This would allow the timer to continue for 255 days before it caps out. The display timer would now show "Days" - which would show how many days, rounded to the nearest hundredth, you've been playing.

The only foreseeable issue with this is with the frame counter - I know there are at least a few formulas that use the frame counter, and assume it to be 1-60.

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: FF3us - 255 hours on timer
« Reply #17 on: February 29, 2016, 06:54:38 PM »
I know this is an old thread, but I've been testing this and I've discovered that it interferes with the MP cost for Step Mine. MP costs for spells in general are 8-bit values, so without this patch, since the maximum time would be 99:59, the max MP cost for Step Mine would be 199. With this patch, the maximum time is 255:59, so in theory the max MP cost would be 511; however, this is no longer an 8-bit value. It's now a 9-bit value, but the top bit gets lost. As a result, for anyone who has played for 128 hours, Step Mine now has a cost of 0 when it should be 256.
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings

Leviathan Mist

  • Schizophrenic Madman
  • *
  • Posts: 362
  • Gender: Male
  • Game over.
    • View Profile
    • Retro Gaming Central
Re: FF3us - 255 hours on timer
« Reply #18 on: March 29, 2016, 11:52:40 PM »
I know this is an old thread, but I've been testing this and I've discovered that it interferes with the MP cost for Step Mine. MP costs for spells in general are 8-bit values, so without this patch, since the maximum time would be 99:59, the max MP cost for Step Mine would be 199. With this patch, the maximum time is 255:59, so in theory the max MP cost would be 511; however, this is no longer an 8-bit value. It's now a 9-bit value, but the top bit gets lost. As a result, for anyone who has played for 128 hours, Step Mine now has a cost of 0 when it should be 256.

Thanks for bringing this to my attention. I have attached some patches to fix this. From the readme:

Quote
What is this?

In Final Fantasy III (US) there is a skill called Step Mine. This skill does damage based
on your total number of steps, and costs MP based on the total time played. I had created
a patch for the game that expands the timer to allow for up to 255 hours of gameplay to
be recorded. It was then brought to my attention, by 13375K31C43R, that this had an
adverse effect on Step Mine's MP cost. Since hours capped at 99, no rollover check was
put in place. At 128 hours, Step Mine's MP cost rolled over to 0. These patches will fix
this behavior when using my 255 hours patch.

The 199 patch will cap Step Mine MP cost at 199 (which was the natural maximum when hours
were capped at 99 - this is equivalent behavior to the original game and the choice for
purists who still want an expanded timer counter). It will cap at 199 when the timer
reaches 99:30, and will not go any higher when the hours go over 100.

The 255 patch will cap Step Mine's MP cost at 255. This will happen when the timer
reaches 127:30. It will not go any higher, nor will it roll over.

Edit: Apparently the patch isn't quite done yet. It fixes the MP cost in the menu, but not in battle. I'll work on the battle portion tomorrow.
« Last Edit: March 30, 2016, 04:25:53 AM by Leviathan Mist »

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FF3us - 255 hours on timer
« Reply #19 on: March 30, 2016, 01:25:41 AM »
as for adapting my revolutionary Step Mine MP cost fix to deal with this capping...

1) 255 cap:

- lengthen a branch:
Code: [Select]
C2/5665: D0 0E        BNE $5675      (branch and skip cost modification if not)
- put this code after the "TXA + ROL":

Code: [Select]
bcc okay
lda #$ff
okay:

- shift down the stuff under it accordingly.  there will still be 2 bytes to spare.

----------

2) 199 cap:

the smallest added code i can come up with is:
Code: [Select]
bcs over

cmp #$c8
bcc okay
over:
lda #$c7
okay:

that's 2 bytes too big, so it'll have to branch elsewhere.  i dunno what code is in Leviathan Mist's new function, so i can't say whether it's reusable here.

Leviathan Mist

  • Schizophrenic Madman
  • *
  • Posts: 362
  • Gender: Male
  • Game over.
    • View Profile
    • Retro Gaming Central
Re: FF3us - 255 hours on timer
« Reply #20 on: March 30, 2016, 03:27:19 AM »
I was under the assumption that your MP digit fix patch would simply work with the MP overflow fix.

Here's an overview of the code I used in these patches. The code modified is under the section listed to determine MP cost for a given spell.
(Credit: Co-opted C3 disassembly document by
Imzogelmo, Lenophis, assassin, Dragonsbrethren, Novalia Spirit )

Code right before that which is modified:
Code: [Select]
Determine the MP cost to a given spell
C3/510D: 48      PHA            (save current spell)
C3/510E: 20F550  JSR $50F5      (A = A * 14)
C3/5111: AE3421  LDX $2134      (X product of previous JSR)
C3/5114: BFC56AC4 LDA $C46AC5,X  (magic data, MP cost)
C3/5118: 85E0    STA $E0        (store MP cost)
C3/511A: 68      PLA            (get current spell)
C3/511B: C999    CMP #$99       (is the current spell Step Mine?)
C3/511D: D00F    BNE $512E      (branch if not)

The original code:
Code: [Select]
C3/511F: AD1B02  LDA $021B
C3/5122: 0A      ASL A          (* 2)
C3/5123: 85E0    STA $E0        (save as new MP cost)
C3/5125: AD1C02  LDA $021C
C3/5128: C91E    CMP #$1E
C3/512A: 9002    BCC $512E
C3/512C: E6E0    INC $E0        (add 1 to MP cost)

My modified code:
Code: [Select]
C3/511F: 20A1F0 JSR $F0A1 (Jump to new subroutine)
I simply moved this code down to an area where I would have more space for it. From C3/5122 to C3/512D, I emptied the code/replaced each byte with FF. (Could have done a bunch of NOP's here, but I was too lazy to do anything but just hold down the F key.)

Here's the actual important part of the new code (this one is for the 255 MP patch):
Code: [Select]
C3/F0A1: AD1B02 LDA $021B (Load hours)
C3/F0A4: C980 CMP #$80 (Are hours 128 or greater?)
C3/F0A6: 9005 BCC $F0AD (Branch to $F0AD if no)
C3/F0A8: A9FF LDA #$FF (Set MP cost to 255)
C3/F0AA: 85E0 STA $E0 (Store 255 as Step Mine MP cost)
C3/F0AC: 60 RTS (Return)
C3/F0AD: 0A      ASL A           (Multiply hours played by 2)
C3/F0AE: 85E0    STA $E0         (save this amount as new MP cost for Step Mine)
C3/F0B0: AD1C02  LDA $021C (load minutes)
C3/F0B3: C91E    CMP #$1E (Are minutes 30 or higher?)
C3/F0B5: 9002    BCC $F0B9 (Branch to $F0B9 if not)
C3/F0B7: E6E0    INC $E0         (add 1 to MP cost of Step Mine)
C3/F0B9: 60 RTS (Return)

The only changes between this and the 199 patch are the value at C3/F0A5 (64 instead of 80), and the value at C3/F0A9 (C7 instead of FF)

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FF3us - 255 hours on timer
« Reply #21 on: March 30, 2016, 03:51:34 AM »
thanks for posting the code.

i actually meant my other Step Mine MP cost -related patch:
http://assassin17.brinkster.net/patches.htm#anchor32

:P

also, with no C2 modifications in your patch, you aren't capping the in-battle Step Mine cost.  see near the end of Function C2/5551.

----------

EDIT:

Quote
I simply moved this code down to an area where I would have more space for it. From C3/5122 to C3/512D, I emptied the code/replaced each byte with FF. (Could have done a bunch of NOP's here, but I was too lazy to do anything but just hold down the F key.)

won't the FFs break things after C3/F0A1 returns?  you might want those NOPs after all.
« Last Edit: March 30, 2016, 03:59:10 AM by assassin »

Leviathan Mist

  • Schizophrenic Madman
  • *
  • Posts: 362
  • Gender: Male
  • Game over.
    • View Profile
    • Retro Gaming Central
Re: FF3us - 255 hours on timer
« Reply #22 on: March 30, 2016, 04:07:23 AM »
also, with no C2 modifications in your patch, you aren't capping the in-battle Step Mine cost.  see near the end of Function C2/5551.
Wow, you're right. I completely forgot that battles use a different routine to determine MP cost, and that's important. It almost seems moot to cap it in the original game though, while leaving this bug intact. This patch looks like it should go hand-in-hand with yours. How about we co-author a patch for this that includes both the bugfix and the overflow fix?

won't the FFs break things after C3/F0A1 returns?  you might want those NOPs after all.

When I tested it, I didn't run into any problems. You're probably right though, nothing good ever comes out of being lazy/sloppy with code.

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FF3us - 255 hours on timer
« Reply #23 on: March 30, 2016, 04:16:58 AM »
This patch looks like it should go hand-in-hand with yours. How about we co-author a patch for this that includes both the bugfix and the overflow fix?

sounds good.  but if it requires me to do anything, it'll probably wait until after April 15th.  i haven't started doing my taxes yet, so i'll be very busy the next 2 weeks.

Leviathan Mist

  • Schizophrenic Madman
  • *
  • Posts: 362
  • Gender: Male
  • Game over.
    • View Profile
    • Retro Gaming Central
Re: FF3us - 255 hours on timer
« Reply #24 on: March 30, 2016, 04:21:09 AM »
sounds good.  but if it requires me to do anything, it'll probably wait until after April 15th.  i haven't started doing my taxes yet, so i'll be very busy the next 2 weeks.

That's funny, I'm actually a certified tax preparer. But no, I can create the patch, but I would just be using your code instead of the original, and crediting you for your portion of it.

13375K31C43R

  • Ultros
  • *
  • Posts: 675
  • Gender: Male
    • View Profile
    • Leet Sketcher's Final Fantasy III Patches
Re: FF3us - 255 hours on timer
« Reply #25 on: March 30, 2016, 09:20:06 PM »
I see that for purposes of spell menus, there are four bytes in RAM containing data for each spell at 7E:208E-7E:2091. $208E contains the spell ID, $2090 contains the aiming data and $2091 contains the MP cost...any idea what $208F is used for? I see it being used in a couple of places in bank C1, specifically bit 7, but I can't seem to debug it, nor can I find any place in the code where it's populated with any value.
"Do not meddle in the affairs of wizards, for they are subtle and quick to anger." -Gildor from The Lord of the Rings

assassin

  • Bane of Retards
  • *
  • Posts: 1,033
  • space bears are not gentle!
    • View Profile
    • My Barren Webpage
Re: FF3us - 255 hours on timer
« Reply #26 on: March 30, 2016, 11:57:13 PM »
availability; see C2/52DC.  only the top bit should matter, outside of the Sketch Glitch.

Rodimus Primal

  • Siren
  • *
  • Posts: 80
  • Gender: Male
    • View Profile
Re: FF3us - 255 hours on timer
« Reply #27 on: April 11, 2016, 04:59:24 PM »
Interesting. This affects the Woolsey Uncensored bug fix versions, so its certainly something to fix.

Leviathan Mist

  • Schizophrenic Madman
  • *
  • Posts: 362
  • Gender: Male
  • Game over.
    • View Profile
    • Retro Gaming Central
Re: FF3us - 255 hours on timer
« Reply #28 on: April 27, 2016, 12:01:38 AM »
Sorry for lack of updates guys, I completely forgot about this. I'll put it together this weekend.

C. V. Reynolds

  • Tunnel Armor
  • *
  • Posts: 153
  • RATED TEM OUTTA TEM.
    • View Profile
    • cvreynolds.net
Re: FF3us - 255 hours on timer
« Reply #29 on: May 02, 2016, 11:27:16 PM »
Hoi, Leviathan. :3

Any updates on this? I'm interested. My apologies if you're busy. We all get busy sometimes, after all.
I'm the former Hollywood Narrator from GameFAQs.

I'm a published novelist. My novels "Universe Eleven Series - Blue Ruin" Part 1, Part 2, and Part 3 are for sale on Amazon (check my website) in print and ebook formats.