Quantcast

Jump to content

» «
Photo

GTA2 SCR Tool

54 replies to this topic
B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#1

Posted 10 November 2009 - 02:10 AM Edited by B-$hep, 30 December 2009 - 12:14 PM.

I couldn't sleep so i thought why not develop something useful.

This old topic motivated me:
http://www.gtaforums...howtopic=218166

What's the idea? It's GTA2 player remapper tool.

I thought why the hell not? Just few clicks and you can change player default remap 25
to anything else and more interesting: LIKE COP OUTFIT for example.


Do you like to be COP? Or use it's outfit? It's easy now.
Even in original GTA2 scr files. Choose your desired remap and click Save.

Launch GTA2 and enjoy your new outfit.


Download from my homepage:
http://www.gta2madne.../click.php?id=7


All suggestions for improvement, new ideas, criticism etc are welcome.



Tool is coded using good "old" Borland Delphi 2.0 from 1996.
No joke. EXE is small.

Sektor
  • Sektor

    GTAMP.com

  • Members
  • Joined: 28 Jan 2003

#2

Posted 10 November 2009 - 02:45 AM Edited by Sektor, 10 November 2009 - 02:48 AM.

Cool. I tried to find the player_ped command in SCR files but it seemed to be a different opcode in each file, so I gave up on making a tool like this. Some other commands always have the same opcodes, so I guess I just missed it.

Why did you password the RAR file? That's just annoying.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#3

Posted 10 November 2009 - 02:48 AM Edited by B-$hep, 10 November 2009 - 02:54 AM.

Just that if Google indexes that file then people who will find it but shouldn't have it will not be able to open it.

It's very new. Not final. I guess more stuff can be put in actually.


Maybe one day complete SCR decompiler. I always wanted to do that.

But sad thing is that without any comments.
But actually GTA2 scripts are not so complex so i don't think this will be a problem.


But i know that some people would never like to see such tool.


People If you test it please post results. Ie. does it finds your GTA2 data folder path?
Does it throws any errors? Also your OS versions wouldn't hurt.


Also share your ideas for improvement.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#4

Posted 10 November 2009 - 09:12 PM Edited by B-$hep, 10 November 2009 - 09:18 PM.

It would be cool to decompile the scripts.
But...


I have taked quick look into the compiled scripts (.scr) files and seems they are compiled
like executables from "real" compilers.

Variables are thrown away somewhere or changed to symbols.

If i could decompile the scripts then.. but is there point?
Instead variable names you see just some hex strings or autogenerated variable names.

But does this help you to get ste.scr and wil.scr sources?


And many many things are byte packed and swapped. Dunno why.
Also there is some random sh*t in .scr files.

Maybe just for keeping .scr size on 80,7KB. I don't know.
Of course this is just quick look.

Im not in the mood right now to make a deep look and hack.


But i know my software cra*king experience (5 years) will help me alot.
But as i said, maybe a bit later.



[OT] Im messing with gmp compression at the moment.
I wan't to see my da*n maps in GTA2[/OT]

NTAuthority
  • NTAuthority

    member_title

  • The Yardies
  • Joined: 09 Sep 2008
  • European-Union

#5

Posted 11 November 2009 - 12:07 PM

QUOTE (B-$hep @ Nov 10 2009, 22:12)
I have taked quick look into the compiled scripts (.scr) files and seems they are compiled
like executables from "real" compilers.

Variables are thrown away somewhere or changed to symbols.

If i could decompile the scripts then.. but is there point?
Instead variable names you see just some hex strings or autogenerated variable names.

GTA3D modders do that all the time, all variables are decompiled to numbers, jump targets to 'SECTION_OFFSET', since sections do have names. tounge.gif Only thing that's not done using names is that SA has a huge number-to-possible-name list. smile.gif With some code flow analysis, it'd be possible to at least make code that can be recompiled.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#6

Posted 11 November 2009 - 12:11 PM

Yeah possibly. I will take another look into that stuff later.

Only thing that confuses me that "random" data in SCR files.


And with every compile of same script something changes in the scr file.

NTAuthority
  • NTAuthority

    member_title

  • The Yardies
  • Joined: 09 Sep 2008
  • European-Union

#7

Posted 11 November 2009 - 04:02 PM Edited by NTAuthority, 11 November 2009 - 04:06 PM.

QUOTE (B-$hep @ Nov 11 2009, 13:11)
Only thing that confuses me that "random" data in SCR files.


And with every compile of same script something changes in the scr file.

This is most likely true of any compiler that does not directly have all code flow instructions in the source language, especially if optimization is done -- the GTA3 and GTA IV .sc compilers would possibly have the same 'problem' as the MISS2 compiler, but the modders who discovered that file format obviously didn't notice it since R* didn't release the language compiler (sadly sad.gif ).

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#8

Posted 11 November 2009 - 04:16 PM

R* sadly didn't released different sweet stuff like different GTA (2) tools sources, file format specs (like for SCR file), sources of their games etc.


SCR has it's own format, it must have. Because GTA2 itself reads the compiled script.
But no specs for that format.


But i believe that with some dedication and free time it can be decompiled.
Hopefully to recompilable MIS file like you said.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#9

Posted 11 November 2009 - 06:55 PM Edited by B-$hep, 11 November 2009 - 07:03 PM.

I messed around with miss2.exe today and figured out that DMA aka R* used
Visual Parse++ for creating lexer and parser for their compiler.

http://web.archive.o...ual Parse .htm

Sand-stone is out of business now so it's available only from archive now.


I downloaded the trial pack and also got the headers, libs etc, also headers for Delphi.
In C++ headers i see same error strings and strings in general exactly what i saw in miss2.exe.


I think if will mess around with that stuff i got i can at least figure out the file format or content of it. How to read it and so on.


So the miss2.dfa file shipped with miss2 contains lex tables generated by Visual Parse++.
And miss2.llr file shipped with miss2 contains parse tables generated by Visual Parse++.

Very interesting stuff.

Sektor
  • Sektor

    GTAMP.com

  • Members
  • Joined: 28 Jan 2003

#10

Posted 11 November 2009 - 09:23 PM

Some of the changes might be the time and date but way more bytes are changed than what would be needed to save that info.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#11

Posted 16 November 2009 - 04:31 PM

I have update my blog also about the two new things i have done.



But what else could be added into this tool?




One idea i had is: change the coordinates where the game starts.
Usually at the church.



Fireman
  • Fireman

    Cunning Stunter

  • Members
  • Joined: 25 Mar 2005

#12

Posted 18 November 2009 - 07:05 PM

Awesome always wanted this tool, why did it took so long?

Works fine here, didnt find the path though so had to click myself (OMG WTF THAT TAKES LIKE AGES).

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#13

Posted 18 November 2009 - 09:26 PM Edited by B-$hep, 18 November 2009 - 09:35 PM.

Sorry sorry sorry.


I will fix the problems with DATA folder in next version.
Also backups of all SCR files should be made, at the moment only 3 are back-upped.
Im really sorry.


In next version i will try to add also possibility to change player start coordinates.

Nice to see another user of my tool. This motivates to update it and make it even better.



But can you show me the full path of your GTA2 folder?

Also what's your default drive?


C:\ or something else?


Just curious.




And please spread word around about this tool.
The more people know about the better.

Feel free to make copies of it and post anywhere as long as all files are included and the content isn't changed or modified in any way.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#14

Posted 19 November 2009 - 07:26 PM Edited by B-$hep, 30 December 2009 - 12:14 PM.

Here is new version. Don't use the old one anymore.

user posted image



I had to recompile it in Delphi 3 to add some new features.

Also i just renamed the tool to "GTA2 SCR Tool"
So it's related to modifying GTA2 SCR files.


Also updated UI a bit. There are few components hidden. Just left as placeholders for changing GTA2 player starting coordinates in next version.

And now you can launch GTA2 directly from tool by pressing GTA2 button.

ReadMe.txt is also updated. Read it again. Also i included versions history into it.
Read it, so you know what's changed and what's fixed.


So just use this as minor update.

No password this time, download here:

http://www.gta2madne.../click.php?id=7

Sektor
  • Sektor

    GTAMP.com

  • Members
  • Joined: 28 Jan 2003

#15

Posted 20 November 2009 - 12:15 AM

Is the player 1 remap always at 0x2F02 ?

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#16

Posted 20 November 2009 - 12:17 AM Edited by B-$hep, 20 November 2009 - 12:29 AM.

Seems so yes. Why?


Razor reported that it doesn't work for multiplayer.
It confuses GTA2.

Because GTA2 chooses remaps in MP by itself and seems that he expects there original correct values. If all players have the same remaps then it should work.

Hmm you said player 1. Maybe more players are in scripts that should be changed. But i don't think that this is the problem.

I can't play MP so i can't do nothing atm.

Maybe memory patching helps but it's PITA to locate it in GTA2 memory.

