Skip to content

VideoPortAPI ​

cpp
#include <VirtualC64.h>
cpp
class VideoPortAPI

Defined in VirtualC64.h:698

Video Port Public API

Public Methods ​

ReturnNameDescription
voidlockTextureLocks the emulator texture.
voidunlockTextureUnlocks the emulator texture.
const u32 *getTexture constReturns a pointer to the most recent stable texture.
const u32 *getTexture constReturns the most recent stable texture together with its frame number.
const u32 *getXrayTexture constReturns a pointer to the most recent stable X-Ray texture.
const u32 *getXrayTexture constReturns the most recent stable X-Ray texture together with its frame number.
voidsaveTexture constSaves the most recent stable texture as a PNG file.
voidsaveTexture constSaves a cutout of the most recent stable texture as a PNG file (see above).
voidsaveXrayTexture constSaves the most recent stable X-Ray texture as a PNG file.
voidsaveXrayTexture constSaves a cutout of the most recent stable X-Ray texture as a PNG file.
voidfindInnerArea constDetermines the area of the texture that contains picture data.
voidfindInnerAreaNormalized constSame as findInnerArea(), but returns normalized coordinates.
const VideoPortConfig &getConfig constReturns the component's current configuration.
const VideoPortInfo &getInfo constReturns the component's current state.
const VideoPortInfo &getCachedInfo constReturns the most recent state snapshot recorded by the emulator thread (see getInfo()).

lockTexture ​

cpp
void lockTexture()

Defined in VirtualC64.h:731

Locks the emulator texture.

This function aquires a mutex that prevents the emulator to modify the stable texture. Call this function prior to getTexture().


unlockTexture ​

cpp
void unlockTexture()

Defined in VirtualC64.h:738

Unlocks the emulator texture.

This function releases the mutex acquired in lockTexture(). Call this function when the pointer returned by getTexture() is no longer needed.


getTexture ​

const

cpp
const u32 * getTexture() const

Defined in VirtualC64.h:746

Returns a pointer to the most recent stable texture.

The texture dimensions are given by constants vc64::Tex::width and vc64::Tex::height texels. Each texel is represented by a 32 bit color value.


getTexture ​

const

cpp
const u32 * getTexture(isize * nr) const

Defined in VirtualC64.h:751

Returns the most recent stable texture together with its frame number.

Parameters ​

ParameterTypeDescription
nrisize *Receives the frame number.

getXrayTexture ​

const

cpp
const u32 * getXrayTexture() const

Defined in VirtualC64.h:757

Returns a pointer to the most recent stable X-Ray texture.

The texture has the same dimensions as the regular texture.


getXrayTexture ​

const

cpp
const u32 * getXrayTexture(isize * nr) const

Defined in VirtualC64.h:763

Returns the most recent stable X-Ray texture together with its frame number.

Parameters ​

ParameterTypeDescription
nrisize *Receives the frame number, which matches the number of the regular texture of the same frame.

saveTexture ​

const

cpp
void saveTexture(const std::filesystem::path & path) const

Defined in VirtualC64.h:772

Saves the most recent stable texture as a PNG file.

The cutout is given in texels of the texture. The upper bounds x2 and y2 are exclusive. Without a cutout, the entire texture is saved.

Exceptions ​

ExceptionDescription
Errorif the file cannot be written.

saveTexture ​

const

cpp
void saveTexture(const std::filesystem::path & path, isize x1, isize x2, isize y1, isize y2) const

Defined in VirtualC64.h:774

Saves a cutout of the most recent stable texture as a PNG file (see above).


saveXrayTexture ​

const

cpp
void saveXrayTexture(const std::filesystem::path & path) const

Defined in VirtualC64.h:781

Saves the most recent stable X-Ray texture as a PNG file.

Exceptions ​

ExceptionDescription
Errorif the file cannot be written.

saveXrayTexture ​

const

cpp
void saveXrayTexture(const std::filesystem::path & path, isize x1, isize x2, isize y1, isize y2) const

Defined in VirtualC64.h:783

Saves a cutout of the most recent stable X-Ray texture as a PNG file.


findInnerArea ​

const

cpp
void findInnerArea(isize & x1, isize & x2, isize & y1, isize & y2) const

Defined in VirtualC64.h:802

Determines the area of the texture that contains picture data.

The result is meant to be used to crop the border of the picture. The VirtualC64 core does not analyze the texture yet: the functions always return the complete texture. The emulator thread is suspended during the call.

findInnerArea() returns the coordinates in texture pixels, findInnerAreaNormalized() returns them relative to the size of the texture (0.0 ... 1.0).

Parameters ​

ParameterTypeDescription
x1isize &Left edge of the picture area
x2isize &Right edge of the picture area
y1isize &Top edge of the picture area
y2isize &Bottom edge of the picture area

findInnerAreaNormalized ​

const

cpp
void findInnerAreaNormalized(double & x1, double & x2, double & y1, double & y2) const

Defined in VirtualC64.h:804

Same as findInnerArea(), but returns normalized coordinates.


getConfig ​

const

cpp
const VideoPortConfig & getConfig() const

Defined in VirtualC64.h:708

Returns the component's current configuration.


getInfo ​

const

cpp
const VideoPortInfo & getInfo() const

Defined in VirtualC64.h:719

Returns the component's current state.

getInfo() reads the live state on the calling thread. The result is only consistent if the emulator is paused or suspended. getCachedInfo() returns the snapshot the emulator thread has recorded most recently, which is the one to use while the emulator runs. Both return references that can be overwritten by a later call or by the emulator thread, so copy the data if you need to keep it.


getCachedInfo ​

const

cpp
const VideoPortInfo & getCachedInfo() const

Defined in VirtualC64.h:721

Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).