From a920b6100c18d8dec9b5d483612d3b2fc8482535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 8 Jul 2023 10:44:49 +0200 Subject: [PATCH 1/2] Improve logging about corrupt ISOs --- Core/FileSystems/ISOFileSystem.cpp | 12 ++++++++++-- Core/FileSystems/ISOFileSystem.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index 6d8d830cee..421ff0f30d 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -177,6 +177,14 @@ ISOFileSystem::~ISOFileSystem() { delete treeroot; } +std::string ISOFileSystem::TreeEntry::BuildPath() { + if (parent) { + return parent->BuildPath() + "/" + name; + } else { + return name; + } +} + void ISOFileSystem::ReadDirectory(TreeEntry *root) { for (u32 secnum = root->startsector, endsector = root->startsector + (root->dirsize + 2047) / 2048; secnum < endsector; ++secnum) { u8 theSector[2048]; @@ -228,12 +236,12 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) { entry->startsector = dir.firstDataSector; entry->dirsize = dir.dataLength; entry->valid = isFile; // Can pre-mark as valid if file, as we don't recurse into those. - VERBOSE_LOG(FILESYS, "%s: %s %08x %08x %i", entry->isDirectory ? "D" : "F", entry->name.c_str(), (u32)dir.firstDataSector, entry->startingPosition, entry->startingPosition); + VERBOSE_LOG(FILESYS, "%s: %s %08x %08x %d", entry->isDirectory ? "D" : "F", entry->name.c_str(), (u32)dir.firstDataSector, entry->startingPosition, entry->startingPosition); // Round down to avoid any false reports. if (isFile && dir.firstDataSector + (dir.dataLength / 2048) > blockDevice->GetNumBlocks()) { blockDevice->NotifyReadError(); - ERROR_LOG(FILESYS, "File '%s' starts or ends outside ISO", entry->name.c_str()); + ERROR_LOG(FILESYS, "File '%s' starts or ends outside ISO. firstDataSector: %d len: %d", entry->BuildPath().c_str(), dir.firstDataSector, dir.dataLength); } if (entry->isDirectory && !relative) { diff --git a/Core/FileSystems/ISOFileSystem.h b/Core/FileSystems/ISOFileSystem.h index c7813bf1ac..613bfcf15d 100644 --- a/Core/FileSystems/ISOFileSystem.h +++ b/Core/FileSystems/ISOFileSystem.h @@ -60,6 +60,9 @@ private: struct TreeEntry { ~TreeEntry(); + // Recursive function that reconstructs the path by looking at the parent pointers. + std::string BuildPath(); + std::string name; u32 flags = 0; u32 startingPosition = 0; From ce802664ea110b8c4315d1b1c439bf35b4a94ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 8 Jul 2023 10:45:22 +0200 Subject: [PATCH 2/2] Minor SettingInfo cleanup --- Common/System/System.h | 3 +++ UI/MiscScreens.cpp | 6 +++--- UI/MiscScreens.h | 5 +---- UI/TabbedDialogScreen.cpp | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Common/System/System.h b/Common/System/System.h index e3233cc8f7..14001fefa7 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -219,7 +219,10 @@ void System_PostUIMessage(const std::string &message, const std::string ¶m); // no need to implement separately. void System_AudioGetDebugStats(char *buf, size_t bufSize); void System_AudioClear(); + // These samples really have 16 bits of value, but can be a little out of range. +// This is for pushing rate-controlled 44khz audio from emulation. +// If you push a little too fast, we'll pitch up to a limit, for example. void System_AudioPushSamples(const int32_t *audio, int numSamples); inline void System_AudioResetStatCounters() { diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 226c4c13a9..5046c09ce1 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -1064,8 +1064,8 @@ void CreditsScreen::render() { dc.Flush(); } -SettingInfoMessage::SettingInfoMessage(int align, UI::AnchorLayoutParams *lp) - : UI::LinearLayout(UI::ORIENT_HORIZONTAL, lp) { +SettingInfoMessage::SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp) + : UI::LinearLayout(UI::ORIENT_HORIZONTAL, lp), cutOffY_(cutOffY) { using namespace UI; SetSpacing(0.0f); Add(new UI::Spacer(10.0f)); @@ -1077,7 +1077,7 @@ void SettingInfoMessage::Show(const std::string &text, const UI::View *refView) if (refView) { Bounds b = refView->GetBounds(); const UI::AnchorLayoutParams *lp = GetLayoutParams()->As(); - if (b.y >= cutOffY_) { + if (cutOffY_ != -1.0f && b.y >= cutOffY_) { ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, 80.0f, lp->right, lp->bottom, lp->center)); } else { ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, g_display.dp_yres - 80.0f - 40.0f, lp->right, lp->bottom, lp->center)); diff --git a/UI/MiscScreens.h b/UI/MiscScreens.h index 55b7484946..d99f1c6be8 100644 --- a/UI/MiscScreens.h +++ b/UI/MiscScreens.h @@ -178,11 +178,8 @@ private: class SettingInfoMessage : public UI::LinearLayout { public: - SettingInfoMessage(int align, UI::AnchorLayoutParams *lp); + SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp); - void SetBottomCutoff(float y) { - cutOffY_ = y; - } void Show(const std::string &text, const UI::View *refView = nullptr); void Draw(UIContext &dc) override; diff --git a/UI/TabbedDialogScreen.cpp b/UI/TabbedDialogScreen.cpp index 237f06e561..96a0a6b5bd 100644 --- a/UI/TabbedDialogScreen.cpp +++ b/UI/TabbedDialogScreen.cpp @@ -64,10 +64,9 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() { if (!vertical) { leftSide += 200.0f; } - settingInfo_ = new SettingInfoMessage(ALIGN_CENTER | FLAG_WRAP_TEXT, new AnchorLayoutParams( + settingInfo_ = new SettingInfoMessage(ALIGN_CENTER | FLAG_WRAP_TEXT, g_display.dp_yres - 200.0f, new AnchorLayoutParams( g_display.dp_xres - leftSide - 40.0f, WRAP_CONTENT, leftSide, g_display.dp_yres - 80.0f - 40.0f, NONE, NONE)); - settingInfo_->SetBottomCutoff(g_display.dp_yres - 200.0f); root_->Add(settingInfo_); // Show it again if we recreated the view