Closed echozio closed 4 years ago
That's what I explained in instruction for Linux.
The code should perhaps be updated to ignore case when looking for files.
There is no C# API for opening files case-insensitively (maybe not even a Linux API). But we could enumerate all files in GTA installation, store them in some list, and then search through this list case-insensitively (this is the best solution).
Also, there are some other solutions for this:
I'm sorry, I completely missed those instructions.
There is no C# API for opening files case-insensitively (maybe not even a Linux API).
Yes, I realize you would need additional logic to be able to do this, but at least in the future it should be implemented in the application to eliminate manual steps that need to be taken by less technical users. Certainly not something that matters much in practice right now, I'm sure.
Enumerating the files and comparing case-insensitively like you said definitely seems like the best long-term solution.
I'm on kernel 5.3, so I tried giving this a shot, but it turns out the EXT4 filesystem requires an additional attribute, encoding=utf8, in order to do this. For those who can use it, though, this is by far the easiest solution (in contrast to renaming or using a FAT image).
All you have to do on a compatible system is to go to your San Andreas directory and run
chattr +F .
in the future it should be implemented in the application to eliminate manual steps that need to be taken by less technical users.
I agree. It should run out of the box with no additional setup. It's just that there hasn't been many Linux users so far, so this wasn't a problem.
it turns out the EXT4 filesystem requires an additional attribute, encoding=utf8, in order to do this
So this attribute is specified at moment of creation of EXT4 partition, or can be changed later ? If it can be changed, than that is the way to go.
So this attribute is specified at moment of creation of EXT4 partition, or can be changed later ? If it can be changed, than that is the way to go.
Unfortunately not. I did give it a shot with tune2fs /dev/sdb1 -E encoding=utf8
, however only a subset of extended options are possible to change on an existing filesystem.
I think the best solution (and easiest to implement one) would be to try open all used GTA files to check for proper naming and report user to rename these. For long term solution I think just lowercasing all filenames open from dat files will do. User could use one of lowercase scripts once on their GTA installation. I think lowercasing is very quick to add and that will solve the problem completely and no fancy stuff will be required.
To rename all files, go to gta sa directory and run the following script:
rename -v 'y/A-Z/a-z/' `find .`
if errors are printed, run it again until no output given
To make game work with lowercase files, the small patch is needed:
diff --git a/Assets/Scripts/Importing/Items/Item.cs b/Assets/Scripts/Importing/Items/Item.cs
index 03012128..85009767 100644
--- a/Assets/Scripts/Importing/Items/Item.cs
+++ b/Assets/Scripts/Importing/Items/Item.cs
@@ -40,6 +40,7 @@ namespace SanAndreasUnity.Importing.Items
args = args.Replace(".IDE", ".ide");
args = args.Replace(".IPL", ".ipl");
args = args.Replace('\\', Path.DirectorySeparatorChar);
+ args = args.ToLower();
switch (type.ToLower())
{
Thanks for the nice project. Very nice playground. Is it possible to enter cars yet or see peds actually dying (not disappearing)?
@slapin Thanks for suggesting another solution.
But I don't agree that it is the best long-term solution. The best solution would be to case-insensitively search for files in internal list of all files, like I said before. This will not require any setup from users.
I think I know how to do it. ArchiveManager
holds all loaded archives. One of them is LooseArchive
, which is actually a directory, and contains files from GTA installation. So what we can do, is
to replace arg
with the real name, after this line:
The real name will be retreived from ArchiveManager.
Thanks for the nice project. Very nice playground.
Yeah, it's just fun to work on it :grinning:
Is it possible to enter cars yet
Well, did you see gameplay video, or even played the game ? Of course it is.
see peds actually dying (not disappearing)?
Not yet.
I completely agree with @in0finite . This also allows you to use an existing game installation without altering it.
I haven't read enough of the code to have any valuable input on your suggested implementation, but if you implement it I would be happy to test it.
It shouldn't be difficult. But I'm a little busy these days, so you guys can give it a try in the meantime.
@chris-echoz can you test it now, from case-sensitivity
branch ? It works for my GTA version on NTFS partition.
@in0finite Did not work, failed at loading carrec.img Might work for everything else than carrec.img, though, as when I renamed its parent directory "paths" to "Paths", everything loaded perfectly. Exception:
System.Exception: Archive not found: /home/chris/etc/games/steam/steamapps/common/Grand Theft Auto San Andreas/data/Paths/carrec.img
at SanAndreasUnity.Behaviours.Loader.StepLoadArchives () [0x0005e] in /home/chris/git/SanAndreasUnity/Assets/Scripts/Behaviours/Loader.cs:280
at SanAndreasUnity.Behaviours.Loader+<LoadCoroutine>d__36.MoveNext () [0x001f6] in /home/chris/git/SanAndreasUnity/Assets/Scripts/Behaviours/Loader.cs:186
Ok, so archives are not working yet. I can fix this in 1-2 hours.
Can you confirm that you did not rename any other files/folders in your GTA installation ?
I fixed archives. Try now.
You mentioned that data folder starts with capital D. If that is the case, then some more file types will fail to load. I don't know how you succeeded. Maybe you renamed "Data" to "data".
@in0finite I may have renamed some things from earlier. I'll try deleting and redownloading the game from Steam.
That would be great. This is the only thing preventing the Linux build release.
Basically, I think that everything is fixed, except maybe for models folder. If it starts with capital M, then there will be 1 more fix to do.
It worked right away with the freshly downloaded game from Steam
Awesome 😊. Can you try to spawn vehicles and roam around for a little, just to make sure it's all good ?
Yup, I did, everything appears to work as it should. Was able to fly around, spawn and drive vehicles as well as shoot my guns (except the rocket launcher, but this was the case earlier, too).
Alright then, I guess this issue is fixed. Thanks for testing.
@chris-echoz I've just been told that sound can not be loaded with Steam version. The reason for this is audio/sfx
folder, which is named audio/SFX
in other GTA versions. Can you hear sounds with your version ?
@in0finite I did not hear any sounds, but I also don't believe I heard any when I played with the FAT disk image.
Now I don't get it. How is it possible that you didn't hear sounds with FAT ? By sounds, I mean weapon sounds when you shoot, and startup music.
I tested both just now, and you're right. Audio works with the FAT image, but not with the game from Steam stored on ext4.
Try it now, from audio-lib
branch. It looks for "sfx" folder if "SFX" folder does not exist.
Btw, can you send me the contents of GTA installation, for example, by using tree
command ? So that I can test everything without asking you.
audio-lib
branch fixed the audio for me.
Here's the output of tree
:
https://gist.github.com/chris-echoz/666b9574baf60c3efc74875586c5f388
And output of find
, which might be more useful:
https://gist.github.com/chris-echoz/11c57a21076de4502792ff6765531eb6
Running the game on Linux with EXT4 and the Steam version of the game, I encounter a lot of errors with files the game is unable to locate due to the case in the path being different. For instance the "Data" directory has a capital D where as the game looks for "data". I've had to work around this by creating a disk image with FAT32 and copying the game data there. The code should perhaps be updated to ignore case when looking for files.