2010-06-09 01:37:08 +00:00
|
|
|
// Copyright (C) 2003-2009 Dolphin Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
|
|
|
|
#include "Common.h"
|
|
|
|
|
2010-12-02 05:38:48 +00:00
|
|
|
#if defined(HAVE_WX) && HAVE_WX
|
|
|
|
#include "VideoConfigDialog.h"
|
|
|
|
#endif // HAVE_WX
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
#include "SWCommandProcessor.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
#include "OpcodeDecoder.h"
|
2011-01-29 06:26:03 +00:00
|
|
|
#include "SWVideoConfig.h"
|
2011-02-03 19:55:30 +00:00
|
|
|
#include "SWPixelEngine.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
#include "BPMemLoader.h"
|
|
|
|
#include "XFMemLoader.h"
|
|
|
|
#include "Clipper.h"
|
|
|
|
#include "Rasterizer.h"
|
2011-02-03 19:55:30 +00:00
|
|
|
#include "SWRenderer.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
#include "../../../Core/VideoCommon/Src/LookUpTables.h"
|
|
|
|
#include "HwRasterizer.h"
|
|
|
|
#include "LogManager.h"
|
|
|
|
#include "EfbInterface.h"
|
|
|
|
#include "DebugUtil.h"
|
2010-12-02 05:38:48 +00:00
|
|
|
#include "FileUtil.h"
|
2011-01-31 01:28:32 +00:00
|
|
|
#include "VideoBackend.h"
|
2011-02-17 09:38:06 +00:00
|
|
|
#include "../../../Core/VideoCommon/Src/Fifo.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
namespace SW
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
std::string VideoBackend::GetName()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-01-31 01:28:32 +00:00
|
|
|
return "Software Renderer";
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2010-07-22 02:05:28 +00:00
|
|
|
void *DllDebugger(void *_hParent, bool Show)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2010-07-22 02:05:28 +00:00
|
|
|
return NULL;
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::ShowConfig(void *_hParent)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2010-12-02 05:38:48 +00:00
|
|
|
#if defined(HAVE_WX) && HAVE_WX
|
|
|
|
VideoConfigDialog* const diag = new VideoConfigDialog((wxWindow*)_hParent, "Software", "gfx_software");
|
|
|
|
diag->ShowModal();
|
|
|
|
diag->Destroy();
|
|
|
|
#endif
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Initialize()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-01-29 04:52:19 +00:00
|
|
|
g_SWVideoConfig.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_software.ini").c_str());
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
InitBPMemory();
|
|
|
|
InitXFMemory();
|
2011-02-03 19:55:30 +00:00
|
|
|
SWCommandProcessor::Init();
|
|
|
|
SWPixelEngine::Init();
|
2010-06-09 01:37:08 +00:00
|
|
|
OpcodeDecoder::Init();
|
|
|
|
Clipper::Init();
|
|
|
|
Rasterizer::Init();
|
|
|
|
HwRasterizer::Init();
|
2011-02-03 19:55:30 +00:00
|
|
|
SWRenderer::Init();
|
2010-06-09 01:37:08 +00:00
|
|
|
DebugUtil::Init();
|
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::DoState(PointerWrap&)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-02-08 11:02:34 +00:00
|
|
|
}
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-02-08 11:02:34 +00:00
|
|
|
void VideoBackend::RunLoop(bool enable)
|
|
|
|
{
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2011-02-02 04:40:27 +00:00
|
|
|
void VideoBackend::EmuStateChange(EMUSTATE_CHANGE newState)
|
2010-06-24 20:54:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Shutdown()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-02-03 19:55:30 +00:00
|
|
|
SWRenderer::Shutdown();
|
2010-06-09 01:37:08 +00:00
|
|
|
OpenGL_Shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is called after Video_Initialize() from the Core
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_Prepare()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-02-03 19:55:30 +00:00
|
|
|
SWRenderer::Prepare();
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-02-14 02:18:03 +00:00
|
|
|
INFO_LOG(VIDEO, "Video backend initialized.");
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Run from the CPU thread (from VideoInterface.cpp)
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run from the CPU thread (from VideoInterface.cpp)
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_EndField()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
u32 VideoBackend::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case PEEK_Z:
|
|
|
|
{
|
|
|
|
value = EfbInterface::GetDepth(x, y);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case POKE_Z:
|
|
|
|
break;
|
|
|
|
case PEEK_COLOR:
|
|
|
|
{
|
|
|
|
u32 color = 0;
|
|
|
|
EfbInterface::GetColor(x, y, (u8*)&color);
|
|
|
|
|
|
|
|
// rgba to argb
|
|
|
|
value = (color >> 8) | (color & 0xff) << 24;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case POKE_COLOR:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
bool VideoBackend::Video_Screenshot(const char *_szFilename)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-01-31 01:28:32 +00:00
|
|
|
return false;
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------
|
|
|
|
// Enter and exit the video loop
|
|
|
|
// -------------------------------
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_EnterLoop()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-02-17 09:38:06 +00:00
|
|
|
EmulatorState(true);
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_ExitLoop()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-02-17 09:38:06 +00:00
|
|
|
ExitGpuLoop();
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_AddMessage(const char* pstr, u32 milliseconds)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void VideoBackend::Video_ClearMessages()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_SetRendering(bool bEnabled)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-02-07 22:01:08 +00:00
|
|
|
Fifo_SetRendering(bEnabled);
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-10 04:47:02 +00:00
|
|
|
bool VideoBackend::Video_IsPossibleWaitingSetDrawDone(void)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-01-31 01:28:32 +00:00
|
|
|
return false;
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2011-01-31 01:28:32 +00:00
|
|
|
void VideoBackend::Video_AbortFrame(void)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-02-03 19:55:30 +00:00
|
|
|
}
|
2010-06-24 13:28:54 +00:00
|
|
|
|
2011-02-07 22:01:08 +00:00
|
|
|
// Draw messages on top of the screen
|
|
|
|
unsigned int VideoBackend::PeekMessages()
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
// TODO: peekmessage
|
|
|
|
MSG msg;
|
|
|
|
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
|
|
|
{
|
|
|
|
if (msg.message == WM_QUIT)
|
|
|
|
return FALSE;
|
|
|
|
TranslateMessage(&msg);
|
|
|
|
DispatchMessage(&msg);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show the current FPS
|
|
|
|
void VideoBackend::UpdateFPSDisplay(const char *text)
|
|
|
|
{
|
|
|
|
char temp[100];
|
|
|
|
snprintf(temp, sizeof temp, "%s | Software | %s", svn_rev_str, text);
|
|
|
|
OpenGL_SetWindowText(temp);
|
|
|
|
}
|
|
|
|
|
2011-01-31 01:53:57 +00:00
|
|
|
}
|