summaryrefslogtreecommitdiff
path: root/plugins/dfxvideo/gpu.c
diff options
context:
space:
mode:
authorSND\dario86_cp <SND\dario86_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-03-12 18:54:28 +0000
committerSND\dario86_cp <SND\dario86_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-03-12 18:54:28 +0000
commita58cfdac407bc1d8fedc11acd924b275ba28cc51 (patch)
treeb4c2e08c34ef1bfe0ba947ef8eed931c9a43fc0e /plugins/dfxvideo/gpu.c
parent9bdd06684bcc627c06ddcf4c406f6b48f0dfe389 (diff)
downloadpcsxr-a58cfdac407bc1d8fedc11acd924b275ba28cc51.tar.gz
Commited patch in issue #8171 (by darktjm).
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@64524 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins/dfxvideo/gpu.c')
-rw-r--r--plugins/dfxvideo/gpu.c109
1 files changed, 63 insertions, 46 deletions
diff --git a/plugins/dfxvideo/gpu.c b/plugins/dfxvideo/gpu.c
index 4aa6f230..e74331ae 100644
--- a/plugins/dfxvideo/gpu.c
+++ b/plugins/dfxvideo/gpu.c
@@ -32,16 +32,7 @@
#include "key.h"
#include "fps.h"
#include "swap.h"
-
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#include <locale.h>
-#define _(x) gettext(x)
-#define N_(x) (x)
-#else
-#define _(x) (x)
-#define N_(x) (x)
-#endif
+#include "psemu_plugin_defs.h"
#ifdef _WINDOWS
#include "resource.h"
@@ -58,14 +49,20 @@ const unsigned char build = 17; // increase that with each version
#if defined (_WINDOWS)
static char *libraryName = N_("Soft Driver");
+#if 0
static char *libraryInfo = N_("P.E.Op.S. Soft Driver V1.17\nCoded by Pete Bernert and the P.E.Op.S. team\n");
+#endif
#elif defined (_MACGL)
static char *libraryName = N_("SoftGL Driver");
+#if 0
static char *libraryInfo = N_("P.E.Op.S. SoftGL Driver V1.17\nCoded by Pete Bernert and the P.E.Op.S. team\n");
+#endif
#else
static char *libraryName = N_("XVideo Driver");
+#if 0
static char *libraryInfo = N_("P.E.Op.S. Xvideo Driver V1.17\nCoded by Pete Bernert and the P.E.Op.S. team\n");
#endif
+#endif
static char *PluginAuthor = N_("Pete Bernert and the P.E.Op.S. team");
@@ -137,7 +134,7 @@ EXECUTION_STATE WINAPI STUB_SetThreadExecutionState(EXECUTION_STATE 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)
+static BOOL LoadKernel32(void)
{
// Get a handle to the kernel32.dll (which is actually already loaded)
kernel32LibHandle = LoadLibrary("kernel32.dll");
@@ -152,7 +149,7 @@ BOOL LoadKernel32(void)
return TRUE;
}
-BOOL FreeKernel32(void)
+static BOOL FreeKernel32(void)
{
// Release the handle to kernel32.dll
if (kernel32LibHandle != NULL)
@@ -166,12 +163,12 @@ BOOL FreeKernel32(void)
#else
// Linux: Stub the functions
-BOOL LoadKernel32(void)
+static BOOL LoadKernel32(void)
{
return TRUE;
}
-BOOL FreeKernel32(void)
+static BOOL FreeKernel32(void)
{
return TRUE;
}
@@ -195,11 +192,13 @@ void CALLBACK GPUdisplayText(char * pText) // some debug func
////////////////////////////////////////////////////////////////////////
+#if 0
void CALLBACK GPUdisplayFlags(unsigned long dwFlags) // some info func
{
dwCoreFlags=dwFlags;
BuildDispMenu(0);
}
+#endif
////////////////////////////////////////////////////////////////////////
// stuff to make this a true PDK module
@@ -220,16 +219,18 @@ unsigned long CALLBACK PSEgetLibVersion(void)
return version<<16|revision<<8|build;
}
+#if 0
char * GPUgetLibInfos(void)
{
return _(libraryInfo);
}
+#endif
////////////////////////////////////////////////////////////////////////
// Snapshot func
////////////////////////////////////////////////////////////////////////
-char * pGetConfigInfos(int iCfg)
+static char * pGetConfigInfos(int iCfg)
{
char szO[2][4]={"off","on "};
char szTxt[256];
@@ -305,7 +306,12 @@ static void DoTextSnapShot(int iNum)
pB = pGetConfigInfos(0);
if (pB)
{
- fwrite(pB, strlen(pB), 1, txtfile);
+ if(fwrite(pB, strlen(pB), 1, txtfile) != 1) {
+ fclose(txtfile);
+ free(pB);
+ remove(szTxt);
+ return;
+ }
free(pB);
}
fclose(txtfile);
@@ -373,7 +379,11 @@ void CALLBACK GPUmakeSnapshot(void)
if ((bmpfile = fopen(filename,"wb")) == NULL)
return;
- fwrite(header, 0x36, 1, bmpfile);
+ if(fwrite(header, 0x36, 1, bmpfile) != 1) {
+ fclose(bmpfile);
+ remove(filename);
+ return;
+ }
for (i = height + PSXDisplay.DisplayPosition.y - 1; i >= PSXDisplay.DisplayPosition.y; i--)
{
pD = (unsigned char *)&psxVuw[i * 1024 + PSXDisplay.DisplayPosition.x];
@@ -396,10 +406,21 @@ void CALLBACK GPUmakeSnapshot(void)
pD += 2;
}
}
- fwrite(line, PreviousPSXDisplay.Range.x1 * 3, 1, bmpfile);
+ if(fwrite(line, PreviousPSXDisplay.Range.x1 * 3, 1, bmpfile) != 1) {
+ fclose(bmpfile);
+ remove(filename);
+ return;
+ }
}
- fwrite(empty, 0x2, 1, bmpfile);
+ if(fwrite(empty, 0x2, 1, bmpfile) != 1) {
fclose(bmpfile);
+ remove(filename);
+ return;
+ }
+ if(fclose(bmpfile) != 0) {
+ remove(filename);
+ return;
+ }
DoTextSnapShot(snapshotnr);
}
@@ -621,7 +642,7 @@ void updateDisplay(void) // UPDATE DISPLAY
// roughly emulated screen centering bits... not complete !!!
////////////////////////////////////////////////////////////////////////
-void ChangeDispOffsetsX(void) // X CENTER
+static void ChangeDispOffsetsX(void) // X CENTER
{
long lx,l;
@@ -681,7 +702,7 @@ void ChangeDispOffsetsX(void) // X CENTER
////////////////////////////////////////////////////////////////////////
-void ChangeDispOffsetsY(void) // Y CENTER
+static void ChangeDispOffsetsY(void) // Y CENTER
{
int iT,iO=PreviousPSXDisplay.Range.y0;
int iOldYOffset=PreviousPSXDisplay.DisplayModeNew.y;
@@ -741,7 +762,7 @@ void ChangeDispOffsetsY(void) // Y CENTER
// check if update needed
////////////////////////////////////////////////////////////////////////
-void updateDisplayIfChanged(void) // UPDATE DISPLAY IF CHANGED
+static void updateDisplayIfChanged(void) // UPDATE DISPLAY IF CHANGED
{
if ((PSXDisplay.DisplayMode.y == PSXDisplay.DisplayModeNew.y) &&
(PSXDisplay.DisplayMode.x == PSXDisplay.DisplayModeNew.x))
@@ -793,11 +814,8 @@ void ChangeWindowMode(void) // TOGGLE FULLSCREEN - WI
#include "draw.h"
-void ChangeWindowMode(void) // TOGGLE FULLSCREEN - WINDOW
+static void ChangeWindowMode(void) // TOGGLE FULLSCREEN - WINDOW
{
- extern Display *display;
- extern Window window;
- extern int root_window_id;
Screen *screen;
XSizeHints hints;
MotifWmHints mwmhints;
@@ -1240,7 +1258,7 @@ void CALLBACK GPUwriteStatus(uint32_t gdata) // WRITE STATUS
// vram read/write helpers, needed by LEWPY's optimized vram read/write :)
////////////////////////////////////////////////////////////////////////
-__inline void FinishedVRAMWrite(void)
+static __inline void FinishedVRAMWrite(void)
{
/*
// NEWX
@@ -1267,7 +1285,7 @@ __inline void FinishedVRAMWrite(void)
VRAMWrite.RowsRemaining = 0;
}
-__inline void FinishedVRAMRead(void)
+static __inline void FinishedVRAMRead(void)
{
// Set register to NORMAL operation
DataReadMode = DR_NORMAL;
@@ -1568,6 +1586,7 @@ void CALLBACK GPUwriteData(uint32_t gdata)
// this functions will be removed soon (or 'soonish')... not really needed, but some emus want them
////////////////////////////////////////////////////////////////////////
+#if 0
void CALLBACK GPUsetMode(unsigned long gdata)
{
// Peops does nothing here...
@@ -1583,6 +1602,7 @@ long CALLBACK GPUgetMode(void)
if(DataReadMode ==DR_VRAMTRANSFER) iT|=0x2;
return iT;
}
+#endif
////////////////////////////////////////////////////////////////////////
// call config dlg
@@ -1629,7 +1649,7 @@ void SetFixes(void)
unsigned long lUsedAddr[3];
-__inline BOOL CheckForEndlessLoop(unsigned long laddr)
+static __inline BOOL CheckForEndlessLoop(unsigned long laddr)
{
if(laddr==lUsedAddr[1]) return TRUE;
if(laddr==lUsedAddr[2]) return TRUE;
@@ -1720,16 +1740,6 @@ long CALLBACK GPUtest(void)
// Freeze
////////////////////////////////////////////////////////////////////////
-typedef struct GPUFREEZETAG
-{
- uint32_t ulFreezeVersion; // should be always 1 for now (set by main emu)
- uint32_t ulStatus; // current gpu status
- uint32_t ulControl[256]; // latest control register values
- unsigned char psxVRam[1024*1024*2]; // current VRam image (full 2 MB for ZN)
-} GPUFreeze_t;
-
-////////////////////////////////////////////////////////////////////////
-
long CALLBACK GPUfreeze(uint32_t ulGetFreezeData,GPUFreeze_t * pF)
{
//----------------------------------------------------//
@@ -2019,7 +2029,9 @@ unsigned char cFont[10][120]=
////////////////////////////////////////////////////////////////////////
-void PaintPicDot(unsigned char * p,unsigned char c)
+#ifdef _WINDOWS /* used by commmented out linux version as well */
+
+static void PaintPicDot(unsigned char * p,unsigned char c)
{
if(c==0) {*p++=0x00;*p++=0x00;*p=0x00;return;} // black
@@ -2027,6 +2039,7 @@ void PaintPicDot(unsigned char * p,unsigned char c)
if(c==2) {*p++=0x00;*p++=0x00;*p=0xff;return;} // red
// transparent
}
+#endif
////////////////////////////////////////////////////////////////////////
// the main emu allocs 128x96x3 bytes, and passes a ptr
@@ -2039,7 +2052,7 @@ void PaintPicDot(unsigned char * p,unsigned char c)
#ifdef _WINDOWS
-void CALLBACK GPUgetScreenPic(unsigned char * pMem)
+long CALLBACK GPUgetScreenPic(unsigned char * pMem)
{
HRESULT ddrval;DDSURFACEDESC xddsd;unsigned char * pf;
int x,y,c,v;RECT r;
@@ -2174,16 +2187,16 @@ void CALLBACK GPUgetScreenPic(unsigned char * pMem)
*(pf+(127*3))=0xff;*pf++=0xff;
pf+=127*3; // offset to next line
}
+ return 0;
}
#else
// LINUX version:
-extern char * Xpixels;
-
-void GPUgetScreenPic(unsigned char * pMem)
+long GPUgetScreenPic(unsigned char * pMem)
{
+ return -1;
/*
unsigned short c;unsigned char * pf;int x,y;
@@ -2250,6 +2263,7 @@ void GPUgetScreenPic(unsigned char * pMem)
*(pf+(127*3))=0xff;*pf++=0xff;
pf+=127*3; // offset to next line
}
+ return 0;
*/
}
@@ -2263,17 +2277,20 @@ void GPUgetScreenPic(unsigned char * pMem)
// release your picture data and stop displaying
// the screen pic
-void CALLBACK GPUshowScreenPic(unsigned char * pMem)
+long CALLBACK GPUshowScreenPic(unsigned char * pMem)
{
DestroyPic(); // destroy old pic data
- if(pMem==0) return; // done
+ if(pMem==0) return 0; // done
CreatePic(pMem); // create new pic... don't free pMem or something like that... just read from it
+ return 0;
}
+#if 0
void CALLBACK GPUsetfix(uint32_t dwFixBits)
{
dwEmuFixes=dwFixBits;
}
+#endif
void CALLBACK GPUvBlank( int val )
{