diff --git a/Readme_release.txt b/Readme_release.txt index 58382afa..8fb633b0 100644 --- a/Readme_release.txt +++ b/Readme_release.txt @@ -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. diff --git a/dll/settings.h b/dll/settings.h index 697fe38a..225d2685 100644 --- a/dll/settings.h +++ b/dll/settings.h @@ -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 depots; + //App Install paths void setAppInstallPath(AppId_t appID, std::string path); std::string getAppInstallPath(AppId_t appID); diff --git a/dll/settings_parser.cpp b/dll/settings_parser.cpp index 0ccb5f51..40c6df48 100644 --- a/dll/settings_parser.cpp +++ b/dll/settings_parser.cpp @@ -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 paths = Local_Storage::get_filenames_path(mod_path); diff --git a/dll/steam_apps.cpp b/dll/steam_apps.cpp index 9bd382ac..7f7dbd5d 100644 --- a/dll/steam_apps.cpp +++ b/dll/steam_apps.cpp @@ -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 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 diff --git a/files_example/steam_settings.EXAMPLE/depots.EXAMPLE.txt b/files_example/steam_settings.EXAMPLE/depots.EXAMPLE.txt new file mode 100644 index 00000000..d2629e89 --- /dev/null +++ b/files_example/steam_settings.EXAMPLE/depots.EXAMPLE.txt @@ -0,0 +1,6 @@ +228986 +228990 +814381 +814382 +814383 +1039230