[Glide64] Move Some of the screen res code in to ScreenResolution.cpp

This commit is contained in:
zilmar 2017-01-28 22:29:03 +11:00
parent 734ea5c659
commit 03da86382d
15 changed files with 517 additions and 586 deletions

View File

@ -411,9 +411,6 @@ public:
m_spinVRAM.GetWindowText(spinVRAM, sizeof(spinVRAM));
CSettings oldsettings = *g_settings;
g_settings->res_data = m_WindowRes.GetCurSel();
g_settings->res_data_org = g_settings->res_data;
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED;
g_settings->ssformat = m_cmbScreenShotFormat.GetCurSel();
g_settings->texenh_options = m_cbxTextureSettings.GetCheck() == BST_CHECKED;
@ -877,7 +874,7 @@ void CALL DllConfig(HWND hParent)
if (g_romopen)
{
if (evoodoo)// && fullscreen && !ev_fullscreen)
if (evoodoo)// && g_fullscreen && !ev_fullscreen)
{
ReleaseGfx();
rdp_reset();

View File

@ -142,7 +142,6 @@ extern "C" {
#define DMASK 0x1FFFFF
extern uint32_t update_screen_count;
extern uint32_t resolutions[0x18][2];
int CheckKeyPressed(int key, int mask);

View File

@ -48,6 +48,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Gfx_1.3.h" />
<ClInclude Include="ScreenResolution.h" />
<ClInclude Include="Settings.h" />
<ClInclude Include="SettingsID.h" />
<ClInclude Include="trace.h" />
@ -96,6 +97,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="CRC.cpp" />
<ClCompile Include="ScreenResolution.cpp" />
<ClCompile Include="Settings.cpp" />
<ClCompile Include="TexCache.cpp" />
<ClCompile Include="Config.cpp" />

View File

@ -130,6 +130,7 @@
<ClInclude Include="trace.h" />
<ClInclude Include="Settings.h" />
<ClInclude Include="SettingsID.h" />
<ClInclude Include="ScreenResolution.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="CRC.cpp">
@ -153,6 +154,7 @@
<ClCompile Include="Util.cpp" />
<ClCompile Include="trace.cpp" />
<ClCompile Include="Settings.cpp" />
<ClCompile Include="ScreenResolution.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="gpl.txt">

View File

@ -44,22 +44,18 @@ typedef FxU32 GrCombineMode_t;
#define GR_TEXTURE_UMA_EXT 0x06
//wrapper specific
FX_ENTRY void FX_CALL grConfigWrapperExt(
#ifndef ANDROID
FxI32, /* resolution parameter not supported on Android */
#endif
void grConfigWrapperExt(
FxI32,
FxBool,
FxBool
);
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*);
FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*);
uint32_t grWrapperFullScreenResolutionExt(uint32_t *, uint32_t *);
char ** grQueryResolutionsExt(int32_t*);
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);
FX_ENTRY GrContext_t FX_CALL grSstWinOpenExt(
#ifndef ANDROID
HWND hWnd,
GrScreenResolution_t screen_resolution,
#endif
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,

View File

@ -59,6 +59,7 @@
#include "FBtoScreen.h"
#include "DepthBufferRender.h"
#include "trace.h"
#include "ScreenResolution.h"
#include <stdarg.h>
int ghq_dmptex_toggle_key = 0;
@ -75,6 +76,7 @@ int evoodoo = 0;
int ev_fullscreen = 0;
#ifdef _WIN32
#include <commctrl.h>
HINSTANCE hinstDLL = NULL;
#endif
@ -85,36 +87,6 @@ int64 perf_next;
uint32_t region = 0;
// Resolutions, MUST be in the correct order (SST1VID.H)
uint32_t resolutions[0x18][2] = {
{ 320, 200 },
{ 320, 240 },
{ 400, 256 },
{ 512, 384 },
{ 640, 200 },
{ 640, 350 },
{ 640, 400 },
{ 640, 480 },
{ 800, 600 },
{ 960, 720 },
{ 856, 480 },
{ 512, 256 },
{ 1024, 768 },
{ 1280, 1024 },
{ 1600, 1200 },
{ 400, 300 },
// 0x10
{ 1152, 864 },
{ 1280, 960 },
{ 1600, 1024 },
{ 1792, 1344 },
{ 1856, 1392 },
{ 1920, 1440 },
{ 2048, 1536 },
{ 2048, 2048 }
};
// ref rate
// 60=0x0, 70=0x1, 72=0x2, 75=0x3, 80=0x4, 90=0x5, 100=0x6, 85=0x7, 120=0x8, none=0xff
@ -123,6 +95,7 @@ unsigned int BMASK = 0x7FFFFF;
RDP rdp;
CSettings * g_settings = NULL;
extern int viewport_offset;
VOODOO voodoo = { 0, 0, 0, 0,
0, 0, 0, 0,
@ -139,6 +112,14 @@ uint32_t offset_texbuf1 = 0;
int capture_screen = 0;
std::string capture_path;
#ifdef _WIN32
HWND g_hwnd_win = NULL;
static RECT g_windowedRect = { 0 };
static HMENU g_windowedMenu = 0;
static unsigned long g_windowedExStyle, g_windowedStyle;
bool g_fullscreen;
#endif // _WIN32
void _ChangeSize()
{
rdp.scale_1024 = g_settings->scr_res_x / 1024.0f;
@ -215,19 +196,11 @@ void ChangeSize()
rdp.offset_x = (g_settings->scr_res_x - rdp.vi_width) / 2.0f;
rdp.offset_y = (g_settings->scr_res_y - rdp.vi_height) / 2.0f;
}
// g_settings->res_x = g_settings->scr_res_x;
// g_settings->res_y = g_settings->scr_res_y;
}
void ConfigWrapper()
{
grConfigWrapperExt(
#ifdef ANDROID
g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic
#else
g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic
#endif
);
grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
}
void UseUnregisteredSetting(int /*SettingID*/)
@ -403,6 +376,233 @@ void DisplayLoadProgress(const wchar_t *format, ...)
grBufferClear(0, 0, 0xFFFF);
}
#ifdef _WIN32
void SetWindowDisplaySize(HWND hWnd)
{
if ((HWND)hWnd == NULL) hWnd = GetActiveWindow();
g_hwnd_win = (HWND)hWnd;
// Resolutions, MUST be in the correct order (SST1VID.H)
uint32_t resolutions[0x18][2] = {
{ 320, 200 },
{ 320, 240 },
{ 400, 256 },
{ 512, 384 },
{ 640, 200 },
{ 640, 350 },
{ 640, 400 },
{ 640, 480 },
{ 800, 600 },
{ 960, 720 },
{ 856, 480 },
{ 512, 256 },
{ 1024, 768 },
{ 1280, 1024 },
{ 1600, 1200 },
{ 400, 300 },
// 0x10
{ 1152, 864 },
{ 1280, 960 },
{ 1600, 1024 },
{ 1792, 1344 },
{ 1856, 1392 },
{ 1920, 1440 },
{ 2048, 1536 },
{ 2048, 2048 }
};
#ifndef ANDROID
uint32_t screen_resolution = g_settings->res_data;
if (ev_fullscreen)
{
uint32_t _width, _height = 0;
screen_resolution = grWrapperFullScreenResolutionExt(&_width, &_height);
g_settings->scr_res_x = g_settings->res_x = _width;
g_settings->scr_res_y = g_settings->res_y = _height;
}
else if (evoodoo)
{
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
screen_resolution |= 0x80000000;
}
#endif
if ((HWND)hWnd == NULL) hWnd = GetActiveWindow();
g_width = g_height = 0;
if (screen_resolution & 0x80000000)
{
switch (screen_resolution & ~0x80000000)
{
case GR_RESOLUTION_320x200:
g_width = 320;
g_height = 200;
break;
case GR_RESOLUTION_320x240:
g_width = 320;
g_height = 240;
break;
case GR_RESOLUTION_400x256:
g_width = 400;
g_height = 256;
break;
case GR_RESOLUTION_512x384:
g_width = 512;
g_height = 384;
break;
case GR_RESOLUTION_640x200:
g_width = 640;
g_height = 200;
break;
case GR_RESOLUTION_640x350:
g_width = 640;
g_height = 350;
break;
case GR_RESOLUTION_640x400:
g_width = 640;
g_height = 400;
break;
case GR_RESOLUTION_640x480:
g_width = 640;
g_height = 480;
break;
case GR_RESOLUTION_800x600:
g_width = 800;
g_height = 600;
break;
case GR_RESOLUTION_960x720:
g_width = 960;
g_height = 720;
break;
case GR_RESOLUTION_856x480:
g_width = 856;
g_height = 480;
break;
case GR_RESOLUTION_512x256:
g_width = 512;
g_height = 256;
break;
case GR_RESOLUTION_1024x768:
g_width = 1024;
g_height = 768;
break;
case GR_RESOLUTION_1280x1024:
g_width = 1280;
g_height = 1024;
break;
case GR_RESOLUTION_1600x1200:
g_width = 1600;
g_height = 1200;
break;
case GR_RESOLUTION_400x300:
g_width = 400;
g_height = 300;
break;
case GR_RESOLUTION_1152x864:
g_width = 1152;
g_height = 864;
break;
case GR_RESOLUTION_1280x960:
g_width = 1280;
g_height = 960;
break;
case GR_RESOLUTION_1600x1024:
g_width = 1600;
g_height = 1024;
break;
case GR_RESOLUTION_1792x1344:
g_width = 1792;
g_height = 1344;
break;
case GR_RESOLUTION_1856x1392:
g_width = 1856;
g_height = 1392;
break;
case GR_RESOLUTION_1920x1440:
g_width = 1920;
g_height = 1440;
break;
case GR_RESOLUTION_2048x1536:
g_width = 2048;
g_height = 1536;
break;
case GR_RESOLUTION_2048x2048:
g_width = 2048;
g_height = 2048;
break;
default:
WriteTrace(TraceGlitch, TraceWarning, "unknown SstWinOpen resolution : %x", screen_resolution);
}
}
if (screen_resolution & 0x80000000)
{
RECT clientRect, toolbarRect, statusbarRect;
ZeroMemory(&g_windowedRect, sizeof(RECT));
ZeroMemory(&clientRect, sizeof(RECT));
ZeroMemory(&toolbarRect, sizeof(RECT));
ZeroMemory(&statusbarRect, sizeof(RECT));
HWND hToolBar = FindWindowEx(hWnd, NULL, REBARCLASSNAME, NULL);
HWND hStatusBar = FindWindowEx(hWnd, NULL, STATUSCLASSNAME, NULL);
if (hStatusBar == NULL) hStatusBar = FindWindowEx(hWnd, NULL, "msctls_statusbar32", NULL); // 1964
if (hToolBar != NULL) GetWindowRect(hToolBar, &toolbarRect);
if (hStatusBar != NULL) GetWindowRect(hStatusBar, &statusbarRect);
viewport_offset = statusbarRect.bottom - statusbarRect.top;
GetWindowRect(hWnd, &g_windowedRect);
GetClientRect(hWnd, &clientRect);
g_windowedRect.right += (g_width - (clientRect.right - clientRect.left));
g_windowedRect.bottom += (g_height + (toolbarRect.bottom - toolbarRect.top) + (statusbarRect.bottom - statusbarRect.top) - (clientRect.bottom - clientRect.top));
SetWindowPos(hWnd, NULL, 0, 0, g_windowedRect.right - g_windowedRect.left,
g_windowedRect.bottom - g_windowedRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
g_fullscreen = false;
}
else
{
g_width = GetFullScreenResWidth(screen_resolution);
g_height = GetFullScreenResHeight(screen_resolution);
ZeroMemory(&g_windowedRect, sizeof(RECT));
GetWindowRect(hWnd, &g_windowedRect);
g_windowedExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
g_windowedStyle = GetWindowLong(hWnd, GWL_STYLE);
// primary monitor only
if (!EnterFullScreen(screen_resolution))
{
WriteTrace(TraceGlitch, TraceWarning, "can't change to fullscreen mode");
}
g_windowedMenu = GetMenu(hWnd);
if (g_windowedMenu) SetMenu(hWnd, NULL);
HWND hStatusBar = FindWindowEx(hWnd, NULL, "msctls_statusbar32", NULL); // 1964
if (hStatusBar) ShowWindow(hStatusBar, SW_HIDE);
SetWindowLong(hWnd, GWL_STYLE, 0);
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST);
SetWindowPos(hWnd, NULL, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
viewport_offset = 0;
g_fullscreen = true;
}
}
void ExitFullScreen(void)
{
if (g_fullscreen)
{
ChangeDisplaySettings(NULL, 0);
SetWindowPos(g_hwnd_win, NULL, g_windowedRect.left, g_windowedRect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
SetWindowLong(g_hwnd_win, GWL_STYLE, g_windowedStyle);
SetWindowLong(g_hwnd_win, GWL_EXSTYLE, g_windowedExStyle);
if (g_windowedMenu) SetMenu(g_hwnd_win, g_windowedMenu);
g_fullscreen = false;
}
}
#endif
int InitGfx()
{
if (GfxInitDone)
@ -466,24 +666,8 @@ int InitGfx()
//*/
#ifndef ANDROID
uint32_t res_data = g_settings->res_data;
if (ev_fullscreen)
{
uint32_t _width, _height = 0;
g_settings->res_data = grWrapperFullScreenResolutionExt((FxU32*)&_width, (FxU32*)&_height);
g_settings->scr_res_x = g_settings->res_x = _width;
g_settings->scr_res_y = g_settings->res_y = _height;
res_data = g_settings->res_data;
}
else if (evoodoo)
{
g_settings->res_data = g_settings->res_data_org;
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
res_data = g_settings->res_data | 0x80000000;
}
gfx_context = grSstWinOpen(gfx.hWnd, res_data, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
SetWindowDisplaySize(gfx.hWnd);
gfx_context = grSstWinOpen(gfx.hWnd, GR_REFRESH_60Hz, GR_COLORFORMAT_RGBA, GR_ORIGIN_UPPER_LEFT, 2, 1);
if (!gfx_context)
{
#ifdef _WIN32
@ -503,15 +687,6 @@ int InitGfx()
GfxInitDone = TRUE;
to_fullscreen = FALSE;
#ifdef __WINDOWS__
if (ev_fullscreen)
{
if (gfx.hStatusBar)
ShowWindow(gfx.hStatusBar, SW_HIDE);
ShowCursor(FALSE);
}
#endif
// get the # of TMUs available
grGet(GR_NUM_TMU, 4, (FxI32*)&voodoo.num_tmu);
// get maximal texture size
@ -825,24 +1000,11 @@ EXPORT void CALL ChangeWindow(void)
{
to_fullscreen = TRUE;
ev_fullscreen = TRUE;
#ifdef __WINDOWS__
if (gfx.hStatusBar)
ShowWindow(gfx.hStatusBar, SW_HIDE);
ShowCursor(FALSE);
#endif
}
else
{
ev_fullscreen = FALSE;
InitGfx();
#ifdef __WINDOWS__
ShowCursor(TRUE);
if (gfx.hStatusBar)
{
ShowWindow(gfx.hStatusBar, SW_SHOW);
}
SetWindowLongPtr(gfx.hWnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
#endif
}
}
else
@ -853,24 +1015,10 @@ EXPORT void CALL ChangeWindow(void)
if (!GfxInitDone)
{
to_fullscreen = TRUE;
#ifdef __WINDOWS__
if (gfx.hStatusBar)
ShowWindow(gfx.hStatusBar, SW_HIDE);
ShowCursor(FALSE);
#endif
}
else
{
ReleaseGfx();
#ifdef __WINDOWS__
ShowCursor(TRUE);
if (gfx.hStatusBar)
ShowWindow(gfx.hStatusBar, SW_SHOW);
// SetWindowLong fixes the following Windows XP Banshee issues:
// 1964 crash error when loading another rom.
// All N64 emu's minimize, restore crashes.
SetWindowLongPtr(gfx.hWnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
#endif
}
}
}
@ -987,9 +1135,6 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
g_settings->ReadGameSettings(name);
ZLUT_init();
ConfigWrapper();
#ifndef ANDROID
g_settings->res_data_org = g_settings->res_data;
#endif
gfx = Gfx_Info;
@ -1000,14 +1145,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
CountCombine();
ZLUT_init();
grConfigWrapperExt(
#ifdef ANDROID
g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic
#else
g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic
#endif
);
grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic);
grGlideInit();
const char *extensions = grGetString(GR_EXTENSION);
grGlideShutdown();

View File

@ -0,0 +1,231 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#include "ScreenResolution.h"
#include "settings.h"
#include "trace.h"
struct ResolutionInfo
{
unsigned int dwW, dwH, dwF;
ResolutionInfo() : dwW(0), dwH(0), dwF(0) {}
ResolutionInfo(unsigned int _w, unsigned int _h, unsigned int _f) : dwW(_w), dwH(_h), dwF(_f) {}
bool operator == (const ResolutionInfo & _other) const
{
if (dwW != _other.dwW)
return false;
if (dwH != _other.dwH)
return false;
if (dwF != _other.dwF)
return false;
return true;
}
bool operator != (const ResolutionInfo & _other) const
{
return !(operator==(_other));
}
void toString(char * _str) const
{
if (dwF > 0)
sprintf(_str, "%ix%i 32bpp %iHz", dwW, dwH, dwF);
else
sprintf(_str, "%ix%i 32bpp", dwW, dwH);
}
};
class FullScreenResolutions
{
public:
FullScreenResolutions() : dwNumResolutions(0), aResolutions(0), aResolutionsStr(0) {}
~FullScreenResolutions();
void getResolution(uint32_t _idx, uint32_t * _width, uint32_t * _height, uint32_t * _frequency = 0)
{
WriteTrace(TraceResolution, TraceDebug, "_idx: %d", _idx);
if (dwNumResolutions == 0)
{
init();
}
if (_idx >= dwNumResolutions)
{
WriteTrace(TraceGlitch, TraceError, "NumResolutions = %d", dwNumResolutions);
_idx = 0;
}
*_width = (uint32_t)aResolutions[_idx].dwW;
*_height = (uint32_t)aResolutions[_idx].dwH;
if (_frequency != 0)
{
*_frequency = (uint32_t)aResolutions[_idx].dwF;
}
}
int getCurrentResolutions(void)
{
if (dwNumResolutions == 0)
{
init();
}
return currentResolutions;
}
char ** getResolutionsList(int32_t * Size)
{
if (dwNumResolutions == 0)
{
init();
}
*Size = (int32_t)dwNumResolutions;
return aResolutionsStr;
}
bool changeDisplaySettings(uint32_t _resolution);
private:
void init();
unsigned int dwNumResolutions;
ResolutionInfo * aResolutions;
char ** aResolutionsStr;
int currentResolutions;
};
FullScreenResolutions::~FullScreenResolutions()
{
for (unsigned int i = 0; i < dwNumResolutions; i++)
{
delete[] aResolutionsStr[i];
aResolutionsStr[i] = NULL;
}
if (aResolutionsStr)
{
delete[] aResolutionsStr;
aResolutionsStr = NULL;
}
if (aResolutions)
{
delete[] aResolutions;
aResolutions = NULL;
}
}
void FullScreenResolutions::init()
{
#ifdef _WIN32
currentResolutions = -1;
DEVMODE enumMode, currentMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &currentMode);
ResolutionInfo prevInfo;
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
dwNumResolutions++;
prevInfo = curInfo;
}
}
aResolutions = new ResolutionInfo[dwNumResolutions];
aResolutionsStr = new char*[dwNumResolutions];
iModeNum = 0;
int current = 0;
char smode[256];
memset(&enumMode, 0, sizeof(DEVMODE));
memset(&prevInfo, 0, sizeof(ResolutionInfo));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
if (enumMode.dmPelsHeight == currentMode.dmPelsHeight && enumMode.dmPelsWidth == currentMode.dmPelsWidth)
{
currentResolutions = current;
}
aResolutions[current] = curInfo;
curInfo.toString(smode);
aResolutionsStr[current] = new char[strlen(smode) + 1];
strcpy(aResolutionsStr[current], smode);
prevInfo = curInfo;
current++;
}
}
#endif
}
bool FullScreenResolutions::changeDisplaySettings(uint32_t _resolution)
{
#ifdef _WIN32
uint32_t width, height, frequency;
getResolution(_resolution, &width, &height, &frequency);
ResolutionInfo info(width, height, frequency);
DEVMODE enumMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo == info) {
bool bRes = ChangeDisplaySettings(&enumMode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL;
WriteTrace(TraceGlitch, TraceDebug, "width=%d, height=%d, freq=%d %s\r\n", enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency, bRes ? "Success" : "Failed");
return bRes;
}
}
return false;
#else // _WIN32
return false;
#endif // _WIN32
}
FullScreenResolutions g_FullScreenResolutions;
uint32_t GetFullScreenResWidth(uint32_t index)
{
uint32_t _width, _height;
g_FullScreenResolutions.getResolution(index, &_width, &_height);
return _width;
}
uint32_t GetFullScreenResHeight(uint32_t index)
{
uint32_t _width, _height;
g_FullScreenResolutions.getResolution(index, &_width, &_height);
return _height;
}
bool EnterFullScreen(uint32_t index)
{
return g_FullScreenResolutions.changeDisplaySettings(index);
}
int GetCurrentResIndex(void)
{
return g_FullScreenResolutions.getCurrentResolutions();
}
char ** grQueryResolutionsExt(int32_t * Size)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return g_FullScreenResolutions.getResolutionsList(Size);
}
uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
g_FullScreenResolutions.getResolution(g_settings->wrpResolution, width, height);
return g_settings->wrpResolution;
}

