• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
April 27, 2024, 05:13:26 pm

News:

Use of ePSXe before 2.0 is highly discouraged. Mednafen, RetroArch, and Duckstation are recommended for playing/testing, pSX is recommended for debugging.


Editing World Events & Drawing

Started by Xifanie, May 03, 2009, 05:21:19 pm

Kaije

June 15, 2009, 04:45:54 pm #20 Last Edit: December 31, 1969, 07:00:00 pm by Kaije
Okay, I've managed to scrounge up some time to skim through Zodiac's spreadsheet.

Commands for drawing locations appear to be 16 bytes, for drawing roads are 18 bytes, and the basic storyline events are 12 bytes. There's still 3-4 more command structures that I haven't even looked at yet...

Here's the entries from Gariland Magic City:

0100 6D00 0000 0100 6E00 0100 1D00 0000
???? ???? ???? ???? aaaa bbbb ???? ????

0100 2F02 0000 0100 6E00 0100 2000 0600 1800
???? cccc ???? ???? aaaa bbbb dddd eeee ffff

0100 1802 0000 0100 6E00 0100 2200 1800
???? cccc ???? ???? aaaa bbbb dddd gggg

0100 2D02 0000 0100 6E00 0100 2000 1800 0200
???? cccc ???? ???? aaaa bbbb dddd eeee ffff

0100 0202 0000 0100 6E00 0100 2200 0200
???? cccc ???? ???? aaaa bbbb dddd gggg

0100 6E00 0100 1900 0D00 0200
???? aaaa bbbb dddd hhhh iiii


Legend:
aaaa = Condition to be checked, 6E00 being for the main storyline.
bbbb = Value associated with 'aaaa' that is required for the event to trigger.
cccc = Address of location or road to be drawn
dddd = I'm not sure, but the pattern is 1900 = storyline event, 2000 = draw road, & 2200 = draw location
eeee = ID to draw path from, ie 0600 = Gariland Magic City
ffff = ID to draw path to, ie 1800 = Mandalia Plains
gggg = ID of location to be drawn, ie 0200 = Igros Castle
hhhh = ID of the "intial" storyline event, most likely points to Attack.out beginning at 0x10938
iiii = Possibly the event trigger, 0100 = On enter, 0200 = On exit (Just a guess)

This is just from skimming through the code and comparing it to other info from this site... I haven't had the time to test any of it, so if someone has some free time feel free to or I'll get back to it in about a week or so.

*Editted to improve format...

LastingDawn

June 15, 2009, 04:57:55 pm #21 Last Edit: December 31, 1969, 07:00:00 pm by LastingDawn
Whoa! Great work, Kaije! I take it you have some experience in these dealings?
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Xifanie

June 15, 2009, 08:16:56 pm #22 Last Edit: December 31, 1969, 07:00:00 pm by Xifanie
Nice, especially with the paths, I have been wondering a lot how the game would know from which location it would start drawing from. Heck I though it was fixed and not easily editable.

iiii is interesting because if you hack and are on the location of the next event, if you enter & exit a menu (world menu, shop, etc.) the event will trigger just like trying to exit the location.

I look forward to more work of yours; we barely have anyone that does this kind of testing.
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

Cheetah

June 15, 2009, 10:56:41 pm #23 Last Edit: December 31, 1969, 07:00:00 pm by Cheetah
Very nice Kaije. This is very good and very necessary work. Since this contains address of stuff this also opens up the possibility of creating more battles since there is unused space after event instructions in ATTACK.OUT right? Also remember that there are also instructions for activating mid battle events in ATTACK.OUT, perhaps some of the unknowns are address for that information?

Awesome, Awesome, Awesome.
Current Projects:

Kaije

June 16, 2009, 01:34:44 am #24 Last Edit: December 31, 1969, 07:00:00 pm by Kaije
Quote from: "LastingDawn"Whoa! Great work, Kaije! I take it you have some experience in these dealings?

Thanks, but I don't have any real experience with this. I'm just not afraid to use a hex editor... Besides Zodiac and gomtuu have done most of the grunt work, I'm just connecting the dots with some of the info they've posted.

Quote from: "Zodiac"Nice, especially with the paths, I have been wondering a lot how the game would know from which location it would start drawing from. Heck I though it was fixed and not easily editable.

