consistent debug log location, for games that change cwd multiple times while running

This commit is contained in:
otavepto 2023-12-19 22:32:29 +02:00
parent 0b49bd3338
commit ca043837d9
2 changed files with 10 additions and 2 deletions

View File

@ -96,6 +96,10 @@ bool set_env_variable(std::string name, std::string value)
std::recursive_mutex global_mutex; std::recursive_mutex global_mutex;
#ifndef EMU_RELEASE_BUILD
const std::string dbg_log_file = get_full_program_path() + "STEAM_LOG.txt";
#endif
SteamAPICall_t generate_steam_api_call_id() { SteamAPICall_t generate_steam_api_call_id() {
static SteamAPICall_t a; static SteamAPICall_t a;
randombytes((char *)&a, sizeof(a)); randombytes((char *)&a, sizeof(a));

View File

@ -64,7 +64,9 @@
#include <bcrypt.h> #include <bcrypt.h>
#ifndef EMU_RELEASE_BUILD #ifndef EMU_RELEASE_BUILD
#define PRINT_DEBUG(a, ...) do {FILE *t = fopen("STEAM_LOG.txt", "a"); fprintf(t, "%u " a, GetCurrentThreadId(), __VA_ARGS__); fclose(t); WSASetLastError(0);} while (0) #include <string>
extern const std::string dbg_log_file;
#define PRINT_DEBUG(a, ...) do {FILE *t = fopen(dbg_log_file.c_str(), "a"); fprintf(t, "%u " a, GetCurrentThreadId(), __VA_ARGS__); fclose(t); WSASetLastError(0);} while (0)
#endif #endif
EXTERN_C IMAGE_DOS_HEADER __ImageBase; EXTERN_C IMAGE_DOS_HEADER __ImageBase;
@ -127,7 +129,9 @@ inline void reset_LastError()
#define PATH_MAX_STRING_SIZE 512 #define PATH_MAX_STRING_SIZE 512
#ifndef EMU_RELEASE_BUILD #ifndef EMU_RELEASE_BUILD
#define PRINT_DEBUG(...) {FILE *t = fopen("STEAM_LOG.txt", "a"); fprintf(t, __VA_ARGS__); fclose(t);} #include <string>
extern const std::string dbg_log_file;
#define PRINT_DEBUG(...) {FILE *t = fopen(dbg_log_file.c_str(), "a"); fprintf(t, __VA_ARGS__); fclose(t);}
#endif #endif
#define PATH_SEPARATOR "/" #define PATH_SEPARATOR "/"