mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 16:53:40 +01:00
Fix some minor login issues, center login dialog on Windows.
This commit is contained in:
1 parent
41594d319a
commit
bf3acd9208
2 files changed
+27
-18
No files matched your search
@@ -355,9 +355,14 @@ void Initialize() {
|
||||
INFO_LOG(ACHIEVEMENTS, "Achievements are disabled, not initializing.");
|
||||
return;
|
||||
}
|
||||
_assert_msg_(g_Config.bAchievementsEnable, "Achievements are enabled");
|
||||
_assert_msg_(!g_rcClient, "Achievements already initialized");
|
||||
|
||||
g_rcClient = rc_client_create(read_memory_callback, server_call_callback);
|
||||
if (!g_rcClient) {
|
||||
// Shouldn't happen really.
|
||||
return;
|
||||
}
|
||||
|
||||
// Provide a logging function to simplify debugging
|
||||
rc_client_enable_logging(g_rcClient, RC_CLIENT_LOG_LEVEL_VERBOSE, log_message_callback);
|
||||
|
||||
@@ -370,6 +375,8 @@ void Initialize() {
|
||||
if (!api_token.empty()) {
|
||||
rc_client_begin_login_with_token(g_rcClient, g_Config.sAchievementsUserName.c_str(), api_token.c_str(), &login_token_callback, nullptr);
|
||||
}
|
||||
|
||||
INFO_LOG(ACHIEVEMENTS, "Achievements initialized.");
|
||||
}
|
||||
|
||||
static void login_password_callback(int result, const char *error_message, rc_client_t *client, void *userdata) {
|
||||
@@ -416,13 +423,13 @@ void Logout() {
|
||||
}
|
||||
|
||||
void UpdateSettings() {
|
||||
if (!g_Config.bAchievementsEnable) {
|
||||
if (g_rcClient && !g_Config.bAchievementsEnable) {
|
||||
// we're done here
|
||||
Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_rcClient) {
|
||||
if (!g_rcClient && g_Config.bAchievementsEnable) {
|
||||
// we just got enabled.
|
||||
Initialize();
|
||||
}
|
||||
@@ -432,6 +439,7 @@ bool Shutdown() {
|
||||
g_activeChallenges.clear();
|
||||
rc_client_destroy(g_rcClient);
|
||||
g_rcClient = nullptr;
|
||||
INFO_LOG(ACHIEVEMENTS, "Achievements shut down.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+16
-15
@@ -2,6 +2,7 @@
|
||||
#include "Common/CommonWindows.h"
|
||||
#include "Windows/InputBox.h"
|
||||
#include "Windows/resource.h"
|
||||
#include "Windows/W32Util/Misc.h"
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
|
||||
static std::wstring textBoxContents;
|
||||
@@ -18,34 +19,31 @@ static INT_PTR CALLBACK InputBoxFunc(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||
case WM_INITDIALOG:
|
||||
SetWindowText(GetDlgItem(hDlg, IDC_INPUTBOX), textBoxContents.c_str());
|
||||
SetWindowText(hDlg, windowTitle.c_str());
|
||||
if (defaultSelected == false) PostMessage(GetDlgItem(hDlg,IDC_INPUTBOX),EM_SETSEL,-1,-1);
|
||||
if (defaultSelected == false)
|
||||
PostMessage(GetDlgItem(hDlg,IDC_INPUTBOX),EM_SETSEL,-1,-1);
|
||||
W32Util::CenterWindow(hDlg);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (wParam)
|
||||
{
|
||||
switch (wParam) {
|
||||
case IDOK:
|
||||
{
|
||||
wchar_t temp[256];
|
||||
GetWindowText(GetDlgItem(hDlg, IDC_INPUTBOX), temp, 255);
|
||||
wchar_t temp[512];
|
||||
GetWindowText(GetDlgItem(hDlg, IDC_INPUTBOX), temp, ARRAY_SIZE(temp) - 1);
|
||||
out = temp;
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
}
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, IDCANCEL);
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
template <bool hex>
|
||||
void InputBoxFunc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, const wchar_t *title, const std::string &defaultValue, std::string &outvalue, bool selected)
|
||||
{
|
||||
defaultSelected = selected;
|
||||
@@ -151,6 +149,7 @@ static INT_PTR CALLBACK UserPasswordBoxFunc(HWND hDlg, UINT message, WPARAM wPar
|
||||
SetWindowText(hDlg, windowTitle.c_str());
|
||||
PostMessage(GetDlgItem(hDlg, IDC_INPUTBOX), EM_SETSEL, -1, -1);
|
||||
PostMessage(GetDlgItem(hDlg, IDC_PASSWORDBOX), EM_SETSEL, -1, -1);
|
||||
W32Util::CenterWindow(hDlg);
|
||||
return TRUE;
|
||||
case WM_COMMAND:
|
||||
switch (wParam)
|
||||
@@ -162,12 +161,14 @@ static INT_PTR CALLBACK UserPasswordBoxFunc(HWND hDlg, UINT message, WPARAM wPar
|
||||
g_userName = ConvertWStringToUTF8(temp);
|
||||
GetWindowText(GetDlgItem(hDlg, IDC_PASSWORDBOX), temp, 255);
|
||||
g_passWord = ConvertWStringToUTF8(temp);
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
}
|
||||
EndDialog(hDlg, IDOK);
|
||||
return TRUE;
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, IDCANCEL);
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
|
||||
Reference in new issue
Block a user