Skip to content

Commit

Permalink
Integrate "Apex Audio System" for audio playback.
Browse files Browse the repository at this point in the history
(This necessitated the removal of the TIMER_PERFORMANCE timer type, as timer 0 and timer 1 are reserved for AAS; we now only have the regular timer type left, which is completly sufficient.)

Fix Makefile structure (so we don't have to invoke "make models" before invoking make).
  • Loading branch information
zeichensystem committed Jun 30, 2021
1 parent 3365a56 commit 9ec2190
Show file tree
Hide file tree
Showing 77 changed files with 10,766 additions and 334 deletions.
Binary file removed .DS_Store
Binary file not shown.
8 changes: 0 additions & 8 deletions .gitignore

This file was deleted.

30 changes: 0 additions & 30 deletions .vscode/c_cpp_properties.json

This file was deleted.

43 changes: 0 additions & 43 deletions .vscode/launch.json

This file was deleted.

26 changes: 0 additions & 26 deletions .vscode/settings.json

This file was deleted.

70 changes: 0 additions & 70 deletions .vscode/tasks.json

This file was deleted.

38 changes: 22 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ endif

include $(DEVKITARM)/gba_rules

MGBA := /Applications/mGBA.app/Contents/MacOS/mGBA # for "make run"
# The mGBA binary "make run":
MGBA := /Applications/mGBA.app/Contents/MacOS/mGBA

#---------------------------------------------------------------------------------
# TARGET is the name of the output
Expand All @@ -24,8 +25,8 @@ MGBA := /Applications/mGBA.app/Contents/MacOS/mGBA # for "make run"
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source source/scenes source/render asm data
INCLUDES := include $(DEVKITPRO)/libtonc/include/
SOURCES := source source/scenes source/render asm data-models data-audio
INCLUDES := include $(DEVKITPRO)/libtonc/include/ $(CURDIR)/lib/apex-audio-system/build/aas/include/
DATA :=
MUSIC :=

Expand Down Expand Up @@ -61,14 +62,14 @@ LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -ltonc -lm

LIBS := -ltonc -lm -lAAS

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(DEVKITPRO)/libtonc/ $(LIBGBA) #$(CURDIR)/lib/libtonc/
LIBDIRS := $(DEVKITPRO)/libtonc/ $(CURDIR)/lib/apex-audio-system/build/aas/
#$(CURDIR)/lib/libtonc/ $(LIBGBA)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
Expand Down Expand Up @@ -125,26 +126,31 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-iquote$(CURDIR)/$(dir)) \

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean run
.PHONY: $(BUILD) clean run all

# Oh my... We have to $(MAKE) $(BUILD), i.e. make the build target with a new invocation of "make", to "recompute" the SOURCE variable (and everything that depends on it) because
# sourcefiles are generated in data-audio and data-models by the invocations of "Makefile-Music" and "Makefile-Models" if applicable.
# If we don't do this, we get linker errors when we "make" after "make clean" (as the newly generated source files in data-audio and data-models won't be considered then until the next "make" invocation).
all:
@$(MAKE) -f $(CURDIR)/assets/Makefile-Music
@$(MAKE) -f $(CURDIR)/assets/Makefile-Models

@$(MAKE) $(BUILD)

#---------------------------------------------------------------------------------
$(BUILD):

$(BUILD):
@[ -d $@ ] || mkdir -p $@
# $(MAKE) -C $(CURDIR)/lutcalc -f Makefile
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile


models: $(CURDIR)/assets/models/*.obj
python3 $(CURDIR)/tools/obj2model.py

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba
@rm -f $(CURDIR)/lutcalc/lutcalc
@rm -f $(CURDIR)/data/*
@rm -f $(CURDIR)/data-models/*
@rm -f $(CURDIR)/data-audio/*

run: $(BUILD) Makefile
run: all Makefile
$(MGBA) -2 -l 15 $(OUTPUT).gba
#---------------------------------------------------------------------------------
else
Expand Down
14 changes: 8 additions & 6 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# TODO

## Important Features
- [ ] Integration of 'apex audio' for .mod support
- [ ] Camera paths (splines?)
- [ ] Animations (and "native" wireframe model support (only edges, not faces; maybe even 2d))
- [ ] Particle systems
- [ ] Affine texture mapping (cf. fatmap.txt)
- [ ] Subpixel-accuracy (cf. fatmap2.txt)

## Implementation details and Bugfixes
- [ ] Proper near-plane clipping
Expand All @@ -17,6 +17,9 @@
- [ ] Option to calculate the actual centroid of a face for sorting
- [ ] Better handling of lookAt singularity (looking completely down/up)

## Misc
- [ ] Create a Readme/How to use

## Done
- [x] Change model-instance draw options to be properties of the model-instances themselves (so we can have different draw styles for different model-instances and don't have to draw all instances the same)
- [x] Fix broken performance measurement (calculate proper averages etc.)
Expand All @@ -25,10 +28,9 @@
- [x] Basic .obj support
- [x] Simplify perspective calculations
- [x] Don't recalculate vertex projections for each face!
- [x] Better polygon sorting (ordering table)
- [x] Alternative to naive polygon sorting (ordering table)
- [x] Mode switching
- [x] Backface culling winding order/normal problem
- [x] Key chording for scene switching

- [x] Handle .obj colours on import (so far, we just set all colours to a default one).
- [x] Use libtonc qran instead of rand
- [x] Key chording/sequences for scene switching
- [x] Handle .obj colours (.mtl) on import
- [x] Integration of 'apex audio system' for .mod support
4 changes: 4 additions & 0 deletions assets/Makefile-Models
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Assumes to be invoked from the project's top-level directory (namely where the top-level devkitarm-based Makefile is located).

data-models/*.c data-models/*.h &: assets/models/*.obj
python3 tools/obj2model.py
7 changes: 7 additions & 0 deletions assets/Makefile-Music
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Assumes to be invoked from the project's top-level directory (namely where the top-level devkitarm-based Makefile is located).

CONV2AAS := lib/apex-audio-system/build/conv2aas/conv2aas

data-audio/*.s data-audio/*.h &: assets/music
@ $(CONV2AAS) assets/music
@ mv AAS_Data.s AAS_Data.h data-audio
Binary file added assets/music/BuxWV250.mod
Binary file not shown.
Binary file added assets/music/aaa.mod
Binary file not shown.
Binary file removed lib/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion lib/apex-audio-system
Submodule apex-audio-system deleted from 103b1d
10 changes: 10 additions & 0 deletions lib/apex-audio-system/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build
*.o
*.sav
*.tmp
*.gba
*.out
*.a
conv2aas
AAS_Data.h
AAS_Data.s
18 changes: 18 additions & 0 deletions lib/apex-audio-system/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2003-2021 James Daniels

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 9ec2190

Please sign in to comment.