Coding

 Reply to this postStart new topic

GTAG Opcode Database

Deji
post Oct 12 2010, 07:45 PM
Post #41


Coding like a Rockstar!

Group Icon

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



I've found a few opcodes by simply thinking "I really need an opcode that does this", then experimenting with related unknown opcodes, so I think trying to find opcodes that should exist is a good way of finding opcodes.

Here are a list of natives that I can't find an opcode for, however are suited to existing in SA:

SANNY
MAKE_ROOM_IN_PLAYER_GANG_FOR_MISSION_PEDS   // gang system in GTA IV is limited to missions?
SET_PLAYER_CAN_BE_HASSLED_BY_GANGS   // SA has situations where CJ is hassled by gangs - there should be an opcode to turn this off
ABORT_ALL_GARAGE_ACTIVITY   // ???
RENDER_WEAPON_PICKUPS_BIGGER   // GTA IV weapons pickups arent really pickups - but objects?
SET_PED_DONT_DO_EVASIVE_DIVES
SET_PARKED_CAR_DENSITY_MULTIPLIER   // it would indeed be handy


etc.

See a full list of natives (with a lot of opcodes linked to them) here.

Don't edit the page. I'm editing the list in a seperate file on my computer wink.gif


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Oct 14 2010, 03:27 PM
Post #42


Coding like a Rockstar!

Group Icon

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



OMG.. REALLY UNIQUE OPCODE!

bunny.gif

Play around with this script:

SANNY
{$CLEO}
0000:
while true
wait 0
if 0ADC:   test_cheat "TEST"
then
04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset -10.0 -10.0 6.0
04C4: store_coords_to 3@ 4@ 5@ from_actor $PLAYER_ACTOR with_offset 10.0 10.0 4.0
0247: load_model #K_POOLBALLCUE
while 8248:   not model #K_POOLBALLCUE available
    wait 0
end
0830: unknown_rectangle_cornerA 0@ 1@ 2@ cornerB 3@ 4@ 5@  // omg! unknown opcode!!!
04C4: store_coords_to 6@ 7@ 8@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 10.0
0107: 9@ = create_object #K_POOLBALLCUE at 6@ 7@ 8@
0392: make_object 9@ moveable 1
0382: set_object 9@ collision_detection 1
0381: throw_object 9@ velocity_in_direction 0.0 0.0 1.0
end
end


Type "TEST" in-game... then move from your location and look up, to see above the spot you were previously.

Look hard enough, and you may see the little white pool ball that has been created in the sky... Feel free to pull out a sniper rifle and shoot it.


The pool ball is in a special collision box, created by 0830. The collision box is like a giant pool table (seriously.. it even has pockets). Objects that support this kind of collision can bounce of the sides and due to the collision rules, objects that can collide with this collision box also can't take off from the ground.

By default the only objects with these collision rules are pool balls, so this opcode is only compatible with them normally. However, modifying the object.dat file can change this:

CODE
; (J) Special Collision Response Cases     
;        0:none(default)
;        1:lampost
;        2:smallbox
;        3:bigbox
;        4:fencepart
;        5:grenade
;        6:SWINGDOOR
;        7:LOCKDOOR
;        8:HANGING
;          9:OB_COL_POOLBALL


Setting any objects flag "J" to 9 will cause it to have this collision behaviour.

SANNY
0830: unknown_rectangle_cornerA 98@ 100@ $tempvar_Float_3 cornerB 99@ 101@ $tempvar_Float_3

>>
SANNY
0830: create_pool_table_collision_cornerA 98@ 100@ $tempvar_Float_3 cornerB 99@ 101@ $tempvar_Float_3


Found by commenting out the line in the pool script, which caused the Pool ball to just roll away (no cushion collision!).


The fun was captured:


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Oct 22 2010, 09:08 PM
Post #43


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



I don't know for other games, but for gta3, these opcodes are written incorrect:
CODE
05E2=3,call_function %1d% num_params %2h% pop %3h%
05E3=4,call_method %1d% struct %2d% num_params %3d% pop %4d%
05E4=4,call_function_method %1d% struct %2d% num_params %3h% pop %4h%

They can contain variable quantity of params, so the values must be "-1"

This post has been edited by DK22: Oct 22 2010, 09:09 PM
Go to the top of the page
 
+Quote Post
Deji
post Oct 24 2010, 09:24 PM
Post #44


Coding like a Rockstar!

Group Icon

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



Fixed, by the way smile.gif

SANNY
0976: destroy_particle 0@


This one appears to be made for missions as it calls a function to remove the particle from the mission cleanup list, so I've added a comment to the opcodes.txt line next to that opcode.


--------------------
Go to the top of the page
 
+Quote Post
Silent
post Oct 25 2010, 12:57 PM
Post #45


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



