dolphin/Source/Core/Core/ConfigManager.h

310 lines
6.9 KiB
C
Raw Normal View History

// Copyright 2008 Dolphin Emulator Project
2015-05-18 01:08:10 +02:00
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
#include <vector>
#include "Common/IniFile.h"
#include "Common/NonCopyable.h"
#include "Common/SysConf.h"
#include "Core/HW/EXI_Device.h"
#include "Core/HW/SI_Device.h"
#include "DiscIO/Volume.h"
2013-01-16 20:16:56 -05:00
// DSP Backend Types
#define BACKEND_NULLSOUND _trans("No audio output")
#define BACKEND_ALSA "ALSA"
#define BACKEND_AOSOUND "AOSound"
#define BACKEND_COREAUDIO "CoreAudio"
#define BACKEND_OPENAL "OpenAL"
#define BACKEND_PULSEAUDIO "Pulse"
#define BACKEND_XAUDIO2 "XAudio2"
#define BACKEND_OPENSLES "OpenSLES"
enum GPUDeterminismMode
{
GPU_DETERMINISM_AUTO,
GPU_DETERMINISM_NONE,
// This is currently the only mode. There will probably be at least
// one more at some point.
GPU_DETERMINISM_FAKE_COMPLETION,
};
struct SConfig : NonCopyable
{
// Wii Devices
bool m_WiiSDCard;
bool m_WiiKeyboard;
2013-02-11 17:58:56 -06:00
bool m_WiimoteContinuousScanning;
bool m_WiimoteEnableSpeaker;
// name of the last used filename
std::string m_LastFilename;
2014-10-20 17:49:33 -04:00
// ISO folder
std::vector<std::string> m_ISOFolder;
bool m_RecursiveISOFolder;
// Settings
bool bEnableDebugging;
#ifdef USE_GDBSTUB
int iGDBPort;
#ifndef _WIN32
std::string gdb_socket;
#endif
#endif
bool bAutomaticStart;
bool bBootToPause;
int iCPUCore;
// JIT (shared between JIT and JITIL)
bool bJITNoBlockCache, bJITNoBlockLinking;
bool bJITOff;
bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff;
bool bJITLoadStoreFloatingOff;
bool bJITLoadStorePairedOff;
bool bJITFloatingPointOff;
bool bJITIntegerOff;
bool bJITPairedOff;
bool bJITSystemRegistersOff;
bool bJITBranchOff;
bool bJITILTimeProfiling;
bool bJITILOutputIR;
bool bFastmem;
bool bFPRF;
bool bAccurateNaNs;
int iTimingVariance; // in milli secounds
bool bCPUThread;
bool bDSPThread;
bool bDSPHLE;
bool bSkipIdle;
bool bSyncGPUOnSkipIdleHack;
bool bNTSC;
bool bForceNTSCJ;
bool bHLE_BS2;
bool bEnableCheats;
bool bEnableMemcardSdWriting;
bool bDPL2Decoder;
int iLatency;
bool bRunCompareServer;
bool bRunCompareClient;
bool bMMU;
bool bDCBZOFF;
int iBBDumpPort;
bool bFastDiscSpeed;
bool bSyncGPU;
int iSyncGpuMaxDistance;
int iSyncGpuMinDistance;
float fSyncGpuOverclock;
int SelectedLanguage;
bool bOverrideGCLanguage;
bool bWii;
// Interface settings
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers, bOnScreenDisplayMessages;
std::string theme_name;
// Display settings
std::string strFullscreenResolution;
int iRenderWindowXPos, iRenderWindowYPos;
int iRenderWindowWidth, iRenderWindowHeight;
bool bRenderWindowAutoSize, bKeepWindowOnTop;
bool bFullscreen, bRenderToMain;
bool bProgressive, bPAL60;
bool bDisableScreenSaver;
int iPosX, iPosY, iWidth, iHeight;
// Fifo Player related settings
bool bLoopFifoReplay;
enum EBootBS2
{
BOOT_DEFAULT,
BOOT_BS2_JAP,
BOOT_BS2_USA,
BOOT_BS2_EUR,
};
enum EBootType
{
BOOT_ISO,
BOOT_ELF,
BOOT_DOL,
BOOT_WII_NAND,
BOOT_BS2,
BOOT_DFF
};
EBootType m_BootType;
std::string m_strVideoBackend;
std::string m_strGPUDeterminismMode;
// set based on the string version
GPUDeterminismMode m_GPUDeterminismMode;
// files
std::string m_strFilename;
std::string m_strBootROM;
std::string m_strSRAM;
std::string m_strDefaultISO;
std::string m_strDVDRoot;
std::string m_strApploader;
std::string m_strUniqueID;
std::string m_strName;
u16 m_revision;
std::string m_perfDir;
void LoadDefaults();
bool AutoSetup(EBootBS2 _BootBS2);
const std::string &GetUniqueID() const { return m_strUniqueID; }
void CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA);
DiscIO::IVolume::ELanguage GetCurrentLanguage(bool wii) const;
IniFile LoadDefaultGameIni() const;
IniFile LoadLocalGameIni() const;
IniFile LoadGameIni() const;
static IniFile LoadDefaultGameIni(const std::string& id, u16 revision);
static IniFile LoadLocalGameIni(const std::string& id, u16 revision);
static IniFile LoadGameIni(const std::string& id, u16 revision);
static std::vector<std::string> GetGameIniFilenames(const std::string& id, u16 revision);
std::string m_NANDPath;
std::string m_strMemoryCardA;
std::string m_strMemoryCardB;
std::string m_strGbaCartA;
std::string m_strGbaCartB;
TEXIDevices m_EXIDevice[3];
SIDevices m_SIDevice[4];
std::string m_bba_mac;
// interface language
int m_InterfaceLanguage;
float m_EmulationSpeed;
bool m_OCEnable;
float m_OCFactor;
// other interface settings
bool m_InterfaceToolbar;
bool m_InterfaceStatusbar;
bool m_InterfaceLogWindow;
bool m_InterfaceLogConfigWindow;
bool m_InterfaceExtendedFPSInfo;
bool m_ListDrives;
bool m_ListWad;
bool m_ListElfDol;
bool m_ListWii;
bool m_ListGC;
bool m_ListPal;
bool m_ListUsa;
bool m_ListJap;
bool m_ListAustralia;
bool m_ListFrance;
bool m_ListGermany;
bool m_ListItaly;
bool m_ListKorea;
bool m_ListNetherlands;
bool m_ListRussia;
bool m_ListSpain;
bool m_ListTaiwan;
bool m_ListWorld;
bool m_ListUnknown;
int m_ListSort;
int m_ListSort2;
// Game list column toggles
bool m_showSystemColumn;
bool m_showBannerColumn;
bool m_showMakerColumn;
2015-10-11 04:44:53 +02:00
bool m_showFileNameColumn;
bool m_showIDColumn;
bool m_showRegionColumn;
bool m_showSizeColumn;
bool m_showStateColumn;
// Toggles whether compressed titles show up in blue in the game list
bool m_ColorCompressed;
std::string m_WirelessMac;
bool m_PauseMovie;
bool m_ShowLag;
2014-09-30 18:49:44 -04:00
bool m_ShowFrameCount;
std::string m_strMovieAuthor;
unsigned int m_FrameSkip;
bool m_DumpFrames;
bool m_DumpFramesSilent;
2014-10-17 21:08:34 -04:00
bool m_ShowInputDisplay;
bool m_PauseOnFocusLost;
2013-01-16 20:16:56 -05:00
// DSP settings
bool m_DSPEnableJIT;
bool m_DSPCaptureLog;
2013-01-16 20:16:56 -05:00
bool m_DumpAudio;
bool m_IsMuted;
bool m_DumpUCode;
2013-01-16 20:16:56 -05:00
int m_Volume;
std::string sBackend;
// Input settings
bool m_BackgroundInput;
Make the Wii U Gamecube adapter work with less magic. The Wii U Gamecube controller adapter setup has always been a bit weird. It tries to be as automatic as possible to make the user experience as easy as possible. The problem with this approach is that it brings a large disconnect in the user experience because you have the Gamecube controller setup with regular gamepads and then for some reason below that you have a "direct connect" option which will cause the Gamecube Adapter to overwrite the regular inputs if something was connected. While this works and allows the user to only click one checkbox to get the device working, it breaks the user's experience because they don't really know what "direct connect" means and won't look it up to figure out what it is. Just expecting the device to work (At least one occurence of this in the IRC channel in the last week). This way around also had the terrible nature of making the code more filthy than it needed to be. The GCAdapter namespace was parasitic and hooked in to the regular GC Controller SI class to overwrite the data that it was getting from the default configuration. Now instead we have a specific SIDevice class for the Wii U Gamecube adapter. This class is fairly simple and is a child of the regular SI Gamecube Pad device and only reimplements what it needs to. This also gives the ability to configure controllers individually, which allows the user to configure rumble individually per pad input. Overall the code is cleaner, and it fits more in line with how the rest of Dolphin works.
2015-12-31 11:09:47 -06:00
bool m_AdapterRumble[4];
Fix GCPad recalibration shortcut. Dolphin has supported the recalibration shortcut (X+Y+Start) for quite a long while. So if someont's axises are terrible, you could easily recalibrate. Games even get the initial calibration upon boot(Most of the time). While changing over the GCAdapter code, I was testing to make sure the reset and calibration shortcuts still worked, turns out they didn't work at all. Looking in to the problem, we capture the combination properly, and we wait three seconds until we actually fire that off recalibration. The problem is for Nintendo's SDK to properly handle recalibrating, we need to send back data saying that it needs to recalibrate. On hardware this is done as part of the 64bits of data the controller sends back to us. On holding of the controller, bit 61 of the return value is set, which the Nintendo SDK catches, and then signals immediately afterwards a CMD_ORIGIN command in order to recalibrate the controller. We were outright ignoring this bit, so the library wasn't ever recalibrating. I suspect in the past the class itself used to use the calibration data to to offset the data, but somewhere along the lines it got munged out of existence. The Gamecube adapter does this shortcut in a bit of a unique way, instead of sending the command and having the library support it and what have you. Once holding the shortcut for the amount of time, the adapter reports back that the controller has actually been disconnected. Then when you let go of the combination, the adapter states that a new device has been connected to that port, and the recalibration happens because a new device is "connected." This fixes controller calibration for both emulated GC controllers and also the Wii Gamecube Adapter.
2015-12-31 11:23:04 -06:00
bool m_AdapterKonga[4];
SysConf* m_SYSCONF;
// Save settings
void SaveSettings();
// Load settings
void LoadSettings();
// Return the permanent and somewhat globally used instance of this struct
static SConfig& GetInstance() { return(*m_Instance); }
static void Init();
static void Shutdown();
private:
SConfig();
~SConfig();
2014-06-16 01:12:43 -04:00
void SaveGeneralSettings(IniFile& ini);
void SaveInterfaceSettings(IniFile& ini);
void SaveDisplaySettings(IniFile& ini);
void SaveGameListSettings(IniFile& ini);
void SaveCoreSettings(IniFile& ini);
void SaveDSPSettings(IniFile& ini);
void SaveInputSettings(IniFile& ini);
2014-06-16 01:12:43 -04:00
void SaveMovieSettings(IniFile& ini);
void SaveFifoPlayerSettings(IniFile& ini);
void LoadGeneralSettings(IniFile& ini);
void LoadInterfaceSettings(IniFile& ini);
void LoadDisplaySettings(IniFile& ini);
void LoadGameListSettings(IniFile& ini);
void LoadCoreSettings(IniFile& ini);
void LoadDSPSettings(IniFile& ini);
void LoadInputSettings(IniFile& ini);
2014-06-16 01:12:43 -04:00
void LoadMovieSettings(IniFile& ini);
void LoadFifoPlayerSettings(IniFile& ini);
static SConfig* m_Instance;
};