mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-30 08:24:05 +00:00
Implement configurable hotkeys.
This commit is contained in:
parent
7a38e80448
commit
abb9108f14
|
@ -322,7 +322,6 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
|
|||
<ClCompile Include="..\..\src\iob.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Platform)'=='Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\Keys.cpp" />
|
||||
<ClCompile Include="..\..\src\Log.cpp" />
|
||||
<ClCompile Include="..\..\src\MupenPlusPluginAPI.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
|
||||
|
@ -476,7 +475,6 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
|
|||
<ClInclude Include="..\..\src\Graphics\ShaderProgram.h" />
|
||||
<ClInclude Include="..\..\src\gSP.h" />
|
||||
<ClInclude Include="..\..\src\inc\glext.h" />
|
||||
<ClInclude Include="..\..\src\Keys.h" />
|
||||
<ClInclude Include="..\..\src\Log.h" />
|
||||
<ClInclude Include="..\..\src\MemoryStatus.h" />
|
||||
<ClInclude Include="..\..\src\mupenplus\GLideN64_mupenplus.h">
|
||||
|
@ -557,4 +555,4 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -158,9 +158,6 @@
|
|||
<ClCompile Include="..\..\src\Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\Keys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\FrameBufferInfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -499,9 +496,6 @@
|
|||
<ClInclude Include="..\..\src\PostProcessor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Keys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\wst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -796,4 +790,4 @@
|
|||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
|
@ -51,7 +51,7 @@
|
|||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_STATICPLUGIN;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_UITOOLS_LIB;QT_WINEXTRAS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;release;.;$(QTDIR)\mkspecs\win32-msvc2013;.\GeneratedFiles;$(QTDIR)\include\QtUiTools;$(QTDIR)\include\QtWinExtras;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;release;.;$(QTDIR)\mkspecs\win32-msvc2013;.\GeneratedFiles;$(QTDIR)\include\QtUiTools;$(QTDIR)\include\QtWinExtras;$(ProjectDir)..\..\src\osal;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zm200 -w34100 -w34189 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
|
|
|
@ -79,10 +79,13 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\osal\osal_export.h" />
|
||||
<ClInclude Include="..\..\src\osal\osal_files.h" />
|
||||
<ClInclude Include="..\..\src\osal\osal_keys.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\osal\osal_files_win32.c" />
|
||||
<ClCompile Include="..\..\src\osal\osal_keys_win.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
|
@ -14,10 +14,19 @@
|
|||
<ClInclude Include="..\..\src\osal\osal_files.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\osal\osal_keys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\osal\osal_export.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\osal\osal_files_win32.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\osal\osal_keys_win.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -41,7 +41,6 @@ set(GLideN64_SOURCES
|
|||
GLideN64.cpp
|
||||
GraphicsDrawer.cpp
|
||||
gSP.cpp
|
||||
Keys.cpp
|
||||
Log.cpp
|
||||
N64.cpp
|
||||
NoiseTexture.cpp
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "Config.h"
|
||||
#include "GBI.h"
|
||||
#include "wst.h"
|
||||
#include "osal_keys.h"
|
||||
|
||||
void Config::resetToDefaults()
|
||||
{
|
||||
|
@ -91,8 +92,6 @@ void Config::resetToDefaults()
|
|||
textureFilter.txHiresEnable = 0;
|
||||
textureFilter.txHiresFullAlphaChannel = 1;
|
||||
textureFilter.txHresAltCRC = 0;
|
||||
textureFilter.txDump = 0;
|
||||
textureFilter.txReloadHiresTex = 0;
|
||||
|
||||
textureFilter.txForce16bpp = 0;
|
||||
textureFilter.txCacheCompression = 1;
|
||||
|
@ -133,6 +132,9 @@ void Config::resetToDefaults()
|
|||
onScreenDisplay.percent = 0;
|
||||
onScreenDisplay.pos = posBottomLeft;
|
||||
|
||||
hotkeys.keys[HotKey::hkTexDump] = KEY_D;
|
||||
hotkeys.keys[HotKey::hkHdTexToggle] = KEY_T;
|
||||
|
||||
debug.dumpMode = 0;
|
||||
}
|
||||
|
||||
|
@ -155,3 +157,33 @@ void Config::validate()
|
|||
graphics2D.correctTexrectCoords = tcDisable;
|
||||
}
|
||||
}
|
||||
|
||||
const char* Config::hotkeyIniName(u32 _idx)
|
||||
{
|
||||
switch (_idx)
|
||||
{
|
||||
case Config::HotKey::hkTexDump:
|
||||
return "hkTexDump";
|
||||
case Config::HotKey::hkHdTexReload:
|
||||
return "hkHdTexReload";
|
||||
case Config::HotKey::hkHdTexToggle:
|
||||
return "hkHdTexToggle";
|
||||
case Config::HotKey::hkVsync:
|
||||
return "hkVsync";
|
||||
case Config::HotKey::hkFBEmulation:
|
||||
return "hkFBEmulation";
|
||||
case Config::HotKey::hkN64DepthCompare:
|
||||
return "hkN64DepthCompare";
|
||||
case Config::HotKey::hkOsdVis:
|
||||
return "hkOsdVis";
|
||||
case Config::HotKey::hkOsdFps:
|
||||
return "hkOsdFps";
|
||||
case Config::HotKey::hkOsdPercent:
|
||||
return "hkOsdPercent";
|
||||
case Config::HotKey::hkOsdInternalResolution:
|
||||
return "hkOsdInternalResolution";
|
||||
case Config::HotKey::hkOsdRenderingResolution:
|
||||
return "hkOsdRenderingResolution";
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
22
src/Config.h
22
src/Config.h
|
@ -167,8 +167,6 @@ struct Config
|
|||
u32 txHiresEnable; // Use high-resolution texture packs
|
||||
u32 txHiresFullAlphaChannel; // Use alpha channel fully
|
||||
u32 txHresAltCRC; // Use alternative method of paletted textures CRC calculation
|
||||
u32 txDump; // Dump textures
|
||||
u32 txReloadHiresTex; // Reload hires textures
|
||||
|
||||
u32 txForce16bpp; // Force use 16bit color textures
|
||||
u32 txCacheCompression; // Zip textures cache
|
||||
|
@ -215,12 +213,32 @@ struct Config
|
|||
u32 pos;
|
||||
} onScreenDisplay;
|
||||
|
||||
enum HotKey {
|
||||
hkTexDump = 0,
|
||||
hkHdTexReload,
|
||||
hkHdTexToggle,
|
||||
hkVsync,
|
||||
hkFBEmulation,
|
||||
hkN64DepthCompare,
|
||||
hkOsdVis,
|
||||
hkOsdFps,
|
||||
hkOsdPercent,
|
||||
hkOsdInternalResolution,
|
||||
hkOsdRenderingResolution,
|
||||
hkTotal
|
||||
};
|
||||
|
||||
struct {
|
||||
u8 keys[hkTotal];
|
||||
} hotkeys;
|
||||
|
||||
struct {
|
||||
u32 dumpMode;
|
||||
} debug;
|
||||
|
||||
void resetToDefaults();
|
||||
void validate();
|
||||
static const char* hotkeyIniName(u32 _idx);
|
||||
};
|
||||
|
||||
#define hack_Ogre64 (1<<0) //Ogre Battle 64 background copy
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "GLideN64.h"
|
||||
#include "Revision.h"
|
||||
#include "RSP.h"
|
||||
#include "Keys.h"
|
||||
#include "Config.h"
|
||||
#include "Combiner.h"
|
||||
#include "FrameBuffer.h"
|
||||
|
@ -13,6 +12,7 @@
|
|||
#include "TextDrawer.h"
|
||||
#include "DebugDump.h"
|
||||
#include "Debugger.h"
|
||||
#include "osal_keys.h"
|
||||
|
||||
#ifndef MUPENPLUSAPI
|
||||
#include "windows/GLideN64_windows.h"
|
||||
|
@ -153,30 +153,30 @@ Debugger::~Debugger()
|
|||
|
||||
void Debugger::checkDebugState()
|
||||
{
|
||||
if (isKeyPressed(G64_VK_SCROLL, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_ScrollLock, 0x0001))
|
||||
m_bDebugMode = !m_bDebugMode;
|
||||
|
||||
if (m_bDebugMode && isKeyPressed(G64_VK_INSERT, 0x0001))
|
||||
if (m_bDebugMode && osal_is_key_pressed(KEY_Insert, 0x0001))
|
||||
m_bCapture = true;
|
||||
}
|
||||
|
||||
void Debugger::_debugKeys()
|
||||
{
|
||||
if (isKeyPressed(G64_VK_RIGHT, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_Right, 0x0001)) {
|
||||
if (std::next(m_triSel) != m_triangles.cend())
|
||||
++m_triSel;
|
||||
else
|
||||
m_triSel = m_triangles.cbegin();
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_LEFT, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_Left, 0x0001)) {
|
||||
if (m_triSel != m_triangles.cbegin())
|
||||
--m_triSel;
|
||||
else
|
||||
m_triSel = std::prev(m_triangles.cend());
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_F, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_F, 0x0001)) {
|
||||
if (m_pCurTexInfo != nullptr) {
|
||||
auto curTexName = m_pCurTexInfo->texture->name;
|
||||
auto beginItr =
|
||||
|
@ -200,51 +200,51 @@ void Debugger::_debugKeys()
|
|||
}
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_B, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_B, 0x0001)) {
|
||||
if (std::next(m_curFBAddr) != m_fbAddrs.end())
|
||||
++m_curFBAddr;
|
||||
else
|
||||
m_curFBAddr = m_fbAddrs.begin();
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_V, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_V, 0x0001)) {
|
||||
if (m_curFBAddr != m_fbAddrs.begin())
|
||||
--m_curFBAddr;
|
||||
else
|
||||
m_curFBAddr = std::prev(m_fbAddrs.end());
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_Q, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_Q, 0x0001))
|
||||
m_tmu = 0;
|
||||
if (isKeyPressed(G64_VK_W, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_W, 0x0001))
|
||||
m_tmu = 1;
|
||||
|
||||
if (isKeyPressed(G64_VK_A, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_A, 0x0001))
|
||||
m_textureMode = TextureMode::both; // texture & texture alpha
|
||||
if (isKeyPressed(G64_VK_S, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_S, 0x0001))
|
||||
m_textureMode = TextureMode::texture; // texture
|
||||
if (isKeyPressed(G64_VK_D, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_D, 0x0001))
|
||||
m_textureMode = TextureMode::alpha; // texture alpha
|
||||
|
||||
if (isKeyPressed(G64_VK_1, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_1, 0x0001))
|
||||
m_curPage = Page::general;
|
||||
if (isKeyPressed(G64_VK_2, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_2, 0x0001))
|
||||
m_curPage = Page::tex1;
|
||||
if (isKeyPressed(G64_VK_3, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_3, 0x0001))
|
||||
m_curPage = Page::tex2;
|
||||
if (isKeyPressed(G64_VK_4, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_4, 0x0001))
|
||||
m_curPage = Page::colors;
|
||||
if (isKeyPressed(G64_VK_5, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_5, 0x0001))
|
||||
m_curPage = Page::blender;
|
||||
if (isKeyPressed(G64_VK_6, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_6, 0x0001))
|
||||
m_curPage = Page::othermode_l;
|
||||
if (isKeyPressed(G64_VK_7, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_7, 0x0001))
|
||||
m_curPage = Page::othermode_h;
|
||||
if (isKeyPressed(G64_VK_8, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_8, 0x0001))
|
||||
m_curPage = Page::texcoords;
|
||||
if (isKeyPressed(G64_VK_9, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_9, 0x0001))
|
||||
m_curPage = Page::coords;
|
||||
if (isKeyPressed(G64_VK_0, 0x0001))
|
||||
if (osal_is_key_pressed(KEY_0, 0x0001))
|
||||
m_curPage = Page::texinfo;
|
||||
}
|
||||
|
||||
|
@ -517,17 +517,17 @@ void Debugger::_drawTextureCache()
|
|||
}
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_UP, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_Up, 0x0001)) {
|
||||
if ((m_startTexRow[m_tmu] + 1) * m_cacheViewerCols < texInfos.size())
|
||||
m_startTexRow[m_tmu]++;
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_DOWN, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_Down, 0x0001)) {
|
||||
if (m_startTexRow[m_tmu] > 0)
|
||||
--m_startTexRow[m_tmu];
|
||||
}
|
||||
|
||||
if (isKeyPressed(G64_VK_SPACE, 0x0001)) {
|
||||
if (osal_is_key_pressed(KEY_Space, 0x0001)) {
|
||||
if (m_triSel->tex_info[m_tmu]) {
|
||||
graphics::ObjectHandle tex = m_triSel->tex_info[m_tmu]->texture->name;
|
||||
auto iter = std::find_if(texInfos.begin(),
|
||||
|
@ -1264,12 +1264,12 @@ void Debugger::_drawDebugInfo()
|
|||
const f32 lrx = (f32)(winWidth) * (2.0f * scaleX) - 1.0f;
|
||||
const f32 lry = -((f32)(winHeight * 5 / 8)* (2.0f * scaleY) - 1.0f);
|
||||
|
||||
while (!isKeyPressed(G64_VK_INSERT, 0x0001)) {
|
||||
while (!osal_is_key_pressed(KEY_Insert, 0x0001)) {
|
||||
_debugKeys();
|
||||
_drawFrameBuffer(frameBufferList().findBuffer(*m_curFBAddr));
|
||||
_drawTextureCache();
|
||||
|
||||
if (isKeyPressed(G64_VK_LBUTTON, 0x0001))
|
||||
if (osal_is_key_pressed(MB_Left, 0x0001))
|
||||
_findSelected();
|
||||
_drawTriangleFrame();
|
||||
_drawMouseCursor();
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "Settings.h"
|
||||
#include "ConfigDialog.h"
|
||||
#include "FullscreenResolutions.h"
|
||||
#include "qevent.h"
|
||||
#include "osal_keys.h"
|
||||
|
||||
static
|
||||
struct
|
||||
|
@ -66,6 +68,46 @@ u32 powof(u32 dim)
|
|||
return i;
|
||||
}
|
||||
|
||||
QString ConfigDialog::_hotkeyDescription(quint32 _idx) const
|
||||
{
|
||||
switch (_idx)
|
||||
{
|
||||
case Config::HotKey::hkTexDump:
|
||||
return tr("Toggle textures dump");
|
||||
case Config::HotKey::hkHdTexReload:
|
||||
return tr("Reload HD textures");
|
||||
case Config::HotKey::hkHdTexToggle:
|
||||
return tr("Toggle HD textures");
|
||||
case Config::HotKey::hkVsync:
|
||||
return tr("Toggle VSync");
|
||||
case Config::HotKey::hkFBEmulation:
|
||||
return tr("Toggle frame buffer emulation");
|
||||
case Config::HotKey::hkN64DepthCompare:
|
||||
return tr("Toggle N64 depth compare");
|
||||
case Config::HotKey::hkOsdVis:
|
||||
return tr("Toggle OSD VI/S");
|
||||
case Config::HotKey::hkOsdFps:
|
||||
return tr("Toggle OSD FPS");
|
||||
case Config::HotKey::hkOsdPercent:
|
||||
return tr("Toggle OSD percent");
|
||||
case Config::HotKey::hkOsdInternalResolution:
|
||||
return tr("Toggle OSD internal resolution");
|
||||
case Config::HotKey::hkOsdRenderingResolution:
|
||||
return tr("Toggle OSD rendering resolution");
|
||||
}
|
||||
return tr("Unknown hotkey");
|
||||
}
|
||||
|
||||
class HotkeyItemWidget : public QWidget
|
||||
{
|
||||
// Q_OBJECT
|
||||
public:
|
||||
HotkeyItemWidget(QWidget* pParent = Q_NULLPTR) : QWidget(pParent) {}
|
||||
quint32 hidCode() const { return m_hid; }
|
||||
void setHidCode(quint32 _code) { m_hid = _code; }
|
||||
private:
|
||||
quint32 m_hid = 0;
|
||||
};
|
||||
|
||||
void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
|
||||
{
|
||||
|
@ -268,10 +310,6 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
|
|||
ui->texturePackGroupBox->setChecked(config.textureFilter.txHiresEnable != 0);
|
||||
ui->alphaChannelCheckBox->setChecked(config.textureFilter.txHiresFullAlphaChannel != 0);
|
||||
ui->alternativeCRCCheckBox->setChecked(config.textureFilter.txHresAltCRC != 0);
|
||||
ui->textureDumpCheckBox->toggle();
|
||||
ui->textureDumpCheckBox->setChecked(config.textureFilter.txDump != 0);
|
||||
ui->textureReloadCheckBox->toggle();
|
||||
ui->textureReloadCheckBox->setChecked(config.textureFilter.txReloadHiresTex != 0);
|
||||
ui->force16bppCheckBox->setChecked(config.textureFilter.txForce16bpp != 0);
|
||||
ui->compressCacheCheckBox->setChecked(config.textureFilter.txCacheCompression != 0);
|
||||
ui->saveTextureCacheCheckBox->setChecked(config.textureFilter.txSaveCache != 0);
|
||||
|
@ -337,6 +375,31 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
|
|||
ui->dumpNormalCheckBox->setChecked((config.debug.dumpMode & DEBUG_NORMAL) != 0);
|
||||
ui->dumpDetailCheckBox->setChecked((config.debug.dumpMode & DEBUG_DETAIL) != 0);
|
||||
|
||||
{
|
||||
ui->hotkeyListWidget->clear();
|
||||
for (quint32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) {
|
||||
HotkeyItemWidget* pWgt = new HotkeyItemWidget;
|
||||
QLayout* pLayout = new QHBoxLayout;
|
||||
pLayout->addWidget(new QLabel(_hotkeyDescription(idx)));
|
||||
|
||||
QPushButton* pBtn = new QPushButton(tr("Click me"));
|
||||
connect(pBtn, SIGNAL(clicked()), SLOT(on_btn_clicked()));
|
||||
pLayout->addWidget(pBtn);
|
||||
pWgt->setLayout(pLayout);
|
||||
|
||||
QListWidgetItem* pItem = new QListWidgetItem(ui->hotkeyListWidget);
|
||||
pItem->setSizeHint(pWgt->sizeHint());
|
||||
pItem->setCheckState(Qt::Unchecked);
|
||||
ui->hotkeyListWidget->setItemWidget(pItem, pWgt);
|
||||
|
||||
if (config.hotkeys.keys[idx] != 0) {
|
||||
pWgt->setHidCode(config.hotkeys.keys[idx]);
|
||||
pBtn->setText(osal_keycode_name(config.hotkeys.keys[idx]));
|
||||
pItem->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DEBUG_DUMP
|
||||
for (int i = 0; i < ui->tabWidget->count(); ++i) {
|
||||
if (tr("Debug") == ui->tabWidget->tabText(i)) {
|
||||
|
@ -548,8 +611,6 @@ void ConfigDialog::accept(bool justSave) {
|
|||
config.textureFilter.txHiresEnable = ui->texturePackGroupBox->isChecked() ? 1 : 0;
|
||||
config.textureFilter.txHiresFullAlphaChannel = ui->alphaChannelCheckBox->isChecked() ? 1 : 0;
|
||||
config.textureFilter.txHresAltCRC = ui->alternativeCRCCheckBox->isChecked() ? 1 : 0;
|
||||
config.textureFilter.txDump = ui->textureDumpCheckBox->isChecked() ? 1 : 0;
|
||||
config.textureFilter.txReloadHiresTex = ui->textureReloadCheckBox->isChecked() ? 1 : 0;
|
||||
|
||||
config.textureFilter.txCacheCompression = ui->compressCacheCheckBox->isChecked() ? 1 : 0;
|
||||
config.textureFilter.txForce16bpp = ui->force16bppCheckBox->isChecked() ? 1 : 0;
|
||||
|
@ -590,7 +651,7 @@ void ConfigDialog::accept(bool justSave) {
|
|||
QDir txDumpPath(ui->texDumpPathLineEdit->text());
|
||||
if (txDumpPath.exists()) {
|
||||
config.textureFilter.txDumpPath[txDumpPath.absolutePath().toWCharArray(config.textureFilter.txDumpPath)] = L'\0';
|
||||
} else if (config.textureFilter.txHiresEnable != 0 && config.textureFilter.txDump != 0) {
|
||||
} else if (config.textureFilter.txHiresEnable != 0 && config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setWindowTitle("GLideN64");
|
||||
|
@ -638,6 +699,15 @@ void ConfigDialog::accept(bool justSave) {
|
|||
config.onScreenDisplay.internalResolution = ui->internalResolutionCheckBox->isChecked() ? 1 : 0;
|
||||
config.onScreenDisplay.renderingResolution = ui->renderingResolutionCheckBox->isChecked() ? 1 : 0;
|
||||
|
||||
for (quint32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) {
|
||||
config.hotkeys.keys[idx] = 0;
|
||||
QListWidgetItem * pItem = ui->hotkeyListWidget->item(idx);
|
||||
if (pItem->checkState() == Qt::Checked) {
|
||||
HotkeyItemWidget* pWgt = (HotkeyItemWidget*)ui->hotkeyListWidget->itemWidget(pItem);
|
||||
config.hotkeys.keys[idx] = pWgt->hidCode();
|
||||
}
|
||||
}
|
||||
|
||||
config.debug.dumpMode = 0;
|
||||
if (ui->dumpLowCheckBox->isChecked())
|
||||
config.debug.dumpMode |= DEBUG_LOW;
|
||||
|
@ -996,3 +1066,68 @@ void ConfigDialog::on_n64DepthCompareComboBox_currentIndexChanged(int index)
|
|||
ui->msaaRadioButton->setDisabled(index > 0);
|
||||
ui->n64DepthCompareComboBox->setStyleSheet("");
|
||||
}
|
||||
|
||||
void ConfigDialog::on_hotkeyListWidget_itemClicked(QListWidgetItem *item)
|
||||
{
|
||||
if (item->checkState() == Qt::Unchecked)
|
||||
item->setCheckState(Qt::Checked);
|
||||
else
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
class HotkeyMessageBox: public QMessageBox
|
||||
{
|
||||
public:
|
||||
HotkeyMessageBox(QWidget *parent = Q_NULLPTR) : QMessageBox(parent)
|
||||
{
|
||||
setWindowTitle("Hotkey");
|
||||
setIcon(QMessageBox::Information);
|
||||
}
|
||||
|
||||
void keyPressEvent(QKeyEvent * pEvent) override
|
||||
{
|
||||
switch (pEvent->key())
|
||||
{
|
||||
case Qt::Key_Escape:
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Enter:
|
||||
QMessageBox::keyPressEvent(pEvent);
|
||||
return;
|
||||
}
|
||||
m_nativeVK = pEvent->nativeVirtualKey();
|
||||
QMessageBox::keyPressEvent(pEvent);
|
||||
close();
|
||||
}
|
||||
|
||||
quint32 m_nativeVK = 0;
|
||||
};
|
||||
|
||||
void ConfigDialog::on_btn_clicked() {
|
||||
if (QPushButton* pBtn = qobject_cast<QPushButton*>(sender())) {
|
||||
if (QLabel* pLabel = pBtn->parent()->findChild< QLabel* >()) {
|
||||
//QMessageBox::information(this, "Button was clicked!", e->text());
|
||||
HotkeyMessageBox msgBox(this);
|
||||
//msgBox.setWindowTitle("Hotkey");
|
||||
//msgBox.setText("Press a key");
|
||||
msgBox.setInformativeText(QString("Press a key for ") + pLabel->text());
|
||||
//msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.exec();
|
||||
if (msgBox.m_nativeVK != 0) {
|
||||
const unsigned int hidCode = osal_virtual_key_to_hid(msgBox.m_nativeVK);
|
||||
for (quint32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) {
|
||||
QListWidgetItem * pItem = ui->hotkeyListWidget->item(idx);
|
||||
HotkeyItemWidget* pWgt = (HotkeyItemWidget*)ui->hotkeyListWidget->itemWidget(pItem);
|
||||
if (pWgt->hidCode() == hidCode) {
|
||||
QPushButton* pButton = pWgt->findChild<QPushButton*>();
|
||||
if (pButton != nullptr)
|
||||
pButton->setText(tr("Click me"));
|
||||
pWgt->setHidCode(0u);
|
||||
break;
|
||||
}
|
||||
}
|
||||
pBtn->setText(osal_keycode_name(hidCode));
|
||||
((HotkeyItemWidget*)pBtn->parent())->setHidCode(hidCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <QDialog>
|
||||
#include <QTreeWidgetItem>
|
||||
#include "QListWidget"
|
||||
|
||||
namespace Ui {
|
||||
class ConfigDialog;
|
||||
|
@ -78,10 +79,15 @@ private slots:
|
|||
|
||||
void on_n64DepthCompareComboBox_currentIndexChanged(int index);
|
||||
|
||||
void on_hotkeyListWidget_itemClicked(QListWidgetItem *item);
|
||||
|
||||
void on_btn_clicked();
|
||||
|
||||
private:
|
||||
void _init(bool reInit = false, bool blockCustomSettings = false);
|
||||
void _getTranslations(QStringList & _translationFiles) const;
|
||||
void _switchDest(bool isGame);
|
||||
QString _hotkeyDescription(quint32 _idx) const;
|
||||
|
||||
Ui::ConfigDialog *ui;
|
||||
QFont m_font;
|
||||
|
|
|
@ -94,8 +94,6 @@ void _loadSettings(QSettings & settings)
|
|||
config.textureFilter.txHiresEnable = settings.value("txHiresEnable", config.textureFilter.txHiresEnable).toInt();
|
||||
config.textureFilter.txHiresFullAlphaChannel = settings.value("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel).toInt();
|
||||
config.textureFilter.txHresAltCRC = settings.value("txHresAltCRC", config.textureFilter.txHresAltCRC).toInt();
|
||||
config.textureFilter.txDump = settings.value("txDump", config.textureFilter.txDump).toInt();
|
||||
config.textureFilter.txReloadHiresTex = settings.value("txReloadHiresTex", config.textureFilter.txReloadHiresTex).toInt();
|
||||
config.textureFilter.txForce16bpp = settings.value("txForce16bpp", config.textureFilter.txForce16bpp).toInt();
|
||||
config.textureFilter.txCacheCompression = settings.value("txCacheCompression", config.textureFilter.txCacheCompression).toInt();
|
||||
config.textureFilter.txSaveCache = settings.value("txSaveCache", config.textureFilter.txSaveCache).toInt();
|
||||
|
@ -138,6 +136,12 @@ void _loadSettings(QSettings & settings)
|
|||
config.onScreenDisplay.pos = settings.value("osdPos", config.onScreenDisplay.pos).toInt();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("hotkeys");
|
||||
for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) {
|
||||
config.hotkeys.keys[idx] = settings.value(Config::hotkeyIniName(idx), config.hotkeys.keys[idx]).toInt();
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("debug");
|
||||
config.debug.dumpMode = settings.value("dumpMode", config.debug.dumpMode).toInt();
|
||||
settings.endGroup();
|
||||
|
@ -272,8 +276,6 @@ void writeSettings(const QString & _strIniFolder)
|
|||
settings.setValue("txHiresEnable", config.textureFilter.txHiresEnable);
|
||||
settings.setValue("txHiresFullAlphaChannel", config.textureFilter.txHiresFullAlphaChannel);
|
||||
settings.setValue("txHresAltCRC", config.textureFilter.txHresAltCRC);
|
||||
settings.setValue("txDump", config.textureFilter.txDump);
|
||||
settings.setValue("txReloadHiresTex", config.textureFilter.txReloadHiresTex);
|
||||
settings.setValue("txForce16bpp", config.textureFilter.txForce16bpp);
|
||||
settings.setValue("txCacheCompression", config.textureFilter.txCacheCompression);
|
||||
settings.setValue("txSaveCache", config.textureFilter.txSaveCache);
|
||||
|
@ -304,6 +306,12 @@ void writeSettings(const QString & _strIniFolder)
|
|||
settings.setValue("osdPos", config.onScreenDisplay.pos);
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("hotkeys");
|
||||
for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) {
|
||||
settings.setValue(Config::hotkeyIniName(idx), config.hotkeys.keys[idx]);
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("debug");
|
||||
settings.setValue("dumpMode", config.debug.dumpMode);
|
||||
settings.endGroup();
|
||||
|
@ -467,8 +475,6 @@ void saveCustomRomSettings(const QString & _strIniFolder, const char * _strRomNa
|
|||
WriteCustomSetting(textureFilter, txHiresEnable);
|
||||
WriteCustomSetting(textureFilter, txHiresFullAlphaChannel);
|
||||
WriteCustomSetting(textureFilter, txHresAltCRC);
|
||||
WriteCustomSetting(textureFilter, txDump);
|
||||
WriteCustomSetting(textureFilter, txReloadHiresTex);
|
||||
WriteCustomSetting(textureFilter, txForce16bpp);
|
||||
WriteCustomSetting(textureFilter, txCacheCompression);
|
||||
WriteCustomSetting(textureFilter, txSaveCache);
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>559</width>
|
||||
<height>613</height>
|
||||
<width>747</width>
|
||||
<height>715</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -29,6 +29,9 @@
|
|||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -2687,29 +2690,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="textureDumpCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This option dumps textures on screen to a texture pack folder. </p><p>Hotkey:<br/>Use <span style=" font-weight:600;">D</span> to toggle texture dumping on or off</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Press 'd' to dump N64 textures (for texture artists)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="textureReloadCheckBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This option allows texture artists to reload hi-res textures while the game is running to instantly see how they look —big time saver!</p><p>Hotkey:<br/>Use <span style=" font-weight:600;">R</span> to reload textures from the texture pack<br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Press 'r' to reload hi-res textures (for texture artists)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -3656,6 +3636,20 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="hotkeyTab">
|
||||
<attribute name="title">
|
||||
<string>Hotkey</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_45">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_40">
|
||||
<item>
|
||||
<widget class="QListWidget" name="hotkeyListWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="debugTab">
|
||||
<attribute name="title">
|
||||
<string>Debug</string>
|
||||
|
@ -3946,54 +3940,6 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textureDumpCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>texDumpPathLabel</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>129</x>
|
||||
<y>356</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>125</x>
|
||||
<y>257</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textureDumpCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>texDumpPathLineEdit</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>385</x>
|
||||
<y>356</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>471</x>
|
||||
<y>255</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textureDumpCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>texDumpPathButton</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>525</x>
|
||||
<y>356</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>526</x>
|
||||
<y>257</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>gammaCorrectionCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
|
@ -4076,9 +4022,9 @@
|
|||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="factorButtonGroup"/>
|
||||
<buttongroup name="osdButtonGroup"/>
|
||||
<buttongroup name="fixTexrectCoordsButtonGroup"/>
|
||||
<buttongroup name="screenshotButtonGroup"/>
|
||||
<buttongroup name="factorButtonGroup"/>
|
||||
<buttongroup name="osdButtonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
134
src/Keys.cpp
134
src/Keys.cpp
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Keys, used by Glide64.
|
||||
// Since key codes are different for WinAPI and SDL, this difference is managed here
|
||||
// Created by Sergey 'Gonetz' Lipski, July 2009
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
#include "Platform.h"
|
||||
#include "Keys.h"
|
||||
#ifndef MUPENPLUSAPI
|
||||
#include "windows/GLideN64_windows.h"
|
||||
#endif
|
||||
|
||||
Glide64Keys::Glide64Keys()
|
||||
{
|
||||
#ifdef OS_WINDOWS
|
||||
m_keys[G64_VK_CONTROL] = 0x11;
|
||||
m_keys[G64_VK_ALT] = 0x12;
|
||||
m_keys[G64_VK_INSERT] = 0x2D;
|
||||
m_keys[G64_VK_LBUTTON] = 0x01;
|
||||
m_keys[G64_VK_UP] = 0x26;
|
||||
m_keys[G64_VK_DOWN] = 0x28;
|
||||
m_keys[G64_VK_LEFT] = 0x25;
|
||||
m_keys[G64_VK_RIGHT] = 0x27;
|
||||
m_keys[G64_VK_SPACE] = 0x20;
|
||||
m_keys[G64_VK_BACK] = 0x08;
|
||||
m_keys[G64_VK_SCROLL] = 0x91;
|
||||
m_keys[G64_VK_1] = 0x31;
|
||||
m_keys[G64_VK_2] = 0x32;
|
||||
m_keys[G64_VK_3] = 0x33;
|
||||
m_keys[G64_VK_4] = 0x34;
|
||||
m_keys[G64_VK_5] = 0x35;
|
||||
m_keys[G64_VK_6] = 0x36;
|
||||
m_keys[G64_VK_7] = 0x37;
|
||||
m_keys[G64_VK_8] = 0x38;
|
||||
m_keys[G64_VK_9] = 0x39;
|
||||
m_keys[G64_VK_0] = 0x30;
|
||||
m_keys[G64_VK_A] = 0x41;
|
||||
m_keys[G64_VK_B] = 0x42;
|
||||
m_keys[G64_VK_D] = 0x44;
|
||||
m_keys[G64_VK_F] = 0x46;
|
||||
m_keys[G64_VK_G] = 0x47;
|
||||
m_keys[G64_VK_Q] = 0x51;
|
||||
m_keys[G64_VK_R] = 0x52;
|
||||
m_keys[G64_VK_S] = 0x53;
|
||||
m_keys[G64_VK_V] = 0x56;
|
||||
m_keys[G64_VK_W] = 0x57;
|
||||
#else
|
||||
m_keys[G64_VK_CONTROL] = 306;
|
||||
m_keys[G64_VK_ALT] = 308;
|
||||
m_keys[G64_VK_INSERT] = 277;
|
||||
m_keys[G64_VK_LBUTTON] = 1;
|
||||
m_keys[G64_VK_UP] = 273;
|
||||
m_keys[G64_VK_DOWN] = 274;
|
||||
m_keys[G64_VK_LEFT] = 276;
|
||||
m_keys[G64_VK_RIGHT] = 275;
|
||||
m_keys[G64_VK_SPACE] = 32;
|
||||
m_keys[G64_VK_BACK] = 8;
|
||||
m_keys[G64_VK_SCROLL] = 302;
|
||||
m_keys[G64_VK_1] = 49;
|
||||
m_keys[G64_VK_2] = 50;
|
||||
m_keys[G64_VK_3] = 51;
|
||||
m_keys[G64_VK_4] = 52;
|
||||
m_keys[G64_VK_5] = 53;
|
||||
m_keys[G64_VK_6] = 54;
|
||||
m_keys[G64_VK_7] = 55;
|
||||
m_keys[G64_VK_8] = 56;
|
||||
m_keys[G64_VK_9] = 57;
|
||||
m_keys[G64_VK_0] = 48;
|
||||
m_keys[G64_VK_A] = 97;
|
||||
m_keys[G64_VK_B] = 98;
|
||||
m_keys[G64_VK_D] = 100;
|
||||
m_keys[G64_VK_F] = 102;
|
||||
m_keys[G64_VK_G] = 103;
|
||||
m_keys[G64_VK_Q] = 113;
|
||||
m_keys[G64_VK_R] = 114;
|
||||
m_keys[G64_VK_S] = 115;
|
||||
m_keys[G64_VK_V] = 118;
|
||||
m_keys[G64_VK_W] = 119;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isKeyPressed(int _key, int _mask)
|
||||
{
|
||||
static Glide64Keys g64Keys;
|
||||
#ifdef OS_WINDOWS
|
||||
#ifdef MUPENPLUSAPI
|
||||
return (GetAsyncKeyState(g64Keys[_key]) & _mask) != 0;
|
||||
#else
|
||||
return (GetAsyncKeyState(g64Keys[_key]) & _mask) != 0 && GetForegroundWindow() == hWnd;
|
||||
#endif
|
||||
#else
|
||||
// TODO
|
||||
#endif
|
||||
return 0;
|
||||
}
|
96
src/Keys.h
96
src/Keys.h
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Keys, used by Glide64.
|
||||
// Since key codes are different for WinAPI and SDL, this difference is managed here
|
||||
// Created by Sergey 'Gonetz' Lipski, July 2009
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
#ifndef Keys_H
|
||||
#define Keys_H
|
||||
|
||||
#define G64_VK_CONTROL 0
|
||||
#define G64_VK_ALT 1
|
||||
#define G64_VK_INSERT 2
|
||||
#define G64_VK_LBUTTON 3
|
||||
#define G64_VK_UP 4
|
||||
#define G64_VK_DOWN 5
|
||||
#define G64_VK_LEFT 6
|
||||
#define G64_VK_RIGHT 7
|
||||
#define G64_VK_SPACE 8
|
||||
#define G64_VK_BACK 9
|
||||
#define G64_VK_SCROLL 10
|
||||
#define G64_VK_1 11
|
||||
#define G64_VK_2 12
|
||||
#define G64_VK_3 13
|
||||
#define G64_VK_4 14
|
||||
#define G64_VK_5 15
|
||||
#define G64_VK_6 16
|
||||
#define G64_VK_7 17
|
||||
#define G64_VK_8 18
|
||||
#define G64_VK_9 19
|
||||
#define G64_VK_0 20
|
||||
#define G64_VK_A 21
|
||||
#define G64_VK_B 22
|
||||
#define G64_VK_D 23
|
||||
#define G64_VK_F 24
|
||||
#define G64_VK_G 25
|
||||
#define G64_VK_Q 26
|
||||
#define G64_VK_R 27
|
||||
#define G64_VK_S 28
|
||||
#define G64_VK_V 29
|
||||
#define G64_VK_W 30
|
||||
|
||||
#define G64_NUM_KEYS 31
|
||||
|
||||
class Glide64Keys
|
||||
{
|
||||
public:
|
||||
Glide64Keys();
|
||||
~Glide64Keys(){}
|
||||
int operator[](unsigned int index){return m_keys[index];}
|
||||
|
||||
private:
|
||||
int m_keys[G64_NUM_KEYS];
|
||||
};
|
||||
|
||||
bool isKeyPressed(int _key, int _mask);
|
||||
|
||||
#endif //Keys_H
|
|
@ -55,7 +55,7 @@ u32 TextureFilterHandler::_getConfigOptions() const
|
|||
options |= (DUMP_TEXCACHE | DUMP_HIRESTEXCACHE);
|
||||
if (config.textureFilter.txHiresFullAlphaChannel)
|
||||
options |= LET_TEXARTISTS_FLY;
|
||||
if (config.textureFilter.txDump)
|
||||
if (config.hotkeys.keys[Config::HotKey::hkTexDump] != 0)
|
||||
options |= DUMP_TEX;
|
||||
if (config.textureFilter.txDeposterize)
|
||||
options |= DEPOSTERIZE;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "convert.h"
|
||||
#include "FrameBuffer.h"
|
||||
#include "Config.h"
|
||||
#include "Keys.h"
|
||||
#include "GLideNHQ/Ext_TxFilter.h"
|
||||
#include "TextureFilterHandler.h"
|
||||
#include "DisplayLoadProgress.h"
|
||||
|
@ -802,7 +801,7 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
|
||||
if (m_toggleDumpTex &&
|
||||
config.textureFilter.txHiresEnable != 0 &&
|
||||
config.textureFilter.txDump != 0) {
|
||||
config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) {
|
||||
txfilter_dmptx((u8*)pDest, pTexture->width, pTexture->height,
|
||||
pTexture->width, (u16)u32(glInternalFormat),
|
||||
(unsigned short)(pTexture->format << 8 | pTexture->size),
|
||||
|
@ -1213,8 +1212,8 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
}
|
||||
|
||||
if (m_toggleDumpTex &&
|
||||
config.textureFilter.txHiresEnable != 0 &&
|
||||
config.textureFilter.txDump != 0) {
|
||||
config.textureFilter.txHiresEnable != 0 &&
|
||||
config.hotkeys.keys[Config::HotKey::hkTexDump] != 0) {
|
||||
txfilter_dmptx((u8*)texData.get(), tmptex.width, tmptex.height,
|
||||
tmptex.width, (u16)u32(glInternalFormat),
|
||||
(unsigned short)(_pTexture->format << 8 | _pTexture->size),
|
||||
|
@ -1517,7 +1516,7 @@ void TextureCache::_updateBackground()
|
|||
current[0] = pCurrent;
|
||||
}
|
||||
|
||||
void TextureCache::_clear()
|
||||
void TextureCache::clear()
|
||||
{
|
||||
current[0] = current[1] = nullptr;
|
||||
|
||||
|
@ -1528,35 +1527,21 @@ void TextureCache::_clear()
|
|||
m_lruTextureLocations.clear();
|
||||
}
|
||||
|
||||
void TextureCache::toggleDumpTex()
|
||||
{
|
||||
m_toggleDumpTex = !m_toggleDumpTex;
|
||||
if (m_toggleDumpTex) {
|
||||
displayLoadProgress(L"Texture dump - ON\n");
|
||||
clear();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
} else {
|
||||
displayLoadProgress(L"Texture dump - OFF\n");
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCache::update(u32 _t)
|
||||
{
|
||||
if (config.textureFilter.txHiresEnable != 0) {
|
||||
if (config.textureFilter.txReloadHiresTex != 0) {
|
||||
/* Force reload hi-res textures. Useful for texture artists */
|
||||
if (isKeyPressed(G64_VK_R, 0x0001)) {
|
||||
if (txfilter_reloadhirestex()) {
|
||||
_clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.textureFilter.txDump != 0) {
|
||||
/* Turn on texture dump */
|
||||
if (isKeyPressed(G64_VK_D, 0x0001)) {
|
||||
m_toggleDumpTex = !m_toggleDumpTex;
|
||||
if (m_toggleDumpTex) {
|
||||
displayLoadProgress(L"Texture dump - ON\n");
|
||||
_clear();
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
else {
|
||||
displayLoadProgress(L"Texture dump - OFF\n");
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gDPTile * pTile = gSP.textureTile[_t];
|
||||
switch (pTile->textureMode) {
|
||||
case TEXTUREMODE_BGIMAGE:
|
||||
|
|
|
@ -33,7 +33,7 @@ struct CachedTexture
|
|||
u16 width, height; // N64 width and height
|
||||
u16 clampWidth, clampHeight; // Size to clamp to
|
||||
f32 scaleS, scaleT; // Scale to map to 0.0-1.0
|
||||
f32 hdRatioS, hdRatioT; // HD / N64 width and height
|
||||
f32 hdRatioS, hdRatioT; // HD / N64 width and height
|
||||
f32 shiftScaleS, shiftScaleT; // Scale to shift
|
||||
u32 textureBytes;
|
||||
|
||||
|
@ -54,12 +54,14 @@ struct TextureCache
|
|||
|
||||
void init();
|
||||
void destroy();
|
||||
void clear();
|
||||
CachedTexture * addFrameBufferTexture(graphics::Parameter _target);
|
||||
void removeFrameBufferTexture(CachedTexture * _pTexture);
|
||||
void activateTexture(u32 _t, CachedTexture *_pTexture);
|
||||
void activateDummy(u32 _t);
|
||||
void activateMSDummy(u32 _t);
|
||||
void update(u32 _t);
|
||||
void toggleDumpTex();
|
||||
|
||||
static TextureCache & get();
|
||||
|
||||
|
@ -86,7 +88,6 @@ private:
|
|||
bool _loadHiresBackground(CachedTexture *_pTexture, u64 & _ricecrc);
|
||||
void _loadDepthTexture(CachedTexture * _pTexture, u16* _pDest);
|
||||
void _updateBackground();
|
||||
void _clear();
|
||||
void _initDummyTexture(CachedTexture * _pDummy);
|
||||
void _getTextureDestData(CachedTexture& tmptex, u32* pDest, graphics::Parameter glInternalFormat, GetTexelFunc GetTexel, u16* pLine);
|
||||
|
||||
|
|
95
src/VI.cpp
95
src/VI.cpp
|
@ -13,8 +13,9 @@
|
|||
#include "Performance.h"
|
||||
#include "Debugger.h"
|
||||
#include "DebugDump.h"
|
||||
#include "Keys.h"
|
||||
#include "osal_keys.h"
|
||||
#include "DisplayWindow.h"
|
||||
#include "GLideNHQ/Ext_TxFilter.h"
|
||||
#include <Graphics/Context.h>
|
||||
|
||||
using namespace std;
|
||||
|
@ -98,6 +99,94 @@ void VI_UpdateSize()
|
|||
VI.rheight = VI.height != 0 ? 1.0f / VI.height : 0.0f;
|
||||
}
|
||||
|
||||
static void checkHotkeys()
|
||||
{
|
||||
if (osal_is_key_pressed(KEY_G, 0x0001)) {
|
||||
SwitchDump(config.debug.dumpMode);
|
||||
}
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkHdTexToggle], 0x0001)) {
|
||||
if (config.textureFilter.txHiresEnable == 0)
|
||||
dwnd().getDrawer().showMessage("Enable HD textures\n", Milliseconds(750));
|
||||
else
|
||||
dwnd().getDrawer().showMessage("Disable HD textures\n", Milliseconds(750));
|
||||
config.textureFilter.txHiresEnable = !config.textureFilter.txHiresEnable;
|
||||
textureCache().clear();
|
||||
}
|
||||
|
||||
if (config.textureFilter.txHiresEnable != 0) {
|
||||
/* Force reload hi-res textures. Useful for texture artists */
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkHdTexReload], 0x0001)) {
|
||||
dwnd().getDrawer().showMessage("Reload HD textures\n", Milliseconds(750));
|
||||
if (txfilter_reloadhirestex()) {
|
||||
textureCache().clear();
|
||||
}
|
||||
}
|
||||
|
||||
/* Turn on texture dump */
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkTexDump], 0x0001))
|
||||
textureCache().toggleDumpTex();
|
||||
}
|
||||
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkVsync], 0x0001)) {
|
||||
config.video.verticalSync = !config.video.verticalSync;
|
||||
dwnd().stop();
|
||||
dwnd().start();
|
||||
if (config.video.verticalSync == 0)
|
||||
dwnd().getDrawer().showMessage("Disable vertical sync\n", Milliseconds(1000));
|
||||
else
|
||||
dwnd().getDrawer().showMessage("Enable vertical sync\n", Milliseconds(1000));
|
||||
}
|
||||
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkFBEmulation], 0x0001)) {
|
||||
config.frameBufferEmulation.enable = !config.frameBufferEmulation.enable;
|
||||
dwnd().stop();
|
||||
dwnd().start();
|
||||
if (config.frameBufferEmulation.enable == 0)
|
||||
dwnd().getDrawer().showMessage("Disable frame buffer emulation\n", Milliseconds(2000));
|
||||
else
|
||||
dwnd().getDrawer().showMessage("Enable frame buffer emulation\n", Milliseconds(1000));
|
||||
}
|
||||
|
||||
if (config.frameBufferEmulation.enable != 0 &&
|
||||
osal_is_key_pressed(config.hotkeys.keys[Config::hkN64DepthCompare], 0x0001)) {
|
||||
static u32 N64DepthCompare = Config::N64DepthCompareMode::dcCompatible;
|
||||
if (config.frameBufferEmulation.N64DepthCompare != Config::N64DepthCompareMode::dcDisable) {
|
||||
N64DepthCompare = config.frameBufferEmulation.N64DepthCompare;
|
||||
config.frameBufferEmulation.N64DepthCompare = Config::N64DepthCompareMode::dcDisable;
|
||||
} else
|
||||
config.frameBufferEmulation.N64DepthCompare = N64DepthCompare;
|
||||
dwnd().stop();
|
||||
dwnd().start();
|
||||
if (config.frameBufferEmulation.N64DepthCompare == Config::N64DepthCompareMode::dcDisable)
|
||||
dwnd().getDrawer().showMessage("Disable N64 depth compare\n", Milliseconds(1000));
|
||||
else
|
||||
dwnd().getDrawer().showMessage("Enable N64 depth compare\n", Milliseconds(1000));
|
||||
}
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdVis], 0x0001)) {
|
||||
config.onScreenDisplay.vis = !config.onScreenDisplay.vis;
|
||||
}
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdFps], 0x0001)) {
|
||||
config.onScreenDisplay.fps = !config.onScreenDisplay.fps;
|
||||
}
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdPercent], 0x0001)) {
|
||||
config.onScreenDisplay.percent = !config.onScreenDisplay.percent;
|
||||
}
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdInternalResolution], 0x0001)) {
|
||||
config.onScreenDisplay.internalResolution = !config.onScreenDisplay.internalResolution;
|
||||
}
|
||||
|
||||
if (osal_is_key_pressed(config.hotkeys.keys[Config::hkOsdRenderingResolution], 0x0001)) {
|
||||
config.onScreenDisplay.renderingResolution = !config.onScreenDisplay.renderingResolution;
|
||||
}
|
||||
}
|
||||
|
||||
void VI_UpdateScreen()
|
||||
{
|
||||
if (VI.lastOrigin == -1) // Workaround for Mupen64Plus issue with initialization
|
||||
|
@ -117,9 +206,7 @@ void VI_UpdateScreen()
|
|||
wnd.saveScreenshot();
|
||||
g_debugger.checkDebugState();
|
||||
|
||||
if (isKeyPressed(G64_VK_G, 0x0001)) {
|
||||
SwitchDump(config.debug.dumpMode);
|
||||
}
|
||||
checkHotkeys();
|
||||
|
||||
bool bVIUpdated = false;
|
||||
if (*REG.VI_ORIGIN != VI.lastOrigin) {
|
||||
|
|
|
@ -18,6 +18,74 @@ Config config;
|
|||
m64p_handle g_configVideoGeneral = nullptr;
|
||||
m64p_handle g_configVideoGliden64 = nullptr;
|
||||
|
||||
static
|
||||
const char* _hotkeyDescription(u32 _idx)
|
||||
{
|
||||
switch (_idx)
|
||||
{
|
||||
case Config::HotKey::hkTexDump:
|
||||
return "Hotkey: toggle textures dump";
|
||||
case Config::HotKey::hkHdTexReload:
|
||||
return "Hotkey: reload HD textures";
|
||||
case Config::HotKey::hkHdTexToggle:
|
||||
return "Hotkey: toggle HD textures";
|
||||
case Config::HotKey::hkVsync:
|
||||
return "Hotkey: toggle VSync";
|
||||
case Config::HotKey::hkFBEmulation:
|
||||
return "Hotkey: toggle frame buffer emulation";
|
||||
case Config::HotKey::hkN64DepthCompare:
|
||||
return "Hotkey: toggle N64 depth compare";
|
||||
case Config::HotKey::hkOsdVis:
|
||||
return "Hotkey: toggle OSD VI/S";
|
||||
case Config::HotKey::hkOsdFps:
|
||||
return "Hotkey: toggle OSD FPS";
|
||||
case Config::HotKey::hkOsdPercent:
|
||||
return "Hotkey: toggle OSD percent";
|
||||
case Config::HotKey::hkOsdInternalResolution:
|
||||
return "Hotkey: toggle OSD internal resolution";
|
||||
case Config::HotKey::hkOsdRenderingResolution:
|
||||
return "Hotkey: toggle OSD rendering resolution";
|
||||
}
|
||||
return "Unknown hotkey";
|
||||
}
|
||||
|
||||
//static const unsigned char HID_TO_ASCII[256] = {
|
||||
// 0, 0, 0, 0, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
|
||||
// 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 49, 50,
|
||||
// 51, 52, 53, 54, 55, 56, 57, 48, 0, 0, 0, 32, 45, 43, 91, 93,
|
||||
// 92, 59, 34, 0, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
//};
|
||||
|
||||
static
|
||||
u8 ASCIItoHID(const char * pStr) {
|
||||
static const unsigned char ASCII_TO_HID[128] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, 0, 0, 0, 0, 0,
|
||||
0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
if (strlen(pStr) != 1 || pStr[0] < 0)
|
||||
return 0;
|
||||
return ASCII_TO_HID[pStr[0]];
|
||||
}
|
||||
|
||||
bool Config_SetDefault()
|
||||
{
|
||||
if (ConfigOpenSection("Video-General", &g_configVideoGeneral) != M64ERR_SUCCESS) {
|
||||
|
@ -167,10 +235,6 @@ bool Config_SetDefault()
|
|||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "txHresAltCRC", config.textureFilter.txHresAltCRC, "Use alternative method of paletted textures CRC calculation.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "txDump", config.textureFilter.txDump, "Press 'd' to start dump of N64 textures.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "txReloadHiresTex", config.textureFilter.txReloadHiresTex, "Press 'r' to reload HD textures.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "txCacheCompression", config.textureFilter.txCacheCompression, "Zip textures cache.");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
res = ConfigSetDefaultBool(g_configVideoGliden64, "txForce16bpp", config.textureFilter.txForce16bpp, "Force use 16bit texture formats for HD textures.");
|
||||
|
@ -221,6 +285,12 @@ bool Config_SetDefault()
|
|||
"Counters position (1=top left, 2=top center, 4=top right, 8=bottom left, 16=bottom center, 32=bottom right)");
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
|
||||
//#Hotkey settings
|
||||
for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) {
|
||||
res = ConfigSetDefaultString(g_configVideoGliden64, Config::hotkeyIniName(idx), "", _hotkeyDescription(idx));
|
||||
assert(res == M64ERR_SUCCESS);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DUMP
|
||||
//#Debug settings
|
||||
res = ConfigSetDefaultInt(g_configVideoGliden64, "DebugDumpMode", config.debug.dumpMode, "Enable debug dump. Set 3 to normal or 7 to detailed dump.");
|
||||
|
@ -370,10 +440,6 @@ void Config_LoadCustomConfig()
|
|||
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txHresAltCRC", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.textureFilter.txHresAltCRC = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txDump", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.textureFilter.txDump = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txReloadHiresTex", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.textureFilter.txReloadHiresTex = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txForce16bpp", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.textureFilter.txForce16bpp = atoi(value);
|
||||
result = ConfigExternalGetParameter(fileHandle, sectionName, "textureFilter\\txCacheCompression", value, sizeof(value));
|
||||
if (result == M64ERR_SUCCESS) config.textureFilter.txCacheCompression = atoi(value);
|
||||
|
@ -464,8 +530,6 @@ void Config_LoadConfig()
|
|||
config.textureFilter.txHiresEnable = ConfigGetParamBool(g_configVideoGliden64, "txHiresEnable");
|
||||
config.textureFilter.txHiresFullAlphaChannel = ConfigGetParamBool(g_configVideoGliden64, "txHiresFullAlphaChannel");
|
||||
config.textureFilter.txHresAltCRC = ConfigGetParamBool(g_configVideoGliden64, "txHresAltCRC");
|
||||
config.textureFilter.txDump = ConfigGetParamBool(g_configVideoGliden64, "txDump");
|
||||
config.textureFilter.txReloadHiresTex = ConfigGetParamBool(g_configVideoGliden64, "txReloadHiresTex");
|
||||
config.textureFilter.txForce16bpp = ConfigGetParamBool(g_configVideoGliden64, "txForce16bpp");
|
||||
config.textureFilter.txCacheCompression = ConfigGetParamBool(g_configVideoGliden64, "txCacheCompression");
|
||||
config.textureFilter.txSaveCache = ConfigGetParamBool(g_configVideoGliden64, "txSaveCache");
|
||||
|
@ -508,6 +572,11 @@ void Config_LoadConfig()
|
|||
config.onScreenDisplay.renderingResolution = ConfigGetParamBool(g_configVideoGliden64, "ShowRenderingResolution");
|
||||
config.onScreenDisplay.pos = ConfigGetParamInt(g_configVideoGliden64, "CountersPos");
|
||||
|
||||
//#Hotkey settings
|
||||
for (u32 idx = 0; idx < Config::HotKey::hkTotal; ++idx) {
|
||||
config.hotkeys.keys[idx] = ASCIItoHID(ConfigGetParamString(g_configVideoGliden64, Config::hotkeyIniName(idx)));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DUMP
|
||||
config.debug.dumpMode = ConfigGetParamInt(g_configVideoGliden64, "DebugDumpMode");
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@ project( osal )
|
|||
LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/lib )
|
||||
|
||||
if(UNIX)
|
||||
set(OSAL_SOURCES osal_files_unix.c)
|
||||
set(OSAL_SOURCES osal_files_unix.c osal_keys_unix.c)
|
||||
add_definitions(
|
||||
-DNDEBUG
|
||||
-DOS_LINUX
|
||||
|
@ -13,7 +13,7 @@ if(UNIX)
|
|||
endif(UNIX)
|
||||
|
||||
if(WIN32)
|
||||
set(OSAL_SOURCES osal_files_win32.c)
|
||||
set(OSAL_SOURCES osal_files_win32.c osal_keys_win.c)
|
||||
add_definitions(
|
||||
-DOS_WINDOWS
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
|
|
148
src/osal/keycode/keycode.h
Normal file
148
src/osal/keycode/keycode.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
/* This file is automatically generated. */
|
||||
#ifndef KEYCODE_KEYCODE_H
|
||||
#define KEYCODE_KEYCODE_H
|
||||
|
||||
/* HID keycode definitions. These keycodes are portable, and correspond to
|
||||
locations on the keyboard. For example, the keycode KEY_A corresponds to the
|
||||
"A" key on US keyboard layouts, but KEY_A corresponds to the "Q" key on
|
||||
French keyboard layouts. In either case, KEY_A is in the same physical
|
||||
location on the keyboard.
|
||||
|
||||
Platform-specific scancodes can be converted to the HID keycodes defined
|
||||
here, see keytable.h. All keycodes which can be generated on at least one
|
||||
platform are included here, but not all platforms will produce all keycodes.
|
||||
The names of these keycodes are taken, with some modifications, from the HID
|
||||
usage tables. Key codes starting with KEY are general keys, and the keys on
|
||||
the numeric keypad have key codes starting with KP. */
|
||||
enum {
|
||||
/* Zero, does not correspond to any key. */
|
||||
KEY_None = 0,
|
||||
|
||||
/* Keycode definitions. */
|
||||
KEY_A = 4,
|
||||
KEY_B = 5,
|
||||
KEY_C = 6,
|
||||
KEY_D = 7,
|
||||
KEY_E = 8,
|
||||
KEY_F = 9,
|
||||
KEY_G = 10,
|
||||
KEY_H = 11,
|
||||
KEY_I = 12,
|
||||
KEY_J = 13,
|
||||
KEY_K = 14,
|
||||
KEY_L = 15,
|
||||
KEY_M = 16,
|
||||
KEY_N = 17,
|
||||
KEY_O = 18,
|
||||
KEY_P = 19,
|
||||
KEY_Q = 20,
|
||||
KEY_R = 21,
|
||||
KEY_S = 22,
|
||||
KEY_T = 23,
|
||||
KEY_U = 24,
|
||||
KEY_V = 25,
|
||||
KEY_W = 26,
|
||||
KEY_X = 27,
|
||||
KEY_Y = 28,
|
||||
KEY_Z = 29,
|
||||
KEY_1 = 30,
|
||||
KEY_2 = 31,
|
||||
KEY_3 = 32,
|
||||
KEY_4 = 33,
|
||||
KEY_5 = 34,
|
||||
KEY_6 = 35,
|
||||
KEY_7 = 36,
|
||||
KEY_8 = 37,
|
||||
KEY_9 = 38,
|
||||
KEY_0 = 39,
|
||||
KEY_Escape = 41,
|
||||
KEY_Delete = 42,
|
||||
KEY_Tab = 43,
|
||||
KEY_Space = 44,
|
||||
KEY_Minus = 45,
|
||||
KEY_Equals = 46,
|
||||
KEY_LeftBracket = 47,
|
||||
KEY_RightBracket = 48,
|
||||
KEY_Backslash = 49,
|
||||
KEY_Semicolon = 51,
|
||||
KEY_Quote = 52,
|
||||
KEY_Grave = 53,
|
||||
KEY_Comma = 54,
|
||||
KEY_Period = 55,
|
||||
KEY_Slash = 56,
|
||||
KEY_CapsLock = 57,
|
||||
KEY_F1 = 58,
|
||||
KEY_F2 = 59,
|
||||
KEY_F3 = 60,
|
||||
KEY_F4 = 61,
|
||||
KEY_F5 = 62,
|
||||
KEY_F6 = 63,
|
||||
KEY_F7 = 64,
|
||||
KEY_F8 = 65,
|
||||
KEY_F9 = 66,
|
||||
KEY_F10 = 67,
|
||||
KEY_F11 = 68,
|
||||
KEY_F12 = 69,
|
||||
KEY_PrintScreen = 70,
|
||||
KEY_ScrollLock = 71,
|
||||
KEY_Pause = 72,
|
||||
KEY_Insert = 73,
|
||||
KEY_Home = 74,
|
||||
KEY_PageUp = 75,
|
||||
KEY_DeleteForward = 76,
|
||||
KEY_End = 77,
|
||||
KEY_PageDown = 78,
|
||||
KEY_Right = 79,
|
||||
KEY_Left = 80,
|
||||
KEY_Down = 81,
|
||||
KEY_Up = 82,
|
||||
KP_NumLock = 83,
|
||||
KP_Divide = 84,
|
||||
KP_Multiply = 85,
|
||||
KP_Subtract = 86,
|
||||
KP_Add = 87,
|
||||
KP_Enter = 88,
|
||||
KP_1 = 89,
|
||||
KP_2 = 90,
|
||||
KP_3 = 91,
|
||||
KP_4 = 92,
|
||||
KP_5 = 93,
|
||||
KP_6 = 94,
|
||||
KP_7 = 95,
|
||||
KP_8 = 96,
|
||||
KP_9 = 97,
|
||||
KP_0 = 98,
|
||||
KP_Point = 99,
|
||||
KEY_NonUSBackslash = 100,
|
||||
KP_Equals = 103,
|
||||
KEY_F13 = 104,
|
||||
KEY_F14 = 105,
|
||||
KEY_F15 = 106,
|
||||
KEY_F16 = 107,
|
||||
KEY_F17 = 108,
|
||||
KEY_F18 = 109,
|
||||
KEY_F19 = 110,
|
||||
KEY_F20 = 111,
|
||||
KEY_F21 = 112,
|
||||
KEY_F22 = 113,
|
||||
KEY_F23 = 114,
|
||||
KEY_F24 = 115,
|
||||
KEY_Help = 117,
|
||||
KEY_Menu = 118,
|
||||
KEY_Mute = 127,
|
||||
KEY_SysReq = 154,
|
||||
KEY_Return = 158,
|
||||
KP_Clear = 216,
|
||||
KP_Decimal = 220,
|
||||
KEY_LeftControl = 224,
|
||||
KEY_LeftShift = 225,
|
||||
KEY_LeftAlt = 226,
|
||||
KEY_LeftGUI = 227,
|
||||
KEY_RightControl = 228,
|
||||
KEY_RightShift = 229,
|
||||
KEY_RightAlt = 230,
|
||||
KEY_RightGUI = 231,
|
||||
MB_Left = 233 // GLideN64 - specific. Not an actual HID keycode.
|
||||
};
|
||||
|
||||
#endif
|
12
src/osal/osal_export.h
Normal file
12
src/osal/osal_export.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#if !defined(OSAL_EXPORT_H)
|
||||
#define OSAL_EXPORT_H
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#define CALL __cdecl
|
||||
#else /* Not WINDOWS */
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#define CALL
|
||||
#endif
|
||||
|
||||
#endif /* #define OSAL_EXPORT_H */
|
|
@ -26,6 +26,8 @@
|
|||
#if !defined(OSAL_FILES_H)
|
||||
#define OSAL_FILES_H
|
||||
|
||||
#include "osal_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -34,15 +36,11 @@ extern "C" {
|
|||
#define OSAL_DIR_SEPARATOR_CHAR L'/'
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#define CALL __cdecl
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX _MAX_PATH
|
||||
#endif
|
||||
#define strdup _strdup
|
||||
#else /* Not WIN32 */
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#define CALL
|
||||
#else /* Not WINDOWS */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 260
|
||||
#endif
|
||||
|
|
22
src/osal/osal_keys.h
Normal file
22
src/osal/osal_keys.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#if !defined(OSAL_KEYS_H)
|
||||
#define OSAL_KEYS_H
|
||||
|
||||
#include "osal_export.h"
|
||||
#include "keycode/keycode.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
EXPORT unsigned int CALL osal_is_key_pressed(unsigned int _key, unsigned int _mask);
|
||||
|
||||
EXPORT unsigned int CALL osal_virtual_key_to_hid(unsigned int _key);
|
||||
|
||||
EXPORT const char * CALL osal_keycode_name(unsigned int _hidCode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* #define OSAL_KEYS_H */
|
||||
|
24
src/osal/osal_keys_unix.c
Normal file
24
src/osal/osal_keys_unix.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include "osal_keys.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
EXPORT unsigned int CALL osal_is_key_pressed(unsigned int _key, unsigned int _mask)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT unsigned int CALL osal_virtual_key_to_hid(unsigned int _key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT const char * CALL osal_keycode_name(unsigned int _hidCode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
92
src/osal/osal_keys_win.c
Normal file
92
src/osal/osal_keys_win.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
#include <windows.h>
|
||||
#include "osal_keys.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static const unsigned char WIN_HID_TO_NATIVE[256] = {
|
||||
255,255,255,255, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
|
||||
77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 49, 50,
|
||||
51, 52, 53, 54, 55, 56, 57, 48, 13, 27, 8, 9, 32,189,187,219,
|
||||
221,220,255,186,222,192,188,190,191, 20,112,113,114,115,116,117,
|
||||
118,119,120,121,122,123, 44,145, 19, 45, 36, 33, 46, 35, 34, 39,
|
||||
37, 40, 38,144,111,106,109,107,255, 97, 98, 99,100,101,102,103,
|
||||
104,105, 96,110,255,255,255,255,124,125,126,127,128,129,130,131,
|
||||
132,133,134,135,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
17, 16, 18,255,255,255,255,255,255, 1,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
|
||||
};
|
||||
|
||||
static const unsigned char WIN_NATIVE_TO_HID[256] = {
|
||||
255,255,255,255,255,255,255,255, 42, 43,255,255,255, 40,255,255,
|
||||
225,224,226, 72, 57,255,255,255,255,255,255, 41,255,255,255,255,
|
||||
44, 75, 78, 77, 74, 80, 82, 79, 81,255,255,255, 70, 73, 76,255,
|
||||
39, 30, 31, 32, 33, 34, 35, 36, 37, 38,255,255,255,255,255,255,
|
||||
255, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,255,255,255,255,255,
|
||||
98, 89, 90, 91, 92, 93, 94, 95, 96, 97, 85, 87,255, 86, 99, 84,
|
||||
58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,104,105,106,107,
|
||||
108,109,110,111,112,113,114,115,255,255,255,255,255,255,255,255,
|
||||
83, 71,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255, 51, 46, 54, 45, 55, 56,
|
||||
53,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255, 47, 49, 48, 52,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
|
||||
};
|
||||
|
||||
static const char KEYCODE_WINDOWS_NAME_DATA[] =
|
||||
"\0'\0,\0-\0.\0/\0;\0=\0A\0B\0Backspace\0C\0Caps Lock\0D\0Delete\0E\0End\0"
|
||||
"Enter\0Escape\0F\0F1\0F10\0F11\0F12\0F2\0F3\0F4\0F5\0F6\0F7\0F8\0F9\0G\0H"
|
||||
"\0Home\0I\0Insert\0J\0K\0L\0Left\0Left Alt\0Left Control\0Left Shift\0Lef"
|
||||
"t Windows\0M\0N\0O\0P\0Page Down\0Page Up\0Pause\0Print Screen\0Q\0R\0Rig"
|
||||
"ht\0Right Alt\0Right Control\0Right Shift\0Right Windows\0S\0Scroll Lock"
|
||||
"\0T\0Tab\0U\0V\0W\0X\0Y\0Z\0[\0\\\0]\0`";
|
||||
static const unsigned short KEYCODE_WINDOWS_NAME_OFFSET[] = {
|
||||
0,0,0,0,15,17,29,41,50,69,110,112,119,128,130,132,185,187,189,191,230,232,
|
||||
290,304,310,312,314,316,318,320,72,84,90,93,96,99,102,105,108,76,0,62,19,
|
||||
306,0,5,13,322,326,324,0,11,1,328,3,7,9,31,71,86,89,92,95,98,101,104,107,74,
|
||||
78,82,217,292,211,121,114,203,43,52,193,234,134,198,208,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,148,161,139,172,250,264,240,276
|
||||
};
|
||||
|
||||
|
||||
EXPORT unsigned int CALL osal_is_key_pressed(unsigned int _key, unsigned int _mask)
|
||||
{
|
||||
if (_key == 0 || _key > 255)
|
||||
return 0;
|
||||
return GetAsyncKeyState(WIN_HID_TO_NATIVE[_key]) & _mask;
|
||||
}
|
||||
|
||||
EXPORT unsigned int CALL osal_virtual_key_to_hid(unsigned int _key)
|
||||
{
|
||||
if (_key < 256)
|
||||
return WIN_NATIVE_TO_HID[_key];
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT const char * CALL osal_keycode_name(unsigned int _hidCode)
|
||||
{
|
||||
unsigned offset;
|
||||
if (232 <= _hidCode)
|
||||
return NULL;
|
||||
offset = KEYCODE_WINDOWS_NAME_OFFSET[_hidCode];
|
||||
if (offset == 0)
|
||||
return NULL;
|
||||
return KEYCODE_WINDOWS_NAME_DATA + offset;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user