PowerBlocks SDK
 
Loading...
Searching...
No Matches
video.h File Reference

Manages the video output of the system. More...

#include <stdint.h>
#include "powerblocks/core/graphics/framebuffer.h"

Go to the source code of this file.

Classes

struct  video_profile_t
 

Typedefs

typedef void(* video_retrace_callback_t) ()
 Called at the begining of the video retrace.
 

Enumerations

enum  video_mode_t {
  VIDEO_MODE_UNINITIALIZED , VIDEO_MODE_640X480_NTSC_INTERLACED , VIDEO_MODE_640X480_NTSC_PROGRESSIVE , VIDEO_MODE_640X480_PAL50 ,
  VIDEO_MODE_640X480_PAL60
}
 Supported modes for the video interface. More...
 

Functions

video_mode_t video_system_default_video_mode ()
 Gets the video mode of the console.
 
const video_profile_tvideo_get_profile (video_mode_t mode)
 Gets a video profile from a video mode.
 
void video_initialize (video_mode_t mode)
 Initializes the video output.
 
void video_set_framebuffer (const framebuffer_t *framebuffer)
 Sets the frame buffer presented to the screen.
 
framebuffer_tvideo_get_framebuffer ()
 Gets the frame buffer currently displayed.
 
void video_wait_vsync ()
 Waits for the next vsync with interrupts.
 
void video_wait_vsync_int ()
 Waits for the next vsync without interrupts.
 
void video_set_retrace_callback (video_retrace_callback_t callback)
 Sets the retrace callback.
 

Detailed Description

Manages the video output of the system.

Interacts and initializes the video interface. Has functions for working with VSync, creating and using framebuffers.

Author
Samuel Fitzsimons (rainbain)
Date
2025 @license MIT (see LICENSE file)

Typedef Documentation

◆ video_retrace_callback_t

typedef void(* video_retrace_callback_t) ()

Called at the begining of the video retrace.

Usually used to set off a pixel engine copy into the frame buffer so that you dont get artifacts while copying.

Enumeration Type Documentation

◆ video_mode_t

Supported modes for the video interface.

This enum is used to selected between the diffent video modes supported by the video interface. More could be supported, but these are the ones programmed into the system.

Function Documentation

◆ video_get_framebuffer()

framebuffer_t * video_get_framebuffer ( )
extern

Gets the frame buffer currently displayed.

Gets the frame buffer currently displayed. Can be used for some interesting functionality.

◆ video_get_profile()

const video_profile_t * video_get_profile ( video_mode_t mode)
extern

Gets a video profile from a video mode.

Get a video profile from a video mode.

Parameters
profileMode to set into.

◆ video_initialize()

void video_initialize ( video_mode_t mode)
extern

Initializes the video output.

Initializes the video interface with a given video mode.

Parameters
modeMode for the video interface.

◆ video_set_framebuffer()

void video_set_framebuffer ( const framebuffer_t * framebuffer)
extern

Sets the frame buffer presented to the screen.

Sets the frame buffer presented to the screen.

Parameters
framebufferFramebuffer to put to the screen.

◆ video_set_retrace_callback()

void video_set_retrace_callback ( video_retrace_callback_t callback)
extern

Sets the retrace callback.

This is called from the interrupt handler for the retrace from the video interface. Make sure to handle code coming from an interrupter appropriately.

Parameters
callbackFunction pointer to call on retrace.

◆ video_system_default_video_mode()

video_mode_t video_system_default_video_mode ( )
extern

Gets the video mode of the console.

Looks at the system settings to get the system video mode.

Must be called AFTER ios_initialize.

This function is unfinished. I need dumps of the other video modes.

Returns
Default video mode.

◆ video_wait_vsync()

void video_wait_vsync ( )
extern

Waits for the next vsync with interrupts.

Waits for the next vsync, waits for the next display interrupt to measure when the display goes into retrace.

◆ video_wait_vsync_int()

void video_wait_vsync_int ( )
extern

Waits for the next vsync without interrupts.

Waits for the next vsync, in a interrupt handler safe way. It does by just waiting till the vertical position is in range.

This function seems to have some issues, make sure it actually works. May or may not be an emulator thing.