Compare commits

..

48 commits

Author SHA1 Message Date
redpolline
7412c14d65 Merge branch 'wine_fixes_overlay_image_display_support' into 'master'
Implement displaying images in the overlay, friend avatar support, fix overlay rendering glitches under wine, and some misc. fixes.

See merge request Mr_Goldberg/goldberg_emulator!57
2025-02-09 04:11:38 +00:00
redpolline
a211b2fa08 Fix another C0000005 in the overlay. 2025-02-08 11:17:39 -05:00
redpolline
4a5db85a78 Fix renderer detection under Wine.
Use new timing checks to detect D3D being dependant on other APIs.
(Should work now regardless of platform, but GPU hardware detection may still be
needed...)
2025-02-08 11:17:38 -05:00
redpolline
b8bcc81473 Implement SteamAPI_WriteMiniDump. 2025-02-08 11:17:38 -05:00
redpolline
a015cf1095 Prevent overlay crash if no achievements are defd.
Disable the "show achievements" button too.
2025-02-08 11:17:37 -05:00
redpolline
14b3c49a5d HACK: Wine DX10 and DX11 Detection.
Wine doesn't implement the NULL renderer, and tries to fallback to the
REFERENCE renderer. Which then also fails when we try to create a 1x1
DXGI_USAGE_RENDER_TARGET_OUTPUT swapchain.

