From efdfba62104afcd0841e3055e8a64e87b728a040 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Thu, 17 Aug 2023 00:22:10 -0400 Subject: [PATCH] Make save overwrite safer --- CHANGELOG.md | 9 +++++++++ widget_slot.py | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4496fd..900e4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/widget_slot.py b/widget_slot.py index 540cadb..93e98c2 100644 --- a/widget_slot.py +++ b/widget_slot.py @@ -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()