1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-30 08:24:05 +00:00
GLideN64/src/Config.cpp

264 lines
7.8 KiB
C++
Raw Normal View History

2018-11-14 20:09:17 +00:00
#ifdef OS_WINDOWS
# include <windows.h>
#else
# include "winlnxdefs.h"
2018-11-14 20:09:17 +00:00
#endif // OS_WINDOWS
#include "RSP.h"
#include "PluginAPI.h"
#include "Config.h"
#include "GBI.h"
#include "wst.h"
2020-11-16 04:28:21 +00:00
#include "osal_keys.h"
void Config::resetToDefaults()
{
version = CONFIG_VERSION_CURRENT;
#if defined(PANDORA) || defined(VC)
2015-05-31 12:17:28 +00:00
video.fullscreen = 1;
video.fullscreenWidth = video.windowedWidth = 800;
#else
video.fullscreen = 0;
video.fullscreenWidth = video.windowedWidth = 640;
2015-05-31 12:17:28 +00:00
#endif
video.fullscreenHeight = video.windowedHeight = 480;
video.fullscreenRefresh = 60;
2018-08-26 10:03:02 +00:00
video.fxaa = 0;
video.multisampling = 0;
video.maxMultiSampling = 0;
video.verticalSync = 0;
#if defined(OS_ANDROID)
video.threadedVideo = 1;
#else
video.threadedVideo = 0;
#endif
texture.anisotropy = 0;
texture.maxAnisotropy = 0;
texture.bilinearMode = BILINEAR_3POINT;
texture.enableHalosRemoval = 0;
generalEmulation.enableLOD = 1;
generalEmulation.enableHiresNoiseDithering = 0;
generalEmulation.enableDitheringPattern = 0;
generalEmulation.enableDitheringQuantization = 1;
generalEmulation.rdramImageDitheringMode = BufferDitheringMode::bdmBlueNoise;
generalEmulation.enableHWLighting = 0;
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;
generalEmulation.enableLegacyBlending = 0;
generalEmulation.enableHybridFilter = 1;
generalEmulation.enableInaccurateTextureCoordinates = 0;
generalEmulation.hacks = 0;
#if defined(OS_ANDROID) || defined(OS_IOS)
generalEmulation.enableFragmentDepthWrite = 0;
generalEmulation.forcePolygonOffset = 0;
generalEmulation.polygonOffsetFactor = 0.0f;
generalEmulation.polygonOffsetUnits = 0.0f;
#else
generalEmulation.enableFragmentDepthWrite = 1;
#endif
//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;
graphics2D.enableNativeResTexrects = NativeResTexrectsMode::ntDisable;
2019-01-26 08:08:55 +00:00
graphics2D.bgMode = BGMode::bgStripped;
graphics2D.enableTexCoordBounds = 0;
2019-01-26 08:08:55 +00:00
frameBufferEmulation.enable = 1;
frameBufferEmulation.copyDepthToRDRAM = cdSoftwareRender;
frameBufferEmulation.copyFromRDRAM = 0;
frameBufferEmulation.copyAuxToRDRAM = 0;
frameBufferEmulation.copyToRDRAM = ctDoubleBuffer;
frameBufferEmulation.N64DepthCompare = dcDisable;
frameBufferEmulation.forceDepthBufferClear = 0;
frameBufferEmulation.aspect = aAdjust;
frameBufferEmulation.bufferSwapMode = bsOnVerticalInterrupt;
frameBufferEmulation.nativeResFactor = 0;
2016-02-03 16:18:40 +00:00
frameBufferEmulation.fbInfoReadColorChunk = 0;
frameBufferEmulation.fbInfoReadDepthChunk = 1;
frameBufferEmulation.copyDepthToMainDepthBuffer = 0;
#ifndef MUPENPLUSAPI
frameBufferEmulation.fbInfoDisabled = 0;
#else
frameBufferEmulation.fbInfoDisabled = 1;
#endif
#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
frameBufferEmulation.enableOverscan = 0;
#endif
textureFilter.txFilterMode = 0;
textureFilter.txEnhancementMode = 0;
textureFilter.txDeposterize = 0;
textureFilter.txFilterIgnoreBG = 0;
textureFilter.txCacheSize = 100 * gc_uMegabyte;
2022-03-25 06:47:38 +00:00
textureFilter.txHiresEnable = 1;
textureFilter.txHiresFullAlphaChannel = 1;
textureFilter.txHresAltCRC = 0;
textureFilter.txForce16bpp = 0;
textureFilter.txCacheCompression = 1;
textureFilter.txSaveCache = 1;
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
api().GetUserDataPath(textureFilter.txPath);
gln_wcscat(textureFilter.txPath, wst("/hires_texture"));
api().GetUserCachePath(textureFilter.txCachePath);
gln_wcscat(textureFilter.txCachePath, wst("/cache"));
api().GetUserCachePath(textureFilter.txDumpPath);
gln_wcscat(textureFilter.txDumpPath, wst("/texture_dump"));
2018-11-14 20:09:17 +00:00
#ifdef OS_WINDOWS
font.name.assign("arial.ttf");
#elif defined (OS_ANDROID)
font.name.assign("DroidSans.ttf");
2015-05-31 12:17:28 +00:00
#elif defined (PANDORA)
font.name.assign("LiberationMono-Regular.ttf");
#else
font.name = "FreeSans.ttf";
#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;
gammaCorrection.force = 0;
gammaCorrection.level = 2.0f;
onScreenDisplay.vis = 0;
onScreenDisplay.fps = 0;
onScreenDisplay.percent = 0;
onScreenDisplay.internalResolution = 0;
onScreenDisplay.renderingResolution = 0;
onScreenDisplay.statistics = 0;
onScreenDisplay.pos = posBottomLeft;
2017-06-25 05:53:37 +00:00
for (u32 idx = 0; idx < HotKey::hkTotal; ++idx) {
hotkeys.enabledKeys[idx] = 0;
hotkeys.keys[idx] = 0;
}
2020-11-16 04:28:21 +00:00
2017-06-25 05:53:37 +00:00
debug.dumpMode = 0;
}
bool isHWLightingAllowed()
{
if (config.generalEmulation.enableHWLighting == 0)
return false;
return GBI.isHWLSupported();
}
void Config::validate()
{
if (frameBufferEmulation.enable != 0 && frameBufferEmulation.N64DepthCompare != dcDisable)
video.multisampling = 0;
if (frameBufferEmulation.nativeResFactor == 1) {
2019-01-26 08:08:55 +00:00
graphics2D.enableNativeResTexrects = 0;
graphics2D.correctTexrectCoords = tcDisable;
} else {
2019-01-26 08:08:55 +00:00
if (graphics2D.enableNativeResTexrects != 0)
graphics2D.correctTexrectCoords = tcDisable;
}
}
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";
case Config::HotKey::hkTexCoordBounds:
return "hkTexCoordBounds";
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";
case Config::HotKey::hkForceGammaCorrection:
return "hkForceGammaCorrection";
case Config::HotKey::hkInaccurateTexCords:
return "hkInaccurateTexCords";
2020-11-16 04:28:21 +00:00
}
return nullptr;
}
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";
case Config::HotKey::hkInaccurateTexCords:
return "hkInaccurateTexCordsEnabled";
}
return nullptr;
}