Coding

 Reply to this postStart new topic

GTAG Opcode Database

Deji
post Sep 1 2012, 09:08 PM
Post #181


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Many of us have looked at the use of opcode 062E in the main.scm with a lot of confusion. The only thing that I didn't get about this opcode (after getting over the fact it strangely uses 7 as a 'not found' ID, but that's probably just the same ID it would use for 'finished') is the Task ID's used. It seemed to use Task ID's that weren't used in the IDB or documented as a valid task. There also seemed to be large gaps in the Task ID's (see the list here: https://pastebin.com/aHCwuAii).

So this looks pretty confusing:
062E: unknown_get_actor 0@ task 1593 status_store_to 13@ // ret 7 if NOT found
IF
    04A4:   13@ == 7 // @ == any
THEN
    TASK_LOOK_AT_CHAR 0@ scplayer -1
    062E: unknown_get_actor 0@ task 1466 status_store_to 13@ // ret 7 if NOT found
    if
        04A4:   13@ == 7 // @ == any
    THEN
        TASK_MOVE_MOUTH 0@ -2
    end
    2@ += 1
ELSE
    IF OR
        889B:   NOT unknown_actor_check 0@  // probably IS_SCRIPTED_CONVERSATION_GOING_ON_FOR_CHAR or something
        33@ > 15000
    THEN
        TASK_CLEAR_LOOK_AT 0@
        2@ = 0
        1@ = 0
    END
END


However, the ID's here actually refer to the command ID's used to execute the tasks and not the task ID's themselves, though the opcode accepts task ID's also, which probably explains the gaps in the task ID's... The missing task ID's are simply opcodes that run the tasks.

Task 1593: 0639 AKA TASK_TURN_CHAR_TO_FACE_CHAR
Task 1466: 05BA AKA TASK_MOVE_MOUTH

Still need to look into the conversation stuff a bit more, but I'd say enough us known about 062E to add it to SCR, which is definitely GET_SCRIPT_TASK_STATUS smile.gif


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Sep 2 2012, 11:12 PM
Post #182


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



0594 is interesting. It sets the alpha of vehicles LOD model. However, anything higher than 1 and the wheels seem to lose transparency completely.

In the mission "Don Peyote" this is used to hide some bad car spawning in the background of the intro cutscene. Some bad ped spawns still exist and remain visible in the cutscene, though. They're simply spawned too far away and so they fall through the ground. I think they're supposed to be spawned there to add some background scene effect, randomly spawned and set to act like normal, randomly spawned cars and peds, in an otherwise empty cutscene background. But it failed. And instead of R*'s mission coder removing the bad script, they used this opcode once-off to hide the cars and forgot about the MALE01's that were still spawning, I guess...

I took some screenshots of the cutscene with the bug in place. It was hard to get them properly as the peds fall through the floor too fast. I didn't remove 0594, I just changed the parameter to 255, to show that it's indeed an alpha value, not a boolean.

Fig 1: Failed Car Spawn


Fig 2: Car Fell Through Floor


Fig 2: MALE01 Falling Through Floor


Even though they used the "spawn random ped" command, only MALE01 seems to spawn constantly. Probably because the streaming is turned off during cutscenes, so MALE01 is the only loaded model. I guess that explains why that model is permanently loaded... A failsafe, to avoid crashes.


I'm sure the SA coders did their best, but I should've been paid for the job instead of them tongue.gif


Will add to SCR as SET_VEHICLE_LOD_ALPHA. Known'd a few other unknowns lately that will come out with SCR, which is getting very close to completion now.


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Sep 3 2012, 03:12 AM
Post #183


I will kill you

Posts: 126
Joined: 13-May 11



Great story, Maybe a R* employer should write a book about how development goes, what changed and all that things (Like Half-Life 2: Raising the Bar), R* seem to have much to tell.

Question: Why you didn't update the opcode example in the database, just the description? Downloading the opcodes.txt comes with the opcodes with the recently discovered functions, but in database the example is the old one...

Another thing:
http://gtagmodding.com/opcode-database.php?opcode=0876
QUOTE
Due to a R* programming error, the first 3 parameters, while representing the origin coordinates of the flock, should be passed as integers in order for this command to work.

Not just the first 3, but the first 6.

More one thing:
About a 1 year ago I repported this one, but nothing changed, let me quote it again?
QUOTE
The opcode 0AD5, file seek, in the database have the following info:
QUOTE
- 1: SEEK_SET
- 2: SEEK_CUR
- 3: SEEK_END


But, the correct is:
QUOTE
- 0: SEEK_SET
- 1: SEEK_CUR
- 2: SEEK_END



Go to the top of the page
 
+Quote Post
Deji
post Sep 3 2012, 12:43 PM
Post #184


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Ok, I'll fix those descriptions. But at the moment, the OpcodeDB editing is in v2 'SCR' mode, so any changes I do to the opcodes.txt and sascm.ini lines only affect the upcoming v2 generation (the entire database will be switching to it primarily as it's the normal way opcodes SHOULD be represented). When it's done, the whole database will take a huge leap forward, as all up-to-date SCR keywords, INI lines and examples will be shown in place of the old switched-around ones (though they can still be generated).

