Skip to content

Commit

Permalink
Make save overwrite safer
Browse files Browse the repository at this point in the history
  • Loading branch information
randomouscrap98 committed Aug 17, 2023
1 parent b6bc77b commit efdfba6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.4.0

* Fixed major bug where setting program actually sets fx data (sorry!!)
* Added silly + simple .arduboy package creator to toolset (for now it's a duplicate of the slot widget, may have more fields later)
* Added ability to tack on FX dev data on sketch upload
* Detect when FX data has save at the end, alert + ask if you want to split
* Stop logging every time arduboy is pinged from main app (fills logs with useless junk)
* Make arduboy parser prefer an image called "title.png" if available (for title)

## 0.3.1

Small changes, export to .arduboy
Expand Down
6 changes: 4 additions & 2 deletions widget_slot.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,12 @@ def select_data(self):
unused_pages = count_unused_pages(data)
if (unused_pages % (arduboy.fxcart.SAVE_ALIGNMENT // FX_PAGESIZE)) == 0:
# Ask if the user wants to create a save out of this
if gui_utils.yes_no("Save section discovered",
if gui_utils.yes_no("Split save section out",
"The data provided appears to have a save section at the end. This is normal when using the development binary. Do you want to strip the save and add it properly to the slot (recommended)?",
self):
self.parsed.save_raw = data[-unused_pages * FX_PAGESIZE:]
if not len(self.parsed.save_raw) or gui_utils.yes_no("Warn: Overwrite existing save",
"Data set to truncate. However, there's already a save section, do you want to overwrite the existing save (not recommended)?", self):
self.parsed.save_raw = data[-unused_pages * FX_PAGESIZE:]
data = data[:-unused_pages * FX_PAGESIZE]
self.parsed.data_raw = data
self.update_metalabel()
Expand Down

0 comments on commit efdfba6

Please sign in to comment.