Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Squall78 on 2006-12-22 14:53:15

Title: About some OPCODES...
Post by: Squall78 on 2006-12-22 14:53:15
Hi !

I need to decode all opcodes for my project and I used WikiQhimm to find the length of each OPCODE (op + args).

But I've found another length on this topic : http://forums.qhimm.com/index.php?topic=3134.0 :

0x07 : WikiQhimm = 1   ;   halkun = 5 - 1 = 4      (-1 for the opcode)
0x5D : WikiQhimm = 8   ;   halkun = 10 - 1 = 9      (-1 for the opcode)
0xC1 : WikiQhimm = 11  ;   halkun = 8 - 1 = 7       (-1 for the opcode)

Well, who is right ?
Title: Re: About some OPCODES...
Post by: Akari on 2006-12-22 15:23:43
Wiki is the most reliable thing! =)

2 Synergy Blades: Dont you think that 0xAB TURA is the turn to entity like DIRA and MOVA.
Title: Re: About some OPCODES...
Post by: Synergy Blades on 2006-12-22 18:21:57
I've been PM'ing and sent the right lengths for the one he was after.

Akari: Yes. But I decided not to fill in that one as I had with DIRA cos I cannot fully understand what the "anticlockwise" value relates to. So I thought I'd leave it, and any other turning ones, until I knew exactly what it did, as most of the direction/turn/etc. opcodes use this argument.
Title: Re: About some OPCODES...
Post by: Squall78 on 2006-12-23 10:01:04
Hi !

I've fixed values using QhimmWiki ones and (when they're missed) Synergy Blades ones.
But in anfrst_1 level file, I found OPcode 0x1B while it's marked 'unused' by QhimmWiki and Synergy Blades.

Are my values wrong or is it possible these 'unused' values are, in fact, used ?
What do you think ? :)
Title: Re: About some OPCODES...
Post by: Synergy Blades on 2006-12-23 12:27:49
Your values are wrong. Use Meteor & check it against your output.
Title: Re: About some OPCODES...
Post by: Squall78 on 2006-12-23 13:05:29
I checked my values (Wiki + Meteor for unknown values) and I found 0x1B opcodes.

So there are wrong values on QhimmWiki or Meteor (or both)...
Title: Re: About some OPCODES...
Post by: Synergy Blades on 2006-12-23 14:34:13
Well, as I suggested, use Meteor and find out where your script decoding is going wrong since there is no 1B opcode. I've just had a quick flick over that field with Meteor and there are no unusual opcodes appearing. This way, you can see which opcode is causing your output to be incorrect and you can fix it in your program.
Title: Re: About some OPCODES...
Post by: Squall78 on 2006-12-23 15:51:31
Yeah but as I noticed you, there were some mistakes in Meteor with length of arguments...

However, I checked my values (copied from Wiki) and there were some errors. lol ... so...
Title: Re: About some OPCODES...
Post by: Synergy Blades on 2006-12-23 15:56:17
No, the file I sent you via PM is not the same one that the current version of Meteor uses; the current Meteor uses an internal table of opcodes. The file I sent does have mistakes as I haven't finished it as yet. On the contrary, if you check the Meteor output for the current version, with the field anfrst_1 file, the output is correct for every script. So as I said, use that output, check it against what you have.
Title: Re: About some OPCODES...
Post by: Synergy Blades on 2006-12-23 16:22:32
Maybe this'll help you nail your problem, and you can do this method for any other length issues you have. Here are all occurences of a "1B" in the script for anfrst_1.

Entity: dir, Script 1: SETWORD (60,1B,08,00)
Entity: ujp0, Script 1: IFSW (66,00,00,1B,00,00,03)
Entity: cl, Script 20: JUMP (00,00,1B,01,B5,FD,94,00,14,00)
Entity: ti, Script 20: JUMP (00,00,1B,01,B5,FD,94,00,14,00)
Entity: cid, Script 20: JUMP (00,00,1B,01,B5,FD,94,00,14,00)
Entity: bat0, Script 2: IFUB (50,09,00,00,1B)
Entity: bat0, Script 4: IFUB (50,11,00,00,1B), IFUB (50,12,00,00,1B), IFUB (50,13,00,00,1B)
Entity: bat1, Script 2: IFUB (50,09,00,00,1B)
Entity: bat1, Script 4: IFUB (50,11,00,00,1B), IFUB (50,12,00,00,1B), IFUB (50,13,00,00,1B)
Entity: fro0, Script 2: IFUB (50,09,00,00,1B)
Entity: fro1, Script 2: IFUB (50,09,00,00,1B)
Title: Re: About some OPCODES...
Post by: Squall78 on 2006-12-23 17:39:45
I've notified a problem !

