Coding

 Reply to this postStart new topic

A theory about 004F and 00D7

LINK/2012
post Apr 29 2012, 11:16 PM
Post #1


I will kill you

Posts: 126
Joined: 13-May 11



One common question in SCM Coding is:
What is the difference between 004F and 00D7?
Well the answer is simple:
004F can send args to the new script and 00D7 not.

Yeah, that's right, but is it just that?
Let's take a look in some facts and maybe we have more one difference between both.

Let's start in GTA III SCM, that we have part of the source code, missing main.sc.

At line 1096 (decompild in Sanny), we have the threads creation.
CODE
004F: create_thread @NONAME_4
004F: create_thread @NONAME_5
004F: create_thread @NONAME_6
004F: create_thread @NONAME_7
004F: create_thread @NONAME_11
004F: create_thread @NONAME_9
004F: create_thread @NONAME_8
004F: create_thread @NONAME_10
004F: create_thread @NONAME_3
00D7: create_thread_wb @HJ
00D7: create_thread_wb @USJ
00D7: create_thread_wb @GENSTUF
00D7: create_thread_wb @RAMPAGE
00D7: create_thread_wb @IMPORT
00D7: create_thread_wb @CAMERA
00D7: create_thread_wb @GATES


Rockstar programmers are stupid or something? Why the threads are created with different opcodes, with no difference in syntax, no extra params? Why the threads with 004F doesn't have a script name?

No, they're not so stupid, we have a good difference here, although we can't see this difference decompiling the script with Sanny Builder.

Note that 00D7 threads are the files that we have in GTA III Source code:
hj.sc, usj.sc, genstuf.sc, rampage.sc, import.sc, camera.sc, gates.sc are the files that we have in source that is not missions, and look, they're created using 00D7!

Yes, I believe that 00D7 create a script from a file and 004F create a script based in the actual file.
Btw, we have in GTA III src a file that is not a mission neither a new script, named car_gen.sc, how they apply to this rule? Well, this is a gosub in a external file, maybe the function of 02CD was a gosub in a external file?


Let's go to Vice City
CODE
004F: create_thread @O4X4_1
004F: create_thread @TAXI_L
004F: create_thread @FIRE
004F: create_thread @AMBULA
004F: create_thread @COP
004F: create_thread @PIZZ
004F: create_thread @BMXLOOP
004F: create_thread @RCHELY1
004F: create_thread @RC_RACE
004F: create_thread @RC_PLNE
004F: create_thread @MULTI
004F: create_thread @PSAVE1
004F: create_thread @HELP
004F: create_thread @HELI1
004F: create_thread @HELI2
004F: create_thread @HELI3
004F: create_thread @HELI4
004F: create_thread @STADIUM
004F: create_thread @ARMYBAS
004F: create_thread @NBMNBUY
004F: create_thread @LNKVBY
004F: create_thread @HYCOBY
004F: create_thread @OCHEBY
004F: create_thread @WASHBY
004F: create_thread @SKUMBY
004F: create_thread @VCPTBY
00D7: create_thread @HJ without_parameters
00D7: create_thread @USJ without_parameters
00D7: create_thread @AMMU without_parameters
00D7: create_thread @SECURE without_parameters
00D7: create_thread @INTERIO without_parameters
00D7: create_thread @IMPORT without_parameters
00D7: create_thread @CELLFON without_parameters
00D7: create_thread @BUS without_parameters
00D7: create_thread @CARGEN without_parameters
00D7: create_thread @PICKUPS without_parameters
00D7: create_thread @JUNKFUD without_parameters
00D7: create_thread @RAMPAGE without_parameters
00D7: create_thread @SHOPS without_parameters
00D7: create_thread @AUDIO without_parameters

Sure that HJ, USJ, IMPORT and RAMPAGE are from separated files, and I believe that AMMU, SECURE, INTERIO... are from separated files too!

Another thing that we can say here is that the threads with 00D7 respect a order in they position, I say, HJ is at line 6656 and USJ at 7061 and so on with the others script created with 00D7, meaning that USJ was compiled after HJ and so on.

004F doesn't respect that order since the script is at any label at main.sc, for example O4X4_1 is at 4642 and TAXI_L at 3738.

