mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-22 01:50:06 +00:00
GPU/HW: Fall back to replacements from first disc
So you only need one copy.
This commit is contained in:
parent
f6e8ebec99
commit
36d5708391
@ -1,7 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||||
|
|
||||||
#include "gpu_hw_texture_cache.h"
|
#include "gpu_hw_texture_cache.h"
|
||||||
|
#include "game_database.h"
|
||||||
#include "gpu_hw.h"
|
#include "gpu_hw.h"
|
||||||
#include "gpu_hw_shadergen.h"
|
#include "gpu_hw_shadergen.h"
|
||||||
#include "gpu_sw_rasterizer.h"
|
#include "gpu_sw_rasterizer.h"
|
||||||
@ -3457,17 +3458,35 @@ bool GPUTextureCache::EnsureGameDirectoryExists()
|
|||||||
|
|
||||||
std::string GPUTextureCache::GetTextureReplacementDirectory()
|
std::string GPUTextureCache::GetTextureReplacementDirectory()
|
||||||
{
|
{
|
||||||
|
const std::string& serial = GPUThread::GetGameSerial();
|
||||||
std::string dir =
|
std::string dir =
|
||||||
Path::Combine(EmuFolders::Textures,
|
Path::Combine(EmuFolders::Textures, SmallString::from_format("{}" FS_OSPATH_SEPARATOR_STR "replacements", serial));
|
||||||
SmallString::from_format("{}" FS_OSPATH_SEPARATOR_STR "replacements", GPUThread::GetGameSerial()));
|
|
||||||
if (!FileSystem::DirectoryExists(dir.c_str()))
|
if (!FileSystem::DirectoryExists(dir.c_str()))
|
||||||
{
|
{
|
||||||
// Check for the old directory structure without a replacements subdirectory.
|
// Check for the old directory structure without a replacements subdirectory.
|
||||||
std::string altdir = Path::Combine(EmuFolders::Textures, GPUThread::GetGameSerial());
|
std::string altdir = Path::Combine(EmuFolders::Textures, serial);
|
||||||
if (FileSystem::DirectoryExists(altdir.c_str()))
|
if (FileSystem::DirectoryExists(altdir.c_str()))
|
||||||
|
{
|
||||||
WARNING_LOG("Using deprecated texture replacement directory {}", altdir);
|
WARNING_LOG("Using deprecated texture replacement directory {}", altdir);
|
||||||
dir = std::move(altdir);
|
dir = std::move(altdir);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If this is a multi-disc game, try the first disc.
|
||||||
|
const GameDatabase::Entry* dbentry = GameDatabase::GetEntryForSerial(serial);
|
||||||
|
if (dbentry && !dbentry->disc_set_serials.empty() && serial != dbentry->disc_set_serials.front())
|
||||||
|
{
|
||||||
|
altdir =
|
||||||
|
Path::Combine(EmuFolders::Textures, SmallString::from_format("{}" FS_OSPATH_SEPARATOR_STR "replacements",
|
||||||
|
dbentry->disc_set_serials.front()));
|
||||||
|
if (FileSystem::DirectoryExists(altdir.c_str()))
|
||||||
|
{
|
||||||
|
WARNING_LOG("Using texture replacements from first disc {}", dbentry->disc_set_serials.front());
|
||||||
|
dir = std::move(altdir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user