Until Wine manages to get a NULL renderer working, just use the WARP
renderer instead. (Which Wine also doesn't implement and falls back to
the hardware renderer for, but at least it works properly.)
2025-02-08 11:17:37 -05:00
redpolline
aedbc30cfa Fix overlay when avatar images are not configured.
(Otherwise, we'll crash after generating too many images.)
2025-02-08 11:17:37 -05:00
redpolline
72e27588a9 Add PDB generation to release builds & LC x64.
Adds pdb generation to windows release builds. (Easier debugging.)

Adds lobby_connect x64 windows builds. (release and debug.)
2025-02-08 11:17:37 -05:00
redpolline
8919581be7 Rate limit Settings::background_monitor. 2025-02-08 11:17:37 -05:00
redpolline
f6fb664c38 Fix linux build scripts.
Make seperate debug and release build scripts.

Strip the release build.

Add missing define flags.

Fix shared lib arg for libasan.
2025-02-08 11:17:37 -05:00
redpolline
c1ae5f2732 Clang fixes. 2025-02-08 11:17:37 -05:00
redpolline
cc0ffdcbdc Return a val when EMU_OVERLAY isn't defined.
Steam_Overlay::RegisteredInternalCallbacks must return a value when
EMU_OVERLAY isn't defined. (lobby_connect build.)
2025-02-08 11:17:36 -05:00
redpolline
89def85d0c Add missing NO_DISK_WRITES local_storage funcs.
Add Local_Storage::delete_data_settings and Local_Storage::data_settings_exists
implementations when NO_DISK_WRITES is defined. (lobby_connect build.)
2025-02-08 11:17:36 -05:00
redpolline
9fc401a23f Add Overlay UI functions.
Too many things to list.
2025-02-08 11:17:36 -05:00
redpolline
d5d8ced89c Support saving / loading UI Notification Position. 2025-02-08 11:17:36 -05:00
redpolline
f9b6163356 Add Settings::ui_notification_position. 2025-02-08 11:17:36 -05:00
redpolline
a6fa17ebee Use correct callback queue for AvatarImageLoaded_t 2025-02-08 11:17:36 -05:00
redpolline
9b34c9d51b Check callback registration in NOTIFY_AVATAR_IMAGE.
Make sure overlay callbacks are registered before firing callbacks for
set_profile_image.
2025-02-08 11:17:36 -05:00
redpolline
053ea64515 Allow checking registration for GB_CALLBACK
Add cb_type ## _is_registered function for GOLDBERG_CALLBACK_INTERNAL
macro to allow external checking of the callback's registration status
with CCallbackMgr.
2025-02-08 11:17:36 -05:00
redpolline
ba1a94ee5c Implement sending and receiving friend avatars.
Moves Steam_Friends::Callback into a cpp file.

Generates callbacks for avatar changes.

Requests avatars when asked for one that is unknown.
2025-02-08 11:17:36 -05:00
redpolline
fdf5ca8e69 Redo image handling in settings.
Lock the buffers when modifying them.

Notify when callers change a set avatar image.

Create a get function for images.

Allow deletion of previously loaded images, and reuse of their ids.
2025-02-08 11:17:36 -05:00
redpolline
98444c3ead Move most functionality from the macro to template.
Have the users of the macro use common functionality.
2025-02-08 11:17:35 -05:00
redpolline
fb55203797 Add image buffer writing, file copy, avatar save.
Adds functions for saving the user selected avatar image to the global
settings folder. (These also get reused to send the avatar to remote
users.)
2025-02-08 11:17:35 -05:00
redpolline
60c11d1745 Init callback objects first, fix mutex locking
Init callback related objects in Steam_Client before initing anything
else.

Fix missing global_mutex lock in Steam_Client::RegisterCallback() and
Steam_Client::UnregisterCallback().
2025-02-08 11:17:35 -05:00
redpolline
3f4644fabe Change filenames for global settings avatar images...
... and fix the debug messages.

This changes the filenames to be "avatar_*" instead of "profile_*" to
keep things consistent with the proper naming elsewhere.
2025-02-08 11:17:35 -05:00
redpolline
bae54881ef Fix debug message for Steam_Utils::GetImageRGBA(). 2025-02-08 11:17:35 -05:00
redpolline
e2d3b3ecf4 Add protobuf message type Image and Friend_Avatar.
Also adds Friend_Avatar to the Common_Message list of possible
messages.
2025-02-08 11:17:35 -05:00
redpolline
b2c3d3d438 Add try_get_steam_client().
This allows the emulator to attempt to access the global steam_client object
without creating it if it doesn't exist.
2025-02-08 11:17:35 -05:00
redpolline
3d1fdc9392 Create GOLDBERG_CALLBACK_INTERNAL() macro.
This allows the usage of steam callbacks within the emulator itself.
2025-02-08 11:17:35 -05:00
redpolline
d91f82e408 Add fs utility functions for overlay use.
As we need to add a file chooser to the overlay, we need the backend
functions for it to use.

This commit adds:

Local_Storage::get_parent_directory().
Local_Storage::is_directory().
Local_Storage::get_user_pictures_path().
Local_Storage::get_drive_list().
Posix version of DirectoryExists().
2025-02-08 11:17:35 -05:00
redpolline
da0c7b17c6 Add avatar image loading from global ...
... settings directory.

Also adds some additional related debug logging, and a utility function
for converting between std::vector<image_pixel_t> used by Local_Storage::load_image(),
and std::string used by Settings::add_image().
2025-02-08 11:17:35 -05:00
redpolline
308cabe37f Make add_friend_avatars handle local_user avatar
... changes.

Implements STEAM_CALL_RESULT( AvatarImageLoaded_t ).
Adds support for a sending a STEAM_CALL_RESULT( PersonaStateChange_t ) with the k_EPersonaChangeAvatar flag.

Creates a mapping in Settings to hold the avatar image data.

Also adds additional debug logging to indicate which image handle is
returned for each user / image size.
2025-02-08 11:17:34 -05:00
redpolline
2604689181 Enumerate fonts under Windows instead of ...
... hardcoding a path to a font file from the system directory.

Wine doesn't have anything in there, and doing it this way allows
Wine to "just work" without using Winetricks.
2025-02-08 11:17:34 -05:00
redpolline
a91405d20c Overlay: Implement achievement icon display.
Display achievement icons in steam_overlay, and during achievement
notifications.

Add total achievement counts and progress bar to steam_overlay.

Add new global settings for displaying unearned hidden achievements in
the achievement list and displaying achievement descriptions in unlock
notifications. (Both disabled by default.)
2025-02-08 11:17:34 -05:00
redpolline
8a9cf17c31 Win7 / Wine fixes DX11_Hook.cpp.
Don't create image resources if the D3D device isn't inited yet.
(Causes app crash.)

Set quality value on substruct.
2025-02-08 11:17:34 -05:00
redpolline
b037944bab Wine + Enscripten fixes for OpenGL_Hook.cpp. 2025-02-08 11:17:34 -05:00
redpolline
8c2adae67e Extra debugging log functions. 2025-02-08 11:17:33 -05:00
redpolline
aac3c81e7a Implement ISteamUserStats::GetAchievementIcon(). 2025-02-08 11:17:33 -05:00
redpolline
bdbcb62019 Add some achievement display settings. 2025-02-08 11:17:33 -05:00
redpolline
934812ce8c Add functions for global flag settings, ...
return width and height for loaded images.
2025-02-08 11:17:33 -05:00
redpolline
65ea5d2c6c Fix memory leak in resolve_ip. 2025-02-08 11:17:33 -05:00
redpolline
9b56698858 Fix detours not attaching to all threads on startup. 2025-02-08 11:17:33 -05:00
redpolline
ab4740109d Fix compiler warnings. 2025-02-08 11:17:33 -05:00
redpolline
54115a668d Add inttypes defs to common_includes.h 2025-02-08 11:17:32 -05:00
redpolline
d291abb48c Add 32bit registry view editing to ColdClientLoader. 2025-02-08 11:17:31 -05:00
redpolline
599f223800 Set env:SteamAppPath in steamclient_loader. 2025-02-08 11:17:29 -05:00
redpolline
e217bd0a8d Add missing header include guards. 2025-02-08 11:17:27 -05:00
redpolline
611cf69206 Fix CI to use BAT files only for win build.
For consistency have the CI use the same build path as
the end-user builds.

Use where.exe from wine-10.0.

CI's version is a stub. Use one that actually works, until the CI gets
updated.
2025-02-08 11:14:59 -05:00
13 changed files with 43 additions and 142 deletions

View file

@ -66,16 +66,11 @@ build_windows:
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/48db8f434a193aae872279dc4f5dde6a/sdk_standalone.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/48db8f434a193aae872279dc4f5dde6a/sdk_standalone.7z'
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/0119304e030098b4821d73170fe52084/protobuf_x64-windows-static.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/0119304e030098b4821d73170fe52084/protobuf_x64-windows-static.7z'
- wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/4185a97ab363ddc1859127e59ec68581/protobuf_x86-windows-static.7z' - wget 'https://gitlab.com/Mr_Goldberg/goldberg_emulator/uploads/4185a97ab363ddc1859127e59ec68581/protobuf_x86-windows-static.7z'
# Ancient CI version of wine doesn't support the where.exe cmd. (It's a stub.) Use the version from wine-10.0.
- wget 'https://dl.fedoraproject.org/pub/fedora/linux/updates/41/Everything/x86_64/Packages/w/wine-core-10.0-1.fc41.i686.rpm'
- mkdir wine - mkdir wine
# Ancient CI version of wine doesn't support the where.exe cmd. (It's a stub.) Use the version from wine-10.1. - echo './usr/lib/wine/i386-windows/where.exe' > extract.txt; rpm2cpio wine-core-10.0-1.fc41.i686.rpm | cpio -ivdE extract.txt; rm -f extract.txt
# Note: This can use the fedora archive once f40 goes eol (~ 5/28/2025) and wine 10.x gets locked into their archive server. - /usr/bin/mv -f ./usr/lib/wine/i386-windows/where.exe wine/; rm -rf ./usr/
# (Can't use it before then due to newer wine point releases changing the URL....)
#- wget 'https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/39/Everything/x86_64/os/Packages/w/wine-core-10.0-1.fc41.i686.rpm'
#- echo './usr/lib/wine/i386-windows/where.exe' > extract.txt; rpm2cpio wine-core-10.0-1.fc41.i686.rpm | cpio -ivdE extract.txt; rm -f extract.txt
#- /usr/bin/mv -f ./usr/lib/wine/i386-windows/where.exe wine/; rm -rf ./usr/
- wget 'https://dl.winehq.org/wine-builds/fedora/41/x86_64/wine-devel-10.0.0-1.1.x86_64.rpm'
- echo './opt/wine-devel/lib64/wine/i386-windows/where.exe' > extract.txt; rpm2cpio wine-devel-10.0.0-1.1.x86_64.rpm | cpio -ivdE extract.txt; rm -f extract.txt
- /usr/bin/mv -f ./opt/wine-devel/lib64/wine/i386-windows/where.exe wine/; rm -rf ./opt/
- /usr/bin/cp -f wine/where.exe /usr/lib/wine/i386-windows/where.exe; /usr/bin/cp -f wine/where.exe /usr/lib64/wine/x86_64-windows/where.exe - /usr/bin/cp -f wine/where.exe /usr/lib/wine/i386-windows/where.exe; /usr/bin/cp -f wine/where.exe /usr/lib64/wine/x86_64-windows/where.exe
- 7za x protobuf_x86-windows-static.7z -oprotobuf_x86-windows-static - 7za x protobuf_x86-windows-static.7z -oprotobuf_x86-windows-static
- 7za x protobuf_x64-windows-static.7z -oprotobuf_x64-windows-static - 7za x protobuf_x64-windows-static.7z -oprotobuf_x64-windows-static

View file

@ -16,6 +16,7 @@ setlocal
"%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
cd %OLD_DIR%\build\lobby_connect\debug\x86 cd %OLD_DIR%\build\lobby_connect\debug\x86
cl @%CDS_DIR%\RTLGENRANDOM.BLD
cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD
IF EXIST %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS ) IF EXIST %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_LOBBY_CONNECT_X86.LKS )
@ -32,6 +33,7 @@ setlocal
"%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_x64.bat call build_env_x64.bat
cd %OLD_DIR%\build\lobby_connect\debug\x64 cd %OLD_DIR%\build\lobby_connect\debug\x64
cl @%CDS_DIR%\RTLGENRANDOM.BLD
cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD cl /c @%CDS_DIR%\DEBUG.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD
IF EXIST %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS ) IF EXIST %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_LOBBY_CONNECT_X64.LKS )

