1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00

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 The contents of this file are: appid=DLC name
See the steam_settings.EXAMPLE folder for an example. 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: 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. 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. See steam_settings.EXAMPLE\app_paths.EXAMPLE.txt for an example.

View file

@ -106,6 +106,9 @@ public:
bool hasDLC(AppId_t appID); bool hasDLC(AppId_t appID);
bool getDLC(unsigned int index, AppId_t &appID, bool &available, std::string &name); bool getDLC(unsigned int index, AppId_t &appID, bool &available, std::string &name);
//Depots
std::vector<DepotId_t> depots;
//App Install paths //App Install paths
void setAppInstallPath(AppId_t appID, std::string path); void setAppInstallPath(AppId_t appID, std::string path);
std::string getAppInstallPath(AppId_t appID); 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::string mod_path = Local_Storage::get_game_settings_path() + "mods";
std::vector<std::string> paths = Local_Storage::get_filenames_path(mod_path); 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 // return installed depots in mount order
uint32 Steam_Apps::GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uint32 cMaxDepots ) 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. //TODO not sure about the behavior of this function, I didn't actually test this.
if (!pvecDepots) return 0; if (!pvecDepots) return 0;
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
unsigned int count = settings->depots.size();
if (cMaxDepots < count) count = cMaxDepots;
std::copy(settings->depots.begin(), settings->depots.begin() + count, pvecDepots);
return count;
}
if (appID == settings->get_local_game_id().AppID()) {
unsigned int count = settings->DLCCount();
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;
}
}
return count;
} else {
if (cMaxDepots) {
*pvecDepots = appID;
return 1;
}
}
return 0;
} }
// returns current app install folder for AppID, returns folder name length // returns current app install folder for AppID, returns folder name length

View file

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