Now, let's go to SA.
CODE
00D7: create_thread @NONAME_1 // without extra params
00D7: create_thread @NONAME_2 // without extra params
00D7: create_thread @NONAME_3 // without extra params
00D7: create_thread @NONAME_4 // without extra params
00D7: create_thread @NONAME_5 // without extra params
00D7: create_thread @NONAME_6 // without extra params
00D7: create_thread @APCHECK // without extra params
00D7: create_thread @GIRLFRIENDS_INIT // without extra params
00D7: create_thread @NONAME_7 // without extra params
00D7: create_thread @NONAME_8 // without extra params
00D7: create_thread @HJ // without extra params
00D7: create_thread @CELLFON // without extra params

I will not repeat about the separated files here, but about a strange thing with scripts here, for example NONAME_1.

CODE
:NONAME_1
004E: end_thread

:PROJECT
[...]

What? Stupid programmers? I think not my friend.

They did this to the compiler take care about the existence of @PROJECT at another script file and then they can initialize the thread at some place (@BBALL) with 004F.


That's my theory, Since we have not main.sc I can't say "THAT'S A FACT!".
Thanks for reading and sorry for english mistakes.
Go to the top of the page
 
+Quote Post
Silent
post Apr 30 2012, 01:56 PM
Post #2


The master of cut retort

Group Icon

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



IMO your theory is right, but it doesn't make a difference for us really tongue.gif

Anyway, good to see that me and Deji weren't the only one who noticed that.
Go to the top of the page
 
+Quote Post
LINK/2012
post Apr 30 2012, 03:55 PM
Post #3


I will kill you

Posts: 126
Joined: 13-May 11



Do you think that 004F and 00D7 used the same name (START_NEW_SCRIPT) and the compiler recognizes which one to use?
Go to the top of the page
 
+Quote Post
Deji
post Apr 30 2012, 05:49 PM
Post #4


Coding like a Rockstar!

Group Icon

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



I don't think so. In GTA III it would appear to be the case as no reference to the 'with args' command is made, though it's hard to tell for sure because the 'no args' version only seems to be used in the main script, so the source files don't give anything away.

And IV has two natives listed:
CODE
in    out    native
2    1    START_NEW_SCRIPT
4    1    START_NEW_SCRIPT_WITH_ARGS


Unfortunately, the command seems to have changed a lot for IV, so it's hard to make a comparison.

But all that confusion aside, when v2 sascm.ini comes (which people are hopefully still looking forward to) the accompaning keywords will be start_new_script_with_args and start_new_script respectively.


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Apr 30 2012, 06:04 PM
Post #5


I will kill you

Posts: 126
Joined: 13-May 11



QUOTE (Deji @ Apr 30 2012, 02:49 PM) *
I don't think so

It's a answer for the first post or for my second post? rolleyes.gif

QUOTE (Deji @ Apr 30 2012, 02:49 PM) *
it's hard to tell for sure because the 'no args' version only seems to be used in the main script

Maybe because the compiler should have in hands the other scripts before compile mission segment?
Maybe because the separated files are "fully independent"?
Or maybe... maybe...

This post has been edited by LINK2012: Apr 30 2012, 06:06 PM
Go to the top of the page
 
+Quote Post
Deji
post Apr 30 2012, 07:19 PM
Post #6


Coding like a Rockstar!

Group Icon

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



Second. As Silent said, we've previously made such an observation.


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post May 1 2012, 07:16 PM
Post #7


I will kill you

Posts: 126
Joined: 13-May 11



I know that what I will say now will sound a bit stupid, but is one possibility.
Maybe 00D7 is LAUNCH_MISSION and 0417 is other command.

In GTA SA data we have a main.sc, and it have a commented
CODE
//LAUNCH_MISSION debug.sc


Maybe they just commented the code from past GTA's (like the // Test script for Industrial level, why this is here? we're not in GTA III)

debug.sc in GTA III is created with 00D7, in GTA VC seem to be too (because doesn't have a mission structure), maybe the SA debug.sc too?

0417 is late (I mean, seem to be created some times after 00D7)

Any one know how GTA IV start a mission?

I know that LAUNCH_MISSION is more like 0417, but look all those scripts have a START_MISSION at the top, maybe R* considered it some kind o mission...

@Down
You're a joke! You're completly wrong! You loser! You suck! Oh, okay, I think that's enought.

This post has been edited by LINK2012: Jul 20 2013, 01:41 PM
Go to the top of the page
 
+Quote Post
Deji
post May 2 2012, 07:36 AM
Post #8


Coding like a Rockstar!

Group Icon

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



0417 is definitely LAUNCH_MISSION.

EDIT: I am mistaken whistling.gif

This post has been edited by Deji: Jul 20 2013, 01:40 PM


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

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