mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-07-11 09:34:00 +02:00
Compare commits
21 Commits
core-rsp-patch
...
v0.5.9
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a30160398 | |||
| 478f226cad | |||
| 6746711bc3 | |||
| 7bd9c320ea | |||
| ec197c3ee9 | |||
| 4c000101e3 | |||
| 4107ee598b | |||
| 1b4820c7f7 | |||
| cc398720b6 | |||
| 256d1c512a | |||
| 642e768e92 | |||
| 8660efe2dc | |||
| a47160714a | |||
| 9155faf1d2 | |||
| 042717c3a4 | |||
| 5e0c5bfbb0 | |||
| 08ff5a5ad4 | |||
| b89655e4b3 | |||
| c6cbda856b | |||
| b5b97b187a | |||
| c6ec9c0686 |
@@ -377,3 +377,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F30F6 0008
|
||||
811E6F06 FFFD
|
||||
D01F30F6 0004
|
||||
811E6F06 0000
|
||||
D01F30F6 0002
|
||||
811E6F06 FFFE
|
||||
|
||||
@@ -421,3 +421,12 @@ D03E6B3A 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01FB876 0008
|
||||
811EF686 FFFD
|
||||
D01FB876 0004
|
||||
811EF686 0000
|
||||
D01FB876 0002
|
||||
811EF686 FFFE
|
||||
|
||||
@@ -361,3 +361,12 @@ D03E6FCA 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01FBC96 0008
|
||||
811EF726 FFFD
|
||||
D01FBC96 0004
|
||||
811EF726 0000
|
||||
D01FBC96 0002
|
||||
811EF726 FFFE
|
||||
|
||||
@@ -388,3 +388,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F0496 0008
|
||||
811E5496 FFFD
|
||||
D01F0496 0004
|
||||
811E5496 0000
|
||||
D01F0496 0002
|
||||
811E5496 FFFE
|
||||
|
||||
@@ -383,3 +383,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F8836 0008
|
||||
811ED836 FFFD
|
||||
D01F8836 0004
|
||||
811ED836 0000
|
||||
D01F8836 0002
|
||||
811ED836 FFFE
|
||||
|
||||
@@ -418,3 +418,12 @@ D03E4CFA 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F88A0 0008
|
||||
811ED846 FFFD
|
||||
D01F88A0 0004
|
||||
811ED846 0000
|
||||
D01F88A0 0002
|
||||
811ED846 FFFE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[C0F6DB17-80E0D532-C:44]
|
||||
Name=Armorines Project S.
|
||||
Name=Armorines - Project S.W.A.R.M. (G)
|
||||
|
||||
$[Press L For Levitate]
|
||||
D10F7550 0020
|
||||
|
||||
@@ -394,3 +394,12 @@ Note=Put this code on and it will now take where you wanted to go, turn it back
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01F2D56 0008
|
||||
811E6B66 FFFD
|
||||
D01F2D56 0004
|
||||
811E6B66 0000
|
||||
D01F2D56 0002
|
||||
811E6B66 FFFE
|
||||
|
||||
@@ -361,3 +361,12 @@ D05EC55A 0000
|
||||
9214 Zora Shop
|
||||
B214 Snowhead (Path to temple - warp in)
|
||||
D214 East Clock Down
|
||||
|
||||
$Time Control
|
||||
Note=Control the speed of time with the D-pad. Up stops the time, left enables double time, and down restores the notmal speed.
|
||||
D01FBA40 0008
|
||||
811EF476 FFFD
|
||||
D01FBA40 0004
|
||||
811EF476 0000
|
||||
D01FBA40 0002
|
||||
811EF476 FFFE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Maintainer: Rosalie Wanders <rosalie@mailbox.org>
|
||||
pkgname=rmg
|
||||
pkgver=0.5.8
|
||||
pkgver=0.5.9
|
||||
pkgrel=1
|
||||
pkgdesc="Rosalie's Mupen GUI"
|
||||
arch=('x86_64' 'aarch64')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Name: RMG
|
||||
Version: 0.5.8
|
||||
Version: 0.5.9
|
||||
Release: %autorelease
|
||||
Summary: Rosalie's Mupen GUI
|
||||
|
||||
|
||||
@@ -33,6 +33,22 @@
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release version="v0.5.9" date="2024-05-01" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
<ul>
|
||||
<li>Fix parallel-rsp regression introduced in v0.5.8</li>
|
||||
<li>Fix corruption when using GLideN64 and resizing the window</li>
|
||||
<li>Fix changing save state slot always selecting slot 0 on some system configurations</li>
|
||||
<li>Fix changing speed factor always using 0% on some system configurations</li>
|
||||
<li>Add color settings for the OSD in the settings dialog</li>
|
||||
<li>Add 'Test Rumble' button to the options dialog in RMG-Input</li>
|
||||
<li>Add 'Play Game with State' to the context menu of the ROM browser</li>
|
||||
<li>Add '--load-state-slot' commandline option</li>
|
||||
<li>Update cheats and GLideN64</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="v0.5.8" date="2024-03-25" type="stable">
|
||||
<description>
|
||||
<p>Changes:</p>
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
[subrepo]
|
||||
remote = git@github.com:/Rosalie241/parallel-rsp.git
|
||||
branch = RMG
|
||||
commit = 71f52c492ac5896a02725152a0e6c59036ee9576
|
||||
parent = e8f10693c73eeed017f45cf8289a3763ae16c257
|
||||
commit = f7c164cf0c4131f6cfbcaefba9af3c8eaf6df1b0
|
||||
parent = eb6dd8068ef4d82e47807ebccca0444d2e3300e2
|
||||
method = merge
|
||||
cmdver = 0.4.6
|
||||
|
||||
@@ -40,6 +40,7 @@ extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 // FIXME: this is broken with upstream mupen64plus-core
|
||||
if (rd == CP0_REGISTER_SP_SEMAPHORE)
|
||||
{
|
||||
if (*rsp->cp0.cr[CP0_REGISTER_SP_SEMAPHORE])
|
||||
@@ -56,6 +57,7 @@ extern "C"
|
||||
else
|
||||
*rsp->cp0.cr[CP0_REGISTER_SP_SEMAPHORE] = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//if (rd == 4) // SP_STATUS_REG
|
||||
// fprintf(stderr, "READING STATUS REG!\n");
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
[subrepo]
|
||||
remote = git@github.com:/gonetz/GLideN64.git
|
||||
branch = master
|
||||
commit = ded38f88aafb41bd3db574f2ec9f101b9bdba355
|
||||
parent = 363131c1753ababf6d7745be6b850fe0e767e008
|
||||
commit = 576ad87594e0f8f1908302a49b8a4d812facf3d4
|
||||
parent = 4c000101e397911541532a43fce07ff879d1c174
|
||||
method = merge
|
||||
cmdver = 0.4.6
|
||||
|
||||
@@ -369,7 +369,6 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\N64.cpp" />
|
||||
<ClCompile Include="..\..\src\NoiseTexture.cpp" />
|
||||
<ClCompile Include="..\..\src\PaletteTexture.cpp" />
|
||||
<ClCompile Include="..\..\src\Performance.cpp" />
|
||||
<ClCompile Include="..\..\src\PostProcessor.cpp" />
|
||||
@@ -520,7 +519,6 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_qt' Or '$(Configuration)'=='Debug_wtl' Or '$(Configuration)'=='Release_qt' Or '$(Configuration)'=='Release_wtl'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\N64.h" />
|
||||
<ClInclude Include="..\..\src\NoiseTexture.h" />
|
||||
<ClInclude Include="..\..\src\PaletteTexture.h" />
|
||||
<ClInclude Include="..\..\src\Performance.h" />
|
||||
<ClInclude Include="..\..\src\Platform.h" />
|
||||
|
||||
-6
@@ -245,9 +245,6 @@
|
||||
<ClCompile Include="..\..\src\Graphics\OpenGLContext\GLSL\glsl_CombinerInputs.cpp">
|
||||
<Filter>Source Files\Graphics\OpenGL\GLSL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\NoiseTexture.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ZlutTexture.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -610,9 +607,6 @@
|
||||
<ClInclude Include="..\..\src\Graphics\OpenGLContext\GLSL\glsl_CombinerInputs.h">
|
||||
<Filter>Header Files\Graphics\OpenGL\GLSL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\NoiseTexture.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\Graphics\ShaderProgram.h">
|
||||
<Filter>Header Files\Graphics</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -59,7 +59,6 @@ set(GLideN64_SOURCES
|
||||
gSP.cpp
|
||||
Log.cpp
|
||||
N64.cpp
|
||||
NoiseTexture.cpp
|
||||
PaletteTexture.cpp
|
||||
Performance.cpp
|
||||
PostProcessor.cpp
|
||||
@@ -192,7 +191,7 @@ if( NOT CMAKE_BUILD_TYPE)
|
||||
set( CMAKE_BUILD_TYPE Release)
|
||||
endif( NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR
|
||||
CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
set(GLIDEN64_BUILD_TYPE Release)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
||||
@@ -73,7 +73,11 @@ void Config::resetToDefaults()
|
||||
frameBufferEmulation.copyDepthToRDRAM = cdSoftwareRender;
|
||||
frameBufferEmulation.copyFromRDRAM = 0;
|
||||
frameBufferEmulation.copyAuxToRDRAM = 0;
|
||||
#ifdef M64P_GLIDENUI
|
||||
frameBufferEmulation.copyToRDRAM = ctSync;
|
||||
#else
|
||||
frameBufferEmulation.copyToRDRAM = ctDoubleBuffer;
|
||||
#endif
|
||||
frameBufferEmulation.N64DepthCompare = dcDisable;
|
||||
frameBufferEmulation.forceDepthBufferClear = 0;
|
||||
frameBufferEmulation.aspect = a43;
|
||||
|
||||
+5
-4
@@ -31,10 +31,11 @@ namespace graphics {
|
||||
DatatypeParam lutType;
|
||||
u32 lutFormatBytes;
|
||||
|
||||
InternalColorFormatParam noiseInternalFormat;
|
||||
ColorFormatParam noiseFormat;
|
||||
DatatypeParam noiseType;
|
||||
u32 noiseFormatBytes;
|
||||
// Used for font atlas
|
||||
InternalColorFormatParam fontInternalFormat;
|
||||
ColorFormatParam fontFormat;
|
||||
DatatypeParam fontType;
|
||||
u32 fontFormatBytes;
|
||||
|
||||
virtual ~FramebufferTextureFormats() {}
|
||||
};
|
||||
|
||||
+25
-36
@@ -1003,26 +1003,18 @@ class ShaderNoise : public ShaderPart
|
||||
public:
|
||||
ShaderNoise(const opengl::GLInfo & _glinfo)
|
||||
{
|
||||
if (_glinfo.isGLES2) {
|
||||
m_part =
|
||||
"uniform sampler2D uTexNoise; \n"
|
||||
"lowp float snoise() \n"
|
||||
"{ \n"
|
||||
" mediump vec2 texSize = vec2(640.0, 580.0); \n"
|
||||
" mediump vec2 coord = gl_FragCoord.xy/uScreenScale/texSize; \n"
|
||||
" return texture2D(uTexNoise, coord).r; \n"
|
||||
"} \n"
|
||||
;
|
||||
} else {
|
||||
m_part =
|
||||
"uniform sampler2D uTexNoise; \n"
|
||||
"lowp float snoise() \n"
|
||||
"{ \n"
|
||||
" ivec2 coord = ivec2(gl_FragCoord.xy/uScreenScale); \n"
|
||||
" return texelFetch(uTexNoise, coord, 0).r; \n"
|
||||
"} \n"
|
||||
;
|
||||
}
|
||||
m_part =
|
||||
"uniform float uNoiseSeed; \n"
|
||||
"lowp float snoise() \n"
|
||||
"{ \n"
|
||||
" mediump vec2 coord = floor(gl_FragCoord.xy/uScreenScale); \n"
|
||||
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
|
||||
// hash13 from https://www.shadertoy.com/view/4djSRW
|
||||
" p3 = fract(p3 * .1031); \n"
|
||||
" p3 += dot(p3, p3.zyx + 31.32); \n"
|
||||
" return fract((p3.x + p3.y) * p3.z); \n"
|
||||
"} \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1067,7 +1059,6 @@ public:
|
||||
"} \n"
|
||||
"lowp vec3 snoiseRGB() \n"
|
||||
"{ \n"
|
||||
" mediump vec2 texSize = vec2(640.0, 580.0); \n"
|
||||
;
|
||||
if (config.generalEmulation.enableHiresNoiseDithering != 0)
|
||||
// multiplier for higher res noise effect
|
||||
@@ -1077,19 +1068,15 @@ public:
|
||||
m_part +=
|
||||
" lowp float mult = 1.0; \n";
|
||||
m_part +=
|
||||
" mediump vec2 coordR = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
|
||||
" mediump vec2 coordG = mult * ((gl_FragCoord.xy + vec2( 0.0, texSize.y / 2.0 ))/uScreenScale/texSize);\n"
|
||||
" mediump vec2 coordB = mult * ((gl_FragCoord.xy + vec2( texSize.x / 2.0, 0.0))/uScreenScale/texSize);\n"
|
||||
// Only red channel of noise texture contains noise.
|
||||
" lowp float r = texture(uTexNoise,coordR).r; \n"
|
||||
" lowp float g = texture(uTexNoise,coordG).r; \n"
|
||||
" lowp float b = texture(uTexNoise,coordB).r; \n"
|
||||
" \n"
|
||||
" return vec3(r,g,b); \n"
|
||||
"} \n"
|
||||
" mediump vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale)); \n"
|
||||
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
|
||||
// hash33 from https://www.shadertoy.com/view/4djSRW
|
||||
" p3 = fract(p3 * vec3(.1031, .1030, .0973)); \n"
|
||||
" p3 += dot(p3, p3.yxz+33.33); \n"
|
||||
" return fract((p3.xxy + p3.yxx)*p3.zyx); \n"
|
||||
"} \n"
|
||||
"lowp float snoiseA() \n"
|
||||
"{ \n"
|
||||
" mediump vec2 texSize = vec2(640.0, 580.0); \n"
|
||||
;
|
||||
if (config.generalEmulation.enableHiresNoiseDithering != 0)
|
||||
// multiplier for higher res noise effect
|
||||
@@ -1100,10 +1087,12 @@ public:
|
||||
" lowp float mult = 1.0; \n";
|
||||
m_part +=
|
||||
" \n"
|
||||
" mediump vec2 coord = mult * ((gl_FragCoord.xy)/uScreenScale/texSize);\n"
|
||||
" \n"
|
||||
// Only red channel of noise texture contains noise.
|
||||
" return texture(uTexNoise,coord).r; \n"
|
||||
" mediump vec2 coord = floor(mult * (gl_FragCoord.xy/uScreenScale)); \n"
|
||||
" mediump vec3 p3 = vec3(uNoiseSeed, coord); \n"
|
||||
// hash13 from https://www.shadertoy.com/view/4djSRW
|
||||
" p3 = fract(p3 * .1031); \n"
|
||||
" p3 += dot(p3, p3.zyx + 31.32); \n"
|
||||
" return fract((p3.x + p3.y) * p3.z); \n"
|
||||
"} \n"
|
||||
;
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ void CombinerProgramUniformFactory::buildUniforms(GLuint _program,
|
||||
const CombinerKey &_key,
|
||||
UniformGroups &_uniforms) {
|
||||
|
||||
_addNoiseTex(_program, _uniforms);
|
||||
_addNoiseSeed(_program, _uniforms);
|
||||
_addScreenSpaceTriangleInfo(_program, _uniforms);
|
||||
_addRasterInfo(_program, _uniforms);
|
||||
_addViewportInfo(_program, _uniforms);
|
||||
@@ -71,7 +71,7 @@ void CombinerProgramUniformFactory::buildUniforms(GLuint _program,
|
||||
|
||||
_addBlendCvg(_program, _uniforms);
|
||||
|
||||
_addDitherMode(_program, _uniforms, _inputs.usesNoise());
|
||||
_addDitherMode(_program, _uniforms);
|
||||
|
||||
_addScreenScale(_program, _uniforms);
|
||||
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ public:
|
||||
UniformGroups &_uniforms);
|
||||
|
||||
private:
|
||||
virtual void _addNoiseTex(GLuint _program, UniformGroups &_uniforms) const = 0;
|
||||
virtual void _addNoiseSeed(GLuint _program, UniformGroups &_uniforms) const = 0;
|
||||
|
||||
virtual void _addScreenSpaceTriangleInfo(GLuint _program, UniformGroups &_uniforms) const = 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
|
||||
virtual void _addBlendCvg(GLuint _program, UniformGroups &_uniforms) const = 0;
|
||||
|
||||
virtual void _addDitherMode(GLuint _program, UniformGroups &_uniforms, bool _usesNoise) const = 0;
|
||||
virtual void _addDitherMode(GLuint _program, UniformGroups &_uniforms) const = 0;
|
||||
|
||||
virtual void _addScreenScale(GLuint _program, UniformGroups &_uniforms) const = 0;
|
||||
|
||||
|
||||
-1
@@ -317,7 +317,6 @@ public:
|
||||
uTexWrap[t].set(aTexWrap[t][0], aTexWrap[t][1], _force);
|
||||
uTexClamp[t].set(aTexClamp[t][0], aTexClamp[t][1], _force);
|
||||
uTexWrapEn[t].set(aTexWrapEn[t][0], aTexWrapEn[t][1], _force);
|
||||
uTexWrapEn[t].set(aTexWrapEn[t][0], aTexWrapEn[t][1], _force);
|
||||
uTexClampEn[t].set(aTexClampEn[t][0], aTexClampEn[t][1], _force);
|
||||
uTexMirrorEn[t].set(aTexMirrorEn[t][0], aTexMirrorEn[t][1], _force);
|
||||
uTexSize[t].set(aTexSize[t][0], aTexSize[t][1], _force);
|
||||
|
||||
+11
-18
@@ -5,7 +5,6 @@
|
||||
#include <Graphics/Context.h>
|
||||
|
||||
#include <Textures.h>
|
||||
#include <NoiseTexture.h>
|
||||
#include <FrameBuffer.h>
|
||||
#include <DisplayWindow.h>
|
||||
#include <RSP.h>
|
||||
@@ -15,20 +14,21 @@ namespace {
|
||||
using namespace glsl;
|
||||
/*---------------UniformGroup-------------*/
|
||||
|
||||
class UNoiseTex : public UniformGroup
|
||||
class UNoiseSeed : public UniformGroup
|
||||
{
|
||||
public:
|
||||
UNoiseTex(GLuint _program) {
|
||||
LocateUniform(uTexNoise);
|
||||
UNoiseSeed(GLuint _program) {
|
||||
LocateUniform(uNoiseSeed);
|
||||
}
|
||||
|
||||
void update(bool _force) override
|
||||
{
|
||||
uTexNoise.set(int(graphics::textureIndices::NoiseTex), _force);
|
||||
u32 counter = dwnd().getBuffersSwapCount();
|
||||
uNoiseSeed.set(counter & 0xff, _force);
|
||||
}
|
||||
|
||||
private:
|
||||
iUniform uTexNoise;
|
||||
fUniform uNoiseSeed;
|
||||
};
|
||||
|
||||
class UDepthTex : public UniformGroup
|
||||
@@ -323,8 +323,7 @@ private:
|
||||
class UDitherMode : public UniformGroup
|
||||
{
|
||||
public:
|
||||
UDitherMode(GLuint _program, bool _usesNoise)
|
||||
: m_usesNoise(_usesNoise)
|
||||
UDitherMode(GLuint _program)
|
||||
{
|
||||
LocateUniform(uAlphaCompareMode);
|
||||
LocateUniform(uAlphaDitherMode);
|
||||
@@ -343,18 +342,12 @@ public:
|
||||
uAlphaDitherMode.set(0, _force);
|
||||
uColorDitherMode.set(0, _force);
|
||||
}
|
||||
|
||||
bool updateNoiseTex = m_usesNoise;
|
||||
updateNoiseTex |= (gDP.otherMode.cycleType < G_CYC_COPY) && (gDP.otherMode.colorDither == G_CD_NOISE || gDP.otherMode.alphaDither == G_AD_NOISE || gDP.otherMode.alphaCompare == G_AC_DITHER);
|
||||
if (updateNoiseTex)
|
||||
g_noiseTexture.update();
|
||||
}
|
||||
|
||||
private:
|
||||
iUniform uAlphaCompareMode;
|
||||
iUniform uAlphaDitherMode;
|
||||
iUniform uColorDitherMode;
|
||||
bool m_usesNoise;
|
||||
};
|
||||
|
||||
class UScreenScale : public UniformGroup
|
||||
@@ -770,9 +763,9 @@ private:
|
||||
/*---------------CombinerProgramUniformFactoryCommon-------------*/
|
||||
namespace glsl {
|
||||
|
||||
void CombinerProgramUniformFactoryCommon::_addNoiseTex(GLuint _program, UniformGroups &_uniforms) const
|
||||
void CombinerProgramUniformFactoryCommon::_addNoiseSeed(GLuint _program, UniformGroups &_uniforms) const
|
||||
{
|
||||
_uniforms.emplace_back(new UNoiseTex(_program));
|
||||
_uniforms.emplace_back(new UNoiseSeed(_program));
|
||||
}
|
||||
|
||||
void CombinerProgramUniformFactoryCommon::_addScreenSpaceTriangleInfo(GLuint _program, UniformGroups &_uniforms) const
|
||||
@@ -845,9 +838,9 @@ void CombinerProgramUniformFactoryCommon::_addBlendCvg(GLuint _program, UniformG
|
||||
_uniforms.emplace_back(new UBlendCvg(_program));
|
||||
}
|
||||
|
||||
void CombinerProgramUniformFactoryCommon::_addDitherMode(GLuint _program, UniformGroups &_uniforms, bool _usesNoise) const
|
||||
void CombinerProgramUniformFactoryCommon::_addDitherMode(GLuint _program, UniformGroups &_uniforms) const
|
||||
{
|
||||
_uniforms.emplace_back(new UDitherMode(_program, _usesNoise));
|
||||
_uniforms.emplace_back(new UDitherMode(_program));
|
||||
}
|
||||
|
||||
void CombinerProgramUniformFactoryCommon::_addScreenScale(GLuint _program, UniformGroups &_uniforms) const
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ public:
|
||||
CombinerProgramUniformFactoryCommon(const opengl::GLInfo & _glInfo);
|
||||
|
||||
private:
|
||||
void _addNoiseTex(GLuint _program, UniformGroups &_uniforms) const override;
|
||||
void _addNoiseSeed(GLuint _program, UniformGroups &_uniforms) const override;
|
||||
|
||||
void _addScreenSpaceTriangleInfo(GLuint _program, UniformGroups &_uniforms) const override;
|
||||
|
||||
@@ -130,7 +130,7 @@ private:
|
||||
|
||||
void _addBlendCvg(GLuint _program, UniformGroups &_uniforms) const override;
|
||||
|
||||
void _addDitherMode(GLuint _program, UniformGroups &_uniforms, bool _usesNoise) const override;
|
||||
void _addDitherMode(GLuint _program, UniformGroups &_uniforms) const override;
|
||||
|
||||
void _addScreenScale(GLuint _program, UniformGroups &_uniforms) const override;
|
||||
|
||||
|
||||
+12
-12
@@ -282,10 +282,10 @@ struct FramebufferTextureFormatsGLES2 : public graphics::FramebufferTextureForma
|
||||
colorFormatBytes = 2;
|
||||
}
|
||||
|
||||
noiseInternalFormat = graphics::internalcolorFormat::LUMINANCE;
|
||||
noiseFormat = graphics::colorFormat::LUMINANCE;
|
||||
noiseType = GL_UNSIGNED_BYTE;
|
||||
noiseFormatBytes = 1;
|
||||
fontInternalFormat = graphics::internalcolorFormat::LUMINANCE;
|
||||
fontFormat = graphics::colorFormat::LUMINANCE;
|
||||
fontType = GL_UNSIGNED_BYTE;
|
||||
fontFormatBytes = 1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -339,10 +339,10 @@ struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureForma
|
||||
lutType = GL_UNSIGNED_INT;
|
||||
lutFormatBytes = 4;
|
||||
|
||||
noiseInternalFormat = GL_R8;
|
||||
noiseFormat = GL_RED;
|
||||
noiseType = GL_UNSIGNED_BYTE;
|
||||
noiseFormatBytes = 1;
|
||||
fontInternalFormat = GL_R8;
|
||||
fontFormat = GL_RED;
|
||||
fontType = GL_UNSIGNED_BYTE;
|
||||
fontFormatBytes = 1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -379,10 +379,10 @@ struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureForm
|
||||
lutType = GL_UNSIGNED_INT;
|
||||
lutFormatBytes = 4;
|
||||
|
||||
noiseInternalFormat = GL_R8;
|
||||
noiseFormat = GL_RED;
|
||||
noiseType = GL_UNSIGNED_BYTE;
|
||||
noiseFormatBytes = 1;
|
||||
fontInternalFormat = GL_R8;
|
||||
fontFormat = GL_RED;
|
||||
fontType = GL_UNSIGNED_BYTE;
|
||||
fontFormatBytes = 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Vendored
+4
-5
@@ -71,11 +71,10 @@ namespace graphics {
|
||||
|
||||
namespace textureIndices {
|
||||
TextureUnitParam Tex[2] = { 0U, 1U };
|
||||
TextureUnitParam NoiseTex(2U);
|
||||
TextureUnitParam DepthTex(3U);
|
||||
TextureUnitParam ZLUTTex(4U);
|
||||
TextureUnitParam PaletteTex(5U);
|
||||
TextureUnitParam MSTex[2] = { 6U, 7U };
|
||||
TextureUnitParam DepthTex(2U);
|
||||
TextureUnitParam ZLUTTex(3U);
|
||||
TextureUnitParam PaletteTex(4U);
|
||||
TextureUnitParam MSTex[2] = { 5U, 6U };
|
||||
}
|
||||
|
||||
namespace textureImageUnits {
|
||||
|
||||
@@ -71,7 +71,6 @@ namespace graphics {
|
||||
|
||||
namespace textureIndices {
|
||||
extern TextureUnitParam Tex[2];
|
||||
extern TextureUnitParam NoiseTex;
|
||||
extern TextureUnitParam DepthTex;
|
||||
extern TextureUnitParam ZLUTTex;
|
||||
extern TextureUnitParam PaletteTex;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "Performance.h"
|
||||
#include "TextureFilterHandler.h"
|
||||
#include "PostProcessor.h"
|
||||
#include "NoiseTexture.h"
|
||||
#include "ZlutTexture.h"
|
||||
#include "PaletteTexture.h"
|
||||
#include "TextDrawer.h"
|
||||
@@ -1959,7 +1958,6 @@ void GraphicsDrawer::_initData()
|
||||
TFH.init();
|
||||
PostProcessor::get().init();
|
||||
g_zlutTexture.init();
|
||||
g_noiseTexture.init();
|
||||
g_paletteTexture.init();
|
||||
perf.reset();
|
||||
FBInfo::fbInfo.reset();
|
||||
@@ -1983,7 +1981,6 @@ void GraphicsDrawer::_destroyData()
|
||||
m_texrectDrawer.destroy();
|
||||
g_paletteTexture.destroy();
|
||||
g_zlutTexture.destroy();
|
||||
g_noiseTexture.destroy();
|
||||
PostProcessor::get().destroy();
|
||||
if (TFH.optionsChanged())
|
||||
TFH.shutdown();
|
||||
|
||||
@@ -134,7 +134,7 @@ void InverseTransformVectorNormalize(float src[3], float dst[3], float mtx[4][4]
|
||||
dst[2] = product[2];
|
||||
}
|
||||
|
||||
void InverseTransformVectorNormalize4(float src[4][3], float dst[4][3], float mtx[4][4])
|
||||
static void InverseTransformVectorNormalize4(float src[4][3], float dst[4][3], float mtx[4][4])
|
||||
{
|
||||
// Load mtx
|
||||
float32x4x4_t _mtx = vld4q_f32(mtx[0]);
|
||||
@@ -216,7 +216,7 @@ void InverseTransformVectorNormalize4(float src[4][3], float dst[4][3], float mt
|
||||
dst[3][2] = product.val[3][2];
|
||||
}
|
||||
|
||||
void InverseTransformVectorNormalize7(float src[4][3], float dst[4][3], float mtx[4][4])
|
||||
static void InverseTransformVectorNormalize7(float src[4][3], float dst[4][3], float mtx[4][4])
|
||||
{
|
||||
// Load mtx
|
||||
float32x4x4_t _mtx = vld4q_f32(mtx[0]);
|
||||
|
||||
@@ -140,7 +140,7 @@ void gSPInverseTransformVector_NEON(float vec[3], float mtx[4][4])
|
||||
vec[2] = _mtx.val[0][2]; // store vec[2]
|
||||
}
|
||||
|
||||
void DotProductMax7FullNeon( float v0[3], float v1[7][3], float lights[7][3], float _vtx[3])
|
||||
static void DotProductMax7FullNeon( float v0[3], float v1[7][3], float lights[7][3], float _vtx[3])
|
||||
{
|
||||
// load v1
|
||||
float32x4x3_t _v10 = vld3q_f32(v1[0]); // load 4x3 mtx interleaved
|
||||
@@ -203,7 +203,7 @@ void DotProductMax7FullNeon( float v0[3], float v1[7][3], float lights[7][3], fl
|
||||
_vtx[2] += d20[0];
|
||||
}
|
||||
|
||||
void DotProductMax4FullNeon( float v0[3], float v1[4][3], float lights[4][3], float vtx[3])
|
||||
static void DotProductMax4FullNeon( float v0[3], float v1[4][3], float lights[4][3], float vtx[3])
|
||||
{
|
||||
float32x4x3_t _v1 = vld3q_f32(v1[0]); // load 4x3 mtx interleaved
|
||||
float32x4x3_t _lights = vld3q_f32(lights[0]); // load 4x3 mtx interleaved
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
#ifdef MINGW
|
||||
#define _CRT_RAND_S
|
||||
#endif
|
||||
|
||||
#include <thread>
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <functional>
|
||||
#include <cstdlib>
|
||||
#include <Graphics/Context.h>
|
||||
#include <Graphics/Parameters.h>
|
||||
#include "FrameBuffer.h"
|
||||
#include "Config.h"
|
||||
#include "GBI.h"
|
||||
#include "VI.h"
|
||||
#include "Textures.h"
|
||||
#include "NoiseTexture.h"
|
||||
#include "DisplayWindow.h"
|
||||
#include "DisplayLoadProgress.h"
|
||||
|
||||
using namespace graphics;
|
||||
|
||||
#define NOISE_TEX_WIDTH 640
|
||||
#define NOISE_TEX_HEIGHT 580
|
||||
|
||||
NoiseTexture g_noiseTexture;
|
||||
|
||||
NoiseTexture::NoiseTexture()
|
||||
: m_DList(0)
|
||||
, m_currTex(0)
|
||||
, m_prevTex(0)
|
||||
{
|
||||
for (u32 i = 0; i < NOISE_TEX_NUM; ++i)
|
||||
m_pTexture[i] = nullptr;
|
||||
}
|
||||
|
||||
static
|
||||
u32 Rand(u32 rand_value)
|
||||
{
|
||||
static u32 iseed = 1;
|
||||
iseed *= 0x343fd;
|
||||
iseed += 0x269ec3;
|
||||
return ((iseed >> 16) & 0x7fff);
|
||||
}
|
||||
|
||||
static
|
||||
void FillTextureData(u32 _seed, NoiseTexturesData * _pData, u32 _start, u32 _stop)
|
||||
{
|
||||
srand(_seed);
|
||||
for (u32 i = _start; i < _stop; ++i) {
|
||||
auto & vec = _pData->at(i);
|
||||
const size_t sz = vec.size();
|
||||
u32 rand_value(0U);
|
||||
for (size_t t = 0; t < sz; ++t) {
|
||||
rand_value = Rand(rand_value);
|
||||
vec[t] = rand_value & 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NoiseTexture::_fillTextureData()
|
||||
{
|
||||
displayLoadProgress(L"INIT NOISE TEXTURES. PLEASE WAIT...");
|
||||
|
||||
for (auto& vec : m_texData)
|
||||
vec.resize(NOISE_TEX_WIDTH * NOISE_TEX_HEIGHT);
|
||||
|
||||
FillTextureData(static_cast<u32>(time(nullptr)), &m_texData, 0, static_cast<u32>(m_texData.size()));
|
||||
|
||||
displayLoadProgress(L"");
|
||||
}
|
||||
|
||||
|
||||
void NoiseTexture::init()
|
||||
{
|
||||
if (m_texData[0].empty())
|
||||
_fillTextureData();
|
||||
|
||||
for (u32 i = 0; i < NOISE_TEX_NUM; ++i) {
|
||||
m_pTexture[i] = textureCache().addFrameBufferTexture(textureTarget::TEXTURE_2D);
|
||||
m_pTexture[i]->format = G_IM_FMT_RGBA;
|
||||
m_pTexture[i]->clampS = 1;
|
||||
m_pTexture[i]->clampT = 1;
|
||||
m_pTexture[i]->frameBufferTexture = CachedTexture::fbOneSample;
|
||||
m_pTexture[i]->maskS = 0;
|
||||
m_pTexture[i]->maskT = 0;
|
||||
m_pTexture[i]->mirrorS = 0;
|
||||
m_pTexture[i]->mirrorT = 0;
|
||||
m_pTexture[i]->width = NOISE_TEX_WIDTH;
|
||||
m_pTexture[i]->height = NOISE_TEX_HEIGHT;
|
||||
m_pTexture[i]->textureBytes = m_pTexture[i]->width * m_pTexture[i]->height;
|
||||
|
||||
const FramebufferTextureFormats & fbTexFormats = gfxContext.getFramebufferTextureFormats();
|
||||
{
|
||||
Context::InitTextureParams params;
|
||||
params.handle = m_pTexture[i]->name;
|
||||
params.textureUnitIndex = textureIndices::NoiseTex;
|
||||
params.width = m_pTexture[i]->width;
|
||||
params.height = m_pTexture[i]->height;
|
||||
params.internalFormat = fbTexFormats.noiseInternalFormat;
|
||||
params.format = fbTexFormats.noiseFormat;
|
||||
params.dataType = fbTexFormats.noiseType;
|
||||
params.data = m_texData[i].data();
|
||||
gfxContext.init2DTexture(params);
|
||||
}
|
||||
{
|
||||
Context::TexParameters params;
|
||||
params.handle = m_pTexture[i]->name;
|
||||
params.target = textureTarget::TEXTURE_2D;
|
||||
params.textureUnitIndex = textureIndices::NoiseTex;
|
||||
params.minFilter = textureParameters::FILTER_NEAREST;
|
||||
params.magFilter = textureParameters::FILTER_NEAREST;
|
||||
gfxContext.setTextureParameters(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NoiseTexture::destroy()
|
||||
{
|
||||
for (u32 i = 0; i < NOISE_TEX_NUM; ++i) {
|
||||
textureCache().removeFrameBufferTexture(m_pTexture[i]);
|
||||
m_pTexture[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void NoiseTexture::update()
|
||||
{
|
||||
if (m_texData[0].empty() || m_DList == dwnd().getBuffersSwapCount())
|
||||
return;
|
||||
|
||||
u32 rand_value(0U);
|
||||
while (m_currTex == m_prevTex) {
|
||||
rand_value = Rand(rand_value);
|
||||
m_currTex = rand_value % NOISE_TEX_NUM;
|
||||
}
|
||||
m_prevTex = m_currTex;
|
||||
if (m_pTexture[m_currTex] == nullptr)
|
||||
return;
|
||||
{
|
||||
Context::BindTextureParameters params;
|
||||
params.texture = m_pTexture[m_currTex]->name;
|
||||
params.textureUnitIndex = textureIndices::NoiseTex;
|
||||
params.target = textureTarget::TEXTURE_2D;
|
||||
gfxContext.bindTexture(params);
|
||||
}
|
||||
m_DList = dwnd().getBuffersSwapCount();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "Types.h"
|
||||
|
||||
#define NOISE_TEX_NUM 30
|
||||
|
||||
struct CachedTexture;
|
||||
typedef std::array<std::vector<u8>, NOISE_TEX_NUM> NoiseTexturesData;
|
||||
|
||||
class NoiseTexture
|
||||
{
|
||||
public:
|
||||
NoiseTexture();
|
||||
|
||||
void init();
|
||||
void destroy();
|
||||
void update();
|
||||
|
||||
private:
|
||||
void _fillTextureData();
|
||||
|
||||
CachedTexture * m_pTexture[NOISE_TEX_NUM];
|
||||
u32 m_DList;
|
||||
u32 m_currTex, m_prevTex;
|
||||
NoiseTexturesData m_texData;
|
||||
};
|
||||
|
||||
extern NoiseTexture g_noiseTexture;
|
||||
@@ -111,16 +111,16 @@ struct Atlas {
|
||||
m_pTexture->mirrorT = 0;
|
||||
m_pTexture->width = w;
|
||||
m_pTexture->height = h;
|
||||
m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.noiseFormatBytes;
|
||||
m_pTexture->textureBytes = m_pTexture->width * m_pTexture->height * fbTexFormats.fontFormatBytes;
|
||||
|
||||
Context::InitTextureParams initParams;
|
||||
initParams.handle = m_pTexture->name;
|
||||
initParams.textureUnitIndex = textureIndices::Tex[0];
|
||||
initParams.width = w;
|
||||
initParams.height = h;
|
||||
initParams.internalFormat = fbTexFormats.noiseInternalFormat;
|
||||
initParams.format = fbTexFormats.noiseFormat;
|
||||
initParams.dataType = fbTexFormats.noiseType;
|
||||
initParams.internalFormat = fbTexFormats.fontInternalFormat;
|
||||
initParams.format = fbTexFormats.fontFormat;
|
||||
initParams.dataType = fbTexFormats.fontType;
|
||||
gfxContext.init2DTexture(initParams);
|
||||
|
||||
Context::TexParameters setParams;
|
||||
|
||||
@@ -124,25 +124,14 @@ bool CoreDecreaseSaveStateSlot(void)
|
||||
return CoreSetSaveStateSlot(slot - 1);
|
||||
}
|
||||
|
||||
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
|
||||
bool CoreGetSaveStatePath(CoreRomHeader header, CoreRomSettings settings, int slot, std::filesystem::path& path)
|
||||
{
|
||||
// TODO: this should probably be an API function
|
||||
// in mupen64plus-core instead
|
||||
|
||||
std::filesystem::path saveStatePath;
|
||||
std::filesystem::path oldSaveStatePath;
|
||||
std::string saveStateFileName;
|
||||
std::filesystem::path saveStateExtension;
|
||||
CoreRomHeader romHeader;
|
||||
CoreRomSettings romSettings;
|
||||
|
||||
// attempt to retrieve the current
|
||||
// rom header and settings
|
||||
if (!CoreGetCurrentRomHeader(romHeader) ||
|
||||
!CoreGetCurrentRomSettings(romSettings))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// retrieve save state directory
|
||||
saveStatePath = CoreGetSaveStateDirectory();
|
||||
@@ -154,7 +143,7 @@ bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
|
||||
|
||||
// construct old save state path
|
||||
oldSaveStatePath = saveStatePath;
|
||||
oldSaveStatePath += romSettings.GoodName;
|
||||
oldSaveStatePath += settings.GoodName;
|
||||
oldSaveStatePath += saveStateExtension;
|
||||
|
||||
// use old filename if it exists
|
||||
@@ -168,32 +157,32 @@ bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
|
||||
int format = CoreSettingsGetIntValue(SettingsID::Core_SaveFileNameFormat);
|
||||
if (format == 0)
|
||||
{
|
||||
saveStatePath += romHeader.Name;
|
||||
saveStatePath += header.Name;
|
||||
saveStatePath += saveStateExtension;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (romSettings.GoodName.find("(unknown rom)") == std::string::npos)
|
||||
if (settings.GoodName.find("(unknown rom)") == std::string::npos)
|
||||
{
|
||||
if (romSettings.GoodName.size() < 32)
|
||||
if (settings.GoodName.size() < 32)
|
||||
{
|
||||
saveStatePath += romSettings.GoodName;
|
||||
saveStatePath += settings.GoodName;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveStatePath += romSettings.GoodName.substr(0, 32);
|
||||
saveStatePath += settings.GoodName.substr(0, 32);
|
||||
}
|
||||
}
|
||||
else if (!romHeader.Name.empty())
|
||||
else if (!header.Name.empty())
|
||||
{
|
||||
saveStatePath += romHeader.Name;
|
||||
saveStatePath += header.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveStatePath += "unknown";
|
||||
}
|
||||
saveStatePath += "-";
|
||||
saveStatePath += romSettings.MD5.substr(0, 8);
|
||||
saveStatePath += settings.MD5.substr(0, 8);
|
||||
saveStatePath += saveStateExtension;
|
||||
}
|
||||
|
||||
@@ -210,6 +199,22 @@ bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path)
|
||||
{
|
||||
CoreRomHeader romHeader;
|
||||
CoreRomSettings romSettings;
|
||||
|
||||
// attempt to retrieve the current
|
||||
// rom header and settings
|
||||
if (!CoreGetCurrentRomHeader(romHeader) ||
|
||||
!CoreGetCurrentRomSettings(romSettings))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CoreGetSaveStatePath(romHeader, romSettings, slot, path);
|
||||
}
|
||||
|
||||
bool CoreSaveState(void)
|
||||
{
|
||||
std::string error;
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#ifndef CORE_SAVESTATE_HPP
|
||||
#define CORE_SAVESTATE_HPP
|
||||
|
||||
#include "RomHeader.hpp"
|
||||
#include "RomSettings.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
// sets save state slot
|
||||
@@ -27,8 +30,14 @@ bool CoreDecreaseSaveStateSlot(void);
|
||||
|
||||
// retrieves the file path for
|
||||
// the save state in the given slot
|
||||
// for the currently opened ROM
|
||||
bool CoreGetSaveStatePath(int slot, std::filesystem::path& path);
|
||||
|
||||
// retrieves the file path for
|
||||
// the save state in the given slot
|
||||
bool CoreGetSaveStatePath(CoreRomHeader header, CoreRomSettings settings, int slot, std::filesystem::path& path);
|
||||
|
||||
|
||||
// saves state
|
||||
bool CoreSaveState(void);
|
||||
|
||||
|
||||
@@ -117,8 +117,11 @@ static l_Setting get_setting(SettingsID settingId)
|
||||
case SettingsID::GUI_OnScreenDisplayPaddingY:
|
||||
setting = {SETTING_SECTION_GUI, "OnScreenDisplayPaddingY", 20};
|
||||
break;
|
||||
case SettingsID::GUI_OnScreenDisplayOpacity:
|
||||
setting = {SETTING_SECTION_GUI, "OnScreenDisplayOpacity", 0.5f};
|
||||
case SettingsID::GUI_OnScreenDisplayBackgroundColor:
|
||||
setting = {SETTING_SECTION_GUI, "OnScreenDisplayBackgroundColor", std::string("0;0;0;127")};
|
||||
break;
|
||||
case SettingsID::GUI_OnScreenDisplayTextColor:
|
||||
setting = {SETTING_SECTION_GUI, "OnScreenDisplayTextColor", std::string("255;255;255;255")};
|
||||
break;
|
||||
case SettingsID::GUI_OnScreenDisplayDuration:
|
||||
setting = {SETTING_SECTION_GUI, "OnScreenDisplayDuration", 3};
|
||||
|
||||
@@ -18,7 +18,8 @@ enum class SettingsID
|
||||
GUI_OnScreenDisplayLocation,
|
||||
GUI_OnScreenDisplayPaddingX,
|
||||
GUI_OnScreenDisplayPaddingY,
|
||||
GUI_OnScreenDisplayOpacity,
|
||||
GUI_OnScreenDisplayBackgroundColor,
|
||||
GUI_OnScreenDisplayTextColor,
|
||||
GUI_OnScreenDisplayDuration,
|
||||
GUI_Toolbar,
|
||||
GUI_ToolbarArea,
|
||||
|
||||
@@ -117,6 +117,7 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
|
||||
this->currentDeviceName = "";
|
||||
this->currentDeviceNum = deviceNum;
|
||||
controllerWidget->SetCurrentJoystickID(this->currentDeviceNum);
|
||||
controllerWidget->SetCurrentJoystick(nullptr, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,6 +134,7 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
|
||||
this->currentDeviceName = "";
|
||||
this->currentDeviceNum = (int)InputDeviceType::Keyboard;
|
||||
controllerWidget->SetCurrentJoystickID(this->currentDeviceNum);
|
||||
controllerWidget->SetCurrentJoystick(nullptr, nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +154,7 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
|
||||
joystickId = SDL_JoystickGetDeviceInstanceID(deviceNum);
|
||||
controllerWidget->SetCurrentJoystickID(joystickId);
|
||||
controllerWidget->SetIsCurrentJoystickGameController(currentController != nullptr);
|
||||
controllerWidget->SetCurrentJoystick(this->currentJoystick, this->currentController);
|
||||
}
|
||||
|
||||
void MainDialog::closeInputDevice()
|
||||
|
||||
@@ -10,11 +10,15 @@
|
||||
#include "OptionsDialog.hpp"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <RMG-Core/Core.hpp>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
using namespace UserInterface;
|
||||
|
||||
OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
|
||||
OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings,
|
||||
SDL_Joystick* joystick, SDL_GameController* controller) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
|
||||
{
|
||||
this->setupUi(this);
|
||||
|
||||
@@ -31,6 +35,12 @@ OptionsDialog::OptionsDialog(QWidget* parent, OptionsDialogSettings settings) :
|
||||
{
|
||||
this->hideEmulationInfoText();
|
||||
}
|
||||
|
||||
this->currentJoystick = joystick;
|
||||
this->currentController = controller;
|
||||
|
||||
this->testRumbleButton->setVisible(settings.ControllerPak == 1);
|
||||
this->testRumbleButton->setEnabled(this->currentJoystick != nullptr || this->currentController != nullptr);
|
||||
}
|
||||
|
||||
OptionsDialogSettings OptionsDialog::GetSettings()
|
||||
@@ -79,6 +89,11 @@ void OptionsDialog::accept()
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void OptionsDialog::on_controllerPakComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
this->testRumbleButton->setVisible(index == 1);
|
||||
}
|
||||
|
||||
void OptionsDialog::on_changeGameboyRomButton_clicked()
|
||||
{
|
||||
QString gameBoyRom;
|
||||
@@ -100,3 +115,29 @@ void OptionsDialog::on_changeGameboySaveButton_clicked()
|
||||
this->gameboySaveLineEdit->setText(QDir::toNativeSeparators(gameBoySave));
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::on_testRumbleButton_clicked()
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
if ((this->currentJoystick != nullptr && SDL_JoystickHasRumble(this->currentJoystick) != SDL_TRUE) ||
|
||||
(this->currentController != nullptr && SDL_GameControllerHasRumble(this->currentController) != SDL_TRUE))
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setIcon(QMessageBox::Icon::Critical);
|
||||
msgBox.setWindowTitle("Error");
|
||||
msgBox.setText("Controller doesn't support rumble");
|
||||
msgBox.addButton(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this->currentJoystick != nullptr)
|
||||
{
|
||||
SDL_JoystickRumble(this->currentJoystick, 0xFFFF, 0xFFFF, 1500);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_GameControllerRumble(this->currentController, 0xFFFF, 0xFFFF, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <QDialog>
|
||||
#include <string>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "ui_OptionsDialog.h"
|
||||
|
||||
struct OptionsDialogSettings
|
||||
@@ -35,7 +37,8 @@ class OptionsDialog : public QDialog, private Ui::OptionsDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OptionsDialog(QWidget *parent, OptionsDialogSettings settings);
|
||||
OptionsDialog(QWidget *parent, OptionsDialogSettings settings,
|
||||
SDL_Joystick* joystick, SDL_GameController* controller);
|
||||
|
||||
OptionsDialogSettings GetSettings();
|
||||
|
||||
@@ -45,12 +48,18 @@ protected:
|
||||
private:
|
||||
OptionsDialogSettings settings;
|
||||
|
||||
SDL_Joystick* currentJoystick = nullptr;
|
||||
SDL_GameController* currentController = nullptr;
|
||||
|
||||
void setIconsForEmulationInfoText(void);
|
||||
void hideEmulationInfoText(void);
|
||||
|
||||
private slots:
|
||||
void on_controllerPakComboBox_currentIndexChanged(int index);
|
||||
|
||||
void on_changeGameboyRomButton_clicked();
|
||||
void on_changeGameboySaveButton_clicked();
|
||||
void on_testRumbleButton_clicked();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -82,6 +82,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="testRumbleButton">
|
||||
<property name="text">
|
||||
<string>Test Rumble</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
@@ -138,7 +145,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -219,7 +226,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -236,10 +243,10 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -853,7 +853,11 @@ void ControllerWidget::on_resetButton_clicked()
|
||||
|
||||
void ControllerWidget::on_optionsButton_clicked()
|
||||
{
|
||||
OptionsDialog dialog(this, this->optionsDialogSettings);
|
||||
bool isKeyboard = this->inputDeviceComboBox->currentData().toInt() == (int)InputDeviceType::Keyboard;
|
||||
|
||||
OptionsDialog dialog(this, this->optionsDialogSettings,
|
||||
isKeyboard ? nullptr : this->currentJoystick,
|
||||
isKeyboard ? nullptr : this->currentController);
|
||||
int ret = dialog.exec();
|
||||
|
||||
// when saved, store settings for later
|
||||
@@ -1866,6 +1870,12 @@ void ControllerWidget::SetIsCurrentJoystickGameController(bool isGameController)
|
||||
this->isCurrentJoystickGameController = isGameController;
|
||||
}
|
||||
|
||||
void ControllerWidget::SetCurrentJoystick(SDL_Joystick* joystick, SDL_GameController* controller)
|
||||
{
|
||||
this->currentJoystick = joystick;
|
||||
this->currentController = controller;
|
||||
}
|
||||
|
||||
void ControllerWidget::AddUserProfile(QString name, QString section)
|
||||
{
|
||||
int index = this->profileComboBox->findData(section);
|
||||
|
||||
@@ -104,6 +104,9 @@ private:
|
||||
SDL_JoystickID currentJoystickId = -1;
|
||||
bool isCurrentJoystickGameController = false;
|
||||
|
||||
SDL_Joystick* currentJoystick = nullptr;
|
||||
SDL_GameController* currentController = nullptr;
|
||||
|
||||
int previousProfileComboBoxIndex = -1;
|
||||
|
||||
bool onlyLoadGameProfile = false;
|
||||
@@ -143,6 +146,7 @@ public:
|
||||
|
||||
void SetCurrentJoystickID(SDL_JoystickID joystickId);
|
||||
void SetIsCurrentJoystickGameController(bool isGameController);
|
||||
void SetCurrentJoystick(SDL_Joystick* joystick, SDL_GameController* controller);
|
||||
|
||||
void AddUserProfile(QString name, QString section);
|
||||
void RemoveUserProfile(QString name, QString section);
|
||||
|
||||
@@ -24,12 +24,20 @@ static bool l_Enabled = false;
|
||||
static bool l_RenderingPaused = false;
|
||||
|
||||
static std::chrono::time_point<std::chrono::high_resolution_clock> l_MessageTime;
|
||||
static std::string l_Message;
|
||||
static int l_MessagePosition = 1;
|
||||
static float l_MessagePaddingX = 20.0f;
|
||||
static float l_MessagePaddingY = 20.0f;
|
||||
static float l_MessageOpacity = 1.0f;
|
||||
static int l_MessageDuration = 3;
|
||||
static std::string l_Message;
|
||||
static int l_MessagePosition = 1;
|
||||
static float l_MessagePaddingX = 20.0f;
|
||||
static float l_MessagePaddingY = 20.0f;
|
||||
static float l_MessageOpacity = 1.0f;
|
||||
static float l_BackgroundRed = 1.0f;
|
||||
static float l_BackgroundGreen = 1.0f;
|
||||
static float l_BackgroundBlue = 1.0f;
|
||||
static float l_BackgroundAlpha = 1.0f;
|
||||
static float l_TextRed = 1.0f;
|
||||
static float l_TextGreen = 1.0f;
|
||||
static float l_TextBlue = 1.0f;
|
||||
static float l_TextAlpha = 1.0f;
|
||||
static int l_MessageDuration = 3;
|
||||
|
||||
//
|
||||
// Exported Functions
|
||||
@@ -76,8 +84,24 @@ void OnScreenDisplayLoadSettings(void)
|
||||
l_MessagePosition = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayLocation);
|
||||
l_MessagePaddingX = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingX);
|
||||
l_MessagePaddingY = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingY);
|
||||
l_MessageOpacity = CoreSettingsGetFloatValue(SettingsID::GUI_OnScreenDisplayOpacity);
|
||||
l_MessageDuration = CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayDuration);
|
||||
|
||||
std::vector<int> backgroundColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayBackgroundColor);
|
||||
std::vector<int> textColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayTextColor);
|
||||
if (backgroundColor.size() == 4)
|
||||
{
|
||||
l_BackgroundRed = backgroundColor.at(0) / 255.0f;
|
||||
l_BackgroundGreen = backgroundColor.at(1) / 255.0f;
|
||||
l_BackgroundBlue = backgroundColor.at(2) / 255.0f;
|
||||
l_BackgroundAlpha = backgroundColor.at(3) / 255.0f;
|
||||
}
|
||||
if (textColor.size() == 4)
|
||||
{
|
||||
l_TextRed = textColor.at(0) / 255.0f;
|
||||
l_TextGreen = textColor.at(1) / 255.0f;
|
||||
l_TextBlue = textColor.at(2) / 255.0f;
|
||||
l_TextAlpha = textColor.at(3) / 255.0f;
|
||||
}
|
||||
}
|
||||
|
||||
bool OnScreenDisplaySetDisplaySize(int width, int height)
|
||||
@@ -123,8 +147,6 @@ void OnScreenDisplayRender(void)
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui::SetNextWindowBgAlpha(l_MessageOpacity);
|
||||
|
||||
// right bottom = ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x - 20.0f, io.DisplaySize.y - 20.0f), ImGuiCond_Always, ImVec2(1.0f, 1.0f));
|
||||
// right top = ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x - 20.0f, 20.0f), ImGuiCond_Always, ImVec2(1.0f, 0));
|
||||
// left bottom = ImGui::SetNextWindowPos(ImVec2(20.0f, io.DisplaySize.y - 20.0f), ImGuiCond_Always, ImVec2(0.0f, 1.0f));
|
||||
@@ -146,12 +168,17 @@ void OnScreenDisplayRender(void)
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::Begin("Message", nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing);
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(l_BackgroundRed, l_BackgroundGreen, l_BackgroundBlue, l_BackgroundAlpha));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(l_TextRed, l_TextGreen, l_TextBlue, l_TextAlpha));
|
||||
|
||||
ImGui::Begin("Message", nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing);
|
||||
ImGui::Text("%s", l_Message.c_str());
|
||||
ImGui::End();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
ImGui::PopStyleColor(2);
|
||||
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "UserInterface/Widget/KeybindButton.hpp"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QColorDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QDirIterator>
|
||||
#include <QLabel>
|
||||
@@ -401,8 +402,20 @@ void SettingsDialog::loadInterfaceOSDSettings(void)
|
||||
this->osdLocationComboBox->setCurrentIndex(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayLocation));
|
||||
this->osdVerticalPaddingSpinBox->setValue(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingY));
|
||||
this->osdHorizontalPaddingSpinBox->setValue(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayPaddingX));
|
||||
this->osdOpacitySpinBox->setValue(CoreSettingsGetFloatValue(SettingsID::GUI_OnScreenDisplayOpacity));
|
||||
this->osdDurationSpinBox->setValue(CoreSettingsGetIntValue(SettingsID::GUI_OnScreenDisplayDuration));
|
||||
|
||||
std::vector<int> backgroundColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayBackgroundColor);
|
||||
std::vector<int> textColor = CoreSettingsGetIntListValue(SettingsID::GUI_OnScreenDisplayTextColor);
|
||||
if (backgroundColor.size() == 4)
|
||||
{
|
||||
this->currentBackgroundColor = QColor(backgroundColor.at(0), backgroundColor.at(1), backgroundColor.at(2), backgroundColor.at(3));
|
||||
this->chooseColor(this->changeBackgroundColorButton, &this->currentBackgroundColor, true);
|
||||
}
|
||||
if (textColor.size() == 4)
|
||||
{
|
||||
this->currentTextColor = QColor(textColor.at(0), textColor.at(1), textColor.at(2), textColor.at(3));
|
||||
this->chooseColor(this->changeTextColorButton, &this->currentTextColor, true);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::loadInterfaceMiscSettings(void)
|
||||
@@ -562,8 +575,20 @@ void SettingsDialog::loadDefaultInterfaceOSDSettings(void)
|
||||
this->osdLocationComboBox->setCurrentIndex(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayLocation));
|
||||
this->osdVerticalPaddingSpinBox->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayPaddingY));
|
||||
this->osdHorizontalPaddingSpinBox->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayPaddingX));
|
||||
this->osdOpacitySpinBox->setValue(CoreSettingsGetDefaultFloatValue(SettingsID::GUI_OnScreenDisplayOpacity));
|
||||
this->osdDurationSpinBox->setValue(CoreSettingsGetDefaultIntValue(SettingsID::GUI_OnScreenDisplayDuration));
|
||||
|
||||
std::vector<int> backgroundColor = CoreSettingsGetDefaultIntListValue(SettingsID::GUI_OnScreenDisplayBackgroundColor);
|
||||
std::vector<int> textColor = CoreSettingsGetDefaultIntListValue(SettingsID::GUI_OnScreenDisplayTextColor);
|
||||
if (backgroundColor.size() == 4)
|
||||
{
|
||||
this->currentBackgroundColor = QColor(backgroundColor.at(0), backgroundColor.at(1), backgroundColor.at(2), backgroundColor.at(3));
|
||||
this->chooseColor(this->changeBackgroundColorButton, &this->currentBackgroundColor, true);
|
||||
}
|
||||
if (textColor.size() == 4)
|
||||
{
|
||||
this->currentTextColor = QColor(textColor.at(0), textColor.at(1), textColor.at(2), textColor.at(3));
|
||||
this->chooseColor(this->changeTextColorButton, &this->currentTextColor, true);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::loadDefaultInterfaceMiscSettings(void)
|
||||
@@ -770,8 +795,17 @@ void SettingsDialog::saveInterfaceOSDSettings(void)
|
||||
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayLocation, this->osdLocationComboBox->currentIndex());
|
||||
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayPaddingY, this->osdVerticalPaddingSpinBox->value());
|
||||
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayPaddingX, this->osdHorizontalPaddingSpinBox->value());
|
||||
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayOpacity, (float)this->osdOpacitySpinBox->value());
|
||||
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayDuration, this->osdDurationSpinBox->value());
|
||||
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayBackgroundColor, std::vector<int>({ this->currentBackgroundColor.red(),
|
||||
this->currentBackgroundColor.green(),
|
||||
this->currentBackgroundColor.blue(),
|
||||
this->currentBackgroundColor.alpha()
|
||||
}));
|
||||
CoreSettingsSetValue(SettingsID::GUI_OnScreenDisplayTextColor, std::vector<int>({ this->currentTextColor.red(),
|
||||
this->currentTextColor.green(),
|
||||
this->currentTextColor.blue(),
|
||||
this->currentTextColor.alpha()
|
||||
}));
|
||||
}
|
||||
|
||||
void SettingsDialog::saveInterfaceMiscSettings(void)
|
||||
@@ -1053,6 +1087,28 @@ void SettingsDialog::chooseIPLRom(QLineEdit *lineEdit)
|
||||
lineEdit->setText(QDir::toNativeSeparators(file));
|
||||
}
|
||||
|
||||
void SettingsDialog::chooseColor(QPushButton *pushButton, QColor *initialColor, bool skipChoice)
|
||||
{
|
||||
QColor color = QColor::Invalid;
|
||||
|
||||
if (skipChoice)
|
||||
{
|
||||
color = *initialColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = QColorDialog::getColor(*initialColor, this, "", QColorDialog::ColorDialogOption::ShowAlphaChannel);
|
||||
}
|
||||
|
||||
if (!color.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pushButton->setStyleSheet("background-color: " + color.name());
|
||||
*initialColor = color;
|
||||
}
|
||||
|
||||
bool SettingsDialog::applyPluginSettings(void)
|
||||
{
|
||||
// attempt to apply plugin settings when emulation
|
||||
@@ -1182,6 +1238,16 @@ void SettingsDialog::on_changeDevelopmentIPLRomPathButton_clicked(void)
|
||||
this->chooseIPLRom(this->developmentIPLRomLineEdit);
|
||||
}
|
||||
|
||||
void SettingsDialog::on_changeBackgroundColorButton_clicked(void)
|
||||
{
|
||||
this->chooseColor(this->changeBackgroundColorButton, &this->currentBackgroundColor);
|
||||
}
|
||||
|
||||
void SettingsDialog::on_changeTextColorButton_clicked(void)
|
||||
{
|
||||
this->chooseColor(this->changeTextColorButton, &this->currentTextColor);
|
||||
}
|
||||
|
||||
void SettingsDialog::on_KeybindButton_KeybindingChanged(KeybindButton* button)
|
||||
{
|
||||
if (this->keybindButtonTimerId != -1)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <QTreeWidget>
|
||||
#include <QWidget>
|
||||
#include <QMutex>
|
||||
#include <QColor>
|
||||
|
||||
#include <RMG-Core/Core.hpp>
|
||||
|
||||
@@ -56,6 +57,9 @@ class SettingsDialog : public QDialog, private Ui::SettingsDialog
|
||||
int keybindButtonTimeLeft = 5;
|
||||
KeybindButton* currentKeybindButton = nullptr;
|
||||
|
||||
QColor currentBackgroundColor;
|
||||
QColor currentTextColor;
|
||||
|
||||
std::vector<CorePlugin> pluginList;
|
||||
|
||||
int currentIndex(void);
|
||||
@@ -118,6 +122,7 @@ class SettingsDialog : public QDialog, private Ui::SettingsDialog
|
||||
|
||||
void chooseDirectory(QLineEdit *);
|
||||
void chooseIPLRom(QLineEdit *);
|
||||
void chooseColor(QPushButton *, QColor *, bool skipChoice = false);
|
||||
|
||||
bool applyPluginSettings(void);
|
||||
|
||||
@@ -138,6 +143,9 @@ class SettingsDialog : public QDialog, private Ui::SettingsDialog
|
||||
void on_changeAmericanIPLRomPathButton_clicked(void);
|
||||
void on_changeDevelopmentIPLRomPathButton_clicked(void);
|
||||
|
||||
void on_changeBackgroundColorButton_clicked(void);
|
||||
void on_changeTextColorButton_clicked(void);
|
||||
|
||||
void on_KeybindButton_KeybindingChanged(KeybindButton* button);
|
||||
void on_KeybindButton_Clicked(KeybindButton* button);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetNoConstraint</enum>
|
||||
<enum>QLayout::SizeConstraint::SetNoConstraint</enum>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
@@ -34,7 +34,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetNoConstraint</enum>
|
||||
<enum>QLayout::SizeConstraint::SetNoConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
@@ -125,7 +125,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -171,7 +171,7 @@
|
||||
<string>Changes will be applied on next emulation run</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -222,7 +222,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -249,7 +249,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -351,24 +351,36 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Opacity</string>
|
||||
<string>Background Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="osdOpacitySpinBox">
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
<widget class="QPushButton" name="changeBackgroundColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Text Color</string>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="changeTextColorButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -398,7 +410,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -444,7 +456,7 @@
|
||||
<string>The On-Screen Display will only work with OpenGL video plugins</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -534,7 +546,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -580,7 +592,7 @@
|
||||
<string>Changes will be applied on next application run</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -600,7 +612,7 @@
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
<enum>QFrame::Shadow::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
@@ -610,8 +622,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>442</width>
|
||||
<height>692</height>
|
||||
<width>444</width>
|
||||
<height>690</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
@@ -898,7 +910,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1134,7 +1146,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1334,7 +1346,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1408,7 +1420,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1518,7 +1530,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1592,7 +1604,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1801,7 +1813,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1847,7 +1859,7 @@
|
||||
<string>Changes will be applied on next emulation run</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -2033,7 +2045,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -2123,7 +2135,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -2233,7 +2245,7 @@
|
||||
<string>Reality Signal Processor Plugin</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
@@ -2261,7 +2273,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -2307,7 +2319,7 @@
|
||||
<string>Make sure to use a LLE RSP plugin (i.e paraLLEl RSP) when using a LLE Video plugin (i.e paraLLEl)</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@@ -2356,7 +2368,7 @@
|
||||
<string>Changes will be applied on next emulation run</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -2432,7 +2444,7 @@
|
||||
<string>Reality Signal Processor Plugin</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
@@ -2457,7 +2469,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -2503,7 +2515,7 @@
|
||||
<string>Make sure to use a LLE RSP plugin (i.e paraLLEl RSP) when using a LLE Video plugin (i.e paraLLEl)</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@@ -2548,7 +2560,7 @@
|
||||
<string>Changes will be applied on next emulation run</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -2636,7 +2648,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Override User Directories</string>
|
||||
<string>Override &User Directories</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@@ -2697,7 +2709,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -2710,7 +2722,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="emulationInfoLayout_13">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="infoIconLabel_3">
|
||||
@@ -2746,7 +2758,7 @@
|
||||
<string>Changes will be applied on next application run</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -2856,7 +2868,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -2902,7 +2914,7 @@
|
||||
<string>Changes will be applied on next emulation run</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
<enum>Qt::TextFormat::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -2917,10 +2929,10 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
|
||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok|QDialogButtonBox::StandardButton::RestoreDefaults</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -109,7 +109,7 @@ bool MainWindow::Init(QApplication* app, bool showUI, bool launchROM)
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation)
|
||||
void MainWindow::OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation, int stateSlot)
|
||||
{
|
||||
this->ui_LaunchInFullscreen = fullscreen;
|
||||
this->ui_QuitAfterEmulation = quitAfterEmulation;
|
||||
@@ -120,7 +120,7 @@ void MainWindow::OpenROM(QString file, QString disk, bool fullscreen, bool quitA
|
||||
// state, then the transition will be smoother
|
||||
this->updateUI(true, false);
|
||||
|
||||
this->launchEmulationThread(file, disk, true);
|
||||
this->launchEmulationThread(file, disk, true, stateSlot);
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
@@ -182,6 +182,8 @@ void MainWindow::initializeUI(bool launchROM)
|
||||
&MainWindow::on_RomBrowser_PlayGame);
|
||||
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::PlayGameWith, this,
|
||||
&MainWindow::on_RomBrowser_PlayGameWith);
|
||||
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::PlayGameWithSlot, this,
|
||||
&MainWindow::on_RomBrowser_PlayGameWithSlot);
|
||||
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::EditGameSettings, this,
|
||||
&MainWindow::on_RomBrowser_EditGameSettings);
|
||||
connect(this->ui_Widget_RomBrowser, &Widget::RomBrowserWidget::EditGameInputSettings, this,
|
||||
@@ -557,7 +559,7 @@ void MainWindow::connectEmulationThreadSignals(void)
|
||||
Qt::BlockingQueuedConnection);
|
||||
}
|
||||
|
||||
void MainWindow::launchEmulationThread(QString cartRom, QString diskRom, bool refreshRomListAfterEmulation)
|
||||
void MainWindow::launchEmulationThread(QString cartRom, QString diskRom, bool refreshRomListAfterEmulation, int slot)
|
||||
{
|
||||
CoreSettingsSave();
|
||||
|
||||
@@ -593,6 +595,13 @@ void MainWindow::launchEmulationThread(QString cartRom, QString diskRom, bool re
|
||||
this->ui_LaunchInFullscreen = false;
|
||||
}
|
||||
|
||||
this->ui_LoadSaveStateSlotCounter = 0;
|
||||
this->ui_LoadSaveStateSlot = slot;
|
||||
if (slot != -1)
|
||||
{
|
||||
this->ui_LoadSaveStateSlotTimerId = this->startTimer(100);
|
||||
}
|
||||
|
||||
this->ui_CheckVideoSizeTimerId = this->startTimer(2000);
|
||||
|
||||
this->ui_HideCursorInEmulation = CoreSettingsGetBoolValue(SettingsID::GUI_HideCursorInEmulation);
|
||||
@@ -964,8 +973,12 @@ void MainWindow::configureActions(void)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
int factor = speedAction->text().split("%").first().toInt();
|
||||
this->on_Action_System_SpeedFactor(factor);
|
||||
QString factorText = speedAction->text().split("%").first();
|
||||
// sometimes the text can contain a '&'
|
||||
// which will make the toInt() function return 0
|
||||
// so strip it out
|
||||
factorText.remove('&');
|
||||
this->on_Action_System_SpeedFactor(factorText.toInt());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -986,8 +999,12 @@ void MainWindow::configureActions(void)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
int slot = slotAction->text().split(" ").at(1).toInt();
|
||||
this->on_Action_System_CurrentSaveState(slot);
|
||||
QString slotText = slotAction->text().split(" ").at(1);
|
||||
// sometimes the text can contain a '&'
|
||||
// which will make the toInt() function return 0
|
||||
// so strip it out
|
||||
slotText.remove('&');
|
||||
this->on_Action_System_CurrentSaveState(slotText.toInt());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1181,6 +1198,29 @@ void MainWindow::timerEvent(QTimerEvent *event)
|
||||
CoreSetVideoSize(expectedWidth, expectedHeight);
|
||||
}
|
||||
}
|
||||
else if (timerId == this->ui_LoadSaveStateSlotTimerId)
|
||||
{
|
||||
if (!CoreIsEmulationRunning())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CoreSetSaveStateSlot(this->ui_LoadSaveStateSlot) ||
|
||||
!CoreLoadSaveState())
|
||||
{
|
||||
this->ui_LoadSaveStateSlotCounter++;
|
||||
if (this->ui_LoadSaveStateSlotCounter >= 5)
|
||||
{ // give up after 5 attempts
|
||||
this->killTimer(this->ui_LoadSaveStateSlotTimerId);
|
||||
this->ui_LoadSaveStateSlotCounter = 0;
|
||||
this->ui_LoadSaveStateSlotTimerId = -1;
|
||||
this->ui_LoadSaveStateSlot = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this->killTimer(this->ui_LoadSaveStateSlotTimerId);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_EventFilter_KeyPressed(QKeyEvent *event)
|
||||
@@ -1801,24 +1841,12 @@ void MainWindow::on_Action_Help_Update(void)
|
||||
|
||||
void MainWindow::on_Action_Audio_IncreaseVolume(void)
|
||||
{
|
||||
if (!CoreIncreaseVolume())
|
||||
{
|
||||
// It's rather annoying to have an error message pop-up everytime
|
||||
// you use the increase volume hotkey when the volume is already
|
||||
// at 100%, so we'll disable the error message
|
||||
//this->showErrorMessage("CoreIncreaseVolume() Failed", QString::fromStdString(CoreGetError()));
|
||||
}
|
||||
CoreIncreaseVolume();
|
||||
}
|
||||
|
||||
void MainWindow::on_Action_Audio_DecreaseVolume(void)
|
||||
{
|
||||
if (!CoreDecreaseVolume())
|
||||
{
|
||||
// It's rather annoying to have an error message pop-up everytime
|
||||
// you use the decrease volume hotkey when the volume is already
|
||||
// at 0%, so we'll disable the error message
|
||||
//this->showErrorMessage("CoreDecreaseVolume() Failed", QString::fromStdString(CoreGetError()));
|
||||
}
|
||||
CoreDecreaseVolume();
|
||||
}
|
||||
|
||||
void MainWindow::on_Action_Audio_ToggleVolumeMute(void)
|
||||
@@ -1916,6 +1944,11 @@ void MainWindow::on_RomBrowser_PlayGameWith(CoreRomType type, QString file)
|
||||
this->launchEmulationThread(mainRom, otherRom);
|
||||
}
|
||||
|
||||
void MainWindow::on_RomBrowser_PlayGameWithSlot(QString file, int slot)
|
||||
{
|
||||
this->launchEmulationThread(file, "", false, slot);
|
||||
}
|
||||
|
||||
void MainWindow::on_RomBrowser_ChangeRomDirectory(void)
|
||||
{
|
||||
QString dir;
|
||||
@@ -2403,6 +2436,11 @@ void MainWindow::on_Core_StateCallback(CoreStateCallbackType type, int value)
|
||||
QString dateTimeText = this->getSaveStateSlotDateTimeText(slotAction);
|
||||
std::string message = "Selected save slot: " + std::to_string(value);
|
||||
|
||||
if (this->ui_LoadSaveStateSlotTimerId != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// add date and time when available
|
||||
if (!dateTimeText.isEmpty())
|
||||
{
|
||||
@@ -2442,7 +2480,28 @@ void MainWindow::on_Core_StateCallback(CoreStateCallbackType type, int value)
|
||||
} break;
|
||||
case CoreStateCallbackType::SaveStateLoaded:
|
||||
{
|
||||
if (value == 0)
|
||||
if (this->ui_LoadSaveStateSlotTimerId != -1 && value == 0)
|
||||
{
|
||||
this->ui_LoadSaveStateSlotCounter++;
|
||||
if (this->ui_LoadSaveStateSlotCounter >= 5)
|
||||
{ // give up after 5 attempts
|
||||
this->showErrorMessage("Failed to load save state");
|
||||
this->ui_LoadSaveStateSlotCounter = 0;
|
||||
this->ui_LoadSaveStateSlotTimerId = -1;
|
||||
this->ui_LoadSaveStateSlot = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->ui_LoadSaveStateSlotTimerId = this->startTimer(500);
|
||||
}
|
||||
}
|
||||
else if (this->ui_LoadSaveStateSlotTimerId != -1 && value != 0)
|
||||
{
|
||||
this->ui_LoadSaveStateSlotCounter = 0;
|
||||
this->ui_LoadSaveStateSlotTimerId = -1;
|
||||
this->ui_LoadSaveStateSlot = -1;
|
||||
}
|
||||
else if (value == 0)
|
||||
{
|
||||
OnScreenDisplaySetMessage("Failed to load save state.");
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
~MainWindow(void);
|
||||
|
||||
bool Init(QApplication* app, bool showUI, bool launchROM);
|
||||
void OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation);
|
||||
void OpenROM(QString file, QString disk, bool fullscreen, bool quitAfterEmulation, int stateSlot);
|
||||
|
||||
private:
|
||||
Thread::EmulationThread *emulationThread = nullptr;
|
||||
@@ -76,6 +76,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
bool ui_LaunchInFullscreen = false;
|
||||
bool ui_QuitAfterEmulation = false;
|
||||
bool ui_RefreshRomListAfterEmulation = false;
|
||||
int ui_LoadSaveStateSlot = -1;
|
||||
|
||||
VidExtRenderMode ui_VidExtRenderMode = VidExtRenderMode::OpenGL;
|
||||
|
||||
@@ -112,6 +113,9 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
int ui_UpdateSaveStateSlotTimerId = 0;
|
||||
int ui_CheckVideoSizeTimerId = 0;
|
||||
|
||||
int ui_LoadSaveStateSlotCounter = 0;
|
||||
int ui_LoadSaveStateSlotTimerId = -1;
|
||||
|
||||
QString ui_WindowTitle;
|
||||
|
||||
Dialog::LogDialog logDialog;
|
||||
@@ -132,7 +136,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
|
||||
void initializeEmulationThread(void);
|
||||
void connectEmulationThreadSignals(void);
|
||||
void launchEmulationThread(QString cartRom, QString diskRom = "", bool refreshRomListAfterEmulation = false);
|
||||
void launchEmulationThread(QString cartRom, QString diskRom = "", bool refreshRomListAfterEmulation = false, int slot = -1);
|
||||
|
||||
QString getSaveStateSlotDateTimeText(QAction* action);
|
||||
QString getSaveStateSlotText(QAction* action, int slot);
|
||||
@@ -214,6 +218,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
|
||||
void on_RomBrowser_PlayGame(QString file);
|
||||
void on_RomBrowser_PlayGameWith(CoreRomType type, QString file);
|
||||
void on_RomBrowser_PlayGameWithSlot(QString file, int slot);
|
||||
void on_RomBrowser_ChangeRomDirectory(void);
|
||||
void on_RomBrowser_RomInformation(QString file);
|
||||
void on_RomBrowser_EditGameSettings(QString file);
|
||||
|
||||
@@ -174,6 +174,7 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
|
||||
this->contextMenu = new QMenu(this);
|
||||
this->action_PlayGame = new QAction(this);
|
||||
this->action_PlayGameWith = new QAction(this);
|
||||
this->menu_PlayGameWithSlot = new QMenu(this);
|
||||
this->action_RefreshRomList = new QAction(this);
|
||||
this->action_OpenRomDirectory = new QAction(this);
|
||||
this->action_ChangeRomDirectory = new QAction(this);
|
||||
@@ -192,6 +193,7 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
|
||||
// configure context menu contents
|
||||
this->action_PlayGame->setText("Play Game");
|
||||
this->action_PlayGameWith->setText("Play Game with Disk");
|
||||
this->menu_PlayGameWithSlot->menuAction()->setText("Play Game with State");
|
||||
this->action_RefreshRomList->setText("Refresh ROM List");
|
||||
this->action_OpenRomDirectory->setText("Open ROM Directory");
|
||||
this->action_ChangeRomDirectory->setText("Change ROM Directory...");
|
||||
@@ -219,6 +221,7 @@ RomBrowserWidget::RomBrowserWidget(QWidget *parent) : QStackedWidget(parent)
|
||||
// configure context menu
|
||||
this->contextMenu->addAction(this->action_PlayGame);
|
||||
this->contextMenu->addAction(this->action_PlayGameWith);
|
||||
this->contextMenu->addMenu(this->menu_PlayGameWithSlot);
|
||||
this->contextMenu->addSeparator();
|
||||
this->contextMenu->addAction(this->action_RefreshRomList);
|
||||
this->contextMenu->addSeparator();
|
||||
@@ -600,6 +603,7 @@ void RomBrowserWidget::customContextMenuRequested(QPoint position)
|
||||
|
||||
this->action_PlayGame->setEnabled(hasSelection);
|
||||
this->action_PlayGameWith->setEnabled(hasSelection);
|
||||
this->menu_PlayGameWithSlot->menuAction()->setEnabled(hasSelection);
|
||||
this->action_RomInformation->setEnabled(hasSelection);
|
||||
this->action_EditGameSettings->setEnabled(hasSelection);
|
||||
this->action_EditGameInputSettings->setEnabled(hasSelection && CorePluginsHasROMConfig(CorePluginType::Input));
|
||||
@@ -611,6 +615,11 @@ void RomBrowserWidget::customContextMenuRequested(QPoint position)
|
||||
this->action_RemoveCoverImage->setEnabled(hasSelection && !data.coverFile.isEmpty());
|
||||
this->action_RemoveCoverImage->setVisible(view == this->gridViewWidget);
|
||||
|
||||
if (hasSelection)
|
||||
{
|
||||
this->generateStateMenu();
|
||||
}
|
||||
|
||||
if (hasSelection && data.type == CoreRomType::Disk)
|
||||
{ // disk selected
|
||||
this->action_PlayGameWith->setText("Play Game with Cartridge");
|
||||
@@ -658,6 +667,49 @@ void RomBrowserWidget::generateColumnsMenu(void)
|
||||
}
|
||||
}
|
||||
|
||||
void RomBrowserWidget::generateStateMenu(void)
|
||||
{
|
||||
this->menu_PlayGameWithSlot->clear();
|
||||
|
||||
RomBrowserModelData data;
|
||||
|
||||
if (!this->getCurrentData(data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::filesystem::path saveStatePath;
|
||||
QString saveStateSlotText;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (!CoreGetSaveStatePath(data.header, data.settings, i, saveStatePath))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QFileInfo saveStateFileInfo(QString::fromStdWString(saveStatePath.wstring()));
|
||||
if (!saveStatePath.empty() && saveStateFileInfo.exists())
|
||||
{
|
||||
saveStateSlotText = "Slot " + QString::number(i) + " - ";
|
||||
saveStateSlotText += saveStateFileInfo.lastModified().toString("dd/MM/yyyy hh:mm");
|
||||
|
||||
QAction* slotAction = this->menu_PlayGameWithSlot->addAction(saveStateSlotText);
|
||||
connect(slotAction, &QAction::triggered, [=, this]()
|
||||
{
|
||||
QString slotText = slotAction->text().split(" ").at(1);
|
||||
// sometimes the text can contain a '&'
|
||||
// which will make the toInt() function return 0
|
||||
// so strip it out
|
||||
slotText.remove('&');
|
||||
this->on_Action_PlayGameWithSlot(slotText.toInt());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this->menu_PlayGameWithSlot->setDisabled(this->menu_PlayGameWithSlot->isEmpty());
|
||||
}
|
||||
|
||||
void RomBrowserWidget::on_listViewWidget_sortIndicatorChanged(int logicalIndex, Qt::SortOrder sortOrder)
|
||||
{
|
||||
CoreSettingsSetValue(SettingsID::RomBrowser_ListViewSortSection, logicalIndex);
|
||||
@@ -891,6 +943,18 @@ void RomBrowserWidget::on_Action_PlayGameWith(void)
|
||||
emit this->PlayGameWith(data.type, data.file);
|
||||
}
|
||||
|
||||
void RomBrowserWidget::on_Action_PlayGameWithSlot(int slot)
|
||||
{
|
||||
RomBrowserModelData data;
|
||||
|
||||
if (!this->getCurrentData(data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
emit this->PlayGameWithSlot(data.file, slot);
|
||||
}
|
||||
|
||||
void RomBrowserWidget::on_Action_RefreshRomList(void)
|
||||
{
|
||||
this->RefreshRomList();
|
||||
|
||||
@@ -88,6 +88,7 @@ class RomBrowserWidget : public QStackedWidget
|
||||
QAction* action_SetCoverImage;
|
||||
QAction* action_RemoveCoverImage;
|
||||
|
||||
QMenu* menu_PlayGameWithSlot;
|
||||
QMenu* menu_Columns;
|
||||
QAction* action_ColumnsMenuEntry;
|
||||
|
||||
@@ -110,6 +111,7 @@ class RomBrowserWidget : public QStackedWidget
|
||||
void on_DoubleClicked(const QModelIndex& index);
|
||||
void customContextMenuRequested(QPoint position);
|
||||
void generateColumnsMenu(void);
|
||||
void generateStateMenu(void);
|
||||
|
||||
void on_listViewWidget_sortIndicatorChanged(int logicalIndex, Qt::SortOrder sortOrder);
|
||||
void on_listViewWidget_sectionResized(int logicalIndex, int oldWidth, int newWidth);
|
||||
@@ -126,6 +128,7 @@ class RomBrowserWidget : public QStackedWidget
|
||||
|
||||
void on_Action_PlayGame(void);
|
||||
void on_Action_PlayGameWith(void);
|
||||
void on_Action_PlayGameWithSlot(int);
|
||||
void on_Action_RefreshRomList(void);
|
||||
void on_Action_OpenRomDirectory(void);
|
||||
void on_Action_ChangeRomDirectory(void);
|
||||
@@ -140,6 +143,7 @@ class RomBrowserWidget : public QStackedWidget
|
||||
signals:
|
||||
void PlayGame(QString);
|
||||
void PlayGameWith(CoreRomType, QString);
|
||||
void PlayGameWithSlot(QString, int);
|
||||
void EditGameSettings(QString);
|
||||
void EditGameInputSettings(QString);
|
||||
void Cheats(QString);
|
||||
|
||||
+11
-1
@@ -169,6 +169,7 @@ int main(int argc, char **argv)
|
||||
QCommandLineOption fullscreenOption({"f", "fullscreen"}, "Launches ROM in fullscreen mode");
|
||||
QCommandLineOption noGuiOption({"n", "nogui"}, "Hides GUI elements (menubar, toolbar, statusbar)");
|
||||
QCommandLineOption quitAfterEmulationOption({"q", "quit-after-emulation"}, "Quits RMG when emulation has finished");
|
||||
QCommandLineOption loadStateSlot("load-state-slot", "Loads save state slot when launching the ROM", "Slot Number");
|
||||
QCommandLineOption diskOption("disk", "64DD Disk to open ROM in combination with", "64DD Disk");
|
||||
|
||||
#ifndef PORTABLE_INSTALL
|
||||
@@ -181,6 +182,7 @@ int main(int argc, char **argv)
|
||||
parser.addOption(fullscreenOption);
|
||||
parser.addOption(noGuiOption);
|
||||
parser.addOption(quitAfterEmulationOption);
|
||||
parser.addOption(loadStateSlot);
|
||||
parser.addOption(diskOption);
|
||||
parser.addPositionalArgument("ROM", "ROM to open");
|
||||
|
||||
@@ -228,7 +230,15 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!args.empty())
|
||||
{
|
||||
window.OpenROM(args.at(0), parser.value(diskOption), parser.isSet(fullscreenOption), parser.isSet(quitAfterEmulationOption));
|
||||
bool parsedNumber = false;
|
||||
int saveStateSlot = parser.value(loadStateSlot).toInt(&parsedNumber);
|
||||
if (parser.value(loadStateSlot).isEmpty() || !parsedNumber ||
|
||||
saveStateSlot < 0 || saveStateSlot > 9)
|
||||
{
|
||||
saveStateSlot = -1;
|
||||
}
|
||||
|
||||
window.OpenROM(args.at(0), parser.value(diskOption), parser.isSet(fullscreenOption), parser.isSet(quitAfterEmulationOption), saveStateSlot);
|
||||
}
|
||||
|
||||
// show window
|
||||
|
||||
@@ -12,7 +12,7 @@ git clone https://github.com/project64/project64 "$tmp_dir"
|
||||
cd "$tmp_dir"
|
||||
|
||||
# latest commit of cheats change
|
||||
git checkout e60f7ec6489e22c8b1988931f8ce3ca46edae91c -f
|
||||
git checkout 1bde8589e95478a7e82bfa67e84c3face0802e1b -f
|
||||
|
||||
for file in "$source_cheat_dir"/*.cht
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user