Integration guide for decompilation projects (like pokefirered and pokeemerald).
pokefirered.mp4
pokeemerald-expansion.mp4
This guide is available in the following languages:
English |
Español |
Português (BR) |
Français |
Deutsch |
Italiano |
Português |
Nederlands |
Polski
Türkçe |
Tiếng Việt |
Bahasa Indonesia |
हिन्दी |
Русский |
日本語 |
简体中文 |
繁體中文 |
한국어
After encoding a video with GBA Video Studio, you will find an output/ folder. Copy these files into your project structure:
Source (output/) |
Destination in your project |
|---|---|
graphics/video/ |
graphics/video/ |
include/video.h |
include/video.h |
src/video.c |
src/video.c |
Note:
video.handgraphics/video/are regenerated every time you perform a new encoding; always replace them.video.conly needs to be copied once.
Include the header file in the .c files where you need to control the player:
#include "video.h"Use these functions to manage playback:
// Initialize and start the video. Call after ResetTasks().
u8 VideoPlayer_Start(void);
// Returns TRUE once the video has finished and resources are freed.
bool8 VideoPlayer_IsDone(void);
// Immediately stop playback and restore hardware state.
void VideoPlayer_ForceStop(void);The recommended pattern is to manage the state within gMain.state in your callback:
static void CB2_PlayVideo(void)
{
switch (gMain.state)
{
case 0:
ResetTasks();
if (VideoPlayer_Start() != TASK_NONE)
gMain.state++;
break;
case 1:
RunTasks();
if (VideoPlayer_IsDone())
SetMainCallback2(CB2_YourNextScreen); // Next screen
break;
}
}The skip key(s) are determined by your settings in the application at the time of encoding. However, you can manually override this configuration by defining VIDEO_SKIP_KEY in your source file before including video.h (you may use a bitmask to combine multiple buttons, e.g., A_BUTTON | B_BUTTON | START_BUTTON):
// In your source file:
#define VIDEO_SKIP_KEY (A_BUTTON | B_BUTTON | START_BUTTON)
#include "video.h"To disable skipping entirely, use #define VIDEO_SKIP_KEY 0.
- Error:
undefined reference to VideoPlayer_StartEnsuresrc/video.cis copied into your project'ssrc/directory and that the build system is including it. - Error:
cannot open graphics/video/video_data.binVerify that thegraphics/video/folder contains all the files generated by the application. - Distorted audio or volume fluctuations (ADPCM)
Ensure
VideoPlayer_Start()is called only once when starting the sequence (thegMain.statepattern above prevents multiple calls).