-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: Add Maxmod + NitroFAT example
- Loading branch information
Showing
6 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nitrofat/soundbank.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SPDX-License-Identifier: CC0-1.0 | ||
# | ||
# SPDX-FileContributor: Antonio Niño Díaz, 2023 | ||
|
||
BLOCKSDS ?= /opt/blocksds/core | ||
|
||
# User config | ||
|
||
NAME := maxmod_nitrofat | ||
GAME_TITLE := Maxmod NitroFAT example | ||
|
||
# Source code paths | ||
|
||
SOURCEDIRS := source | ||
AUDIODIRS := audio | ||
# When a directory is added to NITROFATDIR, the Makefile rules will save the | ||
# soundbank to that directory instead of the build directory. | ||
NITROFATDIR := nitrofat | ||
|
||
# Libraries | ||
|
||
LIBS := -lnds9 -lmm9 | ||
LIBDIRS := $(BLOCKSDS)/libs/maxmod | ||
|
||
include ../../tests/Makefile.include |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This is here so that the NitroFAT filesystem isn't empty and the Makefile | ||
creates the Maxmod soundbank here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
// | ||
// SPDX-FileContributor: Antonio Niño Díaz, 2023 | ||
|
||
#include <stdbool.h> | ||
#include <stdio.h> | ||
|
||
#include <filesystem.h> | ||
#include <maxmod9.h> | ||
#include <nds.h> | ||
|
||
#include "soundbank.h" | ||
|
||
// - lasse_haen_pyykit.xm | ||
// | ||
// XM module by Lasse. Obtained from the original libxm7 example by sverx | ||
// | ||
// - Parallax Glacier by Raina | ||
// | ||
// http://modarchive.org/index.php?request=view_by_moduleid&query=163194 | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
consoleDemoInit(); | ||
|
||
printf("maxmod NitroFAT example\n"); | ||
printf("=======================\n"); | ||
printf("\n"); | ||
printf("START: Return to loader\n"); | ||
printf("\n"); | ||
printf("\n"); | ||
|
||
// It isn't needed to call fatInitDefault() manually. If nitroFSInit detects | ||
// that the ROM is running in a flashcard or from the DSi internal SD slot, | ||
// it will call it internally. | ||
bool init_ok = nitroFSInit(NULL); | ||
if (!init_ok) | ||
{ | ||
perror("nitroFSInit()"); | ||
while (1) | ||
{ | ||
swiWaitForVBlank(); | ||
uint16_t keys = keysDown(); | ||
if (keys & KEY_START) | ||
return 0; | ||
} | ||
} | ||
|
||
printf("NitroFAT init ok!\n"); | ||
printf("\n"); | ||
printf("\n"); | ||
|
||
printf("X: haen pyykit by Lasse\n"); | ||
printf("Y: Parallax Glacier by Raina\n"); | ||
printf("\n"); | ||
printf("B: Stop song\n"); | ||
printf("\n"); | ||
|
||
mmInitDefault("nitro:/soundbank.bin"); | ||
|
||
mmLoad(MOD_PARALLAX_80599); | ||
mmLoad(MOD_LASSE_HAEN_PYYKIT); | ||
|
||
soundEnable(); | ||
|
||
bool playing = false; | ||
|
||
while (1) | ||
{ | ||
swiWaitForVBlank(); | ||
|
||
scanKeys(); | ||
|
||
uint16_t keys_down = keysDown(); | ||
|
||
if (keys_down & KEY_B) | ||
{ | ||
if (playing) | ||
{ | ||
mmStop(); | ||
playing = false; | ||
} | ||
} | ||
|
||
if (keys_down & KEY_X) | ||
{ | ||
if (playing) | ||
mmStop(); | ||
|
||
mmStart(MOD_LASSE_HAEN_PYYKIT, MM_PLAY_LOOP); | ||
playing = true; | ||
} | ||
|
||
if (keys_down & KEY_Y) | ||
{ | ||
if (playing) | ||
mmStop(); | ||
|
||
mmStart(MOD_PARALLAX_80599, MM_PLAY_LOOP); | ||
playing = true; | ||
} | ||
|
||
if (keys_down & KEY_START) | ||
break; | ||
} | ||
|
||
soundDisable(); | ||
|
||
return 0; | ||
} |