[GUIDE] [1.20.0.7] Editing game files using a hex editor

Forum rules
SCS as a company do not wish to have paid mods on this forum. While we understand that not all paid mods use the Intellectual Property of other companies/people, it is very hard to moderate what is and isn't acceptable when money is involved. There are also concerns that it could look unfavorable to potential work partners going forward if SCS allow mods that may potentially use unlicensed branding.
Posting in the Mods forum (ATS and ETS2) is restricted to sharing free-to-the-public mods and providing support for mods. For more details, please check chapters [4] and [5] of Forum Rules.
hydraulics
Posts: 34
Joined: 20 Nov 2013 23:06

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#21 Post by hydraulics » 17 Apr 2016 20:57

I managed to figure it out.

Quick Demo on Codepen

{note: apparently it will not work for all .tobj files}

User avatar
Cadde
Posts: 9535
Joined: 24 Apr 2013 18:08
Location: Have no fear, i am from the internets!

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#22 Post by Cadde » 17 Apr 2016 21:12

It most likely doesn't work on cube maps. Neither does Mods Studio's TOBJ parser/writer.

Nice work though!

What i really should do with the newfound knowledge on TOBJ files is go over all TOBJ files again and see how the settings relate to various in game features and find out what the remaining unknowns are. And figure out which of the unknowns could actually be renamed to "reserved" because i am sure there are some. And possibly padding, which would be the last 4 bytes methinks before the paths array.
On extended hiatus.

hydraulics
Posts: 34
Joined: 20 Nov 2013 23:06

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#23 Post by hydraulics » 17 Apr 2016 21:17

It would seem "text0" is just accounted for in this instance.

So anything that has more than one texture file such as cube maps like you say will not be taken into account as is.

It wont seem to parse some of the "models" either, which is weird.

I'm pretty sure the 4bytes before the path is the text0_str_offset, which would make sense if there were more than one texture. try a cube map .tobj file and see if those look like a file pointer.

User avatar
Cadde
Posts: 9535
Joined: 24 Apr 2013 18:08
Location: Have no fear, i am from the internets!

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#24 Post by Cadde » 25 Jun 2016 20:03

Here's a listing of all TOBJ files from ETS 2 version 1.24.2.3 and their (known) settings in CSV format for anyone interested.

https://www.dropbox.com/s/fg4u1jal6au5x ... J.zip?dl=1

Open with Excel / Open Office Calc etc. I recommend formatting as table so one can sort and filter on each column.

Why? It might help you get a better grasp for what files uses what settings.
Also, this was done in preparation for improving the TOBJ editor in Mods Studio.
On extended hiatus.

hydraulics
Posts: 34
Joined: 20 Nov 2013 23:06

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#25 Post by hydraulics » 27 Jun 2016 20:38

Great resource to compare .tobj types, thanks @Cadde

Did you "grep" those files or manually print out each file?

User avatar
Cadde
Posts: 9535
Joined: 24 Apr 2013 18:08
Location: Have no fear, i am from the internets!

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#26 Post by Cadde » 27 Jun 2016 21:25

Code: Select all

        private void parseAllTOBJButton_Click(object sender, EventArgs e) {
            var extractsPath = @"G:\ETS 2 extracts\extracts 1.24.2.3";
            var tobjs = Directory.GetFiles(extractsPath, "*.tobj", SearchOption.AllDirectories);
            using (var csv = new StreamWriter(@"DebugFiles\AllTOBJ.csv")) {
                csv.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26}",
                    "Path",
                    "Version",
                    "UnInt1",
                    "UnInt2",
                    "UnInt3",
                    "UnInt4",
                    "UnInt5",
                    "Bias",
                    "UnByte1",
                    "Mapping",
                    "UnByte2",
                    "MagFilter",
                    "MinFilter",
                    "MipFilter",
                    "UnByte3",
                    "WrapModeU",
                    "WrapModeV",
                    "WrapModeW",
                    "IsUI",
                    "UnByte4",
                    "UnByte5",
                    "UnByte6",
                    "UnByte7",
                    "IsNormal",
                    "UnByte8",
                    "PathLen",
                    "UnInt6");
                foreach (var tobjPath in tobjs) {
                    var tobj = TobjFile.Load(tobjPath);
                    csv.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26}",
                        tobjPath.Substring(extractsPath.Length).Replace("\\", "/"),
                        tobj.Header.Version,
                        tobj.Header.UnInt1,
                        tobj.Header.UnInt2,
                        tobj.Header.UnInt3,
                        tobj.Header.UnInt4,
                        tobj.Header.UnInt5,
                        tobj.Header.Bias,
                        tobj.Header.UnByte1,
                        tobj.Header.Mapping,
                        tobj.Header.UnByte2, 
                        tobj.Header.MagFilter, 
                        tobj.Header.MinFilter, 
                        tobj.Header.MipFilter, 
                        tobj.Header.UnByte3, 
                        tobj.Header.WrapModeU, 
                        tobj.Header.WrapModeV, 
                        tobj.Header.WrapModeW, 
                        tobj.Header.IsUI, 
                        tobj.Header.UnByte4, 
                        tobj.Header.UnByte5, 
                        tobj.Header.UnByte6, 
                        tobj.Header.UnByte7,
                        tobj.Header.IsNormal, 
                        tobj.Header.UnByte8, 
                        tobj.Header.PathLen, 
                        tobj.Header.UnInt6);
                }
            }
        }
;)
On extended hiatus.

hydraulics
Posts: 34
Joined: 20 Nov 2013 23:06

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#27 Post by hydraulics » 27 Jun 2016 22:23

haha good job dude!

edsor
Posts: 82
Joined: 05 Dec 2017 20:13

Re: [GUIDE] [1.20.0.7] Editing game files using a hex editor

#28 Post by edsor » 26 Jul 2020 17:58

Thank you very much for this guide. Too bad my little knowledge won't let me appreciate all its value. I've read it repeatedly, trying to decipher the names and abbreviations that appear, trying to relate the numbers to the objects and functions displayed in the game. But I need a lot more information. It is frustrating, because I realize that with the right knowledge it is possible to create and modify what I want. I'd like to be able to correct the animations of the windshield wipers or be able to create animations inside the vehicles. For me with Blender it's just impossible. I wish there were a lot more guides like this.

Post Reply

Return to “Modding Guides”

Who is online

Users browsing this forum: No registered users and 1 guest