View File

@ -0,0 +1,16 @@
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#include <Common/stdtypes.h>
uint32_t GetFullScreenResWidth(uint32_t index);
uint32_t GetFullScreenResHeight(uint32_t index);
bool EnterFullScreen(uint32_t index);

View File

@ -15,7 +15,6 @@ res_y(480),
scr_res_y(480),
#ifndef ANDROID
res_data(GR_RESOLUTION_640x480),
res_data_org(GR_RESOLUTION_640x480),
#endif
advanced_options(0),
texenh_options(0),
@ -278,8 +277,6 @@ void CSettings::ReadSettings()
#else
this->res_data = (uint32_t)GetSetting(Set_Resolution);
if (this->res_data >= 24) this->res_data = 12;
this->scr_res_x = this->res_x = resolutions[this->res_data][0];
this->scr_res_y = this->res_y = resolutions[this->res_data][1];
this->wrpResolution = GetSetting(Set_wrpResolution);
#endif
this->vsync = GetSetting(Set_vsync);
@ -457,8 +454,6 @@ void CSettings::ReadGameSettings(const char * name)
#ifdef _WIN32
g_settings->res_data = GetSetting(Set_Resolution);
if (g_settings->res_data < 0 || g_settings->res_data >= 0x18) g_settings->res_data = 12;
g_settings->scr_res_x = g_settings->res_x = resolutions[g_settings->res_data][0];
g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1];
#endif
//frame buffer

