2 Commits

Author SHA1 Message Date
Neil Haverlandt 5091012cfb Add advanced menus for the Wii emulation wiimotes 2021-01-25 13:19:13 -07:00
Neil Haverlandt 87a769c461 Pass a boolean value to Wiimote sideways and Wiimote upright 2021-01-25 13:18:19 -07:00
26 changed files with 12769 additions and 5456 deletions
-3
View File
@@ -1,3 +0,0 @@
#ifdef __cplusplus
#include "Source/PCH/pch.h"
#endif
+20 -29
View File
@@ -9,7 +9,6 @@
#include "Common/Common.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
// This shouldn't be a global, at least not here.
@@ -29,36 +28,28 @@ namespace AudioCommon
if (!g_sound_stream->Init())
{
WARN_LOG_FMT(AUDIO, "Could not initialize backend");
WARN_LOG(AUDIO, "Could not initialize backend");
g_sound_stream = std::make_unique<NullSound>();
}
UpdateSoundStream();
SetSoundStreamRunning(true);
}
void PostInitSoundStream()
{
// This needs to be called after AudioInterface::Init and SerialInterface::Init (for GBA devices)
// where input sample rates are set
UpdateSoundStream();
SetSoundStreamRunning(true);
if (Config::Get(Config::MAIN_DUMP_AUDIO) && !s_audio_dump_start)
if (SConfig::GetInstance().m_DumpAudio && !s_audio_dump_start)
StartAudioDump();
}
void ShutdownSoundStream()
{
INFO_LOG_FMT(AUDIO, "Shutting down sound stream");
INFO_LOG(AUDIO, "Shutting down sound stream");
if (Config::Get(Config::MAIN_DUMP_AUDIO) && s_audio_dump_start)
if (SConfig::GetInstance().m_DumpAudio && s_audio_dump_start)
StopAudioDump();
SetSoundStreamRunning(false);
g_sound_stream.reset();
INFO_LOG_FMT(AUDIO, "Done shutting down sound stream");
INFO_LOG(AUDIO, "Done shutting down sound stream");
}
std::string GetDefaultSoundBackend()
@@ -101,7 +92,7 @@ DPL2Quality GetDefaultDPL2Quality()
{
if (g_sound_stream)
{
int volume = Config::Get(Config::MAIN_AUDIO_MUTED) ? 0 : Config::Get(Config::MAIN_AUDIO_VOLUME);
int volume = SConfig::GetInstance().m_IsMuted ? 0 : SConfig::GetInstance().m_Volume;
g_sound_stream->SetVolume(volume);
}
}
@@ -118,9 +109,9 @@ DPL2Quality GetDefaultDPL2Quality()
if (g_sound_stream->SetRunning(running))
return;
if (running)
ERROR_LOG_FMT(AUDIO, "Error starting stream.");
ERROR_LOG(AUDIO, "Error starting stream.");
else
ERROR_LOG_FMT(AUDIO, "Error stopping stream.");
ERROR_LOG(AUDIO, "Error stopping stream.");
}
void SendAIBuffer(const short* samples, unsigned int num_samples)
@@ -128,9 +119,9 @@ DPL2Quality GetDefaultDPL2Quality()
if (!g_sound_stream)
return;
if (Config::Get(Config::MAIN_DUMP_AUDIO) && !s_audio_dump_start)
if (SConfig::GetInstance().m_DumpAudio && !s_audio_dump_start)
StartAudioDump();
else if (!Config::Get(Config::MAIN_DUMP_AUDIO) && s_audio_dump_start)
else if (!SConfig::GetInstance().m_DumpAudio && s_audio_dump_start)
StopAudioDump();
Mixer* pMixer = g_sound_stream->GetMixer();
@@ -139,6 +130,8 @@ DPL2Quality GetDefaultDPL2Quality()
{
pMixer->PushSamples(samples, num_samples);
}
g_sound_stream->Update();
}
void StartAudioDump()
@@ -163,30 +156,28 @@ DPL2Quality GetDefaultDPL2Quality()
void IncreaseVolume(unsigned short offset)
{
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_MUTED, false);
int currentVolume = Config::Get(Config::MAIN_AUDIO_VOLUME);
SConfig::GetInstance().m_IsMuted = false;
int& currentVolume = SConfig::GetInstance().m_Volume;
currentVolume += offset;
if (currentVolume > AUDIO_VOLUME_MAX)
currentVolume = AUDIO_VOLUME_MAX;
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_VOLUME, currentVolume);
UpdateSoundStream();
}
void DecreaseVolume(unsigned short offset)
{
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_MUTED, false);
int currentVolume = Config::Get(Config::MAIN_AUDIO_VOLUME);
SConfig::GetInstance().m_IsMuted = false;
int& currentVolume = SConfig::GetInstance().m_Volume;
currentVolume -= offset;
if (currentVolume < AUDIO_VOLUME_MIN)
currentVolume = AUDIO_VOLUME_MIN;
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_VOLUME, currentVolume);
UpdateSoundStream();
}
void ToggleMuteVolume()
{
bool isMuted = Config::Get(Config::MAIN_AUDIO_MUTED);
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_MUTED, !isMuted);
UpdateSoundStream();
bool& isMuted = SConfig::GetInstance().m_IsMuted;
isMuted = !isMuted;
UpdateSoundStream();
}
} // namespace AudioCommon
-29
View File
@@ -1,29 +0,0 @@
// Copyright (c) 2022, OpenEmu Team
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the OpenEmu Team nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __x86_64__
#include "../../dolphin/Source/Core/Common/x64CPUDetect.cpp"
#elif defined(__arm64__)
#include "../../dolphin/Source/Core/Common/ArmCPUDetect.cpp"
#endif
-27
View File
@@ -1,27 +0,0 @@
// Copyright (c) 2022, OpenEmu Team
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the OpenEmu Team nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __x86_64__
#include "../../dolphin/Source/Core/Common/x64FPURoundMode.cpp"
#endif
+7 -13
View File
@@ -20,7 +20,7 @@
#include "Common/CommonFuncs.h"
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/IOFile.h"
#include "Common/File.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
@@ -479,7 +479,7 @@ bool CreateEmptyFile(const std::string& filename)
}
// Recursive or non-recursive list of files and directories under directory.
FSTEntry ScanDirectoryTree(std::string directory, bool recursive)
FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
{
INFO_LOG_FMT(COMMON, "ScanDirectoryTree: directory {}", directory);
FSTEntry parent_entry;
@@ -781,7 +781,7 @@ std::string GetTempFilenameForAtomicWrite(std::string path)
std::string GetBundleDirectory()
{
//OpenEmu
GET_CURRENT_OR_RETURN("");
GET_CURRENT_OR_RETURN();
return [current getBundlePath];
}
@@ -834,7 +834,7 @@ std::string GetExeDirectory()
#endif
}
static std::string CreateSysDirectoryPath()
std::string GetSysDirectory()
{
std::string sysDir;
@@ -867,12 +867,6 @@ static std::string CreateSysDirectoryPath()
return sysDir;
}
const std::string& GetSysDirectory()
{
static const std::string sys_directory = CreateSysDirectoryPath();
return sys_directory;
}
#ifdef ANDROID
void SetSysDirectory(const std::string& path)
{
@@ -933,7 +927,7 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[F_ARAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + ARAM_DUMP;
s_user_paths[F_FAKEVMEMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + FAKEVMEM_DUMP;
s_user_paths[F_GCSRAM_IDX] = s_user_paths[D_GCUSER_IDX] + GC_SRAM;
s_user_paths[F_WIISDCARDIMAGE_IDX] = s_user_paths[D_WIIROOT_IDX] + DIR_SEP WII_SD_CARD_IMAGE;
s_user_paths[F_WIISDCARD_IDX] = s_user_paths[D_WIIROOT_IDX] + DIR_SEP WII_SDCARD;
s_user_paths[D_MEMORYWATCHER_IDX] = s_user_paths[D_USER_IDX] + MEMORYWATCHER_DIR DIR_SEP;
s_user_paths[F_MEMORYWATCHERLOCATIONS_IDX] =
@@ -999,12 +993,12 @@ const std::string& GetUserPath(unsigned int dir_index)
// Sets a user directory path
// Rebuilds internal directory structure to compensate for the new directory
void SetUserPath(unsigned int dir_index, std::string path)
void SetUserPath(unsigned int dir_index, const std::string& path)
{
if (path.empty())
return;
s_user_paths[dir_index] = path + DIR_SEP;
s_user_paths[dir_index] = path;
RebuildUserDirectories(dir_index);
}
+637 -21
View File
@@ -28,6 +28,7 @@
#include "Common/StringUtil.h"
#include "Common/scmrev.h"
#include "Core/Analytics.h"
#include "Core/Boot/Boot.h"
#include "Core/CommonTitles.h"
#include "Core/Config/MainSettings.h"
@@ -81,13 +82,538 @@ SConfig::~SConfig()
void SConfig::SaveSettings()
{
NOTICE_LOG_FMT(BOOT, "Saving settings to {}", File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
SaveGeneralSettings(ini);
SaveInterfaceSettings(ini);
SaveGameListSettings(ini);
SaveCoreSettings(ini);
SaveMovieSettings(ini);
SaveDSPSettings(ini);
SaveInputSettings(ini);
SaveFifoPlayerSettings(ini);
SaveBluetoothPassthroughSettings(ini);
SaveUSBPassthroughSettings(ini);
SaveAutoUpdateSettings(ini);
SaveJitDebugSettings(ini);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
Config::Save();
}
void SConfig::SaveGeneralSettings(IniFile& ini)
{
IniFile::Section* general = ini.GetOrCreateSection("General");
// General
general->Set("ShowLag", m_ShowLag);
general->Set("ShowFrameCount", m_ShowFrameCount);
// ISO folders
// Clear removed folders
int oldPaths;
int numPaths = (int)m_ISOFolder.size();
general->Get("ISOPaths", &oldPaths, 0);
for (int i = numPaths; i < oldPaths; i++)
{
ini.DeleteKey("General", fmt::format("ISOPath{}", i));
}
general->Set("ISOPaths", numPaths);
for (int i = 0; i < numPaths; i++)
{
general->Set(fmt::format("ISOPath{}", i), m_ISOFolder[i]);
}
general->Set("WirelessMac", m_WirelessMac);
#ifdef USE_GDBSTUB
#ifndef _WIN32
general->Set("GDBSocket", gdb_socket);
#endif
general->Set("GDBPort", iGDBPort);
#endif
}
void SConfig::SaveInterfaceSettings(IniFile& ini)
{
IniFile::Section* interface = ini.GetOrCreateSection("Interface");
interface->Set("ConfirmStop", bConfirmStop);
interface->Set("HideCursor", bHideCursor);
interface->Set("LanguageCode", m_InterfaceLanguage);
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
interface->Set("ShowActiveTitle", m_show_active_title);
interface->Set("UseBuiltinTitleDatabase", m_use_builtin_title_database);
interface->Set("ThemeName", theme_name);
interface->Set("PauseOnFocusLost", m_PauseOnFocusLost);
interface->Set("DebugModeEnabled", bEnableDebugging);
}
void SConfig::SaveGameListSettings(IniFile& ini)
{
IniFile::Section* gamelist = ini.GetOrCreateSection("GameList");
gamelist->Set("ListDrives", m_ListDrives);
gamelist->Set("ListWad", m_ListWad);
gamelist->Set("ListElfDol", m_ListElfDol);
gamelist->Set("ListWii", m_ListWii);
gamelist->Set("ListGC", m_ListGC);
gamelist->Set("ListJap", m_ListJap);
gamelist->Set("ListPal", m_ListPal);
gamelist->Set("ListUsa", m_ListUsa);
gamelist->Set("ListAustralia", m_ListAustralia);
gamelist->Set("ListFrance", m_ListFrance);
gamelist->Set("ListGermany", m_ListGermany);
gamelist->Set("ListItaly", m_ListItaly);
gamelist->Set("ListKorea", m_ListKorea);
gamelist->Set("ListNetherlands", m_ListNetherlands);
gamelist->Set("ListRussia", m_ListRussia);
gamelist->Set("ListSpain", m_ListSpain);
gamelist->Set("ListTaiwan", m_ListTaiwan);
gamelist->Set("ListWorld", m_ListWorld);
gamelist->Set("ListUnknown", m_ListUnknown);
gamelist->Set("ListSort", m_ListSort);
gamelist->Set("ListSortSecondary", m_ListSort2);
gamelist->Set("ColumnPlatform", m_showSystemColumn);
gamelist->Set("ColumnBanner", m_showBannerColumn);
gamelist->Set("ColumnDescription", m_showDescriptionColumn);
gamelist->Set("ColumnTitle", m_showTitleColumn);
gamelist->Set("ColumnNotes", m_showMakerColumn);
gamelist->Set("ColumnFileName", m_showFileNameColumn);
gamelist->Set("ColumnFilePath", m_showFilePathColumn);
gamelist->Set("ColumnID", m_showIDColumn);
gamelist->Set("ColumnRegion", m_showRegionColumn);
gamelist->Set("ColumnSize", m_showSizeColumn);
gamelist->Set("ColumnFileFormat", m_showFileFormatColumn);
gamelist->Set("ColumnBlockSize", m_showBlockSizeColumn);
gamelist->Set("ColumnCompression", m_showCompressionColumn);
gamelist->Set("ColumnTags", m_showTagsColumn);
}
void SConfig::SaveCoreSettings(IniFile& ini)
{
IniFile::Section* core = ini.GetOrCreateSection("Core");
core->Set("SkipIPL", bHLE_BS2);
core->Set("TimingVariance", iTimingVariance);
core->Set("CPUCore", cpu_core);
core->Set("Fastmem", bFastmem);
core->Set("CPUThread", bCPUThread);
core->Set("DSPHLE", bDSPHLE);
core->Set("SyncOnSkipIdle", bSyncGPUOnSkipIdleHack);
core->Set("SyncGPU", bSyncGPU);
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
core->Set("SyncGpuMinDistance", iSyncGpuMinDistance);
core->Set("SyncGpuOverclock", fSyncGpuOverclock);
core->Set("FPRF", bFPRF);
core->Set("AccurateNaNs", bAccurateNaNs);
core->Set("EnableCheats", bEnableCheats);
core->Set("SelectedLanguage", SelectedLanguage);
core->Set("OverrideRegionSettings", bOverrideRegionSettings);
core->Set("DPL2Decoder", bDPL2Decoder);
core->Set("AudioLatency", iLatency);
core->Set("AudioStretch", m_audio_stretch);
core->Set("AudioStretchMaxLatency", m_audio_stretch_max_latency);
core->Set("AgpCartAPath", m_strGbaCartA);
core->Set("AgpCartBPath", m_strGbaCartB);
core->Set("SlotA", m_EXIDevice[0]);
core->Set("SlotB", m_EXIDevice[1]);
core->Set("SerialPort1", m_EXIDevice[2]);
core->Set("BBA_MAC", m_bba_mac);
core->Set("BBA_XLINK_IP", m_bba_xlink_ip);
core->Set("BBA_XLINK_CHAT_OSD", m_bba_xlink_chat_osd);
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]);
core->Set(fmt::format("AdapterRumble{}", i), m_AdapterRumble[i]);
core->Set(fmt::format("SimulateKonga{}", i), m_AdapterKonga[i]);
}
core->Set("WiiSDCard", m_WiiSDCard);
core->Set("WiiKeyboard", m_WiiKeyboard);
core->Set("WiimoteContinuousScanning", m_WiimoteContinuousScanning);
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
core->Set("WiimoteControllerInterface", connect_wiimotes_for_ciface);
core->Set("RunCompareServer", bRunCompareServer);
core->Set("RunCompareClient", bRunCompareClient);
core->Set("MMU", bMMU);
core->Set("EmulationSpeed", m_EmulationSpeed);
core->Set("Overclock", m_OCFactor);
core->Set("OverclockEnable", m_OCEnable);
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
core->Set("PerfMapDir", m_perfDir);
core->Set("EnableCustomRTC", bEnableCustomRTC);
core->Set("CustomRTCValue", m_customRTCValue);
}
void SConfig::SaveMovieSettings(IniFile& ini)
{
IniFile::Section* movie = ini.GetOrCreateSection("Movie");
movie->Set("PauseMovie", m_PauseMovie);
movie->Set("Author", m_strMovieAuthor);
movie->Set("DumpFrames", m_DumpFrames);
movie->Set("DumpFramesSilent", m_DumpFramesSilent);
movie->Set("ShowInputDisplay", m_ShowInputDisplay);
movie->Set("ShowRTC", m_ShowRTC);
}
void SConfig::SaveDSPSettings(IniFile& ini)
{
IniFile::Section* dsp = ini.GetOrCreateSection("DSP");
dsp->Set("EnableJIT", m_DSPEnableJIT);
dsp->Set("DumpAudio", m_DumpAudio);
dsp->Set("DumpAudioSilent", m_DumpAudioSilent);
dsp->Set("DumpUCode", m_DumpUCode);
dsp->Set("Backend", sBackend);
dsp->Set("Volume", m_Volume);
dsp->Set("CaptureLog", m_DSPCaptureLog);
#ifdef _WIN32
dsp->Set("WASAPIDevice", sWASAPIDevice);
#endif
}
void SConfig::SaveInputSettings(IniFile& ini)
{
IniFile::Section* input = ini.GetOrCreateSection("Input");
input->Set("BackgroundInput", m_BackgroundInput);
}
void SConfig::SaveFifoPlayerSettings(IniFile& ini)
{
IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");
fifoplayer->Set("LoopReplay", bLoopFifoReplay);
}
void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
section->Set("Enabled", m_bt_passthrough_enabled);
section->Set("VID", m_bt_passthrough_vid);
section->Set("PID", m_bt_passthrough_pid);
section->Set("LinkKeys", m_bt_passthrough_link_keys);
}
void SConfig::SaveUSBPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("USBPassthrough");
std::ostringstream oss;
for (const auto& device : m_usb_passthrough_devices)
oss << fmt::format("{:04x}:{:04x}", device.first, device.second) << ',';
std::string devices_string = oss.str();
if (!devices_string.empty())
devices_string.pop_back();
section->Set("Devices", devices_string);
}
void SConfig::SaveAutoUpdateSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("AutoUpdate");
section->Set("UpdateTrack", m_auto_update_track);
section->Set("HashOverride", m_auto_update_hash_override);
}
void SConfig::SaveJitDebugSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("Debug");
section->Set("JitOff", bJITOff);
section->Set("JitLoadStoreOff", bJITLoadStoreOff);
section->Set("JitLoadStoreFloatingOff", bJITLoadStoreFloatingOff);
section->Set("JitLoadStorePairedOff", bJITLoadStorePairedOff);
section->Set("JitFloatingPointOff", bJITFloatingPointOff);
section->Set("JitIntegerOff", bJITIntegerOff);
section->Set("JitPairedOff", bJITPairedOff);
section->Set("JitSystemRegistersOff", bJITSystemRegistersOff);
section->Set("JitBranchOff", bJITBranchOff);
section->Set("JitRegisterCacheOff", bJITRegisterCacheOff);
}
void SConfig::LoadSettings()
{
INFO_LOG_FMT(BOOT, "Loading Settings from {}", File::GetUserPath(F_DOLPHINCONFIG_IDX));
Config::Load();
INFO_LOG_FMT(BOOT, "Loading Settings from {}", File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
LoadGeneralSettings(ini);
LoadInterfaceSettings(ini);
LoadGameListSettings(ini);
LoadCoreSettings(ini);
LoadMovieSettings(ini);
LoadDSPSettings(ini);
LoadInputSettings(ini);
LoadFifoPlayerSettings(ini);
LoadBluetoothPassthroughSettings(ini);
LoadUSBPassthroughSettings(ini);
LoadAutoUpdateSettings(ini);
LoadJitDebugSettings(ini);
}
void SConfig::LoadGeneralSettings(IniFile& ini)
{
IniFile::Section* general = ini.GetOrCreateSection("General");
general->Get("ShowLag", &m_ShowLag, false);
general->Get("ShowFrameCount", &m_ShowFrameCount, false);
#ifdef USE_GDBSTUB
#ifndef _WIN32
general->Get("GDBSocket", &gdb_socket, "");
#endif
general->Get("GDBPort", &(iGDBPort), -1);
#endif
m_ISOFolder.clear();
int numISOPaths;
if (general->Get("ISOPaths", &numISOPaths, 0))
{
for (int i = 0; i < numISOPaths; i++)
{
std::string tmpPath;
general->Get(fmt::format("ISOPath{}", i), &tmpPath, "");
m_ISOFolder.push_back(std::move(tmpPath));
}
}
general->Get("WirelessMac", &m_WirelessMac);
}
void SConfig::LoadInterfaceSettings(IniFile& ini)
{
IniFile::Section* interface = ini.GetOrCreateSection("Interface");
interface->Get("ConfirmStop", &bConfirmStop, true);
interface->Get("HideCursor", &bHideCursor, false);
interface->Get("LanguageCode", &m_InterfaceLanguage, "");
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
interface->Get("ShowActiveTitle", &m_show_active_title, true);
interface->Get("UseBuiltinTitleDatabase", &m_use_builtin_title_database, true);
interface->Get("ThemeName", &theme_name, DEFAULT_THEME_DIR);
interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false);
interface->Get("DebugModeEnabled", &bEnableDebugging, false);
}
void SConfig::LoadGameListSettings(IniFile& ini)
{
IniFile::Section* gamelist = ini.GetOrCreateSection("GameList");
gamelist->Get("ListDrives", &m_ListDrives, false);
gamelist->Get("ListWad", &m_ListWad, true);
gamelist->Get("ListElfDol", &m_ListElfDol, true);
gamelist->Get("ListWii", &m_ListWii, true);
gamelist->Get("ListGC", &m_ListGC, true);
gamelist->Get("ListJap", &m_ListJap, true);
gamelist->Get("ListPal", &m_ListPal, true);
gamelist->Get("ListUsa", &m_ListUsa, true);
gamelist->Get("ListAustralia", &m_ListAustralia, true);
gamelist->Get("ListFrance", &m_ListFrance, true);
gamelist->Get("ListGermany", &m_ListGermany, true);
gamelist->Get("ListItaly", &m_ListItaly, true);
gamelist->Get("ListKorea", &m_ListKorea, true);
gamelist->Get("ListNetherlands", &m_ListNetherlands, true);
gamelist->Get("ListRussia", &m_ListRussia, true);
gamelist->Get("ListSpain", &m_ListSpain, true);
gamelist->Get("ListTaiwan", &m_ListTaiwan, true);
gamelist->Get("ListWorld", &m_ListWorld, true);
gamelist->Get("ListUnknown", &m_ListUnknown, true);
gamelist->Get("ListSort", &m_ListSort, 3);
gamelist->Get("ListSortSecondary", &m_ListSort2, 0);
// Gamelist columns toggles
gamelist->Get("ColumnPlatform", &m_showSystemColumn, true);
gamelist->Get("ColumnDescription", &m_showDescriptionColumn, false);
gamelist->Get("ColumnBanner", &m_showBannerColumn, true);
gamelist->Get("ColumnTitle", &m_showTitleColumn, true);
gamelist->Get("ColumnNotes", &m_showMakerColumn, true);
gamelist->Get("ColumnFileName", &m_showFileNameColumn, false);
gamelist->Get("ColumnFilePath", &m_showFilePathColumn, false);
gamelist->Get("ColumnID", &m_showIDColumn, false);
gamelist->Get("ColumnRegion", &m_showRegionColumn, true);
gamelist->Get("ColumnSize", &m_showSizeColumn, true);
gamelist->Get("ColumnFileFormat", &m_showFileFormatColumn, false);
gamelist->Get("ColumnBlockSize", &m_showBlockSizeColumn, false);
gamelist->Get("ColumnCompression", &m_showCompressionColumn, false);
gamelist->Get("ColumnTags", &m_showTagsColumn, false);
}
void SConfig::LoadCoreSettings(IniFile& ini)
{
IniFile::Section* core = ini.GetOrCreateSection("Core");
core->Get("SkipIPL", &bHLE_BS2, true);
#ifdef _M_X86
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::JIT64);
#elif _M_ARM_64
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::JITARM64);
#else
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::Interpreter);
#endif
core->Get("JITFollowBranch", &bJITFollowBranch, true);
core->Get("Fastmem", &bFastmem, true);
core->Get("DSPHLE", &bDSPHLE, true);
core->Get("TimingVariance", &iTimingVariance, 40);
core->Get("CPUThread", &bCPUThread, true);
core->Get("SyncOnSkipIdle", &bSyncGPUOnSkipIdleHack, true);
core->Get("EnableCheats", &bEnableCheats, false);
core->Get("SelectedLanguage", &SelectedLanguage, 0);
core->Get("OverrideRegionSettings", &bOverrideRegionSettings, false);
core->Get("DPL2Decoder", &bDPL2Decoder, false);
core->Get("AudioLatency", &iLatency, 20);
core->Get("AudioStretch", &m_audio_stretch, false);
core->Get("AudioStretchMaxLatency", &m_audio_stretch_max_latency, 80);
core->Get("AgpCartAPath", &m_strGbaCartA);
core->Get("AgpCartBPath", &m_strGbaCartB);
core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER);
core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE);
core->Get("SerialPort1", (int*)&m_EXIDevice[2], ExpansionInterface::EXIDEVICE_NONE);
core->Get("BBA_MAC", &m_bba_mac);
core->Get("BBA_XLINK_IP", &m_bba_xlink_ip, "127.0.0.1");
core->Get("BBA_XLINK_CHAT_OSD", &m_bba_xlink_chat_osd, true);
for (size_t i = 0; i < std::size(m_SIDevice); ++i)
{
//OpenEmu change all controllers to GaceCube Controllers
//core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i],
//(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i], SerialInterface::SIDEVICE_GC_CONTROLLER);
core->Get(fmt::format("AdapterRumble{}", i), &m_AdapterRumble[i], true);
core->Get(fmt::format("SimulateKonga{}", i), &m_AdapterKonga[i], false);
}
core->Get("WiiSDCard", &m_WiiSDCard, true);
core->Get("WiiKeyboard", &m_WiiKeyboard, false);
core->Get("WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false);
core->Get("WiimoteControllerInterface", &connect_wiimotes_for_ciface, false);
core->Get("RunCompareServer", &bRunCompareServer, false);
core->Get("RunCompareClient", &bRunCompareClient, false);
core->Get("MMU", &bMMU, bMMU);
core->Get("BBDumpPort", &iBBDumpPort, -1);
core->Get("SyncGPU", &bSyncGPU, false);
core->Get("SyncGpuMaxDistance", &iSyncGpuMaxDistance, 200000);
core->Get("SyncGpuMinDistance", &iSyncGpuMinDistance, -200000);
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
core->Get("LowDCBZHack", &bLowDCBZHack, false);
core->Get("FPRF", &bFPRF, false);
core->Get("AccurateNaNs", &bAccurateNaNs, false);
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
core->Get("Overclock", &m_OCFactor, 1.0f);
core->Get("OverclockEnable", &m_OCEnable, false);
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
core->Get("PerfMapDir", &m_perfDir, "");
core->Get("EnableCustomRTC", &bEnableCustomRTC, false);
// Default to seconds between 1.1.1970 and 1.1.2000
core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
}
void SConfig::LoadMovieSettings(IniFile& ini)
{
IniFile::Section* movie = ini.GetOrCreateSection("Movie");
movie->Get("PauseMovie", &m_PauseMovie, false);
movie->Get("Author", &m_strMovieAuthor, "");
movie->Get("DumpFrames", &m_DumpFrames, false);
movie->Get("DumpFramesSilent", &m_DumpFramesSilent, false);
movie->Get("ShowInputDisplay", &m_ShowInputDisplay, false);
movie->Get("ShowRTC", &m_ShowRTC, false);
}
void SConfig::LoadDSPSettings(IniFile& ini)
{
IniFile::Section* dsp = ini.GetOrCreateSection("DSP");
dsp->Get("EnableJIT", &m_DSPEnableJIT, true);
dsp->Get("DumpAudio", &m_DumpAudio, false);
dsp->Get("DumpAudioSilent", &m_DumpAudioSilent, false);
dsp->Get("DumpUCode", &m_DumpUCode, false);
dsp->Get("Backend", &sBackend, AudioCommon::GetDefaultSoundBackend());
dsp->Get("Volume", &m_Volume, 100);
dsp->Get("CaptureLog", &m_DSPCaptureLog, false);
#ifdef _WIN32
dsp->Get("WASAPIDevice", &sWASAPIDevice, "default");
#endif
m_IsMuted = false;
}
void SConfig::LoadInputSettings(IniFile& ini)
{
IniFile::Section* input = ini.GetOrCreateSection("Input");
input->Get("BackgroundInput", &m_BackgroundInput, false);
}
void SConfig::LoadFifoPlayerSettings(IniFile& ini)
{
IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");
fifoplayer->Get("LoopReplay", &bLoopFifoReplay, true);
}
void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
section->Get("Enabled", &m_bt_passthrough_enabled, false);
section->Get("VID", &m_bt_passthrough_vid, -1);
section->Get("PID", &m_bt_passthrough_pid, -1);
section->Get("LinkKeys", &m_bt_passthrough_link_keys, "");
}
void SConfig::LoadUSBPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("USBPassthrough");
m_usb_passthrough_devices.clear();
std::string devices_string;
section->Get("Devices", &devices_string, "");
for (const auto& pair : SplitString(devices_string, ','))
{
const auto index = pair.find(':');
if (index == std::string::npos)
continue;
const u16 vid = static_cast<u16>(strtol(pair.substr(0, index).c_str(), nullptr, 16));
const u16 pid = static_cast<u16>(strtol(pair.substr(index + 1).c_str(), nullptr, 16));
if (vid && pid)
m_usb_passthrough_devices.emplace(vid, pid);
}
}
void SConfig::LoadAutoUpdateSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("AutoUpdate");
section->Get("UpdateTrack", &m_auto_update_track, SCM_UPDATE_TRACK_STR);
section->Get("HashOverride", &m_auto_update_hash_override, "");
}
void SConfig::LoadJitDebugSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("Debug");
section->Get("JitOff", &bJITOff, false);
section->Get("JitLoadStoreOff", &bJITLoadStoreOff, false);
section->Get("JitLoadStoreFloatingOff", &bJITLoadStoreFloatingOff, false);
section->Get("JitLoadStorePairedOff", &bJITLoadStorePairedOff, false);
section->Get("JitFloatingPointOff", &bJITFloatingPointOff, false);
section->Get("JitIntegerOff", &bJITIntegerOff, false);
section->Get("JitPairedOff", &bJITPairedOff, false);
section->Get("JitSystemRegistersOff", &bJITSystemRegistersOff, false);
section->Get("JitBranchOff", &bJITBranchOff, false);
section->Get("JitRegisterCacheOff", &bJITRegisterCacheOff, false);
}
void SConfig::ResetRunningGameMetadata()
@@ -185,19 +711,114 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
HLE::Reload();
PatchEngine::Reload();
HiresTexture::Update();
DolphinAnalytics::Instance().ReportGameStart();
}
}
void SConfig::LoadDefaults()
{
bEnableDebugging = false;
bAutomaticStart = false;
bBootToPause = false;
#ifdef USE_GDBSTUB
iGDBPort = -1;
#ifndef _WIN32
gdb_socket = "";
#endif
#endif
cpu_core = PowerPC::DefaultCPUCore();
iTimingVariance = 40;
bCPUThread = false;
bSyncGPUOnSkipIdleHack = true;
bRunCompareServer = false;
bDSPHLE = true;
bFastmem = true;
bFPRF = false;
bAccurateNaNs = false;
bMMU = false;
bLowDCBZHack = false;
iBBDumpPort = -1;
bSyncGPU = false;
bFastDiscSpeed = false;
bEnableMemcardSdWriting = true;
SelectedLanguage = 0;
bOverrideRegionSettings = false;
bWii = false;
bDPL2Decoder = false;
iLatency = 20;
m_audio_stretch = false;
m_audio_stretch_max_latency = 80;
bLoopFifoReplay = true;
bJITOff = false; // debugger only settings
bJITLoadStoreOff = false;
bJITLoadStoreFloatingOff = false;
bJITLoadStorePairedOff = false;
bJITFloatingPointOff = false;
bJITIntegerOff = false;
bJITPairedOff = false;
bJITSystemRegistersOff = false;
bJITBranchOff = false;
bJITRegisterCacheOff = false;
ResetRunningGameMetadata();
}
bool SConfig::IsUSBDeviceWhitelisted(const std::pair<u16, u16> vid_pid) const
{
return m_usb_passthrough_devices.find(vid_pid) != m_usb_passthrough_devices.end();
}
// The reason we need this function is because some memory card code
// expects to get a non-NTSC-K region even if we're emulating an NTSC-K Wii.
DiscIO::Region SConfig::ToGameCubeRegion(DiscIO::Region region)
{
if (region != DiscIO::Region::NTSC_K)
return region;
// GameCube has no NTSC-K region. No choice of replacement value is completely
// non-arbitrary, but let's go with NTSC-J since Korean GameCubes are NTSC-J.
return DiscIO::Region::NTSC_J;
}
const char* SConfig::GetDirectoryForRegion(DiscIO::Region region)
{
if (region == DiscIO::Region::Unknown)
region = ToGameCubeRegion(GetFallbackRegion());
switch (region)
{
case DiscIO::Region::NTSC_J:
return JAP_DIR;
case DiscIO::Region::NTSC_U:
return USA_DIR;
case DiscIO::Region::PAL:
return EUR_DIR;
case DiscIO::Region::NTSC_K:
ASSERT_MSG(BOOT, false, "NTSC-K is not a valid GameCube region");
return JAP_DIR; // See ToGameCubeRegion
default:
ASSERT_MSG(BOOT, false, "Default case should not be reached");
return EUR_DIR;
}
}
std::string SConfig::GetBootROMPath(const std::string& region_directory) const
{
const std::string path =
File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + region_directory + DIR_SEP GC_IPL;
if (!File::Exists(path))
return File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + region_directory + DIR_SEP GC_IPL;
return path;
}
struct SetGameMetadata
{
SetGameMetadata(SConfig* config_, DiscIO::Region* region_) : config(config_), region(region_) {}
@@ -299,23 +920,29 @@ bool SConfig::SetPathsAndGameMetadata(const BootParameters& boot)
return false;
if (m_region == DiscIO::Region::Unknown)
m_region = Config::Get(Config::MAIN_FALLBACK_REGION);
m_region = GetFallbackRegion();
// Set up paths
const std::string region_dir = Config::GetDirectoryForRegion(Config::ToGameCubeRegion(m_region));
const std::string region_dir = GetDirectoryForRegion(ToGameCubeRegion(m_region));
m_strSRAM = File::GetUserPath(F_GCSRAM_IDX);
m_strBootROM = Config::GetBootROMPath(region_dir);
m_strBootROM = GetBootROMPath(region_dir);
return true;
}
DiscIO::Region SConfig::GetFallbackRegion()
{
return Config::Get(Config::MAIN_FALLBACK_REGION);
}
DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
{
DiscIO::Language language;
int language_value;
if (wii)
language = static_cast<DiscIO::Language>(Config::Get(Config::SYSCONF_LANGUAGE));
language_value = Config::Get(Config::SYSCONF_LANGUAGE);
else
language = DiscIO::FromGameCubeLanguage(Config::Get(Config::MAIN_GC_LANGUAGE));
language_value = SConfig::GetInstance().SelectedLanguage + 1;
DiscIO::Language language = static_cast<DiscIO::Language>(language_value);
// Get rid of invalid values (probably doesn't matter, but might as well do it)
if (language > DiscIO::Language::Unknown || language < DiscIO::Language::Japanese)
@@ -333,7 +960,7 @@ DiscIO::Language SConfig::GetLanguageAdjustedForRegion(bool wii, DiscIO::Region
if (!wii && region == DiscIO::Region::NTSC_J && language == DiscIO::Language::English)
return DiscIO::Language::Japanese; // English and Japanese both use the value 0 in GC SRAM
if (!Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS))
if (!bOverrideRegionSettings)
{
if (region == DiscIO::Region::NTSC_J)
return DiscIO::Language::Japanese;
@@ -398,18 +1025,7 @@ IniFile SConfig::LoadGameIni(const std::string& id, std::optional<u16> revision)
return game_ini;
}
void SConfig::OnNewTitleLoad()
bool SConfig::ShouldUseDPL2Decoder() const
{
if (!Core::IsRunning())
return;
if (!g_symbolDB.IsEmpty())
{
g_symbolDB.Clear();
Host_NotifyMapLoaded();
}
CBoot::LoadMapFromFilename();
HLE::Reload();
PatchEngine::Reload();
HiresTexture::Update();
return bDPL2Decoder && !bDSPHLE;
}
-59
View File
@@ -1,59 +0,0 @@
// Copyright (c) 2022, OpenEmu Team
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the OpenEmu Team nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __x86_64__
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_Branch.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_Paired.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64Common/BlockCache.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64Common/ConstantPool.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64Common/FarCodeCache.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/Jit64Common/TrampolineCache.cpp"
#elif defined(__arm64__)
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/Jit_Util.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/Jit.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_FloatingPoint.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_Integer.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_Paired.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_SystemRegisters.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitAsm.cpp"
#include "../../dolphin/Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp"
#endif
+7 -36
View File
@@ -44,7 +44,6 @@
#endif
ControllerInterface g_controller_interface;
static bool m_is_populating_devices = false;
void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
{
@@ -94,34 +93,7 @@ void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
m_is_populating_devices = false;
}
static thread_local ciface::InputChannel tls_input_channel = ciface::InputChannel::Host;
void ControllerInterface::SetCurrentInputChannel(ciface::InputChannel input_channel)
{
tls_input_channel = input_channel;
}
ciface::InputChannel ControllerInterface::GetCurrentInputChannel()
{
return tls_input_channel;
}
void ControllerInterface::PlatformPopulateDevices(std::function<void()> callback)
{
if (!m_is_init)
return;
std::lock_guard lk_population(m_devices_population_mutex);
m_populating_devices_counter.fetch_add(1);
callback();
if (m_populating_devices_counter.fetch_sub(1) == 1)
InvokeDevicesChangedCallbacks();
}
void ControllerInterface::ChangeWindow(void* hwnd, WindowChangeReason reason)
void ControllerInterface::ChangeWindow(void* hwnd)
{
if (!m_is_init)
return;
@@ -131,7 +103,7 @@ void ControllerInterface::ChangeWindow(void* hwnd, WindowChangeReason reason)
RefreshDevices();
}
void ControllerInterface::RefreshDevices(RefreshReason reason)
void ControllerInterface::RefreshDevices()
{
if (!m_is_init)
return;
@@ -233,11 +205,11 @@ void ControllerInterface::Shutdown()
#endif
}
bool ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device)
void ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device)
{
// If we are shutdown (or in process of shutting down) ignore this request:
if (!m_is_init)
return false;
return;
{
std::lock_guard lk(m_devices_mutex);
@@ -265,23 +237,22 @@ bool ControllerInterface::AddDevice(std::shared_ptr<ciface::Core::Device> device
device->SetId(id);
}
NOTICE_LOG_FMT(CONTROLLERINTERFACE, "Added device: {}", device->GetQualifiedName());
NOTICE_LOG(SERIALINTERFACE, "Added device: %s", device->GetQualifiedName().c_str());
m_devices.emplace_back(std::move(device));
}
if (!m_is_populating_devices)
InvokeDevicesChangedCallbacks();
return true;
}
void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::Device*)> callback, bool force_devices_release)
void ControllerInterface::RemoveDevice(std::function<bool(const ciface::Core::Device*)> callback)
{
{
std::lock_guard lk(m_devices_mutex);
auto it = std::remove_if(m_devices.begin(), m_devices.end(), [&callback](const auto& dev) {
if (callback(dev.get()))
{
NOTICE_LOG_FMT(SERIALINTERFACE, "Removed device: {}", dev->GetQualifiedName());
NOTICE_LOG(SERIALINTERFACE, "Removed device: %s", dev->GetQualifiedName().c_str());
return true;
}
return false;
+9 -4
View File
@@ -26,7 +26,7 @@ InputConfig::InputConfig(const std::string& ini_name, const std::string& gui_nam
InputConfig::~InputConfig() = default;
bool InputConfig::LoadConfig(InputClass type)
bool InputConfig::LoadConfig(bool isGC)
{
//OpenEmu Stub
return false;
@@ -45,7 +45,7 @@ void InputConfig::SaveConfig()
inifile.Save(ini_filename);
}
ControllerEmu::EmulatedController* InputConfig::GetController(int index) const
ControllerEmu::EmulatedController* InputConfig::GetController(int index)
{
return m_controllers.at(index).get();
}
@@ -60,9 +60,9 @@ bool InputConfig::ControllersNeedToBeCreated() const
return m_controllers.empty();
}
int InputConfig::GetControllerCount() const
std::size_t InputConfig::GetControllerCount() const
{
return static_cast<int>(m_controllers.size());
return m_controllers.size();
}
void InputConfig::RegisterHotplugCallback()
@@ -80,6 +80,11 @@ void InputConfig::UnregisterHotplugCallback()
g_controller_interface.UnregisterDevicesChangedCallback(m_hotplug_callback_handle);
}
void InputConfig::OnControllerCreated(ControllerEmu::EmulatedController& controller)
{
controller.SetDynamicInputTextureManager(&m_dynamic_input_tex_config_manager);
}
bool InputConfig::IsControllerControlledByGamepadDevice(int index) const
{
if (static_cast<size_t>(index) >= m_controllers.size())
+1 -3
View File
@@ -4,8 +4,6 @@
#include "OpenEmuController.h"
#include "Core/ConfigManager.h"
#include "Common/Config/Config.h"
#include "Core/Config/MainSettings.h"
void input_poll_f()
{
@@ -16,7 +14,7 @@ void input_poll_f()
int16_t input_state_f(unsigned port, unsigned device, unsigned index, unsigned button)
{
if (SConfig::GetInstance().bWii && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
if (SConfig::GetInstance().bWii && !SConfig::GetInstance().m_bt_passthrough_enabled)
{
//This is where we must translate the OpenEmu frontend keys presses stored in the keymap to bitmasks for Dolphin.
return WiiRemotes[port].wiimote_keymap[button].value;
+8 -11
View File
@@ -5,9 +5,6 @@
#include "Common/Common.h"
#include "Common/CommonTypes.h"
#include "Common/IniFile.h"
#include "Common/Config/Config.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/WiimoteSettings.h"
#include "Core/ConfigManager.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCPad.h"
@@ -276,7 +273,7 @@ static bool init_wiimotes = false;
Pad::Initialize();
Keyboard::Initialize();
if (SConfig::GetInstance().bWii && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
if (SConfig::GetInstance().bWii && !SConfig::GetInstance().m_bt_passthrough_enabled)
{
init_wiimotes = true;
Wiimote::Initialize(Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
@@ -374,7 +371,7 @@ void Input::openemu_set_controller_port_device(unsigned port, unsigned device)
gcPad->UpdateReferences(g_controller_interface);
Pad::GetConfig()->SaveConfig();
if (SConfig::GetInstance().bWii && !Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
if (SConfig::GetInstance().bWii && !SConfig::GetInstance().m_bt_passthrough_enabled)
{
WiimoteEmu::Wiimote* wm = (WiimoteEmu::Wiimote*)Wiimote::GetConfig()->GetController(port);
// load an empty inifile section, clears everything
@@ -509,34 +506,34 @@ void Input::openemu_set_controller_port_device(unsigned port, unsigned device)
{
case OEWiimote:
wmExtension->SetSelectedAttachment(ExtensionNumber::NONE);
Config::SetCurrent(Config::GetInfoForWiimoteSource(port), WiimoteSource::Emulated);
WiimoteCommon::SetSource(port, WiimoteSource::Emulated);
break;
case OEWiimoteSW:
wmExtension->SetSelectedAttachment(ExtensionNumber::NONE);
static_cast<ControllerEmu::NumericSetting<bool>*>(wmOptions->numeric_settings[2].get())
->SetValue(true); // Sideways Wiimote
Config::SetCurrent(Config::GetInfoForWiimoteSource(port), WiimoteSource::Emulated);
WiimoteCommon::SetSource(port, WiimoteSource::Emulated);
break;
case OEWiimoteNC:
wmExtension->SetSelectedAttachment(ExtensionNumber::NUNCHUK);
Config::SetCurrent(Config::GetInfoForWiimoteSource(port), WiimoteSource::Emulated);
WiimoteCommon::SetSource(port, WiimoteSource::Emulated);
break;
case OEWiimoteCC:
case OEWiimoteCC_Pro:
wmExtension->SetSelectedAttachment(ExtensionNumber::CLASSIC);
Config::SetCurrent(Config::GetInfoForWiimoteSource(port), WiimoteSource::Emulated);
WiimoteCommon::SetSource(port, WiimoteSource::Emulated);
break;
case OEWiiMoteReal:
//desc = Libretro::Input::descEmpty;
Config::SetCurrent(Config::GetInfoForWiimoteSource(port), WiimoteSource::Real);
WiimoteCommon::SetSource(port, WiimoteSource::Real);
default:
//desc = Libretro::Input::descGC;
Config::SetCurrent(Config::GetInfoForWiimoteSource(port), WiimoteSource::None);
WiimoteCommon::SetSource(port, WiimoteSource::None);
break;
}
wm->UpdateReferences(g_controller_interface);
@@ -2,7 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "VideoBackends/OGL/OGLRender.h"
#include "VideoBackends/OGL/Render.h"
#include <algorithm>
#include <cinttypes>
@@ -11,6 +11,7 @@
#include <memory>
#include <string>
#include "Common/Atomic.h"
#include "Common/CommonTypes.h"
#include "Common/GL/GLContext.h"
#include "Common/GL/GLUtil.h"
@@ -21,13 +22,13 @@
#include "Core/Config/GraphicsSettings.h"
#include "VideoBackends/OGL/OGLBoundingBox.h"
#include "VideoBackends/OGL/BoundingBox.h"
#include "VideoBackends/OGL/OGLPipeline.h"
#include "VideoBackends/OGL/OGLShader.h"
#include "VideoBackends/OGL/OGLTexture.h"
#include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoBackends/OGL/SamplerCache.h"
#include "VideoBackends/OGL/OGLVertexManager.h"
#include "VideoBackends/OGL/VertexManager.h"
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/DriverDetails.h"
@@ -104,19 +105,19 @@ static void APIENTRY ErrorCallback(GLenum source, GLenum type, GLuint id, GLenum
switch (severity)
{
case GL_DEBUG_SEVERITY_HIGH_ARB:
ERROR_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
ERROR_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message);
break;
case GL_DEBUG_SEVERITY_MEDIUM_ARB:
WARN_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
WARN_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message);
break;
case GL_DEBUG_SEVERITY_LOW_ARB:
DEBUG_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
DEBUG_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message);
break;
case GL_DEBUG_SEVERITY_NOTIFICATION:
DEBUG_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
DEBUG_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message);
break;
default:
ERROR_LOG_FMT(HOST_GPU, "id: {:x}, source: {}, type: {} - {}", id, s_source, s_type, message);
ERROR_LOG(HOST_GPU, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message);
break;
}
}
@@ -306,7 +307,7 @@ static void InitDriverInfo()
version = 100 * major + minor;
if (change >= change_scale)
{
ERROR_LOG_FMT(VIDEO, "Version changeID overflow - change:{} scale:{}", change, change_scale);
ERROR_LOG(VIDEO, "Version changeID overflow - change:%d scale:%f", change, change_scale);
}
else
{
@@ -357,8 +358,8 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
{
// We want the ogl3 framebuffer instead of the ogl2 one for better blitting support.
// It's also compatible with the gles3 one.
PanicAlertFmtT("GPU: ERROR: Need GL_ARB_framebuffer_object for multiple render targets.\n"
"GPU: Does your video card support OpenGL 3.0?");
PanicAlert("GPU: ERROR: Need GL_ARB_framebuffer_object for multiple render targets.\n"
"GPU: Does your video card support OpenGL 3.0?");
bSuccess = false;
}
@@ -366,8 +367,8 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
{
// This extension is used to replace lots of pointer setting function.
// Also gles3 requires to use it.
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_vertex_array_object.\n"
"GPU: Does your video card support OpenGL 3.0?");
PanicAlert("GPU: OGL ERROR: Need GL_ARB_vertex_array_object.\n"
"GPU: Does your video card support OpenGL 3.0?");
bSuccess = false;
}
@@ -375,8 +376,8 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
{
// ogl3 buffer mapping for better streaming support.
// The ogl2 one also isn't in gles3.
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_map_buffer_range.\n"
"GPU: Does your video card support OpenGL 3.0?");
PanicAlert("GPU: OGL ERROR: Need GL_ARB_map_buffer_range.\n"
"GPU: Does your video card support OpenGL 3.0?");
bSuccess = false;
}
@@ -384,13 +385,13 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
{
// ubo allow us to keep the current constants on shader switches
// we also can stream them much nicer and pack into it whatever we want to
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_uniform_buffer_object.\n"
"GPU: Does your video card support OpenGL 3.1?");
PanicAlert("GPU: OGL ERROR: Need GL_ARB_uniform_buffer_object.\n"
"GPU: Does your video card support OpenGL 3.1?");
bSuccess = false;
}
else if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_UBO))
{
PanicAlertFmtT(
PanicAlert(
"Buggy GPU driver detected.\n"
"Please either install the closed-source GPU driver or update your Mesa 3D version.");
bSuccess = false;
@@ -400,8 +401,8 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
{
// Our sampler cache uses this extension. It could easyly be workaround and it's by far the
// highest requirement, but it seems that no driver lacks support for it.
PanicAlertFmtT("GPU: OGL ERROR: Need GL_ARB_sampler_objects.\n"
"GPU: Does your video card support OpenGL 3.3?");
PanicAlert("GPU: OGL ERROR: Need GL_ARB_sampler_objects.\n"
"GPU: Does your video card support OpenGL 3.3?");
bSuccess = false;
}
@@ -426,6 +427,7 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
((GLExtensions::Version() >= 310) || GLExtensions::Supports("GL_NV_primitive_restart"));
g_Config.backend_info.bSupportsFragmentStoresAndAtomics =
GLExtensions::Supports("GL_ARB_shader_storage_buffer_object");
g_Config.backend_info.bSupportsBBox = g_Config.backend_info.bSupportsFragmentStoresAndAtomics;
g_Config.backend_info.bSupportsGSInstancing = GLExtensions::Supports("GL_ARB_gpu_shader5");
g_Config.backend_info.bSupportsSSAA = GLExtensions::Supports("GL_ARB_gpu_shader5") &&
GLExtensions::Supports("GL_ARB_sample_shading");
@@ -485,21 +487,20 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
GLExtensions::Supports("GL_EXT_texture_compression_s3tc");
g_Config.backend_info.bSupportsBPTCTextures =
GLExtensions::Supports("GL_ARB_texture_compression_bptc");
g_Config.backend_info.bSupportsCoarseDerivatives =
GLExtensions::Supports("GL_ARB_derivative_control") || GLExtensions::Version() >= 450;
g_Config.backend_info.bSupportsTextureQueryLevels =
GLExtensions::Supports("GL_ARB_texture_query_levels") || GLExtensions::Version() >= 430;
if (m_main_gl_context->IsGLES())
{
g_ogl_config.SupportedESPointSize = GLExtensions::Supports("GL_OES_geometry_point_size") ? 1 :
GLExtensions::Supports("GL_EXT_geometry_point_size") ? 2 :
0;
g_ogl_config.SupportedESTextureBuffer =
GLExtensions::Supports("VERSION_GLES_3_2") ? EsTexbufType::TexbufCore :
GLExtensions::Supports("GL_OES_texture_buffer") ? EsTexbufType::TexbufOes :
GLExtensions::Supports("GL_EXT_texture_buffer") ? EsTexbufType::TexbufExt :
EsTexbufType::TexbufNone;
g_ogl_config.SupportedESPointSize =
GLExtensions::Supports("GL_OES_geometry_point_size") ?
1 :
GLExtensions::Supports("GL_EXT_geometry_point_size") ? 2 : 0;
g_ogl_config.SupportedESTextureBuffer = GLExtensions::Supports("VERSION_GLES_3_2") ?
EsTexbufType::TexbufCore :
GLExtensions::Supports("GL_OES_texture_buffer") ?
EsTexbufType::TexbufOes :
GLExtensions::Supports("GL_EXT_texture_buffer") ?
EsTexbufType::TexbufExt :
EsTexbufType::TexbufNone;
supports_glsl_cache = true;
g_ogl_config.bSupportsGLSync = true;
@@ -515,9 +516,6 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
// ARB_get_texture_sub_image (unlikely, except maybe on NVIDIA), we can use that instead.
g_Config.backend_info.bSupportsDepthReadback = g_ogl_config.bSupportsTextureSubImage;
// GL_TEXTURE_LOD_BIAS is not supported on GLES.
g_Config.backend_info.bSupportsLodBiasInSampler = false;
if (GLExtensions::Supports("GL_EXT_shader_framebuffer_fetch"))
{
g_ogl_config.SupportedFramebufferFetch = EsFbFetchType::FbFetchExt;
@@ -586,17 +584,16 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_ogl_config.bSupports3DTextureStorageMultisample = true;
g_Config.backend_info.bSupportsBitfield = true;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
}
}
else
{
if (GLExtensions::Version() < 300)
{
PanicAlertFmtT("GPU: OGL ERROR: Need at least GLSL 1.30\n"
"GPU: Does your video card support OpenGL 3.0?\n"
"GPU: Your driver supports GLSL {0}",
reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
PanicAlert("GPU: OGL ERROR: Need at least GLSL 1.30\n"
"GPU: Does your video card support OpenGL 3.0?\n"
"GPU: Your driver supports GLSL %s",
(const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
bSuccess = false;
}
else if (GLExtensions::Version() == 300)
@@ -632,7 +629,6 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_ogl_config.bSupportsTextureStorage = true;
g_ogl_config.bSupportsImageLoadStore = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
// Compute shaders are core in GL4.3.
g_Config.backend_info.bSupportsComputeShaders = true;
@@ -660,8 +656,6 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
glEnable(GL_PROGRAM_POINT_SIZE);
}
g_Config.backend_info.bSupportsBBox = g_Config.backend_info.bSupportsFragmentStoresAndAtomics;
// Either method can do early-z tests. See PixelShaderGen for details.
g_Config.backend_info.bSupportsEarlyZ =
g_ogl_config.bSupportsImageLoadStore || g_ogl_config.bSupportsConservativeDepth;
@@ -706,8 +700,8 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, true);
glDebugMessageCallbackARB(ErrorCallback, nullptr);
}
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::LogType::HOST_GPU,
Common::Log::LogLevel::LERROR))
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::HOST_GPU,
Common::Log::LERROR))
{
glEnable(GL_DEBUG_OUTPUT);
}
@@ -724,11 +718,10 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
// MSAA on default framebuffer isn't working because of glBlitFramebuffer.
// It also isn't useful as we don't render anything to the default framebuffer.
// We also try to get a non-msaa fb, so this only happens when forced by the driver.
PanicAlertFmtT(
"The graphics driver is forcibly enabling anti-aliasing for Dolphin. You need to "
"turn this off in the graphics driver's settings in order for Dolphin to work.\n\n"
"(MSAA with {0} samples found on default framebuffer)",
samples);
PanicAlertT("The graphics driver is forcibly enabling anti-aliasing for Dolphin. You need to "
"turn this off in the graphics driver's settings in order for Dolphin to work.\n\n"
"(MSAA with %d samples found on default framebuffer)",
samples);
bSuccess = false;
}
@@ -742,35 +735,33 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_Config.VerifyValidity();
UpdateActiveConfig();
OSD::AddMessage(fmt::format("Video Info: {}, {}, {}", g_ogl_config.gl_vendor,
g_ogl_config.gl_renderer, g_ogl_config.gl_version),
OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s", g_ogl_config.gl_vendor,
g_ogl_config.gl_renderer, g_ogl_config.gl_version),
5000);
if (!g_ogl_config.bSupportsGLBufferStorage && !g_ogl_config.bSupportsGLPinnedMemory)
{
OSD::AddMessage(fmt::format("Your OpenGL driver does not support {}_buffer_storage.",
m_main_gl_context->IsGLES() ? "EXT" : "ARB"),
OSD::AddMessage(StringFromFormat("Your OpenGL driver does not support %s_buffer_storage.",
m_main_gl_context->IsGLES() ? "EXT" : "ARB"),
60000);
OSD::AddMessage("This device's performance may be poor.", 60000);
OSD::AddMessage("This device's performance will be terrible.", 60000);
OSD::AddMessage("Please ask your device vendor for an updated OpenGL driver.", 60000);
}
INFO_LOG_FMT(VIDEO, "Video Info: {}, {}, {}", g_ogl_config.gl_vendor, g_ogl_config.gl_renderer,
g_ogl_config.gl_version);
WARN_LOG_FMT(VIDEO, "Missing OGL Extensions: {}{}{}{}{}{}{}{}{}{}{}{}{}{}",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
g_ActiveConfig.backend_info.bSupportsEarlyZ ? "" : "EarlyZ ",
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
supports_glsl_cache ? "" : "ShaderCache ",
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
g_ogl_config.bSupportsGLBufferStorage ? "" : "BufferStorage ",
g_ogl_config.bSupportsGLSync ? "" : "Sync ",
g_ogl_config.bSupportsMSAA ? "" : "MSAA ",
g_ActiveConfig.backend_info.bSupportsSSAA ? "" : "SSAA ",
g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ",
g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl ",
g_ogl_config.bSupportsCopySubImage ? "" : "CopyImageSubData ",
g_ActiveConfig.backend_info.bSupportsDepthClamp ? "" : "DepthClamp ");
WARN_LOG(VIDEO, "Missing OGL Extensions: %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
g_ActiveConfig.backend_info.bSupportsEarlyZ ? "" : "EarlyZ ",
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
supports_glsl_cache ? "" : "ShaderCache ",
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
g_ogl_config.bSupportsGLBufferStorage ? "" : "BufferStorage ",
g_ogl_config.bSupportsGLSync ? "" : "Sync ", g_ogl_config.bSupportsMSAA ? "" : "MSAA ",
g_ActiveConfig.backend_info.bSupportsSSAA ? "" : "SSAA ",
g_ActiveConfig.backend_info.bSupportsGSInstancing ? "" : "GSInstancing ",
g_ActiveConfig.backend_info.bSupportsClipControl ? "" : "ClipControl ",
g_ogl_config.bSupportsCopySubImage ? "" : "CopyImageSubData ",
g_ActiveConfig.backend_info.bSupportsDepthClamp ? "" : "DepthClamp ");
// Handle VSync on/off
if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_VSYNC))
@@ -820,10 +811,9 @@ void Renderer::Shutdown()
glDeleteFramebuffers(1, &m_shared_read_framebuffer);
}
std::unique_ptr<AbstractTexture> Renderer::CreateTexture(const TextureConfig& config,
std::string_view name)
std::unique_ptr<AbstractTexture> Renderer::CreateTexture(const TextureConfig& config)
{
return std::make_unique<OGLTexture>(config, name);
return std::make_unique<OGLTexture>(config);
}
std::unique_ptr<AbstractStagingTexture> Renderer::CreateStagingTexture(StagingTextureType type,
@@ -840,15 +830,13 @@ std::unique_ptr<AbstractFramebuffer> Renderer::CreateFramebuffer(AbstractTexture
}
std::unique_ptr<AbstractShader> Renderer::CreateShaderFromSource(ShaderStage stage,
std::string_view source,
std::string_view name)
std::string_view source)
{
return OGLShader::CreateFromSource(stage, source, name);
return OGLShader::CreateFromSource(stage, source);
}
std::unique_ptr<AbstractShader> Renderer::CreateShaderFromBinary(ShaderStage stage,
const void* data, size_t length,
std::string_view name)
const void* data, size_t length)
{
return nullptr;
}
@@ -865,9 +853,32 @@ void Renderer::SetScissorRect(const MathUtil::Rectangle<int>& rc)
glScissor(rc.left, rc.top, rc.GetWidth(), rc.GetHeight());
}
std::unique_ptr<::BoundingBox> Renderer::CreateBoundingBox() const
u16 Renderer::BBoxRead(int index)
{
return std::make_unique<OGLBoundingBox>();
// swap 2 and 3 for top/bottom
if (index >= 2)
index ^= 1;
int value = BoundingBox::Get(index);
if (index >= 2)
{
// up/down -- we have to swap up and down
value = EFB_HEIGHT - value;
}
return static_cast<u16>(value);
}
void Renderer::BBoxWrite(int index, u16 value)
{
s32 swapped_value = value;
if (index >= 2)
{
index ^= 1; // swap 2 and 3 for top/bottom
swapped_value = EFB_HEIGHT - swapped_value;
}
BoundingBox::Set(index, swapped_value);
}
void Renderer::SetViewport(float x, float y, float width, float height, float near_depth,
@@ -907,8 +918,8 @@ void Renderer::DrawIndexed(u32 base_index, u32 num_indices, u32 base_vertex)
}
}
void Renderer::DispatchComputeShader(const AbstractShader* shader, u32 groupsize_x, u32 groupsize_y,
u32 groupsize_z, u32 groups_x, u32 groups_y, u32 groups_z)
void Renderer::DispatchComputeShader(const AbstractShader* shader, u32 groups_x, u32 groups_y,
u32 groups_z)
{
glUseProgram(static_cast<const OGLShader*>(shader)->GetGLComputeProgramID());
glDispatchCompute(groups_x, groups_y, groups_z);
@@ -962,7 +973,7 @@ void Renderer::ClearScreen(const MathUtil::Rectangle<int>& rc, bool colorEnable,
glDepthMask(m_current_depth_state.updateenable);
// Scissor rect must be restored.
BPFunctions::SetScissorAndViewport();
BPFunctions::SetScissor();
}
void Renderer::RenderXFBToScreen(const MathUtil::Rectangle<int>& target_rc,
@@ -1040,8 +1051,8 @@ void Renderer::PresentBackbuffer()
{
if (g_ogl_config.bSupportsDebug)
{
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::LogType::HOST_GPU,
Common::Log::LogLevel::LERROR))
if (Common::Log::LogManager::GetInstance()->IsEnabled(Common::Log::HOST_GPU,
Common::Log::LERROR))
{
glEnable(GL_DEBUG_OUTPUT);
}
@@ -1127,11 +1138,11 @@ void Renderer::ApplyRasterizationState(const RasterizationState state)
return;
// none, ccw, cw, ccw
if (state.cullmode != CullMode::None)
if (state.cullmode != GenMode::CULL_NONE)
{
// TODO: GX_CULL_ALL not supported, yet!
glEnable(GL_CULL_FACE);
glFrontFace(state.cullmode == CullMode::Front ? GL_CCW : GL_CW);
glFrontFace(state.cullmode == GenMode::CULL_FRONT ? GL_CCW : GL_CW);
}
else
{
@@ -1153,7 +1164,7 @@ void Renderer::ApplyDepthState(const DepthState state)
{
glEnable(GL_DEPTH_TEST);
glDepthMask(state.updateenable ? GL_TRUE : GL_FALSE);
glDepthFunc(glCmpFuncs[u32(state.func.Value())]);
glDepthFunc(glCmpFuncs[state.func]);
}
else
{
@@ -1172,43 +1183,53 @@ void Renderer::ApplyBlendingState(const BlendingState state)
if (m_current_blend_state == state)
return;
bool useDualSource = state.usedualsrc;
bool useDualSource =
state.usedualsrc && g_ActiveConfig.backend_info.bSupportsDualSourceBlend &&
(!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING) || state.dstalpha);
// Only use shader blend if we need to and we don't support dual-source blending directly
bool useShaderBlend = !useDualSource && state.usedualsrc && state.dstalpha &&
g_ActiveConfig.backend_info.bSupportsFramebufferFetch;
const GLenum src_factors[8] = {GL_ZERO,
GL_ONE,
GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA :
(GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};
const GLenum dst_factors[8] = {GL_ZERO,
GL_ONE,
GL_SRC_COLOR,
GL_ONE_MINUS_SRC_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA :
(GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};
if (state.blendenable)
glEnable(GL_BLEND);
else
if (useShaderBlend)
{
glDisable(GL_BLEND);
}
else
{
const GLenum src_factors[8] = {GL_ZERO,
GL_ONE,
GL_DST_COLOR,
GL_ONE_MINUS_DST_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA :
(GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};
const GLenum dst_factors[8] = {GL_ZERO,
GL_ONE,
GL_SRC_COLOR,
GL_ONE_MINUS_SRC_COLOR,
useDualSource ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
useDualSource ? GL_ONE_MINUS_SRC1_ALPHA :
(GLenum)GL_ONE_MINUS_SRC_ALPHA,
GL_DST_ALPHA,
GL_ONE_MINUS_DST_ALPHA};
// Always call glBlendEquationSeparate and glBlendFuncSeparate, even when
// GL_BLEND is disabled, as a workaround for some bugs (possibly graphics
// driver issues?). See https://bugs.dolphin-emu.org/issues/10120 : "Sonic
// Adventure 2 Battle: graphics crash when loading first Dark level"
GLenum equation = state.subtract ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD;
GLenum equationAlpha = state.subtractAlpha ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD;
glBlendEquationSeparate(equation, equationAlpha);
glBlendFuncSeparate(src_factors[u32(state.srcfactor.Value())],
dst_factors[u32(state.dstfactor.Value())],
src_factors[u32(state.srcfactoralpha.Value())],
dst_factors[u32(state.dstfactoralpha.Value())]);
if (state.blendenable)
glEnable(GL_BLEND);
else
glDisable(GL_BLEND);
// Always call glBlendEquationSeparate and glBlendFuncSeparate, even when
// GL_BLEND is disabled, as a workaround for some bugs (possibly graphics
// driver issues?). See https://bugs.dolphin-emu.org/issues/10120 : "Sonic
// Adventure 2 Battle: graphics crash when loading first Dark level"
GLenum equation = state.subtract ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD;
GLenum equationAlpha = state.subtractAlpha ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD;
glBlendEquationSeparate(equation, equationAlpha);
glBlendFuncSeparate(src_factors[state.srcfactor], dst_factors[state.dstfactor],
src_factors[state.srcfactoralpha], dst_factors[state.dstfactoralpha]);
}
const GLenum logic_op_codes[16] = {
GL_CLEAR, GL_AND, GL_AND_REVERSE, GL_COPY, GL_AND_INVERTED, GL_NOOP,
@@ -1221,7 +1242,7 @@ void Renderer::ApplyBlendingState(const BlendingState state)
if (state.logicopenable)
{
glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(logic_op_codes[u32(state.logicmode.Value())]);
glLogicOp(logic_op_codes[state.logicmode]);
}
else
{
@@ -1,27 +0,0 @@
// Copyright (c) 2022, OpenEmu Team
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the OpenEmu Team nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __x86_64__
#include "../../dolphin/Source/Core/VideoCommon/TextureDecoder_x64.cpp"
#endif
@@ -1,29 +0,0 @@
// Copyright (c) 2022, OpenEmu Team
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the OpenEmu Team nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __x86_64__
#include "../../dolphin/Source/Core/VideoCommon/VertexLoaderX64.cpp"
#elif defined(__arm64__)
#include "../../dolphin/Source/Core/VideoCommon/VertexLoaderARM64.cpp"
#endif
+37 -61
View File
@@ -16,8 +16,6 @@
#include <vector>
#include "Common/CommonTypes.h"
#include "VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.h"
#include "VideoCommon/VideoCommon.h"
enum class APIType;
@@ -58,7 +56,7 @@ enum class ShaderCompilationMode : int
// NEVER inherit from this class.
struct VideoConfig final
{
VideoConfig() = default;
VideoConfig();
void Refresh();
void VerifyValidity();
@@ -89,7 +87,6 @@ struct VideoConfig final
bool bShowNetPlayMessages;
bool bOverlayStats;
bool bOverlayProjStats;
bool bOverlayScissorStats;
bool bTexFmtOverlayEnable;
bool bTexFmtOverlayCenter;
bool bLogRenderTimeToFile;
@@ -112,7 +109,6 @@ struct VideoConfig final
bool bDumpFramesAsImages;
bool bUseFFV1;
std::string sDumpCodec;
std::string sDumpPixelFormat;
std::string sDumpEncoder;
std::string sDumpFormat;
std::string sDumpPath;
@@ -120,8 +116,6 @@ struct VideoConfig final
bool bBorderlessFullscreen;
bool bEnableGPUTextureDecoding;
int iBitrateKbps;
bool bGraphicMods = false;
std::optional<GraphicsModGroupConfig> graphics_mod_config;
// Hacks
bool bEFBAccessEnable;
@@ -144,8 +138,6 @@ struct VideoConfig final
bool bFastDepthCalc;
bool bVertexRounding;
int iEFBAccessTileSize;
u32 iMissingColorValue;
bool bFastTextureSampling;
int iLog; // CONF_ bits
int iSaveTargetId; // TODO: Should be dropped
@@ -194,7 +186,7 @@ struct VideoConfig final
// TODO: Move this out of VideoConfig
struct
{
APIType api_type = APIType::Nothing;
APIType api_type;
std::vector<std::string> Adapters; // for D3D
std::vector<u32> AAModes;
@@ -202,48 +194,42 @@ struct VideoConfig final
// TODO: merge AdapterName and Adapters array
std::string AdapterName; // for OpenGL
u32 MaxTextureSize = 16384;
bool bUsesLowerLeftOrigin = false;
u32 MaxTextureSize;
bool bUsesLowerLeftOrigin;
bool bSupportsExclusiveFullscreen = false;
bool bSupportsDualSourceBlend = false;
bool bSupportsPrimitiveRestart = false;
bool bSupportsOversizedViewports = false;
bool bSupportsGeometryShaders = false;
bool bSupportsComputeShaders = false;
bool bSupports3DVision = false;
bool bSupportsEarlyZ = false; // needed by PixelShaderGen, so must stay in VideoCommon
bool bSupportsBindingLayout = false; // Needed by ShaderGen, so must stay in VideoCommon
bool bSupportsBBox = false;
bool bSupportsGSInstancing = false; // Needed by GeometryShaderGen, so must stay in VideoCommon
bool bSupportsPostProcessing = false;
bool bSupportsPaletteConversion = false;
bool bSupportsClipControl = false; // Needed by VertexShaderGen, so must stay in VideoCommon
bool bSupportsSSAA = false;
bool bSupportsFragmentStoresAndAtomics = false; // a.k.a. OpenGL SSBOs a.k.a. Direct3D UAVs
bool bSupportsDepthClamp = false; // Needed by VertexShaderGen, so must stay in VideoCommon
bool bSupportsReversedDepthRange = false;
bool bSupportsLogicOp = false;
bool bSupportsMultithreading = false;
bool bSupportsGPUTextureDecoding = false;
bool bSupportsST3CTextures = false;
bool bSupportsCopyToVram = false;
bool bSupportsBitfield = false; // Needed by UberShaders, so must stay in VideoCommon
// Needed by UberShaders, so must stay in VideoCommon
bool bSupportsDynamicSamplerIndexing = false;
bool bSupportsBPTCTextures = false;
bool bSupportsFramebufferFetch = false; // Used as an alternative to dual-source blend on GLES
bool bSupportsBackgroundCompiling = false;
bool bSupportsLargePoints = false;
bool bSupportsPartialDepthCopies = false;
bool bSupportsDepthReadback = false;
bool bSupportsShaderBinaries = false;
bool bSupportsPipelineCacheData = false;
bool bSupportsCoarseDerivatives = false;
bool bSupportsTextureQueryLevels = false;
bool bSupportsLodBiasInSampler = false;
bool bSupportsSettingObjectNames = false;
bool bSupportsPartialMultisampleResolve = false;
bool bSupportsExclusiveFullscreen;
bool bSupportsDualSourceBlend;
bool bSupportsPrimitiveRestart;
bool bSupportsOversizedViewports;
bool bSupportsGeometryShaders;
bool bSupportsComputeShaders;
bool bSupports3DVision;
bool bSupportsEarlyZ; // needed by PixelShaderGen, so must stay in VideoCommon
bool bSupportsBindingLayout; // Needed by ShaderGen, so must stay in VideoCommon
bool bSupportsBBox;
bool bSupportsGSInstancing; // Needed by GeometryShaderGen, so must stay in VideoCommon
bool bSupportsPostProcessing;
bool bSupportsPaletteConversion;
bool bSupportsClipControl; // Needed by VertexShaderGen, so must stay in VideoCommon
bool bSupportsSSAA;
bool bSupportsFragmentStoresAndAtomics; // a.k.a. OpenGL SSBOs a.k.a. Direct3D UAVs
bool bSupportsDepthClamp; // Needed by VertexShaderGen, so must stay in VideoCommon
bool bSupportsReversedDepthRange;
bool bSupportsLogicOp;
bool bSupportsMultithreading;
bool bSupportsGPUTextureDecoding;
bool bSupportsST3CTextures;
bool bSupportsCopyToVram;
bool bSupportsBitfield; // Needed by UberShaders, so must stay in VideoCommon
bool bSupportsDynamicSamplerIndexing; // Needed by UberShaders, so must stay in VideoCommon
bool bSupportsBPTCTextures;
bool bSupportsFramebufferFetch; // Used as an alternative to dual-source blend on GLES
bool bSupportsBackgroundCompiling;
bool bSupportsLargePoints;
bool bSupportsPartialDepthCopies;
bool bSupportsDepthReadback;
bool bSupportsShaderBinaries;
bool bSupportsPipelineCacheData;
} backend_info;
// Utility
@@ -257,16 +243,6 @@ struct VideoConfig final
return backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding;
}
bool UseVertexRounding() const { return bVertexRounding && iEFBScale != 1; }
bool ManualTextureSamplingWithHiResTextures() const
{
// Hi-res textures (including hi-res EFB copies, but not native-resolution EFB copies at higher
// internal resolutions) breaks the wrapping logic used by manual texture sampling.
if (bFastTextureSampling)
return false;
if (iEFBScale != 1 && bCopyEFBScaled)
return true;
return bHiresTextures;
}
bool UsingUberShaders() const;
u32 GetShaderCompilerThreads() const;
u32 GetShaderPrecompilerThreads() const;
+3 -3
View File
@@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Core/ActionReplay.h"
#include "Core/ARDecrypt.h"
#include "InputCommon/ControllerInterface/CoreDevice.h"
#include "InputCommon/ControllerInterface/Device.h"
#include "DolphinNoGUI/Platform.h"
@@ -59,8 +59,8 @@ public:
void SetIR(int player, float x, float y);
void processSpecialKeys (int button , int player);
void setWiimoteSideways (int player);
void setWiimoteUpright (int player);
void setWiimoteSideways (int player, bool sideways);
void setWiimoteUpright (int player, bool upright);
void changeWiimoteExtension(int extension, int player);
void toggleAudioMute();
+28 -44
View File
@@ -44,11 +44,10 @@
#include "Common/Thread.h"
#include "Common/Version.h"
#include "Core/DolphinAnalytics.h"
#include "Core/Analytics.h"
#include "Core/Boot/Boot.h"
#include "Core/BootManager.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/WiimoteSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/Host.h"
@@ -79,9 +78,6 @@
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoBackends/OGL/ProgramShaderCache.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
DolHost* DolHost::m_instance = nullptr;
static Common::Event updateMainFrameEvent;
static Common::Flag s_running{true};
@@ -115,33 +111,33 @@ void DolHost::Init(std::string supportDirectoryPath, std::string cpath)
UICommon::Init();
// Database Settings
Config::SetBase(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE, true);
SConfig::GetInstance().m_use_builtin_title_database = true;
//Setup the CPU Settings
Config::SetBase(Config::MAIN_MMU, true);
Config::SetBase(Config::MAIN_ENABLE_CHEATS, true);
SConfig::GetInstance().bMMU = true;
SConfig::GetInstance().bEnableCheats = true;
SConfig::GetInstance().bBootToPause = false;
//Debug Settings
Config::SetBase(Config::MAIN_ENABLE_DEBUGGING, false);
SConfig::GetInstance().bEnableDebugging = false;
#ifdef DEBUG
Config::SetBase(Config::MAIN_OSD_MESSAGES, true);
#else
Config::SetBase(Config::MAIN_OSD_MESSAGES, false);
#endif
Config::SetBase(Config::MAIN_SHOW_FRAME_COUNT, false);
SConfig::GetInstance().m_ShowFrameCount = false;
//Video
Config::SetBase(Config::MAIN_GFX_BACKEND, "OGL");
VideoBackendBase::ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
//Set the Sound
Config::SetBase(Config::MAIN_DSP_HLE, true);
Config::SetBase(Config::MAIN_DSP_THREAD, true);
Config::SetBase(Config::MAIN_AUDIO_VOLUME, 0);
SConfig::GetInstance().bDSPHLE = true;
SConfig::GetInstance().bDSPThread = true;
SConfig::GetInstance().m_Volume = 0;
//Split CPU thread from GPU
Config::SetBase(Config::MAIN_CPU_THREAD, true);
SConfig::GetInstance().bCPUThread = true;
//Analitics
Config::SetBase(Config::MAIN_ANALYTICS_PERMISSION_ASKED, true);
@@ -152,10 +148,10 @@ void DolHost::Init(std::string supportDirectoryPath, std::string cpath)
SConfig::GetInstance().SaveSettings();
//Choose Wiimote Type
Config::SetCurrent(Config::GetInfoForWiimoteSource(0), WiimoteSource::Emulated);
Config::SetCurrent(Config::GetInfoForWiimoteSource(1), WiimoteSource::Emulated);
Config::SetCurrent(Config::GetInfoForWiimoteSource(2), WiimoteSource::Emulated);
Config::SetCurrent(Config::GetInfoForWiimoteSource(3), WiimoteSource::Emulated);
WiimoteCommon::SetSource(0, WiimoteSource::Emulated);
WiimoteCommon::SetSource(1, WiimoteSource::Emulated);
WiimoteCommon::SetSource(2, WiimoteSource::Emulated);
WiimoteCommon::SetSource(3, WiimoteSource::Emulated);
//Get game info from file path
GetGameInfo();
@@ -193,7 +189,7 @@ void DolHost::Init(std::string supportDirectoryPath, std::string cpath)
// SConfig::GetInstance().m_enable_signature_checks = false;
// Disable wiimote continuous scanning
Config::SetBase(Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING, false);
SConfig::GetInstance().m_WiimoteContinuousScanning = false;
//Set the Wiimote type
// WiimoteReal::ChangeWiimoteSource(0, _wiiMoteType);
@@ -206,7 +202,7 @@ void DolHost::Init(std::string supportDirectoryPath, std::string cpath)
# pragma mark - Execution
bool DolHost::LoadFileAtPath()
{
Core::AddOnStateChangedCallback([](Core::State state) {
Core::SetOnStateChangedCallback([](Core::State state) {
if (state == Core::State::Uninitialized)
s_running.Clear();
});
@@ -295,7 +291,7 @@ void DolHost::SetBackBufferSize(int width, int height) {
# pragma mark - Audio
void DolHost::SetVolume(float value)
{
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_VOLUME, value * 100);
SConfig::GetInstance().m_Volume = value * 100;
AudioCommon::UpdateSoundStream();
}
@@ -495,29 +491,32 @@ void DolHost::SetAxis(int button, float value, int player)
void DolHost::processSpecialKeys (int button , int player)
{
player -= 1;
button += 1;
if (button == OEWiimoteSideways) {
_wmSideways[player] = !_wmSideways[player];
setWiimoteSideways(player);
setWiimoteSideways(player, _wmSideways[player - 1]);
} else if (button == OEWiimoteUpright) {
_wmUpright[player] = !_wmUpright[player];
setWiimoteUpright(player);
setWiimoteUpright(player ,_wmUpright[player - 1]);
}
}
void DolHost::setWiimoteSideways (int player)
void DolHost::setWiimoteSideways (int player, bool sideways)
{
static_cast<ControllerEmu::NumericSetting<bool>*>(Wiimote::GetWiimoteGroup(player, WiimoteEmu::WiimoteGroup::Options)->numeric_settings[3].get())->SetValue(_wmSideways[player]);
player -= 1;
static_cast<ControllerEmu::NumericSetting<bool>*>(Wiimote::GetWiimoteGroup(player, WiimoteEmu::WiimoteGroup::Options)->numeric_settings[3].get())->SetValue(sideways);
}
void DolHost::setWiimoteUpright (int player)
void DolHost::setWiimoteUpright (int player, bool upright)
{
static_cast<ControllerEmu::NumericSetting<bool>*>(Wiimote::GetWiimoteGroup(player, WiimoteEmu::WiimoteGroup::Options)->numeric_settings[2].get())->SetValue(_wmUpright[player]);
player -= 1;
static_cast<ControllerEmu::NumericSetting<bool>*>(Wiimote::GetWiimoteGroup(player, WiimoteEmu::WiimoteGroup::Options)->numeric_settings[2].get())->SetValue(upright);
}
void DolHost::changeWiimoteExtension(int extension, int player)
{
player -= 1;
static_cast<ControllerEmu::Attachments*>(Wiimote::GetWiimoteGroup(player, WiimoteEmu::WiimoteGroup::Attachments))->SetSelectedAttachment(extension);
}
@@ -616,30 +615,15 @@ void Host_RequestRenderWindowSize(int width, int height){}
void Host_SetStartupDebuggingParameters()
{
SConfig& StartUp = SConfig::GetInstance();
StartUp.bEnableDebugging = false;
StartUp.bBootToPause = false;
}
std::vector<std::string> Host_GetPreferredLocales()
{
return {};
}
bool Host_UINeedsControllerState(){ return false; }
bool Host_UIBlocksControllerState() { return false; }
bool Host_RendererHasFocus() { return true; }
bool Host_RendererHasFullFocus() { return true; }
bool Host_RendererIsFullscreen() { return false; }
void Host_ShowVideoConfig(void*, const std::string&) {}
void Host_YieldToUI() {}
void Host_TitleChanged() {}
void Host_UpdateProgressDialog(const char* caption, int position, int total) {}
void Host_UpdateDiscordClientID(const std::string& client_id) {}
bool Host_UpdateDiscordPresenceRaw(const std::string& details, const std::string& state,
const std::string& large_image_key,
const std::string& large_image_text,
const std::string& small_image_key,
const std::string& small_image_text,
const int64_t start_timestamp,
const int64_t end_timestamp, const int party_size,
const int party_max) { return false; }
+272
View File
@@ -71,6 +71,8 @@ extern std::unique_ptr<SoundStream> g_sound_stream;
NSString *_dolphinCoreModule;
OEIntSize _dolphinCoreAspect;
OEIntSize _dolphinCoreScreen;
NSMutableArray <NSMutableDictionary <NSString *, id> *> *_advancedMenus;
}
- (instancetype)init
@@ -145,6 +147,9 @@ extern std::unique_ptr<SoundStream> g_sound_stream;
_frameInterval = dol_host->GetFrameInterval();
if (_isWii)
[self changeAdvancedMenuOption:@"Wiimote" menuID:@"Controller1"];
}
[super startEmulation];
@@ -407,4 +412,271 @@ extern std::unique_ptr<SoundStream> g_sound_stream;
{
dol_host->SetCheat([code UTF8String], [type UTF8String], enabled);
}
# pragma mark - Advanced Menu Functions (do not change)
- (void)changeAdvancedMenuOption:(NSString *)advancedMenuName menuID:(NSString *)menuID
{
if (_advancedMenus.count == 0)
[self advancedMenu];
// First check if Menu Option is toggleable and grab its preference key
BOOL isMenuToggleable = NO;
BOOL isValidMenu = NO;
BOOL menuState = NO;
NSString *menuPrefKey;
NSString *menuIDKey;
for (NSDictionary *menuDict in _advancedMenus)
{
if (menuDict[OEGameCoreAdvancedMenuGroupNameKey]){
NSDictionary *subMenuDict = [self findAdvancedSubMenu:menuDict menuName:advancedMenuName menuID:menuID];
if (subMenuDict){
menuState = [subMenuDict[OEGameCoreAdvancedMenuStateKey] boolValue];
menuPrefKey = subMenuDict[OEGameCoreAdvancedMenuPrefKeyNameKey];
menuIDKey = subMenuDict[OEGameCoreAdvancedMenuGroupIDKey];
isMenuToggleable = [subMenuDict[OEGameCoreAdvancedMenuAllowsToggleKey] boolValue];
isValidMenu = YES;
break;
}
}
if ([menuDict[OEGameCoreAdvancedMenuNameKey] isEqualToString:advancedMenuName])
{
if ([menuDict[OEGameCoreAdvancedMenuGroupIDKey] isEqualToString:menuID])
{
menuState = [menuDict[OEGameCoreAdvancedMenuStateKey] boolValue];
menuPrefKey = menuDict[OEGameCoreAdvancedMenuPrefKeyNameKey];
menuIDKey = menuDict[OEGameCoreAdvancedMenuGroupIDKey];
isMenuToggleable = [menuDict[OEGameCoreAdvancedMenuAllowsToggleKey] boolValue];
isValidMenu = YES;
break;
}
}
}
if (!isValidMenu)
return;
// Handle option state changes
for (NSMutableDictionary *menuDict in _advancedMenus)
{
if (menuDict[OEGameCoreAdvancedMenuGroupNameKey]){
[self processAdvancedSubMenu:menuDict menuName:advancedMenuName menuID:menuID menuState:menuState menuPrefKey:menuPrefKey menuToggle:isMenuToggleable];
}
}
//send the menuname and menuID for actions to be taken
[self advancedMenuAction:advancedMenuName menuID:menuID];
}
- (void) processAdvancedSubMenu:(NSMutableDictionary *)parentMenuDict menuName:(NSString *)menuName menuID:(NSString *)menuID menuState:(BOOL)menuState menuPrefKey:(NSString *)menuPrefKey menuToggle:(BOOL)menuToggle;
{
for (NSMutableDictionary *subMenuDict in parentMenuDict[OEGameCoreAdvancedMenuGroupItemsKey])
{
//This function iterates through the menu items and sets the option and clears others in the same prefs group or toggles the menu item
NSString *curMenuID = subMenuDict[OEGameCoreAdvancedMenuGroupIDKey];
if (subMenuDict[OEGameCoreAdvancedMenuGroupNameKey]){
[self processAdvancedSubMenu:subMenuDict menuName:menuName menuID:menuID menuState:menuState menuPrefKey:menuPrefKey menuToggle:menuToggle];
}
else if ( [curMenuID isEqualToString:menuID] ){
NSString *curMenuName = subMenuDict[OEGameCoreAdvancedMenuNameKey];
NSString *curMenuKey = subMenuDict[OEGameCoreAdvancedMenuPrefKeyNameKey];
if (!curMenuName)
continue;
// Mutually exclusive option state change
else if ([curMenuName isEqualToString:menuName] && !menuToggle)
subMenuDict[OEGameCoreAdvancedMenuStateKey] = @YES;
// Reset mutually exclusive options that are the same prefs group
else if (!menuToggle && [curMenuKey isEqualToString:menuPrefKey])
subMenuDict[OEGameCoreAdvancedMenuStateKey] = @NO;
// Toggleable option state change
else if ([curMenuName isEqualToString:menuName] && menuToggle)
subMenuDict[OEGameCoreAdvancedMenuStateKey] = @(!menuState);
}
}
}
- (NSDictionary *) findAdvancedSubMenu:(NSDictionary *)parentMenuDict menuName:(NSString *)menuName menuID:(NSString *)menuID
{
//This function iterates through the menu items and returns the dictionary item if found
NSDictionary *testSubMenuDict;
for (NSDictionary *subMenuDict in parentMenuDict[OEGameCoreAdvancedMenuGroupItemsKey])
{
if (subMenuDict[OEGameCoreAdvancedMenuGroupNameKey])
{
testSubMenuDict = [self findAdvancedSubMenu:subMenuDict menuName:menuName menuID:menuID];
if (testSubMenuDict)
{
if ([testSubMenuDict[OEGameCoreAdvancedMenuNameKey] isEqualToString:menuName])
{
if ([testSubMenuDict[OEGameCoreAdvancedMenuGroupIDKey] isEqualToString:menuID])
{
return testSubMenuDict;
}
}
}
}
if ([subMenuDict[OEGameCoreAdvancedMenuNameKey] isEqualToString:menuName])
{
if ([subMenuDict[OEGameCoreAdvancedMenuGroupIDKey] isEqualToString:menuID])
{
return subMenuDict;
}
}
}
return nil;
}
# pragma mark - Advanced Menu Creation
- (NSArray <NSDictionary <NSString *, id> *> *)advancedMenu
{
//Create your menu array here. 4 levels deep at most
if (_advancedMenus.count == 0)
{
_advancedMenus = [NSMutableArray array];
NSArray <NSDictionary <NSString *, id> *> *advancedMenuWithDefault =
@[ // Level 1
// @{ OEGameCoreAdvancedMenuGroupNameKey : @"Controllers",
// OEGameCoreAdvancedMenuGroupIDKey : @"Controllers",
// OEGameCoreAdvancedMenuGroupItemsKey : @[
// // Level 2
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Controller 1",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller1",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 3
OEAdvancedMenu_OptionDefault(@"Wiimote", @"Controller1", @"controller1"),
OEAdvancedMenu_Option(@"Sideways Wiimote", @"Controller1", @"controller1"),
OEAdvancedMenu_SeparatorItem(),
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Wiimote Attachment",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller1",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 4
OEAdvancedMenu_OptionIndentedDefault(@"None", @"Controller1", @"attachment1"),
OEAdvancedMenu_OptionIndented(@"Nunckuk", @"Controller1", @"attachment1"),
OEAdvancedMenu_OptionIndented(@"Classic Controller", @"Controller1", @"attachment1"),
]
},
]
},
// Level 2
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Controller 2",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller2",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 3
OEAdvancedMenu_OptionDefault(@"Wiimote", @"Controller2", @"controller2"),
OEAdvancedMenu_Option(@"Sideways Wiimote", @"Controller2", @"controller2"),
OEAdvancedMenu_SeparatorItem(),
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Wiimote Attachment",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller2",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 4
OEAdvancedMenu_OptionIndentedDefault(@"None", @"Controller2", @"attachment2"),
OEAdvancedMenu_OptionIndented(@"Nunckuk", @"Controller2", @"attachment2"),
OEAdvancedMenu_OptionIndented(@"Classic Controller", @"Controller2", @"attachment2"),
]
},
]
},
// Level 2
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Controller 3",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller3",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 3
OEAdvancedMenu_OptionDefault(@"Wiimote", @"Controller3", @"controller3"),
OEAdvancedMenu_Option(@"Sideways Wiimote", @"Controller3", @"controller3"),
OEAdvancedMenu_SeparatorItem(),
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Wiimote Attachment",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller3",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 4
OEAdvancedMenu_OptionIndentedDefault(@"None", @"Controller3", @"attachment3"),
OEAdvancedMenu_OptionIndented(@"Nunckuk", @"Controller3", @"attachment3"),
OEAdvancedMenu_OptionIndented(@"Classic Controller", @"Controller3", @"attachment3"),
]
},
]
},
// Level 2
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Controller 4",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller4",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 3
OEAdvancedMenu_OptionDefault(@"Wiimote", @"Controller4", @"controller4"),
OEAdvancedMenu_Option(@"Sideways Wiimote", @"Controller4", @"controller4"),
OEAdvancedMenu_SeparatorItem(),
@{ OEGameCoreAdvancedMenuGroupNameKey : @"Wiimote Attachment",
OEGameCoreAdvancedMenuGroupIDKey : @"Controller4",
OEGameCoreAdvancedMenuGroupItemsKey : @[
// Level 4
OEAdvancedMenu_OptionIndentedDefault(@"None", @"Controller4", @"attachment4"),
OEAdvancedMenu_OptionIndented(@"Nunckuk", @"Controller4", @"attachment4"),
OEAdvancedMenu_OptionIndented(@"Classic Controller", @"Controller4", @"attachment4"),
]
},
]
// },
// ]
},
];
// Deep mutable copy
_advancedMenus = (NSMutableArray *)CFBridgingRelease(CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (CFArrayRef)advancedMenuWithDefault, kCFPropertyListMutableContainers));
}
return [_advancedMenus copy];
}
# pragma mark - Advanced Menu Actions Processing
- (void)advancedMenuAction:(NSString *)advancedMenuName menuID:(NSString *)menuID
{
//Write your code to process Clicked menu items here
int player = 0;
if ([menuID isEqualToString:@"Controller1"]){
player = 1;
}
if ([menuID isEqualToString:@"Controller2"]){
player = 2;
}
if ([menuID isEqualToString:@"Controller3"]){
player = 3;
}
if ([menuID isEqualToString:@"Controller4"]){
player = 4;
}
if (player){
if ([advancedMenuName isEqualToString:@"Wiimote"])
{
dol_host->setWiimoteSideways(player, false);
return;
}
if ([advancedMenuName isEqualToString:@"Sideways Wiimote"])
{
dol_host->setWiimoteSideways(player, true);
return;
}
if ([advancedMenuName isEqualToString:@"none"])
{
dol_host->changeWiimoteExtension(0, player);
return;
}
if ([advancedMenuName isEqualToString:@"Nunchuk"])
{
dol_host->changeWiimoteExtension(1, player);
return;
}
if ([advancedMenuName isEqualToString:@"Classic Controller"])
{
dol_host->changeWiimoteExtension(2, player);
return;
}
}
}
@end
+5 -3
View File
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
@@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<string>5.0.13467</string>
<key>NSPrincipalClass</key>
<string>OEGameCoreController</string>
<key>OEGameCoreClass</key>
@@ -37,6 +37,8 @@
<dict>
<key>OEGameCoreHasGlitches</key>
<true/>
<key>OEGameCoreSupportsAdvancedMenu</key>
<true/>
</dict>
</dict>
<key>OEGameCorePlayerCount</key>
@@ -49,7 +51,7 @@
<string>openemu.system.wii</string>
</array>
<key>SUEnableAutomaticChecks</key>
<true/>
<string>1</string>
<key>SUFeedURL</key>
<string>https://raw.github.com/OpenEmu/OpenEmu-Update/master/dolphin_appcast.xml</string>
</dict>
+1 -1
Submodule dolphin updated: 63638d4021...79a234eff7
File diff suppressed because it is too large Load Diff