Users browsing this thread: 1 Guest(s)
Command Edit Upgrade patch [WIP] Alpha Patch Available

#21
Posts: 212
Threads: 1
Thanks Received: 11
Thanks Given: 2
Joined: Oct 2014
Reputation: 7
Status
None
Don't scan anything, just change the code to load the commands from a list in memory.

As for 15 commands, you can have more than 15 but they won't display in the menu. You have to scroll off of the edge of the menu to access them.




https://github.com/abyssonym/beyondchaos
Beyond Chaos is a full-game randomizer for FF6.
Quote  

#22
Posts: 96
Threads: 3
Thanks Received: 2
Thanks Given: 3
Joined: Dec 2011
Reputation: 1
Status
None
I'd rather not just load from a list. If I can help it I want to keep things as dynamic as possible and avoid any hard-coding.
In the end I just want people to be able to have their characters start with whatever commands they want and have them appear on this list.

You can have a maximum of 16 without it scrolling off the edge.
I just need to get the 16th command to display it's text.
I'm not worried about it, though. If I can't make it display the text I'll just have to limit the list to 15 commands.

I had one idea that may provide a solution if it works out.
I want to try to make it so that if the Y button is pressed, the currently selected command on the battle list is replaced with the blank space.
If I can do that then there is no need for the first command on the generated list to be the blank command.
Then if I make the generated list start with Fight at the top there would then be no issues with the rest of the commands.
  Find
Quote  

#23
Posts: 212
Threads: 1
Thanks Received: 11
Thanks Given: 2
Joined: Oct 2014
Reputation: 7
Status
None
IMO loading from a list is way more convenient because you can just hex edit the list to change it, but if you're limiting people to using editors without hex editing, I can see your point.




https://github.com/abyssonym/beyondchaos
Beyond Chaos is a full-game randomizer for FF6.
Quote  

#24
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Quote:If I'm understanding the code and my observations, what is happening is that the game scans the commands currently held by the permanent party members and checks against the table at CF/FE00 to determine whether a given command should be added to the list. In order to make this properly functional I would have to make it scan each character's starting commands from the default data instead to avoid this issue entirely. Does that sound like an accurate assessment?

Yes, it is correct. You can scan the characters commands from the startup up data (rom) instead of the characters in memory (ram). However, it is much easier to alter the code and use a custom table or a fixed setup in the new code itself. In my opinion, you don't need to check the default commands in the recruited characters.

If you want to follow this route, you can check the function at C0/A07C. It is the event opcode #$40. It loads the character data from rom and save it at ram. It has almost all the fields for the start up characters and their rom/ram offsets. The commands offsets are included.

Quote:When you say the engine can only hold 15 commands, you mean the text for them, right?
Is that because of limited memory space for text?

I don't know the reason. Probably, it is related with the amount of OAM objects reserved for the commands and their setup. You can add more than 15 commands but, in the current screen, their text won't appear and they can appear in relatively weird positions. But they still can be selected, anyway. I recommend to cap the number of commands to 15 or less.
  Find
Quote  

#25
Posts: 96
Threads: 3
Thanks Received: 2
Thanks Given: 3
Joined: Dec 2011
Reputation: 1
Status
None
OK. I have some questions...

What event bit or whatever corresponds to Terra's Morph being unlocked?

What determines if a party member is only a guest?

EDIT:
I just upgraded the command edit routine.
Using the space I saved from optimizing the sustain status screen routine, I moved it up and added 2 minor features to give the whole thing a little polish.
1) When you press the A button to select a command that is not allowed to be changed, for now only Mimic does this, it no longer makes the 'click' sound.
2) Instead it makes the 'buzzer' sound and triggers the mosaic effect.

Here's the code:
Code:
One portion of Gogo's custom command setting in status menu
Gogo:  C3/2248: 20A622   JSR $22A6
       C3/224B: B90000   LDA $0000,Y (get character ID)
       C3/224E: C90D     CMP #$0D     (is character Gogo?)
       C3/2250: B05B     BCS $22AD (branch if greater than or equal)
       C3/2252: 200537   JSR $3705 (set finger positioning data for the four commands in status menu)
       C3/2255: A508     LDA $08
       C3/2257: 8980     BIT #$80 (did you press A?)
       C3/2259: F052     BEQ $22AD
       C3/225B: A54B     LDA $4B
       C3/225D: 85E7     STA $E7
       C3/225F: 64E8     STZ $E8
       C3/2261: 20A622   JSR $22A5
       C3/2264: C220     REP #$20
       C3/2266: 98       TYA
       C3/2267: 18       CLC
       C3/2268: 65E7     ADC $E7
       C3/226A: A8       TAY
       C3/226B: E220     SEP
       C3/226D: B91600   LDA $0016,Y (unmodified commands)
       C3/2270: C912     CMP #$12 (is command Mimic?)
       C3/2272: F02D     BEQ $22A1 (branch to buzzer sound + RTS)
       C3/2274: 20062F   JSR $2F06
       C3/2277: A54E     LDA
       C3/2279: 855E     STA $5E
       C3/227B: A54B     LDA $4B
       C3/227D: 8564     STA $64
       C3/227F: A906     LDA #$06
       C3/2281: 8520     STA $20
       C3/2283: A00C00   LDY #$000C
       C3/2286: 849C     STY $9C    
       C3/2288: A96A     LDA #$6A
       C3/228A: 8527     STA $27 (queue up to execute at C3/63A7)
       C3/228C: A965     LDA #$65
       C3/228E: 8526     STA $26 (execute at C3/36E7)
       C3/2290: 200364   JSR $6403
       C3/2293: AF899D7E LDA $7E9D89
       C3/2297: 8554     STA $54
       C3/2299: 4C0C64   JMP $640C (set finger positioning data for Gogo's customizable commands)
       C3/229C: 20B20E   JSR $0EB2 (makes the click sound)
       C3/229F: 800C     BRA $22AD (skip buzzer sound)
GBuzz: C3/22A1: 20C00E   JSR $0EC0 (makes the buzzer sound)
       C3/22A4: 205D30   JSR $305D (triggers the mosaic effect)
       C3/22A7: 8007     BRA $22AD (isolate Sub-routine)
GSub1: C3/22A9: 7B       TDC
       C3/22AA: A528     LDA $28
       C3/22AC: 0A       ASL A
       C3/22AD: AA       TAX
       C3/22AE: B46D     LDY $6D,X    
GEnd:  C3/22B0: 60       RTS

       C3/22B1: A509     LDA $09
       C3/22B3: 8980     BIT #$80 (did you press B?)
       C3/22B5: F009     BEQ $22BD
       C3/22B7: 20A90E   JSR $0EA9
       C3/22BA: A904     LDA #$04
       C3/22BC: 8527     STA $27 (init the main menu, queue up to execute at C3/1A8A)
       C3/22BE: 6426     STZ $26 (fade out)
GEnd2: C3/22C0:    60       RTS

       C3/22C1: EAEA     Free Space
       C3/22C3: EAEA     4 Bytes

EDIT2:
Here is another observation I just made.
The text for the command in the 16th position actually IS drawn to the screen.
It's just in the wrong place.
I tried this with everything the way it is right now; optimized status screen + upgraded command edit.
If I mark Morph as allowed in usME, load up a save from the very end of the game having a full party roster, then the text for Rage is pushed down to the 16th slot when I open the status screen as expected there is nothing in the 16th position even though I can point to it as expected.
However, when I looked at the status screen itself, with the command list closed, there are the letters _ag_ in the lower left corner.
So all that really need to be done is make sure that the text appear in the right place.
Hopefully it doesn't prove to be too much of a hassle.

EDIT3:
I managed to get the commands to read from the default data instead of from the current data.
However, there is a bunch of text corruption caused by my changes.
I double checked the branches and jumps associated with the code for the routine at C3/5DC1, which generates the command list, and everything seems to be pointing to the correct places.
So I guess it's not reading the data the way it should.
Here's the code I changed & I'm attaching a pic of the messed up text:

Code:
C3/5DD6:    F027        BEQ $5DFF

C3/5DE1:    BFA27CED    LDA $ED7CA2,X    (command 1) //Is this where the commands are laded from for placement into command list?
C3/5DE5:    8D8021      STA $2180
C3/5DE8:    BFA37CED    LDA $ED7CA3,X    (command 2)
C3/5DEC:    8D8021      STA $2180
C3/5DEF:    BFA47CED    LDA $ED7CA4,X    (command 3)
C3/5DF3:    8D8021      STA $2180
C3/5DF6:    BFA57CED    LDA $ED7CA5,X    (command 4)
C3/5DFA:    8D8021      STA $2180
C3/5DFD:    8010        BRA $5E0F
C3/5DFF:    E220        SEP #$20          (8 bit memory/accum.)
C3/5E01:    A9FF        LDA #$FF
C3/5E03:    8D8021      STA $2180
C3/5E06:    8D8021      STA $2180
C3/5E09:    8D8021      STA $2180
C3/5E0C:    8D8021      STA $2180      (four spaces, 16 loop iterations)
C3/5E0F:    FA          PLX
C3/5E10:    E8          INX
C3/5E11:    E01000      CPX #$0010
C3/5E14:    D0B3        BNE $5DC9
C3/5E16:    7B          TDC            (A = #$0000)
C3/5E17:    AA          TAX            (X = #$0000)
C3/5E18:    DA          PHX            (save X)
C3/5E19:    BF099E7E    LDA $7E9E09,X
C3/5E1D:    DF0A9E7E    CMP $7E9E0A,X
C3/5E21:    D008        BNE $5E2B
C3/5E23:    48          PHA
C3/5E24:    A9FF        LDA #$FF
C3/5E26:    9F0A9E7E    STA $7E9E0A,X
C3/5E2A:    68          PLA
C3/5E2B:    E8          INX
C3/5E2C:    E04000      CPX #$0040
C3/5E2F:    D0EC        BNE $5E1D
C3/5E31:    FA          PLX
C3/5E32:    E8          INX
C3/5E33:    E04000      CPX #$0040
C3/5E36:    D0E0        BNE $5E18
C3/5E38:    A28A9D      LDX #$9D8A
C3/5E3B:    8E8121      STX $2181
C3/5E3E:    A9FF        LDA #$FF
C3/5E40:    8D8021      STA $2180
C3/5E43:    7B          TDC            (A = #$0000)
C3/5E44:    AA          TAX            (X = #$0000)
C3/5E45:    A8          TAY            (Y = #$0000)
C3/5E46:    7B          TDC            (A = #$0000)
C3/5E47:    DA          PHX
C3/5E48:    BF099E7E    LDA $7E9E09,X  (load command?)
C3/5E4C:    3016        BMI $5E64
C3/5E4E:    C912        CMP #$12       (is command Mimic?)
C3/5E50:    F012        BEQ $5E64      (branch if so)
        //Remove this branch in order to allow the Mimic command to be added to the command list.
        //Alternatively, this can be used a jumping off point to a more elaborate sub-routine that can limit commands more comprehensively.
C3/5E52:    85E0        STA $E0
C3/5E54:    0A          ASL A
C3/5E55:    AA          TAX
C3/5E56:    BF00FECF    LDA $CFFE00,X  (load command usability data from table)
C3/5E5A:    2901        AND #$01       (can Gogo use this command?)
C3/5E5C:    F006        BEQ $5E64      (branch if not)
        //Kill this branch to allow all commands to be added to the list.
        //The above code is used to add commands to the command list by checking against a table of usable commands.
C3/5E5E:    A5E0        LDA $E0
C3/5E60:    8D8021      STA $2180
C3/5E63:    C8          INY
C3/5E64:    FA          PLX
C3/5E65:    E8          INX
C3/5E66:    E04000      CPX #$0040
C3/5E69:    D0DB        BNE $5E46
C3/5E6B:    C8          INY
C3/5E6C:    98          TYA
C3/5E6D:    8F899D7E    STA $7E9D89
C3/5E71:    A28DAA      LDX #$AA8D
C3/5E74:    8E8121      STX $2181
C3/5E77:    7B          TDC            (A = #$0000)
C3/5E78:    AA          TAX            (X = #$0000)
C3/5E79:    BF855FC3    LDA $C35F85,X  (window data for Gogo's command list?)
C3/5E7D:    8D8021      STA $2180
C3/5E80:    E8          INX
C3/5E81:    E00800      CPX #$0008
C3/5E84:    D0F3        BNE $5E79
C3/5E86:    A918          TYA             //Edit here to hardcode the length of the command menu.
C3/5E88:    4C915E        STA $E2        //A918    LDA #$18 ;make window full length of screen
                            //4C915E    JMP $5E91
C3/5E8B:    EAEAEAEA      ADC $E2        //The rest of the bytes up to 5E90 is now free space.
C3/5E8F:    EAEA          ADC $E2        //If loading the text of the 16th command is not solvable, change the value to #$17
                            //This will limit the length of the list to the displayable maximum.
  Find
Quote  

#26
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Quote:What event bit or whatever corresponds to Terra's Morph being unlocked?

The variable $3EBC, bit #$08. It also hides the display of the learned magic points after battle.

While it is unset, Terra can't raise her morph gauge. The game engine nulls the morph command if its morph gauge isn't above a specified level. It begins with zero and will never raise while this flag is unset.

The C2/5D91 is a long routine which manages all learning/update features in the end of battle. It includes many things. You can kill the check at C2/5E38 to force the morph gauge to raise independently of this flag. The relevant code is:
Code:
C2/5DA4: AD BC 3E     LDA $3EBC     event flags
C2/5DA7: 29 08        AND #$08      allow magic point display
C2/5DA9: 85 F1        STA $F1       save by now
....
C2/5E36: A5 F1        LDA $F1       allow magic point display
C2/5E38: F0 0F        BEQ $5E49     skip morph gauge increment if not

You can also kill the check of the morph supply at C2/5326. The routine checks the morph supply and returns a carry to determinate if the morph command will be enabled or not. However, i don't know if it is desired to call the morph command with a zero/low morph supply.

For reference, you can check this pointers if you need, in the future, to verify the commands that can be enabled/disabled in special ways:
Code:
(Data - addresses of functions to check whether above command should be
enabled, disabled, or otherwise modified on battle menu)

C2/52F1: 26 53   (Morph)
C2/52F3: 22 53   (Runic)
C2/52F5: 1D 53   (SwdTech)
C2/52F7: 14 53   (Lore)
C2/52F9: 14 53   (X-Magic)
C2/52FB: 14 53   (Magic)
C2/52FD: 01 53   (Capture)
C2/52FF: 01 53   (Fight)

Quote:What determines if a party member is only a guest?

Its character id. Any character id above or equal to #$0E is a guest character.

About your code, the block size for characters is different between ram and rom. For ram, the data size for a single character data is #$25 in size. For rom, it is #$16. They are two different structures with different sizes.

In your code, it uses the ram offsets from C3/6969. It is relative to the block size of #$25 (ram offset). However, you now must use rom offsets instead of the ram offsets. The offsets from C3/6969 won't work.
  Find
Quote  

#27
Posts: 200
Threads: 1
Thanks Received: 10
Thanks Given: 0
Joined: Oct 2015
Reputation: 18
Status
None
for a nearly-fully-commented C3/5DC1 (though you might have a handle on the function by now), see the "Miscolored command names fix" on my website:
http://assassin17.brinkster.net/
http://home.comcast.net/~assassin17/ (could go down any day)

credit to Imzogelmo, Lenophis, Dragonsbrethren, Novalia Spirit for the C3 disassembly. and to Lenophis for providing me more comments than what's on Slick.
Quote  

#28
Posts: 96
Threads: 3
Thanks Received: 2
Thanks Given: 3
Joined: Dec 2011
Reputation: 1
Status
None
Thanks for the info guys. I'm going to end up having to credit the entire FF6 Hacking community by the time I finish this. Tongue

EDIT:
Small Update.

I got the command list generator to pull commands from the ROM instead of the RAM properly. No longer do commands disappear if no once is using a given command and you leave the Status screen. Also, I disabled the null command from appearing from the list so now I can fit Mimic in there. IIRC, it's pretty much the same as with the Extra Mimic Slot patch just without the alternate command loading method.

Right now there are only a few issues I need to remedy.
Fight is a couple of pixels higher than all the other commands and needs to be lowered.
I need to prevent Morph from appearing on Terra's list if it isn't available yet.
If the character is not Terra Morph should never appear.
If the character is not Gogo Mimic should not appear.
If the character has not learned any spells Magic should not appear.
And lastly, at the beginning of the game during the first battle field event, Mog is not treated as a permanent character so his commands are ignored.
I need to exclude Mog from using command edit at this point in the game.
  Find
Quote  

#29
Posts: 96
Threads: 3
Thanks Received: 2
Thanks Given: 3
Joined: Dec 2011
Reputation: 1
Status
None
Another small update.
I just added a new routine that selectively prevents characters other than Gogo from using Mimic and characters other than Terra from using Morph.
I noticed, though, that when pressing L or R to switch characters the command list is not rebuilt. It seems to be a similar problem as with the Miscolored Command Names patch. I'm going to see about maybe forcing the Status menu to reload when switching characters.

In the mean time I'm uploading an alpha version of the patch in case anyone want's to try it out. It has several issues still, but the basic functionality is there.

Working features:
-All characters below Umaro can use command edit.
-Morph and Mimic are restricted to Terra and Gogo respectively.
-Commands are loaded from ROM instead of RAM to prevent commands from disappearing.

Issues:
-Switching characters with L / R doesn't refresh the command list.
-Morph appears on the list even if it is blanked out.
-Magic still appears even if blanked out or if no spells are known.
-During first battlefield event, Mog has access to command edit but his command is not included on the list. This can lead to the permanent loss of the Dance command.

If anyone finds any other issues please feel free to post them here. Thanks!

IPS PATCH:
dropbox.com/s/k744s857itautrs/Final Fantasy III (U) (V1.0) (Headered) [Command Edit Upgrade] ALPHA 10262015.ips?dl=0
  Find
Quote  

#30
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Perhaps, you can check the routine at C3/612C for reference. The routine disables/replaces commands for the menu. It only affects the menu and doesn't change commands in battle. You can try to analyze it to discovery the conditions when commands are enabled or disabled. The routine determines the availability for magic, morph, leap and dance commands in the menu. It also replaces commands based on relics, like from fight to jump.

Keep in mind it only works in ram offsets and you use rom offsets now.

Related routines are:
Code:
C3/5ED7 blank/replace gogo's commands
C3/5EE1 check blank/grayed commands (used by many routines)
C3/612C blank/replace commands (includes cases for: magic, morph, leap, dance)
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite