Merge pull request #17700 from hrydgard/improve-bad-iso-logging

Improve some logging related to bad ISO detection
This commit is contained in:
Henrik Rydgård 2023-07-12 10:53:41 +02:00 committed by GitHub
commit 5333091fa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 11 deletions

View file

@ -219,7 +219,10 @@ void System_PostUIMessage(const std::string &message, const std::string &param);
// 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() {

View file

@ -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) {

View file

@ -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;

View file

@ -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<UI::AnchorLayoutParams>();
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));

View file

@ -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;

View file

@ -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