View file

@ -16,6 +16,7 @@ setlocal
"%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
cd %OLD_DIR%\build\lobby_connect\release\x86 cd %OLD_DIR%\build\lobby_connect\release\x86
cl @%CDS_DIR%\RTLGENRANDOM.BLD
cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD
IF EXIST %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS ) IF EXIST %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_LOBBY_CONNECT_X86.LKS )
@ -32,6 +33,7 @@ setlocal
"%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_x64.bat call build_env_x64.bat
cd %OLD_DIR%\build\lobby_connect\release\x64 cd %OLD_DIR%\build\lobby_connect\release\x64
cl @%CDS_DIR%\RTLGENRANDOM.BLD
cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X64.BLD @%CDS_DIR%\LOBBY_CONNECT.BLD
IF EXIST %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS ) IF EXIST %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_LOBBY_CONNECT_X64.LKS )

View file

@ -18,6 +18,7 @@ setlocal
"%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
cd %OLD_DIR%\build\release\x86 cd %OLD_DIR%\build\release\x86
cl @%CDS_DIR%\RTLGENRANDOM.BLD
cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\DLL_MAIN_CPP.BLD cl /c @%CDS_DIR%\RELEASE.BLD @%CDS_DIR%\PROTOBUF_X86.BLD @%CDS_DIR%\DLL_MAIN_CPP.BLD
IF EXIST %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS ) IF EXIST %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_BASE_DLL_X86.LKS )
@ -33,6 +34,7 @@ setlocal
"%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
cd %OLD_DIR%\build\release\x64 cd %OLD_DIR%\build\release\x64
cl @%CDS_DIR%\RTLGENRANDOM.BLD
cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%/DLL_MAIN_CPP.BLD cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%/DLL_MAIN_CPP.BLD
IF EXIST %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS ) IF EXIST %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_BASE_DLL_X64.LKS )

