New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiresTextures: Read textfile to refer to texture pack folder. #7556

Open
wants to merge 1 commit into
base: master
from

Conversation

4 participants
@DevRobDev

DevRobDev commented Nov 9, 2018

A while ago I mentioned this feature request: https://forums.dolphin-emu.org/Thread-feature-request-custom-textures-folder-for-multiple-games.

I am kinda new with writing C++. As proof of concept, I managed to draft up the following code. It is probably horrible. But I wanted to give it a try anyway.

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 hopefully get rid of symbolic links.

Testing:

  • NAR.txt containing PZLE01 to load texture folder PZLE01 - Works
  • NAR.txt containing PZLE01 to load texture folder PZL - Works
  • NAR.txt containing PZL to load texture folder PZLE01 - Doesn't work
  • NAR.txt containing PZL to load texture folder PZL - Works

The textfile can be either named with the first three characters or the complete Game ID. Shouldn't really matter. The textfile should be placed into Load/Textures.

Admentus

if (File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id.substr(0, 3) + ".txt"))
texture_textFile = File::GetUserPath(D_HIRESTEXTURES_IDX) + game_id.substr(0, 3) + ".txt";
std::ifstream texture_textFile_stream(texture_textFile);

This comment has been minimized.

@JosJuice

JosJuice Nov 9, 2018

Contributor

You need to use File::OpenFStream instead of passing a string to the constructor, otherwise this won't work if the user has non-ASCII characters in the path and is on Windows.

Also, to follow our coding style, replace textFile with text_file.

This comment has been minimized.

@DevRobDev

DevRobDev Nov 9, 2018

Sure. I think I might have missed some guidelines, being my first time. I try to address the issues.

This comment has been minimized.

@DevRobDev

DevRobDev Nov 9, 2018

I think it should be fixed now.

std::ifstream stream;
File::OpenFStream(stream, texture_text_file, std::ios_base::out);
if (stream.good())
getline(stream, refer_texture_directory);

This comment has been minimized.

@lioncash

lioncash Nov 9, 2018

Member

std::getline

File::OpenFStream(stream, texture_text_file, std::ios_base::out);
if (stream.good())
getline(stream, refer_texture_directory);
stream.close();

This comment has been minimized.

@lioncash

lioncash Nov 9, 2018

Member

You don't need to manually close the stream; this will happen automatically when it goes out of scope.

@Zexaron

This comment has been minimized.

Contributor

Zexaron commented Nov 10, 2018

Also squash the commits and use the message from the first one if those later commits contain fixes to the initial commit.

@DevRobDev DevRobDev force-pushed the DevRobDev:master branch from be91357 to afee585 Nov 10, 2018

@DevRobDev

This comment has been minimized.

DevRobDev commented Nov 10, 2018

Ok. I should have squashed the commits (basically fixes only) and addressed the previous comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment