diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp index 5befb78e9..01f947133 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h" +#include "stdafx.h" #include "screen_cartographer_account_manager.h" #include "screen_cartographer_account_manager_strings.h" @@ -45,6 +45,7 @@ enum e_cartographer_account_create_list_items : uint16 _item_cartographer_account_create_username = 0, _item_cartographer_account_create_email, _item_cartographer_account_create_password, + _item_cartographer_account_create_confirm_password, _item_cartographer_account_create_process, k_total_no_of_cartographer_account_create_list_items, @@ -60,6 +61,7 @@ enum e_cartographer_screen_type_account_create_string_table _screen_type_account_create_button_placeholder_username_text = k_screen_type_account_list_button_text_index, _screen_type_account_create_button_placeholder_email_text, _screen_type_account_create_button_placeholder_password_text, + _screen_type_account_create_button_placeholder_confirm_password_text, _screen_type_account_create_button_create_account, k_screen_type_account_create_unknown_text @@ -96,6 +98,7 @@ struct s_cartographer_account_create_data char user_name[XUSER_NAME_SIZE]; char email[128]; char password[128]; + e_cartographer_error_id server_error_code; }; struct s_cartographer_account_login_data @@ -137,7 +140,7 @@ const wchar_t*** k_screen_label_table[k_language_count] = /* prototypes */ void* ui_load_cartographer_invalid_login_token(void); -void xbox_live_task_progress_callback(c_screen_xbox_live_task_progress_dialog* dialog); +void sign_in_xbox_task_progress_cb(c_screen_xbox_live_task_progress_dialog* dialog); DWORD WINAPI thread_account_login_proc_cb(LPVOID lParam); static DWORD WINAPI thread_account_create_proc_cb(LPVOID lParam); static const wchar_t* get_cartographer_account_manager_label(e_cartographer_account_manager_screen_type screen_type, int32 label_id); @@ -183,7 +186,7 @@ c_cartographer_account_manager_edit_list::c_cartographer_account_manager_edit_li linker_type2.link(&this->m_slot_2); - const wchar_t* placeholder_username, *placeholder_email, *placeholder_password; + const wchar_t* placeholder_username, *placeholder_email, *placeholder_password, *placeholder_confirm_password; switch (m_cartographer_screen_type) { case _cartographer_account_manager_screen_type_none: @@ -197,9 +200,11 @@ c_cartographer_account_manager_edit_list::c_cartographer_account_manager_edit_li placeholder_username = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_button_placeholder_username_text); placeholder_email = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_button_placeholder_email_text); placeholder_password = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_button_placeholder_password_text); + placeholder_confirm_password = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_button_placeholder_confirm_password_text); wcsncpy(m_account_create.user_name, placeholder_username, XUSER_NAME_SIZE); wcsncpy(m_account_create.email, placeholder_email, ARRAYSIZE(m_account_create.email)); wcsncpy(m_account_create.password, placeholder_password, ARRAYSIZE(m_account_create.password)); + wcsncpy(m_account_create.password_confirmation, placeholder_confirm_password, ARRAYSIZE(m_account_create.password_confirmation)); break; case _cartographer_account_manager_screen_type_add_account: csmemset(&m_account_add, 0, sizeof(m_account_add)); @@ -318,6 +323,9 @@ void c_cartographer_account_manager_edit_list::update_list_items(c_list_item_wid case _screen_type_account_create_button_placeholder_password_text: button_label = cartographer_account_manager_set_password_label(m_account_create.password, password_censored_buffer_wide); break; + case _screen_type_account_create_button_placeholder_confirm_password_text: + button_label = cartographer_account_manager_set_password_label(m_account_create.password_confirmation, password_censored_buffer_wide); + break; default: button_label = get_cartographer_account_manager_label(m_cartographer_screen_type, k_screen_type_account_create_button_text_index + list_item_index); break; @@ -401,9 +409,10 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_add c_cartographer_account_manager_menu::update_accounting_active_handle(true); snprintf(g_account_add_login_data.email_or_username, ARRAYSIZE(g_account_add_login_data.email_or_username), "%S", m_account_add.email_or_username); snprintf(g_account_add_login_data.password, ARRAYSIZE(g_account_add_login_data.password), "%S", m_account_add.password); + g_account_manager_login_thread_handle = CreateThread(NULL, 0, thread_account_login_proc_cb, (LPVOID)NONE, 0, NULL); + c_screen_xbox_live_task_progress_dialog::add_task(sign_in_xbox_task_progress_cb); - c_screen_xbox_live_task_progress_dialog::add_task(xbox_live_task_progress_callback); user_interface_back_out_from_channel(parent_screen_ui_channel, parent_render_window); } } @@ -452,8 +461,10 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_lis { c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; c_cartographer_account_manager_menu::update_accounting_active_handle(true); + g_account_manager_login_thread_handle = CreateThread(NULL, 0, thread_account_login_proc_cb, (LPVOID)button_id, 0, NULL); - c_screen_xbox_live_task_progress_dialog::add_task(xbox_live_task_progress_callback); + c_screen_xbox_live_task_progress_dialog::add_task(sign_in_xbox_task_progress_cb); + user_interface_back_out_from_channel(parent_screen_ui_channel, parent_render_window); } } @@ -480,6 +491,22 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_lis } +void __cdecl create_account_xbox_task_progress_cb(c_screen_xbox_live_task_progress_dialog* dialog) +{ + dialog->set_display_text_raw(L"Processing account creation request, please wait..."); + + if (g_account_manager_thread_handle == NULL) + { + dialog->close_task(); + c_cartographer_error_menu::load_by_error_id(g_account_create_data.server_error_code); + + SecureZeroMemory(g_account_create_data.user_name, sizeof(g_account_create_data.user_name)); + SecureZeroMemory(g_account_create_data.email, sizeof(g_account_create_data.email)); + SecureZeroMemory(g_account_create_data.password, sizeof(g_account_create_data.password)); + memset(&g_account_create_data, 0, sizeof(g_account_create_data)); + } +} + void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_create_account(s_event_record* event_record, int32* a3) { const int32 button_id = DATUM_INDEX_TO_ABSOLUTE_INDEX(*a3); @@ -489,7 +516,7 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_cre if (button_id == _item_cartographer_account_create_username) { - ui_load_virtual_keyboard(m_account_create.user_name, ARRAYSIZE(m_account_create.user_name) /* Wide string buffer size */, _vkbd_custom_context_username); + ui_load_virtual_keyboard(m_account_create.user_name, /* wide characters count */ ARRAYSIZE(m_account_create.user_name), _vkbd_custom_context_username); } else if (button_id == _item_cartographer_account_create_email) { @@ -499,9 +526,17 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_cre { ui_load_virtual_keyboard(m_account_create.password, ARRAYSIZE(m_account_create.password), _vkbd_custom_context_password); } + else if (button_id == _item_cartographer_account_create_confirm_password) + { + ui_load_virtual_keyboard(m_account_create.password_confirmation, ARRAYSIZE(m_account_create.password_confirmation), _vkbd_custom_context_password); + } else if (button_id == _item_cartographer_account_create_process) { - if (g_account_manager_thread_handle == NULL) + if (ustrncmp(m_account_create.password, m_account_create.password_confirmation, k_cartographer_account_email_and_password_max_length) != 0) + { + c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_password_confirmation_mismatch); + } + else if (g_account_manager_thread_handle == NULL) { c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; c_cartographer_account_manager_menu::update_accounting_active_handle(true); @@ -510,11 +545,14 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_cre snprintf(g_account_create_data.email, ARRAYSIZE(g_account_create_data.email), "%S", m_account_create.email); snprintf(g_account_create_data.password, ARRAYSIZE(g_account_create_data.password), "%S", m_account_create.password); - g_account_manager_login_thread_handle = CreateThread(NULL, 0, thread_account_login_proc_cb, (LPVOID)NONE, 0, NULL); + SecureZeroMemory(m_account_create.user_name, sizeof(m_account_create.user_name)); + SecureZeroMemory(m_account_create.email, sizeof(m_account_create.email)); + SecureZeroMemory(m_account_create.password, sizeof(m_account_create.password)); + SecureZeroMemory(m_account_create.password_confirmation, sizeof(m_account_create.password_confirmation)); user_interface_back_out_from_channel(parent_screen_ui_channel, parent_render_window); - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_processing_account_notice); g_account_manager_thread_handle = CreateThread(NULL, 0, thread_account_create_proc_cb, (LPVOID)0, 0, NULL); + c_screen_xbox_live_task_progress_dialog::add_task(create_account_xbox_task_progress_cb); } } return; @@ -539,6 +577,7 @@ void c_cartographer_account_manager_menu::pre_destroy() if (c_cartographer_account_manager_menu::g_accounting_go_back_to_list && c_cartographer_account_manager_menu::is_accounting_active_handle()) { + load_for_account_list_context(); c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; } break; @@ -547,6 +586,7 @@ void c_cartographer_account_manager_menu::pre_destroy() if (c_cartographer_account_manager_menu::g_accounting_go_back_to_list && c_cartographer_account_manager_menu::is_accounting_active_handle()) { + load_for_account_list_context(); c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; } break; @@ -650,7 +690,7 @@ void* __cdecl c_cartographer_account_manager_menu::load(s_screen_parameters* par selected_button_index = 0; break; case _cartographer_account_manager_screen_type_create_account: - button_count = 4; + button_count = 5; selected_button_index = 0; c_cartographer_account_manager_menu::g_accounting_go_back_to_list = true; break; @@ -732,7 +772,7 @@ void* ui_load_cartographer_invalid_login_token(void) } -void xbox_live_task_progress_callback(c_screen_xbox_live_task_progress_dialog* dialog) +void sign_in_xbox_task_progress_cb(c_screen_xbox_live_task_progress_dialog* dialog) { dialog->set_display_text_raw(L"Signing into Project Cartographer, please wait..."); @@ -858,13 +898,8 @@ static DWORD WINAPI thread_account_create_proc_cb(LPVOID lParam) Sleep(200L); //submit account creation. - if (HandleGuiAccountCreate(g_account_create_data.user_name, g_account_create_data.email, g_account_create_data.password)) + if (HandleGuiAccountCreate(g_account_create_data.user_name, g_account_create_data.email, g_account_create_data.password, &g_account_create_data.server_error_code)) { - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_verification_email_sent); - - SecureZeroMemory(g_account_create_data.user_name, sizeof(g_account_create_data.user_name)); - SecureZeroMemory(g_account_create_data.email, sizeof(g_account_create_data.email)); - SecureZeroMemory(g_account_create_data.password, sizeof(g_account_create_data.password)); } c_cartographer_account_manager_menu::update_accounting_active_handle(false); @@ -879,24 +914,37 @@ static const wchar_t* get_cartographer_account_manager_label(e_cartographer_acco return k_screen_label_table[language][screen_type][label_id]; } -static const wchar_t* cartographer_account_manager_set_password_label(const wchar_t* password, wchar_t* password_censored_buffer) +static const wchar_t* cartographer_account_manager_set_password_label(const wchar_t* password, wchar_t* password_censored_text) { - const wchar_t* default_password_label = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_create_account, _screen_type_account_create_button_placeholder_password_text); - const size_t default_password_label_length = ustrnlen(default_password_label, k_cartographer_account_email_and_password_max_length); + const wchar_t* default_password_labels[2]; + default_password_labels[0] = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_create_account, _screen_type_account_create_button_placeholder_password_text); + default_password_labels[1] = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_create_account, _screen_type_account_create_button_placeholder_confirm_password_text); + + bool is_default_password_label = false; + for (int32 i = 0; i < ARRAYSIZE(default_password_labels); i++) + { + const size_t default_password_label_length = wcslen(default_password_labels[i]); - // Check if the password passed is the default password level (k_password_string) - const bool is_not_default_password_label = ustrncmp(password, default_password_label, default_password_label_length) != 0; - if (is_not_default_password_label) + // Check if the password passed is the default password level (k_password_string) + is_default_password_label = ustrncmp(password, default_password_labels[i], default_password_label_length) == 0; + if (is_default_password_label) + { + break; + } + } + + if (!is_default_password_label) { - // Populate password_censored_buffer with the '*' character for each character entered + // Populate password_censored_text with the '*' character for each character entered const size_t length = ustrnlen(password, k_cartographer_account_email_and_password_max_length); - size_t i = 0; + size_t i = 0; for (; i < length; ++i) { - password_censored_buffer[i] = L'*'; + password_censored_text[i] = L'*'; } - password_censored_buffer[i] = L'\0'; + password_censored_text[i] = L'\0'; } - return is_not_default_password_label ? password_censored_buffer : password; + + return is_default_password_label ? password : password_censored_text; } diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h index 0eff7c973..4da2ba86e 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h @@ -45,6 +45,7 @@ class c_cartographer_account_manager_edit_list : public c_list_widget wchar_t user_name[XUSER_NAME_SIZE]; wchar_t email[k_cartographer_account_email_and_password_max_length]; wchar_t password[k_cartographer_account_email_and_password_max_length]; + wchar_t password_confirmation[k_cartographer_account_email_and_password_max_length]; } m_account_create; struct @@ -109,8 +110,6 @@ class c_cartographer_account_manager_menu : protected c_screen_with_menu static c_cartographer_account_manager_menu* load_for_account_list_context(void); static c_cartographer_account_manager_menu* load_for_account_remove_from_list_context(void); - - // c_cartographer_account_manager_menu virtual functions virtual ~c_cartographer_account_manager_menu(void) = default; diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager_strings.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager_strings.h index a711bec0f..a2bca2b09 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager_strings.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager_strings.h @@ -4,6 +4,7 @@ const wchar_t k_username_string_eng[] = L"[Username]"; const wchar_t k_password_string_eng[] = L"[Password]"; +const wchar_t k_password_confirm_string_eng[] = L"[Confirm Password]"; const wchar_t k_remember_me_string_eng[] = L"%c Remember me"; const wchar_t* k_screen_type_list_add_account_eng[] = @@ -37,6 +38,7 @@ static const wchar_t* k_screen_type_list_create_account_eng[] = k_username_string_eng, L"[Email]", k_password_string_eng, + k_password_confirm_string_eng, L"Create Account", L"" }; diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp index a7ca8c76c..e94528c35 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp @@ -85,6 +85,10 @@ const s_cartographer_error_globals k_cartographer_error_globals[k_language_count L"Username Taken!", L"The Username you have entered is already in use!" }, + { + L"Password mismatch!", + L"Password confirmation does not match the actual password!" + }, { L"BANNED Email Provider!", L"The Email Address you have entered is using a domain name that has been banned! We do not allow disposable email addresses! If this is a mistake please contact an admin." @@ -127,9 +131,21 @@ void c_cartographer_error_menu::get_error_label(e_cartographer_error_id error_id void* c_cartographer_error_menu::load_by_error_id(e_cartographer_error_id error_id) { - c_cartographer_error_menu* error_menu = (c_cartographer_error_menu*)ui_custom_cartographer_load_menu(c_cartographer_error_menu::load, 1); - error_menu->m_error_id = error_id; + s_screen_parameters params; + c_cartographer_error_menu* error_menu = NULL; + + params.m_flags = 0; + params.m_window_index = _window_4; + params.m_context = NULL; + params.user_flags = user_interface_controller_get_signed_in_controllers_mask() | FLAG(k_windows_device_controller_index); + params.m_channel_type = _user_interface_channel_type_game_error; + params.m_screen_state.field_0 = NONE; + params.m_screen_state.m_last_focused_item_order = NONE; + params.m_screen_state.m_last_focused_item_index = NONE; + params.m_load_function = c_cartographer_error_menu::load; + error_menu = (c_cartographer_error_menu*)params.m_load_function(¶ms); + error_menu->m_error_id = error_id; return error_menu; } @@ -147,7 +163,7 @@ void* c_cartographer_error_menu::load(s_screen_parameters* parameters) c_cartographer_error_menu::c_cartographer_error_menu(e_user_interface_channel_type _ui_channel, e_user_interface_render_window _window_index, uint16 _flags) : - c_screen_widget(_screen_error_dialog_ok_cancel, _ui_channel, _window_index, _flags) + c_screen_widget(_screen_error_dialog_ok, _ui_channel, _window_index, _flags) { m_error_id = _cartpgrapher_error_id_none; } @@ -172,20 +188,21 @@ void c_cartographer_error_menu::pre_destroy() bool c_cartographer_error_menu::handle_event(s_event_record* event) { - if (event->type == _user_interface_event_type_gamepad_button_pressed) + bool result = false; + if (event->type == _user_interface_event_type_keyboard_button_pressed + || event->type == _user_interface_event_type_gamepad_button_pressed + || event->type == _user_interface_event_type_mouse_button_left_click) { - if (event->component == _user_interface_controller_component_button_a - || event->component == _user_interface_controller_component_button_b - || event->component == _user_interface_controller_component_button_start - || event->component == _user_interface_controller_component_button_back) + if (event->component == _user_interface_keyboard_component_button_letter_a + || event->component == _user_interface_controller_component_button_a) { - e_user_interface_render_window parent_render_window = this->get_parent_render_window(); - e_user_interface_channel_type parent_screen_ui_channel = this->get_parent_channel(); - - user_interface_back_out_from_channel(parent_screen_ui_channel, parent_render_window); + start_widget_animation(3); + result = true; } } - return c_screen_widget::handle_event(event);; + + //return c_screen_widget::handle_event(event); + return result; } void c_cartographer_error_menu::initialize(s_screen_parameters* screen_parameters) @@ -194,7 +211,6 @@ void c_cartographer_error_menu::initialize(s_screen_parameters* screen_parameter csmemset(&layout, 0, sizeof(layout)); layout.panes_count = 1; - datum widget_tag_datum = user_interface_get_widget_tag_index_from_screen_id(this->m_screen_id); if (widget_tag_datum != NONE) { @@ -213,7 +229,7 @@ void c_cartographer_error_menu::initialize(s_screen_parameters* screen_parameter } m_header_text.set_text(header_text); - c_text_widget* subheader_text_widget = try_find_text_widget(K_SUB_HEADER_TEXT_BLOCK_INDEX); + c_text_widget* subheader_text_widget = try_find_text_widget(k_sub_header_text_block_index); if (subheader_text_widget) { subheader_text_widget->set_text(subheader_text); diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h index fae08408b..e268e28a3 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h @@ -22,6 +22,7 @@ enum e_cartographer_error_id _cartographer_error_id_account_create_invalid_password, _cartographer_error_id_account_create_email_already_used, _cartographer_error_id_account_create_username_taken, + _cartographer_error_id_account_create_password_confirmation_mismatch, _cartographer_error_id_account_create_blacklisted_email_provider, _cartographer_error_id_account_create_success, _cartographer_error_id_account_create_verification_email_sent, diff --git a/xlive/Blam/Engine/interface/screens/screen_error_dialog.cpp b/xlive/Blam/Engine/interface/screens/screen_error_dialog.cpp index 8358cb8ae..8d60638fe 100644 --- a/xlive/Blam/Engine/interface/screens/screen_error_dialog.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_error_dialog.cpp @@ -4,9 +4,9 @@ #include "interface/user_interface_controller.h" -typedef void(__cdecl* ok_cancle_dialog_t)(e_user_interface_channel_type channel_type, e_ui_error_types error_type, e_user_interface_render_window window_index, uint16 user_flags, void* ok_callback, void* fallback, int a7, int a8); -ok_cancle_dialog_t p_ok_cancle_dialog; -void __cdecl ok_cancle_dialog_show_hook(e_user_interface_channel_type channel_type, e_ui_error_types error_type, e_user_interface_render_window window_index, uint16 user_flags, void* ok_callback, void* fallback, int a7, int a8) +typedef void(__cdecl* ok_cancel_dialog_t)(e_user_interface_channel_type channel_type, e_ui_error_types error_type, e_user_interface_render_window window_index, uint16 user_flags, void* ok_callback, void* fallback, int a7, int a8); +ok_cancel_dialog_t p_ok_cancel_dialog; +void __cdecl ok_cancel_dialog_show_hook(e_user_interface_channel_type channel_type, e_ui_error_types error_type, e_user_interface_render_window window_index, uint16 user_flags, void* ok_callback, void* fallback, int a7, int a8) { //ALL_USERS_MASK if ((user_flags & 0xFF) == (uint8)NONE) @@ -39,14 +39,17 @@ void __cdecl ok_cancle_dialog_show_hook(e_user_interface_channel_type channel_ty break; } } - p_ok_cancle_dialog(channel_type, error_type, window_index, user_flags, ok_callback, fallback, a7, a8); + p_ok_cancel_dialog(channel_type, error_type, window_index, user_flags, ok_callback, fallback, a7, a8); } void* c_screen_error_dialog_ok::load_for_active_users(s_screen_parameters* parameters) { - parameters->user_flags = user_interface_controller_get_signed_in_controllers_mask(); + if ((parameters->user_flags & 0xFF) == (uint8)NONE) + { + parameters->user_flags = user_interface_controller_get_signed_in_controllers_mask() | FLAG(k_windows_device_controller_index); + } return INVOKE(0x20E032, 0x0, c_screen_error_dialog_ok::load_for_active_users, parameters); } @@ -57,5 +60,5 @@ void c_screen_error_dialog_ok::apply_patches() void c_screen_error_dialog_ok_cancel::apply_patches() { - DETOUR_ATTACH(p_ok_cancle_dialog, Memory::GetAddress(0x20E243), ok_cancle_dialog_show_hook); + DETOUR_ATTACH(p_ok_cancel_dialog, Memory::GetAddress(0x20E243), ok_cancel_dialog_show_hook); } diff --git a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp index 55f422da9..38bc1d6f8 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp @@ -6,7 +6,7 @@ /* macro defines */ -#define K_VIRTUAL_KEYBOARD_DESCRIPTION_TEXT_BLOCK_INDEX 3 +#define k_virtual_keyboard_description_text_block_index 3 /* structures */ @@ -160,7 +160,7 @@ void c_screen_virtual_keyboard::update_custom_labels(e_vkbd_context_type context get_keyboard_labels(context, &header_text, &subheader_text); m_header_text.set_text(header_text); - c_text_widget* subheader_text_widget = try_find_text_widget(K_VIRTUAL_KEYBOARD_DESCRIPTION_TEXT_BLOCK_INDEX); + c_text_widget* subheader_text_widget = try_find_text_widget(k_virtual_keyboard_description_text_block_index); if (subheader_text_widget) { subheader_text_widget->set_text(subheader_text); diff --git a/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.cpp b/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.cpp index 130ed9021..d5e21a7b4 100644 --- a/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.cpp @@ -130,14 +130,14 @@ void c_screen_xbox_live_task_progress_dialog::set_header_text(string_id header) void c_screen_xbox_live_task_progress_dialog::set_display_text(string_id display) { - c_text_widget* text = try_find_text_widget(K_SUB_HEADER_TEXT_BLOCK_INDEX); + c_text_widget* text = try_find_text_widget(k_sub_header_text_block_index); if (text) text->set_text_from_string_id(display); } void c_screen_xbox_live_task_progress_dialog::set_display_text_raw(const wchar_t* raw_text) { - c_text_widget* text = try_find_text_widget(K_SUB_HEADER_TEXT_BLOCK_INDEX); + c_text_widget* text = try_find_text_widget(k_sub_header_text_block_index); if (text) text->set_text(raw_text); } diff --git a/xlive/Blam/Engine/interface/user_interface_controller.h b/xlive/Blam/Engine/interface/user_interface_controller.h index 7a69a2e98..677544c26 100644 --- a/xlive/Blam/Engine/interface/user_interface_controller.h +++ b/xlive/Blam/Engine/interface/user_interface_controller.h @@ -49,54 +49,54 @@ enum e_user_interface_controller_component : uint32 _user_interface_keyboard_component_button_pause_break = 0x13, _user_interface_keyboard_component_button_capslock = 0x14, _user_interface_keyboard_component_button_escape = 0x1B, - _user_interface_keyboard_component_buton_space = 0x20, - _user_interface_keyboard_component_buton_page_up = 0x21, - _user_interface_keyboard_component_buton_page_down = 0x22, - _user_interface_keyboard_component_buton_end = 0x23, - - _user_interface_keyboard_component_buton_left = 0x25, - _user_interface_keyboard_component_buton_up = 0x26, - _user_interface_keyboard_component_buton_right = 0x27, - _user_interface_keyboard_component_buton_down = 0x28, + _user_interface_keyboard_component_button_space = 0x20, + _user_interface_keyboard_component_button_page_up = 0x21, + _user_interface_keyboard_component_button_page_down = 0x22, + _user_interface_keyboard_component_button_end = 0x23, + + _user_interface_keyboard_component_button_left = 0x25, + _user_interface_keyboard_component_button_up = 0x26, + _user_interface_keyboard_component_button_right = 0x27, + _user_interface_keyboard_component_button_down = 0x28, _user_interface_keyboard_component_button_insert = 0x2D, _user_interface_keyboard_component_button_delete = 0x2E, - _user_interface_keyboard_component_buton_numeric_zero = 0x30, - _user_interface_keyboard_component_buton_numeric_two = 0x32, + _user_interface_keyboard_component_button_numeric_zero = 0x30, + _user_interface_keyboard_component_button_numeric_two = 0x32, // ....so on - _user_interface_keyboard_component_buton_numeric_nine = 0x39, + _user_interface_keyboard_component_button_numeric_nine = 0x39, - _user_interface_keyboard_component_buton_letter_a = 0x41, - _user_interface_keyboard_component_buton_letter_b = 0x42, + _user_interface_keyboard_component_button_letter_a = 0x41, + _user_interface_keyboard_component_button_letter_b = 0x42, // ....so on - _user_interface_keyboard_component_buton_letter_z = 0x5A, + _user_interface_keyboard_component_button_letter_z = 0x5A, - _user_interface_keyboard_component_buton_f1 = 0x70, - _user_interface_keyboard_component_buton_f2 = 0x71, + _user_interface_keyboard_component_button_f1 = 0x70, + _user_interface_keyboard_component_button_f2 = 0x71, // ....so on - _user_interface_keyboard_component_buton_f12 = 0x7B, + _user_interface_keyboard_component_button_f12 = 0x7B, // ....special keys - _user_interface_keyboard_component_buton_numlock = 0x90, - _user_interface_keyboard_component_buton_left_shift = 0xA0, - _user_interface_keyboard_component_buton_right_shift = 0xA1, - _user_interface_keyboard_component_buton_left_control = 0xA2, - _user_interface_keyboard_component_buton_right_control = 0xA3, - _user_interface_keyboard_component_buton_left_alt = 0xA4, - _user_interface_keyboard_component_buton_right_alt = 0xA5, - _user_interface_keyboard_component_buton_tilde = 0x107, - _user_interface_keyboard_component_buton_minus = 0x108, - _user_interface_keyboard_component_buton_comma = 0x10E, - _user_interface_keyboard_component_buton_period = 0x10E, - _user_interface_keyboard_component_buton_backslash = 0x110, - _user_interface_keyboard_component_buton_equals = 0x112, - _user_interface_keyboard_component_buton_multiple = 0x115, - _user_interface_keyboard_component_buton_numeric_one = 0x117, + _user_interface_keyboard_component_button_numlock = 0x90, + _user_interface_keyboard_component_button_left_shift = 0xA0, + _user_interface_keyboard_component_button_right_shift = 0xA1, + _user_interface_keyboard_component_button_left_control = 0xA2, + _user_interface_keyboard_component_button_right_control = 0xA3, + _user_interface_keyboard_component_button_left_alt = 0xA4, + _user_interface_keyboard_component_button_right_alt = 0xA5, + _user_interface_keyboard_component_button_tilde = 0x107, + _user_interface_keyboard_component_button_minus = 0x108, + _user_interface_keyboard_component_button_comma = 0x10E, + _user_interface_keyboard_component_button_period = 0x10E, + _user_interface_keyboard_component_button_backslash = 0x110, + _user_interface_keyboard_component_button_equals = 0x112, + _user_interface_keyboard_component_button_multiple = 0x115, + _user_interface_keyboard_component_button_numeric_one = 0x117, }; diff --git a/xlive/Blam/Engine/interface/user_interface_widget_window.cpp b/xlive/Blam/Engine/interface/user_interface_widget_window.cpp index ef30b1945..929ef8feb 100644 --- a/xlive/Blam/Engine/interface/user_interface_widget_window.cpp +++ b/xlive/Blam/Engine/interface/user_interface_widget_window.cpp @@ -12,7 +12,6 @@ c_screen_widget::c_screen_widget(e_user_interface_screen_id menu_id, e_user_inte //INVOKE_TYPE(0x2106A2, 0x0, void(__thiscall*)(c_screen_widget*, e_user_interface_screen_id, e_user_interface_channel_type, e_user_interface_render_window, int16), // this, menu_id, channel_type, window_index, user_flags); - this->m_channel_type = channel_type; //this->interface_widget_vtable = &c_screen_widget::`vftable'; this->m_screen_id = menu_id; @@ -25,9 +24,9 @@ c_screen_widget::c_screen_widget(e_user_interface_screen_id menu_id, e_user_inte this->m_disable_overlay_effect = false; this->field_9FD = false; - //h2v writes screen_id to some global variable , - //probably a leftover stuff from gfwl - WriteValue(Memory::GetAddress(0x9758D8), menu_id); + // h2v writes screen_id to some global variable, + // probably some leftover stuff from gfwl + *Memory::GetAddress(0x9758D8) = menu_id; this->m_widget_type = _widget_type_screen; this->field_6D = true; @@ -51,12 +50,12 @@ const e_user_interface_screen_id c_screen_widget::get_id() c_text_widget* c_screen_widget::get_screen_header_text() { - return try_find_text_widget(K_HEADER_TEXT_BLOCK_INDEX); + return try_find_text_widget(k_header_text_block_index); } c_text_widget* c_screen_widget::get_screen_button_key_text() { - return try_find_text_widget(K_BUTTON_KEY_TEXT_BLOCK_INDEX); + return try_find_text_widget(k_button_key_text_block_index); } // only use this when you are sure the screen texts start from 2 @@ -231,7 +230,7 @@ c_screen_with_menu::c_screen_with_menu(e_user_interface_screen_id menu_id, e_use // verify before using this , not all widgets have a subheader c_text_widget* c_screen_with_menu::get_screen_subheader_text() { - return try_find_text_widget(K_SUB_HEADER_TEXT_BLOCK_INDEX); + return try_find_text_widget(k_sub_header_text_block_index); } diff --git a/xlive/Blam/Engine/interface/user_interface_widget_window.h b/xlive/Blam/Engine/interface/user_interface_widget_window.h index a746459b2..8e26b185a 100644 --- a/xlive/Blam/Engine/interface/user_interface_widget_window.h +++ b/xlive/Blam/Engine/interface/user_interface_widget_window.h @@ -7,14 +7,14 @@ /* macro defines */ -#define K_HEADER_TEXT_BLOCK_INDEX 0 -#define K_BUTTON_KEY_TEXT_BLOCK_INDEX 1 -#define K_SUB_HEADER_TEXT_BLOCK_INDEX 2 -#define K_MINIMUM_NUMBER_OF_DEFAULT_SCREEN_TEXTS 2 -#define K_MAXIMUM_NUMBER_OF_BUTTON_KEYS 4 +#define k_header_text_block_index 0 +#define k_button_key_text_block_index 1 +#define k_sub_header_text_block_index 2 +#define k_minimum_number_of_default_screen_texts 2 +#define k_maximum_number_of_button_keys 4 #define TEXT_BLOCK_INDEX_TO_WIDGET_INDEX(block_idx) \ - ((block_idx) + K_MINIMUM_NUMBER_OF_DEFAULT_SCREEN_TEXTS) + ((block_idx) + k_minimum_number_of_default_screen_texts) /* enums */ diff --git a/xlive/H2MOD/Modules/Accounts/AccountCreate.cpp b/xlive/H2MOD/Modules/Accounts/AccountCreate.cpp index 4d7ac9da5..589bf0da8 100644 --- a/xlive/H2MOD/Modules/Accounts/AccountCreate.cpp +++ b/xlive/H2MOD/Modules/Accounts/AccountCreate.cpp @@ -6,8 +6,6 @@ #include "H2MOD/Modules/CustomMenu/CustomLanguage.h" #include "H2MOD/Utils/Utils.h" -#include "interface/screens/screen_cartographer_errors.h" - #define ERROR_CODE_INVALID_PARAM -1 #define ERROR_CODE_INVALID_EMAIL -2 #define ERROR_CODE_INVALID_USERNAME -3 @@ -68,7 +66,7 @@ static int InterpretMasterCreate(char* response_content) { } -bool HandleGuiAccountCreate(char* username, char* email, char* password) { +bool HandleGuiAccountCreate(char* username, char* email, char* password, e_cartographer_error_id* out_account_create_cartographer_error_id) { bool result = false; char* rtn_result = 0; @@ -89,7 +87,6 @@ bool HandleGuiAccountCreate(char* username, char* email, char* password) { TEST_N_DEF(LC4); #endif - if (rtn_code == 0) { rtn_code = InterpretMasterCreate(rtn_result); if (rtn_code > 0) { @@ -99,36 +96,39 @@ bool HandleGuiAccountCreate(char* username, char* email, char* password) { } if (rtn_code <= 0) { addDebugText("ERROR Account Create: %d", rtn_code); - if (rtn_code == 0 || rtn_code == ERROR_CODE_CURL_SOCKET_FAILED || rtn_code == ERROR_CODE_CURL_HANDLE || rtn_code == ERROR_CODE_CURL_EASY_PERF + // ### TODO FIXME move this handling trash out of here + if (rtn_code == 0 + || rtn_code == ERROR_CODE_CURL_SOCKET_FAILED + || rtn_code == ERROR_CODE_CURL_HANDLE + || rtn_code == ERROR_CODE_CURL_EASY_PERF || rtn_code == ERROR_CODE_INVALID_PARAM) { - //internal error - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_internal_error); + *out_account_create_cartographer_error_id = _cartographer_error_id_internal_error; } else if (rtn_code == ERROR_CODE_INVALID_EMAIL) { - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_invalid_email); + *out_account_create_cartographer_error_id = _cartographer_error_id_account_create_invalid_email; } else if (rtn_code == ERROR_CODE_INVALID_USERNAME) { - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_invalid_username); + *out_account_create_cartographer_error_id = _cartographer_error_id_account_create_invalid_username; } else if (rtn_code == ERROR_CODE_INVALID_PASSWORD) { - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_invalid_password); + *out_account_create_cartographer_error_id = _cartographer_error_id_account_create_invalid_password; } else if (rtn_code == ERROR_CODE_TAKEN_EMAIL) { - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_email_already_used); + *out_account_create_cartographer_error_id = _cartographer_error_id_account_create_email_already_used; } else if (rtn_code == ERROR_CODE_TAKEN_USERNAME) { - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_username_taken); + *out_account_create_cartographer_error_id = _cartographer_error_id_account_create_username_taken; } else if (rtn_code == ERROR_CODE_BANNED_EMAIL_DOMAIN) { - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_account_create_blacklisted_email_provider); + *out_account_create_cartographer_error_id = _cartographer_error_id_account_create_blacklisted_email_provider; } else { //unknown error! - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_unknown_unhandled_error); + *out_account_create_cartographer_error_id = _cartographer_error_id_unknown_unhandled_error; } } else { - + *out_account_create_cartographer_error_id = _cartographer_error_id_account_create_success; } return result; } diff --git a/xlive/H2MOD/Modules/Accounts/AccountCreate.h b/xlive/H2MOD/Modules/Accounts/AccountCreate.h index 603bec8ca..40d7177fe 100644 --- a/xlive/H2MOD/Modules/Accounts/AccountCreate.h +++ b/xlive/H2MOD/Modules/Accounts/AccountCreate.h @@ -1,3 +1,5 @@ #pragma once -bool HandleGuiAccountCreate(char* username, char* email, char* password); +#include "interface/screens/screen_cartographer_errors.h" + +bool HandleGuiAccountCreate(char* username, char* email, char* password, e_cartographer_error_id* out_account_create_cartographer_error_id);