diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-13 01:32:56 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-08-13 01:32:56 +0000 |
| commit | c6191a4474b4cab60cc9886860c8b6de7c4e146b (patch) | |
| tree | 7b450e4d69ec922805cf2448af9cc53286f17d73 /plugins | |
| parent | 7d0cd28dd85965b4f94c8eeb5aa2c70297122485 (diff) | |
| download | pcsxr-c6191a4474b4cab60cc9886860c8b6de7c4e146b.tar.gz | |
dfxvideo: Readded windows support.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@56047 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/dfxvideo/cfg.h | 10 | ||||
| -rw-r--r-- | plugins/dfxvideo/externals.h | 93 | ||||
| -rw-r--r-- | plugins/dfxvideo/gpu.c | 581 | ||||
| -rw-r--r-- | plugins/dfxvideo/interp.h | 8 | ||||
| -rw-r--r-- | plugins/dfxvideo/menu.c | 92 | ||||
| -rw-r--r-- | plugins/dfxvideo/prim.c | 6 | ||||
| -rw-r--r-- | plugins/dfxvideo/soft.c | 5 | ||||
| -rw-r--r-- | plugins/dfxvideo/zn.c | 33 |
8 files changed, 657 insertions, 171 deletions
diff --git a/plugins/dfxvideo/cfg.h b/plugins/dfxvideo/cfg.h index fa259f30..a58a3de2 100644 --- a/plugins/dfxvideo/cfg.h +++ b/plugins/dfxvideo/cfg.h @@ -22,7 +22,11 @@ void ReadConfig(void); void WriteConfig(void); void ReadWinSizeConfig(void); -void SoftDlgProc(void); -void AboutDlgProc(void); +#ifdef _WINDOWS
+BOOL CALLBACK SoftDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
+#else
+void SoftDlgProc(void);
+void AboutDlgProc(void);
+#endif -#endif // _GPU_CFG_H_ +#endif diff --git a/plugins/dfxvideo/externals.h b/plugins/dfxvideo/externals.h index 2c29faf2..35fe0eff 100644 --- a/plugins/dfxvideo/externals.h +++ b/plugins/dfxvideo/externals.h @@ -51,6 +51,33 @@ #define GPUIsNotReadyForCommands (lGPUstatusRet &= ~GPUSTATUS_READYFORCOMMANDS) #define GPUIsReadyForCommands (lGPUstatusRet |= GPUSTATUS_READYFORCOMMANDS) +
+#ifdef _WINDOWS
+
+#ifndef STRICT
+#define STRICT
+#endif
+#define D3D_OVERLOADS
+#define DIRECT3D_VERSION 0x600
+#define CINTERFACE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <windows.h>
+#include <windowsx.h>
+#include <tchar.h>
+#include "resource.h"
+
+#include "ddraw.h"
+#include "d3dtypes.h"
+#include "d3d.h"
+
+#pragma warning (disable:864)
+
+#else
#define __X11_C_ //X11 render @@ -68,6 +95,8 @@ #include <math.h> #include <X11/cursorfont.h> #include <stdint.h> +
+#endif
///////////////////////////////////////////////////////////////////////////// @@ -103,6 +132,21 @@ typedef struct PSXRECTTAG short y0; short y1; } PSXRect_t; +
+#ifdef _WINDOWS
+
+typedef struct SDXTAG
+{
+ LPDIRECTDRAW DD;
+
+ LPDIRECTDRAWSURFACE DDSPrimary;
+ LPDIRECTDRAWSURFACE DDSRender;
+ LPDIRECTDRAWSURFACE DDSHelper;
+ LPDIRECTDRAWSURFACE DDSScreenPic;
+ HWND hWnd;
+} sDX;
+
+#else
// linux defines for some windows stuff @@ -122,9 +166,9 @@ typedef struct RECTTAG int top; int right; int bottom; -}RECT; - +} RECT; +#endif ///////////////////////////////////////////////////////////////////////////// @@ -155,13 +199,26 @@ typedef struct PSXDISPLAYTAG } PSXDisplay_t; -///////////////////////////////////////////////////////////////////////////// +#ifdef _WINDOWS
+extern HINSTANCE hInst;
+#endif
+/////////////////////////////////////////////////////////////////////////////
+
// draw.c #ifndef _IN_DRAW -extern char * pCaptionText; +#ifdef _WINDOWS
+extern sDX DX;
+extern HWND hWGPU;
+extern GUID guiDev;
+extern int iRefreshRate;
+extern BOOL bVsync;
+extern BOOL bVsync_Key;
+#else
+extern char * pCaptionText;
+#endif extern int iResX; extern int iResY; @@ -179,7 +236,10 @@ extern short g_m1; extern short g_m2; extern short g_m3; extern short DrawSemiTrans; -extern int iUseGammaVal; +extern int iUseGammaVal;
+#ifdef _WINDOWS
+extern int iUseScanLines;
+#endif extern int iMaintainAspect; extern int iDesktopCol; extern int iUseNoStretchBlt; @@ -188,8 +248,11 @@ extern int iFastFwd; extern int iDebugMode; extern int iFVDisplay; extern PSXPoint_t ptCursorPoint[]; -extern unsigned short usCursorActive; +extern unsigned short usCursorActive;
+#ifdef _WINDOWS
+extern int iSysMemory;
+#endif
#endif @@ -261,6 +324,12 @@ extern uint32_t ulStatusControl[]; #ifndef _IN_MENU extern uint32_t dwCoreFlags; +
+#ifdef _WINDOWS
+extern HFONT hGFont;
+extern int iMPos;
+extern BOOL bTransparent;
+#endif
#endif @@ -268,8 +337,12 @@ extern uint32_t dwCoreFlags; #ifndef _IN_KEY -extern unsigned long ulKeybits; +extern unsigned long ulKeybits;
+#ifdef _WINDOWS
+extern char szGPUKeys[];
+#endif +
#endif // fps.c @@ -283,6 +356,10 @@ extern int iFrameLimit; extern float fFrameRateHz; extern float fps_skip; extern float fps_cur; +#ifdef _WINDOWS
+extern BOOL IsPerformanceCounter;
+extern int iStopSaver;
+#endif
#endif @@ -311,5 +388,3 @@ extern int GlobalTextIL; extern int iTileCheat; #endif - - diff --git a/plugins/dfxvideo/gpu.c b/plugins/dfxvideo/gpu.c index 7dd359ff..1bb2ad63 100644 --- a/plugins/dfxvideo/gpu.c +++ b/plugins/dfxvideo/gpu.c @@ -18,7 +18,7 @@ #ifndef _MACGL #include "config.h" #endif - +
#define _IN_GPU #include "externals.h" @@ -42,6 +42,11 @@ #define _(x) (x) #define N_(x) (x) #endif +
+#ifdef _WINDOWS
+#include "resource.h"
+#include "record.h"
+#endif
//////////////////////////////////////////////////////////////////////// // PPDK developer must change libraryName field and can change revision and build @@ -50,8 +55,11 @@ const unsigned char version = 1; // do not touch - library for PSEmu 1.x const unsigned char revision = 1; const unsigned char build = 17; // increase that with each version - -#ifdef _MACGL +
+#if defined (_WINDOWS)
+static char *libraryName = N_("Soft Driver"); +static char *libraryInfo = N_("P.E.Op.S. Soft Driver V1.17\nCoded by Pete Bernert and the P.E.Op.S. team\n");
+#elif defined (_MACGL) static char *libraryName = N_("SoftGL Driver"); static char *libraryInfo = N_("P.E.Op.S. SoftGL Driver V1.17\nCoded by Pete Bernert and the P.E.Op.S. team\n"); #else @@ -107,6 +115,65 @@ BOOL bChangeWinMode=FALSE; BOOL bDoLazyUpdate=FALSE; uint32_t lGPUInfoVals[16]; static int iFakePrimBusy=0; +
+#ifdef _WINDOWS
+
+////////////////////////////////////////////////////////////////////////
+// screensaver stuff: dynamically load kernel32.dll to avoid export dependeny
+////////////////////////////////////////////////////////////////////////
+
+int iStopSaver=0;
+HINSTANCE kernel32LibHandle = NULL;
+
+// A stub function, that does nothing .... but it does "nothing" well :)
+EXECUTION_STATE WINAPI STUB_SetThreadExecutionState(EXECUTION_STATE esFlags)
+{
+ return esFlags;
+}
+
+// The dynamic version of the system call is prepended with a "D_"
+EXECUTION_STATE (WINAPI *D_SetThreadExecutionState)(EXECUTION_STATE esFlags) = STUB_SetThreadExecutionState;
+
+BOOL LoadKernel32(void)
+{
+ // Get a handle to the kernel32.dll (which is actually already loaded)
+ kernel32LibHandle = LoadLibrary("kernel32.dll");
+
+ // If we've got a handle, then locate the entry point for the SetThreadExecutionState function
+ if (kernel32LibHandle != NULL)
+ {
+ if ((D_SetThreadExecutionState = (EXECUTION_STATE (WINAPI *)(EXECUTION_STATE))GetProcAddress (kernel32LibHandle, "SetThreadExecutionState")) == NULL)
+ D_SetThreadExecutionState = STUB_SetThreadExecutionState;
+ }
+
+ return TRUE;
+}
+
+BOOL FreeKernel32(void)
+{
+ // Release the handle to kernel32.dll
+ if (kernel32LibHandle != NULL)
+ FreeLibrary(kernel32LibHandle);
+
+ // Set to stub function, to avoid nasty suprises if called :)
+ D_SetThreadExecutionState = STUB_SetThreadExecutionState;
+
+ return TRUE;
+}
+#else
+
+// Linux: Stub the functions
+BOOL LoadKernel32(void)
+{
+ return TRUE;
+}
+
+BOOL FreeKernel32(void)
+{
+ return TRUE;
+}
+
+#endif
//////////////////////////////////////////////////////////////////////// // some misc external display funcs @@ -159,7 +226,7 @@ char * GPUgetLibInfos(void) // Snapshot func //////////////////////////////////////////////////////////////////////// -static char * pGetConfigInfos(int iCfg) +char * pGetConfigInfos(int iCfg) { char szO[2][4]={"off","on "}; char szTxt[256]; @@ -203,7 +270,7 @@ static char * pGetConfigInfos(int iCfg) else sprintf(szTxt,"- FPS limit: %.1f\r\n\r\n",fFrameRate); strcat(pB,szTxt); //----------------------------------------------------// -#ifndef _MACGL +#if !defined (_MACGL) && !defined (_WINDOWS) strcpy(szTxt,"Misc:\r\n- MaintainAspect: "); if(iMaintainAspect == 0) strcat(szTxt,"disabled"); else @@ -222,8 +289,12 @@ static void DoTextSnapShot(int iNum) FILE *txtfile; char szTxt[256]; char *pB; - - sprintf(szTxt,"%s/pcsx%04d.txt",getenv("HOME"),iNum); +
+#ifdef _WINDOWS
+ sprintf(szTxt,"snap\\pcsx%04d.txt",iNum);
+#else
+ sprintf(szTxt,"%s/pcsx%04d.txt",getenv("HOME"),iNum);
+#endif if ((txtfile = fopen(szTxt, "wb")) == NULL) return; @@ -280,8 +351,12 @@ void CALLBACK GPUmakeSnapshot(void) // increment snapshot value & try to get filename do { - snapshotnr++; - sprintf(filename, "%s/pcsx%04ld.bmp", getenv("HOME"), snapshotnr); + snapshotnr++;
+#ifdef _WINDOWS
+ sprintf(filename,"snap\\pcsx%04ld.bmp",snapshotnr);
+#else
+ sprintf(filename, "%s/pcsx%04ld.bmp", getenv("HOME"), snapshotnr);
+#endif bmpfile = fopen(filename,"rb"); if (bmpfile == NULL) @@ -383,7 +458,10 @@ long CALLBACK GPUinit() // GPU INIT lGPUstatusRet = 0x14802000; GPUIsIdle; GPUIsReadyForCommands; - bDoVSyncUpdate = TRUE; + bDoVSyncUpdate = TRUE;
+ + // Get a handle for kernel32.dll, and access the required export function
+ LoadKernel32();
return 0; } @@ -391,7 +469,34 @@ long CALLBACK GPUinit() // GPU INIT //////////////////////////////////////////////////////////////////////// // Here starts all... //////////////////////////////////////////////////////////////////////// - +
+#ifdef _WINDOWS
+long CALLBACK GPUopen(HWND hwndGPU) // GPU OPEN
+{
+ hWGPU = hwndGPU; // store hwnd
+
+ SetKeyHandler(); // sub-class window
+
+ if(bChangeWinMode) ReadWinSizeConfig(); // alt+enter toggle?
+ else // or first time startup?
+ {
+ ReadConfig(); // read registry
+ InitFPS();
+ }
+
+ bIsFirstFrame = TRUE; // we have to init later
+ bDoVSyncUpdate = TRUE;
+
+ ulInitDisplay(); // setup direct draw
+
+ if(iStopSaver)
+ D_SetThreadExecutionState(ES_SYSTEM_REQUIRED|ES_DISPLAY_REQUIRED|ES_CONTINUOUS);
+
+
+ return 0;
+}
+
+#else
long GPUopen(unsigned long * disp,char * CapText,char * CfgFile) { @@ -415,7 +520,8 @@ long GPUopen(unsigned long * disp,char * CapText,char * CfgFile) if(d) return 0; return -1; } - +
+#endif //////////////////////////////////////////////////////////////////////// // time to leave... @@ -423,10 +529,18 @@ long GPUopen(unsigned long * disp,char * CapText,char * CfgFile) long CALLBACK GPUclose() // GPU CLOSE { +#ifdef _WINDOWS
+ if(RECORD_RECORDING==TRUE) {RECORD_Stop();RECORD_RECORDING=FALSE;BuildDispMenu(0);}
+#endif
ReleaseKeyHandler(); // de-subclass window CloseDisplay(); // shutdown direct draw +
+#ifdef _WINDOWS
+ if(iStopSaver)
+ D_SetThreadExecutionState(ES_SYSTEM_REQUIRED|ES_DISPLAY_REQUIRED);
+#endif
return 0; } @@ -436,7 +550,10 @@ long CALLBACK GPUclose() // GPU CLOSE //////////////////////////////////////////////////////////////////////// long CALLBACK GPUshutdown() // GPU SHUTDOWN -{ +{
+ // screensaver: release the handle for kernel32.dll
+ FreeKernel32();
+ free(psxVSecure); return 0; // nothinh to do @@ -538,18 +655,19 @@ void ChangeDispOffsetsX(void) // X CENTER PreviousPSXDisplay.Range.x0+=2; //??? PreviousPSXDisplay.Range.x1+=(short)(lx-l); - +
+#ifndef _WINDOWS PreviousPSXDisplay.Range.x1-=2; // makes linux stretching easier - +#endif } - +#ifndef _WINDOWS // some linux alignment security PreviousPSXDisplay.Range.x0=PreviousPSXDisplay.Range.x0>>1; PreviousPSXDisplay.Range.x0=PreviousPSXDisplay.Range.x0<<1; PreviousPSXDisplay.Range.x1=PreviousPSXDisplay.Range.x1>>1; PreviousPSXDisplay.Range.x1=PreviousPSXDisplay.Range.x1<<1; - +#endif DoClearScreenBuffer(); } @@ -656,106 +774,117 @@ void updateDisplayIfChanged(void) // UPDATE DISPLAY IF CHAN //////////////////////////////////////////////////////////////////////// -#ifndef _MACGL - -#include "draw.h" - -void ChangeWindowMode(void) // TOGGLE FULLSCREEN - WINDOW -{ - extern Display *display; - extern Window window; - extern int root_window_id; - Screen *screen; - XSizeHints hints; - MotifWmHints mwmhints; - Atom mwmatom; - - screen=DefaultScreenOfDisplay(display); - iWindowMode=!iWindowMode; - - if(!iWindowMode) // fullscreen - { - mwmhints.flags=MWM_HINTS_DECORATIONS; - mwmhints.functions=0; - mwmhints.decorations=0; - mwmhints.input_mode=0; - mwmatom=XInternAtom(display,"_MOTIF_WM_HINTS",0); - XChangeProperty(display,window,mwmatom,mwmatom,32, - PropModeReplace,(unsigned char *)&mwmhints,5); - - XResizeWindow(display,window,screen->width,screen->height); - - hints.min_width = hints.max_width = hints.base_width = screen->width; - hints.min_height= hints.max_height = hints.base_height = screen->height; - - XSetWMNormalHints(display,window,&hints); - - { - XEvent xev; - - memset(&xev, 0, sizeof(xev)); - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = 1; - xev.xclient.message_type = XInternAtom(display, "_NET_WM_STATE", 0); - xev.xclient.window = window; - xev.xclient.format = 32; - xev.xclient.data.l[0] = 1; - xev.xclient.data.l[1] = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", 0); - xev.xclient.data.l[2] = 0; - xev.xclient.data.l[3] = 0; - xev.xclient.data.l[4] = 0; - - XSendEvent(display, root_window_id, 0, - SubstructureRedirectMask | SubstructureNotifyMask, &xev); - } - } else { - { - XEvent xev; - - memset(&xev, 0, sizeof(xev)); - xev.xclient.type = ClientMessage; - xev.xclient.serial = 0; - xev.xclient.send_event = 1; - xev.xclient.message_type = XInternAtom(display, "_NET_WM_STATE", 0); - xev.xclient.window = window; - xev.xclient.format = 32; - xev.xclient.data.l[0] = 0; - xev.xclient.data.l[1] = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", 0); - xev.xclient.data.l[2] = 0; - xev.xclient.data.l[3] = 0; - xev.xclient.data.l[4] = 0; - - XSendEvent(display, root_window_id, 0, - SubstructureRedirectMask | SubstructureNotifyMask, &xev); - } - - mwmhints.flags=MWM_HINTS_DECORATIONS; - mwmhints.functions=0; - mwmhints.decorations=1; - mwmhints.input_mode=0; - mwmatom=XInternAtom(display,"_MOTIF_WM_HINTS",0); - - //This shouldn't work on 64 bit longs, but it does...in fact, it breaks when I change all the mwmhints to int. - //I don't pretend to understand it. - XChangeProperty(display,window,mwmatom,mwmatom,32, - PropModeReplace,(unsigned char *)&mwmhints,5); - - hints.flags=USPosition|USSize; - hints.base_width = iResX; - hints.base_height = iResY; - XSetWMNormalHints(display,window,&hints); - - XResizeWindow(display,window,iResX,iResY); -} - - DoClearScreenBuffer(); - - bChangeWinMode=FALSE; - bDoVSyncUpdate=TRUE; -} - -#endif +#if defined(_WINDOWS)
+
+void ChangeWindowMode(void) // TOGGLE FULLSCREEN - WINDOW
+{
+ GPUclose();
+ iWindowMode=!iWindowMode;
+ GPUopen(hWGPU);
+ bChangeWinMode=FALSE;
+ bDoVSyncUpdate=TRUE;
+}
+
+#else !defined (_MACGL)
+
+#include "draw.h"
+
+void ChangeWindowMode(void) // TOGGLE FULLSCREEN - WINDOW
+{
+ extern Display *display;
+ extern Window window;
+ extern int root_window_id;
+ Screen *screen;
+ XSizeHints hints;
+ MotifWmHints mwmhints;
+ Atom mwmatom;
+
+ screen=DefaultScreenOfDisplay(display);
+ iWindowMode=!iWindowMode;
+
+ if(!iWindowMode) // fullscreen
+ {
+ mwmhints.flags=MWM_HINTS_DECORATIONS;
+ mwmhints.functions=0;
+ mwmhints.decorations=0;
+ mwmhints.input_mode=0;
+ mwmatom=XInternAtom(display,"_MOTIF_WM_HINTS",0);
+ XChangeProperty(display,window,mwmatom,mwmatom,32,
+ PropModeReplace,(unsigned char *)&mwmhints,5);
+
+ XResizeWindow(display,window,screen->width,screen->height);
+
+ hints.min_width = hints.max_width = hints.base_width = screen->width;
+ hints.min_height= hints.max_height = hints.base_height = screen->height;
+
+ XSetWMNormalHints(display,window,&hints);
+
+ {
+ XEvent xev;
+
+ memset(&xev, 0, sizeof(xev));
+ xev.xclient.type = ClientMessage;
+ xev.xclient.serial = 0;
+ xev.xclient.send_event = 1;
+ xev.xclient.message_type = XInternAtom(display, "_NET_WM_STATE", 0);
+ xev.xclient.window = window;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = 1;
+ xev.xclient.data.l[1] = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", 0);
+ xev.xclient.data.l[2] = 0;
+ xev.xclient.data.l[3] = 0;
+ xev.xclient.data.l[4] = 0;
+
+ XSendEvent(display, root_window_id, 0,
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+ }
+ } else {
+ {
+ XEvent xev;
+
+ memset(&xev, 0, sizeof(xev));
+ xev.xclient.type = ClientMessage;
+ xev.xclient.serial = 0;
+ xev.xclient.send_event = 1;
+ xev.xclient.message_type = XInternAtom(display, "_NET_WM_STATE", 0);
+ xev.xclient.window = window;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = 0;
+ xev.xclient.data.l[1] = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", 0);
+ xev.xclient.data.l[2] = 0;
+ xev.xclient.data.l[3] = 0;
+ xev.xclient.data.l[4] = 0;
+
+ XSendEvent(display, root_window_id, 0,
+ SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+ }
+
+ mwmhints.flags=MWM_HINTS_DECORATIONS;
+ mwmhints.functions=0;
+ mwmhints.decorations=1;
+ mwmhints.input_mode=0;
+ mwmatom=XInternAtom(display,"_MOTIF_WM_HINTS",0);
+
+ //This shouldn't work on 64 bit longs, but it does...in fact, it breaks when I change all the mwmhints to int.
+ //I don't pretend to understand it.
+ XChangeProperty(display,window,mwmatom,mwmatom,32,
+ PropModeReplace,(unsigned char *)&mwmhints,5);
+
+ hints.flags=USPosition|USSize;
+ hints.base_width = iResX;
+ hints.base_height = iResY;
+ XSetWMNormalHints(display,window,&hints);
+
+ XResizeWindow(display,window,iResX,iResY);
+}
+
+ DoClearScreenBuffer();
+
+ bChangeWinMode=FALSE;
+ bDoVSyncUpdate=TRUE;
+}
+
+#endif
//////////////////////////////////////////////////////////////////////// // gun cursor func: player=0-7, x=0-511, y=0-255 @@ -809,10 +938,18 @@ void CALLBACK GPUupdateLace(void) // VSYNC if(bDoVSyncUpdate && !UseFrameSkip) // some primitives drawn? updateDisplay(); // -> update display } - } + }
+
+#ifdef _WINDOWS
+ if(RECORD_RECORDING)
+ if(RECORD_WriteFrame()==FALSE)
+ {RECORD_RECORDING=FALSE;RECORD_Stop();}
+#endif
+ #ifndef _MACGL if(bChangeWinMode) ChangeWindowMode(); // toggle full - window mode -#endif +#endif
+ bDoVSyncUpdate=FALSE; // vsync done } @@ -1403,7 +1540,8 @@ ENDVRAM: gpuDataC=gpuDataP=0; primFunc[gpuCommand]((unsigned char *)gpuDataM); if(dwEmuFixes&0x0001 || dwActFixes&0x0400) // hack for emulating "gpu busy" in some games - iFakePrimBusy=4;
} + iFakePrimBusy=4; + } } } @@ -1447,7 +1585,14 @@ long CALLBACK GPUgetMode(void) long CALLBACK GPUconfigure(void) { - SoftDlgProc(); +#ifdef _WINDOWS
+ HWND hWP=GetActiveWindow();
+
+ DialogBox(hInst,MAKEINTRESOURCE(IDD_CFGSOFT),
+ hWP,(DLGPROC)SoftDlgProc);
+#else
+ SoftDlgProc();
+#endif return 0; } @@ -1457,7 +1602,18 @@ long CALLBACK GPUconfigure(void) //////////////////////////////////////////////////////////////////////// void SetFixes(void) - { + {
+#ifdef _WINDOWS
+ BOOL bOldPerformanceCounter=IsPerformanceCounter; // store curr timer mode
+
+ if(dwActFixes&0x10) // check fix 0x10
+ IsPerformanceCounter=FALSE;
+ else SetFPSHandler();
+
+ if(bOldPerformanceCounter!=IsPerformanceCounter) // we have change it?
+ InitFPS(); // -> init fps again
+#endif
+ if(dwActFixes&0x02) sDispWidths[4]=384; else sDispWidths[4]=368; } @@ -1516,12 +1672,33 @@ long CALLBACK GPUdmaChain(uint32_t * baseAddrL, uint32_t addr) // show about dlg //////////////////////////////////////////////////////////////////////// - -void CALLBACK GPUabout(void) // ABOUT -{ - AboutDlgProc(); - return; -} +#ifdef _WINDOWS
+BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(LOWORD(wParam))
+ {case IDOK: EndDialog(hW,TRUE);return TRUE;}
+ }
+ }
+ return FALSE;
+}
+#endif
+
+void CALLBACK GPUabout(void) // ABOUT
+{
+#ifdef _WINDOWS
+ HWND hWP=GetActiveWindow(); // to be sure
+ DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT),
+ hWP,(DLGPROC)AboutDlgProc);
+#else
+ AboutDlgProc();
+#endif
+
+ return;
+}
//////////////////////////////////////////////////////////////////////// // We are ever fine ;) @@ -1854,9 +2031,150 @@ void PaintPicDot(unsigned char * p,unsigned char c) // Beware: the func can be called at any time, // so you have to use the frontbuffer to get a fully // rendered picture - -// LINUX version: - +
+#ifdef _WINDOWS
+
+void CALLBACK GPUgetScreenPic(unsigned char * pMem)
+{
+ HRESULT ddrval;DDSURFACEDESC xddsd;unsigned char * pf;
+ int x,y,c,v;RECT r;
+ float XS,YS;
+
+ memset(&xddsd, 0, sizeof(DDSURFACEDESC));
+ xddsd.dwSize = sizeof(DDSURFACEDESC);
+ xddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
+ xddsd.dwWidth = iResX;
+ xddsd.dwHeight = iResY;
+
+ r.left=0; r.right =iResX;
+ r.top=0; r.bottom=iResY;
+
+ if(iWindowMode)
+ {
+ POINT Point={0,0};
+ ClientToScreen(DX.hWnd,&Point);
+ r.left+=Point.x;r.right+=Point.x;
+ r.top+=Point.y;r.bottom+=Point.y;
+ }
+
+ XS=(float)iResX/128;
+ YS=(float)iResY/96;
+
+ ddrval=IDirectDrawSurface_Lock(DX.DDSPrimary,NULL, &xddsd, DDLOCK_WAIT|DDLOCK_READONLY, NULL);
+
+ if(ddrval==DDERR_SURFACELOST) IDirectDrawSurface_Restore(DX.DDSPrimary);
+
+ pf=pMem;
+
+ if(ddrval==DD_OK)
+ {
+ unsigned char * ps=(unsigned char *)xddsd.lpSurface;
+
+ if(iDesktopCol==16)
+ {
+ unsigned short sx;
+ for(y=0;y<96;y++)
+ {
+ for(x=0;x<128;x++)
+ {
+ sx=*((unsigned short *)((ps)+
+ r.top*xddsd.lPitch+
+ (((int)((float)y*YS))*xddsd.lPitch)+
+ r.left*2+
+ ((int)((float)x*XS))*2));
+ *(pf+0)=(sx&0x1f)<<3;
+ *(pf+1)=(sx&0x7e0)>>3;
+ *(pf+2)=(sx&0xf800)>>8;
+ pf+=3;
+ }
+ }
+ }
+ else
+ if(iDesktopCol==15)
+ {
+ unsigned short sx;
+ for(y=0;y<96;y++)
+ {
+ for(x=0;x<128;x++)
+ {
+ sx=*((unsigned short *)((ps)+
+ r.top*xddsd.lPitch+
+ (((int)((float)y*YS))*xddsd.lPitch)+
+ r.left*2+
+ ((int)((float)x*XS))*2));
+ *(pf+0)=(sx&0x1f)<<3;
+ *(pf+1)=(sx&0x3e0)>>2;
+ *(pf+2)=(sx&0x7c00)>>7;
+ pf+=3;
+ }
+ }
+ }
+ else
+ {
+ unsigned long sx;
+ for(y=0;y<96;y++)
+ {
+ for(x=0;x<128;x++)
+ {
+ sx=*((unsigned long *)((ps)+
+ r.top*xddsd.lPitch+
+ (((int)((float)y*YS))*xddsd.lPitch)+
+ r.left*4+
+ ((int)((float)x*XS))*4));
+ *(pf+0)=(unsigned char)((sx&0xff));
+ *(pf+1)=(unsigned char)((sx&0xff00)>>8);
+ *(pf+2)=(unsigned char)((sx&0xff0000)>>16);
+ pf+=3;
+ }
+ }
+ }
+ }
+
+ IDirectDrawSurface_Unlock(DX.DDSPrimary,&xddsd);
+
+ /////////////////////////////////////////////////////////////////////
+ // generic number/border painter
+
+ pf=pMem+(103*3); // offset to number rect
+
+ for(y=0;y<20;y++) // loop the number rect pixel
+ {
+ for(x=0;x<6;x++)
+ {
+ c=cFont[lSelectedSlot][x+y*6]; // get 4 char dot infos at once (number depends on selected slot)
+ v=(c&0xc0)>>6;
+ PaintPicDot(pf,(unsigned char)v);pf+=3; // paint the dots into the rect
+ v=(c&0x30)>>4;
+ PaintPicDot(pf,(unsigned char)v);pf+=3;
+ v=(c&0x0c)>>2;
+ PaintPicDot(pf,(unsigned char)v);pf+=3;
+ v=c&0x03;
+ PaintPicDot(pf,(unsigned char)v);pf+=3;
+ }
+ pf+=104*3; // next rect y line
+ }
+
+ pf=pMem; // ptr to first pos in 128x96 pic
+ for(x=0;x<128;x++) // loop top/bottom line
+ {
+ *(pf+(95*128*3))=0x00;*pf++=0x00;
+ *(pf+(95*128*3))=0x00;*pf++=0x00; // paint it red
+ *(pf+(95*128*3))=0xff;*pf++=0xff;
+ }
+ pf=pMem; // ptr to first pos
+ for(y=0;y<96;y++) // loop left/right line
+ {
+ *(pf+(127*3))=0x00;*pf++=0x00;
+ *(pf+(127*3))=0x00;*pf++=0x00; // paint it red
+ *(pf+(127*3))=0xff;*pf++=0xff;
+ pf+=127*3; // offset to next line
+ }
+}
+
+#else
+ +// LINUX version:
+
extern char * Xpixels; void GPUgetScreenPic(unsigned char * pMem) @@ -1930,6 +2248,7 @@ void GPUgetScreenPic(unsigned char * pMem) */ } +#endif
//////////////////////////////////////////////////////////////////////// // func will be called with 128x96x3 BGR data. diff --git a/plugins/dfxvideo/interp.h b/plugins/dfxvideo/interp.h index 30432371..e4ae0e36 100644 --- a/plugins/dfxvideo/interp.h +++ b/plugins/dfxvideo/interp.h @@ -209,7 +209,7 @@ static __inline unsigned int interp_32_97(unsigned int p1, unsigned int p2) #define INTERP_U_LIMIT (0x07*4) #define INTERP_V_LIMIT (0x06*8) -inline static int interp_16_diff(unsigned short p1, unsigned short p2) +__inline static int interp_16_diff(unsigned short p1, unsigned short p2) { int r, g, b; int y, u, v; @@ -243,7 +243,7 @@ inline static int interp_16_diff(unsigned short p1, unsigned short p2) return 0; } -inline static int interp_32_diff(unsigned int p1, unsigned int p2) +__inline static int interp_32_diff(unsigned int p1, unsigned int p2) { int r, g, b; int y, u, v; @@ -271,8 +271,6 @@ inline static int interp_32_diff(unsigned int p1, unsigned int p2) return 0; } -#if 0 - static void interp_set(unsigned bits_per_pixel) { interp_bits_per_pixel = bits_per_pixel; @@ -294,5 +292,3 @@ static void interp_set(unsigned bits_per_pixel) } #endif - -#endif diff --git a/plugins/dfxvideo/menu.c b/plugins/dfxvideo/menu.c index 33d111d9..57ff2201 100644 --- a/plugins/dfxvideo/menu.c +++ b/plugins/dfxvideo/menu.c @@ -20,19 +20,43 @@ #include "externals.h" #include "draw.h" #include "menu.h" -#include "gpu.h" +#include "gpu.h"
+ +#ifdef _WINDOWS
+
+#include "record.h"
+
+HFONT hGFont=NULL;
+BOOL bTransparent=FALSE;
+
+#endif
unsigned long dwCoreFlags = 0; // create lists/stuff for fonts (actually there are no more lists, but I am too lazy to change the func names ;) void InitMenu(void) -{ +{
+#ifdef _WINDOWS
+ hGFont=CreateFont(//-8,
+ 13,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,
+ ANSI_CHARSET,OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
+ DEFAULT_PITCH,
+ //"Courier New");
+ //"MS Sans Serif");
+ "Arial");
+#endif } // kill existing lists/fonts void CloseMenu(void) { - DestroyPic(); +#ifdef _WINDOWS
+ if(hGFont) DeleteObject(hGFont);
+ hGFont=NULL;
+#else
+ DestroyPic();
+#endif } // DISPLAY FPS/MENU TEXT @@ -43,7 +67,33 @@ extern time_t tStart; int iMPos=0; // menu arrow pos void DisplayText(void) // DISPLAY TEXT -{ +{
+#ifdef _WINDOWS
+ HDC hdc;HFONT hFO;
+
+ IDirectDrawSurface_GetDC(DX.DDSRender,&hdc);
+ hFO=(HFONT)SelectObject(hdc,hGFont);
+
+ SetTextColor(hdc,RGB(0,255,0));
+ if(bTransparent)
+ SetBkMode(hdc,TRANSPARENT);
+ else SetBkColor(hdc,RGB(0,0,0));
+
+ if(szDebugText[0] && ((time(NULL) - tStart) < 2)) // special debug text? show it
+ {
+ RECT r={0,0,1024,1024};
+ DrawText(hdc,szDebugText,lstrlen(szDebugText),&r,DT_LEFT|DT_NOCLIP);
+ }
+ else // else standard gpu menu
+ {
+ szDebugText[0]=0;
+ lstrcat(szDispBuf,szMenuBuf);
+ ExtTextOut(hdc,0,0,0,NULL,szDispBuf,lstrlen(szDispBuf),NULL);
+ }
+
+ SelectObject(hdc,hFO);
+ IDirectDrawSurface_ReleaseDC(DX.DDSRender,hdc);
+#endif } // Build Menu buffer (== Dispbuffer without FPS)... @@ -94,11 +144,28 @@ void BuildDispMenu(int iInc) szMenuBuf[24]='0'+(char)((dwCoreFlags&0xf000)>>12); // number } +#ifdef _WINDOWS
+ if(bVsync_Key) szMenuBuf[25] = 'V';
+#endif
if(lSelectedSlot) szMenuBuf[26] = '0'+(char)lSelectedSlot; - szMenuBuf[(iMPos+1)*5]='<'; // set arrow - + szMenuBuf[(iMPos+1)*5]='<'; // set arrow
+ +#ifdef _WINDOWS
+ if(RECORD_RECORDING)
+ {
+ szMenuBuf[27] = ' ';
+ szMenuBuf[28] = ' ';
+ szMenuBuf[29] = ' ';
+ szMenuBuf[30] = 'R';
+ szMenuBuf[31] = 'e';
+ szMenuBuf[32] = 'c';
+ szMenuBuf[33] = 0;
+ }
+
+ if(DX.DDSScreenPic) ShowTextGpuPic();
+#endif } // Some menu action... @@ -111,7 +178,18 @@ void SwitchDispMenu(int iStep) // SWITCH DISP MENU case 0: // frame limit { int iType=0; - bInitCap = TRUE; + bInitCap = TRUE;
+ +#ifdef _WINDOWS
+ if(iFrameLimit==1 && UseFrameLimit &&
+ GetAsyncKeyState(VK_SHIFT)&32768)
+ {
+ fFrameRate+=iStep;
+ if(fFrameRate<3.0f) fFrameRate=3.0f;
+ SetAutoFrameCap();
+ break;
+ }
+#endif
if(UseFrameLimit) iType=iFrameLimit; iType+=iStep; diff --git a/plugins/dfxvideo/prim.c b/plugins/dfxvideo/prim.c index 097f202e..563980ae 100644 --- a/plugins/dfxvideo/prim.c +++ b/plugins/dfxvideo/prim.c @@ -387,9 +387,9 @@ void cmdTexturePage(unsigned char * baseAddr) lGPUstatusRet&=~0x000007ff; lGPUstatusRet|=(gdata & 0x07ff); - - usMirror=gdata&0x3000; - + + usMirror=(unsigned short)(gdata&0x3000); + UpdateGlobalTP((unsigned short)gdata); GlobalTextREST = (gdata&0x00ffffff)>>9; } diff --git a/plugins/dfxvideo/soft.c b/plugins/dfxvideo/soft.c index 21625664..4fdb3ae8 100644 --- a/plugins/dfxvideo/soft.c +++ b/plugins/dfxvideo/soft.c @@ -25,6 +25,11 @@ #include "prim.h" #include "menu.h" #include "swap.h" +
+#ifdef _WINDOWS
+#pragma warning (disable:4244)
+#pragma warning (disable:4761)
+#endif
//////////////////////////////////////////////////////////////////////////////////// // "NO EDGE BUFFER" POLY VERSION... FUNCS BASED ON FATMAP.TXT FROM MRI / Doomsday diff --git a/plugins/dfxvideo/zn.c b/plugins/dfxvideo/zn.c index ea8537b6..534e9674 100644 --- a/plugins/dfxvideo/zn.c +++ b/plugins/dfxvideo/zn.c @@ -23,8 +23,11 @@ // - psx gpu plugin interface prototypes-------------- // // --------------------------------------------------- // -long GPUopen(unsigned long *disp, const char *CapText, const char *CfgFile); - +#ifdef _WINDOWS
+long CALLBACK GPUopen(HWND hwndGPU);
+#else
+long GPUopen(unsigned long * disp,const char * CapText,const char * CfgFile);
+#endif void CALLBACK GPUdisplayText(char * pText); void CALLBACK GPUdisplayFlags(uint32_t dwFlags); void CALLBACK GPUmakeSnapshot(void); @@ -48,9 +51,9 @@ long CALLBACK GPUtest(void); long CALLBACK GPUfreeze(uint32_t ulGetFreezeData,void * pF); void CALLBACK GPUgetScreenPic(unsigned char * pMem); void CALLBACK GPUshowScreenPic(unsigned char * pMem); - -void CALLBACK GPUkeypressed(int keycode); - +#ifndef _WINDOWS
+void CALLBACK GPUkeypressed(int keycode);
+#endif // --------------------------------------------------- // // - zn gpu interface -------------------------------- // @@ -110,10 +113,13 @@ long CALLBACK ZN_GPUopen(void * vcfg) long lret; if(!cfg) return -1; - if(cfg->Version!=1) return -1; + if(cfg->Version!=1) return -1;
+#ifdef _WINDOWS
+ lret=GPUopen((HWND)cfg->hWnd);
+#else lret = GPUopen(&cfg->hWnd, cfg->GameName, cfg->CfgFile); - +#endif /* if(!lstrcmp(cfg->GameName,"kikaioh") || @@ -248,8 +254,11 @@ void CALLBACK ZN_GPUshowScreenPic(unsigned char * pMem) // --------------------------------------------------- // -void CALLBACK ZN_GPUkeypressed(int keycode) -{ - GPUkeypressed(keycode); -} - +#ifndef _WINDOWS
+
+void CALLBACK ZN_GPUkeypressed(int keycode)
+{
+ GPUkeypressed(keycode);
+}
+
+#endif
|
