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:
parent
b1206b0fa2
commit
9deef8c6f3
5 changed files with 40 additions and 23 deletions
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
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
|
||||
|
|
6
files_example/steam_settings.EXAMPLE/depots.EXAMPLE.txt
Normal file
6
files_example/steam_settings.EXAMPLE/depots.EXAMPLE.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
228986
|
||||
228990
|
||||
814381
|
||||
814382
|
||||
814383
|
||||
1039230
|
Loading…
Reference in a new issue