diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj
index c9859c4496..805b7c022d 100644
--- a/Source/Core/DebuggerWX/DebuggerWX.vcproj
+++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj
@@ -542,6 +542,10 @@
RelativePath=".\src\RegisterWindow.h"
>
+
+
diff --git a/Source/Core/DebuggerWX/src/SConscript b/Source/Core/DebuggerWX/src/SConscript
index b9955a3270..139afb0a93 100644
--- a/Source/Core/DebuggerWX/src/SConscript
+++ b/Source/Core/DebuggerWX/src/SConscript
@@ -13,6 +13,7 @@ files = ["LogWindow.cpp",
"MemoryWindow.cpp",
"RegisterWindow.cpp",
"RegisterView.cpp",
+ "JitWindow.cpp",
]
wxenv = env.Copy(CXXFLAGS = "`wx-config --cppflags` -DUSE_XPM_BITMAPS -DwxNEEDS_CHARPP",
LINKFLAGS = "-L/usr/local/lib -pthread `wx-config --libs --debug`")
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp
similarity index 86%
rename from Source/Plugins/Plugin_VideoOGL/Src/Fifo.cpp
rename to Source/Core/VideoCommon/Src/Fifo.cpp
index 867a8f52aa..12db09b289 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Fifo.cpp
+++ b/Source/Core/VideoCommon/Src/Fifo.cpp
@@ -17,11 +17,12 @@
#include
-#include "Globals.h"
#include "MemoryUtil.h"
-#include "Fifo.h"
#include "Thread.h"
#include "OpcodeDecoding.h"
+#include "pluginspecs_video.h"
+
+#include "Fifo.h"
#define FIFO_SIZE (1024*1024)
@@ -98,11 +99,9 @@ void Video_SendFifoData(BYTE *_uData)
{
if (FAKE_GetFifoSize() > readptr)
{
- SysMessage("out of bounds");
- exit(1);
+ PanicAlert("FIFO out of bounds (sz = %i, at %08x)", FAKE_GetFifoSize(), readptr);
}
-
- DebugLog("FAKE BUFFER LOOPS");
+// DebugLog("FAKE BUFFER LOOPS");
memmove(&videoBuffer[0], &videoBuffer[readptr], FAKE_GetFifoSize());
// memset(&videoBuffer[FAKE_GetFifoSize()], 0, FIFO_SIZE - FAKE_GetFifoSize());
size = FAKE_GetFifoSize();
@@ -114,12 +113,12 @@ void Video_SendFifoData(BYTE *_uData)
//TODO - turn inside out, have the "reader" ask for bytes instead
// See Core.cpp for threading idea
-void Video_EnterLoop()
+void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
{
- SCPFifoStruct &fifo = *g_VideoInitialize.pCPFifo;
+ SCPFifoStruct &fifo = *video_initialize.pCPFifo;
// TODO(ector): Don't peek so often!
- while (g_VideoInitialize.pPeekMessages())
+ while (video_initialize.pPeekMessages())
{
if (fifo.CPReadWriteDistance < 1) //fifo.CPLoWatermark)
Common::SleepCurrentThread(1);
@@ -137,14 +136,13 @@ void Video_EnterLoop()
if (fifo.CPReadPointer == fifo.CPBreakpoint)
{
fifo.bFF_Breakpoint = 1;
- g_VideoInitialize.pUpdateInterrupts();
+ video_initialize.pUpdateInterrupts();
break;
}
}
// read the data and send it to the VideoPlugin
-
- u8 *uData = Memory_GetPtr(fifo.CPReadPointer);
+ u8 *uData = video_initialize.pGetMemoryPointer(fifo.CPReadPointer);
#ifdef _WIN32
EnterCriticalSection(&fifo.sync);
#endif
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Fifo.h b/Source/Core/VideoCommon/Src/Fifo.h
similarity index 94%
rename from Source/Plugins/Plugin_VideoOGL/Src/Fifo.h
rename to Source/Core/VideoCommon/Src/Fifo.h
index 48392c2a51..f8f9a33892 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Fifo.h
+++ b/Source/Core/VideoCommon/Src/Fifo.h
@@ -52,6 +52,7 @@ extern FifoReader fifo;
void Fifo_Init();
void Fifo_Shutdown();
+void Fifo_EnterLoop(const SVideoInitialize &video_initialize);
#endif
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.h b/Source/Core/VideoCommon/Src/OpcodeDecoding.h
similarity index 100%
rename from Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.h
rename to Source/Core/VideoCommon/Src/OpcodeDecoding.h
diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript
index a91f110e17..caadfca091 100644
--- a/Source/Core/VideoCommon/Src/SConscript
+++ b/Source/Core/VideoCommon/Src/SConscript
@@ -6,6 +6,7 @@ files = ["BPMemory.cpp",
"TextureDecoder.cpp",
"XFMemory.cpp",
"XFBConvert.cpp",
+ "Fifo.cpp",
]
env_common = env.Copy(CXXFLAGS = " -fPIC ")
diff --git a/Source/Core/VideoCommon/VideoCommon.vcproj b/Source/Core/VideoCommon/VideoCommon.vcproj
index 4e80ec97f8..7954a7a6d6 100644
--- a/Source/Core/VideoCommon/VideoCommon.vcproj
+++ b/Source/Core/VideoCommon/VideoCommon.vcproj
@@ -43,7 +43,7 @@
+
+
+
+
@@ -413,6 +421,10 @@
RelativePath=".\Src\LookUpTables.h"
>
+
+
diff --git a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj
index c7f43296df..411fe1591b 100644
--- a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj
+++ b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcproj
@@ -1270,10 +1270,6 @@
RelativePath=".\Src\OpcodeDecoding.cpp"
>
-
-
@@ -1451,14 +1447,6 @@
>
-
-
-
-
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Fifo.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Fifo.cpp
deleted file mode 100644
index c7ebf90e4d..0000000000
--- a/Source/Plugins/Plugin_VideoDX9/Src/Fifo.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// Copyright (C) 2003-2008 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
-#include
-
-#include "Common.h"
-#include "Utils.h"
-#include "Fifo.h"
-#include "main.h"
-#include "OpcodeDecoding.h"
-
-#define FIFO_SIZE (1024*1024)
-
-FifoReader fifo;
-static u8 *videoBuffer;
-
-int size = 0;
-int readptr = 0;
-
-void Fifo_Init()
-{
- //VirtualFree((LPVOID)buffer,CMDBUFFER_SIZE,MEM_RELEASE);
- videoBuffer = (u8*)VirtualAlloc(0, FIFO_SIZE, MEM_COMMIT, PAGE_READWRITE);
- fifo.Init(videoBuffer, videoBuffer); //zero length. there is no data yet.
-}
-
-void Fifo_Shutdown()
-{
- VirtualFree(videoBuffer, FIFO_SIZE, MEM_RELEASE);
-}
-
-int FAKE_GetFifoSize()
-{
- if (size < readptr)
- {
- PanicAlert("GFX Fifo underrun encountered (size = %i, readptr = %i)", size, readptr);
- }
- return (size - readptr);
-}
-
-u8 FAKE_PeekFifo8(u32 _uOffset)
-{
- return videoBuffer[readptr + _uOffset];
-}
-
-u16 FAKE_PeekFifo16(u32 _uOffset)
-{
- return _byteswap_ushort(*(u16*)&videoBuffer[readptr + _uOffset]);
-}
-
-u32 FAKE_PeekFifo32(u32 _uOffset)
-{
- return _byteswap_ulong(*(u32*)&videoBuffer[readptr + _uOffset]);
-}
-
-u8 FAKE_ReadFifo8()
-{
- return videoBuffer[readptr++];
-}
-
-u16 FAKE_ReadFifo16()
-{
- u16 val = _byteswap_ushort(*(u16*)(videoBuffer+readptr));
- readptr += 2;
- return val;
-}
-
-u32 FAKE_ReadFifo32()
-{
- u32 val = _byteswap_ulong(*(u32*)(videoBuffer+readptr));
- readptr += 4;
- return val;
-}
-
-void FAKE_SkipFifo(u32 skip)
-{
- readptr += skip;
-}
-
-void Video_SendFifoData(BYTE *_uData)
-{
- memcpy(videoBuffer + size, _uData, 32);
- size += 32;
- if (size + 32 >= FIFO_SIZE)
- {
- if (FAKE_GetFifoSize() > readptr)
- {
- PanicAlert("FIFO out of bounds", "video-plugin", MB_OK);
- exit(1);
- }
-
- DebugLog("FAKE BUFFER LOOPS");
- memmove(&videoBuffer[0], &videoBuffer[readptr], FAKE_GetFifoSize());
- // memset(&videoBuffer[FAKE_GetFifoSize()], 0, FIFO_SIZE - FAKE_GetFifoSize());
- size = FAKE_GetFifoSize();
- readptr = 0;
- }
- OpcodeDecoder_Run();
-}
-
-
-//TODO - turn inside out, have the "reader" ask for bytes instead
-// See Core.cpp for threading idea
-void Video_EnterLoop()
-{
- SCPFifoStruct &fifo = *g_VideoInitialize.pCPFifo;
-
- // TODO(ector): Don't peek so often!
- while (g_VideoInitialize.pPeekMessages())
- {
- if (fifo.CPReadWriteDistance < 1) //fifo.CPLoWatermark)
- Sleep(1);
- //etc...
-
- // check if we are able to run this buffer
- if ((fifo.bFF_GPReadEnable) && !(fifo.bFF_BPEnable && fifo.bFF_Breakpoint))
- {
- int count = 200;
- while(fifo.CPReadWriteDistance > 0 && count)
- {
- // check if we are on a breakpoint
- if (fifo.bFF_BPEnable)
- {
- //MessageBox(0,"Breakpoint enabled",0,0);
- if (fifo.CPReadPointer == fifo.CPBreakpoint)
- {
- fifo.bFF_Breakpoint = 1;
- g_VideoInitialize.pUpdateInterrupts();
- break;
- }
- }
-
- // read the data and send it to the VideoPlugin
-
- u8 *uData = Memory_GetPtr(fifo.CPReadPointer);
-
- EnterCriticalSection(&fifo.sync);
- fifo.CPReadPointer += 32;
- Video_SendFifoData(uData);
- InterlockedExchangeAdd((LONG*)&fifo.CPReadWriteDistance, -32);
- LeaveCriticalSection(&fifo.sync);
-
- // increase the ReadPtr
- if (fifo.CPReadPointer >= fifo.CPEnd)
- {
- fifo.CPReadPointer = fifo.CPBase;
- //LOG(COMMANDPROCESSOR, "BUFFER LOOP");
- // MessageBox(NULL, "loop", "now", MB_OK);
- }
- count--;
- }
- }
-
- }
-}
-
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Fifo.h b/Source/Plugins/Plugin_VideoDX9/Src/Fifo.h
deleted file mode 100644
index c6bf425dbc..0000000000
--- a/Source/Plugins/Plugin_VideoDX9/Src/Fifo.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _FIFO_H
-#define _FIFO_H
-
-#include "Common.h"
-
-// inline for speed!
-class FifoReader
-{
- u8 *ptr;
- u8 *end;
- u8 *tempPtr; //single element stack :P
- u8 *tempEnd;
- bool pushed;
-public:
- void Init(u8 *_ptr, u8 *_end)
- {
- ptr = _ptr; end = _end; pushed = false;
- }
- bool IsPushed() {return pushed;}
- void Push(u8 *_ptr, u8 *_end) {pushed = true; tempPtr = ptr; tempEnd = end; ptr = _ptr; end = _end;}
- void Pop() {pushed = false; ptr = tempPtr; end = tempEnd;}
- u8 Peek8 (int offset) { return ptr[offset]; }
- u16 Peek16(int offset) { return _byteswap_ushort(*(u16*)(ptr+offset)); }
- u32 Peek32(int offset) { return _byteswap_ulong(*(u32*)(ptr+offset)); }
- u8 Read8 () {return *ptr++;}
- u16 Read16() {const u16 value = _byteswap_ushort(*((u16*)ptr)); ptr+=2; return value;}
- u32 Read32() {const u32 value = _byteswap_ulong(*((u32*)ptr)); ptr+=4; return value;}
- float Read32F() {const u32 value = _byteswap_ulong(*((u32*)ptr)); ptr+=4; return *(float*)&value;}
- size_t GetRemainSize() const { return (int)(end - ptr); }
- u8 *GetPtr() const { return ptr; }
- void MoveEndForward() { end += 32; }
- u8 *GetEnd() const { return end; }
-};
-
-extern FifoReader fifo;
-
-void Fifo_Init();
-void Fifo_Shutdown();
-
-#endif
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Globals.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Globals.cpp
index 84ce9bbd76..de74613806 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/Globals.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/Globals.cpp
@@ -15,7 +15,7 @@ void Config::Load()
iniFile.Get("Hardware", "WindowedRes", &iWindowedRes, 0);
iniFile.Get("Hardware", "FullscreenRes", &iFSResolution, 0);
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0);
- iniFile.Get("Hardware", "RenderInMainframe", &renderToMainframe, true);
+ iniFile.Get("Hardware", "RenderInMainframe", &renderToMainframe, false);
iniFile.Get("Hardware", "VSync", &bVsync, 0);
if (iAdapter == -1)
iAdapter = 0;
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.h b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.h
deleted file mode 100644
index 6e1de3b73e..0000000000
--- a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _OPCODE_DECODING_H
-#define _OPCODE_DECODING_H
-
-#include "PluginSpecs_Video.h"
-#include "Common.h"
-
-#define GX_NOP 0x00
-
-#define GX_LOAD_BP_REG 0x61
-#define GX_LOAD_CP_REG 0x08
-#define GX_LOAD_XF_REG 0x10
-#define GX_LOAD_INDX_A 0x20
-#define GX_LOAD_INDX_B 0x28
-#define GX_LOAD_INDX_C 0x30
-#define GX_LOAD_INDX_D 0x38
-
-#define GX_CMD_CALL_DL 0x40
-#define GX_CMD_INVL_VC 0x48
-
-#define GX_PRIMITIVE_MASK 0x78
-#define GX_PRIMITIVE_SHIFT 3
-#define GX_VAT_MASK 0x07
-
-//these are defined 1/8th of their real values and without their top bit
-#define GX_DRAW_QUADS 0x0 //0x80
-#define GX_DRAW_TRIANGLES 0x2 //0x90
-#define GX_DRAW_TRIANGLE_STRIP 0x3 //0x98
-#define GX_DRAW_TRIANGLE_FAN 0x4 //0xA0
-#define GX_DRAW_LINES 0x5 //0xA8
-#define GX_DRAW_LINE_STRIP 0x6 //0xB0
-#define GX_DRAW_POINTS 0x7 //0xB8
-
-void OpcodeDecoder_Init();
-void OpcodeDecoder_Shutdown();
-void OpcodeDecoder_Run();
-
-#endif
\ No newline at end of file
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
index 02ddd727ee..63ec234e5c 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
@@ -165,6 +165,11 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
}
+void Video_EnterLoop()
+{
+ Fifo_EnterLoop(g_VideoInitialize);
+}
+
void Video_Prepare(void)
{
Renderer::Init(g_VideoInitialize);
diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
index fae04ccc98..ec876141ba 100644
--- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
+++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj
@@ -737,10 +737,6 @@
RelativePath=".\Src\OpcodeDecoding.cpp"
>
-
-
@@ -906,14 +902,6 @@
>
-
-
-
-
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
index 9e7be5c218..3ce35cf984 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp
@@ -144,11 +144,11 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
nBackbufferWidth = _twidth;
nBackbufferHeight = _theight;
- float FactorW = (float)640 / (float)nBackbufferWidth;
- float FactorH = (float)480 / (float)nBackbufferHeight;
+ float FactorW = 640.0f / (float)nBackbufferWidth;
+ float FactorH = 480.0f / (float)nBackbufferHeight;
float Max = (FactorW < FactorH) ? FactorH : FactorW;
- MValue = 1 / Max;
+ MValue = 1.0f / Max;
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
@@ -211,8 +211,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
}
else
{
- dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
- dwStyle=WS_OVERLAPPEDWINDOW;
+ dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
+ dwStyle = WS_OVERLAPPEDWINDOW;
}
RECT rc;
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript
index f996a16e84..4cb9c4b0e2 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript
+++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript
@@ -3,7 +3,6 @@ import sys
files = ["BPStructs.cpp",
"DataReader.cpp",
- "Fifo.cpp",
"Globals.cpp",
"GLInit.cpp",
"main.cpp",
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
index 2dc74d00f4..dab10e9b05 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
@@ -198,6 +198,12 @@ void Video_Shutdown(void)
}
+void Video_EnterLoop()
+{
+ Fifo_EnterLoop(g_VideoInitialize);
+}
+
+
void DebugLog(const char* _fmt, ...)
{
#ifdef _DEBUG