2018-11-14 20:09:17 +00:00
|
|
|
#ifdef OS_WINDOWS
|
2015-03-06 09:16:25 +00:00
|
|
|
# include <windows.h>
|
|
|
|
#else
|
|
|
|
# include "winlnxdefs.h"
|
2018-11-14 20:09:17 +00:00
|
|
|
#endif // OS_WINDOWS
|
2015-03-06 09:16:25 +00:00
|
|
|
#include "RSP.h"
|
|
|
|
#include "PluginAPI.h"
|
|
|
|
#include "Config.h"
|
2017-10-31 10:42:48 +00:00
|
|
|
#include "GBI.h"
|
2015-05-29 14:51:19 +00:00
|
|
|
#include "wst.h"
|
2020-11-16 04:28:21 +00:00
|
|
|
#include "osal_keys.h"
|
2015-03-06 09:16:25 +00:00
|
|
|
|
|
|
|
void Config::resetToDefaults()
|
|
|
|
{
|
|
|
|
version = CONFIG_VERSION_CURRENT;
|
|
|
|
|
2015-10-08 19:06:13 +00:00
|
|
|
#if defined(PANDORA) || defined(VC)
|
2015-05-31 12:17:28 +00:00
|
|
|
video.fullscreen = 1;
|
|
|
|
video.fullscreenWidth = video.windowedWidth = 800;
|
|
|
|
#else
|
2015-03-06 09:16:25 +00:00
|
|
|
video.fullscreen = 0;
|
|
|
|
video.fullscreenWidth = video.windowedWidth = 640;
|
2015-05-31 12:17:28 +00:00
|
|
|
#endif
|
2015-03-06 09:16:25 +00:00
|
|
|
video.fullscreenHeight = video.windowedHeight = 480;
|
|
|
|
video.fullscreenRefresh = 60;
|
2018-08-26 10:03:02 +00:00
|
|
|
video.fxaa = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
video.multisampling = 0;
|
2020-12-23 22:47:13 +00:00
|
|
|
video.maxMultiSampling = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
video.verticalSync = 0;
|
2020-01-02 09:41:18 +00:00
|
|
|
|
2021-04-21 04:02:49 +00:00
|
|
|
#if defined(OS_ANDROID)
|
2019-11-23 05:54:44 +00:00
|
|
|
video.threadedVideo = 1;
|
2021-04-21 04:02:49 +00:00
|
|
|
#else
|
|
|
|
video.threadedVideo = 0;
|
2020-01-02 09:41:18 +00:00
|
|
|
#endif
|
2015-03-06 09:16:25 +00:00
|
|
|
|
2021-07-22 05:05:13 +00:00
|
|
|
texture.anisotropy = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
texture.maxAnisotropy = 0;
|
2022-01-29 22:51:08 +00:00
|
|
|
texture.bilinearMode = BILINEAR_3POINT;
|
2019-02-07 10:22:14 +00:00
|
|
|
texture.enableHalosRemoval = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
|
|
|
|
generalEmulation.enableLOD = 1;
|
2020-03-28 11:42:50 +00:00
|
|
|
generalEmulation.enableHiresNoiseDithering = 0;
|
|
|
|
generalEmulation.enableDitheringPattern = 0;
|
2020-04-02 07:42:18 +00:00
|
|
|
generalEmulation.enableDitheringQuantization = 1;
|
2020-03-28 11:42:50 +00:00
|
|
|
generalEmulation.rdramImageDitheringMode = BufferDitheringMode::bdmBlueNoise;
|
2015-03-06 09:16:25 +00:00
|
|
|
generalEmulation.enableHWLighting = 0;
|
2021-01-03 14:55:08 +00:00
|
|
|
generalEmulation.enableCoverage = 0;
|
2021-01-20 10:07:23 +00:00
|
|
|
generalEmulation.enableClipping = 1;
|
2015-03-21 16:10:51 +00:00
|
|
|
generalEmulation.enableCustomSettings = 1;
|
2015-10-03 13:31:16 +00:00
|
|
|
generalEmulation.enableShadersStorage = 1;
|
2016-07-17 05:15:02 +00:00
|
|
|
generalEmulation.enableLegacyBlending = 0;
|
2020-02-08 20:53:50 +00:00
|
|
|
generalEmulation.enableHybridFilter = 1;
|
2021-10-11 23:22:23 +00:00
|
|
|
generalEmulation.enableInaccurateTextureCoordinates = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
generalEmulation.hacks = 0;
|
2018-03-30 12:26:18 +00:00
|
|
|
#if defined(OS_ANDROID) || defined(OS_IOS)
|
2016-09-07 14:11:31 +00:00
|
|
|
generalEmulation.enableFragmentDepthWrite = 0;
|
2015-07-06 11:58:51 +00:00
|
|
|
generalEmulation.forcePolygonOffset = 0;
|
|
|
|
generalEmulation.polygonOffsetFactor = 0.0f;
|
|
|
|
generalEmulation.polygonOffsetUnits = 0.0f;
|
2017-02-08 13:27:14 +00:00
|
|
|
#else
|
|
|
|
generalEmulation.enableFragmentDepthWrite = 1;
|
2015-07-06 11:58:51 +00:00
|
|
|
#endif
|
2015-03-06 09:16:25 +00:00
|
|
|
|
2022-02-20 13:57:08 +00:00
|
|
|
//Fix the texture coordinates when two 2D rectangles are next to each other
|
|
|
|
//The game creates a gap of half a pixel
|
|
|
|
graphics2D.correctTexrectCoords = tcSmart;
|
2019-11-27 10:08:17 +00:00
|
|
|
graphics2D.enableNativeResTexrects = NativeResTexrectsMode::ntDisable;
|
2019-01-26 08:08:55 +00:00
|
|
|
graphics2D.bgMode = BGMode::bgStripped;
|
2021-02-12 21:52:19 +00:00
|
|
|
graphics2D.enableTexCoordBounds = 0;
|
2019-01-26 08:08:55 +00:00
|
|
|
|
2015-03-06 09:16:25 +00:00
|
|
|
frameBufferEmulation.enable = 1;
|
2016-11-04 07:06:46 +00:00
|
|
|
frameBufferEmulation.copyDepthToRDRAM = cdSoftwareRender;
|
2015-03-06 09:16:25 +00:00
|
|
|
frameBufferEmulation.copyFromRDRAM = 0;
|
2015-10-31 02:21:09 +00:00
|
|
|
frameBufferEmulation.copyAuxToRDRAM = 0;
|
2018-02-21 06:29:10 +00:00
|
|
|
frameBufferEmulation.copyToRDRAM = ctDoubleBuffer;
|
2020-02-09 06:02:55 +00:00
|
|
|
frameBufferEmulation.N64DepthCompare = dcDisable;
|
2018-05-01 12:21:30 +00:00
|
|
|
frameBufferEmulation.forceDepthBufferClear = 0;
|
2022-01-29 22:51:08 +00:00
|
|
|
frameBufferEmulation.aspect = aAdjust;
|
2015-12-14 15:36:07 +00:00
|
|
|
frameBufferEmulation.bufferSwapMode = bsOnVerticalInterrupt;
|
2016-02-09 17:33:31 +00:00
|
|
|
frameBufferEmulation.nativeResFactor = 0;
|
2016-02-03 16:18:40 +00:00
|
|
|
frameBufferEmulation.fbInfoReadColorChunk = 0;
|
|
|
|
frameBufferEmulation.fbInfoReadDepthChunk = 1;
|
2019-06-27 09:21:51 +00:00
|
|
|
frameBufferEmulation.copyDepthToMainDepthBuffer = 0;
|
2016-03-02 05:28:14 +00:00
|
|
|
#ifndef MUPENPLUSAPI
|
|
|
|
frameBufferEmulation.fbInfoDisabled = 0;
|
|
|
|
#else
|
|
|
|
frameBufferEmulation.fbInfoDisabled = 1;
|
|
|
|
#endif
|
2022-03-26 15:23:33 +00:00
|
|
|
|
|
|
|
#ifdef NATIVE
|
|
|
|
frameBufferEmulation.enableOverscan = 1;
|
|
|
|
config.frameBufferEmulation.overscanPAL.left = 4;
|
|
|
|
config.frameBufferEmulation.overscanPAL.right = 4;
|
|
|
|
config.frameBufferEmulation.overscanPAL.top = 0;
|
|
|
|
config.frameBufferEmulation.overscanPAL.bottom = 3;
|
|
|
|
config.frameBufferEmulation.overscanNTSC.left = 4;
|
|
|
|
config.frameBufferEmulation.overscanNTSC.right = 4;
|
|
|
|
config.frameBufferEmulation.overscanNTSC.top = 0;
|
|
|
|
config.frameBufferEmulation.overscanNTSC.bottom = 3;
|
|
|
|
#else
|
2018-05-05 07:45:18 +00:00
|
|
|
frameBufferEmulation.enableOverscan = 0;
|
2022-03-26 15:23:33 +00:00
|
|
|
#endif
|
2015-03-06 09:16:25 +00:00
|
|
|
|
2016-04-14 15:42:18 +00:00
|
|
|
textureFilter.txFilterMode = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
textureFilter.txEnhancementMode = 0;
|
2016-04-14 15:42:18 +00:00
|
|
|
textureFilter.txDeposterize = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
textureFilter.txFilterIgnoreBG = 0;
|
2016-04-14 15:42:18 +00:00
|
|
|
textureFilter.txCacheSize = 100 * gc_uMegabyte;
|
|
|
|
|
2022-03-25 06:47:38 +00:00
|
|
|
textureFilter.txHiresEnable = 1;
|
2017-11-28 09:31:55 +00:00
|
|
|
textureFilter.txHiresFullAlphaChannel = 1;
|
2015-03-06 09:16:25 +00:00
|
|
|
textureFilter.txHresAltCRC = 0;
|
|
|
|
|
|
|
|
textureFilter.txForce16bpp = 0;
|
2016-04-14 15:42:18 +00:00
|
|
|
textureFilter.txCacheCompression = 1;
|
2015-03-06 09:16:25 +00:00
|
|
|
textureFilter.txSaveCache = 1;
|
|
|
|
|
2022-01-29 22:51:08 +00:00
|
|
|
textureFilter.txEnhancedTextureFileStorage = 1;
|
|
|
|
textureFilter.txHiresTextureFileStorage = 1;
|
2021-08-01 11:22:18 +00:00
|
|
|
textureFilter.txNoTextureFileStorage = 0;
|
2021-10-30 07:57:36 +00:00
|
|
|
|
|
|
|
textureFilter.txHiresVramLimit = 0u;
|
2019-05-23 12:44:28 +00:00
|
|
|
|
2015-05-23 11:53:08 +00:00
|
|
|
api().GetUserDataPath(textureFilter.txPath);
|
2015-05-29 14:51:19 +00:00
|
|
|
gln_wcscat(textureFilter.txPath, wst("/hires_texture"));
|
2017-11-17 08:26:33 +00:00
|
|
|
api().GetUserCachePath(textureFilter.txCachePath);
|
|
|
|
gln_wcscat(textureFilter.txCachePath, wst("/cache"));
|
|
|
|
api().GetUserCachePath(textureFilter.txDumpPath);
|
|
|
|
gln_wcscat(textureFilter.txDumpPath, wst("/texture_dump"));
|
2015-03-06 09:16:25 +00:00
|
|
|
|
2018-11-14 20:09:17 +00:00
|
|
|
#ifdef OS_WINDOWS
|
2015-05-23 11:53:08 +00:00
|
|
|
font.name.assign("arial.ttf");
|
2017-02-09 12:40:29 +00:00
|
|
|
#elif defined (OS_ANDROID)
|
2015-05-30 14:27:17 +00:00
|
|
|
font.name.assign("DroidSans.ttf");
|
2015-05-31 12:17:28 +00:00
|
|
|
#elif defined (PANDORA)
|
2018-03-19 07:08:29 +00:00
|
|
|
font.name.assign("LiberationMono-Regular.ttf");
|
2015-03-06 09:16:25 +00:00
|
|
|
#else
|
2018-03-19 07:08:29 +00:00
|
|
|
font.name = "FreeSans.ttf";
|
2015-03-06 09:16:25 +00:00
|
|
|
#endif
|
|
|
|
font.size = 18;
|
|
|
|
font.color[0] = 0xB5;
|
|
|
|
font.color[1] = 0xE6;
|
|
|
|
font.color[2] = 0x1D;
|
|
|
|
font.color[3] = 0xFF;
|
|
|
|
for (int i = 0; i < 4; ++i)
|
|
|
|
font.colorf[i] = font.color[i] / 255.0f;
|
|
|
|
|
2015-12-23 10:22:30 +00:00
|
|
|
gammaCorrection.force = 0;
|
|
|
|
gammaCorrection.level = 2.0f;
|
2016-09-25 13:21:54 +00:00
|
|
|
|
|
|
|
onScreenDisplay.vis = 0;
|
|
|
|
onScreenDisplay.fps = 0;
|
|
|
|
onScreenDisplay.percent = 0;
|
2021-02-25 15:00:42 +00:00
|
|
|
onScreenDisplay.internalResolution = 0;
|
|
|
|
onScreenDisplay.renderingResolution = 0;
|
|
|
|
onScreenDisplay.statistics = 0;
|
2016-12-04 05:37:28 +00:00
|
|
|
onScreenDisplay.pos = posBottomLeft;
|
2017-06-25 05:53:37 +00:00
|
|
|
|
2021-07-28 12:38:42 +00:00
|
|
|
for (u32 idx = 0; idx < HotKey::hkTotal; ++idx) {
|
|
|
|
hotkeys.enabledKeys[idx] = 0;
|
2020-12-05 09:02:06 +00:00
|
|
|
hotkeys.keys[idx] = 0;
|
2021-07-28 12:38:42 +00:00
|
|
|
}
|
2020-11-16 04:28:21 +00:00
|
|
|
|
2017-06-25 05:53:37 +00:00
|
|
|
debug.dumpMode = 0;
|
2015-03-06 09:16:25 +00:00
|
|
|
}
|
2017-10-31 10:42:48 +00:00
|
|
|
|
|
|
|
bool isHWLightingAllowed()
|
|
|
|
{
|
|
|
|
if (config.generalEmulation.enableHWLighting == 0)
|
|
|
|
return false;
|
|
|
|
return GBI.isHWLSupported();
|
|
|
|
}
|
2018-06-28 09:18:16 +00:00
|
|
|
|
|
|
|
void Config::validate()
|
|
|
|
{
|
2020-02-09 06:02:55 +00:00
|
|
|
if (frameBufferEmulation.enable != 0 && frameBufferEmulation.N64DepthCompare != dcDisable)
|
2018-06-28 09:18:16 +00:00
|
|
|
video.multisampling = 0;
|
|
|
|
if (frameBufferEmulation.nativeResFactor == 1) {
|
2019-01-26 08:08:55 +00:00
|
|
|
graphics2D.enableNativeResTexrects = 0;
|
|
|
|
graphics2D.correctTexrectCoords = tcDisable;
|
2018-06-28 09:18:16 +00:00
|
|
|
} else {
|
2019-01-26 08:08:55 +00:00
|
|
|
if (graphics2D.enableNativeResTexrects != 0)
|
|
|
|
graphics2D.correctTexrectCoords = tcDisable;
|
2018-06-28 09:18:16 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-16 04:28:21 +00:00
|
|
|
|
|
|
|
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";
|
2021-04-11 04:05:34 +00:00
|
|
|
case Config::HotKey::hkTexCoordBounds:
|
|
|
|
return "hkTexCoordBounds";
|
2021-04-11 11:02:21 +00:00
|
|
|
case Config::HotKey::hkNativeResTexrects:
|
|
|
|
return "hkNativeResTexrects";
|
2020-11-16 04:28:21 +00:00
|
|
|
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";
|
2020-12-05 10:35:02 +00:00
|
|
|
case Config::HotKey::hkForceGammaCorrection:
|
|
|
|
return "hkForceGammaCorrection";
|
2022-01-31 17:54:12 +00:00
|
|
|
case Config::HotKey::hkInaccurateTexCords:
|
|
|
|
return "hkInaccurateTexCords";
|
2020-11-16 04:28:21 +00:00
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
2021-07-28 12:38:42 +00:00
|
|
|
|
|
|
|
const char* Config::enabledHotkeyIniName(u32 _idx)
|
|
|
|
{
|
|
|
|
switch (_idx)
|
|
|
|
{
|
|
|
|
case Config::HotKey::hkTexDump:
|
|
|
|
return "hkTexDumpEnabled";
|
|
|
|
case Config::HotKey::hkHdTexReload:
|
|
|
|
return "hkHdTexReloadEnabled";
|
|
|
|
case Config::HotKey::hkHdTexToggle:
|
|
|
|
return "hkHdTexToggleEnabled";
|
|
|
|
case Config::HotKey::hkTexCoordBounds:
|
|
|
|
return "hkTexCoordBoundsEnabled";
|
|
|
|
case Config::HotKey::hkNativeResTexrects:
|
|
|
|
return "hkNativeResTexrectsEnabled";
|
|
|
|
case Config::HotKey::hkVsync:
|
|
|
|
return "hkVsyncEnabled";
|
|
|
|
case Config::HotKey::hkFBEmulation:
|
|
|
|
return "hkFBEmulationEnabled";
|
|
|
|
case Config::HotKey::hkN64DepthCompare:
|
|
|
|
return "hkN64DepthCompareEnabled";
|
|
|
|
case Config::HotKey::hkOsdVis:
|
|
|
|
return "hkOsdVisEnabled";
|
|
|
|
case Config::HotKey::hkOsdFps:
|
|
|
|
return "hkOsdFpsEnabled";
|
|
|
|
case Config::HotKey::hkOsdPercent:
|
|
|
|
return "hkOsdPercentEnabled";
|
|
|
|
case Config::HotKey::hkOsdInternalResolution:
|
|
|
|
return "hkOsdInternalResolutionEnabled";
|
|
|
|
case Config::HotKey::hkOsdRenderingResolution:
|
|
|
|
return "hkOsdRenderingResolutionEnabled";
|
|
|
|
case Config::HotKey::hkForceGammaCorrection:
|
|
|
|
return "hkForceGammaCorrectionEnabled";
|
2022-01-31 17:54:12 +00:00
|
|
|
case Config::HotKey::hkInaccurateTexCords:
|
|
|
|
return "hkInaccurateTexCordsEnabled";
|
2021-07-28 12:38:42 +00:00
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|