EDIT

This is pretty damn wrong:
0A15:   is_car_affected_by_cheats 34@


Instead should be:
0A15:   has_car_been_resprayed 34@


So much more useful. It's used in a mission to set the players car health to 3000 if the car has been resprayed. Usually a repray would only set the health to 1000 (if the health is under that value). So using this command allowed them to control that.

It probably only works for one frame, though.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Sep 6 2012, 01:11 AM
Post #185


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



0648 == SET_SENSE_RANGE

I believe it sets the range that ped events will be triggered, thus also setting affecting the range of the char's response to certain events. So perhaps EVENT_DEAD_PED would be responded to by the character when there is a dead ped however far away from it.


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Sep 7 2012, 08:24 PM
Post #186


I will kill you

Posts: 126
Joined: 13-May 11



CODE
06DA: reset_train_directions
>>
CODE
06DA: remove_references_to_all_trains

in native syntax:
CODE
MARK_MISSION_TRAINS_AS_NO_LONGER_NEEDED


This post has been edited by LINK2012: Sep 7 2012, 08:25 PM
Go to the top of the page
 
+Quote Post
Deji
post Sep 7 2012, 08:39 PM
Post #187


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



QUOTE (LINK2012 @ Sep 7 2012, 09:24 PM) *
CODE
06DA: reset_train_directions
>>
CODE
06DA: remove_references_to_all_trains

in native syntax:
CODE
MARK_MISSION_TRAINS_AS_NO_LONGER_NEEDED


Ah, so it is. Correcting my mistakes now? teehee.gif


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Sep 12 2012, 11:11 PM
Post #188


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



094C
SCR: GET_CHAR_USED_ENTRY_MARKER_COORDINATES

So the last parameter was named to indicate that it recieved and enex ID or interior ID, which is of course completely wrong, but what's weird here is what the last return actually is. It gets the angle of the used entry marker (makes sense since it also gets it's coordinates), but it returns it in radians...
v73 = v71->angle * 0.01745329238474369;  // wtf?!


R* only used this command once, during the burglary missions. And they DID seem to use the angle with no converting:
{2942370} 72@ += 180.0
{2942380} SET_CHAR_HEADING $PLAYER_ACTOR 72@


It's used when daylight is reached and you're still in the house. And it DOES screw up the players heading when you're teleported back out of the house. NOP'ing 6 bytes at 0x477660 should fix this, and be more helful to those who wish to use it.

And to clarify, it only works while in an interior, and returns the coordinates of the marker used to get there. It also works for an entrance marker leading to another interior (e.g. the wardrobe), however if you go from the wardrobe to the original interior, it'll return the position of the wardrobe entrance marker, so be careful using it to get out of safehouses. What's more, the results of using this while not in an interior are undefined. The X coord will return the char handle, and the other 3 returns could be anything, based on what the last command run was. So this is a pretty badly programmed command.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Sep 29 2012, 04:35 PM
Post #189


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



