From d4f82944e2e1bb8ee45c5227b4d134f009bc4774 Mon Sep 17 00:00:00 2001 From: Berthalamew <40469582+Berthalamew@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:36:23 -0500 Subject: [PATCH 1/6] adjust interface headers - type mismatch warnings fixes --- .../screens/screen_brightness_menu.cpp | 3 ++- .../screens/screen_brightness_menu.h | 5 +++- .../screen_cartographer_account_manager.cpp | 7 +++--- .../screen_cartographer_account_manager.h | 4 +++- .../screens/screen_cartographer_errors.cpp | 2 ++ .../screens/screen_cartographer_menus.cpp | 6 ++--- .../screens/screen_cartographer_menus.h | 8 +++---- .../screens/screen_virtual_keyboard.cpp | 2 ++ .../screens/screen_virtual_keyboard.h | 4 +++- .../Engine/interface/user_interface_headers.h | 11 --------- .../interface/user_interface_widget.cpp | 24 +++++++++++-------- .../Engine/interface/user_interface_widget.h | 16 ++++++------- xlive/Blam/Engine/main/main_screenshot.cpp | 2 +- .../Modules/CustomMenu/CustomMenuGlobals.h | 2 +- xlive/Project_Cartographer.vcxproj | 1 - 15 files changed, 51 insertions(+), 46 deletions(-) delete mode 100644 xlive/Blam/Engine/interface/user_interface_headers.h diff --git a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.cpp b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.cpp index 3a21a2eb5..15dc88a9f 100644 --- a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.cpp @@ -1,7 +1,8 @@ #include "stdafx.h" - #include "screen_brightness_menu.h" +#include "interface/user_interface_memory.h" + /* Re-implementation of default brightness menu Now with the abillity to override base class functions diff --git a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h index db64cea31..63d9041cc 100644 --- a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h +++ b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h @@ -1,6 +1,9 @@ #pragma once -#include "interface/user_interface_headers.h" +#include "interface/user_interface_widget.h" +#include "interface/user_interface_widget_list.h" +#include "interface/user_interface_widget_list_item.h" +#include "interface/user_interface_widget_window.h" class c_brightness_level_edit_list : public c_list_widget { 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 d2d49f7d1..194dff413 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp @@ -1,13 +1,14 @@ #include "stdafx.h" #include "screen_cartographer_account_manager.h" +#include "screen_cartographer_errors.h" +#include "screen_virtual_keyboard.h" + #include "main/game_preferences.h" #include "memory/data.h" +#include "interface/user_interface_memory.h" #include "interface/screens/screen_xbox_live_task_progress_dialog.h" -#include "screen_cartographer_errors.h" -#include "screen_virtual_keyboard.h" - #include "H2MOD/GUI/ImGui_Integration/ImGui_Handler.h" #include "H2MOD/Modules/Accounts/Accounts.h" 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 d757ffd1f..bd5de7276 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h @@ -1,5 +1,7 @@ #pragma once -#include "interface/user_interface_headers.h" +#include "interface/user_interface_widget_list.h" +#include "interface/user_interface_widget_list_item.h" +#include "interface/user_interface_widget_window.h" /* macro defines */ diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp index 45352e1c0..5c3c0838a 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp @@ -3,6 +3,8 @@ #include "screen_cartographer_account_manager.h" +#include "interface/user_interface_controller.h" +#include "interface/user_interface_memory.h" #include "interface/user_interface_utilities.h" #include "main/game_preferences.h" diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp index 32c6fb3b8..730e82ed2 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp @@ -1,11 +1,11 @@ #include "stdafx.h" - #include "screen_cartographer_menus.h" -#include "H2MOD/GUI/ImGui_Integration/imgui_handler.h" +#include "main/game_preferences.h" +#include "interface/user_interface_memory.h" +#include "H2MOD/GUI/ImGui_Integration/imgui_handler.h" #include "H2MOD/Modules/CustomMenu/CustomMenuGlobals.h" - #include "H2MOD/Modules/Updater/Updater.h" diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h index 66eacf9d9..5a41d41ec 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h @@ -2,10 +2,10 @@ // miscellaneous cartographer menus -#include "interface/user_interface_headers.h" - -#include "main/game_preferences.h" -#include "H2MOD/Modules/Updater/Updater.h" +#include "interface/user_interface_widget.h" +#include "interface/user_interface_widget_list.h" +#include "interface/user_interface_widget_list_item.h" +#include "interface/user_interface_widget_window.h" /* macro defines */ diff --git a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp index 6d0d47f9e..3680a06f8 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp @@ -1,5 +1,7 @@ #include "stdafx.h" #include "screen_virtual_keyboard.h" + +#include "interface/user_interface_memory.h" #include "main/game_preferences.h" /* macro defines */ diff --git a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h index 71e628dc4..039fd51b7 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h @@ -1,5 +1,7 @@ #pragma once -#include "interface/user_interface_headers.h" +#include "interface/user_interface_widget_button.h" +#include "interface/user_interface_widget_window.h" + #include "saved_games/saved_game_files.h" /* macro defines */ diff --git a/xlive/Blam/Engine/interface/user_interface_headers.h b/xlive/Blam/Engine/interface/user_interface_headers.h deleted file mode 100644 index 7392a34fc..000000000 --- a/xlive/Blam/Engine/interface/user_interface_headers.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include "user_interface.h" -#include "user_interface_memory.h" -#include "user_interface_widget.h" -#include "user_interface_widget_list.h" -#include "user_interface_widget_list_item.h" -#include "user_interface_widget_text.h" -#include "user_interface_widget_window.h" -#include "user_interface_widget_button.h" -#include "user_interface_controller.h" \ No newline at end of file diff --git a/xlive/Blam/Engine/interface/user_interface_widget.cpp b/xlive/Blam/Engine/interface/user_interface_widget.cpp index f4cd6192e..80a262fcd 100644 --- a/xlive/Blam/Engine/interface/user_interface_widget.cpp +++ b/xlive/Blam/Engine/interface/user_interface_widget.cpp @@ -1,7 +1,11 @@ #include "stdafx.h" -#include "interface/user_interface_headers.h" +#include "user_interface.h" +#include "user_interface_controller.h" +#include "user_interface_memory.h" #include "user_interface_widget.h" +#include "user_interface_widget_text.h" +#include "user_interface_widget_window.h" c_user_interface_widget::c_user_interface_widget(e_user_interface_widget_type widget_type, uint16 user_flags) { @@ -48,7 +52,7 @@ void c_user_interface_widget::initialize_animation(s_animation_transform* animat /* public methods */ -e_controller_index c_user_interface_widget::get_any_responding_controller() +e_controller_index c_user_interface_widget::get_any_responding_controller() const { if (TEST_FLAG(m_controllers_mask, _controller_index_0)) return _controller_index_0; @@ -62,32 +66,32 @@ e_controller_index c_user_interface_widget::get_any_responding_controller() return k_no_controller; } -int16 c_user_interface_widget::get_animation_type() +int16 c_user_interface_widget::get_animation_type() const { return this->m_animation_index; } -e_user_interface_widget_type c_user_interface_widget::get_type() +e_user_interface_widget_type c_user_interface_widget::get_type() const { return this->m_widget_type; } -c_user_interface_widget* c_user_interface_widget::get_next() +c_user_interface_widget* c_user_interface_widget::get_next() const { return this->next_widget; } -c_user_interface_widget* c_user_interface_widget::get_previous() +c_user_interface_widget* c_user_interface_widget::get_previous() const { return this->previous_widget; } -c_user_interface_widget* c_user_interface_widget::get_parent() +c_user_interface_widget* c_user_interface_widget::get_parent() const { return this->parent_widget; } -c_user_interface_widget* c_user_interface_widget::get_children() +c_user_interface_widget* c_user_interface_widget::get_children() const { return this->m_child_widget; } @@ -151,7 +155,7 @@ void c_user_interface_widget::add_new_child(c_user_interface_widget* child) INVOKE_TYPE(0x21208E, 0x0, void(__thiscall*)(c_user_interface_widget*, c_user_interface_widget*), this, child); } -void c_user_interface_widget::get_bounds(rectangle2d* bounds) +void c_user_interface_widget::get_bounds(rectangle2d* bounds) const { if (bounds) { @@ -170,7 +174,7 @@ void c_user_interface_widget::set_bounds(rectangle2d* bounds) void c_user_interface_widget::set_controller_mask(uint32 user_mask) { - this->m_controllers_mask = user_mask; + this->m_controllers_mask = (int16)user_mask; } void c_user_interface_widget::set_controller_mask_recursive(uint32 user_mask) diff --git a/xlive/Blam/Engine/interface/user_interface_widget.h b/xlive/Blam/Engine/interface/user_interface_widget.h index e6d71e365..7be820e7b 100644 --- a/xlive/Blam/Engine/interface/user_interface_widget.h +++ b/xlive/Blam/Engine/interface/user_interface_widget.h @@ -97,13 +97,13 @@ class c_user_interface_widget public: c_user_interface_widget(e_user_interface_widget_type widget_type, uint16 user_flags); - e_controller_index get_any_responding_controller(); - int16 get_animation_type(); - e_user_interface_widget_type get_type(); - c_user_interface_widget* get_next(); - c_user_interface_widget* get_previous(); - c_user_interface_widget* get_parent(); - c_user_interface_widget* get_children(); + e_controller_index get_any_responding_controller() const; + int16 get_animation_type() const; + e_user_interface_widget_type get_type() const; + c_user_interface_widget* get_next() const; + c_user_interface_widget* get_previous() const; + c_user_interface_widget* get_parent() const; + c_user_interface_widget* get_children() const; c_user_interface_widget* try_find_child(e_user_interface_widget_type type, uint32 idx, bool recursive_search); c_text_widget* try_find_text_widget(uint32 idx); c_hud_widget* try_find_hud_widget(uint32 idx); @@ -116,7 +116,7 @@ class c_user_interface_widget void set_child_visible(e_user_interface_widget_type type, uint32 idx, bool visible); void set_allocated(bool allocated); void add_new_child(c_user_interface_widget* child); - void get_bounds(rectangle2d* bounds); + void get_bounds(rectangle2d* bounds) const; void set_bounds(rectangle2d* bounds); void set_controller_mask(uint32 user_mask); void set_controller_mask_recursive(uint32 user_mask); diff --git a/xlive/Blam/Engine/main/main_screenshot.cpp b/xlive/Blam/Engine/main/main_screenshot.cpp index f0627164e..836a55557 100644 --- a/xlive/Blam/Engine/main/main_screenshot.cpp +++ b/xlive/Blam/Engine/main/main_screenshot.cpp @@ -129,7 +129,7 @@ bool __cdecl screenshot_render(window_bound* window) if (!movie_globals->in_progress || movie_should_continue()) { const window_bound window_copy = *window; - const int32 tile_count = 1 << screenshot_globals->tile_count_jittered; + const int16 tile_count = 1 << screenshot_globals->tile_count_jittered; screenshot_globals->taking_screenshot = true; int32 horizontal_tiles; diff --git a/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.h b/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.h index 91a9542fb..d3b38be11 100644 --- a/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.h +++ b/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.h @@ -1,6 +1,6 @@ #pragma once -#include "interface/user_interface_headers.h" +#include "interface/user_interface.h" void* ui_custom_cartographer_load_menu(proc_ui_screen_load_cb_t p_ui_screen_proc_cb); void* ui_custom_cartographer_load_menu(proc_ui_screen_load_cb_t p_ui_screen_proc_cb, int open_method); diff --git a/xlive/Project_Cartographer.vcxproj b/xlive/Project_Cartographer.vcxproj index fcf9db1be..ad6af198d 100644 --- a/xlive/Project_Cartographer.vcxproj +++ b/xlive/Project_Cartographer.vcxproj @@ -691,7 +691,6 @@ - From 92a324f5790f27099be3add594db2c3c37de20e1 Mon Sep 17 00:00:00 2001 From: Berthalamew <40469582+Berthalamew@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:27:37 -0500 Subject: [PATCH 2/6] remove KantTesting --- xlive/H2MOD.cpp | 2 -- .../H2MOD/Modules/KantTesting/KantTesting.cpp | 19 -------------- xlive/H2MOD/Modules/KantTesting/KantTesting.h | 25 ------------------- xlive/Project_Cartographer.vcxproj | 2 -- xlive/Project_Cartographer.vcxproj.filters | 2 -- 5 files changed, 50 deletions(-) delete mode 100644 xlive/H2MOD/Modules/KantTesting/KantTesting.cpp delete mode 100644 xlive/H2MOD/Modules/KantTesting/KantTesting.h diff --git a/xlive/H2MOD.cpp b/xlive/H2MOD.cpp index b34d36624..5ac4215a2 100644 --- a/xlive/H2MOD.cpp +++ b/xlive/H2MOD.cpp @@ -84,7 +84,6 @@ #include "H2MOD/Modules/GamePhysics/Patches/ProjectileFix.h" #include "H2MOD/Modules/HaloScript/HaloScript.h" #include "H2MOD/Modules/Input/KeyboardInput.h" -#include "H2MOD/Modules/KantTesting/KantTesting.h" #include "H2MOD/Modules/MainMenu/MapSlots.h" #include "H2MOD/Modules/MainMenu/Ranks.h" #include "H2MOD/Modules/MapManager/MapManager.h" @@ -1187,7 +1186,6 @@ void H2MOD::Initialize() MeleeFix::Initialize(); MapSlots::Initialize(); HaloScript::Initialize(); - KantTesting::Initialize(); ProjectileFix::ApplyPatches(); H2X::ApplyPatches(); H2MOD::ApplyHooks(); diff --git a/xlive/H2MOD/Modules/KantTesting/KantTesting.cpp b/xlive/H2MOD/Modules/KantTesting/KantTesting.cpp deleted file mode 100644 index 4bcbf8840..000000000 --- a/xlive/H2MOD/Modules/KantTesting/KantTesting.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "stdafx.h" -#include "KantTesting.h" - -#include "H2MOD/Modules/EventHandler/EventHandler.hpp" -#include "items/projectile_definition.h" -#include "items/weapon_definitions.h" -#include "scenario/scenario.h" -#include "tag_files/tag_loader/tag_injection.h" - -namespace KantTesting -{ - void MapLoad() - { - } - - void Initialize() - { - } -} diff --git a/xlive/H2MOD/Modules/KantTesting/KantTesting.h b/xlive/H2MOD/Modules/KantTesting/KantTesting.h deleted file mode 100644 index d81d0b3eb..000000000 --- a/xlive/H2MOD/Modules/KantTesting/KantTesting.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#define ENABLEKANTTEST 0 - -namespace KantTesting -{ - /* - struct __declspec(align(8)) s_session_informations_live - { - DWORD dwServerExists; - DWORD time; - char gap8[60]; - BYTE bAlways_1_1; - BYTE bQoSDataAcquired; - WORD unk_word; - s_qos_attempt_data qos; - WORD wAlways_1_2; - char gap6[6]; - int8 session_info[0xA1C]; - char gapp[24]; - }; - ASSERT_STRUCT_SIZE(s_session_informations_live, 0xAA8); - */ - - void Initialize(); -} diff --git a/xlive/Project_Cartographer.vcxproj b/xlive/Project_Cartographer.vcxproj index ad6af198d..1a89f9b9e 100644 --- a/xlive/Project_Cartographer.vcxproj +++ b/xlive/Project_Cartographer.vcxproj @@ -904,7 +904,6 @@ - @@ -1341,7 +1340,6 @@ - diff --git a/xlive/Project_Cartographer.vcxproj.filters b/xlive/Project_Cartographer.vcxproj.filters index 0b852a807..954d8f59c 100644 --- a/xlive/Project_Cartographer.vcxproj.filters +++ b/xlive/Project_Cartographer.vcxproj.filters @@ -57,7 +57,6 @@ - @@ -602,7 +601,6 @@ - From 45df2aa4e725454fb0e73a295d76dcd2233a1f7c Mon Sep 17 00:00:00 2001 From: Berthalamew <40469582+Berthalamew@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:01:55 -0500 Subject: [PATCH 3/6] update cartographer account manager - censor password in menu after it's been typed out - make remember me a checkbox button --- .../screen_cartographer_account_manager.cpp | 330 ++++++++++-------- .../screen_cartographer_account_manager.h | 62 ++-- ...een_cartographer_account_manager_strings.h | 42 +++ .../screens/screen_cartographer_errors.cpp | 7 +- .../screens/screen_virtual_keyboard.cpp | 4 +- .../screens/screen_virtual_keyboard.h | 2 +- 6 files changed, 258 insertions(+), 189 deletions(-) create mode 100644 xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager_strings.h 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 194dff413..dde5ce9b1 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp @@ -1,6 +1,8 @@ -#include "stdafx.h" +#include "stdafx.h" #include "screen_cartographer_account_manager.h" +#include "screen_cartographer_account_manager_strings.h" + #include "screen_cartographer_errors.h" #include "screen_virtual_keyboard.h" @@ -19,10 +21,6 @@ #include "H2MOD/Modules/Shell/Config.h" #include "H2MOD/Utils/Utils.h" -/* macro defines */ - -#define k_cartographer_account_manager_list_name "cartographer account manager list" - /* enums */ enum e_cartographer_screen_type_account_list_string_table @@ -86,12 +84,24 @@ enum e_cartographer_screen_type_account_add_string_table _screen_type_account_add_button_placeholder_username_text = k_screen_type_account_add_button_text_index, _screen_type_account_add_button_placeholder_password_text, _screen_type_account_add_button_remember_me_text, - _screen_type_account_add_button_dont_remember_me_text, - // same index, + 1 when parsed - // ### TODO FIXME improve the system - _screen_type_account_add_button_login_text = _screen_type_account_add_button_dont_remember_me_text, + _screen_type_account_add_button_login_text, + + k_cartographer_screen_type_account_add_string_table_count +}; - k_screen_type_account_add_unknown_label +/* structures */ + +struct s_cartographer_account_create_data +{ + char user_name[XUSER_NAME_SIZE]; + char email[128]; + char password[128]; +}; + +struct s_cartographer_account_login_data +{ + char email_or_username[128]; + char password[128]; }; /* global externs */ @@ -99,30 +109,53 @@ enum e_cartographer_screen_type_account_add_string_table extern bool g_force_cartographer_update; extern void* ui_load_cartographer_update_notice_menu(); -/* forward declarations */ +/* constants */ + +const char* k_cartographer_account_manager_list_name = "cartographer account manager list"; + +const wchar_t** k_screen_label_table_eng[k_cartographer_account_manager_screen_type_count] = +{ + k_screen_type_list_table_eng, + NULL, + k_screen_type_list_create_account_eng, + k_screen_type_list_add_account_eng +}; + +const wchar_t*** k_screen_label_table[k_language_count] = +{ + k_screen_label_table_eng, + k_screen_label_table_eng, + k_screen_label_table_eng, + k_screen_label_table_eng, + k_screen_label_table_eng, + k_screen_label_table_eng, + k_screen_label_table_eng, + k_screen_label_table_eng, + k_screen_label_table_eng +}; -void* ui_load_cartographer_invalid_login_token(); +/* prototypes */ + +void* ui_load_cartographer_invalid_login_token(void); void xbox_live_task_progress_callback(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); +/* +Censors the password string entered if it's not the default password label and returns the pointer to the string. +If password is the default label then return the pointer to password +*/ +static const wchar_t* cartographer_account_manager_set_password_label(const wchar_t* password, wchar_t* password_censored_buffer); -/* global constants */ +/* globals */ static bool g_account_manager_remove_mode; -bool c_cartographer_account_manager_menu::accountingGoBackToList = false; -int c_cartographer_account_manager_menu::accountingActiveHandleCount = 0; - -struct { - char email_or_username[128]; - char password[128]; -} g_account_add_login_data; +bool c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; +int32 c_cartographer_account_manager_menu::g_accounting_active_handle_count = 0; -struct { - char user_name[XUSER_NAME_SIZE]; - char email[128]; - char password[128]; -} g_account_create_data; +s_cartographer_account_login_data g_account_add_login_data; +s_cartographer_account_create_data g_account_create_data; e_cartographer_account_manager_screen_type g_open_cartographer_account_manager_context = _cartographer_account_manager_screen_type_none; @@ -130,55 +163,7 @@ int g_account_manager_master_login_code; HANDLE g_account_manager_login_thread_handle = NULL; HANDLE g_account_manager_thread_handle = NULL; - -static void get_cartographer_account_manager_label(e_cartographer_account_manager_screen_type screen_type, int32 label_id, wchar_t** out_label) -{ - wchar_t** label_table[k_language_count][_carrographer_account_manager_screen_type_end] = {}; - - static wchar_t* screen_type_list_add_account_eng[] = - { - L"Add account", - L"Enter your account's Username\r\n[or Email] and Password to Login.", - L"[Username]", - L"[Password]", - L"-Remember me", - L"-Don't remember me", - L"Login", - L"" - L"", - }; - - static wchar_t* screen_type_list_table_eng[] = - { - L"Online Accounts", - L"Select an Account to Sign in to or use options to create/add/remove them.", - L">Play Offline", - L">Create Account", - L">Add Account", - L"-Remove Account", - L"-Cancel Remove", - L"" - }; - - static wchar_t* screen_type_list_create_account_eng[] = - { - L"Create Account", - L"Enter a username, email and password for your new account.", - L"[Username]", - L"[Email]", - L"[Password]", - L"Create Account", - L"" - }; - - label_table[_language_english][_cartographer_account_manager_screen_type_list] = screen_type_list_table_eng; - label_table[_language_english][_cartographer_account_manager_screen_type_create_account] = screen_type_list_create_account_eng; - label_table[_language_english][_cartographer_account_manager_screen_type_add_account] = screen_type_list_add_account_eng; - - // ### TODO FIXME localization - *out_label = label_table[_language_english][screen_type][label_id]; -} - +/* public code */ c_cartographer_account_manager_edit_list::c_cartographer_account_manager_edit_list(uint16 _flags, int32 _button_count, int32 _default_selected_button, e_cartographer_account_manager_screen_type _screen_type) : c_list_widget(_flags), @@ -198,6 +183,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; switch (m_cartographer_screen_type) { case _cartographer_account_manager_screen_type_none: @@ -208,10 +194,9 @@ c_cartographer_account_manager_edit_list::c_cartographer_account_manager_edit_li case _cartographer_account_manager_screen_type_create_account: csmemset(&m_account_create, 0, sizeof(m_account_create)); - wchar_t* placeholder_username, * placeholder_email, * placeholder_password; - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_button_placeholder_username_text, &placeholder_username); - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_button_placeholder_email_text, &placeholder_email); - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_button_placeholder_password_text, &placeholder_password); + 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); 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)); @@ -219,18 +204,17 @@ c_cartographer_account_manager_edit_list::c_cartographer_account_manager_edit_li case _cartographer_account_manager_screen_type_add_account: csmemset(&m_account_add, 0, sizeof(m_account_add)); - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_button_placeholder_username_text, &placeholder_username); - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_button_placeholder_password_text, &placeholder_password); + placeholder_username = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_button_placeholder_username_text); + placeholder_password = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_button_placeholder_password_text); wcsncpy(m_account_add.email_or_username, placeholder_username, ARRAYSIZE(m_account_add.email_or_username)); wcsncpy(m_account_add.password, placeholder_password, ARRAYSIZE(m_account_add.password)); break; - case _carrographer_account_manager_screen_type_end: default: break; } } -void c_cartographer_account_manager_edit_list::pre_destroy() +void c_cartographer_account_manager_edit_list::pre_destroy(void) { switch (m_cartographer_screen_type) { @@ -243,19 +227,17 @@ void c_cartographer_account_manager_edit_list::pre_destroy() case _cartographer_account_manager_screen_type_add_account: csmemset(&m_account_add, 0, sizeof(m_account_add)); break; - case _cartographer_account_manager_screen_type_none: - case _carrographer_account_manager_screen_type_end: default: break; } } -c_list_item_widget* c_cartographer_account_manager_edit_list::get_list_items() +c_list_item_widget* c_cartographer_account_manager_edit_list::get_list_items(void) { return m_list_item_widgets; } -int32 c_cartographer_account_manager_edit_list::get_list_items_count() +int32 c_cartographer_account_manager_edit_list::get_list_items_count(void) { return NUMBEROF(m_list_item_widgets); } @@ -273,8 +255,12 @@ void c_cartographer_account_manager_edit_list::update_list_items(c_list_item_wid if (text_widget) { int32 button_count_allocated = m_list_data->datum_max_elements; - wchar_t* button_label = nullptr; + const wchar_t* button_label = nullptr; + + // + 1 for the unicode character (nullptr included in original string size) + wchar_t remember_me_text[NUMBEROF(k_remember_me_string_eng) + 1]; wchar_t username_wide[XUSER_NAME_SIZE]; + wchar_t password_censored_buffer_wide[k_cartographer_account_email_and_password_max_length]; switch (m_cartographer_screen_type) { @@ -297,7 +283,7 @@ void c_cartographer_account_manager_edit_list::update_list_items(c_list_item_wid label_index += 1; } - get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, k_screen_type_account_list_button_text_index + label_index, &button_label); + button_label = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, k_screen_type_account_list_button_text_index + label_index); } else { @@ -308,15 +294,15 @@ void c_cartographer_account_manager_edit_list::update_list_items(c_list_item_wid } else { - get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, _screen_type_account_list_button_unnamed_account, &button_label); + button_label = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, _screen_type_account_list_button_unnamed_account); } } } else { // just 3 buttons, play offline, create account and add - int32 label_index = 3 - (button_count_allocated - list_item_index); - get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, k_screen_type_account_list_button_text_index + label_index, &button_label); + const int32 label_index = 3 - (button_count_allocated - list_item_index); + button_label = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, k_screen_type_account_list_button_text_index + label_index); } } break; @@ -330,10 +316,10 @@ void c_cartographer_account_manager_edit_list::update_list_items(c_list_item_wid button_label = m_account_create.email; break; case _screen_type_account_create_button_placeholder_password_text: - button_label = m_account_create.password; + button_label = cartographer_account_manager_set_password_label(m_account_create.password, password_censored_buffer_wide); break; default: - get_cartographer_account_manager_label(m_cartographer_screen_type, k_screen_type_account_create_button_text_index + list_item_index, &button_label); + button_label = get_cartographer_account_manager_label(m_cartographer_screen_type, k_screen_type_account_create_button_text_index + list_item_index); break; } break; @@ -344,18 +330,18 @@ void c_cartographer_account_manager_edit_list::update_list_items(c_list_item_wid button_label = m_account_add.email_or_username; break; case _screen_type_account_add_button_placeholder_password_text: - button_label = m_account_add.password; + button_label = cartographer_account_manager_set_password_label(m_account_add.password, password_censored_buffer_wide); break; case _screen_type_account_add_button_remember_me_text: - get_cartographer_account_manager_label(m_cartographer_screen_type, k_screen_type_account_add_button_text_index + list_item_index + (m_account_add.remember_me ? 0 : 1), &button_label); + button_label = get_cartographer_account_manager_label(m_cartographer_screen_type, k_screen_type_account_add_button_text_index + list_item_index); + usnzprintf(remember_me_text, NUMBEROF(remember_me_text), button_label, m_account_add.remember_me ? L'☑' : L'☐'); + button_label = remember_me_text; break; case _screen_type_account_add_button_login_text: - get_cartographer_account_manager_label(m_cartographer_screen_type, k_screen_type_account_add_button_text_index + list_item_index + 1, &button_label); + button_label = get_cartographer_account_manager_label(m_cartographer_screen_type, k_screen_type_account_add_button_text_index + list_item_index); break; } break; - case _cartographer_account_manager_screen_type_none: - case _carrographer_account_manager_screen_type_end: default: break; } @@ -379,8 +365,6 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event(s_event case _cartographer_account_manager_screen_type_add_account: handle_item_pressed_event_for_add_account(pevent, pitem_index); break; - - case _carrographer_account_manager_screen_type_end: default: break; } @@ -413,8 +397,8 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_add { if (g_account_manager_login_thread_handle == NULL) { - c_cartographer_account_manager_menu::accountingGoBackToList = false; - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(true); + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; + 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); @@ -427,7 +411,7 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_add void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_listed_accounts(s_event_record* event_record, int32* a3) { - int button_id = DATUM_INDEX_TO_ABSOLUTE_INDEX(*a3); + const int32 button_id = DATUM_INDEX_TO_ABSOLUTE_INDEX(*a3); 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(); @@ -466,15 +450,16 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_lis } else if (g_account_manager_login_thread_handle == NULL) { - c_cartographer_account_manager_menu::accountingGoBackToList = false; - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(true); + 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); user_interface_back_out_from_channel(parent_screen_ui_channel, parent_render_window); } } + // play offline button else if (button_id == H2AccountCount) - { // play offline button + { BYTE abEnet[6]; BYTE abOnline[20]; XNetRandom(abEnet, sizeof(abEnet)); @@ -491,12 +476,13 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_lis user_interface_back_out_from_channel(parent_screen_ui_channel, parent_render_window); } } + return; } void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_create_account(s_event_record* event_record, int32* a3) { - int button_id = DATUM_INDEX_TO_ABSOLUTE_INDEX(*a3); + const int32 button_id = DATUM_INDEX_TO_ABSOLUTE_INDEX(*a3); 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(); @@ -517,8 +503,8 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_cre { if (g_account_manager_thread_handle == NULL) { - c_cartographer_account_manager_menu::accountingGoBackToList = false; - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(true); + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; + c_cartographer_account_manager_menu::update_accounting_active_handle(true); snprintf(g_account_create_data.user_name, ARRAYSIZE(g_account_create_data.user_name), "%S", m_account_create.user_name); snprintf(g_account_create_data.email, ARRAYSIZE(g_account_create_data.email), "%S", m_account_create.email); @@ -531,7 +517,6 @@ void c_cartographer_account_manager_edit_list::handle_item_pressed_event_for_cre g_account_manager_thread_handle = CreateThread(NULL, 0, thread_account_create_proc_cb, (LPVOID)0, 0, NULL); } } - return; } @@ -540,6 +525,7 @@ c_cartographer_account_manager_menu::c_cartographer_account_manager_menu(e_user_ m_account_edit_list(_flags, _button_count, _selected_button, _screen_type) { m_cartographer_screen_type = _screen_type; + return; } void c_cartographer_account_manager_menu::pre_destroy() @@ -550,26 +536,26 @@ void c_cartographer_account_manager_menu::pre_destroy() case _cartographer_account_manager_screen_type_list_remove_account: break; case _cartographer_account_manager_screen_type_create_account: - if (c_cartographer_account_manager_menu::accountingGoBackToList - && c_cartographer_account_manager_menu::IsAccountingActiveHandle()) + if (c_cartographer_account_manager_menu::g_accounting_go_back_to_list + && c_cartographer_account_manager_menu::is_accounting_active_handle()) { - c_cartographer_account_manager_menu::accountingGoBackToList = false; + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; } break; case _cartographer_account_manager_screen_type_add_account: - if (c_cartographer_account_manager_menu::accountingGoBackToList - && c_cartographer_account_manager_menu::IsAccountingActiveHandle()) + if (c_cartographer_account_manager_menu::g_accounting_go_back_to_list + && c_cartographer_account_manager_menu::is_accounting_active_handle()) { - c_cartographer_account_manager_menu::accountingGoBackToList = false; + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = false; } break; - - case _carrographer_account_manager_screen_type_end: default: break; } - UpdateAccountingActiveHandle(false); + + update_accounting_active_handle(false); + return; } // c_screen_with_menu specific interface @@ -577,26 +563,24 @@ void c_cartographer_account_manager_menu::initialize(s_screen_parameters* screen { c_screen_with_menu::initialize(screen_parameters); - wchar_t* header_text = nullptr; - wchar_t* subheader_text = nullptr; + const wchar_t* header_text = NULL; + const wchar_t* subheader_text = NULL; switch (m_cartographer_screen_type) { case _cartographer_account_manager_screen_type_list: case _cartographer_account_manager_screen_type_list_remove_account: - get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, _screen_type_account_list_header_text, &header_text); - get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, _screen_type_account_list_subheader_text, &subheader_text); + header_text = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, _screen_type_account_list_header_text); + subheader_text = get_cartographer_account_manager_label(_cartographer_account_manager_screen_type_list, _screen_type_account_list_subheader_text); break; case _cartographer_account_manager_screen_type_create_account: - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_header_text, &header_text); - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_subheader_text, &subheader_text); + header_text = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_header_text); + subheader_text = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_create_subheader_text); break; case _cartographer_account_manager_screen_type_add_account: - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_header_text, &header_text); - get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_subheader_text, &subheader_text); + header_text = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_header_text); + subheader_text = get_cartographer_account_manager_label(m_cartographer_screen_type, _screen_type_account_add_subheader_text); break; - case _cartographer_account_manager_screen_type_none: - case _carrographer_account_manager_screen_type_end: default: break; } @@ -609,30 +593,33 @@ void c_cartographer_account_manager_menu::initialize(s_screen_parameters* screen { subheader_text_widget->set_text(subheader_text); } + return; } -void c_cartographer_account_manager_menu::post_initialize() +void c_cartographer_account_manager_menu::post_initialize(void) { m_account_edit_list.set_focused_item_index(m_account_edit_list.m_default_focused_item != NONE ? m_account_edit_list.m_default_focused_item : 0); return c_screen_with_menu::post_initialize(); } -void* c_cartographer_account_manager_menu::load_proc() +void* c_cartographer_account_manager_menu::load_proc(void) { return c_cartographer_account_manager_menu::load_default_context; } -bool c_cartographer_account_manager_menu::IsAccountingActiveHandle() { - return accountingActiveHandleCount > 0; +bool c_cartographer_account_manager_menu::is_accounting_active_handle(void) +{ + return c_cartographer_account_manager_menu::g_accounting_active_handle_count > 0; } -void c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(bool active) { - accountingActiveHandleCount += active ? 1 : -1; - addDebugText("Accounting active: %d", accountingActiveHandleCount); - if (accountingActiveHandleCount <= 0) { +void c_cartographer_account_manager_menu::update_accounting_active_handle(bool active) { + c_cartographer_account_manager_menu::g_accounting_active_handle_count += active ? 1 : -1; + addDebugText("Accounting active: %d", c_cartographer_account_manager_menu::g_accounting_active_handle_count); + if (c_cartographer_account_manager_menu::g_accounting_active_handle_count <= 0) { SaveH2Accounts(); } + return; } void c_cartographer_account_manager_menu::set_menu_open_context(e_cartographer_account_manager_screen_type screen_type) @@ -651,7 +638,7 @@ void* __cdecl c_cartographer_account_manager_menu::load(s_screen_parameters* par int32 button_count = 0; int32 selected_button_index = 0; - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(true); + c_cartographer_account_manager_menu::update_accounting_active_handle(true); switch (g_open_cartographer_account_manager_context) { case _cartographer_account_manager_screen_type_list: @@ -665,15 +652,13 @@ void* __cdecl c_cartographer_account_manager_menu::load(s_screen_parameters* par case _cartographer_account_manager_screen_type_create_account: button_count = 4; selected_button_index = 0; - c_cartographer_account_manager_menu::accountingGoBackToList = true; + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = true; break; case _cartographer_account_manager_screen_type_add_account: button_count = 4; selected_button_index = 0; - c_cartographer_account_manager_menu::accountingGoBackToList = true; + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = true; break; - case _carrographer_account_manager_screen_type_end: - case _cartographer_account_manager_screen_type_none: default: break; } @@ -720,10 +705,29 @@ c_cartographer_account_manager_menu* c_cartographer_account_manager_menu::load_f return (c_cartographer_account_manager_menu*)ui_custom_cartographer_load_menu(c_cartographer_account_manager_menu::load); } -void* ui_load_cartographer_invalid_login_token() +void cartographer_account_manager_open_list(void) +{ + const bool is_accounting_active_handle = c_cartographer_account_manager_menu::is_accounting_active_handle(); + if (!is_accounting_active_handle && ReadH2Accounts()) + { + c_cartographer_account_manager_menu::load_for_account_list_context(); + } + else + { + if (!is_accounting_active_handle) + { + c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_login_account_already_in_use); + } + } + return; +} + +/* private code */ + +void* ui_load_cartographer_invalid_login_token(void) { - c_cartographer_account_manager_menu::accountingGoBackToList = true; - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(true); + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = true; + c_cartographer_account_manager_menu::update_accounting_active_handle(true); return c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_invalid_login_token); } @@ -842,7 +846,7 @@ DWORD WINAPI thread_account_login_proc_cb(LPVOID lParam) } } - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(false); + c_cartographer_account_manager_menu::update_accounting_active_handle(false); g_account_manager_login_thread_handle = NULL; return 0; @@ -863,20 +867,36 @@ static DWORD WINAPI thread_account_create_proc_cb(LPVOID lParam) SecureZeroMemory(g_account_create_data.password, sizeof(g_account_create_data.password)); } - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(false); + c_cartographer_account_manager_menu::update_accounting_active_handle(false); g_account_manager_thread_handle = NULL; return 0; } -void cartographer_account_manager_open_list() { - if (!c_cartographer_account_manager_menu::IsAccountingActiveHandle() && ReadH2Accounts()) { - c_cartographer_account_manager_menu::load_for_account_list_context(); - } - else { - if (!c_cartographer_account_manager_menu::IsAccountingActiveHandle()) - c_cartographer_error_menu::load_by_error_id(_cartographer_error_id_login_account_already_in_use); - } +static const wchar_t* get_cartographer_account_manager_label(e_cartographer_account_manager_screen_type screen_type, int32 label_id) +{ + const e_language language = get_current_language(); + 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) +{ + 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); + + // 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) + { + // Populate password_censored_buffer 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; + for (; i < length; ++i) + { + password_censored_buffer[i] = L'*'; + } + password_censored_buffer[i] = L'\0'; + } + return is_not_default_password_label ? password_censored_buffer : password; +} 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 bd5de7276..0a38a07d3 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h @@ -3,21 +3,23 @@ #include "interface/user_interface_widget_list_item.h" #include "interface/user_interface_widget_window.h" -/* macro defines */ +/* constants */ #define k_no_of_visible_items_for_cartographer_account_manager_list 4 +#define k_cartographer_account_email_and_password_max_length 128 /* enums */ -enum e_cartographer_account_manager_screen_type +enum e_cartographer_account_manager_screen_type : int8 { - _cartographer_account_manager_screen_type_none = NONE, _cartographer_account_manager_screen_type_list, _cartographer_account_manager_screen_type_list_remove_account, _cartographer_account_manager_screen_type_create_account, - _cartographer_account_manager_screen_type_add_account, - - _carrographer_account_manager_screen_type_end + _cartographer_account_manager_screen_type_add_account, + + k_cartographer_account_manager_screen_type_count, + + _cartographer_account_manager_screen_type_none = NONE, }; /* classes */ @@ -41,15 +43,15 @@ class c_cartographer_account_manager_edit_list : public c_list_widget struct { wchar_t user_name[XUSER_NAME_SIZE]; - wchar_t email[128]; - wchar_t password[128]; + wchar_t email[k_cartographer_account_email_and_password_max_length]; + wchar_t password[k_cartographer_account_email_and_password_max_length]; } m_account_create; struct { bool remember_me; - wchar_t email_or_username[128]; - wchar_t password[128]; + wchar_t email_or_username[k_cartographer_account_email_and_password_max_length]; + wchar_t password[k_cartographer_account_email_and_password_max_length]; } m_account_add; }; // button handler callback @@ -65,17 +67,17 @@ class c_cartographer_account_manager_edit_list : public c_list_widget c_cartographer_account_manager_edit_list(uint16 _flags, int32 _button_count, int32 _default_selected_button, e_cartographer_account_manager_screen_type _screen_type); - bool account_removal_mode() const + bool account_removal_mode(void) const { return m_cartographer_screen_type == _cartographer_account_manager_screen_type_list_remove_account; } // c_cartographer_account_manager_edit_list virtual functions - virtual ~c_cartographer_account_manager_edit_list() = default; - virtual void pre_destroy() override; - virtual c_list_item_widget* get_list_items() override; - virtual int32 get_list_items_count() override; + virtual ~c_cartographer_account_manager_edit_list(void) = default; + virtual void pre_destroy(void) override; + virtual c_list_item_widget* get_list_items(void) override; + virtual int32 get_list_items_count(void) override; virtual void update_list_items(c_list_item_widget* item, int32 skin_index) override; }; @@ -89,32 +91,36 @@ class c_cartographer_account_manager_menu : protected c_screen_with_menu c_cartographer_account_manager_edit_list m_account_edit_list; e_cartographer_account_manager_screen_type m_cartographer_screen_type; + public: + static bool g_accounting_go_back_to_list; + static int32 g_accounting_active_handle_count; + c_cartographer_account_manager_menu(e_user_interface_channel_type _ui_channel, e_user_interface_render_window _window_index, uint16 _flags, e_cartographer_account_manager_screen_type _screen_type, int32 _button_count, int32 _selected_button); - static bool accountingGoBackToList; - static int accountingActiveHandleCount; - static bool IsAccountingActiveHandle(); - static void UpdateAccountingActiveHandle(bool active); + static bool is_accounting_active_handle(void); + static void update_accounting_active_handle(bool active); static void set_menu_open_context(e_cartographer_account_manager_screen_type screen_type); static void* __cdecl load(s_screen_parameters* a1); static void* __cdecl load_default_context(s_screen_parameters* a1); - static c_cartographer_account_manager_menu* load_for_account_create_context(); - static c_cartographer_account_manager_menu* load_for_account_add_context(); - static c_cartographer_account_manager_menu* load_for_account_list_context(); - static c_cartographer_account_manager_menu* load_for_account_remove_from_list_context(); + static c_cartographer_account_manager_menu* load_for_account_create_context(void); + static c_cartographer_account_manager_menu* load_for_account_add_context(void); + 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() = default; - virtual void pre_destroy() override; + virtual ~c_cartographer_account_manager_menu(void) = default; + virtual void pre_destroy(void) override; virtual void initialize(s_screen_parameters* screen_parameters) override; - virtual void post_initialize() override; - virtual void* load_proc() override; + virtual void post_initialize(void) override; + virtual void* load_proc(void) override; }; // ASSERT_STRUCT_SIZE(c_cartographer_account_manager_menu, 3396); -void cartographer_account_manager_open_list(); \ No newline at end of file +/* prototypes */ + +void cartographer_account_manager_open_list(void); 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 new file mode 100644 index 000000000..a711bec0f --- /dev/null +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager_strings.h @@ -0,0 +1,42 @@ +#pragma once + +/* english */ + +const wchar_t k_username_string_eng[] = L"[Username]"; +const wchar_t k_password_string_eng[] = L"[Password]"; +const wchar_t k_remember_me_string_eng[] = L"%c Remember me"; + +const wchar_t* k_screen_type_list_add_account_eng[] = +{ + L"Add account", + L"Enter your account's Username\r\n[or Email] and Password to Login.", + k_username_string_eng, + k_password_string_eng, + k_remember_me_string_eng, + L"Login", + L"" + L"", +}; + +static const wchar_t* k_screen_type_list_table_eng[] = +{ + L"Online Accounts", + L"Select an Account to Sign in to or use options to create/add/remove them.", + L">Play Offline", + L">Create Account", + L">Add Account", + L"-Remove Account", + L"-Cancel Remove", + L"" +}; + +static const wchar_t* k_screen_type_list_create_account_eng[] = +{ + L"Create Account", + L"Enter a username, email and password for your new account.", + k_username_string_eng, + L"[Email]", + k_password_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 5c3c0838a..712dffacb 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp @@ -157,11 +157,12 @@ void c_cartographer_error_menu::pre_destroy() switch (m_error_id) { case _cartographer_error_id_invalid_login_token: - if (c_cartographer_account_manager_menu::accountingGoBackToList && c_cartographer_account_manager_menu::IsAccountingActiveHandle()) { + if (c_cartographer_account_manager_menu::g_accounting_go_back_to_list && c_cartographer_account_manager_menu::is_accounting_active_handle()) + { c_cartographer_account_manager_menu::load_for_account_add_context(); - c_cartographer_account_manager_menu::accountingGoBackToList = true; + c_cartographer_account_manager_menu::g_accounting_go_back_to_list = true; } - c_cartographer_account_manager_menu::UpdateAccountingActiveHandle(false); + c_cartographer_account_manager_menu::update_accounting_active_handle(false); break; case _cartpgrapher_error_id_none: default: diff --git a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp index 3680a06f8..d33ea0146 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp @@ -192,7 +192,7 @@ void* c_screen_virtual_keyboard::load(s_screen_parameters* parameters) return virtual_keyboard_menu; } -void* ui_load_virtual_keyboard(wchar_t* out_keyboard_text, uint32 out_keyboard_text_lenght, e_vkbd_context_type keyboard_type) +void* ui_load_virtual_keyboard(wchar_t* out_keyboard_text, uint32 out_keyboard_text_length, e_vkbd_context_type keyboard_type) { s_screen_parameters virtual_keyboard_params; virtual_keyboard_params.m_context = nullptr; @@ -200,7 +200,7 @@ void* ui_load_virtual_keyboard(wchar_t* out_keyboard_text, uint32 out_keyboard_t c_screen_virtual_keyboard* virtual_keyboard = (c_screen_virtual_keyboard*)virtual_keyboard_params.ui_screen_load_proc_exec(); virtual_keyboard->set_context(keyboard_type); - virtual_keyboard->set_input_string_buffer(out_keyboard_text, out_keyboard_text_lenght); + virtual_keyboard->set_input_string_buffer(out_keyboard_text, out_keyboard_text_length); return virtual_keyboard; } diff --git a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h index 039fd51b7..6ff65cbcc 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h @@ -161,5 +161,5 @@ ASSERT_STRUCT_SIZE(c_screen_virtual_keyboard, 0x3B80); /* public code */ -void* ui_load_virtual_keyboard(wchar_t* out_keyboard_text, uint32 out_keyboard_text_lenght, e_vkbd_context_type keyboard_type); +void* ui_load_virtual_keyboard(wchar_t* out_keyboard_text, uint32 out_keyboard_text_length, e_vkbd_context_type keyboard_type); void ui_set_virtual_keyboard_in_use(bool state); \ No newline at end of file From 6ba58acd7b887044bd2f4b27086eb3cd4e307545 Mon Sep 17 00:00:00 2001 From: Berthalamew <40469582+Berthalamew@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:25:52 -0500 Subject: [PATCH 4/6] make load_proc member function const --- .../Engine/interface/screens/screen_4way_signin.cpp | 4 ++-- .../Blam/Engine/interface/screens/screen_4way_signin.h | 2 +- .../Engine/interface/screens/screen_brightness_menu.h | 8 ++++---- .../screens/screen_cartographer_account_manager.cpp | 2 +- .../screens/screen_cartographer_account_manager.h | 2 +- .../interface/screens/screen_cartographer_errors.cpp | 2 +- .../interface/screens/screen_cartographer_errors.h | 2 +- .../interface/screens/screen_cartographer_menus.cpp | 8 ++++---- .../interface/screens/screen_cartographer_menus.h | 10 +++++----- .../screens/screen_press_start_introduction.cpp | 2 +- .../screens/screen_press_start_introduction.h | 2 +- .../Blam/Engine/interface/screens/screen_settings.cpp | 2 +- xlive/Blam/Engine/interface/screens/screen_settings.h | 2 +- .../Engine/interface/screens/screen_squad_settings.cpp | 2 +- .../Engine/interface/screens/screen_squad_settings.h | 2 +- .../interface/screens/screen_virtual_keyboard.cpp | 2 +- .../Engine/interface/screens/screen_virtual_keyboard.h | 2 +- .../screens/screen_xbox_live_task_progress_dialog.cpp | 2 +- .../screens/screen_xbox_live_task_progress_dialog.h | 2 +- .../Engine/interface/user_interface_widget_window.h | 2 +- 20 files changed, 31 insertions(+), 31 deletions(-) diff --git a/xlive/Blam/Engine/interface/screens/screen_4way_signin.cpp b/xlive/Blam/Engine/interface/screens/screen_4way_signin.cpp index 600238dbb..7fb6f63d3 100644 --- a/xlive/Blam/Engine/interface/screens/screen_4way_signin.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_4way_signin.cpp @@ -377,7 +377,7 @@ void c_screen_4way_signin::initialize(s_screen_parameters* parameters) user_interface_squad_clear_match_playlist(); } -void* c_screen_4way_signin::load_proc() +const void* c_screen_4way_signin::load_proc(void) const { switch (this->m_call_context) { @@ -403,7 +403,7 @@ void* c_screen_4way_signin::load_proc() default: DISPLAY_ASSERT("unreachable"); } - return nullptr; + return NULL; } bool __cdecl user_interface_mainmenu_sign_out_controller_callback(e_controller_index controller_index) diff --git a/xlive/Blam/Engine/interface/screens/screen_4way_signin.h b/xlive/Blam/Engine/interface/screens/screen_4way_signin.h index 7d492f0a5..57ecebc4a 100644 --- a/xlive/Blam/Engine/interface/screens/screen_4way_signin.h +++ b/xlive/Blam/Engine/interface/screens/screen_4way_signin.h @@ -41,6 +41,6 @@ class c_screen_4way_signin : protected c_screen_widget virtual void update() override; virtual bool handle_event(s_event_record* event) override; virtual void initialize(s_screen_parameters* parameters) override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; }; ASSERT_STRUCT_SIZE(c_screen_4way_signin, 0xA60); \ No newline at end of file diff --git a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h index 63d9041cc..f0634fb62 100644 --- a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h +++ b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h @@ -260,9 +260,9 @@ class c_brightness_menu : protected c_screen_with_menu INVOKE_VFPTR_FN(_get_vfptr_table, 37, void(class_type::**)(s_screen_state*), state); } - virtual void* load_proc() override + virtual const void* load_proc(void) const override { - return INVOKE_VFPTR_FN(_get_vfptr_table, 38, void*(class_type::**)()); + return INVOKE_VFPTR_FN(_get_vfptr_table, 38, const void*(class_type::**)() const); } virtual bool overlay_effect_is_disabled() override @@ -282,9 +282,9 @@ class c_brightness_menu : protected c_screen_with_menu private: // reserved name template - static T _get_vfptr_table(DWORD idx) + static const T _get_vfptr_table(DWORD idx) { - return reinterpret_cast(&Memory::GetAddress(0x4D7ABC)[idx]); + return reinterpret_cast(&Memory::GetAddress(0x4D7ABC)[idx]); } }; 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 dde5ce9b1..5befb78e9 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp @@ -602,7 +602,7 @@ void c_cartographer_account_manager_menu::post_initialize(void) return c_screen_with_menu::post_initialize(); } -void* c_cartographer_account_manager_menu::load_proc(void) +const void* c_cartographer_account_manager_menu::load_proc(void) const { return c_cartographer_account_manager_menu::load_default_context; } 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 0a38a07d3..409467967 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h @@ -117,7 +117,7 @@ class c_cartographer_account_manager_menu : protected c_screen_with_menu virtual void pre_destroy(void) override; virtual void initialize(s_screen_parameters* screen_parameters) override; virtual void post_initialize(void) override; - virtual void* load_proc(void) override; + const virtual const void* load_proc(void) const override; }; // ASSERT_STRUCT_SIZE(c_cartographer_account_manager_menu, 3396); diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp index 712dffacb..a7ca8c76c 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.cpp @@ -220,7 +220,7 @@ void c_cartographer_error_menu::initialize(s_screen_parameters* screen_parameter } } -void* c_cartographer_error_menu::load_proc() +const void* c_cartographer_error_menu::load_proc(void) const { return c_cartographer_error_menu::load; } diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h index e526bcbd5..fae08408b 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h @@ -63,7 +63,7 @@ class c_cartographer_error_menu : protected c_screen_widget virtual void pre_destroy() override; virtual bool handle_event(s_event_record* event) override; virtual void initialize(s_screen_parameters* screen_parameters) override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; private: }; diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp index 730e82ed2..a1b1644f6 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.cpp @@ -309,7 +309,7 @@ void c_cartographer_guide_menu::initialize(s_screen_parameters* screen_parameter } } -void* c_cartographer_guide_menu::load_proc() +const void* c_cartographer_guide_menu::load_proc(void) const { return c_cartographer_guide_menu::load; } @@ -383,7 +383,7 @@ void* c_cartographer_credits_menu::load(s_screen_parameters* parameters) return credits_menu; } -void* c_cartographer_credits_menu::load_proc() +const void* c_cartographer_credits_menu::load_proc(void) const { return c_cartographer_credits_menu::load; } @@ -564,7 +564,7 @@ void c_cartographer_update_menu::update() c_screen_with_menu::update(); } -void* c_cartographer_update_menu::load_proc() +const void* c_cartographer_update_menu::load_proc(void) const { return c_cartographer_update_menu::load; } @@ -679,7 +679,7 @@ c_cartographer_update_notice_menu::c_cartographer_update_notice_menu(e_user_inte { } -void* c_cartographer_update_notice_menu::load_proc() +const void* c_cartographer_update_notice_menu::load_proc(void) const { return c_cartographer_update_notice_menu::load; } diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h index 5a41d41ec..bb536a8d4 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h @@ -2,7 +2,7 @@ // miscellaneous cartographer menus -#include "interface/user_interface_widget.h" +#include "interface/user_interface.h" #include "interface/user_interface_widget_list.h" #include "interface/user_interface_widget_list_item.h" #include "interface/user_interface_widget_window.h" @@ -61,7 +61,7 @@ class c_cartographer_guide_menu : public c_screen_with_menu virtual ~c_cartographer_guide_menu() = default; virtual void initialize(s_screen_parameters* screen_parameters) override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; }; @@ -96,7 +96,7 @@ class c_cartographer_credits_menu : public c_screen_with_menu // c_cartographer_credits_menu virtual functions virtual ~c_cartographer_credits_menu() = default; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; virtual void initialize(s_screen_parameters* screen_parameters) override; }; @@ -141,7 +141,7 @@ class c_cartographer_update_menu : public c_screen_with_menu virtual ~c_cartographer_update_menu() = default; virtual void update() override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; virtual void initialize(s_screen_parameters* screen_parameters) override; }; @@ -178,7 +178,7 @@ class c_cartographer_update_notice_menu : public c_screen_with_menu // c_cartographer_update_notice_menu virtual functions. virtual ~c_cartographer_update_notice_menu() = default; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; virtual void initialize(s_screen_parameters* screen_parameters) override; }; diff --git a/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.cpp b/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.cpp index 0acf4228d..589bc3c42 100644 --- a/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.cpp @@ -44,7 +44,7 @@ void c_screen_press_start_introduction::sub_60EBC2(int32 a1) INVOKE_TYPE(0x23F011, 0x0, void(__thiscall*)(c_screen_press_start_introduction*, int32), this, a1); } -void* c_screen_press_start_introduction::load_proc() +const void* c_screen_press_start_introduction::load_proc(void) const { return &c_screen_press_start_introduction::load; } diff --git a/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.h b/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.h index da2eb628d..071da14aa 100644 --- a/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.h +++ b/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.h @@ -29,6 +29,6 @@ class c_screen_press_start_introduction : protected c_screen_widget bool handle_event(s_event_record* event) override; virtual void initialize(s_screen_parameters* parameters) override; virtual void sub_60EBC2(int32 a1) override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; }; ASSERT_STRUCT_SIZE(c_screen_press_start_introduction, 0xB8C); \ No newline at end of file diff --git a/xlive/Blam/Engine/interface/screens/screen_settings.cpp b/xlive/Blam/Engine/interface/screens/screen_settings.cpp index d561f72e0..fd82e6db9 100644 --- a/xlive/Blam/Engine/interface/screens/screen_settings.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_settings.cpp @@ -358,7 +358,7 @@ void c_screen_settings::post_initialize_button_keys() } -void* c_screen_settings::load_proc() +const void* c_screen_settings::load_proc(void) const { return &c_screen_settings::load; } diff --git a/xlive/Blam/Engine/interface/screens/screen_settings.h b/xlive/Blam/Engine/interface/screens/screen_settings.h index ebcb58693..4eb91d8ad 100644 --- a/xlive/Blam/Engine/interface/screens/screen_settings.h +++ b/xlive/Blam/Engine/interface/screens/screen_settings.h @@ -61,6 +61,6 @@ class c_screen_settings : protected c_screen_with_menu virtual ~c_screen_settings() = default; virtual void post_initialize_button_keys() override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; }; ASSERT_STRUCT_SIZE(c_screen_settings, 0xEC8); diff --git a/xlive/Blam/Engine/interface/screens/screen_squad_settings.cpp b/xlive/Blam/Engine/interface/screens/screen_squad_settings.cpp index ef1564407..f313b016f 100644 --- a/xlive/Blam/Engine/interface/screens/screen_squad_settings.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_squad_settings.cpp @@ -687,7 +687,7 @@ void* c_screen_squad_settings::load(s_screen_parameters* parameters) } -void* c_screen_squad_settings::load_proc() +const void* c_screen_squad_settings::load_proc(void) const { return &c_screen_squad_settings::load; } diff --git a/xlive/Blam/Engine/interface/screens/screen_squad_settings.h b/xlive/Blam/Engine/interface/screens/screen_squad_settings.h index 83b0649fe..e54f7a68f 100644 --- a/xlive/Blam/Engine/interface/screens/screen_squad_settings.h +++ b/xlive/Blam/Engine/interface/screens/screen_squad_settings.h @@ -64,6 +64,6 @@ class c_screen_squad_settings : protected c_screen_widget virtual void update() override; virtual bool handle_event(s_event_record* event) override; virtual void initialize(s_screen_parameters* parameters) override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; }; ASSERT_STRUCT_SIZE(c_screen_squad_settings, 0xEC4); diff --git a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp index d33ea0146..55f422da9 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.cpp @@ -145,7 +145,7 @@ void c_screen_virtual_keyboard::initialize(s_screen_parameters* parameters) update_custom_labels(old_context); } -void* c_screen_virtual_keyboard::load_proc() +const void* c_screen_virtual_keyboard::load_proc(void) const { return &c_screen_virtual_keyboard::load; } diff --git a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h index 6ff65cbcc..36f6862d5 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h @@ -155,7 +155,7 @@ class c_screen_virtual_keyboard : protected c_screen_widget virtual void render_widget(rectangle2d* viewport_bounds) override; virtual bool handle_event(s_event_record* event) override; virtual void initialize(s_screen_parameters* parameters) override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; }; ASSERT_STRUCT_SIZE(c_screen_virtual_keyboard, 0x3B80); 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 994788613..130ed9021 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 @@ -78,7 +78,7 @@ void c_screen_xbox_live_task_progress_dialog::initialize(s_screen_parameters* pa this->setup_children(); } -void* c_screen_xbox_live_task_progress_dialog::load_proc() +const void* c_screen_xbox_live_task_progress_dialog::load_proc(void) const { return &c_screen_xbox_live_task_progress_dialog::load; } diff --git a/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.h b/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.h index ed500f948..054e2fe6f 100644 --- a/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.h +++ b/xlive/Blam/Engine/interface/screens/screen_xbox_live_task_progress_dialog.h @@ -43,6 +43,6 @@ class c_screen_xbox_live_task_progress_dialog : c_screen_widget virtual void update() override; virtual bool handle_event(s_event_record* event) override; virtual void initialize(s_screen_parameters* parameters) override; - virtual void* load_proc() override; + virtual const void* load_proc(void) const override; }; ASSERT_STRUCT_SIZE(c_screen_xbox_live_task_progress_dialog, 0xA70); \ No newline at end of file diff --git a/xlive/Blam/Engine/interface/user_interface_widget_window.h b/xlive/Blam/Engine/interface/user_interface_widget_window.h index 5e3a16b6a..a746459b2 100644 --- a/xlive/Blam/Engine/interface/user_interface_widget_window.h +++ b/xlive/Blam/Engine/interface/user_interface_widget_window.h @@ -440,7 +440,7 @@ class c_screen_widget : public c_user_interface_widget virtual void sub_60EBC2(int32 a1); virtual void* sub_60EC5C(s_screen_state* state); virtual void sub_60ECC9(s_screen_state* state); - virtual void* load_proc() = 0; + virtual const void* load_proc(void) const = 0; virtual bool overlay_effect_is_disabled(); virtual void set_favourites_bitmap_visible(bool show_icon); From b29c0d8d75d1f3e2f10c760f1fd25482861088bf Mon Sep 17 00:00:00 2001 From: Berthalamew <40469582+Berthalamew@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:33:13 -0500 Subject: [PATCH 5/6] misc vcxproj changes - prevent imgui_demo from being compiled - add screen_cartographer_account_manager_strings as include --- xlive/Project_Cartographer.vcxproj | 5 +---- xlive/Project_Cartographer.vcxproj.filters | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/xlive/Project_Cartographer.vcxproj b/xlive/Project_Cartographer.vcxproj index 1a89f9b9e..0bf179bc0 100644 --- a/xlive/Project_Cartographer.vcxproj +++ b/xlive/Project_Cartographer.vcxproj @@ -221,10 +221,6 @@ NotUsing NotUsing - - NotUsing - NotUsing - NotUsing NotUsing @@ -684,6 +680,7 @@ + diff --git a/xlive/Project_Cartographer.vcxproj.filters b/xlive/Project_Cartographer.vcxproj.filters index 954d8f59c..ad23e3804 100644 --- a/xlive/Project_Cartographer.vcxproj.filters +++ b/xlive/Project_Cartographer.vcxproj.filters @@ -10,7 +10,6 @@ - @@ -79,7 +78,6 @@ - @@ -99,7 +97,6 @@ - @@ -547,7 +544,6 @@ - @@ -627,7 +623,6 @@ - @@ -1077,7 +1072,6 @@ - @@ -1176,6 +1170,7 @@ + From c68148497ca1084361319ad7c55d0eff81ce1fdc Mon Sep 17 00:00:00 2001 From: Berthalamew <40469582+Berthalamew@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:46:06 -0500 Subject: [PATCH 6/6] fix type mismatch warnings --- .../animations/animation_definitions.cpp | 4 ++-- .../Engine/animations/animation_definitions.h | 2 +- xlive/Blam/Engine/game/player_vibration.cpp | 6 ++--- xlive/Blam/Engine/interface/interface.cpp | 4 ++-- xlive/Blam/Engine/interface/new_hud_draw.cpp | 4 ++-- xlive/Blam/Engine/interface/new_hud_draw.h | 2 +- .../screen_cartographer_account_manager.h | 2 +- .../Engine/interface/user_interface_guide.cpp | 2 ++ .../interface/user_interface_utilities.cpp | 1 - .../dx9/rasterizer_dx9_lens_flares.cpp | 16 ++++++------- .../rasterizer/dx9/rasterizer_dx9_targets.cpp | 23 +++++++++--------- .../render/render_cartographer_ingame_ui.cpp | 6 ++--- xlive/Blam/Engine/text/font_cache.cpp | 17 +++++++------ xlive/Blam/Engine/text/font_cache.h | 6 +++-- .../imgui_integration/AdvancedSettings.cpp | 24 +++++++++---------- xlive/XLive/achievements/XAchievements.cpp | 6 ++--- xlive/XLive/achievements/XAchievements.h | 2 +- xlive/xliveless.cpp | 16 ++++++------- 18 files changed, 74 insertions(+), 69 deletions(-) diff --git a/xlive/Blam/Engine/animations/animation_definitions.cpp b/xlive/Blam/Engine/animations/animation_definitions.cpp index 2ced325c5..3a32a4be4 100644 --- a/xlive/Blam/Engine/animations/animation_definitions.cpp +++ b/xlive/Blam/Engine/animations/animation_definitions.cpp @@ -113,7 +113,7 @@ int16 c_model_animation::find_first_key_of_type(const e_frame_event_type event_t return result; } -int16 c_model_animation::find_first_sound_event(int32* sound) const +int16 c_model_animation::find_first_sound_event(int16* sound) const { int16 frame = 0; if (this->sound_events.count > 0) @@ -252,7 +252,7 @@ size_t c_model_animation::get_sound_events_size(void) const int16 c_model_animation::get_sound_reference_index(void) const { - int32 sound = NONE; + int16 sound = NONE; this->find_first_sound_event(&sound); return sound; } diff --git a/xlive/Blam/Engine/animations/animation_definitions.h b/xlive/Blam/Engine/animations/animation_definitions.h index ec84b2d34..f4c4d2ccc 100644 --- a/xlive/Blam/Engine/animations/animation_definitions.h +++ b/xlive/Blam/Engine/animations/animation_definitions.h @@ -335,7 +335,7 @@ class c_model_animation public: bool animation_is_world_relative(void) const; int16 find_first_key_of_type(const e_frame_event_type event_type) const; - int16 find_first_sound_event(int32* sound) const; + int16 find_first_sound_event(int16* sound) const; int16 find_next_key_of_type(const e_frame_event_type event_type, const int32 frame) const; e_animation_type get_animation_type(void) const; real32 get_authored_duration(void) const; diff --git a/xlive/Blam/Engine/game/player_vibration.cpp b/xlive/Blam/Engine/game/player_vibration.cpp index 5edcc2243..8be0ca89e 100644 --- a/xlive/Blam/Engine/game/player_vibration.cpp +++ b/xlive/Blam/Engine/game/player_vibration.cpp @@ -89,11 +89,9 @@ void __cdecl vibration_update(real32 dt) } } - for (uint32 controller_index = 0; controller_index < NUMBEROF(controller_vibration_states); ++controller_index) + for (int16 controller_index = 0; controller_index < NUMBEROF(controller_vibration_states); ++controller_index) { - const XINPUT_VIBRATION state = controller_vibration_states[controller_index]; - - input_set_gamepad_rumbler_state(controller_index, state.wLeftMotorSpeed, state.wRightMotorSpeed); + input_set_gamepad_rumbler_state(controller_index, controller_vibration_states[controller_index].wLeftMotorSpeed, controller_vibration_states[controller_index].wRightMotorSpeed); } } } diff --git a/xlive/Blam/Engine/interface/interface.cpp b/xlive/Blam/Engine/interface/interface.cpp index 2e623b839..255eb7181 100644 --- a/xlive/Blam/Engine/interface/interface.cpp +++ b/xlive/Blam/Engine/interface/interface.cpp @@ -111,8 +111,8 @@ void render_splitscreen_line(void) ASSERT(IN_RANGE(player_window_count, 1, 4)); const s_rasterizer_globals* rasterizer_globals = rasterizer_globals_get(); - const int32 resolution_x = rasterizer_globals->resolution_x; - const int32 resolution_y = rasterizer_globals->resolution_y; + const int16 resolution_x = (int16)rasterizer_globals->resolution_x; + const int16 resolution_y = (int16)rasterizer_globals->resolution_y; // We calculate the size of the line by dividing our resolution by the height the original game ran at const int32 line_size = resolution_y / 480; diff --git a/xlive/Blam/Engine/interface/new_hud_draw.cpp b/xlive/Blam/Engine/interface/new_hud_draw.cpp index 61675902e..fa4736c23 100644 --- a/xlive/Blam/Engine/interface/new_hud_draw.cpp +++ b/xlive/Blam/Engine/interface/new_hud_draw.cpp @@ -797,9 +797,9 @@ datum hud_bitmap_tag_index_get(void) return *Memory::GetAddress(0x976678); } -int32 hud_bitmap_data_index_get(void) +int16 hud_bitmap_data_index_get(void) { - return *Memory::GetAddress(0x97667C); + return *Memory::GetAddress(0x97667C); } void hud_player_indicators_draw_enabled_set(int32 user_index, bool enabled) diff --git a/xlive/Blam/Engine/interface/new_hud_draw.h b/xlive/Blam/Engine/interface/new_hud_draw.h index 1ed8b2951..0484a8eb5 100644 --- a/xlive/Blam/Engine/interface/new_hud_draw.h +++ b/xlive/Blam/Engine/interface/new_hud_draw.h @@ -16,7 +16,7 @@ void hud_draw_on_map_load(void); datum hud_bitmap_tag_index_get(void); -int32 hud_bitmap_data_index_get(void); +int16 hud_bitmap_data_index_get(void); void hud_player_indicators_draw_enabled_set(int32 user_index, bool enabled); 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 409467967..0eff7c973 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h @@ -117,7 +117,7 @@ class c_cartographer_account_manager_menu : protected c_screen_with_menu virtual void pre_destroy(void) override; virtual void initialize(s_screen_parameters* screen_parameters) override; virtual void post_initialize(void) override; - const virtual const void* load_proc(void) const override; + virtual const void* load_proc(void) const override; }; // ASSERT_STRUCT_SIZE(c_cartographer_account_manager_menu, 3396); diff --git a/xlive/Blam/Engine/interface/user_interface_guide.cpp b/xlive/Blam/Engine/interface/user_interface_guide.cpp index fc9a48196..991857cfb 100644 --- a/xlive/Blam/Engine/interface/user_interface_guide.cpp +++ b/xlive/Blam/Engine/interface/user_interface_guide.cpp @@ -2,6 +2,7 @@ #include "user_interface_guide.h" #include "screens/screen_cartographer_account_manager.h" +/* public code */ c_user_interface_guide_state_manager* user_interface_guide_state_manager_get(void) { @@ -13,4 +14,5 @@ void c_user_interface_guide_state_manager::add_user_signin_task(bool sign_to_liv //INVOKE_TYPE(0xDD7550, 0x0, int(__thiscall*)(c_user_interface_guide_state_manager*, bool, void*), this, sign_to_live, signin_callback); this->m_callback_task = signin_callback; cartographer_account_manager_open_list(); + return; } diff --git a/xlive/Blam/Engine/interface/user_interface_utilities.cpp b/xlive/Blam/Engine/interface/user_interface_utilities.cpp index 349ccd14e..aa4194d12 100644 --- a/xlive/Blam/Engine/interface/user_interface_utilities.cpp +++ b/xlive/Blam/Engine/interface/user_interface_utilities.cpp @@ -3,7 +3,6 @@ #include "hud.h" #include "user_interface_controller.h" -#include "rasterizer/rasterizer_globals.h" #include "render/render.h" datum __cdecl user_interface_get_widget_tag_index_from_screen_id(e_user_interface_screen_id screen_id) diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_lens_flares.cpp b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_lens_flares.cpp index 0b5df6f06..7889b542e 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_lens_flares.cpp +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_lens_flares.cpp @@ -102,10 +102,10 @@ e_rasterizer_target rasterizer_dx9_sun_glow_draw(datum tag_index, real_point3d* real32 viewport_middle_y = (real32)(viewport_height / 2); RECT rect; - rect.left = viewport_left + (viewport_width * sun_surface_quad.x0 / 2.0f + viewport_middle_x); - rect.top = viewport_bottom - (viewport_height * sun_surface_quad.y1 / 2.0f + viewport_middle_y); - rect.right = viewport_left + (viewport_width * sun_surface_quad.x1 / 2.0f + viewport_middle_x); - rect.bottom = viewport_bottom - (viewport_height * sun_surface_quad.y0 / 2.0f + viewport_middle_y); + rect.left = (LONG)(viewport_left + (viewport_width * sun_surface_quad.x0 / 2.0f + viewport_middle_x)); + rect.top = (LONG)(viewport_bottom - (viewport_height * sun_surface_quad.y1 / 2.0f + viewport_middle_y)); + rect.right = (LONG)(viewport_left + (viewport_width * sun_surface_quad.x1 / 2.0f + viewport_middle_x)); + rect.bottom = (LONG)(viewport_bottom - (viewport_height * sun_surface_quad.y0 / 2.0f + viewport_middle_y)); // Make sure we limit the rect to within the bounds of the viewport // Without this the StretchRect call to copy to the sun target will fail @@ -363,10 +363,10 @@ void rasterizer_dx9_sun_glow_copy_source(const RECT* rect, e_rasterizer_target t real_rectangle2d rectangle; if (rect) { - rectangle.x0 = rect->left; - rectangle.x1 = rect->right; - rectangle.y0 = rect->top; - rectangle.y1 = rect->bottom; + rectangle.x0 = (real32)rect->left; + rectangle.x1 = (real32)rect->right; + rectangle.y0 = (real32)rect->top; + rectangle.y1 = (real32)rect->bottom; p_rect = &rectangle; } diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp index f1a36d642..9a4ca2df9 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp @@ -171,13 +171,14 @@ void __cdecl rasterizer_set_render_target_internal_hook_set_viewport(IDirect3DSu // NOTE: *ONLY* use this function for entire screen surfaces (e.g the backbuffer, a render target) rasterizer_dx9_set_render_target_internal(target, z_stencil, a3); - D3DVIEWPORT9 vp = { - global_camera->viewport_bounds.left, - global_camera->viewport_bounds.top, - rectangle2d_width(&global_camera->viewport_bounds), - rectangle2d_height(&global_camera->viewport_bounds), - 0.0f, - 1.0f + D3DVIEWPORT9 vp = + { + (DWORD)global_camera->viewport_bounds.left, + (DWORD)global_camera->viewport_bounds.top, + (DWORD)rectangle2d_width(&global_camera->viewport_bounds), + (DWORD)rectangle2d_height(&global_camera->viewport_bounds), + 0.f, + 1.f }; // set the viewport, after setting the main render target // to note that the viewport will always gets reset when a new render target is set @@ -528,10 +529,10 @@ void __cdecl rasterizer_dx9_set_target(e_rasterizer_target rasterizer_target, in else { viewport_scale = 1.0; - viewport.X = global_window_parameters->camera.viewport_bounds.left * viewport_scale; - viewport.Y = global_window_parameters->camera.viewport_bounds.top * viewport_scale; - viewport.Width = viewport_width * viewport_scale; - viewport.Height = viewport_height * viewport_scale; + viewport.X = (DWORD)(global_window_parameters->camera.viewport_bounds.left * viewport_scale); + viewport.Y = (DWORD)(global_window_parameters->camera.viewport_bounds.top * viewport_scale); + viewport.Width = (DWORD)(viewport_width * viewport_scale); + viewport.Height = (DWORD)(viewport_height * viewport_scale); } } // By default set the viewport as the desc params diff --git a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp index 39e6955fa..eeac09950 100644 --- a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp +++ b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp @@ -105,7 +105,7 @@ void render_cartographer_status_bar(const char *build_text) text_color_console.alpha = .5f; } - const int32 line_height = get_text_size_from_font_cache(k_status_text_font); + const int16 line_height = get_text_size_from_font_cache(k_status_text_font); bool paused_or_in_main_menu = game_is_main_menu || paused_or_in_menus; if (paused_or_in_main_menu) { @@ -133,7 +133,7 @@ void render_cartographer_git_build_info(void) #if defined(GEN_GIT_VER_VERSION_STRING) && defined(CARTOGRAPHER_TEST_BUILD_DRAW_TEXT) const s_rasterizer_globals* rasterizer_globals = rasterizer_globals_get(); - const int32 line_height = get_text_size_from_font_cache(k_status_text_font); + const int16 line_height = get_text_size_from_font_cache(k_status_text_font); real_argb_color text_color_console = *global_real_argb_white; text_color_console.alpha = .55f; @@ -172,7 +172,7 @@ bool render_cartographer_achievement_message(const char *achivement_message) { rectangle2d bounds; wchar_t cheevo_message[256]; - int32 widget_total_height = get_text_size_from_font_cache(k_cheevo_title_font) + (get_text_size_from_font_cache(k_cheevo_message_font) * 2); + const int16 widget_total_height = get_text_size_from_font_cache(k_cheevo_title_font) + (get_text_size_from_font_cache(k_cheevo_message_font) * 2); real_argb_color text_color = *global_real_argb_white; text_color.alpha = (float)(x_cheevo_timer - time_now) / k_cheevo_display_lifetime; diff --git a/xlive/Blam/Engine/text/font_cache.cpp b/xlive/Blam/Engine/text/font_cache.cpp index 5e210148e..c5a57b01b 100644 --- a/xlive/Blam/Engine/text/font_cache.cpp +++ b/xlive/Blam/Engine/text/font_cache.cpp @@ -3,15 +3,18 @@ #include "interface/hud.h" +/* public code */ -// Multiply font size by the global text scale to fix scaling issues on resolutions higher than 1080 pixels vertically -int __cdecl get_text_size_from_font_cache(int font_cache_index) +void font_group_apply_hooks(void) { - auto p_get_text_size_from_font_cache = Memory::GetAddress(0x31865); - return (int)((float)p_get_text_size_from_font_cache(font_cache_index) * *get_secondary_hud_scale()); + PatchCall(Memory::GetAddress(0x6AE0D), get_text_size_from_font_cache); + return; } -void font_group_apply_hooks() +// Multiply font size by the global text scale to fix scaling issues on resolutions higher than 1080 pixels vertically +int16 __cdecl get_text_size_from_font_cache(int32 font_cache_index) { - PatchCall(Memory::GetAddress(0x6AE0D), get_text_size_from_font_cache); -} \ No newline at end of file + int16 size = INVOKE(0x31865, 0x0, get_text_size_from_font_cache, font_cache_index); + return (int16)(size * *get_secondary_hud_scale()); +} + diff --git a/xlive/Blam/Engine/text/font_cache.h b/xlive/Blam/Engine/text/font_cache.h index 4b15d20b3..72722de68 100644 --- a/xlive/Blam/Engine/text/font_cache.h +++ b/xlive/Blam/Engine/text/font_cache.h @@ -1,5 +1,7 @@ #pragma once -int __cdecl get_text_size_from_font_cache(int font_cache_index); +/* prototypes */ -void font_group_apply_hooks(); +void font_group_apply_hooks(void); + +int16 __cdecl get_text_size_from_font_cache(int32 font_cache_index); diff --git a/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp b/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp index 729f59319..7944d94a4 100644 --- a/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp +++ b/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp @@ -32,7 +32,7 @@ const char* k_button_items[] = { "Dpad Up","Dpad Down","Dpad Left","Dpad Right","Start","Back","Left Thumb","Right Thumb","Left Bumper","Right Bumper","A","B","X","Y" }; const char* k_action_items[] = { "Dpad Up","Dpad Down","Dpad Left","Dpad Right","Start","Back","Crouch","Zoom","Flashlight","Switch Grenades","Jump","Melee","Reload","Switch Weapons" }; -const uint32 k_button_values[k_number_of_xinput_buttons] = +const uint16 k_button_values[k_number_of_xinput_buttons] = { XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, @@ -93,17 +93,17 @@ namespace ImGuiHandler { if (current_cartographer_profile->controller_deadzone_type == _controller_deadzone_type_axial || current_cartographer_profile->controller_deadzone_type == _controller_deadzone_type_combined) { - int X_Axis = current_cartographer_profile->deadzone_axial.x; - int Y_Axis = current_cartographer_profile->deadzone_axial.y; + real32 x_axis = current_cartographer_profile->deadzone_axial.x; + real32 y_axis = current_cartographer_profile->deadzone_axial.y; ImVec2 Y_TopLeft( Center.x - 100, - Center.y - Y_Axis); + Center.y - y_axis); ImVec2 Y_BottomRight( Center.x + 100, - Center.y + Y_Axis); + Center.y + y_axis); draw_list->AddRectFilled(Y_TopLeft, Y_BottomRight, ImColor(20, 20, 20, 125)); - ImVec2 X_TopLeft(Center.x - X_Axis, Center.y - 100); - ImVec2 X_BottomRight(Center.x + X_Axis, Center.y + 100); + ImVec2 X_TopLeft(Center.x - x_axis, Center.y - 100); + ImVec2 X_BottomRight(Center.x + x_axis, Center.y + 100); draw_list->AddRectFilled(X_TopLeft, X_BottomRight, ImColor(20, 20, 20, 125)); } if (current_cartographer_profile->controller_deadzone_type == _controller_deadzone_type_radial @@ -124,10 +124,10 @@ namespace ImGuiHandler { if (abs(state->thumb_right.y) <= THUMBSTICK_PERCENTAGE_TO_POINT(current_cartographer_profile->deadzone_axial.y)) axial_invalid++; bool radial_invalid = false; - unsigned int ar = pow((short)THUMBSTICK_PERCENTAGE_TO_POINT(current_cartographer_profile->deadzone_radial), 2); - unsigned int arx = pow(state->thumb_right.x, 2); - unsigned int ary = pow(state->thumb_right.y, 2); - unsigned int rh = arx + ary; + uint32 ar = (uint32)pow((short)THUMBSTICK_PERCENTAGE_TO_POINT(current_cartographer_profile->deadzone_radial), 2); + uint32 arx = (uint32)pow(state->thumb_right.x, 2); + uint32 ary = (uint32)pow(state->thumb_right.y, 2); + uint32 rh = arx + ary; if (rh <= ar) { radial_invalid = true; @@ -219,7 +219,7 @@ namespace ImGuiHandler { ImGui::PushItemWidth(WidthPercentage(10)); ImGui::InputFloat("##Crosshair2", ¤t_cartographer_profile->crosshair_offset, 0, 110, "%.3f"); ImGui::SameLine(); if (ImGui::IsItemEdited()) { - current_cartographer_profile->crosshair_offset = PIN(current_cartographer_profile->crosshair_offset, 0, 0.5); + current_cartographer_profile->crosshair_offset = PIN(current_cartographer_profile->crosshair_offset, 0.f, 0.5f); } ImGui::PushItemWidth(WidthPercentage(10)); if (ImGui::Button(advanced_settings_get_string(_advanced_string_reset, "Crosshair3"), b2_size)) diff --git a/xlive/XLive/achievements/XAchievements.cpp b/xlive/XLive/achievements/XAchievements.cpp index 152b7d274..2ee4a5978 100644 --- a/xlive/XLive/achievements/XAchievements.cpp +++ b/xlive/XLive/achievements/XAchievements.cpp @@ -4,9 +4,9 @@ #include "H2MOD/Modules/Achievements/Achievements.h" -int achievementCount = 0; -int achievementEnumeratorFlags = 0; -int achievementEnumeratorIndex = 0; +DWORD achievementCount = 0; +DWORD achievementEnumeratorFlags = 0; +DWORD achievementEnumeratorIndex = 0; extern void Check_Overlapped(PXOVERLAPPED pOverlapped); HANDLE g_dwFakeAchievementContent = INVALID_HANDLE_VALUE; diff --git a/xlive/XLive/achievements/XAchievements.h b/xlive/XLive/achievements/XAchievements.h index bccc2a88f..787d0d1a6 100644 --- a/xlive/XLive/achievements/XAchievements.h +++ b/xlive/XLive/achievements/XAchievements.h @@ -1,5 +1,5 @@ #pragma once -extern int achievementCount; +extern DWORD achievementCount; extern HANDLE g_dwFakeAchievementContent; #define XACHIEVEMENT_TYPE_COMPLETION 1 diff --git a/xlive/xliveless.cpp b/xlive/xliveless.cpp index 03d8f794a..8cdbf7bcb 100644 --- a/xlive/xliveless.cpp +++ b/xlive/xliveless.cpp @@ -134,19 +134,19 @@ LONG WINAPI XLivePBufferAllocate (DWORD size, FakePBuffer **pBuffer) //initialize fake buffer *pBuffer = (FakePBuffer*)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,sizeof(FakePBuffer)); - (*pBuffer)->dwSize = size; - (*pBuffer)->id = CreateMutex(NULL,NULL,NULL); - (*pBuffer)->magic = 0xDEADC0DE; - - //initialize real buffer inside fake buffer - (*pBuffer)->pbData = (PBYTE)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,size); - if(!*pBuffer) { LOG_ERROR_XLIVE("XLivePBufferAllocate() unable to allocate {} bytes", size); return E_OUTOFMEMORY; } + (*pBuffer)->dwSize = size; + (*pBuffer)->id = CreateMutex(NULL, NULL, NULL); + (*pBuffer)->magic = 0xDEADC0DE; + + //initialize real buffer inside fake buffer + (*pBuffer)->pbData = (PBYTE)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, size); + return 0; } @@ -342,7 +342,7 @@ DWORD WINAPI XStringVerify( DWORD dwFlags, const CHAR *szLocale, DWORD dwNumStri if( pResults ) { - pResults->wNumStrings = dwNumStrings; + pResults->wNumStrings = (WORD)dwNumStrings; pResults->pStringResult = (HRESULT *) ((BYTE *) pResults + sizeof(STRING_VERIFY_RESPONSE));