Skip to content

Commit

Permalink
Merge pull request #11586 from JosJuice/unknown-opcode-msg
Browse files Browse the repository at this point in the history
VideoCommon: Reword the unknown opcode error message
  • Loading branch information
AdmiralCurtiss committed Jun 3, 2023
2 parents 3245786 + f2be35c commit 0b3d28a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Source/Core/Core/CoreTiming.cpp
Expand Up @@ -417,6 +417,11 @@ bool CoreTimingManager::GetVISkip() const
return m_throttle_disable_vi_int && g_ActiveConfig.bVISkip && !Core::WantsDeterminism();
}

bool CoreTimingManager::UseSyncOnSkipIdle() const
{
return m_config_sync_on_skip_idle;
}

void CoreTimingManager::LogPendingEvents() const
{
auto clone = m_event_queue;
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Core/CoreTiming.h
Expand Up @@ -150,6 +150,8 @@ class CoreTimingManager
TimePoint GetCPUTimePoint(s64 cyclesLate) const; // Used by Dolphin Analytics
bool GetVISkip() const; // Used By VideoInterface

bool UseSyncOnSkipIdle() const;

private:
Globals m_globals;

Expand Down
51 changes: 43 additions & 8 deletions Source/Core/VideoCommon/CommandProcessor.cpp
Expand Up @@ -12,6 +12,7 @@
#include "Common/CommonTypes.h"
#include "Common/Flag.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h"
#include "Core/HW/GPFifo.h"
Expand Down Expand Up @@ -695,16 +696,50 @@ void CommandProcessorManager::HandleUnknownOpcode(Core::System& system, u8 cmd_b
{
m_is_fifo_error_seen = true;

// TODO(Omega): Maybe dump FIFO to file on this error
// The panic alert contains an explanatory part that's worded differently depending on the
// user's settings, so as to offer the most relevant advice to the user.
const char* advice;
if (IsOnThread(system) && !system.GetFifo().UseDeterministicGPUThread())
{
if (!system.GetCoreTiming().UseSyncOnSkipIdle() && !system.GetFifo().UseSyncGPU())
{
// The SyncOnSkipIdle setting is only in the Android GUI, so we use the INI name on other platforms.
//
// TODO: Mark the Android string as translatable once we have translations on Android. It's
// currently untranslatable so translators won't try to look up how they translated "Synchronize
// GPU Thread" and "On Idle Skipping" and then not find those strings and become confused.
#ifdef ANDROID
advice = "Please change the \"Synchronize GPU Thread\" setting to \"On Idle Skipping\"! "
"It's currently set to \"Never\", which makes this problem very likely to happen.";
#else
// i18n: Please leave SyncOnSkipIdle and True untranslated.
// The user needs to enter these terms as-is in an INI file.
advice = _trans("Please change the \"SyncOnSkipIdle\" setting to \"True\"! "
"It's currently disabled, which makes this problem very likely to happen.");
#endif
}
else
{
advice = _trans(
"This error is usually caused by the emulated GPU desyncing with the emulated CPU. "
"Turn off the \"Dual Core\" setting to avoid this.");
}
}
else
{
advice = _trans(
"This error is usually caused by the emulated GPU desyncing with the emulated CPU, "
"but your current settings make this unlikely to happen. If this error is stopping the "
"game from working, please report it to the developers.");
}

PanicAlertFmtT("GFX FIFO: Unknown Opcode ({0:#04x} @ {1}, preprocess={2}).\n"
"This means one of the following:\n"
"* The emulated GPU got desynced, disabling dual core can help\n"
"* Command stream corrupted by some spurious memory bug\n"
"* This really is an unknown opcode (unlikely)\n"
"* Some other sort of bug\n\n"
"Further errors will be sent to the Video Backend log and\n"
"\n"
"{3}\n"
"\n"
"Further errors will be sent to the Video Backend log and "
"Dolphin will now likely crash or hang.",
cmd_byte, fmt::ptr(buffer), preprocess);
cmd_byte, fmt::ptr(buffer), preprocess, Common::GetStringT(advice));
}
}

Expand Down
1 change: 1 addition & 0 deletions Source/Core/VideoCommon/Fifo.h
Expand Up @@ -54,6 +54,7 @@ class FifoManager final
void PauseAndLock(Core::System& system, bool doLock, bool unpauseOnUnlock);
void UpdateWantDeterminism(Core::System& system, bool want);
bool UseDeterministicGPUThread() const { return m_use_deterministic_gpu_thread; }
bool UseSyncGPU() const { return m_config_sync_gpu; }

// In deterministic GPU thread mode this waits for the GPU to be done with pending work.
void SyncGPU(SyncGPUReason reason, bool may_move_read_ptr = true);
Expand Down

0 comments on commit 0b3d28a

Please sign in to comment.