Fireman
  • Fireman

    Cunning Stunter

  • Members
  • Joined: 25 Mar 2005

#17

Posted 25 November 2009 - 01:41 PM

D:\GTA2

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#18

Posted 25 November 2009 - 02:36 PM Edited by B-$hep, 30 December 2009 - 12:14 PM.

Fireman, did you tested new version?
Please test it and report the results. Asks for the GTA2 path or not?

Download:
http://www.gta2madne.../click.php?id=7

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#19

Posted 15 December 2009 - 07:28 PM Edited by B-$hep, 15 December 2009 - 07:30 PM.

Private version screenshot.
Saving of new player starting coordinates works fine.


user posted image


Im still working on the reading of the values from SCR file. It's complicated stuff.

Stay tuned.


EDIT: imageshack is totally fcked up.
Gonna replace it soon.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#20

Posted 17 December 2009 - 04:24 PM Edited by B-$hep, 17 December 2009 - 06:18 PM.

I got the Visual Parse++ to work (ie. compiling, generating files etc).
I can't remember if i got the full sources of Visual Parse ++ or not.
They must be somewhere on my CD's/DVD's. But i can't remember did i got the sources or not.
Something tells me that i got them and burned to CD, but i can't find it so quickly.
Having these sources helps even more.


I believe that if i devote more time to this SCR stuff and DMA compiler then maybe i could
recreate GTA2 script compiler or make a SCR decompiler thanks to this.

But this stuff needs alot of time and devotion. This is future plan, after map editor.



But SCR tool will be updated, alot more stuff could be added in but as i said SCR files are tricky stuff.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#21

Posted 18 December 2009 - 05:27 PM Edited by B-$hep, 18 December 2009 - 05:32 PM.

I can say that i almost solved the problem with reading coordinates from SCR file.

But there rises another problem.

Getting number of players from SCR file. I have made one test.mis script added few players to it and compiled. Then modified script (removed one player) and compiled again.

Then compared them.


Something changes in the headers of the SCR file but i don't know yet what it is.
There are some common patterns in all SCR files but some of them do not always match.

These bytes could be anything. They could be even just tokens or pointers to the symbol table or something.

Usually in the filenames of SCR files there are number of players added, but not always.
Depends on author. I can't fully rely on that.


Seems that only way is to understand the bits it changes in header after PLAYER_PED command has been added or removed.

I can't blindly read the SCR file. Well, i know the offsets and things but if SCR file has one player and im trying to read more then i will read just pure trash that has nothing to do with actual coordinates.

But im working on it. Maybe i figure out something.


EDIT: Seems like some basic AI should be added in to this app. Some bit pattern macthing and such things. Like in cr*cking world.

Sektor
  • Sektor

    GTAMP.com

  • Members
  • Joined: 28 Jan 2003

#22

Posted 19 December 2009 - 02:54 AM

It wouldn't be so bad if you let the user chose the number of players and have a warning that it will corrupt the SCR file if they chose wrong. All the official SCR files have the player count in the filename and those are the ones that don't have the .mis files available.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#23

Posted 19 December 2009 - 04:32 AM Edited by B-$hep, 19 December 2009 - 04:35 AM.

Good idea Sektor.

Never thought of that. I think this is the way to go until i figure out the bits.
And in later versions will implement proper way of handling this.

I will add also detecting of number of players from filename and ask user "is it correct?" or something like that.

GTA2 has filenames like: "MP1-2P" So that 2P is good for detecting number of players.
I wish that everyone would use this method naming their scripts.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#24

Posted 28 December 2009 - 01:48 PM Edited by B-$hep, 30 December 2009 - 12:13 PM.

Sektor

Could you please change topic title to "GTA2 SCR Tool"?
It's not only remapper tool now and i don't want to make new thread.


TIA.


OK, because something is messed up with hosting at 000webhost my site is fckd up and i can't login to FTP atm.

So uploaded new test version to my old email provider homepage account:
http://www.gta2madne.../click.php?id=7

The readme.txt is not completed and this version is only for testing.
But not for everyday use.

README.TXT has little tutorial how to change coords in STE.SCR to pay a a little visit to
Zaibatsu!



Please go through this tutorial and test it!

PLEASE.


I want you all to test it, do you see something strange when using it?
Bugs? Weird coordinates?

Please let me know about this in this thread.



Also please remember that it saves coordinates ONLY FOR PLAYER 1!
It doesn't save others yet.



Just test everything you can with player 1 and let me know how it works.