View File

@ -1,4 +1,5 @@
#pragma once
#include <string>
class CSettings
{
@ -27,7 +28,7 @@ public:
uint32_t res_x, scr_res_x;
uint32_t res_y, scr_res_y;
#ifndef ANDROID
uint32_t res_data, res_data_org;
uint32_t res_data;
#endif
int advanced_options;

View File

@ -547,11 +547,6 @@ void GoToFullScreen()
WriteTrace(TraceGlide64, TraceError, "tInitGfx failed");
return;
}
#ifdef __WINDOWS__
if (gfx.hStatusBar)
ShowWindow(gfx.hStatusBar, SW_HIDE);
ShowCursor(FALSE);
#endif
}
/******************************************************************
@ -742,7 +737,7 @@ EXPORT void CALL ProcessDList(void)
#ifdef CATCH_EXCEPTIONS
}
catch (...) {
if (fullscreen)
if (g_fullscreen)
{
ReleaseGfx ();
rdp_reset();

View File

@ -22,7 +22,6 @@
#ifdef _WIN32
#include <windows.h>
#include <commctrl.h>
#else
#include <stdint.h>
#include <stdarg.h>
@ -173,14 +172,8 @@ int UMAmode = 0; //support for VSA-100 UMA mode;
static HDC hDC = NULL;
static HGLRC hGLRC = NULL;
static HWND hToolBar = NULL;
static HWND hwnd_win = NULL;
static unsigned long windowedExStyle, windowedStyle;
#endif // _WIN32
static unsigned long fullscreen;
#ifdef _WIN32
static RECT windowedRect;
static HMENU windowedMenu;
#endif // _WIN32
static int savedWidtho, savedHeighto;
static int savedWidth, savedHeight;
@ -670,18 +663,7 @@ grSstWinClose(GrContext_t context)
wglDeleteContext(hGLRC);
hGLRC = NULL;
}
if (fullscreen)
{
ChangeDisplaySettings(NULL, 0);
SetWindowPos(hwnd_win, NULL,
windowedRect.left, windowedRect.top,
0, 0,
SWP_NOZORDER | SWP_NOSIZE);
SetWindowLong(hwnd_win, GWL_STYLE, windowedStyle);
SetWindowLong(hwnd_win, GWL_EXSTYLE, windowedExStyle);
if (windowedMenu) SetMenu(hwnd_win, windowedMenu);
fullscreen = 0;
}
ExitFullScreen();
#endif
return FXTRUE;
}
@ -1052,8 +1034,6 @@ grGetProcAddress(char *procName)
return (GrProc)grTextureAuxBufferExt;
if (!strcmp(procName, "grAuxBufferExt"))
return (GrProc)grAuxBufferExt;
if (!strcmp(procName, "grWrapperFullScreenResolutionExt"))
return (GrProc)grWrapperFullScreenResolutionExt;
if (!strcmp(procName, "grConfigWrapperExt"))
return (GrProc)grConfigWrapperExt;
if (!strcmp(procName, "grKeyPressedExt"))
@ -1960,16 +1940,6 @@ grQueryResolutionsExt(int32_t * Size)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return 0;
}
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32* width, FxU32* height)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return 0;
/*
g_FullScreenResolutions.getResolution(config.res, width, height);
return config.res;
*/
}
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
@ -1977,7 +1947,7 @@ FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
return 0;
}
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso)
void grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
config.vram_size = vram;
@ -2230,18 +2200,6 @@ GrTexInfo *info)
FX_ENTRY void FX_CALL
grLoadGammaTable(FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue)
{
//TODO?
/*LOG("grLoadGammaTable\r\n");
if (!fullscreen)
return;
FxU16 aGammaRamp[3][256];
for (int i = 0; i < 256; i++)
{
aGammaRamp[0][i] = (FxU16)((red[i] << 8) & 0xFFFF);
aGammaRamp[1][i] = (FxU16)((green[i] << 8) & 0xFFFF);
aGammaRamp[2][i] = (FxU16)((blue[i] << 8) & 0xFFFF);
}
CorrectGamma(aGammaRamp);*/
}
FX_ENTRY void FX_CALL

View File

@ -2,7 +2,6 @@
#ifdef _WIN32
#include <windows.h>
#include <commctrl.h>
#else
#include <stdint.h>
#include <stdarg.h>
@ -29,187 +28,7 @@
*/
#include <Settings/Settings.h>
struct ResolutionInfo
{
unsigned int dwW, dwH, dwF;
ResolutionInfo() : dwW(0), dwH(0), dwF(0) {}
ResolutionInfo(unsigned int _w, unsigned int _h, unsigned int _f) : dwW(_w), dwH(_h), dwF(_f) {}
bool operator == (const ResolutionInfo & _other) const
{
if (dwW != _other.dwW)
return false;
if (dwH != _other.dwH)
return false;
if (dwF != _other.dwF)
return false;
return true;
}
bool operator != (const ResolutionInfo & _other) const
{
return !(operator==(_other));
}
void toString(char * _str) const
{
if (dwF > 0)
sprintf(_str, "%ix%i 32bpp %iHz", dwW, dwH, dwF);
else
sprintf(_str, "%ix%i 32bpp", dwW, dwH);
}
};
class FullScreenResolutions
{
public:
FullScreenResolutions() : dwNumResolutions(0), aResolutions(0), aResolutionsStr(0) {}
~FullScreenResolutions();
void getResolution(FxU32 _idx, FxU32 * _width, FxU32 * _height, FxU32 * _frequency = 0)
{
WriteTrace(TraceResolution, TraceDebug, "_idx: %d", _idx);
if (dwNumResolutions == 0)
{
init();
}
if (_idx >= dwNumResolutions)
{
WriteTrace(TraceGlitch, TraceError, "NumResolutions = %d", dwNumResolutions);
_idx = 0;
}
*_width = (FxU32)aResolutions[_idx].dwW;
*_height = (FxU32)aResolutions[_idx].dwH;
if (_frequency != 0)
{
*_frequency = (FxU32)aResolutions[_idx].dwF;
}
}
int getCurrentResolutions(void)
{
if (dwNumResolutions == 0)
{
init();
}
return currentResolutions;
}
char ** getResolutionsList(int32_t * Size)
{
if (dwNumResolutions == 0)
{
init();
}
*Size = (int32_t)dwNumResolutions;
return aResolutionsStr;
}
bool changeDisplaySettings(FxU32 _resolution);
private:
void init();
unsigned int dwNumResolutions;
ResolutionInfo * aResolutions;
char ** aResolutionsStr;
int currentResolutions;
};
FullScreenResolutions::~FullScreenResolutions()
{
for (unsigned int i = 0; i < dwNumResolutions; i++)
{
delete[] aResolutionsStr[i];
aResolutionsStr[i] = NULL;
}
if (aResolutionsStr)
{
delete[] aResolutionsStr;
aResolutionsStr = NULL;
}
if (aResolutions)
{
delete[] aResolutions;
aResolutions = NULL;
}
}
void FullScreenResolutions::init()
{
#ifdef _WIN32
currentResolutions = -1;
DEVMODE enumMode , currentMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &currentMode);
ResolutionInfo prevInfo;
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
dwNumResolutions++;
prevInfo = curInfo;
}
}
aResolutions = new ResolutionInfo[dwNumResolutions];
aResolutionsStr = new char*[dwNumResolutions];
iModeNum = 0;
int current = 0;
char smode[256];
memset(&enumMode, 0, sizeof(DEVMODE));
memset(&prevInfo, 0, sizeof(ResolutionInfo));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo != prevInfo)
{
if (enumMode.dmPelsHeight == currentMode.dmPelsHeight && enumMode.dmPelsWidth == currentMode.dmPelsWidth)
{
currentResolutions = current;
}
aResolutions[current] = curInfo;
curInfo.toString(smode);
aResolutionsStr[current] = new char[strlen(smode) + 1];
strcpy(aResolutionsStr[current], smode);
prevInfo = curInfo;
current++;
}
}
#endif
}
bool FullScreenResolutions::changeDisplaySettings(FxU32 _resolution)
{
#ifdef _WIN32
FxU32 width, height, frequency;
getResolution(_resolution, &width, &height, &frequency);
ResolutionInfo info(width, height, frequency);
DEVMODE enumMode;
int iModeNum = 0;
memset(&enumMode, 0, sizeof(DEVMODE));
while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0)
{
ResolutionInfo curInfo(enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency);
if (enumMode.dmBitsPerPel == 32 && curInfo == info) {
bool bRes = ChangeDisplaySettings(&enumMode, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL;
WriteTrace(TraceGlitch, TraceDebug, "width=%d, height=%d, freq=%d %s\r\n", enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency, bRes ? "Success" : "Failed");
return bRes;
}
}
return false;
#else // _WIN32
return false;
#endif // _WIN32
}
FullScreenResolutions g_FullScreenResolutions;
wrapper_config config = { 0, 0, 0, 0 };
wrapper_config config = { 0, 0, 0 };
int screen_width, screen_height;
static inline void opt_glCopyTexImage2D(GLenum target,
@ -484,13 +303,6 @@ int UMAmode = 0; //support for VSA-100 UMA mode;
static HDC hDC = NULL;
static HGLRC hGLRC = NULL;
static HWND hToolBar = NULL;
static HWND hwnd_win = NULL;
static unsigned long windowedExStyle, windowedStyle;
#endif // _WIN32
static unsigned long fullscreen;
#ifdef _WIN32
static RECT windowedRect;
static HMENU windowedMenu;
#endif // _WIN32
static int savedWidtho, savedHeighto;
@ -669,8 +481,8 @@ GrPixelFormat_t /*pixelformat*/,
int nColBuffers,
int nAuxBuffers)
{
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, screen_resolution: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(hWnd, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
}
#ifdef _WIN32
@ -678,12 +490,12 @@ int nAuxBuffers)
# ifndef ATTACH_PARENT_PROCESS
# define ATTACH_PARENT_PROCESS ((FxU32)-1)
# endif
extern HWND g_hwnd_win;
#endif
FX_ENTRY GrContext_t FX_CALL
grSstWinOpen(
HWND hWnd,
GrScreenResolution_t screen_resolution,
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
@ -717,184 +529,16 @@ int nAuxBuffers)
fputs("ERROR: No GLX yet to start GL on [Free]BSD, Linux etc.\n", stderr);
#endif // _WIN32
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, screen_resolution: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, screen_resolution&~0x80000000, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
WriteTrace(TraceGlitch, TraceDebug, "hWnd: %d, refresh_rate: %d, color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", hWnd, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
#ifdef _WIN32
if ((HWND)hWnd == NULL) hWnd = GetActiveWindow();
hwnd_win = (HWND)hWnd;
#endif // _WIN32
g_width = g_height = 0;
if (screen_resolution & 0x80000000)
{
switch (screen_resolution & ~0x80000000)
{
case GR_RESOLUTION_320x200:
g_width = 320;
g_height = 200;
break;
case GR_RESOLUTION_320x240:
g_width = 320;
g_height = 240;
break;
case GR_RESOLUTION_400x256:
g_width = 400;
g_height = 256;
break;
case GR_RESOLUTION_512x384:
g_width = 512;
g_height = 384;
break;
case GR_RESOLUTION_640x200:
g_width = 640;
g_height = 200;
break;
case GR_RESOLUTION_640x350:
g_width = 640;
g_height = 350;
break;
case GR_RESOLUTION_640x400:
g_width = 640;
g_height = 400;
break;
case GR_RESOLUTION_640x480:
g_width = 640;
g_height = 480;
break;
case GR_RESOLUTION_800x600:
g_width = 800;
g_height = 600;
break;
case GR_RESOLUTION_960x720:
g_width = 960;
g_height = 720;
break;
case GR_RESOLUTION_856x480:
g_width = 856;
g_height = 480;
break;
case GR_RESOLUTION_512x256:
g_width = 512;
g_height = 256;
break;
case GR_RESOLUTION_1024x768:
g_width = 1024;
g_height = 768;
break;
case GR_RESOLUTION_1280x1024:
g_width = 1280;
g_height = 1024;
break;
case GR_RESOLUTION_1600x1200:
g_width = 1600;
g_height = 1200;
break;
case GR_RESOLUTION_400x300:
g_width = 400;
g_height = 300;
break;
case GR_RESOLUTION_1152x864:
g_width = 1152;
g_height = 864;
break;
case GR_RESOLUTION_1280x960:
g_width = 1280;
g_height = 960;
break;
case GR_RESOLUTION_1600x1024:
g_width = 1600;
g_height = 1024;
break;
case GR_RESOLUTION_1792x1344:
g_width = 1792;
g_height = 1344;
break;
case GR_RESOLUTION_1856x1392:
g_width = 1856;
g_height = 1392;
break;
case GR_RESOLUTION_1920x1440:
g_width = 1920;
g_height = 1440;
break;
case GR_RESOLUTION_2048x1536:
g_width = 2048;
g_height = 1536;
break;
case GR_RESOLUTION_2048x2048:
g_width = 2048;
g_height = 2048;
break;
default:
WriteTrace(TraceGlitch, TraceWarning, "unknown SstWinOpen resolution : %x", screen_resolution);
}
}
#ifdef _WIN32
if (screen_resolution & 0x80000000)
{
RECT clientRect, toolbarRect, statusbarRect;
ZeroMemory(&windowedRect, sizeof(RECT));
ZeroMemory(&clientRect, sizeof(RECT));
ZeroMemory(&toolbarRect, sizeof(RECT));
ZeroMemory(&statusbarRect, sizeof(RECT));
HWND hToolBar = FindWindowEx(hwnd_win, NULL, REBARCLASSNAME, NULL);
HWND hStatusBar = FindWindowEx(hwnd_win, NULL, STATUSCLASSNAME, NULL);
if (hStatusBar == NULL) hStatusBar = FindWindowEx(hwnd_win, NULL, "msctls_statusbar32", NULL); // 1964
if (hToolBar != NULL) GetWindowRect(hToolBar, &toolbarRect);
if (hStatusBar != NULL) GetWindowRect(hStatusBar, &statusbarRect);
viewport_offset = statusbarRect.bottom - statusbarRect.top;
GetWindowRect(hwnd_win, &windowedRect);
GetClientRect(hwnd_win, &clientRect);
windowedRect.right += (g_width - (clientRect.right - clientRect.left));
windowedRect.bottom += (g_height + (toolbarRect.bottom - toolbarRect.top) + (statusbarRect.bottom - statusbarRect.top) - (clientRect.bottom - clientRect.top));
SetWindowPos(hwnd_win, NULL, 0, 0, windowedRect.right - windowedRect.left,
windowedRect.bottom - windowedRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);
TMU_SIZE = (config.vram_size - g_width * g_height * 4 * 3) / 2; // XXX - what about windows desktop usage?
fullscreen = 0;
}
else
{
{
FxU32 _width, _height;
g_FullScreenResolutions.getResolution(screen_resolution, &_width, &_height);
g_width = _width;
g_height = _height;
}
ZeroMemory(&windowedRect, sizeof(RECT));
GetWindowRect(hwnd_win, &windowedRect);
windowedExStyle = GetWindowLong(hwnd_win, GWL_EXSTYLE);
windowedStyle = GetWindowLong(hwnd_win, GWL_STYLE);
// primary monitor only
if (!g_FullScreenResolutions.changeDisplaySettings(screen_resolution))
{
WriteTrace(TraceGlitch, TraceWarning, "can't change to fullscreen mode");
}
windowedMenu = GetMenu(hwnd_win);
if (windowedMenu) SetMenu(hwnd_win, NULL);
HWND hStatusBar = FindWindowEx(hwnd_win, NULL, "msctls_statusbar32", NULL); // 1964
if (hStatusBar) ShowWindow(hStatusBar, SW_HIDE);
SetWindowLong(hwnd_win, GWL_STYLE, 0);
SetWindowLong(hwnd_win, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST);
SetWindowPos(hwnd_win, NULL, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW);
viewport_offset = 0;
fullscreen = 1;
}
TMU_SIZE = (config.vram_size - g_width * g_height * 4 * 3) / 2;
// save screen resolution for hwfbe, after resolution enumeration
screen_width = g_width;
screen_height = g_height;
if ((hDC = GetDC(hwnd_win)) == NULL)
if ((hDC = GetDC(g_hwnd_win)) == NULL)
{
WriteTrace(TraceGlitch, TraceWarning, "GetDC on main window failed");
return FXFALSE;
@ -1264,18 +908,7 @@ grSstWinClose(GrContext_t context)
wglDeleteContext(hGLRC);
hGLRC = NULL;
}
if (fullscreen)
{
ChangeDisplaySettings(NULL, 0);
SetWindowPos(hwnd_win, NULL,
windowedRect.left, windowedRect.top,
0, 0,
SWP_NOZORDER | SWP_NOSIZE);
SetWindowLong(hwnd_win, GWL_STYLE, windowedStyle);
SetWindowLong(hwnd_win, GWL_EXSTYLE, windowedExStyle);
if (windowedMenu) SetMenu(hwnd_win, windowedMenu);
fullscreen = 0;
}
ExitFullScreen();
#else
//SDL_QuitSubSystem(SDL_INIT_VIDEO);
//sleep(2);
@ -1682,7 +1315,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
if (plength < 4 || params == NULL) return 0;
if (!nbTextureUnits)
{
grSstWinOpen((unsigned long)NULL, GR_RESOLUTION_640x480 | 0x80000000, 0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinOpen((unsigned long)NULL, 0, GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
grSstWinClose(0);
}
#ifdef VOODOO1
@ -2503,27 +2136,9 @@ FxI32 src_stride, void *src_data)
return FXTRUE;
}
int GetCurrentResIndex(void)
{
return g_FullScreenResolutions.getCurrentResolutions();
}
/* wrapper-specific glide extensions */
FX_ENTRY char ** FX_CALL
grQueryResolutionsExt(int32_t * Size)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
return g_FullScreenResolutions.getResolutionsList(Size);
}
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32* width, FxU32* height)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
g_FullScreenResolutions.getResolution(config.res, width, height);
return config.res;
}
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
{
#ifdef _WIN32
@ -2533,10 +2148,9 @@ FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key)
#endif
}
FX_ENTRY void FX_CALL grConfigWrapperExt(FxI32 resolution, FxI32 vram, FxBool fbo, FxBool aniso)
void grConfigWrapperExt(FxI32 vram, FxBool fbo, FxBool aniso)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
config.res = resolution;
config.vram_size = vram;
config.fbo = fbo;
config.anisofilter = aniso;
@ -2812,8 +2426,6 @@ FX_ENTRY void FX_CALL
grLoadGammaTable(FxU32 /*nentries*/, FxU32 *red, FxU32 *green, FxU32 *blue)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
if (!fullscreen)
return;
FxU16 aGammaRamp[3][256];
for (int i = 0; i < 256; i++)
{
@ -2822,7 +2434,6 @@ grLoadGammaTable(FxU32 /*nentries*/, FxU32 *red, FxU32 *green, FxU32 *blue)
aGammaRamp[2][i] = (FxU16)((blue[i] << 8) & 0xFFFF);
}
CorrectGamma(aGammaRamp);
pjutil::Sleep(1000);
}
FX_ENTRY void FX_CALL
@ -2855,8 +2466,7 @@ FX_ENTRY void FX_CALL
guGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB)
{
WriteTrace(TraceGlitch, TraceDebug, "-");
if (!fullscreen)
return;
FxU16 aGammaRamp[3][256];
for (int i = 0; i < 256; i++)
{

View File

@ -17,9 +17,6 @@ extern int dumping;
typedef struct _wrapper_config
{
#ifndef ANDROID
int res;
#endif
int fbo;
int anisofilter;
int vram_size;
@ -172,19 +169,13 @@ void compile_shader();
void set_lambda();
void set_copy_shader();
void disable_textureSizes();
void ExitFullScreen();
// config functions
FX_ENTRY void FX_CALL grConfigWrapperExt(
#ifndef ANDROID
FxI32, /* resolution parameter not supported on Android build */
#endif
FxI32,
FxBool,
FxBool
);
FX_ENTRY GrScreenResolution_t FX_CALL grWrapperFullScreenResolutionExt(FxU32*, FxU32*);
FX_ENTRY char ** FX_CALL grQueryResolutionsExt(int32_t*);
void grConfigWrapperExt(FxI32,FxBool,FxBool);
uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height);
char ** grQueryResolutionsExt(int32_t*);
FX_ENTRY FxBool FX_CALL grKeyPressedExt(FxU32 key);
FX_ENTRY void FX_CALL grGetGammaTableExt(FxU32, FxU32*, FxU32*, FxU32*);

View File

@ -627,7 +627,7 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen(
#ifdef ANDROID
GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers
#else
HWND hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers
HWND hWnd, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers
#endif
);