Add achievements display to overlay and ability to change some settings.

test_ci
Mr_Goldberg 2022-08-05 02:09:43 -04:00
parent c17fb0c931
commit 5e880cd974
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
11 changed files with 411 additions and 36 deletions

View File

@ -4,11 +4,11 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /IImGui /Iglew\include /I%PROTOBUF_X86_DIRECTORY%\include\ /DGLEW_STATIC /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api.dll cl /Z7 /LD /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api.dll
cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient.dll cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient.dll
"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto "%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x64.bat call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /IImGui /Iglew\include /I%PROTOBUF_X64_DIRECTORY%\include\ /DGLEW_STATIC /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api64.dll cl /Z7 /LD /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steam_api64.dll
cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient64.dll cl /LD steamclient.cpp /EHsc /MP12 /link /OUT:steamclient64.dll

View File

@ -3,7 +3,7 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /IImGui /Iglew\include /I%PROTOBUF_X86_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steamclient.dll cl /LD /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD /DEMU_OVERLAY /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steamclient.dll
call build_env_x64.bat call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /IImGui /Iglew\include /I%PROTOBUF_X64_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DEMU_OVERLAY dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steamclient64.dll cl /LD /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_EXPERIMENTAL_BUILD /DEMU_OVERLAY /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /link /OUT:steamclient64.dll

View File

@ -6,11 +6,12 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /Iglew\include /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api.dll cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /I%PROTOBUF_X86_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP12 /Ox /link /OUT:release\experimental\steamclient.dll cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP4 /Ox /link /OUT:release\experimental\steamclient.dll
"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto "%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x64.bat call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DGLEW_STATIC /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /Iglew\include /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api64.dll cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DNDEBUG /IImGui /I%PROTOBUF_X64_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental\steam_api64.dll
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP12 /Ox /link /OUT:release\experimental\steamclient64.dll cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DNDEBUG steamclient.cpp /EHsc /MP4 /Ox /link /OUT:release\experimental\steamclient64.dll
copy Readme_experimental.txt release\experimental\Readme.txt copy Readme_experimental.txt release\experimental\Readme.txt

View File

@ -6,11 +6,11 @@ call build_set_protobuf_directories.bat
"%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto "%PROTOC_X86_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
call build_env_x86.bat call build_env_x86.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DGLEW_STATIC /IImGui /Iglew\include /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X86_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient.dll cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /IImGui /DNDEBUG /I%PROTOBUF_X86_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X86_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient.dll
"%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto "%PROTOC_X64_EXE%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto
cl steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient_loader.exe cl steamclient_loader/*.cpp advapi32.lib user32.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient_loader.exe
copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\ copy steamclient_loader\ColdClientLoader.ini release\experimental_steamclient\
call build_env_x64.bat call build_env_x64.bat
cl dll/rtlgenrandom.c dll/rtlgenrandom.def cl dll/rtlgenrandom.c dll/rtlgenrandom.def
cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /DGLEW_STATIC /IImGui /Iglew\include /DNDEBUG /I%PROTOBUF_X64_DIRECTORY%\include\ dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/impls/*.cpp ImGui/impls/windows/*.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp "%PROTOBUF_X64_LIBRARY%" glew\glew.c opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient64.dll cl /LD /DEMU_RELEASE_BUILD /DEMU_EXPERIMENTAL_BUILD /DSTEAMCLIENT_DLL /DCONTROLLER_SUPPORT /DEMU_OVERLAY /IImGui /DNDEBUG /I%PROTOBUF_X64_DIRECTORY%\include\ /Ioverlay_experimental dll/*.cpp dll/*.cc detours/*.cpp controller/gamepad.c ImGui/*.cpp ImGui/backends/imgui_impl_dx*.cpp ImGui/backends/imgui_impl_win32.cpp ImGui/backends/imgui_impl_vulkan.cpp ImGui/backends/imgui_impl_opengl3.cpp ImGui/backends/imgui_win_shader_blobs.cpp overlay_experimental/*.cpp overlay_experimental/windows/*.cpp overlay_experimental/System/*.cpp "%PROTOBUF_X64_LIBRARY%" opengl32.lib Iphlpapi.lib Ws2_32.lib rtlgenrandom.lib Shell32.lib Winmm.lib /EHsc /MP12 /Ox /link /debug:none /OUT:release\experimental_steamclient\steamclient64.dll
copy Readme_experimental_steamclient.txt release\experimental_steamclient\Readme.txt copy Readme_experimental_steamclient.txt release\experimental_steamclient\Readme.txt

View File

@ -76,6 +76,16 @@ const char *Settings::get_language()
return language.c_str(); return language.c_str();
} }
void Settings::set_local_name(char *name)
{
this->name = name;
}
void Settings::set_language(char *language)
{
this->language = language;
}
void Settings::set_game_id(CGameID game_id) void Settings::set_game_id(CGameID game_id)
{ {
this->game_id = game_id; this->game_id = game_id;

View File

@ -92,7 +92,10 @@ public:
CSteamID get_local_steam_id(); CSteamID get_local_steam_id();
CGameID get_local_game_id(); CGameID get_local_game_id();
const char *get_local_name(); const char *get_local_name();
void set_local_name(char *name);
const char *get_language(); const char *get_language();
void set_language(char *language);
void set_game_id(CGameID game_id); void set_game_id(CGameID game_id);
void set_lobby(CSteamID lobby_id); void set_lobby(CSteamID lobby_id);
CSteamID get_lobby(); CSteamID get_lobby();
@ -155,6 +158,12 @@ public:
//make lobby creation fail in the matchmaking interface //make lobby creation fail in the matchmaking interface
bool disable_lobby_creation = false; bool disable_lobby_creation = false;
//warn people who use force_ settings
bool warn_forced = false;
//warn people who use local save
bool warn_local_save = false;
}; };
#endif #endif

View File

@ -180,10 +180,13 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
} }
} }
bool local_save = false;
{ {
char array[33] = {}; char array[33] = {};
if (Local_Storage::get_file_data(program_path + "local_save.txt", array, sizeof(array) - 1) != -1) { if (Local_Storage::get_file_data(program_path + "local_save.txt", array, sizeof(array) - 1) != -1) {
save_path = program_path + Settings::sanitize(array); save_path = program_path + Settings::sanitize(array);
local_save = true;
} }
} }
@ -263,6 +266,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
bool disable_lobby_creation = false; bool disable_lobby_creation = false;
int build_id = 10; int build_id = 10;
bool warn_forced = false;
{ {
std::string steam_settings_path = Local_Storage::get_game_settings_path(); std::string steam_settings_path = Local_Storage::get_game_settings_path();
@ -279,22 +284,32 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
disable_lobby_creation = true; disable_lobby_creation = true;
} else if (p == "force_language.txt") { } else if (p == "force_language.txt") {
int len = Local_Storage::get_file_data(steam_settings_path + "force_language.txt", language, sizeof(language) - 1); int len = Local_Storage::get_file_data(steam_settings_path + "force_language.txt", language, sizeof(language) - 1);
if (len > 0) language[len] = 0; if (len > 0) {
language[len] = 0;
warn_forced = true;
}
} else if (p == "force_steamid.txt") { } else if (p == "force_steamid.txt") {
char steam_id_text[32] = {}; char steam_id_text[32] = {};
if (Local_Storage::get_file_data(steam_settings_path + "force_steamid.txt", steam_id_text, sizeof(steam_id_text) - 1) > 0) { if (Local_Storage::get_file_data(steam_settings_path + "force_steamid.txt", steam_id_text, sizeof(steam_id_text) - 1) > 0) {
CSteamID temp_id = CSteamID((uint64)std::atoll(steam_id_text)); CSteamID temp_id = CSteamID((uint64)std::atoll(steam_id_text));
if (temp_id.IsValid()) { if (temp_id.IsValid()) {
user_id = temp_id; user_id = temp_id;
warn_forced = true;
} }
} }
} else if (p == "force_account_name.txt") { } else if (p == "force_account_name.txt") {
int len = Local_Storage::get_file_data(steam_settings_path + "force_account_name.txt", name, sizeof(name) - 1); int len = Local_Storage::get_file_data(steam_settings_path + "force_account_name.txt", name, sizeof(name) - 1);
if (len > 0) name[len] = 0; if (len > 0) {
name[len] = 0;
warn_forced = true;
}
} else if (p == "force_listen_port.txt") { } else if (p == "force_listen_port.txt") {
char array_port[10] = {}; char array_port[10] = {};
int len = Local_Storage::get_file_data(steam_settings_path + "force_listen_port.txt", array_port, sizeof(array_port) - 1); int len = Local_Storage::get_file_data(steam_settings_path + "force_listen_port.txt", array_port, sizeof(array_port) - 1);
if (len > 0) port = std::stoi(array_port); if (len > 0) {
port = std::stoi(array_port);
warn_forced = true;
}
} else if (p == "build_id.txt") { } else if (p == "build_id.txt") {
char array_id[10] = {}; char array_id[10] = {};
int len = Local_Storage::get_file_data(steam_settings_path + "build_id.txt", array_id, sizeof(array_id) - 1); int len = Local_Storage::get_file_data(steam_settings_path + "build_id.txt", array_id, sizeof(array_id) - 1);
@ -317,6 +332,10 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
settings_server->disable_lobby_creation = disable_lobby_creation; settings_server->disable_lobby_creation = disable_lobby_creation;
settings_client->build_id = build_id; settings_client->build_id = build_id;
settings_server->build_id = build_id; settings_server->build_id = build_id;
settings_client->warn_forced = warn_forced;
settings_server->warn_forced = warn_forced;
settings_client->warn_local_save = local_save;
settings_server->warn_local_save = local_save;
{ {
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt"; std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt";
@ -571,3 +590,9 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
return appid; return appid;
} }
void save_global_settings(Local_Storage *local_storage, char *name, char *language)
{
local_storage->store_data_settings("account_name.txt", name, strlen(name));
local_storage->store_data_settings("language.txt", language, strlen(language));
}

View File

@ -22,6 +22,6 @@
//returns appid //returns appid
uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out); uint32 create_localstorage_settings(Settings **settings_client_out, Settings **settings_server_out, Local_Storage **local_storage_out);
void save_global_settings(Local_Storage *local_storage, char *name, char *language);
#endif #endif

View File

@ -133,6 +133,11 @@ static void steam_friends_run_every_runcb(void *object)
steam_friends->RunCallbacks(); steam_friends->RunCallbacks();
} }
void resend_friend_data()
{
modified = true;
}
Steam_Friends(Settings* settings, Networking* network, SteamCallResults* callback_results, SteamCallBacks* callbacks, RunEveryRunCB* run_every_runcb, Steam_Overlay* overlay): Steam_Friends(Settings* settings, Networking* network, SteamCallResults* callback_results, SteamCallBacks* callbacks, RunEveryRunCB* run_every_runcb, Steam_Overlay* overlay):
settings(settings), settings(settings),
network(network), network(network),
@ -550,7 +555,8 @@ void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID )
// full address with protocol type is required, e.g. http://www.steamgames.com/ // full address with protocol type is required, e.g. http://www.steamgames.com/
void ActivateGameOverlayToWebPage( const char *pchURL, EActivateGameOverlayToWebPageMode eMode = k_EActivateGameOverlayToWebPageMode_Default ) void ActivateGameOverlayToWebPage( const char *pchURL, EActivateGameOverlayToWebPageMode eMode = k_EActivateGameOverlayToWebPageMode_Default )
{ {
PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToWebPage\n"); PRINT_DEBUG("Steam_Friends::ActivateGameOverlayToWebPage %s %u\n", pchURL, eMode);
overlay->OpenOverlayWebpage(pchURL);
} }
void ActivateGameOverlayToWebPage( const char *pchURL ) void ActivateGameOverlayToWebPage( const char *pchURL )
@ -721,13 +727,13 @@ bool SetRichPresence( const char *pchKey, const char *pchValue )
auto prev_value = (*us.mutable_rich_presence()).find(pchKey); auto prev_value = (*us.mutable_rich_presence()).find(pchKey);
if (prev_value == (*us.mutable_rich_presence()).end() || prev_value->second != pchValue) { if (prev_value == (*us.mutable_rich_presence()).end() || prev_value->second != pchValue) {
(*us.mutable_rich_presence())[pchKey] = pchValue; (*us.mutable_rich_presence())[pchKey] = pchValue;
modified = true; resend_friend_data();
} }
} else { } else {
auto to_remove = us.mutable_rich_presence()->find(pchKey); auto to_remove = us.mutable_rich_presence()->find(pchKey);
if (to_remove != us.mutable_rich_presence()->end()) { if (to_remove != us.mutable_rich_presence()->end()) {
us.mutable_rich_presence()->erase(to_remove); us.mutable_rich_presence()->erase(to_remove);
modified = true; resend_friend_data();
} }
} }
@ -739,7 +745,7 @@ void ClearRichPresence()
PRINT_DEBUG("Steam_Friends::ClearRichPresence\n"); PRINT_DEBUG("Steam_Friends::ClearRichPresence\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex); std::lock_guard<std::recursive_mutex> lock(global_mutex);
us.mutable_rich_presence()->clear(); us.mutable_rich_presence()->clear();
modified = true; resend_friend_data();
} }
@ -1053,7 +1059,7 @@ void RunCallbacks()
PRINT_DEBUG("Steam_Friends::RunCallbacks\n"); PRINT_DEBUG("Steam_Friends::RunCallbacks\n");
if (settings->get_lobby() != lobby_id) { if (settings->get_lobby() != lobby_id) {
lobby_id = settings->get_lobby(); lobby_id = settings->get_lobby();
modified = true; resend_friend_data();
} }
if (modified) { if (modified) {

View File

@ -9,6 +9,7 @@
#include <imgui.h> #include <imgui.h>
#include "../dll/dll.h" #include "../dll/dll.h"
#include "../dll/settings_parser.h"
#include "Renderer_Detector.h" #include "Renderer_Detector.h"
@ -17,6 +18,40 @@ static constexpr int base_notif_window_id = 0 * max_window_id;
static constexpr int base_friend_window_id = 1 * max_window_id; static constexpr int base_friend_window_id = 1 * max_window_id;
static constexpr int base_friend_item_id = 2 * max_window_id; static constexpr int base_friend_item_id = 2 * max_window_id;
static constexpr char *valid_languages[] = {
"english",
"arabic",
"bulgarian",
"schinese",
"tchinese",
"czech",
"danish",
"dutch",
"finnish",
"french",
"german",
"greek",
"hungarian",
"italian",
"japanese",
"koreana",
"norwegian",
"polish",
"portuguese",
"brazilian",
"romanian",
"russian",
"spanish",
"latam",
"swedish",
"thai",
"turkish",
"ukrainian",
"vietnamese"
};
#define URL_WINDOW_NAME "URL Window"
int find_free_id(std::vector<int> & ids, int base) int find_free_id(std::vector<int> & ids, int base)
{ {
std::sort(ids.begin(), ids.end()); std::sort(ids.begin(), ids.end());
@ -90,8 +125,40 @@ Steam_Overlay::Steam_Overlay(Settings* settings, SteamCallResults* callback_resu
h_inset(0), h_inset(0),
v_inset(0), v_inset(0),
overlay_state_changed(false), overlay_state_changed(false),
i_have_lobby(false) i_have_lobby(false),
show_achievements(false),
show_settings(false),
_renderer(nullptr)
{ {
strncpy(username_text, settings->get_local_name(), sizeof(username_text));
if (settings->warn_forced) {
this->disable_forced = true;
this->warning_forced = true;
} else {
this->disable_forced = false;
this->warning_forced = false;
}
if (settings->warn_local_save) {
this->local_save = true;
} else {
this->local_save = false;
}
current_language = 0;
const char *language = settings->get_language();
int i = 0;
for (auto l : valid_languages) {
if (strcmp(l, language) == 0) {
current_language = i;
break;
}
++i;
}
run_every_runcb->add(&Steam_Overlay::steam_overlay_run_every_runcb, this); run_every_runcb->add(&Steam_Overlay::steam_overlay_run_every_runcb, this);
this->network->setCallback(CALLBACK_ID_STEAM_MESSAGES, settings->get_local_steam_id(), &Steam_Overlay::steam_overlay_callback, this); this->network->setCallback(CALLBACK_ID_STEAM_MESSAGES, settings->get_local_steam_id(), &Steam_Overlay::steam_overlay_callback, this);
} }
@ -129,21 +196,25 @@ void Steam_Overlay::SetupOverlay()
if (!setup_overlay_called) if (!setup_overlay_called)
{ {
setup_overlay_called = true; setup_overlay_called = true;
Renderer_Detector::Inst().find_renderer(); future_renderer = detect_renderer();
} }
} }
void Steam_Overlay::HookReady() void Steam_Overlay::HookReady(bool ready)
{ {
if (!is_ready)
{ {
// TODO: Uncomment this and draw our own cursor (cosmetics) // TODO: Uncomment this and draw our own cursor (cosmetics)
//ImGuiIO &io = ImGui::GetIO(); ImGuiIO &io = ImGui::GetIO();
//io.WantSetMousePos = false; //io.WantSetMousePos = false;
//io.MouseDrawCursor = false; //io.MouseDrawCursor = false;
//io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange; //io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
is_ready = true; io.IniFilename = NULL;
is_ready = ready;
if (is_ready) {
CreateFonts();
}
} }
} }
@ -158,11 +229,26 @@ void Steam_Overlay::OpenOverlay(const char* pchDialog)
ShowOverlay(true); ShowOverlay(true);
} }
void Steam_Overlay::OpenOverlayWebpage(const char* pchURL)
{
show_url = pchURL;
ShowOverlay(true);
}
bool Steam_Overlay::ShowOverlay() const bool Steam_Overlay::ShowOverlay() const
{ {
return show_overlay; return show_overlay;
} }
bool Steam_Overlay::OpenOverlayHook(bool toggle)
{
if (toggle) {
ShowOverlay(!show_overlay);
}
return show_overlay;
}
void Steam_Overlay::ShowOverlay(bool state) void Steam_Overlay::ShowOverlay(bool state)
{ {
if (!Ready() || show_overlay == state) if (!Ready() || show_overlay == state)
@ -310,6 +396,7 @@ void Steam_Overlay::AddMessageNotification(std::string const& message)
notif.message = message; notif.message = message;
notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()); notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch());
notifications.emplace_back(notif); notifications.emplace_back(notif);
have_notifications = true;
} }
else else
PRINT_DEBUG("No more free id to create a notification window\n"); PRINT_DEBUG("No more free id to create a notification window\n");
@ -328,9 +415,21 @@ void Steam_Overlay::AddAchievementNotification(nlohmann::json const& ach)
notif.message = ach["displayName"].get<std::string>() + "\n" + ach["description"].get<std::string>(); notif.message = ach["displayName"].get<std::string>() + "\n" + ach["description"].get<std::string>();
notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()); notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch());
notifications.emplace_back(notif); notifications.emplace_back(notif);
have_notifications = true;
} }
else else
PRINT_DEBUG("No more free id to create a notification window\n"); PRINT_DEBUG("No more free id to create a notification window\n");
std::string ach_name = ach.value("name", "");
for (auto &a : achievements) {
if (a.name == ach_name) {
bool achieved = false;
uint32 unlock_time = 0;
get_steam_client()->steam_user_stats->GetAchievementAndUnlockTime(a.name.c_str(), &achieved, &unlock_time);
a.achieved = achieved;
a.unlock_time = unlock_time;
}
}
} }
void Steam_Overlay::AddInviteNotification(std::pair<const Friend, friend_window_state>& wnd_state) void Steam_Overlay::AddInviteNotification(std::pair<const Friend, friend_window_state>& wnd_state)
@ -346,6 +445,7 @@ void Steam_Overlay::AddInviteNotification(std::pair<const Friend, friend_window_
notif.message = wnd_state.first.name() + " invited you to join a game"; notif.message = wnd_state.first.name() + " invited you to join a game";
notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()); notif.start_time = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch());
notifications.emplace_back(notif); notifications.emplace_back(notif);
have_notifications = true;
} }
else else
PRINT_DEBUG("No more free id to create a notification window\n"); PRINT_DEBUG("No more free id to create a notification window\n");
@ -584,6 +684,8 @@ void Steam_Overlay::BuildNotifications(int width, int height)
notifications.erase(std::remove_if(notifications.begin(), notifications.end(), [&now](Notification &item) { notifications.erase(std::remove_if(notifications.begin(), notifications.end(), [&now](Notification &item) {
return (now - item.start_time) > Notification::show_time; return (now - item.start_time) > Notification::show_time;
}), notifications.end()); }), notifications.end());
have_notifications = !notifications.empty();
} }
if (!friend_actions_temp.empty()) { if (!friend_actions_temp.empty()) {
@ -604,10 +706,7 @@ void Steam_Overlay::CreateFonts()
fontcfg.PixelSnapH = true; fontcfg.PixelSnapH = true;
fontcfg.GlyphRanges = io.Fonts->GetGlyphRangesDefault(); fontcfg.GlyphRanges = io.Fonts->GetGlyphRangesDefault();
fontcfg.SizePixels = std::round(io.DisplaySize.y / 68);
font_default = io.Fonts->AddFontDefault(&fontcfg); font_default = io.Fonts->AddFontDefault(&fontcfg);
fontcfg.SizePixels = std::round(io.DisplaySize.y / 60);
font_notif = io.Fonts->AddFontDefault(&fontcfg); font_notif = io.Fonts->AddFontDefault(&fontcfg);
ImGuiStyle& style = ImGui::GetStyle(); ImGuiStyle& style = ImGui::GetStyle();
@ -622,9 +721,11 @@ void Steam_Overlay::OverlayProc()
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImGui::PushFont(font_notif); if (have_notifications) {
BuildNotifications(io.DisplaySize.x, io.DisplaySize.y); ImGui::PushFont(font_notif);
ImGui::PopFont(); BuildNotifications(io.DisplaySize.x, io.DisplaySize.y);
ImGui::PopFont();
}
if (show_overlay) if (show_overlay)
{ {
@ -647,9 +748,21 @@ void Steam_Overlay::OverlayProc()
settings->get_local_steam_id().ConvertToUint64(), settings->get_local_steam_id().ConvertToUint64(),
settings->get_local_game_id().AppID()); settings->get_local_game_id().AppID());
ImGui::SameLine(); ImGui::SameLine();
Base_Hook* hook = Renderer_Detector::Inst().get_renderer();
ImGui::LabelText("##label", "Renderer: %s", (hook == nullptr ? "Unknown" : hook->get_lib_name()));
ImGui::LabelText("##label", "Renderer: %s", (_renderer == nullptr ? "Unknown" : _renderer->GetLibraryName().c_str()));
ImGui::Spacing();
if (ImGui::Button("Show Achievements")) {
show_achievements = true;
}
ImGui::SameLine();
if (ImGui::Button("Settings")) {
show_settings = true;
}
ImGui::Spacing();
ImGui::Spacing(); ImGui::Spacing();
ImGui::LabelText("##label", "Friends"); ImGui::LabelText("##label", "Friends");
@ -676,6 +789,123 @@ void Steam_Overlay::OverlayProc()
ImGui::ListBoxFooter(); ImGui::ListBoxFooter();
} }
} }
if (show_achievements && achievements.size()) {
ImGui::SetNextWindowSizeConstraints(ImVec2(ImGui::GetFontSize() * 32, ImGui::GetFontSize() * 32), ImVec2(8192, 8192));
bool show = show_achievements;
if (ImGui::Begin("Achievement Window", &show)) {
ImGui::Text("List of achievements");
ImGui::BeginChild("Achievements");
for (auto & x : achievements) {
bool achieved = x.achieved;
bool hidden = x.hidden && !achieved;
ImGui::Separator();
ImGui::Text(x.title.c_str());
if (x.hidden) {
ImGui::Text("hidden achievement");
} else {
ImGui::TextWrapped(x.description.c_str());
}
if (achieved) {
char buffer[80] = {};
time_t unlock_time = (time_t)x.unlock_time;
std::strftime(buffer, 80, "%Y-%m-%d at %H:%M:%S", std::localtime(&unlock_time));
ImGui::TextColored(ImVec4(0, 255, 0, 255), "achieved on %s", buffer);
} else {
ImGui::TextColored(ImVec4(255, 0, 0, 255), "not achieved");
}
ImGui::Separator();
}
ImGui::EndChild();
}
ImGui::End();
show_achievements = show;
}
if (show_settings) {
if (ImGui::Begin("Global Settings Window", &show_settings)) {
ImGui::Text("These are global emulator settings and will apply to all games.");
ImGui::Separator();
ImGui::Text("Username:");
ImGui::SameLine();
ImGui::InputText("##username", username_text, sizeof(username_text), disable_forced ? ImGuiInputTextFlags_ReadOnly : 0);
ImGui::Separator();
ImGui::Text("Language:");
if (ImGui::ListBox("##language", &current_language, valid_languages, sizeof(valid_languages) / sizeof(char *), 7)) {
}
ImGui::Text("Selected Language: %s", valid_languages[current_language]);
ImGui::Separator();
if (!disable_forced) {
ImGui::Text("You may have to restart the game for these to apply.");
if (ImGui::Button("Save")) {
save_settings = true;
show_settings = false;
}
} else {
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
ImGui::TextWrapped("Some steam_settings/force_*.txt files have been detected. Please delete them if you want this menu to work.");
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
}
}
ImGui::End();
}
std::string url = show_url;
if (url.size()) {
bool show = true;
if (ImGui::Begin(URL_WINDOW_NAME, &show)) {
ImGui::Text("The game tried to get the steam overlay to open this url:");
ImGui::Spacing();
ImGui::PushItemWidth(ImGui::CalcTextSize(url.c_str()).x + 20);
ImGui::InputText("##url_copy", (char *)url.data(), url.size(), ImGuiInputTextFlags_ReadOnly);
ImGui::PopItemWidth();
ImGui::Spacing();
if (ImGui::Button("Close") || !show)
show_url = "";
// ImGui::SetWindowSize(ImVec2(ImGui::CalcTextSize(url.c_str()).x + 10, 0));
}
ImGui::End();
}
bool show_warning = local_save || warning_forced || appid == 0;
if (show_warning) {
ImGui::SetNextWindowSizeConstraints(ImVec2(ImGui::GetFontSize() * 64, ImGui::GetFontSize() * 64), ImVec2(8192, 8192));
ImGui::SetNextWindowFocus();
if (ImGui::Begin("WARNING", &show_warning)) {
if (appid == 0) {
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
ImGui::TextWrapped("AppID is 0, please create a steam_appid.txt with the right appid and restart the game.");
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
}
if (local_save) {
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
ImGui::TextWrapped("local_save.txt detected, the emu is saving locally to the game folder. Please delete it if you don't want this.");
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
}
if (warning_forced) {
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
ImGui::TextWrapped("Some steam_settings/force_*.txt files have been detected. You will not be able to save some settings.");
ImGui::TextColored(ImVec4(255, 0, 0, 255), "WARNING WARNING WARNING");
}
}
ImGui::End();
if (!show_warning) {
local_save = warning_forced = false;
}
}
} }
ImGui::End(); ImGui::End();
@ -714,6 +944,22 @@ void Steam_Overlay::Callback(Common_Message *msg)
void Steam_Overlay::RunCallbacks() void Steam_Overlay::RunCallbacks()
{ {
if (!Ready() && future_renderer.valid()) {
if (future_renderer.wait_for(std::chrono::milliseconds{0}) == std::future_status::ready) {
_renderer = future_renderer.get();
PRINT_DEBUG("got renderer %p\n", _renderer);
}
}
if (!Ready() && _renderer) {
_renderer->OverlayHookReady = std::bind(&Steam_Overlay::HookReady, this, std::placeholders::_1);
_renderer->OverlayProc = std::bind(&Steam_Overlay::OverlayProc, this);
auto callback = std::bind(&Steam_Overlay::OpenOverlayHook, this, std::placeholders::_1);
PRINT_DEBUG("start renderer\n", _renderer);
bool started = _renderer->StartHook(callback);
PRINT_DEBUG("tried to start renderer %u\n", started);
}
if (overlay_state_changed) if (overlay_state_changed)
{ {
GameOverlayActivated_t data = { 0 }; GameOverlayActivated_t data = { 0 };
@ -726,6 +972,19 @@ void Steam_Overlay::RunCallbacks()
Steam_Friends* steamFriends = get_steam_client()->steam_friends; Steam_Friends* steamFriends = get_steam_client()->steam_friends;
Steam_Matchmaking* steamMatchmaking = get_steam_client()->steam_matchmaking; Steam_Matchmaking* steamMatchmaking = get_steam_client()->steam_matchmaking;
if (save_settings) {
char *language_text = valid_languages[current_language];
save_global_settings(get_steam_client()->local_storage, username_text, language_text);
get_steam_client()->settings_client->set_local_name(username_text);
get_steam_client()->settings_server->set_local_name(username_text);
get_steam_client()->settings_client->set_language(language_text);
get_steam_client()->settings_server->set_language(language_text);
steamFriends->resend_friend_data();
save_settings = false;
}
appid = settings->get_local_game_id().AppID();
i_have_lobby = IHaveLobby(); i_have_lobby = IHaveLobby();
std::lock_guard<std::recursive_mutex> lock(overlay_mutex); std::lock_guard<std::recursive_mutex> lock(overlay_mutex);
std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i) std::for_each(friends.begin(), friends.end(), [this](std::pair<Friend const, friend_window_state> &i)
@ -824,6 +1083,40 @@ void Steam_Overlay::RunCallbacks()
} }
has_friend_action.pop(); has_friend_action.pop();
} }
if (!achievements.size()) {
Steam_User_Stats* steamUserStats = get_steam_client()->steam_user_stats;
uint32 achievements_num = steamUserStats->GetNumAchievements();
if (achievements_num) {
PRINT_DEBUG("POPULATE OVERLAY ACHIEVEMENTS\n");
for (unsigned i = 0; i < achievements_num; ++i) {
Overlay_Achievement ach;
ach.name = steamUserStats->GetAchievementName(i);
ach.title = steamUserStats->GetAchievementDisplayAttribute(ach.name.c_str(), "name");
ach.description = steamUserStats->GetAchievementDisplayAttribute(ach.name.c_str(), "desc");
const char *hidden = steamUserStats->GetAchievementDisplayAttribute(ach.name.c_str(), "hidden");
if (strlen(hidden) && hidden[0] == '1') {
ach.hidden = true;
} else {
ach.hidden = false;
}
bool achieved = false;
uint32 unlock_time = 0;
if (steamUserStats->GetAchievementAndUnlockTime(ach.name.c_str(), &achieved, &unlock_time)) {
ach.achieved = achieved;
ach.unlock_time = unlock_time;
} else {
ach.achieved = false;
ach.unlock_time = 0;
}
achievements.push_back(ach);
}
PRINT_DEBUG("POPULATE OVERLAY ACHIEVEMENTS DONE\n");
}
}
} }
#endif #endif

View File

@ -70,8 +70,19 @@ struct Notification
std::pair<const Friend, friend_window_state>* frd; std::pair<const Friend, friend_window_state>* frd;
}; };
#ifdef EMU_OVERLAY struct Overlay_Achievement
{
std::string name;
std::string title;
std::string description;
bool hidden;
bool achieved;
uint32 unlock_time;
};
#ifdef EMU_OVERLAY
#include <future>
#include "Renderer_Hook.h"
class Steam_Overlay class Steam_Overlay
{ {
Settings* settings; Settings* settings;
@ -88,16 +99,32 @@ class Steam_Overlay
bool show_overlay; bool show_overlay;
ENotificationPosition notif_position; ENotificationPosition notif_position;
int h_inset, v_inset; int h_inset, v_inset;
std::string show_url;
std::vector<Overlay_Achievement> achievements;
bool show_achievements, show_settings;
bool disable_forced, local_save, warning_forced;
uint32_t appid;
char username_text[256];
std::atomic_bool save_settings;
int current_language;
std::string warning_message;
// Callback infos // Callback infos
std::queue<Friend> has_friend_action; std::queue<Friend> has_friend_action;
std::vector<Notification> notifications; std::vector<Notification> notifications;
std::recursive_mutex notifications_mutex; std::recursive_mutex notifications_mutex;
std::atomic<bool> have_notifications;
bool overlay_state_changed; bool overlay_state_changed;
std::recursive_mutex overlay_mutex; std::recursive_mutex overlay_mutex;
std::atomic<bool> i_have_lobby; std::atomic<bool> i_have_lobby;
std::future<Renderer_Hook*> future_renderer;
Renderer_Hook* _renderer;
Steam_Overlay(Steam_Overlay const&) = delete; Steam_Overlay(Steam_Overlay const&) = delete;
Steam_Overlay(Steam_Overlay&&) = delete; Steam_Overlay(Steam_Overlay&&) = delete;
@ -135,16 +162,18 @@ public:
void SetNotificationInset(int nHorizontalInset, int nVerticalInset); void SetNotificationInset(int nHorizontalInset, int nVerticalInset);
void SetupOverlay(); void SetupOverlay();
void HookReady(); void HookReady(bool ready);
void CreateFonts(); void CreateFonts();
void OverlayProc(); void OverlayProc();
void OpenOverlayInvite(CSteamID lobbyId); void OpenOverlayInvite(CSteamID lobbyId);
void OpenOverlay(const char* pchDialog); void OpenOverlay(const char* pchDialog);
void OpenOverlayWebpage(const char* pchURL);
bool ShowOverlay() const; bool ShowOverlay() const;
void ShowOverlay(bool state); void ShowOverlay(bool state);
bool OpenOverlayHook(bool toggle);
void SetLobbyInvite(Friend friendId, uint64 lobbyId); void SetLobbyInvite(Friend friendId, uint64 lobbyId);
void SetRichInvite(Friend friendId, const char* connect_str); void SetRichInvite(Friend friendId, const char* connect_str);
@ -174,16 +203,18 @@ public:
void SetNotificationInset(int nHorizontalInset, int nVerticalInset) {} void SetNotificationInset(int nHorizontalInset, int nVerticalInset) {}
void SetupOverlay() {} void SetupOverlay() {}
void HookReady() {} void HookReady(bool ready) {}
void CreateFonts() {} void CreateFonts() {}
void OverlayProc() {} void OverlayProc() {}
void OpenOverlayInvite(CSteamID lobbyId) {} void OpenOverlayInvite(CSteamID lobbyId) {}
void OpenOverlay(const char* pchDialog) {} void OpenOverlay(const char* pchDialog) {}
void OpenOverlayWebpage(const char* pchURL) {}
bool ShowOverlay() const {} bool ShowOverlay() const {}
void ShowOverlay(bool state) {} void ShowOverlay(bool state) {}
bool OpenOverlayHook(bool toggle) {}
void SetLobbyInvite(Friend friendId, uint64 lobbyId) {} void SetLobbyInvite(Friend friendId, uint64 lobbyId) {}
void SetRichInvite(Friend friendId, const char* connect_str) {} void SetRichInvite(Friend friendId, const char* connect_str) {}