forked from duchuule/vba10
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmulatorRenderer.h
122 lines (96 loc) · 3.31 KB
/
EmulatorRenderer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#pragma once
#include "Emulator.h"
#include "VirtualControllerInput.h"
#include "DXSpriteBatch.h"
#include "Filter\ShaderManager.h"
#include "..\Common\DeviceResources.h"
#include "..\Common\StepTimer.h"
using namespace Engine;
using namespace DirectX;
using namespace Microsoft::WRL;
namespace VBA10
{
class EmulatorRenderer
{
public:
static std::unique_ptr<EmulatorRenderer> GetInstance(void);
EmulatorRenderer(const std::shared_ptr<DX::DeviceResources>& deviceResources);
~EmulatorRenderer(void);
void CreateDeviceDependentResources();
void CreateWindowSizeDependentResources();
void ReleaseDeviceDependentResources();
void Render();
void Update(DX::StepTimer const& timer);
GameTime ^GetGameTime(void);
void GetBackbufferData(uint8 **backbufferPtr, size_t *pitch, int *imageWidth, int *imageHeight);
void CreateTransformMatrix();
private:
// Cached pointer to device resources.
std::shared_ptr<DX::DeviceResources> m_deviceResources;
ShaderManager* shaderManager;
HANDLE waitEvent;
float lastElapsed;
//emulator variables
float autosaveElapsed;
float elapsedTime;
int frames;
int fps;
float fpsElapsedTime;
float elapsedTimeMeasure;
size_t pitch;
u8 *backbufferPtr;
u8* pixtmp; // , *pixtmp2; //to store pix for applying filter
u8* delta[1];
GameTime ^gameTime;
VirtualControllerInput *controller;
RECT aRectangle;
RECT bRectangle;
RECT crossRectangle;
RECT startRectangle;
RECT selectRectangle;
RECT turboRectangle;
RECT comboRectangle;
RECT lRectangle;
RECT rRectangle;
int frontbuffer;
int width, height;
int renderwidth, renderheight;
DXSpriteBatch *dxSpriteBatch;
EmulatorGame *emulator;
ComPtr<ID3D11Texture2D> buffers[2];
ComPtr<ID3D11ShaderResourceView> bufferSRVs[2];
//ComPtr<ID3D11Texture2D> bufferBig; //use for pixel filtering
//ComPtr<ID3D11ShaderResourceView> bufferSRVBig;
ComPtr<ID3D11BlendState> alphablend;
ComPtr<ID3D11Resource> dividerResource;
ComPtr<ID3D11ShaderResourceView> dividerSRV;
ComPtr<ID3D11Resource> stickCenterResource;
ComPtr<ID3D11ShaderResourceView> stickCenterSRV;
ComPtr<ID3D11Resource> stickResource;
ComPtr<ID3D11ShaderResourceView> stickSRV;
ComPtr<ID3D11Resource> crossResource;
ComPtr<ID3D11ShaderResourceView> crossSRV;
ComPtr<ID3D11Resource> aResource;
ComPtr<ID3D11ShaderResourceView> aSRV;
ComPtr<ID3D11Resource> bResource;
ComPtr<ID3D11ShaderResourceView> bSRV;
ComPtr<ID3D11Resource> startResource;
ComPtr<ID3D11ShaderResourceView> startSRV;
ComPtr<ID3D11Resource> selectResource;
ComPtr<ID3D11ShaderResourceView> selectSRV;
ComPtr<ID3D11Resource> turboResource;
ComPtr<ID3D11ShaderResourceView> turboSRV;
ComPtr<ID3D11Resource> comboResource;
ComPtr<ID3D11ShaderResourceView> comboSRV;
ComPtr<ID3D11Resource> lButtonResource;
ComPtr<ID3D11ShaderResourceView> lButtonSRV;
ComPtr<ID3D11Resource> rButtonResource;
ComPtr<ID3D11ShaderResourceView> rButtonSRV;
XMFLOAT4X4 outputTransform;
void AutosaveAsync(void);
void *MapBuffer(int index, size_t *rowPitch);
void FPSCounter(void);
//void MeasureTime(void);
void Autosave(void);
};
}