Add a depots.txt to configure values returned by the getinstalleddepots function.

This commit is contained in:
Mr_Goldberg 2020-01-31 14:31:29 -05:00
parent b1206b0fa2
commit 9deef8c6f3
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
5 changed files with 40 additions and 23 deletions

View File

@ -41,6 +41,10 @@ If the DLC file is present, the emulator will only unlock the DLCs in that file.
The contents of this file are: appid=DLC name
See the steam_settings.EXAMPLE folder for an example.
Depots:
This is pretty rare but some games might use depot ids to see if dlcs are installed. You can provide a list of installed depots to the game with a steam_settings\depots.txt file.
See the steam_settings.EXAMPLE folder for an example.
App paths:
Some rare games might need to be provided one or more paths to app ids. For example the path to where a dlc is installed. This sets the paths returned by the Steam_Apps::GetAppInstallDir function.
See steam_settings.EXAMPLE\app_paths.EXAMPLE.txt for an example.

View File

@ -106,6 +106,9 @@ public:
bool hasDLC(AppId_t appID);
bool getDLC(unsigned int index, AppId_t &appID, bool &available, std::string &name);
//Depots
std::vector<DepotId_t> depots;
//App Install paths
void setAppInstallPath(AppId_t appID, std::string path);
std::string getAppInstallPath(AppId_t appID);

View File

@ -458,6 +458,27 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
}
}
{
std::string depots_config_path = Local_Storage::get_game_settings_path() + "depots.txt";
std::ifstream input( depots_config_path );
if (input.is_open()) {
for( std::string line; getline( input, line ); ) {
if (!line.empty() && line[line.length()-1] == '\n') {
line.pop_back();
}
if (!line.empty() && line[line.length()-1] == '\r') {
line.pop_back();
}
DepotId_t depot_id = stoul(line);
settings_client->depots.push_back(depot_id);
settings_server->depots.push_back(depot_id);
PRINT_DEBUG("Added depot %u\n", depot_id);
}
}
}
{
std::string mod_path = Local_Storage::get_game_settings_path() + "mods";
std::vector<std::string> paths = Local_Storage::get_filenames_path(mod_path);

View File

@ -181,33 +181,16 @@ bool Steam_Apps::MarkContentCorrupt( bool bMissingFilesOnly )
// return installed depots in mount order
uint32 Steam_Apps::GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots )
{
PRINT_DEBUG("GetInstalledDepots %u\n", appID);
PRINT_DEBUG("GetInstalledDepots %u, %u\n", appID, cMaxDepots);
//TODO not sure about the behavior of this function, I didn't actually test this.
if (!pvecDepots) return 0;
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (appID == settings->get_local_game_id().AppID()) {
unsigned int count = settings->DLCCount();
unsigned int count = settings->depots.size();
if (cMaxDepots < count) count = cMaxDepots;
for (int i = 0; i < count; ++i) {
AppId_t appid;
bool available;
std::string name;
if (settings->getDLC(i, appid, available, name)) {
pvecDepots[i] = appid;
}
}
std::copy(settings->depots.begin(), settings->depots.begin() + count, pvecDepots);
return count;
} else {
if (cMaxDepots) {
*pvecDepots = appID;
return 1;
}
}
return 0;
}
// returns current app install folder for AppID, returns folder name length

View File

@ -0,0 +1,6 @@
228986
228990
814381
814382
814383
1039230