Homebrew Video Cutscenes

LeRodeur

Well-Known Member
Member
Joined
Dec 12, 2009
Messages
162
Trophies
0
Age
30
XP
190
Country
France
Could you give the full source?
this keys variable seems suspect, libnds problem? Have you tried the examples that uses buttons?
Edit. Wouldn't it be better with scanKeys(); instead of scanKeys; ? ;)
 

Dirbaio

Well-Known Member
Member
Joined
Sep 26, 2010
Messages
158
Trophies
0
Age
111
Location
Spain
Website
dirbaio.net
XP
108
Country
You could try streaming MP3 with ASLib for the audio. The problem is that then you can't use maxmod (the mp3 decoder and maxmod don't fit both at the same time on ARM7's memory).

Or you could stream the raw PCM files, it can be done from the ARM9 easily, so you can keep maxmod :P
 

loco365

Well-Known Member
OP
Member
Joined
Sep 1, 2010
Messages
5,457
Trophies
0
XP
2,927
Could you give the full source?
this keys variable seems suspect, libnds problem? Have you tried the examples that uses buttons?
Edit. Wouldn't it be better with scanKeys(); instead of scanKeys; ? ;)
Full source in spoilers below:
Code:
/*
-------------------------------------------------

NightFox's Lib Template
Ejemplo carga de fondos en 16bits (modo BITMAP)

Requiere DevkitARM
Requiere NightFox's Lib

Codigo por NightFox
http://www.nightfoxandco.com
Inicio 10 de Octubre del 2009

(c)2009 - 2011 NightFox & Co.

-------------------------------------------------
-------------------------------------------------
Includes
-------------------------------------------------
*/

// Includes C
#include 
#include 
#include 

// Includes propietarios NDS
#include 

// Includes librerias propias
#include 
#include     // Maxmod definitions for ARM9
#include "soundbank.h"  // Soundbank definitions
#include "soundbank_bin.h"

void __libnds_exit(int rc) {
iprintf("\nExiting with retcode %d\n", rc);
while(1) swiWaitForVBlank();
}

/*
-------------------------------------------------
Main() - Bloque general del programa (Mod by TF)
-------------------------------------------------
*/

int main(int argc, char **argv) {

// Pantalla de espera inicializando NitroFS
NF_Set2D(0, 0);
NF_Set2D(1, 0); 
consoleDemoInit();
iprintf("Initiating FAT... Please Wait.");
swiWaitForVBlank();
u16 keys = 0;
mmInitDefault( "soundbank.bin" );

// Define el ROOT e inicializa el sistema de archivos
NF_SetRootFolder("Crazy_Moto"); // Define la carpeta ROOT para usar NITROFS

//This section overrides the function to shut off the system if Main() ends.

// Inicializa el motor 2D en modo BITMAP
NF_Set2D(0, 5); // Modo 2D_5 en ambas pantallas
NF_Set2D(1, 5);

// Inicializa los fondos en modo "BITMAP"
NF_InitBitmapBgSys(0, 1);
NF_InitBitmapBgSys(1, 1);
consoleClear(); //Clears text console.
defaultExceptionHandler();//Sets up Guru Meditation errors so you can troubleshoot in the event of a crash

// Inicializa los buffers para guardar fondos en formato BITMAP
NF_Init16bitsBgBuffers();

// Carga el archivo BITMAP de imagen en formato RAW a la RAM
NF_Load16bitsBg("bmp/top_intro_1", 0);
NF_Load16bitsBg("bmp/touch_intro_1", 1);
// Tranfiere la imagen a la VRAM de ambas pantallas
NF_Copy16bitsBuffer(0, 0, 0);
NF_Copy16bitsBuffer(1, 0, 1);
swiWaitForVBlank();

// Si no es necesario usarla mas, borrala de la RAM
scanKeys();
if( !(keysDown() & KEY_A)) { scanKeys();}
NF_Unload16bitsBg(0);
NF_Unload16bitsBg(1);
NF_Reset16bitsBgBuffers();
NF_Load16bitsBg("bmp/top_intro_2", 0);
NF_Load16bitsBg("bmp/touch_intro_2", 1);
NF_Copy16bitsBuffer(0, 0, 0);
NF_Copy16bitsBuffer(1, 0, 1);
swiWaitForVBlank();
scanKeys();
if( !(keysDown() & KEY_A)) { scanKeys();}
NF_Unload16bitsBg(0);
NF_Unload16bitsBg(1);
NF_Reset16bitsBgBuffers();
swiWaitForVBlank();
mmLoad ( MOD_CMOTO );
mmStart( CMOTO, MM_PLAY_LOOP );
return 0; 

}
You could try streaming MP3 with ASLib for the audio. The problem is that then you can't use maxmod (the mp3 decoder and maxmod don't fit both at the same time on ARM7's memory).