iiii is interesting because if you hack and are on the location of the next event, if you enter & exit a menu (world menu, shop, etc.) the event will trigger just like trying to exit the location.

I look forward to more work of yours; we barely have anyone that does this kind of testing.

Yeah, I'll get around to some more thorough testing towards the end of the week. And thanks for posting the event instructions on the main site, I would never have been able to make sense of any of this without it.

Quote from: "Cheetah"Very nice Kaije. This is very good and very necessary work. Since this contains address of stuff this also opens up the possibility of creating more battles since there is unused space after event instructions in ATTACK.OUT right? Also remember that there are also instructions for activating mid battle events in ATTACK.OUT, perhaps some of the unknowns are address for that information?

Awesome, Awesome, Awesome.

Well, it just so happens I was poking around in Attack.out a few weeks ago. I don't know how far the community has come on deciphering Attack.out, but I suppose it won't hurt to revisit it since it is kind of relevant to what we're doing in this thread.

The following code was originally posted by gomtuu in the "Maps" thread of the Hacking/Patching Tools section:

First line:
0x10938: 0100 3E00 0033 3400 0100 0000 0000 0000 0100 0000 0000 0000
         AAAA BBCC DDEE FFGG GGHH HHII II          ZZ xxxx xxxx JJJJ

Last line:
0x10950: 0200 3E00 0033 3400 0100 0000 0000 0000 0100 0300 8100 0000
              xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx KKKK LL   xxxx


x = duplicate, ignored data
A = Scenario number: 1
    (Just an index for this list, apparently.
    Also, whichever event is numbered "1" always plays first.)
B = Map number: 0x3e
    (MAP/MAP062.GNS)