I think that ZAZ has documented that deeply, cause his scripts have changed those opcode names.
Go to the top of the page
 
+Quote Post
Deji
post Oct 25 2010, 09:39 PM
Post #46


Coding like a Rockstar!

Group Icon

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



New Opcode!
06DF

Modified Opcoode Page
0053


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Oct 26 2010, 10:50 PM
Post #47


Coding like a Rockstar!

Group Icon

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



2 New Opcodes!

0986

SANNY
0986: remove_references_to_all_fires


0828

SANNY
0828: set_max_fire_generations 1


--------------------
Go to the top of the page
 
+Quote Post
Silent
post Oct 31 2010, 09:02 PM
Post #48


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



Almost thought that I've documented 07BF, but I was wrong sad.gif

However I'm sure about that one:

0A23

SANNY
0A23: unknown_panel $2423 unknown_row $2515 flag 0


->

SANNY
0A23: set_panel $2423 row $2515 show_as_bought 0


Setting flag to 1 simply makes text green - used only in clothing shops to highlight bought clothes.

It can be named 'set_row_text_green', or sth.

This post has been edited by Silent: Oct 31 2010, 09:03 PM
Go to the top of the page
 
+Quote Post
Deji
post Nov 4 2010, 03:02 AM
Post #49


Coding like a Rockstar!

Group Icon

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



Opcode Update

08A6 was grossly misnamed. This is for Component B, not A.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 5 2010, 02:59 PM
Post #50


Coding like a Rockstar!

Group Icon

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



New Opcode!

09EB removes the players googles. I only tested on night vision goggles, but I'd assume it works for heat vision ones, too. The parameter controls how the players googles are removed:

0 - Goggles are instantly taken off CJ's head and put in his hand. Night vision turns off.
1 - CJ removes the goggles with the usual animation. Night vision turns off.

Although no GTA IV function appears to exist for this, I'm thinking that "REMOVE_PLAYER_HELMET" may do a similar function, but was of course significantly changed from SA. I can't confirm this without knowing what the parameters are for this native.

Annnd... my internet is slowly running low on fuel. Just wanted to post this quick find.

Cya.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 5 2010, 03:34 PM
Post #51


Coding like a Rockstar!

Group Icon

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



New Opcode!

Hello again.

0A0E disables any currently displayed "styled gxt" with the specified text style.

That description was a bit odd... Here:
SANNY
0ACB: show_styled_text "~y~Testing 123..." time 6000 style 2
wait 1000
0A0E: unknown_text_stuff 2
wait 1000
0ACB: show_styled_text "~y~Testing 321..." time 6000 style 3
wait 1000
0A0E: disable_text_with_style 3


Since any amount of Styled GXT's might be displayable, the opcode only removes ones of a certain style.

This is useful, since a lot of the styled GXTs cannot have the time they last for modified. For example, with style 3, the text will display until the player respawns from being wasted/busted no matter what time you set... But this opcode can provide a simple way through that.


Next opcode in 15 minutes.. maybe?


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 5 2010, 04:36 PM
Post #52


Coding like a Rockstar!

Group Icon

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



New Opcode Lead

lol..

0A13 seems to actually control the camera. Something like linking the camera to the players current position...

It's only used in the external script 'CARMOD'. When you exit the car mods menu, this opcode makes the camera return back to "garage mode". Without it, the camera is near the camera until you move. So something like 0A13: update_player_camera could be accurate. No clue whether this extends to more than just returning the camera while in a garage...


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 5 2010, 05:00 PM
Post #53


Coding like a Rockstar!

Group Icon

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



New Opcode!

My internets lasting longer than I thought it would..

0A20 disables a players ability to command gang members to wait (group control back). If any gang member is currently waiting, they will continue to follow CJ.

I'm wondering if there's a similar opcode for "group control forward"... it might be handy.


Opcode finding spree.. The edit button is overrated.. who wants all that extra scrolling and data download. Not me, since my internet is on it's last few bytes or something...


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 8 2010, 10:18 PM
Post #54


Coding like a Rockstar!

Group Icon

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



New Opcodes!

04F1 >> unknown_is_car_waiting_for_world_collision

A lot of testing went into this. It's used in the Vigilante Missions where it indeed returns true, but I can't manage to get it to return true in the script without memory editing.

SANNY
{$CLEO}
0000:

while true
    wait 0
    if
        0449:   actor $PLAYER_ACTOR in_a_car
    then
        0811: 0@ = actor $PLAYER_ACTOR car_nosave
        if and
            00E1:   player 0 pressed_key 4
            8039:   not 3@ == 1
        then
            0A97: 1@ = car 0@ struct
            000A: 1@ += 0x1C
            0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0
            if 08B7:   test 2@ bit 18
            then 08C3: clear 2@ bit 18
            else 08BD: set 2@ bit 18
            end
            0A8C: write_memory 1@ size 4 value 2@ virtual_protect 0
            0006: 3@ = 1
        else
            0006: 3@ = 0
        end
        if 04F1:   unknown_car_check 0@
        then 0ACD: show_text_highpriority "Yep!" time 1
        else 0ACD: show_text_highpriority "NOP" time 1
        end
    end
