summaryrefslogtreecommitdiff
path: root/plugins/dfxvideo/gpu.c
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-08-13 01:32:56 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-08-13 01:32:56 +0000
commitc6191a4474b4cab60cc9886860c8b6de7c4e146b (patch)
tree7b450e4d69ec922805cf2448af9cc53286f17d73 /plugins/dfxvideo/gpu.c
parent7d0cd28dd85965b4f94c8eeb5aa2c70297122485 (diff)
downloadpcsxr-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/dfxvideo/gpu.c')
-rw-r--r--plugins/dfxvideo/gpu.c581
1 files changed, 450 insertions, 131 deletions
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.