aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-05-28 09:27:03 +0200
committerBad Diode <bd@badd10de.dev>2023-05-28 09:27:03 +0200
commitaf68ac1e1bb77fd821e042d2c8ea9a159c970d20 (patch)
treedbe9ed56d0a846c1c79db3c39e9e6f9655be6821
parentaa3db2f8c3af8163a707a87cd946c2a30070ced4 (diff)
downloadstepper-af68ac1e1bb77fd821e042d2c8ea9a159c970d20.tar.gz
stepper-af68ac1e1bb77fd821e042d2c8ea9a159c970d20.zip
Fix bug for pattern chaining
-rw-r--r--Makefile7
-rw-r--r--src/main.c7
-rw-r--r--src/sequencer.c2
3 files changed, 7 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index ead3e48..7eb4b11 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS))
27INC_FLAGS += -I$(LIBGBA_SRC) 27INC_FLAGS += -I$(LIBGBA_SRC)
28 28
29# Output library names and executables. 29# Output library names and executables.
30TARGET := STEPPER-v1.3 30TARGET := STEPPER-v1.4-dev
31ELF := $(BUILD_DIR)/$(TARGET).elf 31ELF := $(BUILD_DIR)/$(TARGET).elf
32BIN := $(BUILD_DIR)/$(TARGET).gba 32BIN := $(BUILD_DIR)/$(TARGET).gba
33 33
@@ -37,7 +37,7 @@ OBJCOPY := $(DEVKITBIN)/arm-none-eabi-objcopy
37ARCH := -mthumb -mthumb-interwork 37ARCH := -mthumb -mthumb-interwork
38SPECS := -specs=gba.specs 38SPECS := -specs=gba.specs
39CONFIG := 39CONFIG :=
40CFLAGS := -Wall -Wextra -pedantic -Wno-incompatible-pointer-types 40CFLAGS := -Wall -Wextra -Wdouble-promotion -pedantic -Wno-incompatible-pointer-types -Wconversion -Wno-sign-conversion
41CFLAGS += -fno-strict-aliasing 41CFLAGS += -fno-strict-aliasing
42CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH) 42CFLAGS += -mcpu=arm7tdmi -mtune=arm7tdmi $(ARCH)
43CFLAGS += $(INC_FLAGS) 43CFLAGS += $(INC_FLAGS)
@@ -45,13 +45,14 @@ CFLAGS += $(CONFIG)
45LDFLAGS := $(ARCH) $(SPECS) 45LDFLAGS := $(ARCH) $(SPECS)
46LDLIBS := $(LIBGBA) 46LDLIBS := $(LIBGBA)
47RELEASE_CFLAGS := -DNDEBUG -O2 47RELEASE_CFLAGS := -DNDEBUG -O2
48DEBUG_CFLAGS := -DDEBUG -O2 -g 48DEBUG_CFLAGS := -DDEBUG -O2 -g3 -Wno-unused-parameter -Wno-unused-function
49 49
50.PHONY: clean run 50.PHONY: clean run
51 51
52# Setup debug/release builds. 52# Setup debug/release builds.
53# make clean && make <target> DEBUG=0 53# make clean && make <target> DEBUG=0
54# make clean && make <target> DEBUG=1 54# make clean && make <target> DEBUG=1
55# TODO: make a new debugging mode with extra options (sanitizers, etc.)
55DEBUG ?= 0 56DEBUG ?= 0
56ifeq ($(DEBUG), 1) 57ifeq ($(DEBUG), 1)
57 CFLAGS += $(DEBUG_CFLAGS) 58 CFLAGS += $(DEBUG_CFLAGS)
diff --git a/src/main.c b/src/main.c
index d8939ed..abc8571 100644
--- a/src/main.c
+++ b/src/main.c
@@ -41,9 +41,9 @@ WITH REGARD TO THIS SOFTWARE.
41// 41//
42// Bugfixes 42// Bugfixes
43// - Sound can get hung up sometimes, but I can't reproduce when this happens. 43// - Sound can get hung up sometimes, but I can't reproduce when this happens.
44// Not sure if this is an emulator thing or happens also in hardware. 44// Not sure if this is an emulator thing or happens also in hardware.
45// - Cursor can stay in position instead of dissapering, again I can't 45// - Cursor can stay in position instead of dissapering, again I can't
46// reproduce this right now, just happened randomly. Needs investigation. 46// reproduce this right now, just happened randomly. Needs investigation.
47// 47//
48 48
49#include "gba/gba.h" 49#include "gba/gba.h"
@@ -112,9 +112,6 @@ main(void) {
112 // Adjust system wait times. 112 // Adjust system wait times.
113 SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE; 113 SYSTEM_WAIT = SYSTEM_WAIT_CARTRIDGE;
114 114
115 // Initialize filesystem.
116 fs_init();
117
118 // Initialize renderer. 115 // Initialize renderer.
119 renderer_init(); 116 renderer_init();
120 117
diff --git a/src/sequencer.c b/src/sequencer.c
index 65a2f46..6aa8eea 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -21,12 +21,12 @@ bool update_bpm = false;
21 21
22void 22void
23play_step(void) { 23play_step(void) {
24 Pattern *pat = &patterns[current_pattern];
24 if (current_pattern != next_pattern && step_counter == 15) { 25 if (current_pattern != next_pattern && step_counter == 15) {
25 current_pattern = next_pattern; 26 current_pattern = next_pattern;
26 redraw_pattern_buttons = true; 27 redraw_pattern_buttons = true;
27 update_bpm = true; 28 update_bpm = true;
28 } 29 }
29 Pattern *pat = &patterns[current_pattern];
30 if (pat->ch1.active) { 30 if (pat->ch1.active) {
31 TriggerNote *trig = &pat->ch1.notes[step_counter]; 31 TriggerNote *trig = &pat->ch1.notes[step_counter];
32 ChannelSquareParams *params = &pat->ch1.params[step_counter]; 32 ChannelSquareParams *params = &pat->ch1.params[step_counter];