Esempio n. 1
0
void ReadConfig(void)
{
// defaults
    iResX=640;
    iResY=480;
    iWinSize=MAKELONG(iResX,iResY);
    iColDepth=16;
    iWindowMode=1;
    iUseScanLines=0;
    if (frameLimit == FRAMELIMIT_AUTO)
    {
        UseFrameLimit=1;
        iFrameLimit=2;
    }
    else
    {
        UseFrameLimit=0;
        iFrameLimit=0;
    }
    UseFrameSkip = frameSkip;
    fFrameRate=60.0f;
    dwCfgFixes=0;
    iUseFixes=0;
    iUseNoStretchBlt=1;
    iShowFPS=0;
    bSSSPSXLimit=FALSE;

// read sets
    ReadConfigFile();

// additional checks
    if(!iColDepth)       iColDepth=32;
    if(iUseFixes)        dwActFixes=dwCfgFixes;
    SetFixes();
}
Esempio n. 2
0
File: cfg.c Progetto: bsv798/pcsxr
void ReadConfig(void)
{
 // defaults
 iResX=640;iResY=480;
 iWinSize=MAKELONG(iResX,iResY);
 iColDepth=32;
 iWindowMode=1;
 iMaintainAspect=0;
 UseFrameLimit=1;
 UseFrameSkip=0;
 iFrameLimit=2;
 fFrameRate=200.0f;
 dwCfgFixes=0;
 iUseFixes=0;
 iUseNoStretchBlt=0;
 iUseDither=0;
 iShowFPS=0;

 // read sets
 ReadConfigFile();

 // additional checks
 if(!iColDepth)       iColDepth=32;
 if(iUseFixes)        dwActFixes=dwCfgFixes;
 SetFixes();
}
Esempio n. 3
0
void SetExtGLFuncs(void)
{
 //----------------------------------------------------//

 SetFixes();                                           // update fix infos

 //----------------------------------------------------//

  {
   if(bAdvancedBlend) bUseMultiPass=TRUE;              // -> pseudo-advanced with 2 passes
   else               bUseMultiPass=FALSE;             // -> or simple 'bright color' mode
//   bGLBlend=FALSE;                                     // -> no ext blending!
   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glError();
  }

 if(bOpaquePass)                                        // opaque mode?
  {
   if(dwActFixes&32) 
    {
     TCF[0]=CP8RGBA_0;
     PalTexturedColourFn=CP8RGBA;                      // -> init col func
    }
   else
    {
     TCF[0]=XP8RGBA_0;
     PalTexturedColourFn=XP8RGBA;                      // -> init col func
    }

   TCF[1]=XP8RGBA_1;
   glAlphaFuncx(GL_GREATER,0.49f); glError();

  }
 else                                                  // no opaque mode?
  {
   TCF[0]=TCF[1]=P8RGBA;
   PalTexturedColourFn=P8RGBA;                         // -> init col func
   glAlphaFuncx(GL_NOTEQUAL,0); glError();             // --> set alpha func

  }

 //----------------------------------------------------//

 LoadSubTexFn=LoadSubTexturePageSort;                  // init load tex ptr

 bBlendEnable=FALSE;                                   // init blending: off
 glDisable(GL_BLEND); glError();


 SetScanTrans();                                       // init scan lines (if wanted)
}
Esempio n. 4
0
long GPUopen(unsigned long * disp,char * CapText,char * CfgFile)
{
 unsigned long d;
 
 SetFixes();

 InitFPS();

 bDoVSyncUpdate = TRUE;

 d=ulInitDisplay();                                    // setup x

 if(disp)
	*disp=d;                                     // wanna x pointer? ok

 if(d) return 0;
 return -1;
}
Esempio n. 5
0
void SetExtGLFuncs(void)
{
 //----------------------------------------------------//

 SetFixes();                                           // update fix infos

 //----------------------------------------------------//

 if(iUseExts && !(dwActFixes&1024) &&                  // extensions wanted? and not turned off by game fix?
    strstr((char *)glGetString(GL_EXTENSIONS),         // and blend_subtract available?
    "GL_EXT_blend_subtract"))
     {                                                 // -> get ogl blend function pointer
      glBlendEquationEXTEx=(PFNGLBLENDEQU)glBlendEquationEXT; 
     }
 else                                                  // no subtract blending?
  {
   if(glBlendEquationEXTEx)                            // -> change to additive blending (if subract was active)
    glBlendEquationEXTEx(FUNC_ADD_EXT);
   glBlendEquationEXTEx=(PFNGLBLENDEQU)NULL;           // -> no more blend function pointer
  }

 //----------------------------------------------------//

 if(iUseExts && bAdvancedBlend &&                      // advanced blending wanted ?
    strstr((char *)glGetString(GL_EXTENSIONS),         // and extension avail?
           "GL_EXT_texture_env_combine"))
  {
   bUseMultiPass=FALSE;bGLBlend=TRUE;                  // -> no need for 2 passes, perfect

   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, COMBINE_EXT);    
   glTexEnvf(GL_TEXTURE_ENV, COMBINE_RGB_EXT, GL_MODULATE);     
   glTexEnvf(GL_TEXTURE_ENV, COMBINE_ALPHA_EXT, GL_MODULATE);     
   glTexEnvf(GL_TEXTURE_ENV, RGB_SCALE_EXT, 2.0f);    
  }
 else                                                  // no advanced blending wanted/available:
  {
   if(bAdvancedBlend) bUseMultiPass=TRUE;              // -> pseudo-advanced with 2 passes
   else               bUseMultiPass=FALSE;             // -> or simple 'bright color' mode
   bGLBlend=FALSE;                                     // -> no ext blending!

   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);    
  }

 //----------------------------------------------------//
 // init standard tex quality 0-2, and big alpha mode 3

 if(!(dwActFixes&0x4000) && iFilterType && iTexQuality>=3) 
      bSmallAlpha=TRUE;                  
 else bSmallAlpha=FALSE;

 if(bOpaquePass)                                        // opaque mode?
  {
   if(dwActFixes&32) 
    {
     TCF[0]=CP8RGBA_0;
     PalTexturedColourFn=CP8RGBA;                      // -> init col func
    }
   else
    {
     TCF[0]=XP8RGBA_0;
     PalTexturedColourFn=XP8RGBA;                      // -> init col func
    }

   TCF[1]=XP8RGBA_1;
   glAlphaFunc(GL_GREATER,0.49f);
  }
 else                                                  // no opaque mode?
  {
   TCF[0]=TCF[1]=P8RGBA;
   PalTexturedColourFn=P8RGBA;                         // -> init col func
   glAlphaFunc(GL_NOTEQUAL,0);                         // --> set alpha func
  }

 //----------------------------------------------------//

 LoadSubTexFn=LoadSubTexturePageSort;                  // init load tex ptr

 giWantedFMT=GL_RGBA;                                  // init ogl tex format

 switch(iTexQuality)                                   // -> quality:
  {
   //--------------------------------------------------// 
   case 0:                                             // -> don't care
    giWantedRGBA=4;
    giWantedTYPE=GL_UNSIGNED_BYTE;
    break;
   //--------------------------------------------------// 
   case 1:                                             // -> R4G4B4A4
    if(bGLExt)
     {
      giWantedRGBA=GL_RGBA4;
      giWantedTYPE=GL_UNSIGNED_SHORT_4_4_4_4_EXT;
      LoadSubTexFn=LoadPackedSubTexturePageSort;
      if(bOpaquePass) 
       {
        if(dwActFixes&32) PTCF[0]=CP4RGBA_0;
        else              PTCF[0]=XP4RGBA_0;
        PTCF[1]=XP4RGBA_1;
       }
      else      
       {
        PTCF[0]=PTCF[1]=P4RGBA;
       }
     }
    else
     {
      giWantedRGBA=GL_RGBA4;
      giWantedTYPE=GL_UNSIGNED_BYTE;
     }
    break;
   //--------------------------------------------------// 
   case 2:                                             // -> R5B5G5A1
    if(bGLExt)
     {
      giWantedRGBA=GL_RGB5_A1;
      giWantedTYPE=GL_UNSIGNED_SHORT_5_5_5_1_EXT;
      LoadSubTexFn=LoadPackedSubTexturePageSort;
      if(bOpaquePass) 
       {
        if(dwActFixes&32) PTCF[0]=CP5RGBA_0;
        else              PTCF[0]=XP5RGBA_0;
        PTCF[1]=XP5RGBA_1;
       }
      else   
       {
        PTCF[0]=PTCF[1]=P5RGBA;
       }
     }
    else
     {
      giWantedRGBA=GL_RGB5_A1;giWantedTYPE=GL_UNSIGNED_BYTE;
     }
    break;
   //--------------------------------------------------// 
   case 3:                                             // -> R8G8B8A8
    giWantedRGBA=GL_RGBA8;
    giWantedTYPE=GL_UNSIGNED_BYTE;

    if(bSmallAlpha)
     {
      if(bOpaquePass)                                  // opaque mode?
       {
        if(dwActFixes&32) {TCF[0]=CP8RGBAEx_0;PalTexturedColourFn=CP8RGBAEx;}
        else              {TCF[0]=XP8RGBAEx_0;PalTexturedColourFn=XP8RGBAEx;}
        TCF[1]=XP8RGBAEx_1;
       }
     }

    break;
   //--------------------------------------------------// 
   case 4:                                             // -> R8G8B8A8
    giWantedRGBA = GL_RGBA8;
    giWantedTYPE = GL_UNSIGNED_BYTE;

    if(strstr((char *)glGetString(GL_EXTENSIONS),      // and extension avail?
              "GL_EXT_bgra"))
     {
      giWantedFMT  = GL_BGRA_EXT;

      if(bOpaquePass)                                  // opaque mode?
       {
        if(bSmallAlpha)
         {
          if(dwActFixes&32) {TCF[0]=CP8BGRAEx_0;PalTexturedColourFn=CP8RGBAEx;}
          else              {TCF[0]=XP8BGRAEx_0;PalTexturedColourFn=XP8RGBAEx;}
          TCF[1]=XP8BGRAEx_1;
         }
        else
         {
          if(dwActFixes&32) {TCF[0]=CP8BGRA_0;PalTexturedColourFn=CP8RGBA;}
          else              {TCF[0]=XP8BGRA_0;PalTexturedColourFn=XP8RGBA;}
          TCF[1]=XP8BGRA_1;
         }
       }
      else                                             // no opaque mode?
       {
        TCF[0]=TCF[1]=P8BGRA;                          // -> init col func
       }
     }
    else
     {
      iTexQuality=3;
      if(bSmallAlpha)
       {
        if(bOpaquePass)                                 // opaque mode?
         {
          if(dwActFixes&32) {TCF[0]=CP8RGBAEx_0;PalTexturedColourFn=CP8RGBAEx;}
          else              {TCF[0]=XP8RGBAEx_0;PalTexturedColourFn=XP8RGBAEx;}
          TCF[1]=XP8RGBAEx_1;
         }
       }
     }

    break;
   //--------------------------------------------------// 
  }

 bBlendEnable=FALSE;                                   // init blending: off
 glDisable(GL_BLEND);

 SetScanTrans();                                       // init scan lines (if wanted)
}
Esempio n. 6
0
void ReadConfig(void)
{
 HKEY myKey;
 DWORD temp;
 DWORD type;               
 DWORD size;

 // predefines
 iResX=640;iResY=480;
 iColDepth=16;
 iWindowMode=0;
 UseFrameLimit=1;
 UseFrameSkip=0;
 iFrameLimit=2;
 fFrameRate=200.0f;
 iWinSize=MAKELONG(640,480);
 dwCfgFixes=0;
 iUseFixes=0;
 iUseGammaVal=2048;
 iUseScanLines=0;
 iUseNoStretchBlt=0;
 iUseDither=0;
 iShowFPS=0;
 iSysMemory=0;
 iStopSaver=1;
 bVsync=FALSE;
 bTransparent=FALSE;
 iRefreshRate=0;
 iDebugMode=0;
 lstrcpy(szGPUKeys,szKeyDefaults);

 memset(szDevName,0,128);
 memset(&guiDev,0,sizeof(GUID));

 // standard Windows psx config (registry)
 if(RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Vision Thing\\PSEmu Pro\\GPU\\DFXVideo",0,KEY_ALL_ACCESS,&myKey)==ERROR_SUCCESS)
  {
   size = 4;
   if(RegQueryValueEx(myKey,"ResX",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iResX=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"ResY",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iResY=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"RefreshRate",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iRefreshRate=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"WinSize",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iWinSize=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"WindowMode",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iWindowMode=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"ColDepth",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iColDepth=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"UseFrameLimit",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    UseFrameLimit=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"UseFrameSkip",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    UseFrameSkip=(int)temp;
   size = 4;                     
   if(RegQueryValueEx(myKey,"FrameLimit",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iFrameLimit=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"CfgFixes",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    dwCfgFixes=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"UseFixes",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iUseFixes=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"UseScanLines",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iUseScanLines=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"ShowFPS",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iShowFPS=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"UseNoStrechBlt",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iUseNoStretchBlt=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"UseDither",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iUseDither=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"UseGamma",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iUseGammaVal=(int)temp;
   if(!iFrameLimit) {UseFrameLimit=0;UseFrameSkip=0;iFrameLimit=2;}

   // try to get the float framerate... if none: take int framerate
   fFrameRate=0.0f;
   size = 4;
   if(RegQueryValueEx(myKey,"FrameRateFloat",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    fFrameRate=*((float *)(&temp));
   if(fFrameRate==0.0f)
    {
     fFrameRate=200.0f;
     size = 4;
     if(RegQueryValueEx(myKey,"FrameRate",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
      fFrameRate=(float)temp;
    }

   size = 4;
   if(RegQueryValueEx(myKey,"UseSysMemory",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iSysMemory=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"StopSaver",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iStopSaver=(int)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"WaitVSYNC",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    bVsync=bVsync_Key=(BOOL)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"Transparent",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    bTransparent=(BOOL)temp;
   size = 4;
   if(RegQueryValueEx(myKey,"DebugMode",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
    iDebugMode=(BOOL)temp;
   size=11;
   RegQueryValueEx(myKey,"GPUKeys",0,&type,(LPBYTE)&szGPUKeys,&size);
   size=128;
   RegQueryValueEx(myKey,"DeviceName",0,&type,(LPBYTE)szDevName,&size);
   size=sizeof(GUID);
   RegQueryValueEx(myKey,"GuiDev",0,&type,(LPBYTE)&guiDev,&size);

//
// Recording options
//
#define GetDWORD(xa,xb) size=4;if(RegQueryValueEx(myKey,xa,0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) xb=(unsigned long)temp;
#define GetBINARY(xa,xb) size=sizeof(xb);RegQueryValueEx(myKey,xa,0,&type,(LPBYTE)&xb,&size);
	
   GetDWORD("RecordingMode",				    RECORD_RECORDING_MODE);
   GetDWORD("RecordingVideoSize",			    RECORD_VIDEO_SIZE);
   GetDWORD("RecordingWidth",				    RECORD_RECORDING_WIDTH);
   GetDWORD("RecordingHeight",				RECORD_RECORDING_HEIGHT);
   GetDWORD("RecordingFrameRateScale",		RECORD_FRAME_RATE_SCALE);
   GetDWORD("RecordingCompressionMode",	    RECORD_COMPRESSION_MODE);
   GetBINARY("RecordingCompression1",		    RECORD_COMPRESSION1);
   GetBINARY("RecordingCompressionState1",	RECORD_COMPRESSION_STATE1);
   GetBINARY("RecordingCompression2",		    RECORD_COMPRESSION2);
   GetBINARY("RecordingCompressionState2",	RECORD_COMPRESSION_STATE2);

   if(RECORD_RECORDING_WIDTH>1024) RECORD_RECORDING_WIDTH = 1024;
   if(RECORD_RECORDING_HEIGHT>768) RECORD_RECORDING_HEIGHT = 768;
   if(RECORD_VIDEO_SIZE>2) RECORD_VIDEO_SIZE = 2;
   if(RECORD_FRAME_RATE_SCALE>7) RECORD_FRAME_RATE_SCALE = 7;
   if(RECORD_COMPRESSION1.cbSize != sizeof(RECORD_COMPRESSION1))
    {
     memset(&RECORD_COMPRESSION1,0,sizeof(RECORD_COMPRESSION1));
     RECORD_COMPRESSION1.cbSize = sizeof(RECORD_COMPRESSION1);
    }
   RECORD_COMPRESSION1.lpState = RECORD_COMPRESSION_STATE1;
   if(RECORD_COMPRESSION2.cbSize != sizeof(RECORD_COMPRESSION2))
    {
     memset(&RECORD_COMPRESSION2,0,sizeof(RECORD_COMPRESSION2));
     RECORD_COMPRESSION2.cbSize = sizeof(RECORD_COMPRESSION2);
    }
   RECORD_COMPRESSION2.lpState = RECORD_COMPRESSION_STATE2;

//
// end of recording options
//

   RegCloseKey(myKey);
  }

 if(!iColDepth) iColDepth=32;
 if(iUseFixes) dwActFixes=dwCfgFixes;
 SetFixes();

 if(iUseGammaVal<0 || iUseGammaVal>1536) iUseGammaVal=2048;
}
Esempio n. 7
0
void SwitchDispMenu(int iStep)                         // SWITCH DISP MENU
{
	if (!(ulKeybits&KEY_SHOWFPS)) return;                 // tststs

	switch (iMPos)
	{//////////////////////////////////////////////////////
	case 0:                                             // frame limit
	{
		int iType=0;
		bInitCap = TRUE;

#ifdef _WINDOWS
		if (iFrameLimit==1 && UseFrameLimit &&
		    GetAsyncKeyState(VK_SHIFT)&32768)
		{
			fFrameRate+=iStep;
			if (fFrameRate<1.0f) fFrameRate=1.0f;
			SetAutoFrameCap();
			break;
		}
#endif

		if (UseFrameLimit) iType=iFrameLimit;
		iType+=iStep;
		if (iType<0) iType=2;
		if (iType>2) iType=0;
		if (iType==0) UseFrameLimit=0;
		else
		{
			UseFrameLimit=1;
			iFrameLimit=iType;
			SetAutoFrameCap();
		}
	}
	break;
	//////////////////////////////////////////////////////
	case 1:                                             // frame skip
		bInitCap = TRUE;
		if (iStep>0)
		{
			if (!UseFrameSkip)
			{
				UseFrameSkip=1;
				iFastFwd = 0;
			}
			else
			{
				if (!iFastFwd) iFastFwd=1;
				else
				{
					UseFrameSkip=0;
					iFastFwd = 0;
				}
			}
		}
		else
		{
			if (!UseFrameSkip)
			{
				UseFrameSkip=1;
				iFastFwd = 1;
			}
			else
			{
				if (iFastFwd) iFastFwd=0;
				else
				{
					UseFrameSkip=0;
					iFastFwd = 0;
				}
			}
		}
		bSkipNextFrame=FALSE;
		break;
		//////////////////////////////////////////////////////
	case 2:                                             // dithering
		iUseDither+=iStep;
		if (iUseDither<0) iUseDither=2;
		if (iUseDither>2) iUseDither=0;
		break;
		//////////////////////////////////////////////////////
	case 3:                                             // special fixes
		if (iUseFixes)
		{
			iUseFixes=0;
			dwActFixes=0;
		}
		else
		{
			iUseFixes=1;
			dwActFixes=dwCfgFixes;
		}
		SetFixes();
		if (iFrameLimit==2) SetAutoFrameCap();
		break;
	}

	BuildDispMenu(0);                                     // update info
}