Add steam offline mode and change steam_appid.txt priority.
parent
5cf841c603
commit
5af7508e2f
|
@ -44,9 +44,12 @@ Mod folders must be a number corresponding to the file id of the mod.
|
|||
See the steam_settings.EXAMPLE folder for an example.
|
||||
|
||||
Steam appid:
|
||||
The steam_appid.txt can be put in the steam_settings folder if for some reason you can't put it beside the steam api dll.
|
||||
The best place to put your steam_appid.txt is in the steam_settings folder because this is where the emulator checks first.
|
||||
If there is no steam_appid.txt in the steam_settings folder it will try opening it from the run path of the game. If one isn't there it will try to load it from beside my steam api dll.
|
||||
The steam appid can also be set using the SteamAppId or SteamGameId env variables (this is how real steam tells games what their appid is).
|
||||
|
||||
Offline mode:
|
||||
Some games that connect to online servers might only work if the steam emu behaves like steam is in offline mode. If you need this create a offline.txt file in the steam_settings folder.
|
||||
|
||||
Support for CPY steam_api(64).dll cracks: See the build in the experimental folder.
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ std::string Settings::sanitize(std::string name)
|
|||
return name;
|
||||
}
|
||||
|
||||
Settings::Settings(CSteamID steam_id, CGameID game_id, std::string name, std::string language)
|
||||
Settings::Settings(CSteamID steam_id, CGameID game_id, std::string name, std::string language, bool offline)
|
||||
{
|
||||
this->steam_id = steam_id;
|
||||
this->game_id = game_id;
|
||||
|
@ -52,6 +52,8 @@ Settings::Settings(CSteamID steam_id, CGameID game_id, std::string name, std::st
|
|||
this->language = lang;
|
||||
this->lobby_id = k_steamIDNil;
|
||||
this->unlockAllDLCs = true;
|
||||
|
||||
this->offline = offline;
|
||||
}
|
||||
|
||||
CSteamID Settings::get_local_steam_id()
|
||||
|
|
|
@ -40,6 +40,7 @@ class Settings {
|
|||
CSteamID lobby_id;
|
||||
|
||||
bool unlockAllDLCs;
|
||||
bool offline;
|
||||
std::vector<struct DLC_entry> DLCs;
|
||||
std::vector<struct Mod_entry> mods;
|
||||
public:
|
||||
|
@ -49,7 +50,7 @@ public:
|
|||
static const bool is_lobby_connect = false;
|
||||
#endif
|
||||
static std::string sanitize(std::string name);
|
||||
Settings(CSteamID steam_id, CGameID game_id, std::string name, std::string language);
|
||||
Settings(CSteamID steam_id, CGameID game_id, std::string name, std::string language, bool offline);
|
||||
CSteamID get_local_steam_id();
|
||||
CGameID get_local_game_id();
|
||||
const char *get_local_name();
|
||||
|
@ -57,6 +58,7 @@ public:
|
|||
void set_game_id(CGameID game_id);
|
||||
void set_lobby(CSteamID lobby_id);
|
||||
CSteamID get_lobby();
|
||||
bool is_offline() {return offline; }
|
||||
|
||||
//DLC stuff
|
||||
void unlockAllDLC(bool value);
|
||||
|
|
|
@ -46,7 +46,7 @@ Steam_Client::Steam_Client()
|
|||
|
||||
char array[10] = {};
|
||||
array[0] = '0';
|
||||
Local_Storage::get_file_data(program_path + "steam_appid.txt", array, sizeof(array) - 1);
|
||||
Local_Storage::get_file_data(Local_Storage::get_game_settings_path() + "steam_appid.txt", array, sizeof(array) - 1);
|
||||
uint32 appid = 0;
|
||||
try {
|
||||
appid = std::stoi(array);
|
||||
|
@ -61,7 +61,7 @@ Steam_Client::Steam_Client()
|
|||
if (!appid) {
|
||||
memset(array, 0, sizeof(array));
|
||||
array[0] = '0';
|
||||
Local_Storage::get_file_data(Local_Storage::get_game_settings_path() + "steam_appid.txt", array, sizeof(array) - 1);
|
||||
Local_Storage::get_file_data(program_path + "steam_appid.txt", array, sizeof(array) - 1);
|
||||
try {
|
||||
appid = std::stoi(array);
|
||||
} catch (...) {}
|
||||
|
@ -169,8 +169,21 @@ Steam_Client::Steam_Client()
|
|||
local_storage->store_data_settings("user_steam_id.txt", temp_text, strlen(temp_text));
|
||||
}
|
||||
|
||||
settings_client = new Settings(user_id, CGameID(appid), name, language);
|
||||
settings_server = new Settings(generate_steam_id_server(), CGameID(appid), name, language);
|
||||
bool steam_offline_mode = false;
|
||||
{
|
||||
std::string steam_settings_path = Local_Storage::get_game_settings_path();
|
||||
|
||||
std::vector<std::string> paths = Local_Storage::get_filenames_path(steam_settings_path);
|
||||
for (auto & p: paths) {
|
||||
PRINT_DEBUG("steam settings path %s\n", p.c_str());
|
||||
if (p == "offline.txt") {
|
||||
steam_offline_mode = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
settings_client = new Settings(user_id, CGameID(appid), name, language, steam_offline_mode);
|
||||
settings_server = new Settings(generate_steam_id_server(), CGameID(appid), name, language, steam_offline_mode);
|
||||
|
||||
{
|
||||
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt";
|
||||
|
|
|
@ -74,7 +74,7 @@ HSteamUser GetHSteamUser()
|
|||
bool BLoggedOn()
|
||||
{
|
||||
PRINT_DEBUG("BLoggedOn\n");
|
||||
return true;
|
||||
return !settings->is_offline();
|
||||
}
|
||||
|
||||
// returns the CSteamID of the account currently logged into the Steam client
|
||||
|
|
Loading…
Reference in New Issue