Extend our OSD class to support callbacks on init, onframe, and shutdown.

This commit is contained in:
Ryan Houdek
2013-04-13 00:48:53 -05:00
parent ccf1cee203
commit 39a7096711
6 changed files with 79 additions and 9 deletions

View File

@ -1409,7 +1409,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
DrawDebugText();
GL_REPORT_ERRORD();
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_ONFRAME);
OSD::DrawMessages();
GL_REPORT_ERRORD();

View File

@ -157,7 +157,10 @@ void VideoBackend::ShowConfig(void *_hParent)
diag.ShowModal();
#endif
}
void Test(u32 Data)
{
printf("Data: %d\n", Data);
}
bool VideoBackend::Initialize(void *&window_handle)
{
InitializeShared();
@ -175,6 +178,9 @@ bool VideoBackend::Initialize(void *&window_handle)
if (!GLInterface->Create(window_handle))
return false;
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_INIT);
s_BackendInitialized = true;
return true;
@ -222,6 +228,10 @@ void VideoBackend::Video_Prepare()
void VideoBackend::Shutdown()
{
s_BackendInitialized = false;
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);
GLInterface->Shutdown();
}

View File

@ -23,6 +23,8 @@
#include "SWRenderer.h"
#include "SWStatistics.h"
#include "OnScreenDisplay.h"
static GLuint s_RenderTarget = 0;
static GLint attr_pos = -1, attr_tex = -1;
@ -181,6 +183,9 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height)
void SWRenderer::SwapBuffer()
{
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_ONFRAME);
DrawDebugText();
glFlush();

View File

@ -43,6 +43,7 @@
#include "SWVertexLoader.h"
#include "SWStatistics.h"
#include "OnScreenDisplay.h"
#define VSYNC_ENABLED 0
namespace SW
@ -81,6 +82,8 @@ bool VideoSoftware::Initialize(void *&window_handle)
INFO_LOG(VIDEO, "%s", "SWRenderer::Create failed\n");
return false;
}
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_INIT);
InitBPMemory();
InitXFMemory();
@ -111,15 +114,15 @@ void VideoSoftware::DoState(PointerWrap& p)
OpcodeDecoder::DoState(p);
Clipper::DoState(p);
p.Do(swxfregs);
p.Do(bpmem);
p.Do(bpmem);
p.DoPOD(swstats);
// CP Memory
p.DoArray(arraybases, 16);
p.DoArray(arraystrides, 16);
p.Do(MatrixIndexA);
p.Do(MatrixIndexB);
p.Do(g_VtxDesc.Hex);
p.DoArray(arraybases, 16);
p.DoArray(arraystrides, 16);
p.Do(MatrixIndexA);
p.Do(MatrixIndexB);
p.Do(g_VtxDesc.Hex);
p.DoArray(g_VtxAttr, 8);
p.DoMarker("CP Memory");
@ -162,7 +165,10 @@ void VideoSoftware::Shutdown()
// TODO: should be in Video_Cleanup
HwRasterizer::Shutdown();
SWRenderer::Shutdown();
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);
GLInterface->Shutdown();
}