Skip to content

Commit

Permalink
fix type mismatch warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Berthalamew committed Dec 5, 2024
1 parent b29c0d8 commit c681484
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 69 deletions.
4 changes: 2 additions & 2 deletions xlive/Blam/Engine/animations/animation_definitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion xlive/Blam/Engine/animations/animation_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions xlive/Blam/Engine/game/player_vibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions xlive/Blam/Engine/interface/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions xlive/Blam/Engine/interface/new_hud_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,9 @@ datum hud_bitmap_tag_index_get(void)
return *Memory::GetAddress<datum*>(0x976678);
}

int32 hud_bitmap_data_index_get(void)
int16 hud_bitmap_data_index_get(void)
{
return *Memory::GetAddress<int32*>(0x97667C);
return *Memory::GetAddress<int16*>(0x97667C);
}

void hud_player_indicators_draw_enabled_set(int32 user_index, bool enabled)
Expand Down
2 changes: 1 addition & 1 deletion xlive/Blam/Engine/interface/new_hud_draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions xlive/Blam/Engine/interface/user_interface_guide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}
1 change: 0 additions & 1 deletion xlive/Blam/Engine/interface/user_interface_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_lens_flares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
23 changes: 12 additions & 11 deletions xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
17 changes: 10 additions & 7 deletions xlive/Blam/Engine/text/font_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int(__cdecl*)(int)>(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);
}
int16 size = INVOKE(0x31865, 0x0, get_text_size_from_font_cache, font_cache_index);
return (int16)(size * *get_secondary_hud_scale());
}

6 changes: 4 additions & 2 deletions xlive/Blam/Engine/text/font_cache.h
Original file line number Diff line number Diff line change
@@ -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);
24 changes: 12 additions & 12 deletions xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -219,7 +219,7 @@ namespace ImGuiHandler {
ImGui::PushItemWidth(WidthPercentage(10));
ImGui::InputFloat("##Crosshair2", &current_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))
Expand Down
6 changes: 3 additions & 3 deletions xlive/XLive/achievements/XAchievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion xlive/XLive/achievements/XAchievements.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
extern int achievementCount;
extern DWORD achievementCount;
extern HANDLE g_dwFakeAchievementContent;

#define XACHIEVEMENT_TYPE_COMPLETION 1
Expand Down
16 changes: 8 additions & 8 deletions xlive/xliveless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));


Expand Down

0 comments on commit c681484

Please sign in to comment.