C = Weather: 0
    (Doesn't influence whether the rain animations are used)
D = Day/Night: 0
    0 = Day
    1 = Night
E = First Music file: 0x33
    (SOUND/MUSIC_51.SMD)
F = Second Music file: 0x34
    (SOUND/MUSIC_52.SMD)
G = ENTD entry: 0x0100
    (Looks like this matches the "Game Events" list.)
H = Character placement grid, 1st Squad
    (Placement grids are found in ATTACK.OUT at 0xbbd4)
    (For first scenario, using this makes the placement screen garbled.)
I = Character placement grid, 2nd Squad
J = Event script: 0
    (Scenario 1 seems to be a special case because Event Script 0
    plays just fine. Using Event Script 0 on scenario 3 causes wrong
    text to display.)
    (Also seems to control which scenario block the "next scenario"
    byte is read from)
K = Next scenario: 3
    (As indexed by A)
L = 0x80 = World map follows this scenario
    0x81 = Another event follows this scenario (K)
    0x82 = Game reset follows this scenario (side effect, or intneded?)
Z = Not sure yet, but setting it to 1 makes Ramza mandatory on
    character placement screen

I don't doubt gomtuu's findings when he posted this, but from what I saw the Scenario data is neatly structured in sections of 24 bytes.
Unfortunately, gomtuu's legend overlaps into the next event (0x10950 = 02). And as gomtuu noticed, every event is 'duplicated' at least once...

Now let's look at the attack.out code for the fight outside Orbonne Monastery beginning at 0x10968:

0300 3802 0034 0C83 0100 0000 0000 0000 0000 0000 0000 0100
0400 3802 0034 0C83 0100 0000 0000 0000 0000 0000 0000 0000
0500 3802 0034 0C83 0100 0000 0000 0000 0000 0000 0000 0000
0600 3802 0034 0C83 0100 0000 0000 0000 0000 0700 8100 0000
AAAA BBCC DDEE FFGG GGHH HHII II          ZZ KKKK LL


I didn't understand why there would be 'duplicate' entries until I decompiled the events and learned that there was a 'pre-event' event that doesn't get decompiled. Basically, every single event gets it's own entry in Attack.out and we have no clue what the first 'event' of any given scene actually does.

So unless you guys know more about this and I just haven't stumbled upon it, adding new battles is a long way off. We'll need to find/make room in Attack.out & Wldcore.bin, as well as expand Test.evt & the Entd files at the very least - unless I'm mistaken.

Cheetah

June 16, 2009, 02:44:43 am #25 Last Edit: December 31, 1969, 07:00:00 pm by Cheetah
Oh I hope I'm not confusing things, because I wasn't following exactly what you were saying because I was unsure as to what file you were talking about decompiling. But I will say this and maybe it will help.

In attack.out JJJJ is the event script number, and this is the value that references where in test.evt to start reading event instructions from. Where the address for these pointers is is still unknown as far as I know.

If you take a look at the Mid Battle event instructions from Attack.out it may make the entire structure make a bit more sense: http://www.ffhacktics.com/forum/viewtopic.php?t=1961

I'm not sure that was at all helpful, but hopefully it will enlighten you somewhat. I'm too tired to process this information correctly right now.
Current Projects:

LastingDawn

June 16, 2009, 02:25:53 pm #26 Last Edit: December 31, 1969, 07:00:00 pm by LastingDawn
Ah, yes what you are referring to at the end Kaije is the "setup" entry, it includes the Actual Music, the event number used, and a few other odds and ends that exists only in the scenario setup. The reason this is done is to run an event from that and use the other as relative "buffers" for midbattle events. For instance...

Quote0300 3802 0034 0C83 0100 0000 0000 0000 0000 0000 0000 0100
0400 3802 0034 0C83 0100 0000 0000 0000 0000 0000 0000 0000
0500 3802 0034 0C83 0100 0000 0000 0000 0000 0000 0000 0000
0600 3802 0034 0C83 0100 0000 0000 0000 0000 0700 8100 0000

0300 - Orbonne Battle Setup
0400 - Orbonne Battle
0500 - Gafgarion and Agrias chat
0600 - Orbonne Battle conclusion

This is all explored in depth in our wiki, if you haven't read it, I deeply suggest that you do. With your skills I'm sure you can find so much more out with the info. as such available.

ffhacktics.com/wiki
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Kaije

June 16, 2009, 08:26:24 pm #27 Last Edit: December 31, 1969, 07:00:00 pm by Kaije
Yeah, I'll give it Attack.out a better look once I'm through with Wldcore.bin. With that said, I actually had time to run some tests today...

0100 2F02 0000 0100 6E00 0100 2000 0600 1800
???? cccc ???? ???? aaaa bbbb dddd eeee ffff

0100 1802 0000 0100 6E00 0100 2200 1800
???? cccc ???? ???? aaaa bbbb dddd gggg

0100 2D02 0000 0100 6E00 0100 2000 1800 0200
???? cccc ???? ???? aaaa bbbb dddd eeee ffff

0100 0202 0000 0100 6E00 0100 2200 0200
???? cccc ???? ???? aaaa bbbb dddd gggg

0100 6E00 0100 1900 0D00 0200
???? aaaa bbbb dddd hhhh iiii


Everything worked the way I thought it would except for the "iiii" - I've no idea what else it could mean right now.

LastingDawn

June 17, 2009, 12:20:51 pm #28 Last Edit: December 31, 1969, 07:00:00 pm by LastingDawn
Wait... does that mean you could connect a dot from let's say... Murond Death City to the Deep Dungeon for instance?
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Kaije

June 17, 2009, 01:40:48 pm #29 Last Edit: December 31, 1969, 07:00:00 pm by Kaije
Well, prepare yourself for a long anwer that isn't straight forward...

Possibly, but it's not likely... I'm not quite sure how this works exactly, which is why I didn't try to explain it in my previous post, but we're limited to what we can do with this code. Let's take my Gariland Magic City example, it has six entries (the first one being unique and I don't know what it's for) two of which are for auto-drawing locations, two more for auto-drawing roads, and the final one for Balbanes death flashback.

Most of my testing was drawing Igros Castle - Road to Mandalia - Mandalia Plains - Road to Gariland, and then have the Mandalia Plains event trigger on exit. The drawing occurs in the order the line entries are listed, so I reordered the entries through a hex editor and it froze the game. I suspected as much, yet I had to 'know' - those entries are referenced by pointers and the unequal byte lengths are a killer for mixing things up in game. Basically, the closest I could get to having things draw backwards was drawing the road from Igros to Mandalia, next Igros, then the road from Mandalia to Gariland, and finally Mandalia Plains - all of which looks very odd in game.

Also it's important to note that roads end before a location and you cannot pass through the void without a location present. So unless soemone expands and rewrites the code and pointers, it would be best to have roads and locations drawn from a Test.evt event. I suspect since storyline event commands are the shortest in bytes that they can replace the original draw commands, but even this will have it's limits. My theory as of now is, the game only checks the code entries for any given location when you are in fact on that location... so we still won't be able to add more storyline events to any place that only has one or none entries attributed to it.

I still have much more work to do to understand it all better, but it's a start... Any of that make sense or actually answer your question?

LastingDawn

June 17, 2009, 03:03:50 pm #30 Last Edit: December 31, 1969, 07:00:00 pm by LastingDawn
Indeed, it's basically a "maybe, but doubtful" sort of scenario. Test.evt is more then likely the way to go for the majority of it, but this allows us to control order of events, also if we can figure out what makes the Mustadio relevant sidequests activate we can change that to basically anything we want... this is a grand start though! It's another piece to a fragmented puzzle.
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Cheetah

June 17, 2009, 06:51:19 pm #31 Last Edit: December 31, 1969, 07:00:00 pm by Cheetah
Good answer Kaije, that makes sense. Still good news and you are definitely finding stuff that is pointing us in the correct direction. Keep it up!
Current Projects:

Xifanie

June 17, 2009, 08:04:15 pm #32 Last Edit: December 31, 1969, 07:00:00 pm by Xifanie
My spreadsheet already covers the pointer, and IIRC there is a lot of free space you can use to add world map events there.
If you want to move a line, make sure you copy/paste and not 'cut'.

Are you just hexing manually? because since the spreadsheet already generates all the pointer values I feel it would be a waste of time.

Oh, as for the structure:
Each world map location has a pointer, and it will continue reading until the next pointer. Concerning the storyline progress, if you want a specific value or something, you should use the Event Decompiler and find instructions like ADD(x006E,x002A). By checking the text, you can easily determine when world map events will activate.
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

Kaije

June 17, 2009, 11:18:39 pm #33 Last Edit: December 31, 1969, 07:00:00 pm by Kaije
Well Zodiac, I think I have some work for you... For the Beowulf side quest in Goland Coal City, there's two entries with the second one being the first mission with Beowulf. My memory is a bit hazy here, but aren't the following missions with Beowulf selected from a menu on the world map? I don't see anything in your spreadsheet linking to any of the scenes/battles/events accessed via the menu, so that's my job for ya when you get some spare time.

And yes, I prefer to hex manually... Someone else should confirm or correct any of my findings at some point in time, or so I would hope.

karsten

June 18, 2009, 03:12:25 am #34 Last Edit: December 31, 1969, 07:00:00 pm by karsten
i think the city just turns red after talking with beo

Kaije

June 20, 2009, 05:31:58 pm #35 Last Edit: December 31, 1969, 07:00:00 pm by Kaije
I haven't had much time to look at this the past few days, but I did forget to mention the erase codes last time...

0100 2F02 0000 0100 6E00 0100 2000 0600 1800
???? cccc ???? ???? aaaa bbbb dddd eeee ffff

0100 1802 0000 0100 6E00 0100 2200 1800
???? cccc ???? ???? aaaa bbbb dddd gggg

0100 6E00 0100 1900 0D00 0200
???? aaaa bbbb dddd hhhh iiii

Legend:
aaaa = Condition to be checked
bbbb = Value associated with 'aaaa' that is required for the event to trigger.
cccc = Address of location or road to be drawn
dddd = I'm not sure, but the pattern is 1900 = storyline event, 2000 = draw road, 2100 = erase road, 2200 = draw location, 2300 = erase location, 2400 = ???
eeee = ID to draw path from
ffff = ID to draw path to
gggg = ID of location to be drawn
hhhh = ID of the "setup" storyline event
iiii = ???


I was going over Mustadio's and Beowulf's events, but haven't made a whole lot of progress as of yet. I'll also be away on business for about a week, so it'll be a while before I can get back to any of this or give an update.

Xifanie

July 08, 2009, 02:43:33 pm #36 Last Edit: December 31, 1969, 07:00:00 pm by Xifanie
Structure:
Conditions, Actions

Refer to http://www.ffhacktics.com/instructions.php?id=B0 for Integer IDs.

Conditions
0100 6E00 1F00 (check if storyline progress = 0x001F)
AAAA BBBB CCCC
AAAA = 0x0001
BBBB = Integer ID
CCCC = Integer Value to compare
If get_value(BBBB) = CCCC then continue
else quit

Actions
2200 0D00 (draw Bevernia Free City)
DDDD EEEE
DDDD = 0x0022
EEEE = Location ID
Make sure you create a condition to only draw the location if it wasn't already drawn. Example:
0x0001 0x020D 0x0000 or 01000D020000 (checks Bevernia Free City)
2000 1F00 0700 (draw path from Yuguo Woods to Yardow Fort City)
FFFF GGGG HHHH
FFFF = 0x0020
GGGG = Path to draw FROM
HHHH = Path to draw TO
Make sure you create a condition to only draw the path if it wasn't already drawn. Example:
0x0001 0x023A 0x0000 or 0100 3A02 0000 (checks Yuguo Woods - Yardow Fort City path)
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful

LastingDawn

July 13, 2009, 03:17:08 pm #37 Last Edit: July 14, 2009, 01:43:42 am by LastingDawn
Well Zodiac was on quite a roll last night! He basically cracked all of the unknowns in here (as well as his list right above helps)

We know how every sidequest in the game is activated and ran now.

May I say it is Much simpler then I ever personally anticipated. Want to kill Mustadio but also get the rest of the sidequests? Want to make a sidequest requiring Cloud? Or perhaps you're adventurous and want a sidequest that requires Kletian, Vormav, and Rofel. Though maybe you don't care much for a party, but are a treasure hunter... well how about making sidequests dependent on the Treasures you've acquired? In any case, such possibilities are no longer pipe dreams!

Allow me to explain...



Let us begin with the first optional event...

Steel Ball Found!

In Goug Machine City, let's bring up the hex that decides this...

0100 9400 0100 0100 4D03 0000 0100 9900 0000 0400 1600 0100 9A00 0000 1900 D200 0200


AAAA BBBB CCCC AAAA BBBB CCCC AAAA BBBB CCCC DDDD EEEE AAAA BBBB CCCC FFFF GGGG HHHH

A - if (B=C){continue} else {quit}

D - if unit E is in roster continue else quit

F - ???

G - Scenario Number (Refer to the wiki entry on Event order and Correlation)

H - End?





The event underneath that reference is the same but instead has a True for Aquarius and a 00D4 for Scenario. That's to awaken Worker 8.

Below that is the Odd Machine event, which occurs if you don't have the Cancer stone, the event below that (Summon Cloud) occurs only if you have the Cancer stone (and presumably if you've seen the event prior).

