From 1427a4bcef1fc92f1a8aecb54aeae9577bce8498 Mon Sep 17 00:00:00 2001 From: Mr_Goldberg Date: Sat, 5 Oct 2019 15:40:29 -0400 Subject: [PATCH] More accurate steam remote storage behavior. --- dll/steam_remote_storage.h | 12 +++++------- .../disable_networking.EXAMPLE.txt | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 files_example/steam_settings.EXAMPLE/disable_networking.EXAMPLE.txt diff --git a/dll/steam_remote_storage.h b/dll/steam_remote_storage.h index bc41d6e..f6a0c51 100644 --- a/dll/steam_remote_storage.h +++ b/dll/steam_remote_storage.h @@ -83,12 +83,11 @@ Steam_Remote_Storage(class Settings *settings, Local_Storage *local_storage, cla bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) { PRINT_DEBUG("Steam_Remote_Storage::FileWrite %s %u\n", pchFile, cubData); - std::lock_guard lock(global_mutex); - - if (!pvData || cubData < 0 || cubData > k_unMaxCloudFileChunkSize) { + if (!pchFile || cubData <= 0 || cubData > k_unMaxCloudFileChunkSize) { return false; } + std::lock_guard lock(global_mutex); int data_stored = local_storage->store_data(REMOTE_STORAGE_FOLDER, pchFile, (char* )pvData, cubData); PRINT_DEBUG("Steam_Remote_Storage::Stored %i, %u\n", data_stored, data_stored == cubData); return data_stored == cubData; @@ -108,18 +107,17 @@ STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t ) SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) { PRINT_DEBUG("Steam_Remote_Storage::FileWriteAsync\n"); - std::lock_guard lock(global_mutex); - - if (!pvData || cubData > k_unMaxCloudFileChunkSize) { + if (!pchFile || cubData > k_unMaxCloudFileChunkSize || cubData == 0) { return k_uAPICallInvalid; } + std::lock_guard lock(global_mutex); bool success = local_storage->store_data(REMOTE_STORAGE_FOLDER, pchFile, (char* )pvData, cubData) == cubData; RemoteStorageFileWriteAsyncComplete_t data; data.m_eResult = success ? k_EResultOK : k_EResultFail; - return callback_results->addCallResult(data.k_iCallback, &data, sizeof(data), 0.1); + return callback_results->addCallResult(data.k_iCallback, &data, sizeof(data), 0.01); } diff --git a/files_example/steam_settings.EXAMPLE/disable_networking.EXAMPLE.txt b/files_example/steam_settings.EXAMPLE/disable_networking.EXAMPLE.txt new file mode 100644 index 0000000..4cc106f --- /dev/null +++ b/files_example/steam_settings.EXAMPLE/disable_networking.EXAMPLE.txt @@ -0,0 +1 @@ +Rename this to: disable_networking.txt to disable all networking functionality. \ No newline at end of file