end


Press the Secondary Fire key while in a car and it will completely freeze. I added code to revert it on the second press, which doesn't actually work. However, it does change the result of the condition still. Chances are a function on the car would need to be called to fix this issue.

The reason for the freeze might not be related to the particular bit set, but I believe setting it causes the game to change other flags on the car, which could be the cause. It's probably just a bit only used for this purpose, which is never cleared after being initially set.

IS_CAR_WAITING_FOR_WORLD_COLLISION seems to be the appropriate native for this, as I suspected when first seeing it's usage in the main.scm, however I'm still not sure why this returns true when the car has just been created in the Vigilante Missions and not when the car was just created in any of my custom scripts.

It's probably meant to test weather the car has not spawned properly yet. Could be something to do with the rendering around the area the car spawned... to check the car isn't falling underground or something. But the condition only returns true in the Vigilante Missions for a split second.

04F0 >> unknown_is_actor_waiting_for_world_collision $PLAYER_ACTOR

Just like with the vehicle one (you can even set the same bit at the same offset from the actor struct). I've not tested this in the mission it's used in, but it's indeed only used after teleporting the player character somewhere and only on certain missions.

They're both very specific opcodes. However knowing the fact that they both do the same thing, I'm hoping, will make it easier to fully deceipher them. Perhaps someone else will understand what the nature of this opcode is.

0987 >> get_car_blocking_car $1867 store_to $VALET_CAR (GET_CAR_BLOCKING_CAR)

Can't remember why, but I managed to predict what this would be.. probably because I've seen the GTA IV native before. Here's a fun little script:

SANNY
{$CLEO}
0000:

repeat
    wait 0
until 0ADC:   test_cheat "DRIVE"
0247: load_model #ADMIRAL
0247: load_model #BANSHEE
while true
    if or
        8248:   not model #ADMIRAL available
        8248:   not model #BANSHEE available
    jf break
    wait 0
end
00A5: 0@ = create_car #BANSHEE at -356.2157 2532.1189 35.9344
0175: set_car 0@ Z_angle_to 33.3583
00A5: 1@ = create_car #ADMIRAL at -414.5209 2592.2834 43.4147
0175: set_car 1@ Z_angle_to 353.4789
036A: put_actor $PLAYER_ACTOR in_car 0@
00A7: car 0@ drive_to -539.576 2603.4324 53.3077
while true
    wait 0
    0987: unknown_car 0@ unknown_store_car_handle_to 1@   // returns -1 if not found
    if
        056E:   car 1@ defined   // 8039:   not 1@ == -1 - works just as well
    then
        0ACD: show_text_highpriority "Get that piece of crap out of the road!!" time 100
    end
end