GXT keys for PS2 button icons, as well as the texture index:
CODE
01 UP       ~u~
02 DOWN     ~d~
03 LEFT     ~<~
04 RIGHT    ~>~
05 CROSS    ~x~
06 CIRCLE   ~o~
07 SQUARE   ~q~
08 TRIANGLE ~t~
09 L1       ~k~
10 L2       ~m~
11 L3       ~a~
12 R1       ~j~
13 R2       ~v~
14 R3       ~c~


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Sep 30 2012, 04:41 AM
Post #190


I will kill you

Posts: 126
Joined: 13-May 11



More one opcode with a very wrong description.
CODE
08A3: award_player_mission_respect 1

>>
CODE
08A3: can_have_gang_wars_while_on_mission 1


If you see, this opcode is only set in missions with "territory domination".

EDIT 1:
Also, this opcode can have a better description
CODE
0A03:   is_turf_war_going_on

>>
CODE
0A03:   is_player_involved_in_gang_war


What does this mean?
It's: IF [player provoked war with a gang] OR [is player trying to defend territory]
This won't evaluate true if player has been notified that a gang is trying to get a grove territory, but only if the player came to defend the territory.

EDIT 2:
More gang opcodes with wrong description.
CODE
08AC: hide_gang_areas_on_map 1

>>
CODE
08AC: make_only_one_gang_zone_available_for_war 1


After using this opcode you should also set that zone using 08B3

This post has been edited by LINK2012: Oct 1 2012, 07:53 PM
Go to the top of the page
 
+Quote Post
Deji
post Oct 2 2012, 05:05 PM
Post #191


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Possible values for the task status (from 062E):
// const: task status
//TASK_STATUS_INITIATING = 0 // 7 in scripts
//TASK_STATUS_ACTIVE = 1
//TASK_STATUS_QUEUED = 2
//TASK_STATUS_UNUSED = 3
// something to do with peds group? = 4
// something to do with script brains? = 5
//TASK_STATUS_SECONDARY = 6
//TASK_STATUS_INACTIVE = 7


From the SCR constants.inc file. The names need confirming though (thus is why they're commented out).


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Oct 18 2012, 02:52 PM
Post #192


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



07A4: get_char_task_1560_flags 41@ store_to 119@ 120@

>>
07A4: get_sequence_status 41@ store_timer_to 119@ store_task_to 120@


This returns the progress of the characters task sequence, returning the active tasks timer interval (which I guess is the interval between processing) and ID.

07A0: unknown_actor 41@ unknown_assigned_to_AS 114@ unknown_set 0 unknown_set 3

07A0: task_perform_sequence_from_progress 41@ task_sequence 114@ interval 0 unknown_set 3



Oh yeah, and there's a limit to 8 tasks per sequence, but you can tell the char to perform new sequences within a sequence, and so on...


--------------------
Go to the top of the page
 
+Quote Post
badboy
post Dec 17 2012, 09:32 PM
Post #193


Trained Member

Posts: 76
From: Nederland, NL
Joined: 1-May 12



0364: should have a better description. It also makes the "spotter" walk random if he's not assigned to a path.

This post has been edited by badboy: Dec 19 2012, 05:09 PM
Go to the top of the page
 
+Quote Post
Deji
post Dec 18 2012, 08:04 PM
Post #194


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



No it doesn't.


--------------------
Go to the top of the page
 
+Quote Post
badboy
post Dec 19 2012, 05:08 PM
Post #195


Trained Member

Posts: 76
From: Nederland, NL
Joined: 1-May 12



Sorry, my fault. I released the actors after being spotted, which made them walk around. They were in an enemy gang, so they attacked me some time later as the script was supposed to do.
Go to the top of the page
 
+Quote Post
AlexTMjugador
post Dec 20 2012, 04:48 PM
Post #196


The New Guy!

Posts: 9
Joined: 20-December 12



I don't know if this is a little offtopic, but I had to tell it somewhere whistling.gif

Did anybody noticied that boats are a little abandoned in GTA: SA?

I did a search of opcodes with "boat" using GTAG opcodes.txt in my Sanny Builder and there're only 7 opcodes... also, I think they're poorly described (for example, I noticied that opcode 02DB at 50.0 speed crashes the game on Squalo boat; didn't tested with others). Because of this, I'm going to tell you some opcodes that have to be modified, discovered, etc.

0323 opcode only anchors the boat if the engine is off, and it seems to only weigh anchor if engine is off too.

02D3 doesn't make the boat sail using paths, like 00A7 would do on cars. They just sail to the target on straight lines; it's possible to make a route, but you need sphere checks and all that, because there aren't scm paths for boats.

0430 doesn't put an actor in the specified passenger seat on a boat visually. He just dissapears, altough he's in theory in the boat. As a result of this, I investigated further and I discovered that visual, normal boat passengers are just in turret mode of the boat. Check it recruiting a homie and he'll just enter in turret mode on the boat.

02DB opcode (again) doesn't stops the boat when set at 0.0, like I thought before checking it. It just slows down it, but doesn't stop it and, when reaching the target set with 02D3, the boat turns around and goes in reverse; it's strange, you have to see it thumbsup.gif .

02D4 doesn't stop the boat always. Sometimes it just turns off the engine, but the boat'll continue to sail at a minor speed. I think this is because of 02D3, which seems to force the boat to sail unless using 0323.

NOTE: I know these findings can be wrong, but my intention was to help a little bit to have the perfect opcode database turned.gif .

Oh, I almost forgot: using sascm.ini and opcodes.txt of GTAG opcode database when trying to decompile GTA: SA main.scm give me this error: "Unknown opcode 1203 at offset 1559587". It's fixeable turning IGNORE_UNKNOWN on, but in some, small parts of the main.scm I get strange hex data and messed up checks. Here it is a little example of that:

CODE

// Photo Opportunity original mission

0801:
hex
03 92 00 D6 // Decoded to ANSI, this is: ’�Ö
end
0400: store_coords_to 1 1 2.0 from_object
35@ == 0
jf @SYN1_8933


Also, look at the start:

CODE
// This file was decompiled using sascm.ini published by GTAG (http://gtagmodding.com/opcode-database) on 14.11.2012
DEFINE OBJECTS 389
DEFINE OBJECT (noname)
DEFINE OBJECT INFO // Object number -1
DEFINE OBJECT KEYCARD // Object number -2
...


I don't have SKIP_SCM_HEADER option turned on, so... where's the header?

This post has been edited by AlexTMjugador: Dec 21 2012, 02:27 PM
Go to the top of the page
 
+Quote Post
LINK/2012
post Dec 20 2012, 10:56 PM
Post #197


I will kill you

Posts: 126
Joined: 13-May 11



QUOTE
Oh, I almost forgot: using sascm.ini and opcodes.txt of GTAG opcode database when trying to decompile GTA: SA main.scm give me this error: "Unknown opcode 1203 at offset 1559587". It's fixeable turning IGNORE_UNKNOWN on, but in some, small parts of the main.scm I get strange hex data and messed up checks. Here it is a little example of that:

Indeed, I had this problem and didn't knew the reason, now everything is clear.


QUOTE
I don't have SKIP_SCM_HEADER option turned on, so... where's the header?

He, the header is that objects\mission\external script information...

Go to the top of the page
 
+Quote Post
AlexTMjugador
post Dec 21 2012, 02:25 PM
Post #198


The New Guy!

Posts: 9
Joined: 20-December 12



QUOTE (LINK2012 @ Dec 20 2012, 11:56 PM) *
He, the header is that objects\mission\external script information...


You have all the reason. I meant something like this:

CODE
{$VERSION 3.1.1027}
{$CLEO .cs}


But that it's only for .cs or .cm files thumbsup.gif

This post has been edited by AlexTMjugador: Dec 21 2012, 02:26 PM
Go to the top of the page
 
+Quote Post
Wesser
post Mar 12 2013, 10:46 AM
Post #199


The Assistant

Posts: 84
From: Matera, IT
Joined: 16-June 11



074B's SCR command sounds incorrectly named. It should be DRAW_SPRITE_WITH_FIXED_ROTATION.

Edit: has it been excluded because it takes part of an expansion for IV?

This post has been edited by Wesser: Mar 13 2013, 10:34 AM
Go to the top of the page
 
+Quote Post
fastman92
post Mar 16 2013, 02:05 PM
Post #200


Trained Member

Posts: 77
Joined: 25-October 10



There are plenty of errors in GTAG opcode database, here i will write them down:
CODE
sascm.ini    009B=1,delete_char %1d%
Example    009B: delete_char 18@
Command Name    DELETE_CHAR
Vice City
sascm.ini    009B=1,delete_char %1d%
Example    009B: delete_char $853
Command Name    DELETE_CHAR

Since when SB's Vice City INI file is called sascm.ini?

http://gtagmodding.com/opcode-database/opcode/009B/
This opcode doesn't exist in GTA VC, supported in game: GTA III
There isn't GTA IV command PRINT_WITH_2_NUMBERS_SOON. It's your invented name.

http://gtagmodding.com/opcode-database/opcode/0327/
Command is GET_RANDOM_CAR_OF_TYPE_IN_AREA, but 1) (Returned) Actor handle (Integer) ?
Car has become an char?

http://gtagmodding.com/opcode-database/opcode/0344/
There's no SET_TEXT_CENTRE_SIZE command name in GTA IV anymore.

http://gtagmodding.com/opcode-database/opcode/050B/
This opcode isn't NOP, it doesn't exist in GTA SA anymore. It can't be previously an opcode with 1 parameters in GTA VC and later NOP with 0 parameters in GTA SA.
There's no handler for this opcode in GTA SA, knowing that opcode with 0 parameters may be ignored if there's no handler doesn't mean that this opcode has become a NOP with 0 arguments.

http://gtagmodding.com/opcode-database/opcode/0314/
There's no SET_UNIQUE_JUMPS_TOTAL in GTA IV.

http://gtagmodding.com/opcode-database/opcode/0315/
There's no REGISTER_PASSENGER_DROPPED_OFF_TAXI in GTA IV

http://gtagmodding.com/opcode-database/opcode/0319/
There's no SET_CHAR_RUNNING in GTA IV.
GTA IV command name shouldn't be a synonym for command from other games.
This opcode doesn't exist in GTA SA anymore. It isn't 0319=0,NOP ; set_char_running
To be NOP it should accept two parameters and have handler.

http://gtagmodding.com/opcode-database/opcode/031A/
This command has GTA IV command name: http://gtagmodding.com/opcode-database/opcode/031A/

http://gtagmodding.com/opcode-database/opcode/0158/
There's no POINT_CAMERA_AT_CAR in GTA IV.

http://gtagmodding.com/opcode-database/opcode/00BD/
This opcode doesn't exist in GTA VC, supported in game: GTA III

http://gtagmodding.com/opcode-database/opcode/0463/
This opcode exists not only in GTA SA.
Supported games: III, VC, SA

http://gtagmodding.com/opcode-database/opcode/0454/
This opcode exists not only in GTA SA.
Supported games: III, VC, SA

http://gtagmodding.com/opcode-database/opcode/0152/
This command may have been renamed to SET_ZONE_CAR_INFO.
In Vice City:
CODE
      do
      {
        if ( *(&v136 + (signed __int16)v30) )
        {
          if ( *(int *)((char *)&gangs[0].vehicleMI + v28) == -1 )
            sprintf(
              &Dest,
              "SET_ZONE_CAR_INFO - Gang %d car ratio should be 0 in %s zone\n",
              (signed __int16)v30 + 1,
              zoneName);
        }
        ++v30;
        v28 += 24;
      }


http://gtagmodding.com/opcode-database/opcode/0451/
There's no 0451 in GTA SA, it isn't NOP.

This post has been edited by fastman92: Mar 23 2013, 03:13 PM
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

13 User(s) are reading this topic (13 Guests and 0 Anonymous Users)
0 Members: