News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Final Fantasy II: Refurbished  (Read 60990 times)

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #160 on: January 24, 2016, 01:51:37 am »
A couple notes about your ASM:
After an LDA instruction, CMP #$00 is unnecessary. It will already have the flag set if it's 0.
Although, when you use a SBC, you need a SEC instruction before it or it will be off by 1 (though maybe if you were short on space you could adjust the SBC instruction to compensate? I'm not certain, I've just done it the "accurate" way.) (also should be using CLC before ADC)
Those "Horizontal position adjust routines" end on several bytes of identical code. You could also optimize a few of those for space.
Just include one instance of 8D 47 02 8D 4F 02 60, and then from the other one, branch there. (with a JMP. Or... although the NES CPU is missing the BRA (branch always) instruction, you can fake it by using BEQ/BNE if you know the result will always/never be 0. Like that ADC #$07, if you know that is always going to result in a non-zero value, you can put a BNE after and will effectively work as a BRA)
Thanks for your suggestions; I was relying on this: http://www.romhacking.net/documents/112/
I'm still pretty new to NES ASM hacking. I'm not even using a compiler, I'm just using the document to see what bytes do what and testing it out on FCEUX's run-time hex editor (while writing down what works in Notepad, of course). Free space is no longer an issue as it turns out, as there's plenty of free space in bank 0xF, which is always swapped in so it's readily usable (and the Y-coordinate routine had to be a separate one anyway with my implementation).

Anyhow, here's what I got to adjust the Y-coordinates (note I already had this done by the last time I edited my previous post, I just didn't post it, so it was written before I had seen KingMike's post):

0x31CB1: 20 62 F7
//--------------- 0x3F770 -------------------------------------------------
0x3F770:
60 EA
//The overwritten bytes
0x3F772:
8D 44 02
85 55

//now the custom ASM code
A6 5D      //LDX $005D
E0 04      //CPX $04
D0 F3      //BNE $9649 (0c:9649/31659)

//CHECK X POSITION FIRST
A5 53      //LDA $0053
C9 00//POS_1   //CMP #$00
F0 05      //BEQ to 0 vertical position adjust
C9 01//POS_2   //CMP #$01
F0 01      //BEQ to 1 vertical position adjust
60

//POS_1 CHECK Y
A5 54
C9 00
 F0 0C //HEIGHT 0
C9 01
 F0 19 //HEIGHT 1
C9 02
 F0 1A //HEIGHT 2
C9 03
 F0 1B //HEIGHT 3

// HEIGHT 0
A9 A8      //LDA #$A0
8D 48 02      //this is at $F78C
8D 4C 02
E9 08      //SBC #$08
8D 40 02
8D 44 02
60

// HEIGHT 1
A9 B8      //LDA #$B0
4C 8C F7

// HEIGHT 2
A9 C8      //LDA #$C0
4C 8C F7

// HEIGHT 3
A9 D8      //LDA #$D0
4C 8C F7
=====================================================

In case my wording wasn't clear in my previous post's edits, the menu POSITIONS are readjusted to their proper positions, but the cycling order still needs to be fixed. Here's a screenshot:

(ignore the abbreivated/squished names)
The problem with the cycling order right now is that pressing down/up will skip a row, and in order to access the even rows you have to press right twice (in other words, move the cursor over to what would have been the third spell in a given row in the old menu layout). Now don't get me wrong, as it is right now, every spell is still reachable and select-able, but the problem is that the cycling order still thinks its based on the old layout. I couldn't modify the internal "width" value otherwise it would break the connection between the selected spell and the actual performed spell. Now what I do know is that there's a RAM value at $0066 that controls which spell slot is currently selected, so what I'm gonna have to do is simply alter what slot it jumps to based on the D-pad buttons that are pressed. That's something I'll tackle next weekend, hopefully.
Sole developer of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78

Rodimus Primal

  • Hero Member
  • *****
  • Posts: 1043
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #161 on: January 24, 2016, 11:36:38 pm »
Something strange in my playthrough so far this weekend (its been tough IRL stuff in the way) I noticed was the item names extend too far in the monster drops treasure screen.



It's not a big deal and the items work, but its a little jarring.

If you finally do get the spell battle menu working properly, it will most likely give you free space in the text area to use better and more optimized squish tiles for monster and item names. I think G.Guard still looks weird for a monster name which is why I suggested GobGuard.

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #162 on: January 25, 2016, 11:08:29 am »
Something strange in my playthrough so far this weekend (its been tough IRL stuff in the way) I noticed was the item names extend too far in the monster drops treasure screen.



It's not a big deal and the items work, but its a little jarring.

If you finally do get the spell battle menu working properly, it will most likely give you free space in the text area to use better and more optimized squish tiles for monster and item names. I think G.Guard still looks weird for a monster name which is why I suggested GobGuard.
Thanks for pointing that out. To fix it I'll have to expand the window out side of the CRT safe-zone (like I did with the inventory and equipments menu, hopefully that's not bothering people since the text is still in the safe-zone), but the text will still be in the CRT safe-zone so it should be good.
Sole developer of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78

Midna

  • Hero Member
  • *****
  • Posts: 704
  • Resident Panel de Pon Nut
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #163 on: January 25, 2016, 09:44:28 pm »
Not sure how well this would work (and it'd be a lot of work for very little gain), but you could try reprogramming the screen to have a horizontal layout. Like:

     Treasure
       Items    Remove/Exit

If that makes any sense.

cospefogo

  • Full Member
  • ***
  • Posts: 137
  • "Take this silver dagger to save your neck."
    • View Profile
    • Fliperamas
Re: Final Fantasy II: Refurbished
« Reply #164 on: January 27, 2016, 12:54:32 pm »
What a wonderful work!

Final Fantasy I (on NES) has been one of my favorite games of all time, however... Final Fantasy II... Oh my. The only time I did try to play it scared me to death — mainly because the different leveling system. It required a lot of patience and I really did no understood it at all.

Now, a decade has passed, maybe I am ready to try it — and will do it using this very patch!

I will be accompanying this topic to learn more about the parallel patch that probably will enrich Final Fantasy II enjoyment as well (bug fixes, improvements, etc).

Thank you so much, Chaos Rush!
Looking forward for more news!

Cospefogo.
"Replicants are like any other machine - they're either a benefit or a hazard.
If they're a benefit, it's not my problem."

Leviathan Mist

  • Jr. Member
  • **
  • Posts: 25
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #165 on: January 30, 2016, 07:08:27 pm »
This project looks extremely in-depth. I have a number of glitches that no one ever seems to mention, but that I have wanted to see fixed in this version of the game for a long time. They all involve the lack of stat capping.

1. HP and MP are not capped. HP can go over 9999, and MP can go over 999. When they do, the digits look messed up. Also, when HP and MP go over 65535, it "rolls over" to 0. In the remakes, HP and MP are properly capped at 9999/999 respectively.

2. GP/Gil is not capped. It can go over 9999999, and when it does, the digits are messed up. When gold goes over 16777215, it rolls over to 0.

3. Inn costs are not capped. When the inn price goes over 65535, it rolls over to 0. This can only be observed when your HP and MP for everyone are over 9999 and 999, because normally inn costs won't reach those levels.


No one talks about these glitches, because no one gets their stats that high in a normal run. In fact, I'm the only person I know of who has ever leveled HP and MP above those numbers in a normal playthrough. Still, this is not only abusable, but potentially game-breaking. Here's why: Say you have 65437 HP and 99 Vitality on a character. Say they gain HP in their next fight. Their HP will be 65536, but 65535 is the maximum, so instead it will roll over and they'll be stuck with 0 HP. That character is now permanently zombified and can no longer be used. They can't ever gain HP again, and are stuck with 0 HP. Pretty extreme example, but it's something that can result from not having HP capped.

I love the NES version, and I particularly love the process of grinding, but without stat caps, I have no motivation to do so. If these are fixed, I will consider the version THE definitive version of FF2.
Game over.

Sarisa

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #166 on: February 07, 2016, 04:22:55 am »
I spotted a text overflow error early in the game:


Also, for anyone else who needs an indoors B button dash now, this doesn't instantly crash the game:

At 0x3d4f1:
Old: A9 01 85 32 85 34 // LDA $#01 STA $32 STA $34 //storing walking speed in $32 and $34; FF1 uses $34 only
Patch: 20 50 F7 EA 85 32 // JSR $F750 NOP STA $32 //jump to the B button dash subroutine then store the walking speed in $32

At 0x3f760:
Old: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //free space(?)
Patch: A5 20 29 40 D0 05 A9 01 85 34 60 A9 02 85 34 60 // LDA $20 AND $#40 BNE $F75B LDA #$01 STA $34 RTS LDA #$02 STA $34 RTS //Dormento's routine for the FF1 B button dash

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2921
  • 2 + 2 = 5
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #167 on: February 07, 2016, 04:28:31 am »


Who is PPPPPP whom was seen by the Princess and where has all of the FFFFFF gone to?

Old games have such classic stories.
War is Peace. Freedom is Slavery. Ignorance is Strength.

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #168 on: February 07, 2016, 11:22:48 am »
@cospefogo: Thank you for your comments. I still do plan on making a gameplay balance patch, but as of right now I'm still working on improving the in-battle magic menu (except I haven't worked on it at all in the past two weeks due to lack of time.

@Leviathan Mist: I will definitely look into fixing these glitches and hopefully it will be in the next release!

@Sarisa: Thanks for pointing it out, it's been added to my to-do list.

Anyhow I haven't abandoned this project or anything, but I've been really busy with school with boatloads of homework, and school is my number one priority.
Sole developer of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78

Vanya

  • Hero Member
  • *****
  • Posts: 1494
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #169 on: February 09, 2016, 03:50:38 pm »
Take your time. Anything worth having is worth waiting for.

arciks11

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #170 on: March 17, 2016, 05:57:44 am »



Line breaks in this textbox seem odd.

Another bug I came across was that Cross item was displayed as Ice Shield in FCEUX 2.2.1. version, however that wasn't the case in 2.2.2. version.


Edit: After moving the save to a newer version it still says Ice Shield. Although when I Hex edited it into the game from a fresh start it was Saying Cross correctly, The Cross was gotten as a random drop from a Soldier enemy, so that might have something to do with it.

Edit 2: After starting a playthrough on a newer version of FCEUX same thing happened. Soldier dropped Cross, but it's using Ice Shield name.
« Last Edit: March 17, 2016, 07:04:19 am by arciks11 »

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #171 on: April 30, 2016, 01:20:56 am »
Hey everyone, I just spent a good 2+ hours on what had me stumped before (the magic menu extension) and have ultimately decided that it's far too much trouble for what it's worth. I apologize if I let anyone down who was looking forward to fully expanded magic names, but at the end of the day squish tiles are still readable and functional, and my ASM code was getting too herky-jerky, and I'd rather focus on other aspects (such as the item menu after you defeating an enemy, and looking into fixing bugs). If anyone REALLY wants to look into the magic menu and do it themselves, just send me a PM and I'll give you my notes and what I've done so far, but at this point I'd like to just get an acceptable version out on the RHDN database and just leave the magic menu as it is.

For anyone curious, here's my notes for the magic menu (WARNING, they're really unorganized):
Spoiler:
at 31CA9 (0C:9C99):
20 XX XX EA //with XX XX being the new routine offset, you might
       //not need the EA byte
(really, just put 20 18 96)

NEW ROUTINE AT XX XX: 31628

//USE RAM OFFSETS
$53 = X coordinate slot
$54 = Y coordinate slot
$5D = if it's 04, then it's the magic menu
//X COORDINATES WE WANT:
0 & 2: x00, x08
1 & 3: x50, x58

//--------------- 0x31628 -------------------------------------------------
//The overwritten bytes:
8D 47 02    //STA $0247
85 56      //STA $56

//now the custom ASM code
A6 5D      //LDX $005D
E0 04      //CPX $04
D0 20      //BNE $9649 (0c:9649/31659)

//LOAD X POSITION
A5 53      //LDA $0053
C9 00//POS_1   //CMP #$00
F0 09      //BEQ to 0 horizontal position adjust
C9 01//POS_2   //CMP #$01
F0 0E      //BEQ to 1 horizontal position adjust

//IF THE X POSITION IS 3 OR 4, THEN YOU SHOULD REACH THIS CODE:
E9 02      //SBC #$02 //subtract 2 to get correct horizontal index
4C 25 96   //Jump to Pos 1

//0 HORIZONTAL POSITION ADJUST
69 07
8D 47 02
8D 4F 02
60

//1 HORIZONTAL POSITION ADJUST
69 56
8D 47 02
8D 4F 02
60      //RTS
//PLAN FOR Y-COORDINATE UPDATE:
-Check selected magic index
-if its "1st" or "2nd" horizontally, move vertically one tile up
//-------------------------------------------------------------------------


31CB1 (old): 8D 44 02
31CB1 (new): 20 62 F7
//--------------- 0x3F770 -------------------------------------------------
//The overwritten bytes
0x3F770:
60 EA

0x3F772:
8D 44 02
85 55

//now the custom ASM code
A6 5D      //LDX $005D
E0 04      //CPX $04
D0 F3      //BNE $9649 (0c:9649/31659)

//CHECK X POSITION FIRST
A5 53      //LDA $0053
C9 00//POS_1   //CMP #$00
F0 05      //BEQ to 0 vertical position adjust
C9 01//POS_2   //CMP #$01
F0 01      //BEQ to 1 vertical position adjust
60

//POS_1 CHECK Y
A5 54
C9 00
 F0 0C //HEIGHT 0
C9 01
 F0 19 //HEIGHT 1
C9 02
 F0 1A //HEIGHT 2
C9 03
 F0 1B //HEIGHT 3

// HEIGHT 0
A9 A8      //LDA #$A0
8D 48 02
8D 4C 02
E9 08      //SBC #$08
8D 40 02
8D 44 02
60

// HEIGHT 1
A9 B8      //LDA #$B0
4C 8C F7

// HEIGHT 2
A9 C8      //LDA #$C0
4C 8C F7

// HEIGHT 3
A9 D8      //LDA #$D0
4C 8C F7

// alter what slot it jumps to based on the D-pad buttons that are pressed.
//At 0x68 is the 'slot' offset

//$0053 is the column
//$0054 is the row
if (KEY_RIGHT && column == (1 || 3))
   column--;

if (KEY_DOWN && column == 0) {
   row = 0;
   column = 2;
}
// basically this, account for all possibilities
VANILLA:
031C09:E6 53     INC $0053 = #$01
031C0B:A5 53     LDA $0053 = #$01
031C0D:C5 5D     CMP $005D = #$04
031C0F:D0 05     BNE $9C06
031C11:A9 00     LDA #$00
---------------------
ACTUAL CHANGES:

//PRESSING RIGHT
031C09: 20 48 F8 EA// it should branch to 3F858

Free space at 03F858:
E6 53 //original routine
A5 53 //original routine
A6 5D   LDX $005D = $04
E0 04   CPX #04
D0 06   //if not in magic menu, branch to END_SUB location
A5 53   //load column value into A
C9 02   //is it 02?
F0 XX   //branch to RESET_X location
60   //END_SUB
---
RESET X:
C6 53
C6 53
60

//PRESSING DOWN
original routine:
> 031C30:E6 54     INC $0054 = #$00
  031C32:A5 54     LDA $0054 = #$00
  031C34:C5 5C     CMP $005C = #$04
  031C36:D0 04     BNE $9C2C
  031C38:A9 00     LDA #$00
//NEW ROUTINE:
031C30: 20 5E F8 EA

at 03F86E: ($F85E)
E6 54 //original routine
A5 54 //original routine
A6 5D //check if we're in magic menu
E0 04
D0 F5 //branch to RTS if we're not in magic menu
A6 53 //load column value into X
E0 00 //compare column value to 00
F0 0D //branch to routine that sets column to +2 and keeps row the same
E0 01 //compare column value to 01
F0 09 //branch to routine that sets column to +2 and keeps row the same
E0 02 //compare column value to 02
F0 0C //branch to routine that sets row to +1 and column to -2
E0 03 //compare column value to 03
F0 08 //branch to routine that sets row to +1 and column to -2
60

at 03F88B:
E6 53
E6 53 //increment column by +2
C6 54 //decrement row by 1
60

at 03F892: ($F882)
C6 53 //decrement row by 1
C6 53
60

Another bug I came across was that Cross item was displayed as Ice Shield in FCEUX 2.2.1. version, however that wasn't the case in 2.2.2. version.


Edit: After moving the save to a newer version it still says Ice Shield. Although when I Hex edited it into the game from a fresh start it was Saying Cross correctly, The Cross was gotten as a random drop from a Soldier enemy, so that might have something to do with it.

Edit 2: After starting a playthrough on a newer version of FCEUX same thing happened. Soldier dropped Cross, but it's using Ice Shield name.
Thanks for pointing that out, it was a simple fix, turns out I accidentally copied the Ice Shield name onto that item's name. Instead of calling it Cross however, I am calling it 'Garlic' because the corresponding Japanese item name is niniku.
« Last Edit: April 30, 2016, 01:55:21 am by Chaos Rush »
Sole developer of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78

Heaven Piercing Man

  • Full Member
  • ***
  • Posts: 135
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #172 on: April 30, 2016, 01:54:34 am »
What names ended up shortened in the squish-tile scheme?

AWJ

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #173 on: April 30, 2016, 10:37:04 am »
Quote
Thanks for pointing that out, it was a simple fix, turns out I accidentally copied the Ice Shield name onto that item's name. Instead of calling it Cross however, I am calling it 'Garlic' because the corresponding Japanese item name is niniku.

Those are two different items. The Cross fixes curse status, the Garlic damages undead monsters.

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #174 on: April 30, 2016, 12:47:20 pm »
Those are two different items. The Cross fixes curse status, the Garlic damages undead monsters.
The corresponding item index in the Japanese ROM's item name table is Garlic.
Sole developer of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78

Rodimus Primal

  • Hero Member
  • *****
  • Posts: 1043
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #175 on: April 30, 2016, 03:59:43 pm »
Glad you're finally working on this again. I'm curious how the spell names are going to look. Hopefully you can optimize the space for them properly. Also, Cross is the official name currently for removing Curse status.

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #176 on: May 28, 2016, 08:22:48 pm »
Well, I've released v1.3. It fixes some typos and adds the B-Button dash back. Unfortunately I couldn't get the magic menu working, and I was unable to reposition the after-battle "find item" menu too, and quite frankly I don't have the time to spend hours getting those two things working (same with that gameplay improvement patch I wanted to do). I've submitted it to the RHDN database and I have no problems if anyone wants to make addendums to it. I apologize if people were waiting for the new magic menu and the after-battle item menu fix (and it's not as simple as the out-of-battle menus, the way it's coded is completely different), so really the only solution for that is to decrease the item name character limit back to what it was in the vanilla ROM.

But nonetheless, it's fully playable, it's in English, and the script is much more accurate than the Demiforce script. I hope you guys understand for me leaving this, and I apologize, but I'd also be very grateful if anyone wants to improve on v1.3.
Sole developer of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78

Burnt Lasagna

  • Full Member
  • ***
  • Posts: 248
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #177 on: May 29, 2016, 12:11:19 am »
I just wanted to say thanks for making this!
I'm glad a patch like this exists.

Chaos Rush

  • Sr. Member
  • ****
  • Posts: 275
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #178 on: June 18, 2016, 10:48:04 pm »
I'm considering reverting the item name character limit back to 8 since no matter what I've tried I can't fix the "after battle found item" menu size properly. If you put 0x64 at the offsets 0x31366 and 0x313AA then it looks like this:

Which makes the menus barely long enough to fit the item names but the first character of each item is repeated on the line above. I've looked through the ASM code over and over and can't seem to figure it out (mind you, this is something I've been trying to do since March).

How would you guys feel if the item name character limit was shortened back to 8?
Sole developer of STARLIGHT LEGACY intended to be released on Steam.
Discord: https://discord.gg/fTS5Q78

Vanya

  • Hero Member
  • *****
  • Posts: 1494
    • View Profile
Re: Final Fantasy II: Refurbished
« Reply #179 on: June 19, 2016, 01:14:39 am »
I always prefer to have more characters to allow for accurate name translations, but don't kill yourself trying to get it done either.
I say revert it for now and keep working on it at your own pace or drop it for now and tackle it again later with a new perspective.