Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to read a file without interpreting escape sequences #6

Open
LionDoge opened this issue Oct 13, 2024 · 2 comments
Open

Option to read a file without interpreting escape sequences #6

LionDoge opened this issue Oct 13, 2024 · 2 comments

Comments

@LionDoge
Copy link

Currently the library seems to interpret all escape sequences (starting with backslash) inside strings, in the kv3 text reader.
This might not be desired all the time, since it appears that some, if not all games (at least on Source 2) seem to not care about these, and interpret backslashes as a literal character. Even Source2Viewer outputs with this assumption, which causes inconsistency when trying to read a decompiled file directly outputted by that tool.
My suggestion would be to add an optional parameter to kv3.read() to change this behavior.

@kristiker
Copy link
Owner

I just compiled a CS2 scripts/game_asset_tags.vdata file with the sbox resourcecompiler.exe, and it escaped the characters. Can you show an example where it doesn't?

Source2Viewer_1Q0aK9rqJs.mp4

@LionDoge
Copy link
Author

Sorry for a pretty late answer on that, as I was a bit busy.
I haven't verified exactly which compilers do what, I may have jumped to a wrong conclusion here assuming a behavior.
However what I verified is that for CS:GO/CS2's bot behavior trees backspaces seem to be treated literally i.e. they don't cause any issues in nodes where I can type a custom name that includes a backslash (a one that would definitely be an invalid sequence, if treated literally).

The main driving force for me opening this issue was the inconsistency with other tools though (as I don't know if this is standardized somewhre at this point or not). Good example is Source 2 Viewer/Decompiler, where the output assumes that characters are not escaped, and this does cause issues when reading back the outputted file directly. It is very apparent in vents_c files where backslashes appear pretty often and cause invalid sequences issues when using this library to read.

Now I don't know if the problem lies in S2V and if the behavior here should be changed, because as I mentionted I don't think there's really a standard, so that's why I'm thinking that having a toggle would be a good idea for now. But that's just my idea, if you know better solutions then I would be glad for anything!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants