GSdx: renamed None to something else because X11 defined it for itself.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4346 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gabest11 2011-02-23 09:16:00 +00:00
parent e7cc739f56
commit 7dd16f1b1b
10 changed files with 232 additions and 149 deletions

View File

@ -39,6 +39,9 @@ static HRESULT s_hr = E_FAIL;
#else
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
extern bool RunLinuxDialog();
#endif
@ -75,11 +78,15 @@ EXPORT_C_(uint32) PS2EgetLibVersion2(uint32 type)
return (build << 0) | (revision << 8) | (PS2E_GS_VERSION << 16) | (PLUGIN_VERSION << 24);
}
#ifdef _WINDOWS
EXPORT_C_(void) PS2EsetEmuVersion(const char* emuId, uint32 version)
{
s_isgsopen2 = true;
}
#endif
EXPORT_C_(uint32) PS2EgetCpuPlatform()
{
#if _M_AMD64
@ -258,7 +265,7 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
s_gs->m_wnd.Show();
*dsp = s_gs->m_wnd.GetHandle();
*dsp = s_gs->m_wnd.GetDisplay();
}
else
{
@ -281,19 +288,17 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
return 0;
}
#ifdef _WINDOWS
EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
{
int renderer = theApp.GetConfig("renderer", 0);
if(flags & 4)
{
#ifdef _WINDOWS
D3D_FEATURE_LEVEL level;
renderer = GSUtil::CheckDirect3D11Level(level) && level >= D3D_FEATURE_LEVEL_10_0 ? 4 : 1; // dx11 / dx9 sw
#endif
}
int retval = _GSopen(dsp, NULL, renderer);
@ -303,8 +308,18 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
return retval;
}
#endif
EXPORT_C_(int) GSopen(void** dsp, char* title, int mt)
{
/*
if(!XInitThreads()) return -1;
Display* display = XOpenDisplay(0);
XCloseDisplay(display);
*/
int renderer;
// Legacy GUI expects to acquire vsync from the configuration files.

View File

@ -24,8 +24,8 @@
CRC::Game CRC::m_games[] =
{
{0x00000000, None, Unknown, 0},
{0x2113EA2E, MetalSlug6, Unknown, 0},
{0x00000000, NoTitle, NoRegion, 0},
{0x2113EA2E, MetalSlug6, NoRegion, 0},
{0x42E05BAF, TomoyoAfter, JP, PointListPalette},
{0x7800DC84, Clannad, JP, PointListPalette},
{0xA6167B59, Lamune, JP, PointListPalette},
@ -57,12 +57,12 @@ CRC::Game CRC::m_games[] =
{0xdc2a467e, FFXII, EU, 0},
{0xca284668, FFXII, EU, 0},
{0x280AD120, FFXII, JP, 0},
{0x08C1ED4D, HauntingGround, Unknown, 0},
{0x08C1ED4D, HauntingGround, NoRegion, 0},
{0x2CD5794C, HauntingGround, EU, 0},
{0x867BB945, HauntingGround, JP, 0},
{0xE263BC4B, HauntingGround, JP, 0},
{0x901AAC09, HauntingGround, US, 0},
{0x8BE3D7B2, ShadowHearts, Unknown, 0},
{0x8BE3D7B2, ShadowHearts, NoRegion, 0},
{0xDEFA4763, ShadowHearts, US, 0},
{0x21068223, Okami, US, 0},
{0x891f223f, Okami, FR, 0},
@ -70,8 +70,8 @@ CRC::Game CRC::m_games[] =
{0x053D2239, MetalGearSolid3, US, 0},
{0x086273D2, MetalGearSolid3, FR, 0},
{0x26A6E286, MetalGearSolid3, EU, 0},
{0xAA31B5BF, MetalGearSolid3, Unknown, 0},
{0x9F185CE1, MetalGearSolid3, Unknown, 0},
{0xAA31B5BF, MetalGearSolid3, NoRegion, 0},
{0x9F185CE1, MetalGearSolid3, NoRegion, 0},
{0x98D4BC93, MetalGearSolid3, EU, 0},
{0x86BC3040, MetalGearSolid3, US, 0}, //Subsistance disc 1
{0x0481AD8A, MetalGearSolid3, JP, 0},
@ -82,11 +82,11 @@ CRC::Game CRC::m_games[] =
{0xFE961D28, DBZBT2, US, 0},
{0x0393B6BE, DBZBT2, EU, 0},
{0xE2F289ED, DBZBT2, JP, 0}, // Sparking Neo!
{0x35AA84D1, DBZBT2, Unknown, 0},
{0x35AA84D1, DBZBT2, NoRegion, 0},
{0x428113C2, DBZBT3, US, 0},
{0xA422BB13, DBZBT3, EU, 0},
{0x983C53D2, DBZBT3, Unknown, 0},
{0x983C53D3, DBZBT3, Unknown, 0},
{0x983C53D2, DBZBT3, NoRegion, 0},
{0x983C53D3, DBZBT3, NoRegion, 0},
{0x72B3802A, SFEX3, US, 0},
{0x71521863, SFEX3, US, 0},
{0x28703748, Bully, US, 0},
@ -96,15 +96,15 @@ CRC::Game CRC::m_games[] =
{0x3122B508, OnePieceGrandAdventure, US, 0},
{0x8DF14A24, OnePieceGrandAdventure, EU, 0},
{0xB049DD5E, OnePieceGrandBattle, US, 0},
{0x5D02CC5B, OnePieceGrandBattle, Unknown, 0},
{0x5D02CC5B, OnePieceGrandBattle, NoRegion, 0},
{0x6F8545DB, ICO, US, 0},
{0xB01A4C95, ICO, JP, 0},
{0x5C991F4E, ICO, Unknown, 0},
{0x7ACF7E03, ICO, Unknown, 0},
{0x5C991F4E, ICO, NoRegion, 0},
{0x7ACF7E03, ICO, NoRegion, 0},
{0xAEAD1CA3, GT4, JP, 0},
{0x44A61C8F, GT4, Unknown, 0},
{0x0086E35B, GT4, Unknown, 0},
{0x77E61C8A, GT4, Unknown, 0},
{0x44A61C8F, GT4, NoRegion, 0},
{0x0086E35B, GT4, NoRegion, 0},
{0x77E61C8A, GT4, NoRegion, 0},
{0xC164550A, WildArms5, JPUNDUB, 0},
{0xC1640D2C, WildArms5, US, 0},
{0x0FCF8FE4, WildArms5, EU, 0},
@ -113,33 +113,33 @@ CRC::Game CRC::m_games[] =
{0xBBC3EFFA, WildArms4, US, 0},
{0xBBC396EC, WildArms4, US, 0}, //hmm such a small diff in the CRC..
{0x7B2DE9CC, WildArms4, EU, 0},
{0x8B029334, Manhunt2, Unknown, 0},
{0x09F49E37, CrashBandicootWoC, Unknown, 0},
{0x8B029334, Manhunt2, NoRegion, 0},
{0x09F49E37, CrashBandicootWoC, NoRegion, 0},
{0x013E349D, ResidentEvil4, US, 0},
{0x6BA2F6B9, ResidentEvil4, Unknown, 0},
{0x6BA2F6B9, ResidentEvil4, NoRegion, 0},
{0x60FA8C69, ResidentEvil4, JP, 0},
{0x72E1E60E, Spartan, Unknown, 0},
{0x72E1E60E, Spartan, NoRegion, 0},
{0x5ED8FB53, AceCombat4, JP, 0},
{0x1B9B7563, AceCombat4, Unknown, 0},
{0xEC432B24, Drakengard2, Unknown, 0},
{0x1B9B7563, AceCombat4, NoRegion, 0},
{0xEC432B24, Drakengard2, NoRegion, 0},
{0xFC46EA61, Tekken5, JP, 0},
{0x1F88EE37, Tekken5, Unknown, 0},
{0x652050D2, Tekken5, Unknown, 0},
{0x1F88EE37, Tekken5, NoRegion, 0},
{0x652050D2, Tekken5, NoRegion, 0},
{0x9E98B8AE, IkkiTousen, JP, 0},
{0xD6385328, GodOfWar, US, 0},
{0xFB0E6D72, GodOfWar, EU, 0},
{0xEB001875, GodOfWar, EU, 0},
{0xA61A4C6D, GodOfWar, Unknown, 0},
{0xE23D532B, GodOfWar, Unknown, 0},
{0xDF1AF973, GodOfWar, Unknown, 0},
{0xD6385328, GodOfWar, Unknown, 0},
{0xA61A4C6D, GodOfWar, NoRegion, 0},
{0xE23D532B, GodOfWar, NoRegion, 0},
{0xDF1AF973, GodOfWar, NoRegion, 0},
{0xD6385328, GodOfWar, NoRegion, 0},
{0x2F123FD8, GodOfWar2, RU, 0},
{0x2F123FD8, GodOfWar2, US, 0},
{0x44A8A22A, GodOfWar2, EU, 0},
{0x4340C7C6, GodOfWar2, Unknown, 0},
{0xF8CD3DF6, GodOfWar2, Unknown, 0},
{0x0B82BFF7, GodOfWar2, Unknown, 0},
{0x5D482F18, JackieChanAdv, Unknown, 0},
{0x4340C7C6, GodOfWar2, NoRegion, 0},
{0xF8CD3DF6, GodOfWar2, NoRegion, 0},
{0x0B82BFF7, GodOfWar2, NoRegion, 0},
{0x5D482F18, JackieChanAdv, NoRegion, 0},
{0xf0a6d880, HarvestMoon, US, 0},
{0x75c01a04, NamcoXCapcom, US, 0},
{0xBF6F101F, GiTS, US, 0},
@ -150,9 +150,9 @@ CRC::Game CRC::m_games[] =
{0x045D77E9, TalesOfAbyss, JPUNDUB, 0},
{0xAA5EC3A3, TalesOfAbyss, JP, 0},
{0xFB236A46, SonicUnleashed, US, 0},
{0x4C7BB3C8, SimpsonsGame, Unknown, 0},
{0x4C94B32C, SimpsonsGame, Unknown, 0},
{0xD71B57F4, Genji, Unknown, 0},
{0x4C7BB3C8, SimpsonsGame, NoRegion, 0},
{0x4C94B32C, SimpsonsGame, NoRegion, 0},
{0xD71B57F4, Genji, NoRegion, 0},
{0xE04EA200, StarOcean3, EU, 0},
{0x23A97857, StarOcean3, US, 0},
{0xBEC32D49, StarOcean3, JP, 0},

View File

@ -26,7 +26,7 @@ class CRC
public:
enum Title
{
None,
NoTitle,
MetalSlug6,
TomoyoAfter,
Clannad,
@ -86,7 +86,7 @@ public:
enum Region
{
Unknown,
NoRegion,
US,
EU,
JP,

View File

@ -25,7 +25,7 @@
GSTexture::GSTexture()
: m_scale(1, 1)
, m_size(0, 0)
, m_type(None)
, m_type(0)
, m_msaa(false)
, LikelyOffset(false)
{

View File

@ -35,7 +35,7 @@ protected:
public:
struct GSMap {uint8* bits; int pitch;};
enum {None, RenderTarget, DepthStencil, Texture, Offscreen};
enum {RenderTarget = 1, DepthStencil, Texture, Offscreen};
public:
GSTexture();

View File

@ -23,10 +23,12 @@
#include "GSdx.h"
#include "GSWnd.h"
#ifdef _WINDOWS
GSWnd::GSWnd()
: m_hWnd(NULL)
, m_IsManaged(true)
, m_HasFrame(true)
, m_managed(false)
, m_frame(true)
{
}
@ -34,8 +36,6 @@ GSWnd::~GSWnd()
{
}
#ifdef _WINDOWS
LRESULT CALLBACK GSWnd::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
GSWnd* wnd = NULL;
@ -82,13 +82,9 @@ LRESULT GSWnd::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
return DefWindowProc((HWND)m_hWnd, message, wParam, lParam);
}
#endif
bool GSWnd::Create(const string& title, int w, int h)
{
#ifdef _WINDOWS
if(m_hWnd) return true;
if(m_hWnd) return false;
WNDCLASS wc;
@ -139,64 +135,38 @@ bool GSWnd::Create(const string& title, int w, int h)
m_hWnd = CreateWindow(wc.lpszClassName, title.c_str(), style, r.left, r.top, r.width(), r.height(), NULL, NULL, wc.hInstance, (LPVOID)this);
return m_hWnd != NULL;
#else
// TODO: linux
return false;
#endif
return m_hWnd != NULL;
}
bool GSWnd::Attach(void* hWnd, bool isManaged)
bool GSWnd::Attach(void* handle, bool managed)
{
// TODO: subclass
m_hWnd = hWnd;
m_IsManaged = isManaged;
m_managed = managed;
return true;
}
void GSWnd::Detach()
{
if(m_hWnd && m_IsManaged)
if(m_hWnd && m_managed)
{
// close the window, since it's under GSdx care. It's not taking messages anyway, and
// that means its big, ugly, and in the way.
#ifdef _WINDOWS
DestroyWindow((HWND)m_hWnd);
#else
// TODO: linux
#endif
DestroyWindow(m_hWnd);
}
m_hWnd = NULL;
m_IsManaged = true;
m_managed = false;
}
GSVector4i GSWnd::GetClientRect()
{
GSVector4i r;
#ifdef _WINDOWS
::GetClientRect((HWND)m_hWnd, r);
#else
r = GSVector4i::zero();
// TODO: linux
#endif
::GetClientRect(m_hWnd, r);
return r;
}
@ -206,76 +176,129 @@ GSVector4i GSWnd::GetClientRect()
bool GSWnd::SetWindowText(const char* title)
{
if(!m_IsManaged) return false;
if(!m_managed) return false;
#ifdef _WINDOWS
::SetWindowText(m_hWnd, title);
::SetWindowText((HWND)m_hWnd, title);
#else
// TODO: linux
#endif
return m_HasFrame;
return m_frame;
}
void GSWnd::Show()
{
if(!m_IsManaged) return;
if(!m_managed) return;
#ifdef _WINDOWS
HWND hWnd = (HWND)m_hWnd;
SetForegroundWindow(hWnd);
ShowWindow(hWnd, SW_SHOWNORMAL);
UpdateWindow(hWnd);
#else
// TODO: linux
#endif
SetForegroundWindow(m_hWnd);
ShowWindow(m_hWnd, SW_SHOWNORMAL);
UpdateWindow(m_hWnd);
}
void GSWnd::Hide()
{
if(!m_IsManaged) return;
if(!m_managed) return;
#ifdef _WINDOWS
ShowWindow((HWND)m_hWnd, SW_HIDE);
#else
// TODO: linux
#endif
ShowWindow(m_hWnd, SW_HIDE);
}
void GSWnd::HideFrame()
{
if(!m_IsManaged) return;
if(!m_managed) return;
#ifdef _WINDOWS
SetWindowLong(m_hWnd, GWL_STYLE, GetWindowLong(m_hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME));
SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SetMenu(m_hWnd, NULL);
HWND hWnd = (HWND)m_hWnd;
SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) & ~(WS_CAPTION|WS_THICKFRAME));
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SetMenu(hWnd, NULL);
m_frame = false;
}
#else
// TODO: linux
GSWnd::GSWnd()
: m_display(NULL)
, m_window(0)
, m_managed(false)
, m_frame(true)
{
}
GSWnd::~GSWnd()
{
if(m_display != NULL)
{
if(m_window != 0)
{
XDestroyWindow(m_display, m_window);
}
XCloseDisplay(m_display);
}
}
bool GSWnd::Create(const string& title, int w, int h)
{
if(m_display != NULL) return false;
if(!XInitThreads()) return false;
m_display = XOpenDisplay(0);
if(m_display == NULL) return false;
m_window = XCreateSimpleWindow(m_display, RootWindow(m_display, 0), 0, 0, 640, 480, 0, BlackPixel(m_display, 0), BlackPixel(m_display, 0));
XFlush(m_display);
return true;
}
GSVector4i GSWnd::GetClientRect()
{
int x, y;
unsigned int w, h;
unsigned int border, depth;
Window root;
XLockDisplay(m_display);
XGetGeometry(m_display, m_window, &root, &x, &y, &w, &h, &border, &depth);
XUnlockDisplay(m_display);
return GSVector4i(0, 0, w, h);
}
// Returns FALSE if the window has no title, or if th window title is under the strict
// management of the emulator.
bool GSWnd::SetWindowText(const char* title)
{
if(!m_managed) return false;
// TODO
return m_frame;
}
void GSWnd::Show()
{
if(!m_managed) return;
XMapWindow(m_display, m_window);
XFlush(m_display);
}
void GSWnd::Hide()
{
if(!m_managed) return;
XUnmapWindow(m_display, m_window);
XFlush(m_display);
}
void GSWnd::HideFrame()
{
if(!m_managed) return;
// TODO
m_frame = false;
}
#endif
m_HasFrame = false;
}

View File

@ -23,37 +23,67 @@
#include "GSVector.h"
#ifdef _WINDOWS
class GSWnd
{
bool m_IsManaged; // set true when we're attached to a 3rdparty window that's amanged by the emulator
bool m_HasFrame;
void* m_hWnd;
#ifdef _WINDOWS
bool m_managed; // set true when we're attached to a 3rdparty window that's amanged by the emulator
bool m_frame;
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
#endif
public:
GSWnd();
virtual ~GSWnd();
bool Create(const string& title, int w, int h);
bool Attach(void* hWnd, bool isManaged = true);
bool Attach(void* handle, bool managed = true);
void Detach();
bool IsManaged() const { return m_IsManaged; }
bool IsManaged() const {return m_managed;}
void* GetDisplay() {return m_hWnd;}
void* GetHandle() {return m_hWnd;}
GSVector4i GetClientRect();
bool SetWindowText(const char* title);
void Show();
void Hide();
void HideFrame();
};
#else
#include <X11/Xlib.h>
class GSWnd
{
Display* m_display;
Window m_window;
bool m_managed; // set true when we're attached to a 3rdparty window that's amanged by the emulator
bool m_frame;
public:
GSWnd();
virtual ~GSWnd();
bool Create(const string& title, int w, int h);
bool Attach(void* handle, bool managed = true) {return false;}
void Detach() {}
bool IsManaged() const {return m_managed;}
Display* GetDisplay() {return m_display;}
void* GetHandle() {return (void*)m_window;}
GSVector4i GetClientRect();
bool SetWindowText(const char* title);
void Show();
void Hide();
void HideFrame();
};
#endif

View File

@ -12,7 +12,7 @@
<Option object_output="obj/Debug/" />
<Option type="3" />
<Option compiler="gcc" />
<Option host_application="../../pcsx2/bin/pcsx2" />
<Option host_application="../../pcsx2/bin/pcsx2-dbg" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="Workspace">
<Project filename="GSdx.gcc.cbp" active="1">
<Depends filename="../../3rdparty/SDL-1.3.0-5387/SDL-1.3/SDL-1.3.cbp" />
</Project>
<Project filename="../../3rdparty/SDL-1.3.0-5387/SDL-1.3/SDL-1.3.cbp" />
</Workspace>
</CodeBlocks_workspace_file>

View File

@ -17,6 +17,9 @@
<Add option="-O0" />
<Add option="-g" />
</Compiler>
<Linker>
<Add library="../../deps/debug/libSDL-1.3.a" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/libGSdx" prefix_auto="1" extension_auto="1" />
@ -29,6 +32,9 @@
<Add option="-msse2" />
<Add option="-O2" />
</Compiler>
<Linker>
<Add library="../../deps/release/libSDL-1.3.a" />
</Linker>
</Target>
</Build>
<Compiler>