Or you could stream the raw PCM files, it can be done from the ARM9 easily, so you can keep maxmod :P
I think I'll try streaming PCM from the arm9. Now I need to read up on how to do that xD
...and it took 4 hours of tinkering to get maxmod working.
 

Dirbaio

Well-Known Member
Member
Joined
Sep 26, 2010
Messages
158
Trophies
0
Age
111
Location
Spain
Website
dirbaio.net
XP
108
Country
I think I'll try streaming PCM from the arm9. Now I need to read up on how to do that xD
...and it took 4 hours of tinkering to get maxmod working.

wavplayer.cpp http://pastebin.com/W1RbfgVw
wavplayer.h http://pastebin.com/4BkwhZrY
main.cpp (example usage) http://pastebin.com/HXfiS98g

EDIT: This is from a prototype sound engine I'm working on right now. I'll probably abandon it because I'm realizing it won't be as awesome as I wanted it to be :(
It plays the .pcm file looped, seamlessly. You can change the sample rate in wavplayer.cpp line 109. I recommend you don't use higher than 32kHz, because that's what the DS hardware can play at maximum, if you set it higher than that you'll get no quality improvement.

EDIT2: I haven't tested it with maxmod. It should work as long as you don't use both to play stuff at the same time.
 

LeRodeur

Well-Known Member
Member
Joined
Dec 12, 2009
Messages
162
Trophies
0
Age
30
XP
190
Country
France
Why didn't you put the while as I said? Try this:
do scanKeys(); while( !(keysDown() & KEY_A)) NF_Unload16bitsBg(0); NF_Unload16bitsBg(1); NF_Reset16bitsBgBuffers(); NF_Load16bitsBg("bmp/top_intro_2", 0); NF_Load16bitsBg("bmp/touch_intro_2", 1); NF_Copy16bitsBuffer(0, 0, 0); NF_Copy16bitsBuffer(1, 0, 1); swiWaitForVBlank(); do scanKeys(); while( !(keysDown() & KEY_A)) NF_Unload16bitsBg(0); NF_Unload16bitsBg(1); NF_Reset16bitsBgBuffers(); swiWaitForVBlank(); mmLoad ( MOD_CMOTO ); mmStart( CMOTO, MM_PLAY_LOOP );
while (1) swiWaitForVBlank();
Why the hell returning a value in your main function on nds? And you need the last while I added to keep the program working
 

loco365

Well-Known Member
OP
Member
Joined
Sep 1, 2010
Messages
5,457
Trophies
0
XP
2,927
Why didn't you put the while as I said? Try this:
do scanKeys(); while( !(keysDown() & KEY_A)) NF_Unload16bitsBg(0); NF_Unload16bitsBg(1); NF_Reset16bitsBgBuffers(); NF_Load16bitsBg("bmp/top_intro_2", 0); NF_Load16bitsBg("bmp/touch_intro_2", 1); NF_Copy16bitsBuffer(0, 0, 0); NF_Copy16bitsBuffer(1, 0, 1); swiWaitForVBlank(); do scanKeys(); while( !(keysDown() & KEY_A)) NF_Unload16bitsBg(0); NF_Unload16bitsBg(1); NF_Reset16bitsBgBuffers(); swiWaitForVBlank(); mmLoad ( MOD_CMOTO ); mmStart( CMOTO, MM_PLAY_LOOP );
while (1) swiWaitForVBlank();
Why the hell returning a value in your main function on nds? And you need the last while I added to keep the program working
Ok. I rewrote that bottom part to what you have, and it works now, I have buttonpresses. Now, when I press A on the top/touch_intro_2 part to load the audio, I get a Guru Meditation error. I'm going to see if I can find what's causing the issue.

Keep in mind I'm still new to this. And this is a real learning curve.
 

loco365

Well-Known Member
OP
Member
Joined
Sep 1, 2010
Messages
5,457
Trophies
0
XP
2,927
Ok. Got the audio fixed. It was trying to get the audio from FAT when I had it load from the NDS itself. Now I need to implement that cutscene video and get Dirbaio's .wav library working.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: I am the cancer!!! lol