View file

@ -19,37 +19,14 @@
#ifdef __WINDOWS__ #ifdef __WINDOWS__
HMODULE hadvapi32 = NULL;
BOOLEAN (NTAPI *real_RtlGenRandom)(PVOID,ULONG) = NULL;
static void static void
randombytes(char * const buf, const size_t size) randombytes(char * const buf, const size_t size)
{ {
PRINT_DEBUG("%s %p %" PRI_ZU ".\n", "mine_RtlGenRandom() called.", buf, size); while (!RtlGenRandom((PVOID) buf, (ULONG) size)) {
if (hadvapi32 == NULL) { PRINT_DEBUG("RtlGenRandom ERROR\n");
hadvapi32 = GetModuleHandleW(L"advapi32.dll"); Sleep(100);
if (hadvapi32 == NULL) {
PRINT_DEBUG("%s.\n", "GetModuleHandle() failed for advapi32.dll");
}
PRINT_DEBUG("advapi32.dll handle: 0x%p.\n", hadvapi32);
} }
if (hadvapi32 != NULL &&
real_RtlGenRandom == NULL) {
real_RtlGenRandom = (BOOLEAN(NTAPI *)(PVOID,ULONG))GetProcAddress(hadvapi32, "SystemFunction036");
if (real_RtlGenRandom == NULL) {
PRINT_DEBUG("%s.\n", "GetProcAddress() failed for RtlGenRandom()");
}
PRINT_DEBUG("real_RtlGenRandom address: 0x%p.\n", real_RtlGenRandom);
}
if (real_RtlGenRandom != NULL) {
PRINT_DEBUG("%s.\n", "Calling real_RtlGenRandom");
while (!real_RtlGenRandom((PVOID) buf, (ULONG) size)) {
PRINT_DEBUG("RtlGenRandom ERROR\n");
Sleep(100);
}
PRINT_DEBUG("%s.\n", "real_RtlGenRandom returned");
}
return;
} }
std::string get_env_variable(std::string name) std::string get_env_variable(std::string name)

