Comments (17)
BTW, TS-MAP is already updated for HASH v2
from ts-map.
It worked for me. Using some *.scs files
scs_extractor.exe decrypt this list of files:
!!! base.scs !!!
base_map.scs
def.scs
dlc_balkan_e.scs
dlc_balkan_w.scs
dlc_balt.scs
dlc_east.scs
dlc_feldbinder.scs
dlc_fr.scs
dlc_iberia.scs
dlc_it.scs
dlc_north.scs
The contents of each decrypted file must be packed in .zip without compression, then rename to .scs
But, from the !!! base.scs !!! need only folders (prefab, prefab2, material/ui) after adding them to base.zip and renamed to base.scs, turned out to be ~2.8 GB in size for the base.scs file. It may be necessary to add other folders besides prefab and prefab2, but for me it was enough for the map to be rendered...
from ts-map.
I went a bit in deep than unpacking and repacking without going to select single files.
The code below is really initial, wrote quickly yesterday but it works: i've simulated the UberFilesystem
logic, instead of reading from .scs files or .zip, are read directly from the filesystem
In UberFilesyste.AddSourceDirectory
replace this code and other relevant following:
foreach (var scsFilePath in scsFilesPaths)
{
var fileResult = AddSourceFile(scsFilePath);
if (!fileResult) result = false;
}
with
var directories = Directory.GetDirectories(path);
UberDirectory parentDir;
foreach (string dir in directories)
{
string directoryName = new DirectoryInfo(dir).Name;
var parentDirHash = CityHash.CityHash64(directoryName);
if (this.Directories.ContainsKey(parentDirHash))
{
parentDir = this.Directories[parentDirHash];
}
else
{
parentDir = new UberDirectory();
parentDir.VirtualPath = new DirectoryInfo(dir).Name;
this.AddLocalFilesRecursive(parentDir, new DirectoryInfo(dir).Name, dir);
this.Directories.Add(parentDirHash, parentDir);
}
}
and add
private void AddLocalFilesRecursive(UberDirectory uberDirectory, string virtualPath, string realPath)
{
var files = Directory.GetFiles(realPath, "*.*");
foreach (string file in files)
{
string fileVirtualPath = virtualPath + "/" + new FileInfo(file).Name;
this.Files.Add(CityHash.CityHash64(fileVirtualPath), new UberFile(new LocalFileEntry(file)));
uberDirectory.AddSubFileName(new FileInfo(file).Name);
}
var dirs = Directory.GetDirectories(realPath);
foreach (string dir in dirs)
{
uberDirectory.AddSubDirName(new DirectoryInfo(dir).Name);
var subUberDir = new UberDirectory();
subUberDir.VirtualPath = virtualPath + "/" + new DirectoryInfo(dir).Name;
this.AddLocalFilesRecursive(subUberDir, virtualPath + "/" + new DirectoryInfo(dir).Name, dir);
this.Directories.Add(CityHash.CityHash64(virtualPath + "/" + new DirectoryInfo(dir).Name), subUberDir);
}
}
creates a new class called LocalFileEntry
under TsMap.FileSystem
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TsMap.FileSystem.Zip;
using TsMap.Helpers;
namespace TsMap.FileSystem
{
public class LocalFileEntry : Entry
{
public LocalFileEntry(string path) : base(path)
{
}
public override bool IsCompressed()
{
return false;
}
public override bool IsDirectory()
{
throw new NotImplementedException();
}
public override byte[] Read()
{
return File.ReadAllBytes(this._path);
}
protected override byte[] Inflate(byte[] buff)
{
throw new NotImplementedException();
}
}
}
modify Entry.cs
adding
internal string _path;
public Entry(ArchiveFile fsFile)
{
_archiveFile = fsFile;
}
Be aware also you must replace all references with code similar to
Logger.Instance.Error($"Unknown base file version ({Sector.Version}) for item {Type} " +
$"in file '{Path.GetFileName(Sector.FilePath)}' @ {startOffset} from '{Sector.GetUberFile().Entry.GetArchiveFile().GetPath()}'");
with Sector.GetUberFile().Entry.GetArchiveFile()?.GetPath()
otherwise will throw an error when a reference is not found.
With this is not necessary repack all files but can work on all extracted files.
About locale.scs and others files without a root directory, i've discovered this: https://github.com/sk-zk/Extractor
from ts-map.
sure @meatlayer , give me few days, for the weekend.
I've left them unpublished hoping it was only a workaround.
I'm a bit busy these days, bear with me please
from ts-map.
SCS Build another SCS Extractor.
https://modding.scssoft.com/wiki/Documentation/Tools/Game_Archive_Extractor#Download
from ts-map.
It looks like new DLC Guards have also appeared in 1.50 beta ATS
new DlcGuard("dlc_ne", 32, false),
new DlcGuard("dlc_ne_and_co", 33, false),
new DlcGuard("dlc_ne_and_ks", 34, false),
new DlcGuard("dlc_ne_and_wy", 35, false),
from ts-map.
Someone has a working version?
from ts-map.
Lets get together on this, hash has changed. Is there a way to avoid using the .scs files and start using the extracted ones for now? (bypass)
from ts-map.
Yes, this tool can read ZIP files.
Then extract all and compress in ZIP files (Normal method), then change the GetFile Method of AddFolder in TSMapper from: GetFiles(.scs) to GetFiles(.zip)
from ts-map.
thanks @jorensanbar, that is brilliant idea!
from ts-map.
@jorensanbar as you suggested, i've unpacked all .scs files in a single directory then packed the whole content in a .zip file with 7zip and compression Normal - i've tried also with compression = None
So now i have a big 20gb zip file containing all raw files inside.
But throw an exception at ZipArchiveFile.cs line 97, seems can't understand the internal zip content.
var parentDirPath = Path.GetDirectoryName(name).Replace('\\', '/');
Have also this warning:
| Debug] [ZipArchiveFile.cs::Parse] Local name length is different than CD one for zip entry 0 '' in '<zip file>'
What i'm missing? :D
from ts-map.
SCS_Extractor_1.50 cannot access some bytes of files due to HASH V2. So the extraction is incomplete.
Compress only the paths that your application really requires.
from ts-map.
thanks @jorensanbar but still cannot get it to work.
I've unpacked every single file and then repacked in a zip from 7zip with normal compression base, base_map, def, base_vehicle and base_share
Strange thing: altought i have the base.scs (assuming is ETS2 1.50 that one in your screenshot) at same size, when repacked the size is not like yours, is over 6gb.
Evidently i'm messing with something...
from ts-map.
I've unpacked every single file
No, you didn't because the SCS_Extractor does not decompress 100% of the SCS file, HASH V2 does not allow it.
For this reason if you recreate a ZIP by selecting the entire folder, it will be corrupted.
You only have to keep the paths used by TS_MAP, that's why my ETS2_1.50 Base.scs file is only 1.5GB in size, even though it was originally 8GB.
from ts-map.
Did any of you guys manage to solve the problem related to the red background of the POI icons of gas stations and recreation centers? Before version 1.50, they were the correct blue and green colors.
from ts-map.
maybe we can replace them with custom images? they would be better than previous ones :D
from ts-map.
I went a bit in deep than unpacking and repacking without going to select single files.
The code below is really initial, wrote quickly yesterday but it works: i've simulated the
UberFilesystem
logic, instead of reading from .scs files or .zip, are read directly from the filesystemIn
UberFilesyste.AddSourceDirectory
replace this code and other relevant following:foreach (var scsFilePath in scsFilesPaths) { var fileResult = AddSourceFile(scsFilePath); if (!fileResult) result = false; }
with
var directories = Directory.GetDirectories(path); UberDirectory parentDir; foreach (string dir in directories) { string directoryName = new DirectoryInfo(dir).Name; var parentDirHash = CityHash.CityHash64(directoryName); if (this.Directories.ContainsKey(parentDirHash)) { parentDir = this.Directories[parentDirHash]; } else { parentDir = new UberDirectory(); parentDir.VirtualPath = new DirectoryInfo(dir).Name; this.AddLocalFilesRecursive(parentDir, new DirectoryInfo(dir).Name, dir); this.Directories.Add(parentDirHash, parentDir); } }
and add
private void AddLocalFilesRecursive(UberDirectory uberDirectory, string virtualPath, string realPath) { var files = Directory.GetFiles(realPath, "*.*"); foreach (string file in files) { string fileVirtualPath = virtualPath + "/" + new FileInfo(file).Name; this.Files.Add(CityHash.CityHash64(fileVirtualPath), new UberFile(new LocalFileEntry(file))); uberDirectory.AddSubFileName(new FileInfo(file).Name); } var dirs = Directory.GetDirectories(realPath); foreach (string dir in dirs) { uberDirectory.AddSubDirName(new DirectoryInfo(dir).Name); var subUberDir = new UberDirectory(); subUberDir.VirtualPath = virtualPath + "/" + new DirectoryInfo(dir).Name; this.AddLocalFilesRecursive(subUberDir, virtualPath + "/" + new DirectoryInfo(dir).Name, dir); this.Directories.Add(CityHash.CityHash64(virtualPath + "/" + new DirectoryInfo(dir).Name), subUberDir); } }
creates a new class called
LocalFileEntry
underTsMap.FileSystem
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using TsMap.FileSystem.Zip; using TsMap.Helpers;
namespace TsMap.FileSystem { public class LocalFileEntry : Entry { public LocalFileEntry(string path) : base(path) { } public override bool IsCompressed() { return false; } public override bool IsDirectory() { throw new NotImplementedException(); } public override byte[] Read() { return File.ReadAllBytes(this._path); } protected override byte[] Inflate(byte[] buff) { throw new NotImplementedException(); } } }
modify
Entry.cs
addinginternal string _path; public Entry(ArchiveFile fsFile) { _archiveFile = fsFile; }
Be aware also you must replace all references with code similar to
Logger.Instance.Error($"Unknown base file version ({Sector.Version}) for item {Type} " + $"in file '{Path.GetFileName(Sector.FilePath)}' @ {startOffset} from '{Sector.GetUberFile().Entry.GetArchiveFile().GetPath()}'");
with
Sector.GetUberFile().Entry.GetArchiveFile()?.GetPath()
otherwise will throw an error when a reference is not found.With this is not necessary repack all files but can work on all extracted files.
About locale.scs and others files without a root directory, i've discovered this: https://github.com/sk-zk/Extractor
@dowmeister Will you be able to publish the modified code of the entire project in your repository in some separate experimental branch? I didn't manage to apply this changes to the code successfully.
from ts-map.
Related Issues (20)
- Question: How you set the value "itemDrawMargin" of TsMapRenderer.cs ?
- Support for 1.43 HOT 5
- Import TruckersMP Mods file HOT 10
- where is the exe HOT 6
- Tiles aliased or lower quality than before HOT 2
- 1.45 beta problem? HOT 8
- Reading navigation data (.navcache) HOT 8
- Problem on place for landmark icon HOT 1
- Support for Texas HOT 1
- Prefab polygons drawn with wrong z-index HOT 1
- Support for 1.47 HOT 1
- palette editor will not load
- Support 1.48 [not an issue]
- How to read sector file (*.base) as String?
- Support for 1.48.5 + West Balkans DLC HOT 2
- DLC Guards for Kansas
- Christmas 2023 Event Map not rendered
- Issue while converting values from game coords to pixels HOT 5
- Issue when generating tiles with ProMods 2.70
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ts-map.