• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
May 17, 2024, 04:02:06 am

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - pokeytax

41
Quote from: Dome on October 24, 2011, 04:06:43 am
Is there any way to "Fix" this?


Yes, but it's a formula hack so not top of the stack.

Quote
1) Make certain skills require percentages of MP instead of a straight value of MP.
2) Immolation Status: deals fire damage to self and those around the immolated.
3) Minimum range editing for skills and weapons alike.


1) Percentages of current MP? Max MP? Can't deny I do want this one myself and it doesn't sound undoable.
2) a lot of work for something specific to a single patch
3) not sure what you mean

Quote
I wanted to remove the Dragon Target requirement of her skills (also nerfing and putting some costs to them).


This is a formula edit so again it's low priority. I know having rigid formulas is tough but if I ever touch this stuff it's going to be by doing a flexible editor, every single patch needs its own one-offs.

Quote
when you choose "New Game" it skips all the introduction stuff (text overlay intro, name insert, birthdate, opening movie)


I really want this but it involves wading through a lot of system calls and other Complicated Stuff. I'm not giving up, though - I would like to learn about the kernel anyway.

Quote*Base Raw Stat/Zodiac selection on something other than gender and species.


That is interesting, since as you note they seem pointless at present, especially monster preraw. But stuff even the requester isn't interested in using isn't a high priority.
42
Tutorials and Learning / Pokey's ASM Tutorial: Part #0
October 24, 2011, 09:17:12 pm
ASM Tutorial #0: Breaking Code

