Permalink
Browse files

Merge pull request #11357 from unknownbrackets/ui-minor

 UI: Automatically forget pinned deleted paths
  • Loading branch information...
hrydgard committed Sep 5, 2018
2 parents 562c5f6 + 2388be5 commit f42065ed3b5f05c4e38a85bfeb04fc586a0fe7f9
Showing with 18 additions and 11 deletions.
  1. +4 −1 Core/Config.cpp
  2. +8 −5 GPU/Software/Rasterizer.cpp
  3. +5 −4 UI/MainScreen.cpp
  4. +1 −1 ext/native/thin3d/VulkanRenderManager.h
View
@@ -1037,7 +1037,10 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
vPinnedPaths.clear();
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
vPinnedPaths.push_back(it->second);
// Unpin paths that are deleted automatically.
if (File::Exists(it->second)) {
vPinnedPaths.push_back(File::ResolvePath(it->second));
}
}
// This caps the exponent 4 (so 16x.)
@@ -1764,17 +1764,20 @@ bool GetCurrentTexture(GPUDebugBuffer &buffer, int level)
return false;
}
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
buffer.Allocate(w, h, GE_FORMAT_8888, false);
GETextureFormat texfmt = gstate.getTextureFormat();
u32 texaddr = gstate.getTextureAddress(level);
int texbufw = GetTextureBufw(level, texaddr, texfmt);
u8 *texptr = Memory::GetPointer(texaddr);
int w = gstate.getTextureWidth(level);
int h = gstate.getTextureHeight(level);
if (!texaddr || !Memory::IsValidRange(texaddr, (textureBitsPerPixel[texfmt] * texbufw * h) / 8))
return false;
buffer.Allocate(w, h, GE_FORMAT_8888, false);
Sampler::Funcs sampler = Sampler::GetFuncs();
u8 *texptr = Memory::GetPointer(texaddr);
u32 *row = (u32 *)buffer.GetData();
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
View
@@ -495,10 +495,11 @@ UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) {
UI::EventReturn GameBrowser::PinToggleClick(UI::EventParams &e) {
auto &pinnedPaths = g_Config.vPinnedPaths;
const std::string path = File::ResolvePath(path_.GetPath());
if (IsCurrentPathPinned()) {
pinnedPaths.erase(std::remove(pinnedPaths.begin(), pinnedPaths.end(), path_.GetPath()), pinnedPaths.end());
pinnedPaths.erase(std::remove(pinnedPaths.begin(), pinnedPaths.end(), path), pinnedPaths.end());
} else {
pinnedPaths.push_back(path_.GetPath());
pinnedPaths.push_back(path);
}
Refresh();
return UI::EVENT_DONE;
@@ -662,7 +663,7 @@ void GameBrowser::Refresh() {
bool GameBrowser::IsCurrentPathPinned() {
const auto paths = g_Config.vPinnedPaths;
return std::find(paths.begin(), paths.end(), path_.GetPath()) != paths.end();
return std::find(paths.begin(), paths.end(), File::ResolvePath(path_.GetPath())) != paths.end();
}
const std::vector<std::string> GameBrowser::GetPinnedPaths() {
@@ -672,7 +673,7 @@ const std::vector<std::string> GameBrowser::GetPinnedPaths() {
static const std::string sepChars = "/\\";
#endif
const std::string currentPath = path_.GetPath();
const std::string currentPath = File::ResolvePath(path_.GetPath());
const std::vector<std::string> paths = g_Config.vPinnedPaths;
std::vector<std::string> results;
for (size_t i = 0; i < paths.size(); ++i) {
@@ -176,7 +176,7 @@ class VulkanRenderManager {
data.draw.vbuffer = vbuffer;
data.draw.voffset = voffset;
data.draw.numUboOffsets = numUboOffsets;
assert(numUboOffsets <= ARRAY_SIZE(data.drawIndexed.uboOffsets));
assert(numUboOffsets <= ARRAY_SIZE(data.draw.uboOffsets));
for (int i = 0; i < numUboOffsets; i++)
data.draw.uboOffsets[i] = uboOffsets[i];
curRenderStep_->commands.push_back(data);

0 comments on commit f42065e

Please sign in to comment.