Also suggestions about UI design, criticism, anything. Just post here.



Feel free to redistribute this but remind anyone that it's not final version and only for testing purposes!!



LINK FOR DOWNLOAD:

http://www.gta2madne.../click.php?id=7

Sektor
  • Sektor

    GTAMP.com

  • Members
  • Joined: 28 Jan 2003

#25

Posted 28 December 2009 - 02:54 PM Edited by Sektor, 28 December 2009 - 03:02 PM.

On ste.SCR, it says '113,5' is not a valid floating point value. If works if I change my Windows regional setting to use , for decimal point instead of .

Lantyz
  • Lantyz

    S Q R L

  • Members
  • Joined: 24 Sep 2005

#26

Posted 28 December 2009 - 02:58 PM Edited by Lantyz, 28 December 2009 - 03:42 PM.

Great tool! I used it to find the missing codes of Hidden Surprise and Tiny Town. The coordinates seem all right, but I think it messes up the rotations every now and then. For instance, it says player 5 in MP5-6P (Face Off 6 players) has a rather weird rotation of 13, although I'm positive this should be 0. It also seems to have some trouble determining the correct remap. This goes well most of the time, but MP1-6P (Tiny Town 6 players) has two blond haired Rednecks (P4 and P5). Remaps are never used twice, and in fact I'm not sure whether the blond haired Redneck is used at all in multiplayer. P5 of MP5-6P also is a blond haired Redneck according to your tool, but I'm not sure this is correct.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#27

Posted 28 December 2009 - 03:04 PM Edited by B-$hep, 30 December 2009 - 12:13 PM.

Thanks Sektor for title.

Yeah i guess i must add detecting of regional settings.
Im converting these commas to . (dots) in code.


Sektor can you got Regional and Language Options in control panel and post here values
you have in Regional Options tab.

It has Samples and below values like:

Number: 123456789,00
Currency: 123456789.00 kr

What do you have there?


You see? Releasing even such beta version helps alot to find bugs i didn't even knew about.


Thanks alot Lantyz and Sektor.


I will work on these bugs now.



EDIT: i saw your edit about comma problem, thanks for that.
I will modify my regional settings and will try it.
EDIT2: yep, throws me error also here.


EDIT3: download again, Regional problem should be fixed now.
I added checks that should decide what separator to use with different regional settings.

Link is same:

http://www.gta2madne.../click.php?id=7



EDIT4: Lantyz, probably these bugs are because of array of Player structs i use.
Something messes up the data in array.

Should review this code and make it more stable.

Thanks for this report. It helps alot.

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#28

Posted 29 December 2009 - 11:02 AM Edited by B-$hep, 29 December 2009 - 11:09 AM.

Lantyz


5 or 6 Virtual Machines must be set up to test these multiplayer maps / scripts using original unmodified GTA2 files.

This shows and proofs what remaps / coords, rotations etc are actually used and what's not.
Then we will see what is wrong and what's correct.


I guess it's hard to get 6 players into game but with friends it should be possible.

I can only test on VM's but i must set them up one day to really be sure if my tool lies or not.

Well i could build 6 PCs easily at my home but i don't have so much mouses, keyboards and monitors. But i guess one day i will do it and post pics here. But it would be fun, 6 PC's with GTA2 on their screens.

D*mn, im gonna do that. Whatever it takes. Seems good idea and i believe i will get alot of fun.



But i can calculate also values by "hand". I got all coords by calculating from values in SCR for the faceoff maps.



But im working on my tool. Im messing around with that piece of code that is responsible for returning correct values.

porky119
  • porky119

    Player Hater

  • Members
  • Joined: 29 Dec 2009

#29

Posted 29 December 2009 - 09:23 PM

ive tried out the tool (not beta) a little bit and it seems pretty sweet. i had a question - how hard would it be to change the remaps for other computer controlled people (i.e. change blue police to yellow police)?

B-$hep
  • B-$hep

    0xBADF00D

  • Members
  • Joined: 13 Nov 2004

#30

Posted 29 December 2009 - 09:38 PM

Thanks for using my tool.

The remaps are assigned by game (in code) and if i remember correctly you can't even control police or medicar green guys with scripts.
Scripts do not have control over this.

If someone knows that's it's possible in script then i would like to see the command for this.


Actually it would be fun: police jumps out of the medicar and saves people and green medicar guys will go after you if you have wanted level.


And Elvis with guns in army... etc..


It's good idea, i will take a look into EXE, maybe i will find the place where game set's the remaps.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users