Soo... I am kinda new with writing C++ code and stuff. But I wanted it to give it a try anyway.
A while ago I mentioned this feature request: https://forums.dolphin-emu.org/Thread-fe...iple-games.
As proof of concept, I managed to draft up the following code. It is probably horrible. I kinda managed to adjust the GetTextureDirectory method within the HiresTextures.cpp code file.
The idea is that you can place a .txt file naming it with a Game ID of the game you want to load. The text file should contain a single line of text containing the Game ID the loaded game should refer to for loading the texture pack. That's basically it. The goal is to get rid of symbolic links... I hope?
I would love that take this further on GitHub, Pull Requests and such for example. Except... I don't have any idea how to idea how to do that. So I leave it in this thread for now.
UPDATED
A while ago I mentioned this feature request: https://forums.dolphin-emu.org/Thread-fe...iple-games.
As proof of concept, I managed to draft up the following code. It is probably horrible. I kinda managed to adjust the GetTextureDirectory method within the HiresTextures.cpp code file.
The idea is that you can place a .txt file naming it with a Game ID of the game you want to load. The text file should contain a single line of text containing the Game ID the loaded game should refer to for loading the texture pack. That's basically it. The goal is to get rid of symbolic links... I hope?
I would love that take this further on GitHub, Pull Requests and such for example. Except... I don't have any idea how to idea how to do that. So I leave it in this thread for now.
UPDATED
Code:
std::string HiresTexture::GetTextureDirectory(const std::string& game_id)
{
const std::string texture_directory = File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id;
// If there's no directory with the region-specific ID, look for a 3-character region-free one
if (!File::Exists(texture_directory))
{
// First try looking if a text file exists with either the region-specific ID or 3-character
// region-free ID and check if it contains a referral to texture pack directory
if (File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id + ".txt") ||
File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id.substr(0, 3) + ".txt"))
{
std::string texture_text_file = File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id + ".txt";
if (File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id.substr(0, 3) + ".txt"))
texture_text_file = File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id.substr(0, 3) + ".txt";
std::string refer_game_id;
std::ifstream stream;
File::OpenFStream(stream, texture_text_file, std::ios_base::out);
if (stream.good())
std::getline(stream, refer_game_id);
const std::string refer_texture_directory = File::GetUserPath(D_HIRESTEXTURES_IDX) + refer_game_id;
if (!File::Exists(refer_texture_directory))
return File::GetUserPath(D_HIRESTEXTURES_IDX) + refer_game_id.substr(0, 3);
return refer_texture_directory;
}
return File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id.substr(0, 3);
}
return texture_directory;
}