mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-06 04:04:53 +01:00
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.
Also, fix broken RtlGenRandom by importing ADVAPI32's GetUserNameW(),
and calling GetModuleHandleW() / GetProcAddress() for SystemFunction032().
Instead of trying to use a fake import lib.
Bonus: Can now use the host system's username as the default for the
steam user name instead of "Noob".
("Noob" is still used as the fallback if this call fails, or the host
system's username is invalid.)
This commit is contained in:
parent
abd8300d47
commit
74d22df42e
17 changed files with 926 additions and 317 deletions
|
|
@ -217,9 +217,39 @@ 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);
|
||||
|
||||
// Acount name
|
||||
char name[32] = {};
|
||||
char name[32] = { '\0' };
|
||||
if (local_storage->get_data_settings("account_name.txt", name, sizeof(name) - 1) <= 0) {
|
||||
strcpy(name, DEFAULT_NAME);
|
||||
PRINT_DEBUG("%s.\n", "Attempting to set steam user name from system user 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));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue