diff --git a/dll/local_storage.cpp b/dll/local_storage.cpp index 4f557c7b..e15da3dd 100644 --- a/dll/local_storage.cpp +++ b/dll/local_storage.cpp @@ -578,7 +578,7 @@ int Local_Storage::store_file_data(std::string folder, std::string file, const c myfile.open(std::filesystem::u8path(folder + file), std::ios::binary | std::ios::out); if (!myfile.is_open()) return -1; myfile.write(data, length); - int position = myfile.tellp(); + int position = static_cast(myfile.tellp()); myfile.close(); return position; } @@ -666,7 +666,8 @@ int Local_Storage::get_file_data(const std::string &full_path, char *data, unsig myfile.read (data, max_length); myfile.close(); reset_LastError(); - return myfile.gcount(); + + return static_cast(myfile.gcount()); } int Local_Storage::get_data(std::string folder, std::string file, char *data, unsigned int max_length, unsigned int offset) @@ -700,7 +701,7 @@ int Local_Storage::count_files(std::string folder) folder.append(PATH_SEPARATOR); } - return get_filenames_recursive(save_directory + appid + folder).size(); + return static_cast(get_filenames_recursive(save_directory + appid + folder).size()); } bool Local_Storage::file_exists(std::string folder, std::string file) diff --git a/dll/steam_matchmaking.cpp b/dll/steam_matchmaking.cpp index b3e3a50f..45060f97 100644 --- a/dll/steam_matchmaking.cpp +++ b/dll/steam_matchmaking.cpp @@ -1384,7 +1384,7 @@ void Steam_Matchmaking::RunCallbacks() PRINT_DEBUG("Lobby " "%" PRIu64 " use %u", l.room_id(), use); if (use) PUSH_BACK_IF_NOT_IN(filtered_lobbies, (uint64)l.room_id()); - if (filtered_lobbies.size() >= filter_max_results_copy) { + if (filtered_lobbies.size() >= static_cast(filter_max_results_copy)) { PRINT_DEBUG("returning lobby search results, count=%zu", filtered_lobbies.size()); searching = false; LobbyMatchList_t data{}; diff --git a/dll/steam_user_stats_achievements.cpp b/dll/steam_user_stats_achievements.cpp index 2a0a2c0d..512edb89 100644 --- a/dll/steam_user_stats_achievements.cpp +++ b/dll/steam_user_stats_achievements.cpp @@ -807,7 +807,7 @@ void Steam_User_Stats::load_achievements_icons() auto now1 = std::chrono::high_resolution_clock::now(); #endif - size_t idx = 0; + int idx = 0; for (; idx < settings->paginated_achievements_icons && last_loaded_ach_icon < defined_achievements.size(); ++idx, ++last_loaded_ach_icon) { @@ -819,7 +819,7 @@ void Steam_User_Stats::load_achievements_icons() #ifndef EMU_RELEASE_BUILD auto now2 = std::chrono::high_resolution_clock::now(); auto dd = (unsigned)std::chrono::duration_cast(now2 - now1).count(); - PRINT_DEBUG("attempted to load %zu achievements icons in %u ms", idx * 2, dd); + PRINT_DEBUG("attempted to load %d achievements icons in %u ms", idx * 2, dd); #endif } diff --git a/steamclient/steamclient.cpp b/steamclient/steamclient.cpp index 3f1b8bb4..a185c616 100644 --- a/steamclient/steamclient.cpp +++ b/steamclient/steamclient.cpp @@ -1,18 +1,21 @@ - -//#include "dll.h" #define WIN32_LEAN_AND_MEAN + +// #include "dll.h" #include "Windows.h" + #ifdef _WIN64 #define DLL_NAME "steam_api64.dll" #else #define DLL_NAME "steam_api.dll" #endif -extern "C" __declspec( dllexport ) void *CreateInterface( const char *pName, int *pReturnCode ) +extern "C" __declspec(dllexport) void *CreateInterface(const char *pName, int *pReturnCode) { - //PRINT_DEBUG("%s", pName); + // PRINT_DEBUG("%s", pName); + HMODULE steam_api = LoadLibraryA(DLL_NAME); - void *(__stdcall* create_interface)(const char*) = (void * (__stdcall *)(const char*))GetProcAddress(steam_api, "SteamInternal_CreateInterface"); + + void *(__stdcall * create_interface)(const char *) = reinterpret_cast(GetProcAddress(steam_api, "SteamInternal_CreateInterface")); return create_interface(pName); } diff --git a/third-party/build/win b/third-party/build/win index c8c5f528..6cf0418a 160000 --- a/third-party/build/win +++ b/third-party/build/win @@ -1 +1 @@ -Subproject commit c8c5f528a1a90e7ba786990aa5176a389aae0ec9 +Subproject commit 6cf0418a1973e43abc7a34bdf447e4305f4a235f diff --git a/tools/generate_interfaces/generate_interfaces.cpp b/tools/generate_interfaces/generate_interfaces.cpp index b06e676b..6c2ae723 100644 --- a/tools/generate_interfaces/generate_interfaces.cpp +++ b/tools/generate_interfaces/generate_interfaces.cpp @@ -1,16 +1,14 @@ #include #include #include -#include #include #include // these are defined in dll.cpp at the top like this: // static char old_xxx[128] = ... - const static std::vector interface_patterns = { R"(SteamClient\d+)", - + R"(SteamGameServerStats\d+)", R"(SteamGameServer\d+)", @@ -27,10 +25,10 @@ const static std::vector interface_patterns = { R"(STEAMSCREENSHOTS_INTERFACE_VERSION\d+)", R"(STEAMHTTP_INTERFACE_VERSION\d+)", R"(STEAMUNIFIEDMESSAGES_INTERFACE_VERSION\d+)", - - R"(STEAMCONTROLLER_INTERFACE_VERSION\d+)", + + R"(STEAMCONTROLLER_INTERFACE_VERSION)", R"(SteamController\d+)", - + R"(STEAMUGC_INTERFACE_VERSION\d+)", R"(STEAMAPPLIST_INTERFACE_VERSION\d+)", R"(STEAMMUSIC_INTERFACE_VERSION\d+)", @@ -47,56 +45,64 @@ unsigned int findinterface( const std::string &interface_patt) { std::regex interface_regex(interface_patt); - auto begin = std::sregex_iterator(file_contents.begin(), file_contents.end(), interface_regex); + + auto begin = std::sregex_iterator(file_contents.cbegin(), file_contents.cend(), interface_regex); auto end = std::sregex_iterator(); unsigned int matches = 0; - for (std::sregex_iterator i = begin; i != end; ++i) { - std::smatch match = *i; - std::string match_str = match.str(); - out_file << match_str << std::endl; + + for (std::sregex_iterator i = begin; i != end; ++i) + { + out_file << i->str() << std::endl; ++matches; } return matches; } -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { - if (argc < 2) { + if (argc < 2) + { std::cerr << "usage: " << argv[0] << " " << std::endl; return 1; } std::ifstream steam_api_file(std::filesystem::u8path(argv[1]), std::ios::binary); - if (!steam_api_file.is_open()) { - std::cerr << "Error opening file" << std::endl; + if (!steam_api_file) + { + std::cerr << "Error opening file: " << argv[1] << std::endl; return 1; } - std::string steam_api_contents( - (std::istreambuf_iterator(steam_api_file)), - std::istreambuf_iterator()); + std::string steam_api_contents((std::istreambuf_iterator(steam_api_file)), std::istreambuf_iterator()); + steam_api_file.close(); - if (steam_api_contents.size() == 0) { + if (steam_api_contents.empty()) + { std::cerr << "Error loading data" << std::endl; return 1; } - unsigned int total_matches = 0; - std::ofstream out_file(std::filesystem::u8path("steam_interfaces.txt")); - if (!out_file.is_open()) { + std::ofstream out_file("steam_interfaces.txt"); + if (!out_file) + { std::cerr << "Error opening output file" << std::endl; return 1; } - for (const auto &patt : interface_patterns) { + unsigned int total_matches = 0; + + for (const auto &patt : interface_patterns) + { total_matches += findinterface(out_file, steam_api_contents, patt); } + out_file.close(); - if (total_matches == 0) { + if (total_matches == 0) + { std::cerr << "No interfaces were found" << std::endl; return 1; }