mirror of https://github.com/PCSX2/pcsx2.git
zzogl-pg: Move the Keyboard code to a separate file.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3367 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
cab7a894e4
commit
e35211addb
|
@ -84,6 +84,7 @@ set(zzoglSources
|
|||
ZZoglShaders.cpp
|
||||
ZZoglShoots.cpp
|
||||
ZZoglVB.cpp
|
||||
ZZKeyboard.cpp
|
||||
ZZLog.cpp)
|
||||
|
||||
# zzogl headers
|
||||
|
|
|
@ -64,6 +64,9 @@ int CurrentSavestate = 0; // Number of SaveSlot. Default is 0
|
|||
bool SaveStateExists = true; // We could not know save slot status before first change occured
|
||||
const char* SaveStateFile = NULL; // Name of SaveFile for access check.
|
||||
|
||||
extern const char* s_aa[5];
|
||||
extern const char* s_naa[3];
|
||||
extern const char* pbilinear[];
|
||||
// statistics
|
||||
u32 g_nGenVars = 0, g_nTexVars = 0, g_nAlphaVars = 0, g_nResolve = 0;
|
||||
|
||||
|
@ -81,16 +84,16 @@ char *libraryName = "ZZ Ogl PG (Dev)";
|
|||
char *libraryName = "ZZ Ogl PG ";
|
||||
#endif
|
||||
|
||||
static const char* s_aa[5] = { "AA none |", "AA 2x |", "AA 4x |", "AA 8x |", "AA 16x |" };
|
||||
static const char* s_naa[3] = { "native res |", "res /2 |", "res /4 |" };
|
||||
static const char* pbilinear[] = { "off", "normal", "forced" };
|
||||
|
||||
extern GIFRegHandler g_GIFPackedRegHandlers[], g_GIFRegHandlers[];
|
||||
GIFRegHandler g_GIFTempRegHandlers[16] = {0};
|
||||
extern int g_nPixelShaderVer, g_nFrameRender, g_nFramesSkipped;
|
||||
|
||||
int s_frameskipping = 0;
|
||||
|
||||
extern void ProcessMessages();
|
||||
extern void WriteAA();
|
||||
extern void WriteBilinear();
|
||||
|
||||
u32 CALLBACK PS2EgetLibType()
|
||||
{
|
||||
return PS2E_LT_GS;
|
||||
|
@ -331,198 +334,6 @@ s32 CALLBACK GSinit()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CALLBACK GSshutdown()
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
if (gsLog != NULL) fclose(gsLog);
|
||||
}
|
||||
|
||||
// keyboard functions
|
||||
void OnKeyboardF5(int shift)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
char strtitle[256];
|
||||
|
||||
if (shift)
|
||||
{
|
||||
if (g_nPixelShaderVer == SHADER_REDUCED)
|
||||
{
|
||||
conf.bilinear = 0;
|
||||
sprintf(strtitle, "reduced shaders don't support bilinear filtering");
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.bilinear = (conf.bilinear + 1) % 3;
|
||||
sprintf(strtitle, "bilinear filtering - %s", pbilinear[conf.bilinear]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.interlace++;
|
||||
|
||||
if (conf.interlace > 2) conf.interlace = 0;
|
||||
|
||||
if (conf.interlace < 2)
|
||||
sprintf(strtitle, "interlace on - mode %d", conf.interlace);
|
||||
else
|
||||
sprintf(strtitle, "interlace off");
|
||||
}
|
||||
|
||||
ZeroGS::AddMessage(strtitle);
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void OnKeyboardF6(int shift)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
char strtitle[256];
|
||||
|
||||
if (shift)
|
||||
{
|
||||
conf.decAA();
|
||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
||||
ZeroGS::SetAA(conf.aa);
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.incAA();
|
||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
||||
ZeroGS::SetAA(conf.aa);
|
||||
}
|
||||
|
||||
ZeroGS::AddMessage(strtitle);
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void OnKeyboardF7(int shift)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
char strtitle[256];
|
||||
|
||||
if (!shift)
|
||||
{
|
||||
extern bool g_bDisplayFPS;
|
||||
g_bDisplayFPS ^= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.zz_options.wireframe = !conf.zz_options.wireframe;
|
||||
glPolygonMode(GL_FRONT_AND_BACK, (conf.wireframe()) ? GL_LINE : GL_FILL);
|
||||
sprintf(strtitle, "wireframe rendering - %s", (conf.wireframe()) ? "on" : "off");
|
||||
}
|
||||
}
|
||||
|
||||
void OnKeyboardF61(int shift)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
char strtitle[256];
|
||||
|
||||
if (shift)
|
||||
{
|
||||
conf.negaa--; // -1
|
||||
if (conf.negaa > 2) conf.negaa = 2; // u8 in unsigned, so negative value is 255.
|
||||
sprintf(strtitle, "down resolution - %s", s_naa[conf.negaa]);
|
||||
ZeroGS::SetNegAA(conf.negaa);
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.negaa++;
|
||||
if (conf.negaa > 2) conf.negaa = 0;
|
||||
sprintf(strtitle, "down resolution - %s", s_naa[conf.negaa]);
|
||||
ZeroGS::SetNegAA(conf.negaa);
|
||||
}
|
||||
|
||||
ZeroGS::AddMessage(strtitle);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
typedef struct GameHackStruct
|
||||
{
|
||||
const char HackName[40];
|
||||
u32 HackMask;
|
||||
} GameHack;
|
||||
|
||||
#define HACK_NUMBER 30
|
||||
|
||||
GameHack HackinshTable[HACK_NUMBER] =
|
||||
{
|
||||
{"*** 0 No Hack", 0},
|
||||
{"*** 1 TexTargets Check", GAME_TEXTURETARGS},
|
||||
{"*** 2 Autoreset Targets", GAME_AUTORESET},
|
||||
{"*** 3 Interlace 2x", GAME_INTERLACE2X},
|
||||
{"*** 4 TexA hack", GAME_TEXAHACK},
|
||||
{"*** 5 No Target Resolve", GAME_NOTARGETRESOLVE},
|
||||
{"*** 6 Exact color", GAME_EXACTCOLOR},
|
||||
{"*** 7 No color clamp", GAME_NOCOLORCLAMP},
|
||||
{"*** 8 FFX hack", GAME_FFXHACK},
|
||||
{"*** 9 No Alpha Fail", GAME_NOALPHAFAIL},
|
||||
{"***10 No Depth Update", GAME_NODEPTHUPDATE},
|
||||
{"***11 Quick Resolve 1", GAME_QUICKRESOLVE1},
|
||||
{"***12 No quick resolve", GAME_NOQUICKRESOLVE},
|
||||
{"***13 Notaget clut", GAME_NOTARGETCLUT},
|
||||
{"***14 No Stencil", GAME_NOSTENCIL},
|
||||
{"***15 No Depth resolve", GAME_NODEPTHRESOLVE},
|
||||
{"***16 Full 16 bit", GAME_FULL16BITRES},
|
||||
{"***17 Resolve promoted", GAME_RESOLVEPROMOTED},
|
||||
{"***18 Fast Update", GAME_FASTUPDATE},
|
||||
{"***19 No Alpha Test", GAME_NOALPHATEST},
|
||||
{"***20 Disable MRT deprh", GAME_DISABLEMRTDEPTH},
|
||||
{"***21 32 bit targes", GAME_32BITTARGS},
|
||||
{"***22 path 3 hack", GAME_PATH3HACK},
|
||||
{"***23 parallelise calls", GAME_DOPARALLELCTX},
|
||||
{"***24 specular highligths", GAME_XENOSPECHACK},
|
||||
{"***25 partial pointers", GAME_PARTIALPOINTERS},
|
||||
{"***26 partial depth", GAME_PARTIALDEPTH},
|
||||
{"***27 reget hack", GAME_REGETHACK},
|
||||
|
||||
{"***28 gust hack", GAME_GUSTHACK},
|
||||
{"***29 log-Z", GAME_NOLOGZ}
|
||||
};
|
||||
|
||||
int CurrentHackSetting = 0;
|
||||
|
||||
void OnKeyboardF9(int shift)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
// printf ("A %d\n", HackinshTable[CurrentHackSetting].HackMask);
|
||||
conf.hacks._u32 &= !(HackinshTable[CurrentHackSetting].HackMask);
|
||||
|
||||
if (shift)
|
||||
{
|
||||
CurrentHackSetting--;
|
||||
|
||||
if (CurrentHackSetting == -1) CurrentHackSetting = HACK_NUMBER - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentHackSetting++;
|
||||
|
||||
if (CurrentHackSetting == HACK_NUMBER) CurrentHackSetting = 0;
|
||||
}
|
||||
|
||||
conf.hacks._u32 |= HackinshTable[CurrentHackSetting].HackMask;
|
||||
|
||||
ZeroGS::AddMessage(HackinshTable[CurrentHackSetting].HackName);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void OnKeyboardF1(int shift)
|
||||
{
|
||||
FUNCLOG
|
||||
char strtitle[256];
|
||||
sprintf(strtitle, "Saving in savestate %d", CurrentSavestate);
|
||||
SaveStateExists = true;
|
||||
ZeroGS::AddMessage(HackinshTable[CurrentHackSetting].HackName);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
@ -569,26 +380,8 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
|||
|
||||
ZZLog::WriteLn("Initialization successful.");
|
||||
|
||||
switch (conf.bilinear)
|
||||
{
|
||||
case 2:
|
||||
ZeroGS::AddMessage("bilinear filtering - forced", 1000);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ZeroGS::AddMessage("bilinear filtering - normal", 1000);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (conf.aa != 0)
|
||||
{
|
||||
char strtitle[64];
|
||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
||||
ZeroGS::AddMessage(strtitle, 1000);
|
||||
}
|
||||
WriteBilinear();
|
||||
WriteAA();
|
||||
|
||||
luPerfFreq = GetCPUTicks();
|
||||
|
||||
|
@ -599,122 +392,13 @@ s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void ProcessMessages()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
ZeroMemory(&msg, sizeof(msg));
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
switch (msg.message)
|
||||
{
|
||||
|
||||
case WM_KEYDOWN :
|
||||
int my_KeyEvent = msg.wParam;
|
||||
bool my_bShift = !!(GetKeyState(VK_SHIFT) & 0x8000);
|
||||
|
||||
switch (msg.wParam)
|
||||
{
|
||||
|
||||
case VK_F5:
|
||||
OnKeyboardF5(my_bShift);
|
||||
break;
|
||||
|
||||
case VK_F6:
|
||||
OnKeyboardF6(my_bShift);
|
||||
break;
|
||||
|
||||
case VK_F7:
|
||||
OnKeyboardF7(my_bShift);
|
||||
break;
|
||||
|
||||
case VK_F9:
|
||||
OnKeyboardF9(my_bShift);
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
|
||||
if (conf.fullscreen())
|
||||
{
|
||||
// destroy that msg
|
||||
conf.setFullscreen(false);
|
||||
ZeroGS::ChangeDeviceSize(conf.width, conf.height);
|
||||
UpdateWindow(GShwnd);
|
||||
continue; // so that msg doesn't get sent
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(GShwnd, WM_DESTROY, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GetKeyState(VK_MENU) & 0x8000) && (GetKeyState(VK_RETURN) & 0x8000))
|
||||
{
|
||||
conf.zz_options.fullscreen = !conf.zz_options.fullscreen;
|
||||
|
||||
ZeroGS::SetChangeDeviceSize(
|
||||
(conf.fullscreen()) ? 1280 : conf.width,
|
||||
(conf.fullscreen()) ? 960 : conf.height);
|
||||
}
|
||||
}
|
||||
|
||||
#else // linux
|
||||
|
||||
void ProcessMessages()
|
||||
void CALLBACK GSshutdown()
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
// check resizing
|
||||
GLWin.ResizeCheck();
|
||||
|
||||
if (THR_KeyEvent) // This values was passed from GSKeyEvents which could be in another thread
|
||||
{
|
||||
int my_KeyEvent = THR_KeyEvent;
|
||||
bool my_bShift = THR_bShift;
|
||||
THR_KeyEvent = 0;
|
||||
|
||||
switch (my_KeyEvent)
|
||||
{
|
||||
case XK_F5:
|
||||
OnKeyboardF5(my_bShift);
|
||||
break;
|
||||
|
||||
case XK_F6:
|
||||
OnKeyboardF6(my_bShift);
|
||||
break;
|
||||
|
||||
case XK_F7:
|
||||
OnKeyboardF7(my_bShift);
|
||||
break;
|
||||
|
||||
case XK_F9:
|
||||
OnKeyboardF9(my_bShift);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gsLog != NULL) fclose(gsLog);
|
||||
}
|
||||
|
||||
#endif // linux
|
||||
|
||||
void CALLBACK GSclose()
|
||||
{
|
||||
FUNCLOG
|
||||
|
|
|
@ -154,6 +154,7 @@
|
|||
<ClCompile Include="..\x86.cpp" />
|
||||
<ClCompile Include="..\zerogs.cpp" />
|
||||
<ClCompile Include="..\zpipe.cpp" />
|
||||
<ClCompile Include="..\ZZKeyboard.cpp" />
|
||||
<ClCompile Include="..\ZZLog.cpp" />
|
||||
<ClCompile Include="..\ZZoglCreate.cpp" />
|
||||
<ClCompile Include="..\ZZoglCRTC.cpp" />
|
||||
|
|
|
@ -348,6 +348,10 @@
|
|||
RelativePath="..\zpipe.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ZZKeyboard.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ZZLog.cpp"
|
||||
>
|
||||
|
|
|
@ -0,0 +1,375 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@gmail.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// keyboard functions
|
||||
|
||||
#include "Util.h"
|
||||
#include "GS.h"
|
||||
#include "ZeroGSShaders/zerogsshaders.h"
|
||||
#include "Profile.h"
|
||||
|
||||
extern int CurrentSavestate, g_GSMultiThreaded, g_nPixelShaderVer;
|
||||
extern char GStitle[256];
|
||||
extern char *libraryName;
|
||||
extern const unsigned char zgsversion;
|
||||
extern unsigned char zgsrevision, zgsbuild, zgsminor;
|
||||
|
||||
extern u32 THR_KeyEvent; // value for passing out key events between threads
|
||||
extern bool THR_bShift, SaveStateExists;
|
||||
|
||||
const char* s_aa[5] = { "AA none |", "AA 2x |", "AA 4x |", "AA 8x |", "AA 16x |" };
|
||||
const char* s_naa[3] = { "native res |", "res /2 |", "res /4 |" };
|
||||
const char* pbilinear[] = { "off", "normal", "forced" };
|
||||
|
||||
|
||||
void ProcessBilinear()
|
||||
{
|
||||
FUNCLOG
|
||||
char strtitle[256];
|
||||
|
||||
if (g_nPixelShaderVer == SHADER_REDUCED)
|
||||
{
|
||||
conf.bilinear = 0;
|
||||
sprintf(strtitle, "reduced shaders don't support bilinear filtering");
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.bilinear = (conf.bilinear + 1) % 3;
|
||||
sprintf(strtitle, "bilinear filtering - %s", pbilinear[conf.bilinear]);
|
||||
}
|
||||
ZZLog::WriteToScreen(strtitle);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void ProcessInterlace()
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
char strtitle[256];
|
||||
conf.interlace++;
|
||||
|
||||
if (conf.interlace > 2) conf.interlace = 0;
|
||||
|
||||
if (conf.interlace < 2)
|
||||
sprintf(strtitle, "interlace on - mode %d", conf.interlace);
|
||||
else
|
||||
sprintf(strtitle, "interlace off");
|
||||
|
||||
ZZLog::WriteToScreen(strtitle);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void ProcessAASetting(bool reverse)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
char strtitle[256];
|
||||
|
||||
if (reverse)
|
||||
conf.decAA();
|
||||
else
|
||||
conf.incAA();
|
||||
|
||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
||||
ZeroGS::SetAA(conf.aa);
|
||||
ZZLog::WriteToScreen(strtitle);
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void ProcessFPS()
|
||||
{
|
||||
FUNCLOG
|
||||
extern bool g_bDisplayFPS;
|
||||
g_bDisplayFPS ^= 1;
|
||||
}
|
||||
|
||||
void ProcessWireFrame()
|
||||
{
|
||||
FUNCLOG
|
||||
char strtitle[256];
|
||||
|
||||
conf.zz_options.wireframe = !conf.zz_options.wireframe;
|
||||
glPolygonMode(GL_FRONT_AND_BACK, (conf.wireframe()) ? GL_LINE : GL_FILL);
|
||||
sprintf(strtitle, "wireframe rendering - %s", (conf.wireframe()) ? "on" : "off");
|
||||
ZZLog::WriteToScreen(strtitle);
|
||||
}
|
||||
|
||||
void ProcessNegAASetting(bool reverse)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
char strtitle[256];
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
conf.negaa--; // -1
|
||||
if (conf.negaa > 2) conf.negaa = 2; // u8 in unsigned, so negative value is 255.
|
||||
sprintf(strtitle, "down resolution - %s", s_naa[conf.negaa]);
|
||||
ZeroGS::SetNegAA(conf.negaa);
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.negaa++;
|
||||
if (conf.negaa > 2) conf.negaa = 0;
|
||||
sprintf(strtitle, "down resolution - %s", s_naa[conf.negaa]);
|
||||
ZeroGS::SetNegAA(conf.negaa);
|
||||
}
|
||||
|
||||
ZZLog::WriteToScreen(strtitle);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
typedef struct GameHackStruct
|
||||
{
|
||||
const char HackName[40];
|
||||
u32 HackMask;
|
||||
} GameHack;
|
||||
|
||||
#define HACK_NUMBER 30
|
||||
|
||||
GameHack HackinshTable[HACK_NUMBER] =
|
||||
{
|
||||
{"*** 0 No Hack", 0},
|
||||
{"*** 1 TexTargets Check", GAME_TEXTURETARGS},
|
||||
{"*** 2 Autoreset Targets", GAME_AUTORESET},
|
||||
{"*** 3 Interlace 2x", GAME_INTERLACE2X},
|
||||
{"*** 4 TexA hack", GAME_TEXAHACK},
|
||||
{"*** 5 No Target Resolve", GAME_NOTARGETRESOLVE},
|
||||
{"*** 6 Exact color", GAME_EXACTCOLOR},
|
||||
{"*** 7 No color clamp", GAME_NOCOLORCLAMP},
|
||||
{"*** 8 FFX hack", GAME_FFXHACK},
|
||||
{"*** 9 No Alpha Fail", GAME_NOALPHAFAIL},
|
||||
{"***10 No Depth Update", GAME_NODEPTHUPDATE},
|
||||
{"***11 Quick Resolve 1", GAME_QUICKRESOLVE1},
|
||||
{"***12 No quick resolve", GAME_NOQUICKRESOLVE},
|
||||
{"***13 Notaget clut", GAME_NOTARGETCLUT},
|
||||
{"***14 No Stencil", GAME_NOSTENCIL},
|
||||
{"***15 No Depth resolve", GAME_NODEPTHRESOLVE},
|
||||
{"***16 Full 16 bit", GAME_FULL16BITRES},
|
||||
{"***17 Resolve promoted", GAME_RESOLVEPROMOTED},
|
||||
{"***18 Fast Update", GAME_FASTUPDATE},
|
||||
{"***19 No Alpha Test", GAME_NOALPHATEST},
|
||||
{"***20 Disable MRT deprh", GAME_DISABLEMRTDEPTH},
|
||||
{"***21 32 bit targes", GAME_32BITTARGS},
|
||||
{"***22 path 3 hack", GAME_PATH3HACK},
|
||||
{"***23 parallelise calls", GAME_DOPARALLELCTX},
|
||||
{"***24 specular highligths", GAME_XENOSPECHACK},
|
||||
{"***25 partial pointers", GAME_PARTIALPOINTERS},
|
||||
{"***26 partial depth", GAME_PARTIALDEPTH},
|
||||
{"***27 reget hack", GAME_REGETHACK},
|
||||
|
||||
{"***28 gust hack", GAME_GUSTHACK},
|
||||
{"***29 log-Z", GAME_NOLOGZ}
|
||||
};
|
||||
|
||||
int CurrentHackSetting = 0;
|
||||
|
||||
void ProcessHackSetting(bool reverse)
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
// printf ("A %d\n", HackinshTable[CurrentHackSetting].HackMask);
|
||||
conf.hacks._u32 &= !(HackinshTable[CurrentHackSetting].HackMask);
|
||||
|
||||
if (reverse)
|
||||
{
|
||||
CurrentHackSetting--;
|
||||
|
||||
if (CurrentHackSetting == -1) CurrentHackSetting = HACK_NUMBER - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentHackSetting++;
|
||||
|
||||
if (CurrentHackSetting == HACK_NUMBER) CurrentHackSetting = 0;
|
||||
}
|
||||
|
||||
conf.hacks._u32 |= HackinshTable[CurrentHackSetting].HackMask;
|
||||
|
||||
ZZLog::WriteToScreen(HackinshTable[CurrentHackSetting].HackName);
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
void ProcessSaveState()
|
||||
{
|
||||
FUNCLOG
|
||||
char strtitle[256];
|
||||
sprintf(strtitle, "Saving in savestate %d", CurrentSavestate);
|
||||
SaveStateExists = true;
|
||||
ZZLog::WriteToScreen(HackinshTable[CurrentHackSetting].HackName);
|
||||
}
|
||||
|
||||
void OnFKey(int key, int shift)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
//case 1:
|
||||
// ProcessSaveState();
|
||||
// break;
|
||||
case 5:
|
||||
if (shift)
|
||||
ProcessBilinear();
|
||||
else
|
||||
ProcessInterlace();
|
||||
break;
|
||||
case 6:
|
||||
if (shift)
|
||||
ProcessAASetting(true);
|
||||
else
|
||||
ProcessAASetting(false);
|
||||
break;
|
||||
case 7:
|
||||
if (!shift)
|
||||
ProcessFPS();
|
||||
else
|
||||
ProcessWireFrame();
|
||||
break;
|
||||
case 9:
|
||||
if (shift)
|
||||
ProcessHackSetting(true);
|
||||
else
|
||||
ProcessHackSetting(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteAA()
|
||||
{
|
||||
if (conf.aa != 0)
|
||||
{
|
||||
char strtitle[64];
|
||||
sprintf(strtitle, "anti-aliasing - %s", s_aa[conf.aa]);
|
||||
ZZLog::WriteToScreen(strtitle, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteBilinear()
|
||||
{
|
||||
switch (conf.bilinear)
|
||||
{
|
||||
case 2:
|
||||
ZZLog::WriteToScreen("bilinear filtering - forced", 1000);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ZZLog::WriteToScreen("bilinear filtering - normal", 1000);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void ProcessMessages()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
ZeroMemory(&msg, sizeof(msg));
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
switch (msg.message)
|
||||
{
|
||||
case WM_KEYDOWN :
|
||||
int my_KeyEvent = msg.wParam;
|
||||
bool my_bShift = !!(GetKeyState(VK_SHIFT) & 0x8000);
|
||||
|
||||
switch (msg.wParam)
|
||||
{
|
||||
case VK_F5:
|
||||
case VK_F6:
|
||||
case VK_F7:
|
||||
case VK_F9:
|
||||
OnFKey(msg.wParam - VK_F1 + 1, my_bShift);
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
|
||||
if (conf.fullscreen())
|
||||
{
|
||||
// destroy that msg
|
||||
conf.setFullscreen(false);
|
||||
ZeroGS::ChangeDeviceSize(conf.width, conf.height);
|
||||
UpdateWindow(GShwnd);
|
||||
continue; // so that msg doesn't get sent
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(GShwnd, WM_DESTROY, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GetKeyState(VK_MENU) & 0x8000) && (GetKeyState(VK_RETURN) & 0x8000))
|
||||
{
|
||||
conf.zz_options.fullscreen = !conf.zz_options.fullscreen;
|
||||
|
||||
ZeroGS::SetChangeDeviceSize(
|
||||
(conf.fullscreen()) ? 1280 : conf.width,
|
||||
(conf.fullscreen()) ? 960 : conf.height);
|
||||
}
|
||||
}
|
||||
|
||||
#else // linux
|
||||
|
||||
void ProcessMessages()
|
||||
{
|
||||
FUNCLOG
|
||||
|
||||
// check resizing
|
||||
GLWin.ResizeCheck();
|
||||
|
||||
if (THR_KeyEvent) // This values was passed from GSKeyEvents which could be in another thread
|
||||
{
|
||||
int my_KeyEvent = THR_KeyEvent;
|
||||
bool my_bShift = THR_bShift;
|
||||
THR_KeyEvent = 0;
|
||||
|
||||
switch (my_KeyEvent)
|
||||
{
|
||||
case XK_F5:
|
||||
case XK_F6:
|
||||
case XK_F7:
|
||||
case XK_F9:
|
||||
OnFKey(my_KeyEvent - XK_F1 + 1, my_bShift);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // linux
|
|
@ -157,9 +157,15 @@ inline const char *error_name(int err)
|
|||
}
|
||||
|
||||
extern void __LogToConsole(const char *fmt, ...);
|
||||
|
||||
// Subset of zerogs, to avoid that whole huge header.
|
||||
namespace ZeroGS
|
||||
{
|
||||
extern void AddMessage(const char* pstr, u32 ms);
|
||||
extern void SetAA(int mode);
|
||||
extern void SetNegAA(int mode);
|
||||
extern bool Create(int width, int height);
|
||||
extern void Destroy(bool bD3D);
|
||||
}
|
||||
|
||||
namespace ZZLog
|
||||
|
@ -168,6 +174,7 @@ extern bool IsLogging();
|
|||
extern bool OpenLog();
|
||||
extern void Message(const char *fmt, ...);
|
||||
extern void Log(const char *fmt, ...);
|
||||
void WriteToScreen(const char* pstr, u32 ms = 5000);
|
||||
extern void WriteToConsole(const char *fmt, ...);
|
||||
extern void Print(const char *fmt, ...);
|
||||
extern void WriteLn(const char *fmt, ...);
|
||||
|
|
Loading…
Reference in New Issue