Merge pull request #14817 from hrydgard/savedata-screen-fixes

Savedata screen fixes
This commit is contained in:
Unknown W. Brackets authored and GitHub committed 2021-09-09 17:13:11 -07:00
commit e00a3eed13
3 files changed
+21 -8

No files matched your search

+13 -4
View File
@@ -185,13 +185,22 @@ public:
// Clamp to curWidth_/curHeight_. Apparently an issue.
if ((int)(rc.offset.x + rc.extent.width) > curWidth_) {
rc.extent.width = curWidth_ - rc.offset.x;
int newWidth = curWidth_ - rc.offset.x;
rc.extent.width = std::max(1, newWidth);
if (rc.offset.x >= curWidth_) {
// Fallback.
rc.offset.x = curWidth_ - rc.extent.width;
}
}
if ((int)(rc.offset.y + rc.extent.height) > curHeight_) {
rc.extent.height = curHeight_ - rc.offset.y;
int newHeight = curHeight_ - rc.offset.y;
rc.extent.height = std::max(1, newHeight);
if (rc.offset.y >= curHeight_) {
// Fallback.
rc.offset.y = curHeight_ - rc.extent.height;
}
}
_dbg_assert_((int)(rc.offset.x + rc.extent.width) <= curWidth_);
_dbg_assert_((int)(rc.offset.y + rc.extent.height) <= curHeight_);
curRenderArea_.Apply(rc);
VkRenderData data{ VKRRenderCommand::SCISSOR };
+1 -1
View File
@@ -83,7 +83,7 @@ void LoadPostShaderInfo(const std::vector<Path> &directories) {
std::vector<File::FileInfo> fileInfo;
VFSGetFileListing(directories[d].c_str(), &fileInfo, "ini:");
if (fileInfo.size() == 0) {
if (fileInfo.empty()) {
File::GetFilesInDir(directories[d], &fileInfo, "ini:");
}
+7 -3
View File
@@ -317,13 +317,13 @@ void SavedataButton::Draw(UIContext &dc) {
int availableWidth = bounds_.w - 150;
float sineWidth = std::max(0.0f, (tw - availableWidth)) / 2.0f;
float tx = 150;
float tx = 150.0f;
if (availableWidth < tw) {
float overageRatio = 1.5f * availableWidth * 1.0f / tw;
tx -= (1.0f + sin(time_now_d() * overageRatio)) * sineWidth;
Bounds tb = bounds_;
tb.x = bounds_.x + 150;
tb.w = bounds_.w - 150;
tb.x = bounds_.x + 150.0f;
tb.w = std::max(1.0f, bounds_.w - 150.0f);
dc.PushScissor(tb);
}
dc.DrawText(title_.c_str(), bounds_.x + tx, bounds_.y + 4, style.fgColor, ALIGN_TOPLEFT);
@@ -443,6 +443,8 @@ bool SavedataBrowser::BySize(const UI::View *v1, const UI::View *v2) {
if (GetTotalSize(b1) > GetTotalSize(b2))
return true;
else if (GetTotalSize(b1) < GetTotalSize(b2))
return false;
return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0;
}
@@ -469,6 +471,8 @@ bool SavedataBrowser::ByDate(const UI::View *v1, const UI::View *v2) {
if (GetDateSeconds(b1) > GetDateSeconds(b2))
return true;
if (GetDateSeconds(b1) < GetDateSeconds(b2))
return false;
return strcmp(b1->GamePath().c_str(), b2->GamePath().c_str()) < 0;
}