GSnull: Make it work better with Windows and LilyPad.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1237 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-22 01:49:39 +00:00
parent 3b22adc4b3
commit f9cf905155
2 changed files with 379 additions and 344 deletions

View File

@ -35,6 +35,7 @@ int screen;
#endif
#ifdef _WIN32
HINSTANCE HInst;
HWND GShwnd;
#endif
const unsigned char version = PS2E_GS_VERSION;
@ -128,6 +129,25 @@ EXPORT_C_(void) GSshutdown()
SysPrintf("Shutting down GSnull\n");
}
#ifndef __LINUX__
LRESULT CALLBACK MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
#endif
EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread)
{
#ifdef GS_LOG
@ -141,8 +161,21 @@ EXPORT_C_(s32) GSopen(void *pDsp, char *Title, int multithread)
if( pDsp != NULL ) *(Display**)pDsp = display;
#else
if( pDsp != NULL ) *(int*)pDsp = (int)GetNextWindow(GetForegroundWindow(),GW_HWNDNEXT);
(NULL);
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
"PS2EMU_GSNULL", NULL };
RegisterClassEx( &wc );
GShwnd = CreateWindowEx( WS_EX_CLIENTEDGE, "PS2EMU_GSNULL", "The title of my window",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, wc.hInstance, NULL);
if(GShwnd == NULL)
{
GS_LOG("Failed to create window. Exiting...");
return -1;
}
if( pDsp != NULL ) *(int*)pDsp = (int)GShwnd;
#endif
SysPrintf("Opening GSnull\n");
return 0;
@ -243,6 +276,7 @@ EXPORT_C_(void) GSreadFIFO2(u64 *mem, int qwc)
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
{
#ifdef __LINUX__
switch(ev->evt) {
case KEYPRESS:
switch(ev->key) {
@ -278,6 +312,7 @@ EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
break;
}
}
#endif
}
EXPORT_C_(void) GSchangeSaveState(int, const char* filename)

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "GS.h"
#include "../GS.h"
void OnKeyboardF5(int myShift)
{