Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Shard on 2014-01-15 20:46:13

Title: FF8 Script OpCodes
Post by: Shard on 2014-01-15 20:46:13
This thread will be my notes on opcode usage in FF8's script files and what I'm currently trying to figure out. I'll list everything the wiki doesn't have a page for. I'll remove things from this thread as I add them to the wiki.

UPDATED 3-13-2014

BATTLE
Some battle flags are still unknown
2^0 (+1): unknown, used with the +128 flag in some boss fights, also used in every deep sea research ruins battle
2^3 (+8): unknown, used in bahamut's room, probably for the bahamut battle. When used on +0 battles, prevents XP and items from being earned
2^5 (+32): unknown, used in the scripted fights at Dollet
2^6 (+64): unknown? Used in Laguna Pandora flashback and in Bahamut's room. Also used in some X-ATM battles
2^7 (+128): unknown, used in oilboyle, abaddon, minotaur/sacred and bahamut's "ruby dragon" fights. Also used in the missile base if you choose to fight everybody
2^8 (+256): unknown, used exclusively while trying to board lunatic pandora from Esthar

CTURNL and CTURNR
These functions seem to do the same thing given the same inputs. They both pause script execution while running. L and R don't appear to mean Left or Right (I've tried near rotations, far rotations, and 120 degree rotations (half circle). They always rotate the shortest angle)

EFFECTPLAY2
The first 2 parameters are almost definitely volume controls, but I haven't played much with them. Many sounds have 127 as the first parameter and either 127 or 128 as the second parameter.

It's also unknown why the channel number is a power of 2 rather than just an integer, but this isn't really important.

CLEAR
My suspicion is that this will "reset" the game's memory (temporary variables). It's used in a bunch of debug rooms and in start0 right before it sets up a new game. The problem with testing this is that I don't know very many of the game's variables, so I wouldn't know how to tell what data is being cleared. (Maybe myst6re knows some of them?).

MESMODE and message channels
There seem to be five usable message channels (from 0-4) in FF8's scripts. MESMODE has three options (0-2). Some channels have different behaviors than other channels even when MESMODE sets them to be the same (for example, channel 1 mode 1 stays on the screen while channel 0 mode 1 does not).

UNKNOWN17
This function's only parameter is a field map ID. It is always used in a script before one of the MAPJUMP functions. Maybe it's a preloader?
Title: Re: FF8 Script OpCodes
Post by: Aali on 2014-01-15 22:19:35
Good work, I hope someone will take the time to add this information to the wiki! (Or just give you access to do it yourself)
Title: Re: FF8 Script OpCodes
Post by: halkun on 2014-01-19 18:36:00
I added WIKI access, but this is kind of bugging me... Where did you find the names of the opcodes? The same thing happened with FF7, the opcode names just... "appeared" one day. I've poked in the PC executable and didn't find any reference, is this left over cruft found in the PSX version?
Title: Re: FF8 Script OpCodes
Post by: Shard on 2014-01-19 19:29:48
Actually I'm using Deling to view the script files, so you'll have to ask myst6re.
Title: Re: FF8 Script OpCodes
Post by: halkun on 2014-01-19 19:51:50
That's where the LAST opcodes came from for FF7! What does he know about Final Fantasy that we don't?
Title: Re: FF8 Script OpCodes
Post by: Vehek on 2014-01-19 20:10:56
This is hardly the first time you've asked about the opcode names. In fact, I think it's the third.
Title: Re: FF8 Script OpCodes
Post by: myst6re on 2014-01-19 20:12:54
Where did you find the names of the opcodes?

 ;D ;D

No... seriously... did you really forget that you've already asked twice? :P

http://forums.qhimm.com/index.php?topic=12819.5
http://forums.qhimm.com/index.php?topic=8792.msg111645

And the answer was:

The names are all in one big list in ff8.exe, save for 20 opcodes. Two of them are simple enough, they're left/right shift operations but the other 18 are listed as Unknown[1-18] in a dump.
Title: Re: FF8 Script OpCodes
Post by: halkun on 2014-01-19 21:51:57
Yup! I'm an idiot...

Oh well, we can always look forward to me asking again in another three years or so... :P
Title: Re: FF8 Script OpCodes
Post by: Cyberman on 2014-01-26 16:55:59
Yup! I'm an idiot...

Oh well, we can always look forward to me asking again in another three years or so... :P
Well halkun the best thing about this is, it keeps us ALL humble cause we all do it. Of course I forget the first thing that goes as you get older ...

I'm probably one of a few people who actually STILL have tag lines on USENET and EMAIL hehehe.  My current one says this:

Please be advised what was said may be absolutely wrong, and hereby this disclaimer follows.  I reserve the right to be wrong and admit I was wrong in front of the entire world. It won't be the first or the last in all likelyness.

For you I guess it should say  "I reserve the right to forget ..." it won't be the uh... what was I talking about?" :D

Regarding Opcodes COOL!

Thanks for anything one contributes. I keep forgetting to fire up PCSX (cause I run Linux and PCSX has some really old linux code in it sadly).

Cyb