2008-12-08 04:46:09 +00:00
|
|
|
//__________________________________________________________________________________________________
|
|
|
|
// Common video plugin spec, version #1.0 maintained by F|RES
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef _VIDEO_H_INCLUDED__
|
|
|
|
#define _VIDEO_H_INCLUDED__
|
|
|
|
|
|
|
|
#include "PluginSpecs.h"
|
|
|
|
|
|
|
|
#include "ExportProlog.h"
|
|
|
|
|
2009-10-10 21:19:39 +00:00
|
|
|
typedef void (*TimedCallback)(u64 userdata, int cyclesLate);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-10-10 21:19:39 +00:00
|
|
|
typedef void (*TSetInterrupt)(u32 _causemask, bool _bSet);
|
|
|
|
typedef int (*TRegisterEvent)(const char *name, TimedCallback callback);
|
2010-12-04 03:44:56 +00:00
|
|
|
typedef void (*TScheduleEvent_Threadsafe)(int cyclesIntoFuture, int event_type, u64 userdata);
|
2010-07-28 02:57:17 +00:00
|
|
|
typedef void (*TRemoveEvent)(int event_type);
|
2010-12-13 07:56:54 +00:00
|
|
|
typedef void (*TProcessFifoEvents)(void);
|
2008-12-08 04:46:09 +00:00
|
|
|
typedef unsigned char* (*TGetMemoryPointer)(const unsigned int _iAddress);
|
2008-12-12 17:59:33 +00:00
|
|
|
typedef void (*TVideoLog)(const char* _pMessage, int _bBreak);
|
2008-12-08 04:46:09 +00:00
|
|
|
typedef void (*TSysMessage)(const char *fmt, ...);
|
2010-04-12 01:33:10 +00:00
|
|
|
typedef void (*TRequestWindowSize)(int& x, int& y, int& width, int& height);
|
2009-08-01 18:16:12 +00:00
|
|
|
typedef void (*TCopiedToXFB)(bool video_update);
|
2008-12-11 15:12:17 +00:00
|
|
|
typedef unsigned int (*TPeekMessages)(void);
|
2008-12-08 04:46:09 +00:00
|
|
|
typedef void (*TUpdateFPSDisplay)(const char* text); // sets the window title
|
2010-04-12 01:33:10 +00:00
|
|
|
typedef void (*TCoreMessage)(int Id); // passes message to the core
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-07-11 02:34:16 +00:00
|
|
|
enum FieldType
|
|
|
|
{
|
|
|
|
FIELD_PROGRESSIVE = 0,
|
|
|
|
FIELD_UPPER,
|
|
|
|
FIELD_LOWER
|
|
|
|
};
|
|
|
|
|
2009-07-01 13:49:49 +00:00
|
|
|
enum EFBAccessType
|
|
|
|
{
|
|
|
|
PEEK_Z = 0,
|
|
|
|
POKE_Z,
|
|
|
|
PEEK_COLOR,
|
|
|
|
POKE_COLOR
|
|
|
|
};
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
// fifo registers
|
|
|
|
volatile u32 CPBase;
|
|
|
|
volatile u32 CPEnd;
|
|
|
|
u32 CPHiWatermark;
|
|
|
|
u32 CPLoWatermark;
|
|
|
|
volatile u32 CPReadWriteDistance;
|
|
|
|
volatile u32 CPWritePointer;
|
|
|
|
volatile u32 CPReadPointer;
|
|
|
|
volatile u32 CPBreakpoint;
|
|
|
|
|
|
|
|
// Super Monkey Ball Adventure require this.
|
|
|
|
// Because the read&check-PEToken-loop stays in its JITed block I suppose.
|
|
|
|
// So no possiblity to ack the Token irq by the scheduler until some sort of PPC watchdog do its mess.
|
|
|
|
volatile u16 PEToken;
|
|
|
|
|
2008-12-12 17:59:33 +00:00
|
|
|
volatile u32 bFF_GPReadEnable;
|
|
|
|
volatile u32 bFF_BPEnable;
|
2010-06-14 21:55:40 +00:00
|
|
|
volatile u32 bFF_BPInt;
|
2008-12-12 17:59:33 +00:00
|
|
|
volatile u32 bFF_Breakpoint;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-12-12 17:59:33 +00:00
|
|
|
volatile u32 CPCmdIdle;
|
|
|
|
volatile u32 CPReadIdle;
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2010-12-11 12:42:55 +00:00
|
|
|
volatile u32 bFF_LoWatermarkInt;
|
|
|
|
volatile u32 bFF_HiWatermarkInt;
|
|
|
|
|
|
|
|
volatile u32 bFF_LoWatermark;
|
|
|
|
volatile u32 bFF_HiWatermark;
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
// for GP watchdog hack
|
|
|
|
volatile u32 Fake_GPWDToken; // cicular incrementer
|
|
|
|
} SCPFifoStruct;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
void *pWindowHandle;
|
|
|
|
|
2009-10-10 21:19:39 +00:00
|
|
|
TSetInterrupt pSetInterrupt;
|
|
|
|
TRegisterEvent pRegisterEvent;
|
|
|
|
TScheduleEvent_Threadsafe pScheduleEvent_Threadsafe;
|
2010-07-28 02:57:17 +00:00
|
|
|
TRemoveEvent pRemoveEvent;
|
2010-12-13 07:56:54 +00:00
|
|
|
TProcessFifoEvents pProcessFifoEvents;
|
2008-12-08 04:46:09 +00:00
|
|
|
TGetMemoryPointer pGetMemoryPointer;
|
|
|
|
TVideoLog pLog;
|
|
|
|
TSysMessage pSysMessage;
|
|
|
|
TRequestWindowSize pRequestWindowSize;
|
|
|
|
TCopiedToXFB pCopiedToXFB;
|
|
|
|
TPeekMessages pPeekMessages;
|
|
|
|
TUpdateFPSDisplay pUpdateFPSDisplay;
|
2010-04-12 01:33:10 +00:00
|
|
|
TCoreMessage pCoreMessage;
|
2008-12-08 04:46:09 +00:00
|
|
|
void *pMemoryBase;
|
|
|
|
bool bWii;
|
2009-10-23 15:26:35 +00:00
|
|
|
bool bOnThread;
|
2009-10-10 21:19:39 +00:00
|
|
|
u32 *Fifo_CPUBase;
|
|
|
|
u32 *Fifo_CPUEnd;
|
|
|
|
u32 *Fifo_CPUWritePointer;
|
2010-01-13 21:11:02 +00:00
|
|
|
bool bAutoAspectIs16_9;
|
2008-12-08 04:46:09 +00:00
|
|
|
} SVideoInitialize;
|
|
|
|
|
2009-09-02 21:00:45 +00:00
|
|
|
|
|
|
|
// I N T E R F A C E
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_Prepare
|
|
|
|
// Purpose: This function is called from the EmuThread before the
|
|
|
|
// emulation has started. It is just for threadsensitive
|
|
|
|
// APIs like OpenGL.
|
|
|
|
// input: none
|
|
|
|
// output: none
|
|
|
|
//
|
|
|
|
EXPORT void CALL Video_Prepare(void);
|
|
|
|
|
|
|
|
// __________________________________________________________________________________________________
|
2009-07-11 02:34:16 +00:00
|
|
|
// Function: Video_BeginField
|
2009-07-15 22:20:59 +00:00
|
|
|
// Purpose: When a field begins in the VI emulator, this function tells the video plugin what the
|
|
|
|
// parameters of the upcoming field are. The video plugin should make sure the previous
|
|
|
|
// field is on the player's display before returning.
|
|
|
|
// input: vi parameters of the upcoming field
|
2008-12-08 04:46:09 +00:00
|
|
|
// output: none
|
|
|
|
//
|
2009-07-11 02:34:16 +00:00
|
|
|
EXPORT void CALL Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-07-15 22:20:59 +00:00
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_EndField
|
|
|
|
// Purpose: When a field ends in the VI emulator, this function notifies the video plugin. The video
|
|
|
|
// has permission to swap the field to the player's display.
|
|
|
|
// input: none
|
|
|
|
// output: none
|
|
|
|
//
|
|
|
|
EXPORT void CALL Video_EndField();
|
|
|
|
|
2009-07-01 13:49:49 +00:00
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_AccessEFB
|
|
|
|
// input: type of access (r/w, z/color, ...), x coord, y coord
|
|
|
|
// output: response to the access request (ex: peek z data at specified coord)
|
|
|
|
//
|
2010-06-15 21:19:09 +00:00
|
|
|
EXPORT u32 CALL Video_AccessEFB(EFBAccessType type, u32 x, u32 y,u32 InputData);
|
2009-07-01 13:49:49 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_Screenshot
|
|
|
|
// input: Filename
|
|
|
|
// output: TRUE if all was okay
|
|
|
|
//
|
2009-02-27 03:56:34 +00:00
|
|
|
EXPORT void CALL Video_Screenshot(const char *_szFilename);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_EnterLoop
|
2009-02-20 22:04:52 +00:00
|
|
|
// Purpose: Enters the video fifo dispatch loop. This is only used in Dual Core mode.
|
2008-12-08 04:46:09 +00:00
|
|
|
// input: none
|
|
|
|
// output: none
|
|
|
|
//
|
|
|
|
EXPORT void CALL Video_EnterLoop(void);
|
|
|
|
|
2009-02-20 22:04:52 +00:00
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_ExitLoop
|
|
|
|
// Purpose: Exits the video dispatch loop. This is only used in Dual Core mode.
|
|
|
|
// input: none
|
|
|
|
// output: none
|
|
|
|
//
|
|
|
|
EXPORT void CALL Video_ExitLoop(void);
|
|
|
|
|
2009-08-08 01:39:56 +00:00
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_SetRendering
|
|
|
|
// Purpose: Sets video rendering on and off. Currently used for frame skipping
|
|
|
|
// input: Enabled toggle
|
|
|
|
// output: none
|
|
|
|
//
|
|
|
|
EXPORT void CALL Video_SetRendering(bool bEnabled);
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_AddMessage
|
|
|
|
// Purpose: Adds a message to the display queue, to be shown forthe specified time
|
|
|
|
// input: pointer to the null-terminated string, time in milliseconds
|
|
|
|
// output: none
|
|
|
|
//
|
|
|
|
EXPORT void CALL Video_AddMessage(const char* pstr, unsigned int milliseconds);
|
|
|
|
|
2009-10-10 21:19:39 +00:00
|
|
|
EXPORT void CALL Video_CommandProcessorRead16(u16& _rReturnValue, const u32 _Address);
|
|
|
|
EXPORT void CALL Video_CommandProcessorWrite16(const u16 _Data, const u32 _Address);
|
|
|
|
EXPORT void CALL Video_PixelEngineRead16(u16& _rReturnValue, const u32 _Address);
|
|
|
|
EXPORT void CALL Video_PixelEngineWrite16(const u16 _Data, const u32 _Address);
|
|
|
|
EXPORT void CALL Video_PixelEngineWrite32(const u32 _Data, const u32 _Address);
|
|
|
|
EXPORT void CALL Video_GatherPipeBursted(void);
|
|
|
|
EXPORT void CALL Video_WaitForFrameFinish(void);
|
|
|
|
|
2010-06-24 13:28:54 +00:00
|
|
|
// __________________________________________________________________________________________________
|
|
|
|
// Function: Video_IsFifoBusy
|
|
|
|
// Purpose: Return if the FIFO is proecessing data, that is used for sync gfx thread and emulator
|
|
|
|
// thread in CoreTiming
|
|
|
|
// input: none
|
|
|
|
// output: bool
|
|
|
|
//
|
|
|
|
EXPORT bool CALL Video_IsFifoBusy(void);
|
|
|
|
|
2010-08-10 07:25:35 +00:00
|
|
|
EXPORT void CALL Video_AbortFrame(void);
|
|
|
|
|
2010-12-13 07:56:54 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
#include "ExportEpilog.h"
|
|
|
|
#endif
|