Zodiac has said that there is probably much more that can be done then the game shows, such as an event that occurs when you have over 65,536 Gil in any location, and I'm willing to bet that Undiscovered Lands could also play a part.
Really... even Biographies could play a part. There is So Much possibility here! And now that we have it in our hands I hope you fine folk use it to the best.[/quote]
"Moment's anger can revert to joy,
sadness can be turned to delight.
A nation destroyed cannot be restored,
the dead brought back to life."

Art of War

Beta & Gretchen Forever!!!!

Kaijyuu

July 13, 2009, 07:08:25 pm #38 Last Edit: December 31, 1969, 07:00:00 pm by Kaijyuu
I've always been bad at converting hex to code manually...

I figure I'll start with something easy. Say I want to take the Igros castle completion requirement away from the cloud recruitment battle at Zarghidas. There seems to be a bunch of conditions; is there any way I can tell which does what beforehand? Or would I have to mess with each condition to figure out what it does?


EDIT: Side question... I need a hex editor that doesn't suck. Every one I've tried keeps trying to insert the code generated by Zodiac's spreadsheet as text, instead of hex. Ex: http://img124.imageshack.us/img124/4993/facepalm.png

Any suggestions? :P
  • Modding version: PSX

Xifanie

July 14, 2009, 01:12:43 am #39 Last Edit: December 31, 1969, 07:00:00 pm by Xifanie
Um LD, you should use
Not only does it allow multiple spaces, but it uses the courrier font which makes every character the same width.

I'm not even sure myself of how you wanted it to look like, so I'll let you do it.

Just type it in notepad, when it looks good copy & paste in your post and wrap in a [code] tag.
  • Modding version: PSX
Love what you're seeing? https://supportus.ffhacktics.com/ 💜 it's really appreciated

Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)
<R999> My target market is not FFT mod players
<Raijinili> remember that? it was awful