Skip to content

Commit

Permalink
Merge pull request #18724 from hrydgard/restart-graphics-windows
Browse files Browse the repository at this point in the history
Windows: Add "Restart Graphics" to the debug menu.
  • Loading branch information
hrydgard committed Jan 18, 2024
2 parents 7918e49 + b899a17 commit 457681f
Show file tree
Hide file tree
Showing 51 changed files with 73 additions and 2 deletions.
1 change: 1 addition & 0 deletions Common/System/System.h
Expand Up @@ -246,6 +246,7 @@ enum class UIMessage {
SAVESTATE_DISPLAY_SLOT,
GAMESETTINGS_SEARCH,
SAVEDATA_SEARCH,
RESTART_GRAPHICS,
};

std::string System_GetProperty(SystemProperty prop);
Expand Down
1 change: 1 addition & 0 deletions Core/Core.h
Expand Up @@ -44,6 +44,7 @@ bool Core_NextFrame();
void Core_DoSingleStep();
void Core_UpdateSingleStep();
void Core_ProcessStepping();

// Changes every time we enter stepping.
int Core_GetSteppingCounter();
struct SteppingReason {
Expand Down
2 changes: 1 addition & 1 deletion GPU/Common/TextureReplacer.cpp
Expand Up @@ -773,12 +773,12 @@ void TextureReplacer::NotifyTextureDecoded(ReplacedTexture *texture, const Repla

ReplacementCacheKey replacementKey(cachekey, replacedInfo.hash);
auto it = savedCache_.find(replacementKey);
double now = time_now_d();
if (it != savedCache_.end()) {
// We've already saved this texture. Ignore it.
// We don't really care about changing the scale factor during runtime, only confusing.
return;
}
double now = time_now_d();

// Width/height of the image to save.
int w = scaledW;
Expand Down
9 changes: 9 additions & 0 deletions SDL/CocoaBarItems.mm
Expand Up @@ -405,6 +405,10 @@ -(NSMenu *)makeDebugMenu {
copyBaseAddr.target = self;
copyBaseAddr.tag = 11;

NSMenuItem *restartGraphicsAction = [[NSMenuItem alloc] initWithTitle:DESKTOPUI_LOCALIZED("Restart Graphics") action:@selector(restartGraphics) keyEquivalent:@""];
restartGraphicsAction.target = self;
restartGraphicsAction.tag = 12;

MENU_ITEM(showDebugStatsAction, DESKTOPUI_LOCALIZED("Show Debug Statistics"), @selector(toggleShowDebugStats:), ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::DEBUG_STATS), 12)

[parent addItem:loadSymbolMapAction];
Expand All @@ -421,6 +425,7 @@ -(NSMenu *)makeDebugMenu {
[parent addItem:takeScreenshotAction];
[parent addItem:dumpNextFrameToLogAction];
[parent addItem:showDebugStatsAction];
[parent addItem:restartGraphicsAction];

[parent addItem:[NSMenuItem separatorItem]];
[parent addItem:copyBaseAddr];
Expand Down Expand Up @@ -462,6 +467,10 @@ -(void)copyAddr {
[NSPasteboard.generalPasteboard setString:stringToCopy forType:NSPasteboardTypeString];
}

-(void)restartGraphics {
System_PostUIMessage(UIMessage::RESTART_GRAPHICS);
}

-(NSURL *)presentOpenPanelWithAllowedFileTypes: (NSArray<NSString *> *)allowedFileTypes {
NSOpenPanel *openPanel = [[NSOpenPanel alloc] init];
openPanel.allowedFileTypes = allowedFileTypes;
Expand Down
13 changes: 12 additions & 1 deletion UI/NativeApp.cpp
Expand Up @@ -183,6 +183,7 @@ static Draw::DrawContext *g_draw;
static Draw::Pipeline *colorPipeline;
static Draw::Pipeline *texColorPipeline;
static UIContext *uiContext;
static bool g_restartGraphics;

#ifdef _WIN32
WindowsAudioBackend *winAudioBackend;
Expand Down Expand Up @@ -1035,6 +1036,14 @@ static void SendMouseDeltaAxis();
void NativeFrame(GraphicsContext *graphicsContext) {
PROFILE_END_FRAME();

// This can only be accessed from Windows currently, and causes linking errors with headless etc.
if (g_restartGraphics) {
// Used for debugging only.
NativeShutdownGraphics();
NativeInitGraphics(graphicsContext);
g_restartGraphics = false;
}

double startTime = time_now_d();

ProcessWheelRelease(NKCODE_EXT_MOUSEWHEEL_UP, startTime, false);
Expand Down Expand Up @@ -1173,7 +1182,9 @@ void NativeFrame(GraphicsContext *graphicsContext) {
}

bool HandleGlobalMessage(UIMessage message, const std::string &value) {
if (message == UIMessage::SAVESTATE_DISPLAY_SLOT) {
if (message == UIMessage::RESTART_GRAPHICS) {
g_restartGraphics = true;
} else if (message == UIMessage::SAVESTATE_DISPLAY_SLOT) {
auto sy = GetI18NCategory(I18NCat::SYSTEM);
std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), SaveState::GetCurrentSlot() + 1);
// Show for the same duration as the preview.
Expand Down
4 changes: 4 additions & 0 deletions Windows/MainWindowMenu.cpp
Expand Up @@ -925,6 +925,10 @@ namespace MainWindow {
g_TakeScreenshot = true;
break;

case ID_DEBUG_RESTARTGRAPHICS:
System_PostUIMessage(UIMessage::RESTART_GRAPHICS);
break;

case ID_FILE_DUMPFRAMES:
g_Config.bDumpFrames = !g_Config.bDumpFrames;
break;
Expand Down
1 change: 1 addition & 0 deletions Windows/ppsspp.rc
Expand Up @@ -578,6 +578,7 @@ BEGIN
MENUITEM "Take Screenshot", ID_DEBUG_TAKESCREENSHOT
MENUITEM "Dump Next Frame to Log", ID_DEBUG_DUMPNEXTFRAME
MENUITEM "Show Debug Statistics", ID_DEBUG_SHOWDEBUGSTATISTICS
MENUITEM "Restart Graphics", ID_DEBUG_RESTARTGRAPHICS,
MENUITEM "", 0, MFT_SEPARATOR
MENUITEM "Disassembly", ID_DEBUG_DISASSEMBLY
MENUITEM "GE Debugger...", ID_DEBUG_GEDEBUGGER
Expand Down
1 change: 1 addition & 0 deletions Windows/resource.h
Expand Up @@ -190,6 +190,7 @@
#define ID_HELP_OPENFORUM 40064
#define ID_OPTIONS_VSYNC 40065
#define ID_DEBUG_TAKESCREENSHOT 40066
#define ID_DEBUG_RESTARTGRAPHICS 40070
#define ID_OPTIONS_TEXTUREFILTERING_AUTO 40067
#define ID_OPTIONS_NEARESTFILTERING 40068
#define ID_DISASM_DISASSEMBLETOFILE 40069
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ar_AE.ini
Expand Up @@ -241,6 +241,7 @@ Memory View... = ‎عرض الرام...
More Settings... = ‎&إعدادات إضافية...
Nearest = ‎&الأقرب
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = ‎&تخطي تأثيرات الصقل (غير مصقول, أسرع)
Off = ‎&مغلق
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/az_AZ.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Memory &View...
More Settings... = &More Settings...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/bg_BG.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Памет изглед...
More Settings... = Още настройки...
Nearest = &Най-близко
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Изключено
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ca_ES.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Visor de &memòria...
More Settings... = Més &paràmetres...
Nearest = &El més proper
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Renderitzat sense memòria intermèdia (més ràpid)
Off = &No
Open Chat = Obrir xat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/cz_CZ.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = &Zobrazení paměti...
More Settings... = D&alší nastavení...
Nearest = &Nejbližší
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Přeskočit efekty vyrovnávací paměti
Off = &Vypnuto
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/da_DK.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Hukommelseso&versigt...
More Settings... = &Flere indstillinger...
Nearest = &Nærmest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effekter
Off = &Slukket
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/de_DE.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Speicheransicht...
More Settings... = Mehr Einstellungen...
Nearest = Nächster Nachbar
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = Überspringe Puffereffekte
Off = Aus
Open Chat = Öffne Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/dr_ID.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Pempakitan &Memory...
More Settings... = &More Settings...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Mate
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/en_US.ini
Expand Up @@ -256,6 +256,7 @@ Log Console = &Log console
Memory View... = Memory &view...
More Settings... = &More settings...
Nearest = &Nearest
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/es_ES.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Visor de &memoria...
More Settings... = Más &opciones...
Nearest = &Cercano
Recent = &Reciente
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Saltar efectos del búfer (rápido)
Off = &No
Open Chat = Abrir ventana de chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/es_LA.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Visor de &memoria...
More Settings... = Más &opciones...
Nearest = &Cercano
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Saltar efectos por búfer (rápido)
Off = &No
Open Chat = Abrir ventana de chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/fa_IR.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = ‎...نمایش مموری
More Settings... = ‎...تنظیمات بیشتر
Nearest = ‎نزدیک ترین
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = ‎رد کردن اثرات بافر (سریع تر)
Off = ‎خاموش
Open Chat = باز کردن چت
Expand Down
1 change: 1 addition & 0 deletions assets/lang/fi_FI.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Memory &View...
More Settings... = &More Settings...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/fr_FR.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = &Visionneur de mémoire
More Settings... = &Plus de paramètres...
Nearest = Le plus &proche
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Pas d'effets en mémoire tampon (hack de vitesse)
Off = &Désactivé
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/gl_ES.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Visor de &memoria...
More Settings... = Máis &opcións...
Nearest = &Cercano
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Non
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/gr_EL.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Προβολή Μνήμης...
More Settings... = Περισσότερες Ρυθμίσεις...
Nearest = Κοντινότερο
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Παράκαμψη εφέ buffer (γρηγορότερο)
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/he_IL.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = הצג &זיכרון...
More Settings... = &More Settings...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/he_IL_invert.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Memory &View...
More Settings... = &More Settings...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/hr_HR.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Pregled &memorije...
More Settings... = &Više postavki...
Nearest = &Najbliže
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Preskoči bufferane efekte
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/hu_HU.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Memória &nézet…
More Settings... = &Egyéb beállítások…
Nearest = Leg&közelebbi
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = Bufferelt effektek kihagyá&sa (nem bufferelt, gyorsabb)
Off = &Ki
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/id_ID.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Tampilan memori...
More Settings... = Pengaturan lainnya...
Nearest = Terdekat
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = Lewati efek penyangga (tak-tersangga, lebih cepat)
Off = Mati
Open Chat = Buka opsi obrolan
Expand Down
1 change: 1 addition & 0 deletions assets/lang/it_IT.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Visualizzazione Memoria...
More Settings... = Altre Impostazioni...
Nearest = Pixel perfect
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = Salta effetti di buffer (niente buffer, più velocità)
Off = Disattiva
Open Chat = Apri Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ja_JP.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = メモリビュー(&V)...
More Settings... = 詳細設定(&M)...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = ノンバッファレンダリング (高速化)(&S)
Off = オフ(&O)
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/jv_ID.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Tampilan &Memory...
More Settings... = Setelan sing luwih ...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = Skip efek buffer (ora yakuwi,luwih cepet)
Off = &Mati
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ko_KR.ini
Expand Up @@ -232,6 +232,7 @@ Log Console = 콘솔 로그(&L)
Memory View... = 메모리 보기(&V)...
More Settings... = 기타 설정(&M)...
Nearest = 근접 필터링(&N)
Restart Graphics = Restart Graphics
Skip Buffer Effects = 버퍼 효과 건너뛰기(&S)
Off = 끔(&O)
Open Chat = 채팅 열기
Expand Down
1 change: 1 addition & 0 deletions assets/lang/lo_LA.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = &ມຸມມອງຄ່າຄວາມຈຳ...
More Settings... = &ການຕັ້ງຄ່າອື່ນໆ...
Nearest = &ພາບເປັນຮອຍຍັກໄດ້
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &ຂ້າມການໃຊ້ເອັບເຟັກບັບເຟີ້ (ບໍ່ມີບັບເຟີ້, ໄວຂຶ້ນ)
Off = &ປິດ
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/lt-LT.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Atminties &rodymas...
More Settings... = &Daugiau parametrų...
Nearest = &Arčiausias
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Išjungti
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ms_MY.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Lihat &Memori...
More Settings... = &Tetapan lanjutan...
Nearest = &Terdekat
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Tutup
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/nl_NL.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = &Geheugenweergave...
More Settings... = &Meer instellingen...
Nearest = &Naaste buur
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Buffereffecten nalaten (niet-gebufferd, sneller)
Off = &Uit
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/no_NO.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Memory &View...
More Settings... = &More Settings...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Off
Open Chat = Open Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/pl_PL.ini
Expand Up @@ -233,6 +233,7 @@ Memory View... = Podgląd pamięci...
More Settings... = Więcej ustawień...
Nearest = Najbliższe
Recent = &Ostatnie
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Nie renderuj efektów z bufora (niebuforowane, szybsze)
Off = Wyłącz
Open Chat = Otwórz Chat
Expand Down
1 change: 1 addition & 0 deletions assets/lang/pt_BR.ini
Expand Up @@ -256,6 +256,7 @@ Log Console = &Console dos registros
Memory View... = Visualização da &memória...
More Settings... = &Mais configurações...
Nearest = &Mais próximo
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Ignorar efeitos do buffer
Off = &Desligado
Open Chat = Abrir Bate-Papo
Expand Down
1 change: 1 addition & 0 deletions assets/lang/pt_PT.ini
Expand Up @@ -257,6 +257,7 @@ Memory View... = Visualização da &memória...
More Settings... = &Mais Definições...
Nearest = &Mais próximo
Recent = &Recente
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Ignorar efeitos de buffer (sem buffer, mais rápido)
Off = &Desativado
Open Chat = Abrir Bate-Papo
Expand Down
1 change: 1 addition & 0 deletions assets/lang/ro_RO.ini
Expand Up @@ -234,6 +234,7 @@ Memory View... = Memory &View...
More Settings... = &More Settings...
Nearest = &Nearest
Recent = &Recent
Restart Graphics = Restart Graphics
Skip Buffer Effects = &Skip buffer effects
Off = &Off
Open Chat = Open Chat
Expand Down

0 comments on commit 457681f

Please sign in to comment.