In QhimmWiki is 0x75 with a length of 11 bytes.
While you use a length of 7 bytes.

In this Wiki page we can see that the table contains 'C1'... well, a mistake on this page ? So is it 7 ?
Title: Re: About some OPCODES...
Post by: Synergy Blades on 2006-12-23 17:49:44
Well spotted, those shorts should be bytes (same as PXYZI), must have copied that entry from PXYZI which I recently corrected. Wiki updated.
Title: Re: About some OPCODES...
Post by: Squall78 on 2006-12-23 17:54:34
Huuu... updated but now there is a length of 8 bytes while Meteor displays 7 =/

PS : and in the table it's still 0xC1 :p
Title: Re: About some OPCODES...
Post by: Synergy Blades on 2006-12-23 18:52:16
Erm.. nope, P/A XYZI have seven arguments in the wiki... as per Meteor. In the table, 0xC1 is AXYZI, 0x75 is PXYZI. I don't see the problem.

[Edit] Yep, I forgot to update the text of the "I" argument and the table value, but that should have been fairly obvious from the diagram/description/AXYZI, and from Meteor...  :-P
Title: Re: About some OPCODES...
Post by: Squall78 on 2006-12-23 19:01:32
Yes it was on the 0x75 page : it was written 0xC1 in the table.

All is fixed now thanks :^p
Title: Re: About some OPCODES...
Post by: Squall78 on 2007-01-03 09:32:06
I'm trying to resize Windows and I've found a strange thing.

In astage_b level, for dialogs, there are NOT WINDOW opcodes... only WSIZW and MESSAGE.

Beginning of the file (from Meteor) :
MUSIC (00)
UC (01)
MENU2 (01)
RET ()
FADEW ()
WSIZW (00,12,00,00,00,0B,01,39,00)
MESSAGE (01,01)

How MESSAGE opcode can display a window while there is not WINDOW opcode previously ?
And what window WSIZW resizes while there is not WINDOW opcode previously ?
Title: Re: About some OPCODES...
Post by: Akari on 2007-01-03 13:00:36
I'm trying to resize Windows and I've found a strange thing.

In astage_b level, for dialogs, there are NOT WINDOW opcodes... only WSIZW and MESSAGE.

Beginning of the file (from Meteor) :
MUSIC (00)
UC (01)
MENU2 (01)
RET ()
FADEW ()
WSIZW (00,12,00,00,00,0B,01,39,00)
MESSAGE (01,01)

How MESSAGE opcode can display a window while there is not WINDOW opcode previously ?
And what window WSIZW resizes while there is not WINDOW opcode previously ?

There is no need for WINDOW to be called first. It seems that fixed number of scructures that contains window data exist. If we call MESSAGE - it use data from structure specified by window_id, but there are default values anyway, so we don't need to actually call WINDOW to set some parameters.

This is my opinion on how it works.
Title: Re: About some OPCODES...
Post by: Cyberman on 2007-01-04 01:39:53
Are there some default window ID's? I thought there were some that were defined at the start of the game or some such.
Code: [Select]
WSIZW (00,12,00,00,00,0B,01,39,00)translates to
Code: [Select]
WSIZW (0, 18, 0, 267, 57) That's roughly 29 characters by 4 lines (with edge space) window 0 ... seems pretty low on the window pile.

Cyb
Title: Re: About some OPCODES...
Post by: Squall78 on 2007-01-04 09:16:51
In fact, this is the very beginning of the script. That's why I wonder where is the Window 01.
Only Window 00 is created (owing to WSIZW (00,12,00,00,00,0B,01,39,00)) but Message opcode seems to display a Window 01 (which is not created before).