View file

@ -174,7 +174,6 @@ inline void reset_LastError()
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <iterator> #include <iterator>
#include <typeinfo>
#include <vector> #include <vector>
#include <map> #include <map>

4
dll/rtlgenrandom.c Normal file
View file

@ -0,0 +1,4 @@
#include <windows.h>
#define RtlGenRandom SystemFunction036
#define DLLEXPORT __declspec(dllexport)
DLLEXPORT BOOLEAN WINAPI RtlGenRandom(PVOID in, ULONG len) {}

3
dll/rtlgenrandom.def Normal file
View file

@ -0,0 +1,3 @@
LIBRARY advapi32.dll
EXPORTS
SystemFunction036

View file

@ -217,39 +217,9 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
load_custom_broadcasts(Local_Storage::get_game_settings_path() + "custom_master_server.txt", custom_master_server); load_custom_broadcasts(Local_Storage::get_game_settings_path() + "custom_master_server.txt", custom_master_server);
// Acount name // Acount name
char name[32] = { '\0' }; char name[32] = {};
if (local_storage->get_data_settings("account_name.txt", name, sizeof(name) - 1) <= 0) { if (local_storage->get_data_settings("account_name.txt", name, sizeof(name) - 1) <= 0) {
PRINT_DEBUG("%s.\n", "Attempting to set steam user name from system user name"); strcpy(name, DEFAULT_NAME);
#if defined(STEAM_WIN32)
DWORD username_dword = 32;
wchar_t username[32] = { '\0' };
if (GetUserNameW((wchar_t*)&username, &username_dword) == TRUE) {
std::wstring username_wstr(username);
std::string username_str = utf8_encode(username_wstr);
size_t username_len = username_str.length();
if (username_len > 0 &&
username_len < 31) {
memcpy(&name, username_str.c_str(), username_len);
name[31] = '\0';
}
}
#else
char * env_username = getenv("USER");
if (env_username != NULL) {
size_t username_len = strlen(env_username);
if (username_len > 0 &&
username_len < 31) {
memcpy(&name, env_username, username_len);
name[31] = '\0';
}
}
#endif
char empty_name[32] = { '\0' };
if (memcmp(name, empty_name, 32) == 0) {
PRINT_DEBUG("%s %s.\n", "Setting steam user name to", DEFAULT_NAME);
strcpy(name, DEFAULT_NAME);
}
PRINT_DEBUG("Username: %s.\n", name);
local_storage->store_data_settings("account_name.txt", name, strlen(name)); local_storage->store_data_settings("account_name.txt", name, strlen(name));
} }

View file

@ -139,33 +139,14 @@ int32 achievement_image_data_gray_find(std::string key) {
void load_achievements_db() void load_achievements_db()
{ {
uint64 count = 0; uint64 count = 0;
uint64 bad_count = 0;
uint64 corrupt_count = 0;
uint64 missing_normal_images = 0;
uint64 missing_gray_images = 0;
uint64 unreadable_normal_images = 0;
uint64 unreadable_gray_images = 0;
std::string name = "";
std::string file_path = Local_Storage::get_game_settings_path() + achievements_user_file; std::string file_path = Local_Storage::get_game_settings_path() + achievements_user_file;
local_storage->load_json(file_path, defined_achievements); local_storage->load_json(file_path, defined_achievements);
for (auto & it : defined_achievements) { for (auto & it : defined_achievements) {
name = "";
try { try {
auto name_it = it.find("name"); std::string name = static_cast<std::string const&>(it["name"]);
if (name_it != it.end()) {
name = static_cast<std::string const&>(*name_it);
}
if (name.length() > 0) { if (name.length() > 0) {
auto normal_it = it.find("icon"); std::string normal = Local_Storage::get_game_settings_path() + static_cast<std::string const&>(it["icon"]);
auto gray_it = it.find("icon_gray"); std::string gray = Local_Storage::get_game_settings_path() + static_cast<std::string const&>(it["icongray"]);
std::string normal = "";
std::string gray = "";
if (normal_it != it.end()) {
normal = Local_Storage::get_game_settings_path() + static_cast<std::string const&>(*normal_it);
}
if (gray_it != it.end()) {
gray = Local_Storage::get_game_settings_path() + static_cast<std::string const&>(*gray_it);
}
if (normal.length() > 0 && gray.length() > 0) { if (normal.length() > 0 && gray.length() > 0) {
uint32 normal_height = 0; uint32 normal_height = 0;
uint32 normal_width = 0; uint32 normal_width = 0;
@ -194,56 +175,13 @@ void load_achievements_db()
achievement_image_data_normal[name] = settings->add_image(normalStr, normal_width, normal_height); achievement_image_data_normal[name] = settings->add_image(normalStr, normal_width, normal_height);
achievement_image_data_gray[name] = settings->add_image(grayStr, gray_width, gray_height); achievement_image_data_gray[name] = settings->add_image(grayStr, gray_width, gray_height);
count++; count++;
} else {
corrupt_count++;
if (normal_width <= 0 || normal_height <= 0)
unreadable_normal_images++;
if (gray_width <= 0 || gray_height <= 0)
unreadable_gray_images++;
PRINT_DEBUG("%s %s %s.\n",
"Unable to load images for achievement",
name.c_str(),
"unable to get resolution from images.");
} }
} else {
corrupt_count++;
if (normal.length() <= 0)
missing_normal_images++;
if (gray.length() <= 0)
missing_gray_images++;
PRINT_DEBUG("%s %s %s.\n",
"Unable to load images for achievement",
name.c_str(),
"an image path is not configured");
} }
} else {
bad_count++;
PRINT_DEBUG("%s %s %s %" PRIu64 " %s.\n",
"Invalid achievement json at",
file_path.c_str(),
"for achievement number",
count + corrupt_count + bad_count + 1,
"is invalid");
} }
} catch (std::exception &e) { } catch (...) {}
bad_count++;
PRINT_DEBUG("Loading image data for achievement %s failed. Exception type: %s Reason: %s.\n",
(name.length() > 0) ? name.c_str() : "ERROR: NAME PARSING FROM JSON FAILED",
typeid(e).name(),
e.what());
}
} }
PRINT_DEBUG("loaded %" PRIu64 " achievement images.\npartial loaded %" PRIu64 " achievements.\nskipped %" PRIu64 " invalid achievements.\n", PRINT_DEBUG("loaded %llu achievement images.\n", count);
count,
corrupt_count,
bad_count);
PRINT_DEBUG("ignored %" PRIu64 " missing normal achievement images.\nignored %" PRIu64 " missing gray achievement images.\n",
missing_normal_images,
missing_gray_images);
PRINT_DEBUG("ignored %" PRIu64 " unreadable normal achievement images.\nignored %" PRIu64 " unreadable gray achievement images.\n",
unreadable_normal_images,
unreadable_gray_images);
} }
void load_achievements() void load_achievements()

View file

@ -15,6 +15,7 @@ setlocal
call build_env_x86.bat call build_env_x86.bat
SET OLD_DIR=%cd% SET OLD_DIR=%cd%
cd "build\all_deps\debug\x86" cd "build\all_deps\debug\x86"
cl @%CDS_DIR%/RTLGENRANDOM.BLD
cl /c @%CDS_DIR%/DEBUG.BLD @%CDS_DIR%/PROTOBUF_X86.BLD @%CDS_DIR%\ALL_DEPS.BLD cl /c @%CDS_DIR%/DEBUG.BLD @%CDS_DIR%/PROTOBUF_X86.BLD @%CDS_DIR%\ALL_DEPS.BLD
IF EXIST %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS ) IF EXIST %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS )
where "*.obj" > %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS where "*.obj" > %CDS_DIR%\DEBUG_ALL_DEPS_X86.LKS
@ -26,6 +27,7 @@ setlocal
call build_env_x64.bat call build_env_x64.bat
SET OLD_DIR=%cd% SET OLD_DIR=%cd%
cd "build\all_deps\debug\x64" cd "build\all_deps\debug\x64"
cl @%CDS_DIR%/RTLGENRANDOM.BLD
cl /c @%CDS_DIR%/DEBUG.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%\ALL_DEPS.BLD cl /c @%CDS_DIR%/DEBUG.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%\ALL_DEPS.BLD
IF EXIST %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS ) IF EXIST %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS )
where "*.obj" > %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS where "*.obj" > %CDS_DIR%\DEBUG_ALL_DEPS_X64.LKS
@ -37,6 +39,7 @@ setlocal
call build_env_x86.bat call build_env_x86.bat
SET OLD_DIR=%cd% SET OLD_DIR=%cd%
cd "build\all_deps\release\x86" cd "build\all_deps\release\x86"
cl @%CDS_DIR%/RTLGENRANDOM.BLD
cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X86.BLD @%CDS_DIR%\ALL_DEPS.BLD cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X86.BLD @%CDS_DIR%\ALL_DEPS.BLD
IF EXIST %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS ) IF EXIST %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS )
where "*.obj" > %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS where "*.obj" > %CDS_DIR%\RELEASE_ALL_DEPS_X86.LKS
@ -48,6 +51,7 @@ setlocal
call build_env_x64.bat call build_env_x64.bat
SET OLD_DIR=%cd% SET OLD_DIR=%cd%
cd "build\all_deps\release\x64" cd "build\all_deps\release\x64"
cl @%CDS_DIR%/RTLGENRANDOM.BLD
cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%\ALL_DEPS.BLD cl /c @%CDS_DIR%/RELEASE.BLD @%CDS_DIR%/PROTOBUF_X64.BLD @%CDS_DIR%\ALL_DEPS.BLD
IF EXIST %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS ) IF EXIST %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS ( DEL /F /Q %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS )
where "*.obj" > %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS where "*.obj" > %CDS_DIR%\RELEASE_ALL_DEPS_X64.LKS

View file

