Skip to content

Latest commit

 

History

History
143 lines (102 loc) · 4.23 KB

INTEGRATION.md

File metadata and controls

143 lines (102 loc) · 4.23 KB

GBA Video Studio — Decompilation Project Integration

Integration guide for decompilation projects (like pokefirered and pokeemerald).

Demos

pokefirered.mp4
pokeemerald-expansion.mp4

🌐 Translations

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 | हिन्दी | Русский | 日本語 | 简体中文 | 繁體中文 | 한국어


Table of Contents

  1. Required Files
  2. Code Integration
  3. Implementation Example
  4. Advanced Configuration
  5. Troubleshooting

1. Required Files

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.h and graphics/video/ are regenerated every time you perform a new encoding; always replace them. video.c only needs to be copied once.


2. Code Integration

2.1 Header

Include the header file in the .c files where you need to control the player:

#include "video.h"

2.2 Control API

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);

3. Implementation Example

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;
    }
}

4. Advanced Configuration

Skip Key

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.


5. Troubleshooting

  • Error: undefined reference to VideoPlayer_Start Ensure src/video.c is copied into your project's src/ directory and that the build system is including it.
  • Error: cannot open graphics/video/video_data.bin Verify that the graphics/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 (the gMain.state pattern above prevents multiple calls).