2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2011 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:09:55 -06:00
|
|
|
// Refer to the license.txt file included.
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2016-02-15 19:29:24 -07:00
|
|
|
#include <memory>
|
2011-01-30 18:28:32 -07:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-01-17 14:54:31 -07:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "VideoCommon/PerfQueryBase.h"
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2014-02-02 06:16:43 -07:00
|
|
|
namespace MMIO { class Mapping; }
|
2016-01-17 14:54:31 -07:00
|
|
|
class PointerWrap;
|
2011-03-16 16:48:17 -06:00
|
|
|
|
2011-01-30 18:28:32 -07:00
|
|
|
enum FieldType
|
|
|
|
{
|
2015-07-02 10:18:32 -06:00
|
|
|
FIELD_ODD = 0,
|
|
|
|
FIELD_EVEN = 1,
|
2011-01-30 18:28:32 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum EFBAccessType
|
|
|
|
{
|
|
|
|
PEEK_Z = 0,
|
|
|
|
POKE_Z,
|
|
|
|
PEEK_COLOR,
|
|
|
|
POKE_COLOR
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SCPFifoStruct
|
|
|
|
{
|
|
|
|
// fifo registers
|
|
|
|
volatile u32 CPBase;
|
|
|
|
volatile u32 CPEnd;
|
|
|
|
u32 CPHiWatermark;
|
|
|
|
u32 CPLoWatermark;
|
|
|
|
volatile u32 CPReadWriteDistance;
|
|
|
|
volatile u32 CPWritePointer;
|
|
|
|
volatile u32 CPReadPointer;
|
|
|
|
volatile u32 CPBreakpoint;
|
2011-02-13 08:08:37 -07:00
|
|
|
volatile u32 SafeCPReadPointer;
|
2011-01-30 18:28:32 -07:00
|
|
|
// 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;
|
|
|
|
|
2011-02-09 21:47:02 -07:00
|
|
|
volatile u32 bFF_GPLinkEnable;
|
2011-01-30 18:28:32 -07:00
|
|
|
volatile u32 bFF_GPReadEnable;
|
|
|
|
volatile u32 bFF_BPEnable;
|
|
|
|
volatile u32 bFF_BPInt;
|
|
|
|
volatile u32 bFF_Breakpoint;
|
|
|
|
|
|
|
|
volatile u32 bFF_LoWatermarkInt;
|
|
|
|
volatile u32 bFF_HiWatermarkInt;
|
|
|
|
|
|
|
|
volatile u32 bFF_LoWatermark;
|
|
|
|
volatile u32 bFF_HiWatermark;
|
|
|
|
};
|
|
|
|
|
2016-01-12 01:35:24 -07:00
|
|
|
class VideoBackendBase
|
2011-01-30 18:28:32 -07:00
|
|
|
{
|
|
|
|
public:
|
2016-01-12 01:35:24 -07:00
|
|
|
virtual ~VideoBackendBase() {}
|
2011-01-30 18:28:32 -07:00
|
|
|
|
|
|
|
virtual unsigned int PeekMessages() = 0;
|
|
|
|
|
2016-01-02 13:01:12 -07:00
|
|
|
virtual bool Initialize(void* window_handle) = 0;
|
2011-01-30 18:28:32 -07:00
|
|
|
virtual void Shutdown() = 0;
|
|
|
|
|
2014-03-10 23:55:00 -06:00
|
|
|
virtual std::string GetName() const = 0;
|
|
|
|
virtual std::string GetDisplayName() const { return GetName(); }
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2014-06-16 15:03:29 -06:00
|
|
|
virtual void ShowConfig(void*) = 0;
|
2011-01-30 18:28:32 -07:00
|
|
|
|
|
|
|
virtual void Video_Prepare() = 0;
|
2016-01-12 01:35:24 -07:00
|
|
|
void Video_ExitLoop();
|
2013-02-26 08:42:32 -07:00
|
|
|
virtual void Video_Cleanup() = 0; // called from gl/d3d thread
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2016-01-12 01:35:24 -07:00
|
|
|
void Video_BeginField(u32, u32, u32, u32);
|
|
|
|
void Video_EndField();
|
2011-01-30 18:28:32 -07:00
|
|
|
|
2016-01-12 01:35:24 -07:00
|
|
|
u32 Video_AccessEFB(EFBAccessType, u32, u32, u32);
|
|
|
|
u32 Video_GetQueryResult(PerfQueryType type);
|
|
|
|
u16 Video_GetBoundingBox(int index);
|
2011-01-30 18:28:32 -07:00
|
|
|
|
|
|
|
static void PopulateList();
|
|
|
|
static void ClearList();
|
|
|
|
static void ActivateBackend(const std::string& name);
|
2011-12-30 21:16:12 -07:00
|
|
|
|
|
|
|
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
|
2016-01-12 01:35:24 -07:00
|
|
|
void DoState(PointerWrap &p);
|
2013-09-22 10:09:39 -06:00
|
|
|
|
2016-01-12 01:35:24 -07:00
|
|
|
void CheckInvalidState();
|
2014-09-06 15:26:40 -06:00
|
|
|
|
2016-01-02 13:01:12 -07:00
|
|
|
protected:
|
2016-01-12 01:35:24 -07:00
|
|
|
void InitializeShared();
|
|
|
|
|
2016-01-02 13:01:12 -07:00
|
|
|
bool m_initialized = false;
|
2016-01-12 01:35:24 -07:00
|
|
|
bool m_invalid = false;
|
2011-01-30 18:28:32 -07:00
|
|
|
};
|
|
|
|
|
2016-02-15 19:29:24 -07:00
|
|
|
extern std::vector<std::unique_ptr<VideoBackendBase>> g_available_video_backends;
|
2016-01-12 01:35:24 -07:00
|
|
|
extern VideoBackendBase* g_video_backend;
|