@ -114,8 +114,8 @@ copy %CDS_DIR%\RELEASE.ARG %CDS_DIR%\RELEASE.BLD
type %CDS_DIR%\RELEASE.ARG > %CDS_DIR%\RELEASE.LKS type %CDS_DIR%\RELEASE.ARG > %CDS_DIR%\RELEASE.LKS
REM DISABLE the PDB builds if we are running on the CI. (It can't build them currently.) REM DISABLE the PDB builds if we are running on the CI. (It can't build them currently.)
IF EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:NONE >> %CDS_DIR%\RELEASE.LKS ) IF EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:NONE > %CDS_DIR%\RELEASE.LKS )
IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:FULL /OPT:REF /OPT:ICF >> %CDS_DIR%\RELEASE.LKS ) IF NOT EXIST %OLD_DIR%\CI_BUILD.TAG ( echo /link /DEBUG:FULL /OPT:REF /OPT:ICF > %CDS_DIR%\RELEASE.LKS )
REM BASE DLL Flags. REM BASE DLL Flags.
IF EXIST %CDS_DIR%\DLL_MAIN_CPP.ARG ( DEL /F /S /Q %CDS_DIR%\DLL_MAIN_CPP.ARG ) IF EXIST %CDS_DIR%\DLL_MAIN_CPP.ARG ( DEL /F /S /Q %CDS_DIR%\DLL_MAIN_CPP.ARG )
@ -182,7 +182,6 @@ echo dbghelp.lib > %CDS_DIR%\DLL_MAIN_CPP.OS
echo Iphlpapi.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS echo Iphlpapi.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS
echo Ws2_32.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS echo Ws2_32.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS
echo Shell32.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS echo Shell32.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS
echo advapi32.lib >> %CDS_DIR%\DLL_MAIN_CPP.OS
REM EXPERIMENTAL. REM EXPERIMENTAL.
IF EXIST %CDS_DIR%\EXPERIMENTAL.OS ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL.OS ) IF EXIST %CDS_DIR%\EXPERIMENTAL.OS ( DEL /F /S /Q %CDS_DIR%\EXPERIMENTAL.OS )
@ -227,6 +226,11 @@ REM DETOURS.
IF EXIST %CDS_DIR%\DETOURS.FLS ( DEL /F /S /Q %CDS_DIR%\DETOURS.FLS ) IF EXIST %CDS_DIR%\DETOURS.FLS ( DEL /F /S /Q %CDS_DIR%\DETOURS.FLS )
where "%cd%\detours\:*.cpp" > %CDS_DIR%\DETOURS.FLS where "%cd%\detours\:*.cpp" > %CDS_DIR%\DETOURS.FLS
REM rtlgenrandom.
IF EXIST %CDS_DIR%\RTLGENRANDOM.FLS ( DEL /F /S /Q %CDS_DIR%\RTLGENRANDOM.FLS )
where "%cd%\dll\:rtlgenrandom.c" > %CDS_DIR%\RTLGENRANDOM.FLS
where "%cd%\dll\:rtlgenrandom.def" >> %CDS_DIR%\RTLGENRANDOM.FLS
REM CONTROLLER. REM CONTROLLER.
IF EXIST %CDS_DIR%\CONTROLLER.FLS ( DEL /F /S /Q CONTROLLER.FLS ) IF EXIST %CDS_DIR%\CONTROLLER.FLS ( DEL /F /S /Q CONTROLLER.FLS )
where "%cd%\controller\:gamepad.c" > %CDS_DIR%\CONTROLLER.FLS where "%cd%\controller\:gamepad.c" > %CDS_DIR%\CONTROLLER.FLS
@ -278,6 +282,10 @@ type %CDS_DIR%\PROTOBUF_X64.ICD > %CDS_DIR%\PROTOBUF_X64.BLD
type %CDS_DIR%\PROTOBUF_X64.BLD > %CDS_DIR%\PROTOBUF_X64.LKS type %CDS_DIR%\PROTOBUF_X64.BLD > %CDS_DIR%\PROTOBUF_X64.LKS
type %CDS_DIR%\PROTOBUF_X64.OS >> %CDS_DIR%\PROTOBUF_X64.LKS type %CDS_DIR%\PROTOBUF_X64.OS >> %CDS_DIR%\PROTOBUF_X64.LKS
REM rtlgenrandom.
IF EXIST %CDS_DIR%\RTLGENRANDOM.BLD ( DEL /F /S /Q %CDS_DIR%\RTLGENRANDOM.BLD )
type %CDS_DIR%\RTLGENRANDOM.FLS > %CDS_DIR%\RTLGENRANDOM.BLD
REM SC_DEPS REM SC_DEPS
IF EXIST %CDS_DIR%\SC_DEPS.BLD ( DEL /F /S /Q %CDS_DIR%\SC_DEPS.BLD ) IF EXIST %CDS_DIR%\SC_DEPS.BLD ( DEL /F /S /Q %CDS_DIR%\SC_DEPS.BLD )
type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\SC_DEPS.BLD type %CDS_DIR%\NORMAL_ARGS.ARG > %CDS_DIR%\SC_DEPS.BLD

View file

@ -2062,9 +2062,6 @@ int Steam_Overlay::display_imgui_image(uint32_t displayImageType,
} }
} }
} }
if (ret != 1) {
ImGui::Dummy(image_size);
}
break; break;
case displayImageTypeAvatar: case displayImageTypeAvatar:
// User Avatars // User Avatars