Skip to content

Commit

Permalink
fixes for duo makefile and versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed May 3, 2024
1 parent 0e98c52 commit 3cc4c10
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ APPEND = 0x00
# storage of modes, this does not include the eeprom.
BOOTEND = 0x7e

# The branch/tag suffix for this device
BRANCH_SUFFIX=d

# Fetch tags, determine version numbers based on the latest tag, and slice off the branch suffix
VORTEX_VERSION_MAJOR ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list "*$(BRANCH_SUFFIX)" | sort -V | tail -n1 | sed 's/.$(BRANCH_SUFFIX)$$//' | cut -d. -f1)
VORTEX_VERSION_MINOR ?= $(shell git tag --list "*$(BRANCH_SUFFIX)" | sort -V | tail -n1 | sed 's/.$(BRANCH_SUFFIX)$$//' | cut -d. -f2)
VORTEX_BUILD_NUMBER ?= $(shell git rev-list --count HEAD)

# If no tags are found, default to 0.1.0
VORTEX_VERSION_MAJOR := $(if $(VORTEX_VERSION_MAJOR),$(VORTEX_VERSION_MAJOR),0)
VORTEX_VERSION_MINOR := $(if $(VORTEX_VERSION_MINOR),$(VORTEX_VERSION_MINOR),1)
VORTEX_BUILD_NUMBER := $(if $(VORTEX_BUILD_NUMBER),$(VORTEX_BUILD_NUMBER),0)

# Combine into a full version number
VORTEX_VERSION_NUMBER := $(VORTEX_VERSION_MAJOR).$(VORTEX_VERSION_MINOR).$(VORTEX_BUILD_NUMBER)

# compiler defines
DEFINES=\
-DVORTEX_VERSION_MAJOR=$(VORTEX_VERSION_MAJOR) \
Expand Down Expand Up @@ -136,6 +152,7 @@ all: $(TARGET).hex
$(NM) --numeric-sort --line-numbers --demangle --print-size --format=s $(TARGET).elf > $(TARGET).map
chmod +x avrsize.sh
./avrsize.sh $(TARGET).elf $(BOOTEND)00
@echo "== Success building Duo v$(VORTEX_VERSION_NUMBER) =="

$(TARGET).hex: $(TARGET).elf
$(OBJCOPY) -O binary -R .eeprom $(TARGET).elf $(TARGET).bin
Expand Down
4 changes: 4 additions & 0 deletions VortexEngine/src/Modes/Modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ bool Modes::saveToBuffer(ByteStream &modesBuffer)
// load modes from a save buffer
bool Modes::loadFromBuffer(ByteStream &modesBuffer)
{
if (!modesBuffer.decompress()) {
// failed to decompress?
return false;
}
if (!unserializeSaveHeader(modesBuffer)) {
return false;
}
Expand Down

0 comments on commit 3cc4c10

Please sign in to comment.