Go in game and type "DRIVE" (duh). You will see "Jim Johnson" in a Banshee, driving to work (he's the executive of a major company located in the desert that grinds down rocks in order to create sand.. lucrative, eh?). But what's this... someone left their car in the middle of the road?! *dramatic music*

Jim is forced to stop when the car blocks his path and although you can't hear it (he lost his voice a few months ago when he got excessive amounts of small rocks stuck down his wind pipe) he yells at whoever parked that car to get it out of the way.


Hope people have as much fun with this opcode as I did...


099B >> unknown_enable_car 0@ collision_on_path (or SYNCH_RECORDING_WITH_WATER?)

I can't be assed to make a new car recording to test this tongue.gif I tested one where the car was on land. I used a Lanstalker where the car path was obviously made for a lowrider, so the tall wheels of the Landstalker where squashed down a bit. Once I used this opcode, the wheels popped back up and the car was at normal height..

But.. I also tested this in water. A path obviously made for a boat (yet it still works, lol) and as soon as I activated this opcode, it sank.

So I'm sure it's one of those, but I'm not sure which. Might be a combination of both or something slightly different. Since there is no value, it's actually more probable that the second one is right... A "use once" opcode never used in the main.scm.


09FE >> reset_hydraulics_on_car 0@ (RESET_CAR_WHEELS?)

07A9 >> get_searchlight_on_actor 0@ store_to 1@

Untested, but I'm 97% sure it's right. Anyone who can be bothered setting up multiple searchlights.. mind testing it?

0654 >> make_object 114@(50@,7i) fireproof 1


Opcode Updates

0633 >> AS_actor -1 exit_car

05CF >> AS_actor 102@ exit_car 73@ in_direction 2316.4 -1519.2 24.3 (TASK_LEAVE_CAR_IN_DIRECTION)

05CD >> AS_actor -1 exit_car 22@

062E >> get_actor 2@ task 1560 status_store_to 17@ // ret 7 if not found

This doesn't really need to be labeled "unknown". It does exactly that, returns the status of the chars task.. For some reason, the function replaces -1 with 7 on the return. Probably something to do with 7 being used for something else that is almost equivalent to there being no task (task finished, task inactive etc).


Opcode/GTAIV Function Links

0622 >> TASK_LEAVE_CAR_IMMEDIATELY

Just decided to mention this. It's not so important that the opcode line should be updated, but it should be written down somewhere... This isn't exactly "bail car". If the car is stopped, the actor still gets out normally. It's just a more urgent "get out" than with other opcodes.


Now comes the challenge of updating it all in the database...


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 22 2010, 01:41 PM
Post #55


Coding like a Rockstar!

Group Icon

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



I've seen some weird and wonderful things in the last few days. This is one of the more bizzarre, but revealing things:


SANNY
014B: $1201 = init_parked_car_generator #RANCHER color -1 -1 force_spawn 1 alarm 0 door_lock 0 unknown_ipl_11 0 10000 at -769.9179 2409.6914 157.2509 angle 180.0

>>
SANNY
014B: $1201 = init_car_generator #RANCHER colors -1 -1 force 1 alarm 0 doorlock 0 min_delay 0 max_delay 10000 at -769.9179 2409.6914 157.2509 angle 180.0


I don't quite know how it works. There's even a chance that it doesn't work right... But I'm certain of the params wink.gif Logically thinking, the min delay value specifies the minimum delay until the car appears (since the player got close to the spawn origin), the max may prevent the car from being spawned if it has taken too long to load or something. I assume that "force" overrides this value.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 26 2010, 01:36 PM
Post #56


Coding like a Rockstar!

Group Icon

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



Trying to figure out 08EC... It seems to refer to classes of vehicles. All emergancy vehicles seem to return -1.


I've documented some of the cars and which numbers they return...

CODE
-1 - Monster Truck, Jetmax, Police, HPV-100, Hydra, Stunt Plane, Ambulance, Bloodring Banger, (Train)
0  - Landstalker, Quad, Rancher, Blista Compact, Moonbeam, Bus, Romero, Pizzaboy
1  - Perennial, Voodoo, Greenwood, Bravura, Manana, Previon, Stallion, Rumpo
2  - Sentinel, Washington, Premier, Admiral, Caddy, ZR-350
3  - Alpha, Stretch, Buffalo, Blade, Infernus, Cheetah, BF Injection, Banshee, Hotknife, Comet
4  - Trashmaster, Pony, Linerunner, Dumper, Bobcat, Mr. Whoopee, Packer, Flatbed, Journey, Forklift
5  - Securicar
6  - Taxi, Cabbie
8  - NRG-500, FCR-900,
9  - Speeder
10 - Dhingy
11 - Bike, Mountain Bike, BMX


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 29 2010, 01:54 AM
Post #57


Coding like a Rockstar!

Group Icon

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



00D9 adds the car handle to the mission cleanup list.. however, I believe it also removes the last car got with this opcode from the mission cleanup list (if it exists)... so it's probably worth taking into account!


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Nov 29 2010, 05:13 AM
Post #58


Coding like a Rockstar!

Group Icon

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



New Opcodes!

08A8 simply allows you to see markers attached to entities from a very far distance.

GTA IV: SET_BLIP_MARKER_LONG_DISTANCE ?




0971 synchronizes the water/sea/waves with the current time... Or rather, it resets the water... Odd and useless, really... Yet Rockstar managed to use it for the boat missions (sometimes I feel they add these things for the fun of it).


0991 pauses the currently loaded "soundtrack". This is used after you hold the exit key in the dance minigame:


Here, the soundtrack is playing during pause... which is why no "Bad" text is displayed when the notes were missed.


06DA resets the train directions.



Edit

Opcode Update

0A01 checks if the model is a car in general.


--------------------
Go to the top of the page
 
+Quote Post
Silent
post Nov 29 2010, 03:45 PM
Post #59


The master of cut retort

Group Icon

Posts: 239
From: Warsaw, PL
Joined: 21-July 10



0942 checks whether item with specific textureCRC is cloth. It return false eg. for haircut CRCs or naked CJs torso.
Go to the top of the page
 
+Quote Post
Deji
post Nov 29 2010, 06:39 PM
Post #60


Coding like a Rockstar!

Group Icon

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



0770 makes the target system take precedence towards the character.
0816 prevents the character from chasing their victim. The character would now much rather stand and shoot etc.
0856 disables the character from crouching. Doesn't work on the player character.
087F prevents the character from leaving it's group.
094E mutes the characters pain audio. The last parameter is ignored.
094F unmutes the characters pain audio.

Still searching...


--------------------
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

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