NEEDED
pSX debugger, psxrel.exe {http://ffhacktics.com/smf/index.php?topic=5185.0}
a Final Fantasy Tactics ISO {left as an exercise for the reader}

In this lesson we are going to do the simplest thing we can: break something. Creating something is hard, but destroying something is easy. I may need to go back and do tutorial #-1 before moving on to tutorial #1, if this one is too complicated and I took too much knowledge for granted! But we'll start here for now.

You can learn to ASM.

Victory Condition

Today's goal is to break "Monster Talk" - disable its effect so the RSM slot can be used for other stuff.

Step 0: Basic Knowledge
Hex numbers are represented by "0x00". "0x08" is 8. "0x10" is 16. "0x1A" is 26. "0x100" is 256. You don't need to be able to add hex to ASM hack, that's what computers and calculators are for; but, you do need to not mix up your hex and decimals.

Step 1: Set Up A Repeatable Test Condition

To examine Monster Talk, we need to set up a situation where it has an effect. While the byte might be checked if a human talks to a human, it'll definitely be checked if a human talks to a monster; and equally importantly, we'll need a monster to test if our hack worked or not. So enter a battle with a monster and savestate when it's someone with Talk Skill's turn in range of a monster, so we can keep reloading and testing. I suggest Ramza because he's a little easier to pick out of a crowd. If at any point you goof up, reload your savestate.

Step 2: Set Up A Breakpoint

In order to find out where the code we want to edit is located, we need to set up a breakpoint. A breakpoint is a trigger that stops everything when certain memory is loaded, written, or executed.

Lots of stats are checked over the course of using Talk Skill, but what we are interested in is when it asks whether the player has Monster Talk. So we are going to put a READ breakpoint on our human unit's Monster Talk byte, which will freeze the action when Monster Talk is checked. First, though, we have to look up that byte.

Step 2A: Unit Data

The most important page on the wiki is ffhacktics.com/wiki/Formula_Hacking. It tells you about unit data in battle. Just about everything that happens in battle starts or ends with unit data, and this details what most of the bytes mean. This will let you figure out where to look, but you need to know which unit to check as well.

The following are the offsets for each unit, taken from the Final Fantasy Tactics Gameshark Handbook, which is a useful source in its own right.


 UNIT  |  ppp qqq rrr sss ttt uuu  DETAILS
======================================================
No. 17 |  1924CC  [Ally #1]
------------------------------------------------------
No. 18 |  19268C  [Ally #2]
------------------------------------------------------
No. 19 |  19284C  [Ally #3]
------------------------------------------------------
No. 20 |  192A0C  [Ally #4]
------------------------------------------------------
No. 21 |  192BCC  [Ally #5]
------------------------------------------------------
No. 01 |  1908CC  [Enemy / Guest #1]
------------------------------------------------------
No. 02 |  190A8C  [Enemy / Guest #2]
------------------------------------------------------
No. 03 |  190C4C  [Enemy]  
------------------------------------------------------
No. 04 |  190E0C  [Enemy]  
------------------------------------------------------
No. 05 |  190FCC  [Enemy]  
------------------------------------------------------
No. 06 |  19118C  [Enemy]  
------------------------------------------------------
No. 07 |  19134C  [Enemy]  
------------------------------------------------------
No. 08 |  19150C  [Enemy]  
------------------------------------------------------
No. 09 |  1916CC  [Enemy]  
------------------------------------------------------
No. 10 |  19188C  [Enemy]  
------------------------------------------------------
No. 11 |  191A4C  [Enemy]  
------------------------------------------------------
No. 12 |  191C0C  [Enemy]
------------------------------------------------------
No. 13 |  191DCC  [Enemy]  
------------------------------------------------------
No. 14 |  191F8C  [Enemy]  
------------------------------------------------------
No. 15 |  19214C  [Enemy]  
------------------------------------------------------
No. 16 |  19230C  [Enemy]  
------------------------------------------------------


In order to get the unit's Monster Talk byte, we have to add the unit offset from the table above and the data offset from Formula Hacking.

How do we know which Ally our unit is? You can either set your units up properly on the pre-battle screen, using the grid in Xifanie's ASM tutorial or the FFT Gameshark Handbook, or look for the one whose data matches the unit you're playing with. I prefer to just use Ramza and look for the ally whose very first byte is "01" for Chapter 1 Ramza. (If you're in a later chapter, it'll be "02" or "03".)



How do we know which support we want to check? After all, Monster Talk can be an innate ability or an equipped support ability. In the first hack I ever did, I checked the equipped support ability, but it turns out that we don't want to check either of these. The best place to go, and the place the game goes to check RSM, is bytes 0x8B - 0x95. These bytes always tell you exactly what RSM are active, whether innate, equipped, or hacked in. Monster Talk is part of byte 0x91, so that's the byte we want to set a breakpoint on.

Trying to add hexadecimal numbers in your head when you're starting out is asking for trouble. Just take your unit offset [1924cc] and data offset [91] and add them together in Windows Calculator's Hex mode [19255D]. That's where our breakpoint is going.

Step 2B: Seriously, Set Up A Breakpoint

Now that you are where you want to be, open the debugger by selecting Debug > Monitor > r3000.

To actually set a breakpoint, you need to right-click and Add in the Breakpoint pane of the debugger. I keep this pane in the lower right.





Make sure it's set to Read/Write, not Execute. Write is irrelevant right now but generally a good idea to leave in, since you'll want to know if something is sneaking in and touching the data before it's retrieved.

You must enter your offset specifically as hex; type in "0x19255D", not "19255D".



At this point, you should have Ramza able to Act and your breakpoint in place - the trap is set. Switch back to the game window and spring it by choosing your Talk Skill...

Step 3: Search

When the game froze up, that was a good thing! Switch over to the debugger and you'll see the message "Breakpoint on memory read" at the bottom of the screen and a ">" cursor next to a line of code in the Disassembly window. This is the line after your breakpoint triggered. The code you should see is the following:

0x133bd4:  lbu r2, 0x0091(r20)
0x133bd8: >nop
0x133bdc:  andi r2, r2, 0x0002
0x133be0:  beq r2, r0, 0x00133bf4

This is a very common code formation - it's the simplest way to check a flag and then make a decision based on the check. In fact, if you don't know anything else about ASM, this is probably the best thing to remember.

lbu says to load the byte into register 2.
nop says nothing happens. (This is what the hex string "00000000" means.) This is there because lbu needs a minute to think; you can ignore it for now.
andi says to either set register 2 to 0x0002 if Two Hands is checked, or to zero if Two Hands is not checked.
bne says to ignore this line if register 2 is not zero (Two Hands), but jump ahead if register 2 is zero (no Two Hands).

You can tell that this is addressing Two Hands and not Monster Talk because we have the line

"andi r2, r2, 0x0002"
instead of
"andi r2, r2, 0x0010".

If you pull up the Formula Hacking page on the wiki, you will see that each of the eight flags on this byte has its own value to check.



These correspond to the eight bits in a byte, but right now you just need to know you're looking for 0x0010.

Since we don't want to mess with Two Hands right now, we'll skip this. Press F9 and switch to the other window and Ramza will be walking again.

Now move the cursor onto the target - you should get another freeze. Switch back to the debugger.

0x133bd4:  lbu r2, 0x0091(r20)
0x133bd8: >nop
0x133bdc:  andi r2, r2, 0x0002
0x133be0:  beq r2, r0, 0x00133bf4

The same exact line of code. Another false alarm, press F9 and switch back. This time, press X and select a monster to talk to.


Yeah, it does this sometimes when you have to stop at multiple breakpoints. It's a nuisance. I usually try to press F9 and immediately click on the play window to cancel the "ghost" directional input. You can also turn the cursor repeat speed down in FFT's options if it's becoming a real problem.



0x1899e0:  lbu r2, 0x0091(r2)
0x1899e4: >nop
0x1899e8:  andi r2, r2, 0x0010
0x1899ec:  bne r2, r0, 0x001899fc

Success! This has a check for Monster Talk.

Everything you need to worry about right now is in these four lines, so forget about the rest.

lbu says to load the byte into register 2.
nop says nothing happens. (This is what the hex string "00000000" means.) This is there because lbu needs a minute to think; you can ignore it for now.
andi says to either set register 2 to 0x0010 if Monster Talk is checked, or to zero if Monster Talk is not checked.
bne says to ignore this line if register 2 is zero (no Monster Talk), but jump ahead if register 2 is nonzero (yes Monster Talk).

Step 4: Destroy

0x1899e0:  lbu r2, 0x0091(r2)
0x1899e4: >nop
0x1899e8:  andi r2, r2, 0x0010
0x1899ec:  bne r2, r0, 0x001899fc

So if we can make r2 always equal to zero when we get to the bne, the game will never ever trigger the Monster Talk code.

How do we do that? Well, it's easy to break something, there are lots of ways.
Maybe the most obvious way is to change andi r2, r2, 0x0010 to andi r2, r2, 0x0000. That will make r2 always equal to zero.


You could also change either lbu or andi to

or r2, r0, r0
ori r2, r0, 0x0000
and r2, r2, r0
add r2, r0, r0
addi r2, r0, 0x0000

which are all other ways of saying r2 = 0.

Or you could change bne to bne r0, r0, 0x00198000, so that instead of skipping ahead when r2 != 0, it skips ahead when 0 != 0 - never.


You can go ahead and enter this right now. Click on the Memory pane of the debugger and press CTRL+G, then enter "0x1899e8" - that's where the line of code we want to change is stored. Click on that "10" and type in "00". (It's stored as 1000 instead of 0010 because numbers are stored smallest-to-largest instead of largest-to-smallest.)

Be careful you type exactly two zeroes. Your entries will get screwed up fast if you just type one zero, then click away because it says "00" just like you want. Always type the full two-digit hex byte in.

Now if you click somewhere on the Disassembly window, you should see the line change to "andi r2, r2, 0x0000" to reflect your changes. You just made the hack!

Step 5: Verify and Share

To test your hack, delete your breakpoint (highlight it and press Delete) and press F9 to restart game flow. You should see a 00% success rate. Congratulations, you have made an almost useless skill completely useless!

How do you duplicate your hack? The hack is at RAM location 0x1899e8. Most RAM locations in battle are converted to BATTLE.BIN locations by subtracting 0x67000. So get out the Windows Calculator again and do the subtraction - this hack is at 0x1229e8.


BATTLE_BIN
0x1229e8
00


ASM Tutorial #1: Modifying Code & Reading ASM (to come)
43
Still alive.

Here is a usable Monkeygrip hack (although likely still not perfect). Thanks to FFMaster for his version which inspired me to try again. The support ability bytes are bolded so you can attach it to another Support if desired, although it's a little weirder than usual and only Supports are available, not Reactions or Movements.


WORLD_BIN_BIN
0x40b58
24260508
B93A2390
0x69890
1D80023C
7E9E4290
01006130
10004230
02004014
25180000
25182000
D8820408
00000000
0x40b58
30260508
B93A2290
0x69890
1D80033C
7E9E6390
01004130
10006330
02006014
25100000
25102000
CD910408
00000000
44
Quote from: Pickle Girl Fanboy on October 21, 2011, 10:11:49 pm
Could you possibly optimize character data, to fit the existing data into a smaller space?  I'm sure there are full bytes used to represent something which can only be 1 or 0 in there somewhere.


Sure. It would be a lot of work though.
45
There seems to be some confusion between different kinds of free space (which is understandable because it's confusing).

There are different free spaces. Space is valuable based on how accessible it is in the existing code.

For example, if you edit the ENTD so that Gafgarion never joins the party, his formation sprite is now freespace. It's set up for graphical loading, so it's formation sprite freespace. You don't want code there.

The kanji table in BATTLE.BIN/WORLD.BIN is valuable freespace because it's unused, it's large, and it's always accessible from battle or formation screens. However, it's most useful for code. If I try to save JP data there during battle, what will happen after battle? That JP data will be overwritten when WORLD.BIN is read into RAM. In order to save JP data, I need to put it in a part of RAM that persists after battle - and in order to save it forever, I need to put it somewhere that persists after saving and reloading the game file.

The freespace that compressing JP data would clear is in saved unit data. So while 40 bytes seems trivial because it's only 10 lines of assembly code, this data is already set up to load and save with units. You could use one byte, for instance, to save a unit's permakills and implement the WotL Dark Knight requirement; six bytes to represent a unit's permanent STR/DEX/INT/WIS/CON/CHA; two bytes to save a unit's four favorite foods randomly determined at generation; one byte to save a unit's current weapon enchantment. Or just put more job data back in there.

Of course all of those things would require coding, but they are possible with space in unit data.

There might be some unused space already, but this space you could confidently use without fearing a crash someday which would be nice.

Quote from: Vanya on October 21, 2011, 01:51:24 am
I was drawing up a new job tree that included RAD jobs, but I noticed the core problem with using RAD to combine vanilla jobs is that they then lose their individuality in terms of unlocking further jobs.


That's an interesting point. A learned ability requirement allows you to use RAD jobs as prerequisites. I should probably add that in a future draft, then.

Quote from: Kaijyuu on October 21, 2011, 06:12:14 pm
My ASM experience is with super nintendo games, and they rarely ever use all the available ram space. Does the PS1 have really crappy ram space or something?


It has 2 MB main RAM, which isn't much, but then the SNES has 128 kB. But we are not very good at loading memory files. FFT is also not tightly optimized for space - it was coded in C so it takes up more room than necessary.

It would be very nice to create free space by expanding some files and altering the way the game loads files but that's much trickier stuff than simple ASM hacking.
46
Quote from: RavenOfRazgriz on October 20, 2011, 07:03:43 pm
Even if you freed up all that space, Pokeytax, what the fuck would you do with it?


Permanent unit attributes (e.g. adding eight RAD job slots with distinct JP/learned abilities, indistinguishable from base jobs). But, it's a lot of work for incremental benefit.
47
This proposal has two parts: changing job progression to work from learned skills instead of job level, and freeing up the job level bytes for another purpose. The former just takes some elective surgery on RAD, the latter is hard (rewriting every single instance where these bytes are read or written).

I spent a lot of time thinking about how to clear out unit data for RAD jobs. I think the best way would be to compress JP totals, because those take up 80 bytes (job levels are only ten bytes). If you scrap total JP and back into it from available JP, that frees up 40 bytes. If you capped available JP at 4000 and did some painful maneuvering to store it in 1.5 bytes apiece, that frees up 50 bytes. However, none of this is any fun at all.
48
I've tried it before, because it seems like a natural fit. It's not that easy! But yeah, I really would like a real Doublecast.
49
PSX FFT Hacking / Re: RAD 3: 35 jobs.
October 10, 2011, 11:31:07 pm
Your .xls file is okay. You just need to copy the sheet and save it as .xml correctly. Maybe I need to do the RAD/ALMA video tutorials sometime...
50
PSX FFT Hacking / Re: RAD 3: 35 jobs.
October 10, 2011, 01:38:02 pm
You want to open Notepad and Excel (or Notepad and LibreOffice). Select the 'XML' tab and press Ctrl-A, then Ctrl-C to copy the entire tab. Then select Notepad and press Ctrl-V to paste everything into that and Save As "RAD 3.xml", Save As Type "All Files".

I can attach an .xml file but it won't have the edits you make. There is a .ppf in the OP which opens most special jobs to generics.
51
PSX FFT Hacking / Re: RAD 3: 35 jobs.
October 10, 2011, 10:25:15 am
Your job table is not properly formatted as hex. I'm not sure why this is. What spreadsheet program are you using, and what text editor?

If you are using Excel, you can try pressing the 'Export to .XML' button to create the XML file in the same directory automatically, since that seems to be the trouble step.
52
PSX FFT Hacking / Re: RAD 3: 35 jobs.
October 10, 2011, 01:04:14 am
Quote from: Baribal on October 10, 2011, 01:01:03 am
I did everything with Your instructions and implement .xml format using FFTorgASM...but now i cant change for any class and see just I pick in game.


Post the .xml and/or .xls file you are using (you may need to zip the .xml to attach it to your post).
53
I've never seen anything more than five not provoke a graphical glitch for the player, overwriting the bottom of the menu (which makes sense as five is the maximum in vanilla). I imagine this is fixable, or maybe doesn't show up using a different skillset writing method? I don't know, but if it were as easy as just trying more than five, I woulda done it already.

Quote from: RavenOfRazgriz on October 09, 2011, 05:22:41 pmHad any luck there, Pokeytax, or just not tried in forever?


Haven't tried recently. There's such a lot of world to see...

The passives tab hopefully works! I haven't tested it too extensively because no one has ever wanted to use passives.

"Passives" are bonuses from LEARNED ABILITIES.

The three large columns give passives to active jobs, specific people, and equipped secondaries.
The table on the right determines which attributes are granted.

Part 1: Basic Passives

Let's say you wanted to have learning Accumulate grant PA + 1 (attribute 31).

Accumulate is Squire Ability 1, so set cell CL5 to 31. Now Accumulate is associated with PA + 1, but we have to decide what conditions add this bonus.

If you want units with the job Squire to gain the bonus, check cell C78.
If you want units with Basic Skill secondary to gain the bonus, check cell AZ9 (05 Basic Skill).

You can apply multiple conditions: if you want units to gain +1 PA if they are Squires or have Basic Skill secondary, check both C78 & AZ9.

Part 2: Identities and Freelancers

The middle column lets you give special characters talents that apply outside their base job. For example, let's say that you want to give 1E Holy Knight (Agrias) the RSM "Equip Sword" in her sixth RSM slot, and have it grant her permanent sword availability once learned regardless of job.

In FFTPatcher, go to skillset 28 Holy Sword and set the sixth RSM to Equip Sword.
ALMA attribute '7A' is the Equip Sword attribute, so set cell DG5 to 7A to assign it to Base Class RSM6. Then check cell AV30 to enable Base RSM6 Passives for Identity 1E.

This will let Agrias equip Swords as a Monk once she has learned Equip Sword in her Holy Knight base class, without giving that ability to Squires who learn their RSM6, Move + 1.

You can also have jobs that gain boosts from abilities learned in multiple classes. Let's say you had many passive boosts and wanted to give Mimes access to a weak passive from each job - if you set cell CL46 to 5D Mime, they activate every square checked in the grid above. By default, that's all passives. You can uncheck the ones that are too powerful.

Part 3: The ARH and "Pure Passives"

Learned abilities have a pesky habit of affecting stuff. Even trash like Level Jump5 has an in-game effect when learned. How do you make a true passive ability that just adds +20% HP or whatever? You need to use the ARH to disable the ability in battle. However, with a finite number of ability slots this seems a waste.

I fiddled with the ARH to allow it to disable not just real abilities, but the "special" abilities like Item/Throw/Jump/Charge/Math Skill when used in Normal skillsets. Since these abilities are of limited use to most patches, they make perfect passives. You can use the ARH v1.2 to disable Level Jump5, rename it "Toughness", and then add it to a non-Jump skillset. Instead of showing up as a buggy mess, it won't show up at all, just add its passive bonus when desired.

Feel free to ask more questions as I know it's confusing.
54
Quote from: Vanya on October 09, 2011, 01:35:29 pm
Offhand, do you know the values for Byte 16? That's the byte that stores the current support skill IIRC.


Lots of people (including me) try to read the current support skill this way when starting out. The correct way to read the current support skill is by checking the flags on bytes 8F - 92, because this accounts for innate supports and things you add through ALMA. So just choose Flagged?/Monster Talk or whatever.

QuoteAlso, It seems that 3 extra slots is the max no matter what, yes?


Yes, I hardcoded a limit because the menu has graphical glitches after five options (Attack/Primary/Secondary/Extra/Extra).

QuoteAdditionally, it also seems to overwrite any skillsets granted through any other means. Specifically, through the use of FFTP innate settings and Razele's patches. Is this a limitation of the menu or your hack?


I'm not sure what you mean by FFTP innate settings - this hack does overwrite the normal handling of Equip Change and Defend, so if you want them to work you need them in the Skillsets tab, and it rewrites the menu over Razele's hacks or anyone else's. I couldn't make it compatible with other arbitrary hacks.

QuoteUltimately, the set up I'm after is to let all units have Defend, Equip Change, & Item in addition to the extra commands for Lancer, Samurai, Ninja, etc on a one-at-a-time basis through the use of an associated support ability. Of course, this means merging R/S/M is out of the question.


What you are asking for is eight skillslots, if I understand you correctly (Lancer equipping "Chakra" could have Attack/Dragon Skill/White Magick/Jump/Chakra/Equip Change/Item/Defend). You've got five. Gonna have to make stuff like Equip Change/Defend low priority allowing other stuff to push it off the end of the queue, and force Lancers to equip Jump to get Jump.
55
PSX FFT Hacking / Re: RAD 3: 35 jobs.
October 09, 2011, 01:20:32 pm
Copy all the text on the XML tab into a text editor (e.g. Notepad) and save that file as an .xml file in your FFTPatcher directory.
Run the program "FFTorgASM.exe" and click the RAD box, then "Patch ISO", then find your ISO and click Save.
56
It's an oversight; but you can ignore the dropdown and type it in manually.
57
PSX FFT Hacking / Re: RAD 3: 35 jobs.
October 05, 2011, 07:25:28 pm
Quote from: Vanya on October 01, 2011, 05:30:15 am
Could you explain columns AL, AM & AN?


These let you restrict jobs to certain people (e.g. "Identity Less Than 04" means Ramza only) or require a job level lower than X (so White Mage can be phased out for White Wizard). The boxes at the top set the condition and you can set a value for each job.

Quote
And If I understand correctly any job that shares with Mime will be able to track JP, but won't be able to learn skills, right? Also, if I have a job share with Bard/Dancer then they won't show up for females/males respectively, correct?


Using Bard/Dancer/Mime for job shares is sadly not supported (unless the class in question is male-only or female-only, or is actually 5D Mime). The game hardcodes obstinately around this.

To make a class female-only or male-only, have it require Dancer 1 or Bard 1.
58
Quote from: Vanya on September 30, 2011, 04:26:22 am
I just had a thought. Couldn't I use Xef's Skillset Fix patch to make any skillset work like a "boss" one?


I think that functions for a different part of the code. RAD has a more pertinent check that tells skillsets to mimic existing generic skillsets and reference, say, Learned Ability Slot 4 (Archer) in unit data, but even that isn't quite on the nose.

Adding a way to easily flag skillsets as autolearn, and/or to frankenstein byte 1 of learned Black Magic and byte 1 of learned White Magic into Red Magic, would be a nice improvement, I know.
59
Quote from: Vanya on September 25, 2011, 11:36:39 pm
You mentioned that Izlude's jump skillset is auto learned. Is that true for any other skillsets?


Yes! But, I don't know which, apart from that many of the "boss" skillsets are.

I agree that bypassing Jump skills for a better base mechanic is a better idea all-around.
60
Quote from: Vanya on September 25, 2011, 10:38:02 pm
Does that mean the Lancer class would have Jump as well as their skillset listed in FFTP?


Yep.

QuoteAlso, how would that affect the learned skills, or would it force it to be a dinky jump?


It would default to using Lancer skillslots for 12 Jump. You should probably use 34 Jump for everyone, honestly. Just set it to contain whatever horizontal/vertical range you think Jump ought to be.