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

Exporting a build over a saved cart corrupts the cart and memory #2508

Open
SolarLune opened this issue Apr 17, 2024 · 2 comments
Open

Exporting a build over a saved cart corrupts the cart and memory #2508

SolarLune opened this issue Apr 17, 2024 · 2 comments

Comments

@SolarLune
Copy link

SolarLune commented Apr 17, 2024

Hey, just wanted to report this - looks like if you export a native executable over a saved cart (.tic file), it corrupts the cart in-memory, so that you lose your data.

To reproduce this, create a new cart, save it as a filename (say, "test.tic"), then run an export command with the same filename (export linux test.tic). This will create a corrupted build, and the data in-memory is corrupted. I got hit by this when I went to try exporting and pressed tab to autocomplete the filename (which, naturally, included the file extension).

As an aside, once the program's memory is in this state, pressing F5 to get to the music editor will crash TIC-80.

@SolarLune SolarLune changed the title Exporting a build over a saved cart corrupts the cart (!) Exporting a build over a saved cart corrupts the cart Apr 17, 2024
@SolarLune SolarLune changed the title Exporting a build over a saved cart corrupts the cart Exporting a build over a saved cart corrupts the cart and memory Apr 17, 2024
@Skeptim
Copy link
Contributor

Skeptim commented Apr 17, 2024

Ah yes, that's the wikipage that is not clear enough. I will improve that, thanks!

The .tic files are in the TIC-80 format, the goal of the export command is to export the file in a different format. So you should do export linux test or export win test.exe but not test.tic.
If you rename your file test you should be able to execute it on linux.

@SolarLune
Copy link
Author

SolarLune commented Apr 17, 2024

Ah yes, that's the wikipage that is not clear enough. I will improve that, thanks!

The .tic files are in the TIC-80 format, the goal of the export command is to export the file in a different format. So you should do export linux test or export win test.exe but not test.tic. If you rename your file test you should be able to execute it on linux.

Better documentation definitely can be very helpful, but the problem is a bit bigger than documentation. The real issue is that if you overwrite a cart using export, it corrupts TIC-80 and your project in memory, making it so that not only did you overwrite the cart on disk, but you can't resave the program. (As an aside, the executable generated is also corrupted.)

If you didn't make a backup, the project's just gone, as far as I can tell.

I presume that this problem is the same regardless of what exact command you use, so something like exporting graphics PNGs over the cart would probably create the same result. An easy fix this on TIC-80's side is just to disallow exporting or saving a resource over a .tic file (so something like if a file path exists, it should internally check to see if it's a TIC-80 project and, if so, disallow saving over it).

However, this also makes me wary of things outside of TIC-80 altering the cart, like renaming the cart or moving it while TIC-80 is open. Ideally, the program should hold the working cart completely in-memory so changes to the cart on disk wouldn't affect the project while you have it open.

EDIT: Here's a link to another person over on itch.io who had the same experience.

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