From 3c0afcdea5b4ee9fa542ee44492be971e1fb45dc Mon Sep 17 00:00:00 2001 From: Berthalamew <40469582+Berthalamew@users.noreply.github.com> Date: Tue, 23 Dec 2025 15:03:49 -0500 Subject: [PATCH] separate xlive project into different project and lib files --- .github/workflows/build.yaml | 2 +- .gitignore | 11 +- Project_Cartographer.sln | 134 +- xlive/3rdparty/imgui/imguilib.vcxproj | 3 + xlive/3rdparty/zlib/zlib.vcxproj | 6 +- xlive/Blam/Engine/ai/actors.h | 1 - xlive/Blam/Engine/ailib/ailib.vcxproj | 256 ++ xlive/Blam/Engine/ailib/ailib.vcxproj.filters | 177 ++ xlive/Blam/Engine/ailib/stdafx.cpp | 1 + xlive/Blam/Engine/ailib/stdafx.h | 32 + .../Engine/animations/animation_channel.h | 1 - .../Engine/animations/animation_definitions.h | 1 - .../Engine/animations/ik_point_iterator.h | 1 - xlive/Blam/Engine/bitmaps/bitmap_group.h | 4 +- xlive/Blam/Engine/blamlib/blamlib.vcxproj | 607 +++++ .../Engine/blamlib/blamlib.vcxproj.filters | 1344 +++++++++++ xlive/Blam/Engine/blamlib/stdafx.cpp | 1 + xlive/Blam/Engine/blamlib/stdafx.h | 65 + xlive/Blam/Engine/cache/cache_files.cpp | 2 +- xlive/Blam/Engine/cache/cache_files.h | 3 +- xlive/Blam/Engine/cache/pc_texture_cache.h | 4 +- .../discord/discord_interface.cpp | 15 +- .../cartographer/discord/discord_interface.h | 13 +- .../cartographer/tag_fixes/tag_fixes.cpp | 10 +- xlive/Blam/Engine/cseries/cseries.h | 8 +- .../Engine/cseries/cseries_system_memory.cpp | 5 +- .../Engine/cseries/cseries_system_memory.h | 2 +- .../cseries/cseries_windows_minidump.cpp | 2 + .../cseries/cseries_windows_minidump_logs.cpp | 5 - .../cseries/cseries_windows_modules.cpp | 8 +- xlive/Blam/Engine/cutscene/cinematics.h | 1 - .../Engine/cutscene/cinematics_definitions.h | 1 - .../Engine/decorators/decorator_definitions.h | 6 +- .../decorators/decorator_projected_decals.h | 8 +- xlive/Blam/Engine/editor/editor_stubs.cpp | 1 - .../effects/effect_location_definition.h | 1 - .../Blam/Engine/effects/particle_emitter.cpp | 4 +- xlive/Blam/Engine/filesys/pc_file_system.h | 2 +- xlive/Blam/Engine/game/cheats.h | 1 - xlive/Blam/Engine/game/game.cpp | 3 + xlive/Blam/Engine/game/game.h | 14 +- xlive/Blam/Engine/game/game_engine.h | 1 - xlive/Blam/Engine/game/game_engine_spawning.h | 1 - xlive/Blam/Engine/game/game_globals.cpp | 12 +- xlive/Blam/Engine/game/game_globals.h | 35 +- xlive/Blam/Engine/game/materials.h | 1 - xlive/Blam/Engine/game/multiplayer_globals.h | 1 - xlive/Blam/Engine/game/player_control.cpp | 1 + xlive/Blam/Engine/game/player_control.h | 42 +- xlive/Blam/Engine/game/players.h | 4 + .../Engine/graphicslib/graphicslib.vcxproj | 403 ++++ .../graphicslib/graphicslib.vcxproj.filters | 597 +++++ xlive/Blam/Engine/graphicslib/stdafx.cpp | 1 + xlive/Blam/Engine/graphicslib/stdafx.h | 51 + xlive/Blam/Engine/hs/hs.h | 1 - xlive/Blam/Engine/hs/hs_runtime.h | 1 - xlive/Blam/Engine/input/input_abstraction.h | 12 +- xlive/Blam/Engine/input/input_windows.h | 13 +- .../Engine/interface/first_person_weapons.cpp | 2 +- .../Engine/interface/first_person_weapons.h | 5 +- xlive/Blam/Engine/interface/hud_definitions.h | 4 +- xlive/Blam/Engine/interface/hud_messaging.h | 1 - xlive/Blam/Engine/interface/interface.cpp | 8 +- xlive/Blam/Engine/interface/interface.h | 1 - .../Engine/interface/interfacelib.vcxproj | 369 +++ .../interface/interfacelib.vcxproj.filters | 528 +++++ xlive/Blam/Engine/interface/motion_sensor.h | 4 +- .../Engine/interface/new_hud_definitions.h | 11 +- xlive/Blam/Engine/interface/new_hud_draw.cpp | 74 +- .../interface/screens/screen_4way_signin.h | 1 - .../screens/screen_brightness_menu.h | 1 - .../screens/screen_button_settings.h | 1 - .../screen_cartographer_account_manager.cpp | 2 + .../screen_cartographer_account_manager.h | 1 - .../screens/screen_cartographer_errors.h | 6 +- .../screens/screen_cartographer_menus.h | 1 - .../interface/screens/screen_display_mode.cpp | 2 +- .../interface/screens/screen_display_mode.h | 1 - .../interface/screens/screen_main_menu.cpp | 56 +- .../screen_multiplayer_pregame_lobby.cpp | 1 - .../screen_multiplayer_pregame_lobby.h | 1 - .../screen_multiplayer_video_settings_menu.h | 1 - .../screens/screen_network_squad_browser.cpp | 2 - .../screens/screen_network_squad_browser.h | 1 - .../screens/screen_press_start_introduction.h | 1 - .../interface/screens/screen_settings.h | 1 - .../screens/screen_splitscreen_setting.h | 1 - .../interface/screens/screen_squad_settings.h | 1 - .../screens/screen_video_settings.cpp | 5 +- .../interface/screens/screen_video_settings.h | 1 - .../screens/screen_virtual_keyboard.h | 2 - .../screens/screen_vsync_setting.cpp | 6 +- .../interface/screens/screen_vsync_setting.h | 1 - .../screen_xbox_live_task_progress_dialog.h | 8 +- xlive/Blam/Engine/interface/terminal.cpp | 1 + xlive/Blam/Engine/interface/terminal.h | 2 +- .../Blam/Engine/interface/user_interface.cpp | 2 +- xlive/Blam/Engine/interface/user_interface.h | 3 +- .../interface/user_interface_controller.cpp | 1 - .../user_interface_screen_widget_definition.h | 1 - .../interface/user_interface_shared_globals.h | 1 - .../Engine/interface/user_interface_text.cpp | 1 + .../Engine/interface/user_interface_text.h | 2 +- .../user_interface_text_chat_receiver.h | 1 - .../interface/user_interface_utilities.h | 1 - .../interface/user_interface_widget_list.h | 1 - .../interface/user_interface_widget_text.h | 1 - xlive/Blam/Engine/interfacelib/stdafx.cpp | 1 + xlive/Blam/Engine/interfacelib/stdafx.h | 55 + .../Engine/items/item_collection_definition.h | 1 - .../items/vehicle_collection_definitions.h | 1 - .../Blam/Engine/items/weapon_definitions.cpp | 2 +- xlive/Blam/Engine/items/weapon_definitions.h | 2 +- xlive/Blam/Engine/main/console.cpp | 1 + xlive/Blam/Engine/main/interpolator.h | 2 +- xlive/Blam/Engine/main/main.cpp | 15 +- xlive/Blam/Engine/main/main_game.cpp | 10 +- xlive/Blam/Engine/main/main_render.cpp | 39 +- xlive/Blam/Engine/main/main_render.h | 2 +- xlive/Blam/Engine/main/main_screenshot.cpp | 31 +- xlive/Blam/Engine/main/map_manager.h | 1 + xlive/Blam/Engine/main/map_repository.cpp | 141 +- xlive/Blam/Engine/math/color_math.cpp | 6 +- xlive/Blam/Engine/math/real_math.h | 6 +- xlive/Blam/Engine/memory/static_arrays.h | 2 +- .../Engine/models/render_model_definitions.h | 9 +- xlive/Blam/Engine/models/render_models.h | 1 - .../networking/Session/network_session.cpp | 15 - .../networking/Session/network_session.h | 5 +- .../messages/network_message_handler.cpp | 3 +- .../network_messages_session_protocol.h | 3 +- .../networking/network_game_definitions.h | 2 +- .../Engine/networking/network_globals.cpp | 1 + .../Engine/networking/network_loading.cpp | 2 - .../Engine/networking/network_utilities.cpp | 1 + .../networking/online/online_account_xbox.cpp | 15 +- .../networking/online/online_account_xbox.h | 2 - .../networking/online/online_task_xbox.h | 1 - .../Engine/networking/transport/transport.h | 8 - .../networking/transport/transport_security.h | 7 + .../networkinglib/networkinglib.vcxproj | 370 +++ .../networkinglib.vcxproj.filters | 567 +++++ xlive/Blam/Engine/networkinglib/stdafx.cpp | 1 + xlive/Blam/Engine/networkinglib/stdafx.h | 50 + xlive/Blam/Engine/objects/damage.cpp | 1 + xlive/Blam/Engine/objects/damage.h | 1 - xlive/Blam/Engine/objects/damage_effects.h | 1 - xlive/Blam/Engine/objects/object_constants.h | 7 + xlive/Blam/Engine/objects/object_definition.h | 1 - xlive/Blam/Engine/objects/object_placement.h | 1 - xlive/Blam/Engine/objects/object_types.h | 1 - xlive/Blam/Engine/objects/objects.cpp | 3 +- xlive/Blam/Engine/objects/objects.h | 5 +- .../objects/widgets/antenna_definitions.h | 1 - .../Blam/Engine/objectslib/objectslib.vcxproj | 282 +++ .../objectslib/objectslib.vcxproj.filters | 273 +++ xlive/Blam/Engine/objectslib/stdafx.cpp | 1 + xlive/Blam/Engine/objectslib/stdafx.h | 43 + .../physics/collision_model_definitions.h | 1 - xlive/Blam/Engine/physics/physics_models.h | 7 +- .../rasterizer/dx9/rasterizer_dx9_9on12.h | 5 +- .../dx9/rasterizer_dx9_dynamic_geometry.h | 58 - .../dx9/rasterizer_dx9_dynavobgeom.h | 59 +- .../rasterizer/dx9/rasterizer_dx9_main.cpp | 95 +- .../rasterizer/dx9/rasterizer_dx9_main.h | 32 +- .../dx9/rasterizer_dx9_shader_submit_new.cpp | 50 + .../dx9/rasterizer_dx9_shader_submit_new.h | 22 +- .../rasterizer/dx9/rasterizer_dx9_targets.cpp | 12 +- .../rasterizer/dx9/rasterizer_dx9_targets.h | 22 +- .../rasterizer/dx9/rasterizer_dx9_weather.h | 2 +- .../Engine/rasterizer/rasterizer_globals.h | 17 +- .../Engine/rasterizer/rasterizer_main.cpp | 51 + .../Blam/Engine/rasterizer/rasterizer_main.h | 36 + .../Engine/rasterizer/rasterizer_settings.cpp | 11 +- .../Engine/rasterizer/rasterizer_settings.h | 3 +- .../render/render_cartographer_ingame_ui.cpp | 29 +- .../render/render_cartographer_ingame_ui.h | 6 +- xlive/Blam/Engine/render/render_lod_new.cpp | 3 +- xlive/Blam/Engine/render/render_weather.h | 7 +- .../Blam/Engine/render/weather_definitions.h | 14 +- .../Blam/Engine/sapien/patches_initialize.cpp | 4 +- .../Engine/scenario/scenario_definitions.h | 9 +- xlive/Blam/Engine/scenario/scenario_fog.h | 1 - .../Engine/scenario/scenario_interpolators.h | 1 - .../scenario/scenario_kill_trigger_volumes.h | 1 - xlive/Blam/Engine/shaders/pixel_shader.h | 2 +- .../Blam/Engine/shaders/shader_definitions.h | 1 - .../shaders/shader_postprocess_definitions.h | 1 - xlive/Blam/Engine/shaders/shader_templates.h | 1 - xlive/Blam/Engine/shell/shell.cpp | 2 +- xlive/Blam/Engine/shell/shell_windows.cpp | 44 +- .../Engine/shell/shell_windows_internals.cpp | 2 - .../game_interface/simulation_game_action.h | 4 +- .../game_interface/simulation_game_generics.h | 1 - .../game_interface/simulation_game_units.h | 2 +- .../game_interface/simulation_game_vehicles.h | 1 - xlive/Blam/Engine/simulation/machine_id.h | 2 +- xlive/Blam/Engine/simulation/simulation.cpp | 1 + xlive/Blam/Engine/simulation/simulation.h | 1 + .../Engine/simulation/simulation_actors.h | 2 +- .../Engine/simulation/simulation_encoding.cpp | 2 + .../Engine/simulation/simulation_encoding.h | 7 +- .../simulation/simulation_queue_events.cpp | 3 +- .../Engine/simulation/simulation_world.cpp | 3 +- .../sound/sound_cache_file_definitions.h | 1 - .../Engine/structures/structure_audibility.h | 10 +- .../structures/structure_bsp_definitions.h | 134 +- .../structure_lightmap_definitions.h | 10 +- .../tag_files/tag_loader/tag_injection.h | 1 - .../tag_loader/tag_injection_manager.cpp | 58 +- .../tag_loader/tag_injection_manager.h | 1 - .../tag_loader/tag_injection_table.h | 1 - .../tag_files/tag_loader/xml/xml_agent.cpp | 1 - .../tag_files/tag_loader/xml/xml_agent.h | 1 - .../tag_loader/xml/xml_definition_loader.cpp | 1 - xlive/Blam/Engine/tag_files/tag_reference.h | 1 - xlive/Blam/Engine/text/text_group.h | 1 - xlive/Blam/Engine/text/unicode.cpp | 2 +- xlive/Blam/Engine/text/unicode.h | 24 +- xlive/Blam/Engine/units/unit_action_system.h | 1 - xlive/Blam/Engine/units/unit_control.h | 28 + xlive/Blam/Engine/units/units.cpp | 1 + xlive/Blam/Engine/units/units.h | 26 +- xlive/CartographerDllConf.h | 11 + xlive/H2MOD.cpp | 17 +- xlive/H2MOD/GUI/XLiveRendering.h | 33 - .../imgui_integration/AdvancedSettings.cpp | 1 + .../Console/CommandHandler.cpp | 9 + .../Console/CommandHandler.h | 11 +- .../imgui_integration/Console/CommandsUtil.h | 6 +- .../Console/ImGui_ConsoleImpl.h | 1 + .../GUI/imgui_integration/WeaponOffsets.cpp | 2 + .../GUI/imgui_integration/imgui_handler.cpp | 10 +- .../GUI/imgui_integration/imgui_handler.h | 6 +- xlive/H2MOD/Modules/Accounts/AccountLogin.cpp | 46 +- xlive/H2MOD/Modules/Accounts/AccountLogin.h | 3 + .../Modules/Achievements/Achievements.cpp | 3 - .../H2MOD/Modules/Achievements/Achievements.h | 1 - .../Modules/CustomMenu/CustomMenuGlobals.cpp | 6 +- .../CustomVariantSettings.cpp | 2 +- .../CustomVariantSettings.h | 1 - .../GamePhysics/Patches/ProjectileFix.cpp | 3 + xlive/H2MOD/Modules/Input/ControllerInput.cpp | 21 + xlive/H2MOD/Modules/Input/ControllerInput.h | 31 +- xlive/H2MOD/Modules/MapManager/MapManager.cpp | 14 +- .../Modules/OnScreenDebug/OnscreenDebug.cpp | 18 +- .../Modules/PlaylistLoader/PlaylistLoader.cpp | 12 +- xlive/H2MOD/Modules/Shell/Config.cpp | 7 + xlive/H2MOD/Modules/Shell/Config.h | 3 +- xlive/H2MOD/Modules/Shell/H2MODShell.cpp | 4 +- xlive/H2MOD/Modules/Shell/Startup/Startup.cpp | 27 +- .../Modules/SpecialEvents/Events/Birthday.cpp | 1 - .../SpecialEvents/Events/Christmas.cpp | 5 +- .../SpecialEvents/SpecialEventHelpers.h | 1 - .../Modules/SpecialEvents/SpecialEvents.cpp | 2 +- xlive/H2MOD/Modules/h2log/h2log.cpp | 18 + xlive/H2MOD/Modules/h2log/h2log.h | 5 + .../{Util => H2MOD/Utils}/curl-interface.cpp | 0 xlive/H2MOD/Utils/curl-interface.h | 6 + xlive/H2MOD/Utils/curl_constants.h | 9 + xlive/H2MOD/Variants/GunGame/GunGame.cpp | 2 +- xlive/H2MOD/Variants/Infection/Infection.cpp | 44 +- xlive/H2MOD/h2modlib.vcxproj | 313 +++ xlive/H2MOD/h2modlib.vcxproj.filters | 418 ++++ xlive/H2MOD/stdafx.cpp | 3 + xlive/H2MOD/stdafx.h | 81 + xlive/Project_Cartographer.vcxproj | 2095 +--------------- xlive/Project_Cartographer.vcxproj.filters | 2100 +---------------- xlive/Project_Cartographer.vcxproj.user | 2 +- xlive/Util/Hooks/Hook.h | 41 - xlive/Util/Memory.h | 39 +- xlive/Util/curl-interface.h | 11 - xlive/XLive/ServerList/ServerList.cpp | 7 +- xlive/XLive/ServerList/ServerList.h | 4 - xlive/XLive/XAM/notify.cpp | 9 + xlive/XLive/XAM/notify.h | 5 + .../XAM/uithread.cpp} | 61 +- xlive/XLive/XAM/uithread.h | 32 + xlive/XLive/XAM/xam.cpp | 40 +- xlive/XLive/XAM/xam.h | 17 +- xlive/XLive/XStorage/XStorage.cpp | 2 + xlive/XLive/XUser/XUserContext.cpp | 2 +- xlive/XLive/achievements/XAchievements.cpp | 21 +- xlive/XLive/achievements/XAchievements.h | 7 + xlive/XLive/stdafx.cpp | 1 + xlive/XLive/stdafx.h | 67 + xlive/XLive/xlive.cpp | 48 + xlive/XLive/xlive.h | 1 + xlive/{ => XLive}/xlive_exports.def | 0 xlive/{ => XLive}/xlive_exports_debug.def | 0 xlive/{ => XLive}/xlivedefs.h | 31 +- xlive/{ => XLive}/xliveless.cpp | 0 xlive/{ => XLive}/xliveless.h | 4 - xlive/XLive/xlivelib.vcxproj | 263 +++ xlive/XLive/xlivelib.vcxproj.filters | 218 ++ xlive/XLive/xnet/IpManagement/XnIp.cpp | 230 +- xlive/XLive/xnet/IpManagement/XnIp.h | 235 +- xlive/XLive/xnet/Sockets/XSocket.cpp | 41 +- xlive/XLive/xnet/Sockets/XSocket.h | 39 +- xlive/XLive/xnet/XNetQoS.cpp | 4 +- xlive/XLive/xnet/xnet.cpp | 6 +- xlive/XLive/xnet/xnet.h | 50 +- xlive/dllmain.cpp | 72 +- xlive/stdafx.cpp | 6 +- xlive/stdafx.h | 104 +- 305 files changed, 9499 insertions(+), 5651 deletions(-) create mode 100644 xlive/Blam/Engine/ailib/ailib.vcxproj create mode 100644 xlive/Blam/Engine/ailib/ailib.vcxproj.filters create mode 100644 xlive/Blam/Engine/ailib/stdafx.cpp create mode 100644 xlive/Blam/Engine/ailib/stdafx.h create mode 100644 xlive/Blam/Engine/blamlib/blamlib.vcxproj create mode 100644 xlive/Blam/Engine/blamlib/blamlib.vcxproj.filters create mode 100644 xlive/Blam/Engine/blamlib/stdafx.cpp create mode 100644 xlive/Blam/Engine/blamlib/stdafx.h create mode 100644 xlive/Blam/Engine/graphicslib/graphicslib.vcxproj create mode 100644 xlive/Blam/Engine/graphicslib/graphicslib.vcxproj.filters create mode 100644 xlive/Blam/Engine/graphicslib/stdafx.cpp create mode 100644 xlive/Blam/Engine/graphicslib/stdafx.h create mode 100644 xlive/Blam/Engine/interface/interfacelib.vcxproj create mode 100644 xlive/Blam/Engine/interface/interfacelib.vcxproj.filters create mode 100644 xlive/Blam/Engine/interfacelib/stdafx.cpp create mode 100644 xlive/Blam/Engine/interfacelib/stdafx.h create mode 100644 xlive/Blam/Engine/networkinglib/networkinglib.vcxproj create mode 100644 xlive/Blam/Engine/networkinglib/networkinglib.vcxproj.filters create mode 100644 xlive/Blam/Engine/networkinglib/stdafx.cpp create mode 100644 xlive/Blam/Engine/networkinglib/stdafx.h create mode 100644 xlive/Blam/Engine/objectslib/objectslib.vcxproj create mode 100644 xlive/Blam/Engine/objectslib/objectslib.vcxproj.filters create mode 100644 xlive/Blam/Engine/objectslib/stdafx.cpp create mode 100644 xlive/Blam/Engine/objectslib/stdafx.h create mode 100644 xlive/Blam/Engine/units/unit_control.h delete mode 100644 xlive/H2MOD/GUI/XLiveRendering.h create mode 100644 xlive/H2MOD/Modules/Input/ControllerInput.cpp rename xlive/{Util => H2MOD/Utils}/curl-interface.cpp (100%) create mode 100644 xlive/H2MOD/Utils/curl-interface.h create mode 100644 xlive/H2MOD/Utils/curl_constants.h create mode 100644 xlive/H2MOD/h2modlib.vcxproj create mode 100644 xlive/H2MOD/h2modlib.vcxproj.filters create mode 100644 xlive/H2MOD/stdafx.cpp create mode 100644 xlive/H2MOD/stdafx.h delete mode 100644 xlive/Util/curl-interface.h create mode 100644 xlive/XLive/XAM/notify.cpp create mode 100644 xlive/XLive/XAM/notify.h rename xlive/{H2MOD/GUI/XLiveRendering.cpp => XLive/XAM/uithread.cpp} (66%) create mode 100644 xlive/XLive/XAM/uithread.h create mode 100644 xlive/XLive/stdafx.cpp create mode 100644 xlive/XLive/stdafx.h create mode 100644 xlive/XLive/xlive.cpp create mode 100644 xlive/XLive/xlive.h rename xlive/{ => XLive}/xlive_exports.def (100%) rename xlive/{ => XLive}/xlive_exports_debug.def (100%) rename xlive/{ => XLive}/xlivedefs.h (94%) rename xlive/{ => XLive}/xliveless.cpp (100%) rename xlive/{ => XLive}/xliveless.h (83%) create mode 100644 xlive/XLive/xlivelib.vcxproj create mode 100644 xlive/XLive/xlivelib.vcxproj.filters diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b24181c81..e6ed5f10e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -78,4 +78,4 @@ jobs: path: | ./Halo2/xlive.dll ./Halo2/xlive.map - ./xlive/objects/${{matrix.BUILD_CONFIGURATION}}/xlive.pdb \ No newline at end of file + ./objects/${{matrix.BUILD_CONFIGURATION}}/xlive/xlive.pdb \ No newline at end of file diff --git a/.gitignore b/.gitignore index 40beb56ed..cc8d54c97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -Project_Cartographer.VC.db -Project_Cartographer.VC.VC.opendb -Project_Cartographer.vcxproj.user *.exp *.obj *.tlog @@ -15,23 +12,17 @@ Project_Cartographer.vcxproj.user *.opendb *.db xlive.ilk -xliveless.aps -xliveless.opensdf -xliveless.v12.suo **/.vs **/.vscode /Directx SDK/include /Halo2 /Halo2Server -/xlive/objects -*.opensdf +/objects *.user *.ipch *.pso version_git.h -JSON/ - xlive/version_git.h xlive/3rdparty/imgui/lib xlive/3rdparty/imgui/objects diff --git a/Project_Cartographer.sln b/Project_Cartographer.sln index d4d0d2f95..020d34d5a 100644 --- a/Project_Cartographer.sln +++ b/Project_Cartographer.sln @@ -1,12 +1,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35527.113 +# Visual Studio Version 18 +VisualStudioVersion = 18.1.11312.151 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xlive", "xlive\Project_Cartographer.vcxproj", "{DC9655D6-D9C0-4837-8A63-B0693EEED4E8}" ProjectSection(ProjectDependencies) = postProject {0A00117C-C1D6-4C5C-B241-694D7F87421F} = {0A00117C-C1D6-4C5C-B241-694D7F87421F} {349AD4A3-7F10-438B-A15F-58F57A4D5F36} = {349AD4A3-7F10-438B-A15F-58F57A4D5F36} + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8} = {43C14FC5-F143-46EC-B81F-0F21CB04A1C8} + {68DADF6D-A81D-4B73-9017-1076C047E0B1} = {68DADF6D-A81D-4B73-9017-1076C047E0B1} + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA} = {8329696B-F8D4-4DB5-97AC-E863B07B0FBA} + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C} = {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C} + {98C40449-08C0-4F58-8CB3-DEFA93A036E3} = {98C40449-08C0-4F58-8CB3-DEFA93A036E3} + {D82C00DC-18C9-49FF-A189-F68274D2F680} = {D82C00DC-18C9-49FF-A189-F68274D2F680} + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD} = {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD} {ECCF965A-3A41-455C-A0C2-5829F00D03B8} = {ECCF965A-3A41-455C-A0C2-5829F00D03B8} + {F59089C4-6D57-47EF-93A6-B6A49E168EF0} = {F59089C4-6D57-47EF-93A6-B6A49E168EF0} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "xlive\3rdparty\zlib\zlib.vcxproj", "{0A00117C-C1D6-4C5C-B241-694D7F87421F}" @@ -17,6 +25,24 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxmllib", "xlive\3rdpart EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "external_libraries", "external_libraries", "{F7C6A7FA-CF62-4F3E-B7BC-B97A5CE5996F}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "interfacelib", "xlive\Blam\Engine\interface\interfacelib.vcxproj", "{F59089C4-6D57-47EF-93A6-B6A49E168EF0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "h2modlib", "xlive\H2MOD\h2modlib.vcxproj", "{E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{156F54EA-8F5A-4DDE-A217-20D6B52ADCDA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ailib", "xlive\Blam\Engine\ailib\ailib.vcxproj", "{43C14FC5-F143-46EC-B81F-0F21CB04A1C8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "objectslib", "xlive\Blam\Engine\objectslib\objectslib.vcxproj", "{68DADF6D-A81D-4B73-9017-1076C047E0B1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphicslib", "xlive\Blam\Engine\graphicslib\graphicslib.vcxproj", "{D82C00DC-18C9-49FF-A189-F68274D2F680}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xlivelib", "xlive\XLive\xlivelib.vcxproj", "{8329696B-F8D4-4DB5-97AC-E863B07B0FBA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blamlib", "xlive\Blam\Engine\blamlib\blamlib.vcxproj", "{98C40449-08C0-4F58-8CB3-DEFA93A036E3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "networkinglib", "xlive\Blam\Engine\networkinglib\networkinglib.vcxproj", "{97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution debug_llvm|x86 = debug_llvm|x86 @@ -73,6 +99,102 @@ Global {ECCF965A-3A41-455C-A0C2-5829F00D03B8}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 {ECCF965A-3A41-455C-A0C2-5829F00D03B8}.release_msvc|x86.ActiveCfg = release_msvc|Win32 {ECCF965A-3A41-455C-A0C2-5829F00D03B8}.release_msvc|x86.Build.0 = release_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.debug_llvm|x86.ActiveCfg = debug_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.debug_llvm|x86.Build.0 = debug_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_llvm|x86.ActiveCfg = release_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_llvm|x86.Build.0 = release_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_min_llvm|x86.ActiveCfg = release_min_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_min_llvm|x86.Build.0 = release_min_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {F59089C4-6D57-47EF-93A6-B6A49E168EF0}.release_msvc|x86.Build.0 = release_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.debug_llvm|x86.ActiveCfg = release_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.debug_llvm|x86.Build.0 = release_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_llvm|x86.ActiveCfg = debug_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_llvm|x86.Build.0 = debug_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_min_llvm|x86.ActiveCfg = debug_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_min_llvm|x86.Build.0 = debug_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD}.release_msvc|x86.Build.0 = release_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.debug_llvm|x86.ActiveCfg = release_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.debug_llvm|x86.Build.0 = release_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_llvm|x86.ActiveCfg = debug_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_llvm|x86.Build.0 = debug_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_min_llvm|x86.ActiveCfg = debug_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_min_llvm|x86.Build.0 = debug_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8}.release_msvc|x86.Build.0 = release_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.debug_llvm|x86.ActiveCfg = release_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.debug_llvm|x86.Build.0 = release_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_llvm|x86.ActiveCfg = debug_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_llvm|x86.Build.0 = debug_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_min_llvm|x86.ActiveCfg = debug_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_min_llvm|x86.Build.0 = debug_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {68DADF6D-A81D-4B73-9017-1076C047E0B1}.release_msvc|x86.Build.0 = release_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.debug_llvm|x86.ActiveCfg = release_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.debug_llvm|x86.Build.0 = release_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_llvm|x86.ActiveCfg = debug_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_llvm|x86.Build.0 = debug_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_min_llvm|x86.ActiveCfg = debug_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_min_llvm|x86.Build.0 = debug_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {D82C00DC-18C9-49FF-A189-F68274D2F680}.release_msvc|x86.Build.0 = release_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.debug_llvm|x86.ActiveCfg = release_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.debug_llvm|x86.Build.0 = release_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_llvm|x86.ActiveCfg = debug_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_llvm|x86.Build.0 = debug_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_min_llvm|x86.ActiveCfg = debug_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_min_llvm|x86.Build.0 = debug_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA}.release_msvc|x86.Build.0 = release_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.debug_llvm|x86.ActiveCfg = release_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.debug_llvm|x86.Build.0 = release_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_llvm|x86.ActiveCfg = debug_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_llvm|x86.Build.0 = debug_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_min_llvm|x86.ActiveCfg = debug_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_min_llvm|x86.Build.0 = debug_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {98C40449-08C0-4F58-8CB3-DEFA93A036E3}.release_msvc|x86.Build.0 = release_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.debug_llvm|x86.ActiveCfg = release_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.debug_llvm|x86.Build.0 = release_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.debug_msvc|x86.ActiveCfg = debug_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.debug_msvc|x86.Build.0 = debug_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_llvm|x86.ActiveCfg = debug_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_llvm|x86.Build.0 = debug_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_min_llvm|x86.ActiveCfg = debug_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_min_llvm|x86.Build.0 = debug_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_min_msvc|x86.ActiveCfg = release_min_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_min_msvc|x86.Build.0 = release_min_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_msvc|x86.ActiveCfg = release_msvc|Win32 + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C}.release_msvc|x86.Build.0 = release_msvc|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -81,6 +203,14 @@ Global {0A00117C-C1D6-4C5C-B241-694D7F87421F} = {F7C6A7FA-CF62-4F3E-B7BC-B97A5CE5996F} {349AD4A3-7F10-438B-A15F-58F57A4D5F36} = {F7C6A7FA-CF62-4F3E-B7BC-B97A5CE5996F} {ECCF965A-3A41-455C-A0C2-5829F00D03B8} = {F7C6A7FA-CF62-4F3E-B7BC-B97A5CE5996F} + {F59089C4-6D57-47EF-93A6-B6A49E168EF0} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} + {68DADF6D-A81D-4B73-9017-1076C047E0B1} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} + {D82C00DC-18C9-49FF-A189-F68274D2F680} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} + {98C40449-08C0-4F58-8CB3-DEFA93A036E3} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} + {97FCEDEC-ADF6-4AD9-8600-D28AD461BB3C} = {156F54EA-8F5A-4DDE-A217-20D6B52ADCDA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6DAC2B88-E92D-4630-A510-F749F197D188} diff --git a/xlive/3rdparty/imgui/imguilib.vcxproj b/xlive/3rdparty/imgui/imguilib.vcxproj index ada7cdfcb..e0e817b95 100644 --- a/xlive/3rdparty/imgui/imguilib.vcxproj +++ b/xlive/3rdparty/imgui/imguilib.vcxproj @@ -89,6 +89,7 @@ true true StreamingSIMDExtensions2 + NotUsing Console @@ -112,6 +113,7 @@ true true StreamingSIMDExtensions2 + NotUsing Console @@ -135,6 +137,7 @@ true true StreamingSIMDExtensions2 + NotUsing Console diff --git a/xlive/3rdparty/zlib/zlib.vcxproj b/xlive/3rdparty/zlib/zlib.vcxproj index 1e6cb0021..7a6c8a175 100644 --- a/xlive/3rdparty/zlib/zlib.vcxproj +++ b/xlive/3rdparty/zlib/zlib.vcxproj @@ -85,7 +85,7 @@ true _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true - Default + stdcpp17 MultiThreadedDebug @@ -107,7 +107,7 @@ true _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - Default + stdcpp17 MultiThreaded @@ -133,7 +133,7 @@ true _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true - Default + stdcpp17 MultiThreaded diff --git a/xlive/Blam/Engine/ai/actors.h b/xlive/Blam/Engine/ai/actors.h index 41c179647..e73a97400 100644 --- a/xlive/Blam/Engine/ai/actors.h +++ b/xlive/Blam/Engine/ai/actors.h @@ -6,7 +6,6 @@ #include "game/game_allegiance.h" #include "memory/data.h" #include "objects/object_location.h" -#include "tag_files/tag_groups.h" /* TODO: Reverse engineer more of the actor struct and fill this data in appropriately. diff --git a/xlive/Blam/Engine/ailib/ailib.vcxproj b/xlive/Blam/Engine/ailib/ailib.vcxproj new file mode 100644 index 000000000..d69b7fac0 --- /dev/null +++ b/xlive/Blam/Engine/ailib/ailib.vcxproj @@ -0,0 +1,256 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + 18.0 + Win32Proj + {43C14FC5-F143-46EC-B81F-0F21CB04A1C8} + ailib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)ailib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + .\;..\;..\..\..\ + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + true + false + 4700 + Fast + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)ailib.pch + $(IntDir) + $(IntDir) + Level4 + false + .\;..\;..\..\..\ + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)ailib.pch + $(IntDir) + $(IntDir) + Level4 + false + .\;..\;..\..\..\ + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/ailib/ailib.vcxproj.filters b/xlive/Blam/Engine/ailib/ailib.vcxproj.filters new file mode 100644 index 000000000..3702c4d3f --- /dev/null +++ b/xlive/Blam/Engine/ailib/ailib.vcxproj.filters @@ -0,0 +1,177 @@ + + + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ailib + + + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ai + + + ailib + + + + + {cde9d563-8757-4a37-a5c0-b5d2a860523b} + + + {7b9da3f7-98b9-4f8b-b26f-14141d15efe1} + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/ailib/stdafx.cpp b/xlive/Blam/Engine/ailib/stdafx.cpp new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/xlive/Blam/Engine/ailib/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/xlive/Blam/Engine/ailib/stdafx.h b/xlive/Blam/Engine/ailib/stdafx.h new file mode 100644 index 000000000..bb0b2e7be --- /dev/null +++ b/xlive/Blam/Engine/ailib/stdafx.h @@ -0,0 +1,32 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include + +#include + +/* windows */ + +#ifdef _WIN32 + +#define _USE_MATH_DEFINES +#include + +#define WIN32_LEAN_AND_MEAN + +#endif + +/* game includes */ + +#include "cseries/cseries.h" +#include "cseries/cseries_errors.h" +#include "cseries/cseries_system_memory.h" + +#include "math/real_math.h" +#include "memory/static_arrays.h" + +#include "tag_files/tag_groups.h" + +#include "Util/Memory.h" diff --git a/xlive/Blam/Engine/animations/animation_channel.h b/xlive/Blam/Engine/animations/animation_channel.h index 6503470ab..27e0b2473 100644 --- a/xlive/Blam/Engine/animations/animation_channel.h +++ b/xlive/Blam/Engine/animations/animation_channel.h @@ -1,7 +1,6 @@ #pragma once #include "animation_id.h" -#include "tag_files/tag_groups.h" // TODO populate flags enum e_animation_state_flag_bits : int8 diff --git a/xlive/Blam/Engine/animations/animation_definitions.h b/xlive/Blam/Engine/animations/animation_definitions.h index 1dbd319a9..f8f7f105f 100644 --- a/xlive/Blam/Engine/animations/animation_definitions.h +++ b/xlive/Blam/Engine/animations/animation_definitions.h @@ -3,7 +3,6 @@ #include "cache/cache_files.h" #include "tag_files/data_reference.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/animations/ik_point_iterator.h b/xlive/Blam/Engine/animations/ik_point_iterator.h index 29c88ed85..3eaf5a976 100644 --- a/xlive/Blam/Engine/animations/ik_point_iterator.h +++ b/xlive/Blam/Engine/animations/ik_point_iterator.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/bitmaps/bitmap_group.h b/xlive/Blam/Engine/bitmaps/bitmap_group.h index f30eecc03..91e035103 100644 --- a/xlive/Blam/Engine/bitmaps/bitmap_group.h +++ b/xlive/Blam/Engine/bitmaps/bitmap_group.h @@ -116,7 +116,7 @@ struct bitmap_group_sequence }; ASSERT_STRUCT_SIZE(bitmap_group_sequence, 0x3C); -enum e_more_bitmap_data_flags : byte +enum e_more_bitmap_data_flags : uint8 { more_bitmap_data_flag_delete_from_cache_file = FLAG(0), more_bitmap_data_flag_bitmap_create_attempted = FLAG(1) @@ -235,7 +235,7 @@ struct bitmap_data #pragma pack(pop) ASSERT_STRUCT_SIZE(bitmap_data, 116); -enum e_color_subsampling : byte +enum e_color_subsampling : uint8 { color_subsampling_400 = 0, color_subsampling_420 = 1, diff --git a/xlive/Blam/Engine/blamlib/blamlib.vcxproj b/xlive/Blam/Engine/blamlib/blamlib.vcxproj new file mode 100644 index 000000000..7e0bd5d94 --- /dev/null +++ b/xlive/Blam/Engine/blamlib/blamlib.vcxproj @@ -0,0 +1,607 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + 18.0 + Win32Proj + {98C40449-08C0-4F58-8CB3-DEFA93A036E3} + blamlib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)blamlib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + ..\..\..\3rdparty;..\..\..\3rdparty\imgui\imgui;..\..\..\3rdparty\discord\include;..\..\..\3rdparty\spdlog\include;..\..\..\3rdparty\tinyxml;..\..\..\3rdparty\zlib\src;..\..\XLive;.\;..\;..\..\..\;..\blamlib + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + true + false + 4700 + Fast + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)blamlib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;..\..\..\3rdparty\imgui\imgui;..\..\..\3rdparty\discord\include;..\..\..\3rdparty\spdlog\include;..\..\..\3rdparty\tinyxml;..\..\..\3rdparty\zlib\src;..\..\XLive;.\;..\;..\..\..\;..\blamlib + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;IMGUI_DISABLE;SPDLOG_DISABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)blamlib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;..\..\..\3rdparty\imgui\imgui;..\..\..\3rdparty\discord\include;..\..\..\3rdparty\spdlog\include;..\..\..\3rdparty\tinyxml;..\..\..\3rdparty\zlib\src;..\..\XLive;.\;..\;..\..\..\;..\blamlib + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/blamlib/blamlib.vcxproj.filters b/xlive/Blam/Engine/blamlib/blamlib.vcxproj.filters new file mode 100644 index 000000000..97235ab3a --- /dev/null +++ b/xlive/Blam/Engine/blamlib/blamlib.vcxproj.filters @@ -0,0 +1,1344 @@ + + + + + bitmaps + + + bitmaps + + + bitmaps + + + bitmaps + + + bitmaps + + + cache + + + cache + + + cache + + + cache + + + cache + + + cache + + + camera + + + camera + + + camera + + + camera + + + camera + + + camera + + + camera + + + cartographer\config + + + cartographer\discord + + + cartographer\tag_fixes + + + cartographer\twizzler + + + cartographer + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cutscene + + + cutscene + + + data_mining + + + debug\menu + + + dialogs + + + editor + + + animations + + + animations + + + animations + + + animations + + + animations + + + animations + + + bink + + + filesys + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + hs + + + hs + + + hs + + + hs + + + hs + + + hs + + + input + + + input + + + input + + + input + + + input + + + kablam + + + kablam + + + kablam + + + kablam + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + memory + + + memory + + + memory + + + memory + + + memory + + + memory + + + models + + + models + + + multithreading + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + sapien + + + sapien + + + scenario + + + scenario + + + scenario + + + scenario + + + sound + + + sound + + + sound + + + sound + + + structures + + + structures + + + structures + + + tag_files\tag_loader\xml + + + tag_files\tag_loader\xml + + + tag_files\tag_loader\xml + + + tag_files\tag_loader + + + tag_files\tag_loader + + + tag_files\tag_loader + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + text + + + text + + + text + + + text + + + text + + + tool + + + shell\windows\crash_report_window + + + shell + + + shell + + + shell + + + shell + + + saved_games + + + saved_games + + + saved_games + + + saved_games + + + saved_games + + + saved_games + + + saved_games\cartographer_player_profile + + + saved_games\cartographer_player_profile + + + achievements + + + blamlib + + + + + bitmaps + + + bitmaps + + + bitmaps + + + bitmaps + + + bitmaps + + + cache + + + cache + + + cache + + + cache + + + cache + + + cache + + + cache + + + camera + + + camera + + + camera + + + camera + + + camera + + + camera + + + camera + + + camera + + + cartographer\config + + + cartographer\discord + + + cartographer\tag_fixes + + + cartographer\twizzler + + + cartographer + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cseries + + + cutscene + + + cutscene + + + cutscene + + + cutscene + + + data_mining + + + debug\menu + + + dialogs + + + editor + + + editor + + + animations + + + animations + + + animations + + + animations + + + animations + + + animations + + + bink + + + errors + + + filesys + + + filesys + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + game + + + geometry + + + geometry + + + hs + + + hs + + + hs + + + hs + + + hs + + + hs + + + hs + + + hs + + + hs + + + input + + + input + + + input + + + input + + + input + + + input + + + kablam + + + kablam + + + kablam + + + kablam + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + main + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + memory + + + memory + + + memory + + + memory + + + memory + + + memory + + + memory + + + models + + + models + + + models + + + models + + + multithreading + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + physics + + + sapien + + + sapien + + + scenario + + + scenario + + + scenario + + + scenario + + + scenario + + + scenario + + + sound + + + sound + + + sound + + + sound + + + sound + + + sound + + + sound + + + sound + + + structures + + + structures + + + structures + + + structures + + + structures + + + structures + + + structures + + + structures + + + structures + + + tag_files\tag_loader\xml + + + tag_files\tag_loader\xml + + + tag_files\tag_loader\xml + + + tag_files\tag_loader + + + tag_files\tag_loader + + + tag_files\tag_loader + + + tag_files\tag_loader + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + tag_files + + + text + + + text + + + text + + + text + + + text + + + text + + + tool + + + shell\windows\crash_report_window + + + shell + + + shell + + + shell + + + shell + + + saved_games + + + saved_games + + + saved_games + + + saved_games + + + saved_games + + + saved_games + + + saved_games + + + saved_games\cartographer_player_profile + + + saved_games\cartographer_player_profile + + + achievements + + + blamlib + + + + + {3034d9dc-244c-4c2d-90cb-ae81d482261e} + + + {c92a5917-94f5-44b4-a4c9-026559670290} + + + {20ee95bd-eb91-46b7-a4ce-c3368cf5d971} + + + {65e7aa36-66af-442f-8f92-9995f9269449} + + + {cb78246a-fa0b-4c86-8768-d159f3a21f1a} + + + {933681ff-a5a4-4d9f-b4a7-1973698a881b} + + + {742a9f9c-5f58-4090-881a-4a29ead689dd} + + + {b311f6f3-7eb5-4b2d-9f4a-56ea3e29c8d0} + + + {4906cc12-0170-4fce-905d-b8d49b46d1bf} + + + {e4c16522-2f8d-4e61-b5b1-03c8ad05b3ca} + + + {f15bd62c-b4ad-4f52-9d8c-a881d9860341} + + + {f98edf72-9212-48d5-a753-7f07cfe51b41} + + + {db18efa1-a027-4d7a-98ad-5a75649a1e65} + + + {c03128a4-f331-4c45-bda9-62235cc66054} + + + {a9294b30-8864-4c23-8139-bc2abdc4a2db} + + + {063a1690-6706-4c6a-9149-89cd2e085d47} + + + {12cb21c6-58dc-49e1-9bd8-ecd2db716641} + + + {0f41d122-ff72-4db6-8455-17fa9dfa94ec} + + + {9392bed6-148e-4ccd-8ab6-6b75e0a82b0d} + + + {70cd1dca-e5cb-4030-9ed3-e0324d0ab586} + + + {429bc98f-1600-496e-9474-b45048a2733a} + + + {36c1a4b0-2d90-4fed-9dd7-277742e1c7d5} + + + {b042c9e1-76bb-4c06-8981-c7943ad9d12d} + + + {ae2f1b32-3738-4cad-939d-1c103e138c80} + + + {cfbbea73-1bdb-4a40-b924-1d1be793cb6c} + + + {10f83023-8317-4f87-8794-ff588e9635a8} + + + {be31aef3-a831-45ea-ab6a-0052c27882b1} + + + {eb33dc5b-eff6-475f-b2aa-028c0aa2b57e} + + + {018719d1-3a0d-4a38-b95a-06ba05698e79} + + + {a0613a1d-81bf-45c5-8e5c-6c5a628c30cd} + + + {33424ad7-daad-4df1-8340-933fc10dd502} + + + {9e1c2769-2732-43b7-8951-bdbd6355f084} + + + {6e7eb2b8-d3e3-4595-9ba9-053285eb0acc} + + + {ef07ac1c-b9dd-4f06-8f50-a471b22c7769} + + + {7f43c1f6-32ff-4091-8043-8ad98628be01} + + + {29d88656-6ef4-4af5-acb0-3ae3894776ca} + + + {ec4db9d0-5368-4476-a109-decd95e5c982} + + + {a1c3e080-d37c-449e-8034-50fa3a209f13} + + + {87c5c26c-9b6f-44e7-9787-98e6d06e1c35} + + + {472c56bb-f2de-4dc9-9b14-5813698ac883} + + + {89e63182-9e93-41ea-ba72-964356a9fa97} + + + {ad10f891-f8cd-4c90-a019-5ce2552f5157} + + + {38defa8e-6a8a-409c-b10b-0978f5047f05} + + + {b4192f42-c337-40be-aa43-c427657c6b98} + + + {e61aff89-4a91-4be1-bad6-d1a5dcf4e35e} + + + {cd5883d9-f002-410c-8986-4679149bf8f2} + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/blamlib/stdafx.cpp b/xlive/Blam/Engine/blamlib/stdafx.cpp new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/xlive/Blam/Engine/blamlib/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/xlive/Blam/Engine/blamlib/stdafx.h b/xlive/Blam/Engine/blamlib/stdafx.h new file mode 100644 index 000000000..601fe618b --- /dev/null +++ b/xlive/Blam/Engine/blamlib/stdafx.h @@ -0,0 +1,65 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include + +#include +#include +#include +#include +#include + +/* windows */ + +#ifdef _WIN32 + +#define _USE_MATH_DEFINES +#include + +#define _WINSOCK_DEPRECATED_NO_WARNINGS + +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include +#include +#include + +// Use Xinput 9.1.0 and Dinput 0x0800 +#define XINPUT_USE_9_1_0 +#define DIRECTINPUT_VERSION 0x0800 + +#include +#include + +#endif + +/* 3rd party */ + +#include + +#include + +/* game includes */ + +#include "cseries/cseries.h" +#include "cseries/cseries_errors.h" +#include "cseries/cseries_system_memory.h" + +#ifdef _WIN32 +#include "cseries/cseries_windows.h" +#endif + +#include "math/crypto_windows.h" +#include "math/integer_math.h" +#include "math/real_math.h" +#include "memory/static_arrays.h" +#include "networking/network_game_definitions.h" +#include "tag_files/tag_groups.h" + +#include "Util/Hooks/Hook.h" +#include "Util/Memory.h" diff --git a/xlive/Blam/Engine/cache/cache_files.cpp b/xlive/Blam/Engine/cache/cache_files.cpp index 28e71eca9..edbe03683 100644 --- a/xlive/Blam/Engine/cache/cache_files.cpp +++ b/xlive/Blam/Engine/cache/cache_files.cpp @@ -41,7 +41,7 @@ void cache_files_apply_patches(void) return; } -HANDLE* cache_file_handle_get() +void* cache_file_handle_get(void) { return Memory::GetAddress(0x4AE8A8, 0x4CF128); } diff --git a/xlive/Blam/Engine/cache/cache_files.h b/xlive/Blam/Engine/cache/cache_files.h index 936c9ee5c..ee83be521 100644 --- a/xlive/Blam/Engine/cache/cache_files.h +++ b/xlive/Blam/Engine/cache/cache_files.h @@ -1,6 +1,5 @@ #pragma once #include "main/game_preferences.h" -#include "tag_files/tag_groups.h" /* constants */ @@ -148,7 +147,7 @@ ASSERT_STRUCT_SIZE(tag_iterator, 20); void cache_files_apply_patches(void); -HANDLE* cache_file_handle_get(); +void* cache_file_handle_get(void); s_cache_file_memory_globals* cache_file_memory_globals_get(void); diff --git a/xlive/Blam/Engine/cache/pc_texture_cache.h b/xlive/Blam/Engine/cache/pc_texture_cache.h index 562229c9c..18f3bdc1a 100644 --- a/xlive/Blam/Engine/cache/pc_texture_cache.h +++ b/xlive/Blam/Engine/cache/pc_texture_cache.h @@ -17,9 +17,9 @@ struct s_pc_texture_cache_globals void __cdecl texture_cache_new(void); -IDirect3DTexture9* __cdecl texture_cache_bitmap_get_hardware_format_add_to_texture_cache(struct bitmap_data* data, real32 a2, int32 a3); +struct IDirect3DTexture9* __cdecl texture_cache_bitmap_get_hardware_format_add_to_texture_cache(struct bitmap_data* data, real32 a2, int32 a3); -IDirect3DTexture9* __cdecl pc_texture_cache_preload_bitmap(struct bitmap_data* bitmap_data, uint8 flags, real32 unk, bool* unused); +struct IDirect3DTexture9* __cdecl pc_texture_cache_preload_bitmap(struct bitmap_data* bitmap_data, uint8 flags, real32 unk, bool* unused); void __cdecl texture_cache_block_for_one_frame(int32 a1); diff --git a/xlive/Blam/Engine/cartographer/discord/discord_interface.cpp b/xlive/Blam/Engine/cartographer/discord/discord_interface.cpp index 238c1f8d0..ade913996 100644 --- a/xlive/Blam/Engine/cartographer/discord/discord_interface.cpp +++ b/xlive/Blam/Engine/cartographer/discord/discord_interface.cpp @@ -13,6 +13,7 @@ #include "H2MOD/Modules/Shell/Config.h" #include +#include /* constants */ @@ -74,6 +75,18 @@ static const char* k_valid_scenario_names[] = { "salvation" }; +/* enums */ + +enum e_context_id +{ + _context_id_variant = 2, + _context_id_difficulty = 3, + _context_id_map = 5, + _context_id_presence = X_CONTEXT_PRESENCE, + _context_id_game_type = X_CONTEXT_GAME_TYPE, + _context_id_game_mode = X_CONTEXT_GAME_MODE +}; + /* structures */ struct s_context_campaign_map_info @@ -306,7 +319,7 @@ void discord_interface_update_map_info_campaign(int32 map_id, const utf8* scenar } -void discord_interface_set_context(e_context_id context_id, uint32 contex_value) +void discord_interface_set_context(uint32 context_id, uint32 contex_value) { if (shell_is_dedicated_server() || !H2Config_discord_enable || g_instance_number > 1) { diff --git a/xlive/Blam/Engine/cartographer/discord/discord_interface.h b/xlive/Blam/Engine/cartographer/discord/discord_interface.h index fb507d465..3636f5076 100644 --- a/xlive/Blam/Engine/cartographer/discord/discord_interface.h +++ b/xlive/Blam/Engine/cartographer/discord/discord_interface.h @@ -1,5 +1,4 @@ #pragma once -#include /* macros */ @@ -7,16 +6,6 @@ /* enums */ -enum e_context_id -{ - _context_id_variant = 2, - _context_id_difficulty = 3, - _context_id_map = 5, - _context_id_presence = X_CONTEXT_PRESENCE, - _context_id_game_type = X_CONTEXT_GAME_TYPE, - _context_id_game_mode = X_CONTEXT_GAME_MODE -}; - enum e_context_variant { _context_variant_ctf = 0, @@ -80,4 +69,4 @@ void discord_interface_set_player_counts(void); void discord_interface_update_map_info_campaign(int32 map_id, const utf8* scenario_name); -void discord_interface_set_context(e_context_id context_id, uint32 contex_value); +void discord_interface_set_context(uint32 context_id, uint32 contex_value); diff --git a/xlive/Blam/Engine/cartographer/tag_fixes/tag_fixes.cpp b/xlive/Blam/Engine/cartographer/tag_fixes/tag_fixes.cpp index 056a2f3c4..34a6d26e5 100644 --- a/xlive/Blam/Engine/cartographer/tag_fixes/tag_fixes.cpp +++ b/xlive/Blam/Engine/cartographer/tag_fixes/tag_fixes.cpp @@ -141,12 +141,12 @@ static void tag_fixes_brute(void) s_shader_definition* shader = (s_shader_definition*)tag_get_fast(brute_shader_index); s_shader_postprocess_definition_new* postprocess = TAG_BLOCK_GET_ELEMENT(&shader->postprocess_definition, 0, s_shader_postprocess_definition_new); - *postprocess->pixel_constants[0] = D3DCOLOR_RGBA(87, 79, 69, 0); - *postprocess->pixel_constants[1] = D3DCOLOR_RGBA(180, 179, 189, 0); + *postprocess->pixel_constants[0] = PIXEL32_RGBA(87, 79, 69, 0); + *postprocess->pixel_constants[1] = PIXEL32_RGBA(180, 179, 189, 0); shader = (s_shader_definition*)tag_get_fast(brute_head_shader_index); - *postprocess->pixel_constants[0] = D3DCOLOR_RGBA(255, 255, 255, 0); - *postprocess->pixel_constants[1] = D3DCOLOR_RGBA(180, 179, 189, 0); + *postprocess->pixel_constants[0] = PIXEL32_RGBA(255, 255, 255, 0); + *postprocess->pixel_constants[1] = PIXEL32_RGBA(180, 179, 189, 0); } return; } @@ -234,7 +234,7 @@ static void tag_fixes_misty_rain(void) { const scenario_structure_bsp_reference* reference = TAG_BLOCK_GET_ELEMENT(&scenario_definition->structure_bsps, i, scenario_structure_bsp_reference); structure_bsp* bsp_definition = (structure_bsp*)tag_get_fast(reference->structure_bsp.index); - structure_weather_palette_entry* bsp_palette = bsp_definition->weather_palette[0]; + structure_weather_palette_entry* bsp_palette = TAG_BLOCK_GET_ELEMENT(&bsp_definition->weather_palette, 0, structure_weather_palette_entry); csstrncpy(bsp_palette->name, name, NUMBEROF(name)); bsp_palette->weather_system.group.group = _tag_group_weather_system; bsp_palette->weather_system.index = misty_rain_datum; diff --git a/xlive/Blam/Engine/cseries/cseries.h b/xlive/Blam/Engine/cseries/cseries.h index 9264defcf..7cfab4060 100644 --- a/xlive/Blam/Engine/cseries/cseries.h +++ b/xlive/Blam/Engine/cseries/cseries.h @@ -1,4 +1,5 @@ #pragma once +#include // 8-bit character that's specified as a multibyte utf8 string typedef char utf8; @@ -53,7 +54,6 @@ struct utf32 uint32 character; }; - enum { BYTE_MAX = 255, @@ -88,6 +88,10 @@ extern bool g_catch_exceptions; /* macros */ +#define TEST_N_DEF(TEST) + +#define STRINGIFY(x) #x + #define J( symbol1, symbol2 ) _DO_JOIN( symbol1, symbol2 ) #define _DO_JOIN( symbol1, symbol2 ) symbol1##symbol2 @@ -201,6 +205,8 @@ while(0) /* prototypes */ +extern bool is_debugger_present(void); + void cseries_initialize(void); #ifdef ASSERTS_ENABLED diff --git a/xlive/Blam/Engine/cseries/cseries_system_memory.cpp b/xlive/Blam/Engine/cseries/cseries_system_memory.cpp index 24ae896a4..6b99f4de8 100644 --- a/xlive/Blam/Engine/cseries/cseries_system_memory.cpp +++ b/xlive/Blam/Engine/cseries/cseries_system_memory.cpp @@ -8,7 +8,8 @@ void* system_heap_alloc(size_t size) return HeapAlloc(GetProcessHeap(), 0, size); } -BOOL system_heap_free(void* block) +void system_heap_free(void* block) { - return HeapFree(GetProcessHeap(), 0, block); + HeapFree(GetProcessHeap(), 0, block); + return; } diff --git a/xlive/Blam/Engine/cseries/cseries_system_memory.h b/xlive/Blam/Engine/cseries/cseries_system_memory.h index 3c4316864..6e7fd7c4a 100644 --- a/xlive/Blam/Engine/cseries/cseries_system_memory.h +++ b/xlive/Blam/Engine/cseries/cseries_system_memory.h @@ -11,7 +11,7 @@ void* system_heap_alloc(size_t size); #endif -BOOL system_heap_free(void* block); +void system_heap_free(void* block); #ifndef NDEBUG #define CSERIES_FREE(size) system_heap_free(size) // ### TODO: implement debug_free diff --git a/xlive/Blam/Engine/cseries/cseries_windows_minidump.cpp b/xlive/Blam/Engine/cseries/cseries_windows_minidump.cpp index 60b6be26e..19b5bdcdb 100644 --- a/xlive/Blam/Engine/cseries/cseries_windows_minidump.cpp +++ b/xlive/Blam/Engine/cseries/cseries_windows_minidump.cpp @@ -6,6 +6,8 @@ #include "H2MOD/Modules/OnScreenDebug/OnscreenDebug.h" +#include // SHGetFolderPathW + static const char k_initial_dump_path[] = "C:\\TEMP\\"; static const wchar_t k_initial_dump_path_wide[] = L"C:\\TEMP\\"; static const char k_minidump_folder_name[] = "crash_file_archive\\"; diff --git a/xlive/Blam/Engine/cseries/cseries_windows_minidump_logs.cpp b/xlive/Blam/Engine/cseries/cseries_windows_minidump_logs.cpp index b94d76a33..ed9c6069f 100644 --- a/xlive/Blam/Engine/cseries/cseries_windows_minidump_logs.cpp +++ b/xlive/Blam/Engine/cseries/cseries_windows_minidump_logs.cpp @@ -6,7 +6,6 @@ #include "game/game.h" #include "game/game_options.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" /* constants */ @@ -423,10 +422,6 @@ static void setup_rasterizer_text(const wchar_t* reports_path) { fwprintf(file, L"RASTERIZER\n"); fwprintf(file, L"%ls", k_crash_message_header_break); - - fwprintf(file, L"Last Bitmap Tag Datum: "); - print_hex_value_to_file(file, (uint32)last_bitmap_tag_index_get()); - fclose(file); } diff --git a/xlive/Blam/Engine/cseries/cseries_windows_modules.cpp b/xlive/Blam/Engine/cseries/cseries_windows_modules.cpp index a460e3f04..59a4d3585 100644 --- a/xlive/Blam/Engine/cseries/cseries_windows_modules.cpp +++ b/xlive/Blam/Engine/cseries/cseries_windows_modules.cpp @@ -1,8 +1,14 @@ #include "stdafx.h" #include "cseries_windows_modules.h" -s_loaded_module_info g_module_info[k_recorded_module_count]; +#include +#include +/* globals */ + +static s_loaded_module_info g_module_info[k_recorded_module_count]; + +/* public code */ s_loaded_module_info* get_loaded_module_info() { diff --git a/xlive/Blam/Engine/cutscene/cinematics.h b/xlive/Blam/Engine/cutscene/cinematics.h index 8afd660eb..a92e277d6 100644 --- a/xlive/Blam/Engine/cutscene/cinematics.h +++ b/xlive/Blam/Engine/cutscene/cinematics.h @@ -1,6 +1,5 @@ #pragma once #include "math/color_math.h" -#include "tag_files/tag_groups.h" struct s_cinematic_globals_flags { diff --git a/xlive/Blam/Engine/cutscene/cinematics_definitions.h b/xlive/Blam/Engine/cutscene/cinematics_definitions.h index e91e512f9..23a01895f 100644 --- a/xlive/Blam/Engine/cutscene/cinematics_definitions.h +++ b/xlive/Blam/Engine/cutscene/cinematics_definitions.h @@ -2,7 +2,6 @@ #include "math/color_math.h" #include "math/integer_math.h" #include "text/text.h" -#include "tag_files/tag_groups.h" /* structures */ diff --git a/xlive/Blam/Engine/decorators/decorator_definitions.h b/xlive/Blam/Engine/decorators/decorator_definitions.h index 360a2477f..2f5cb66f3 100644 --- a/xlive/Blam/Engine/decorators/decorator_definitions.h +++ b/xlive/Blam/Engine/decorators/decorator_definitions.h @@ -82,10 +82,10 @@ ASSERT_STRUCT_SIZE(c_decorator_cache_block, 52); // max count: k_maximum_group_count 131072 struct s_decorator_group { - byte decorator_set; // Block Index: scenario_decorator_set_palette_entry + uint8 decorator_set; // Block Index: scenario_decorator_set_palette_entry e_decorator_type decorator_type; - byte shader_index; - byte compressed_radius; + uint8 shader_index; + uint8 compressed_radius; short cluster; short cache_block; // Block Index: c_decorator_cache_block short decorator_start_index; diff --git a/xlive/Blam/Engine/decorators/decorator_projected_decals.h b/xlive/Blam/Engine/decorators/decorator_projected_decals.h index 4db592a90..d8ca05001 100644 --- a/xlive/Blam/Engine/decorators/decorator_projected_decals.h +++ b/xlive/Blam/Engine/decorators/decorator_projected_decals.h @@ -18,10 +18,10 @@ ASSERT_STRUCT_SIZE(rasterizer_vertex_decorator_decal, 32); // max count: k_maximum_projected_decal_count 32768 struct s_decorator_projected_decal { - byte decorator_set; // Block Index: scenario_decorator_set_palette_entry - byte decorator_class; - byte decorator_permutation; - byte sprite_index; + uint8 decorator_set; // Block Index: scenario_decorator_set_palette_entry + uint8 decorator_class; + uint8 decorator_permutation; + uint8 sprite_index; real_point3d position; real_vector3d left; real_vector3d up; diff --git a/xlive/Blam/Engine/editor/editor_stubs.cpp b/xlive/Blam/Engine/editor/editor_stubs.cpp index 3edbd40d5..048431697 100644 --- a/xlive/Blam/Engine/editor/editor_stubs.cpp +++ b/xlive/Blam/Engine/editor/editor_stubs.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" #include "editor_stubs.h" -#include "tag_files/tag_groups.h" /* public code */ diff --git a/xlive/Blam/Engine/effects/effect_location_definition.h b/xlive/Blam/Engine/effects/effect_location_definition.h index 102071d13..ec4cdeec5 100644 --- a/xlive/Blam/Engine/effects/effect_location_definition.h +++ b/xlive/Blam/Engine/effects/effect_location_definition.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" #define k_maximum_effect_locations_count 32 diff --git a/xlive/Blam/Engine/effects/particle_emitter.cpp b/xlive/Blam/Engine/effects/particle_emitter.cpp index 6af90f670..6f0899352 100644 --- a/xlive/Blam/Engine/effects/particle_emitter.cpp +++ b/xlive/Blam/Engine/effects/particle_emitter.cpp @@ -114,8 +114,8 @@ void c_particle_emitter::calc_matrix( real_vector3d translated_vector; matrix3x3_transform_vector(&this->m_matrix, &definition->translational_offset, &translated_vector); - if (::abs(definition->relative_direction.yaw) >= k_real_epsilon || - ::abs(definition->relative_direction.pitch) >= k_real_epsilon) + if (::fabs(definition->relative_direction.yaw) >= k_real_epsilon || + ::fabs(definition->relative_direction.pitch) >= k_real_epsilon) { real_matrix3x3 rotations_matrix; matrix3x3_from_angles(&rotations_matrix, definition->relative_direction.yaw, definition->relative_direction.pitch, 0.0f); diff --git a/xlive/Blam/Engine/filesys/pc_file_system.h b/xlive/Blam/Engine/filesys/pc_file_system.h index c48491aba..057191ac5 100644 --- a/xlive/Blam/Engine/filesys/pc_file_system.h +++ b/xlive/Blam/Engine/filesys/pc_file_system.h @@ -16,7 +16,7 @@ enum e_pc_file_system_type : uint32 struct s_pc_file_type_save_path_info { // KNOWNFOLDERID Reference: https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid#constants - KNOWNFOLDERID* known_folder_id; + struct KNOWNFOLDERID* known_folder_id; // CSIDL Reference: https://github.com/tpn/winsdk-10/blob/master/Include/10.0.10240.0/um/ShlObj.h#L1113 uint32 cs_idl; wchar_t* path; diff --git a/xlive/Blam/Engine/game/cheats.h b/xlive/Blam/Engine/game/cheats.h index 803e0bc5b..1c360ee11 100644 --- a/xlive/Blam/Engine/game/cheats.h +++ b/xlive/Blam/Engine/game/cheats.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* enums */ diff --git a/xlive/Blam/Engine/game/game.cpp b/xlive/Blam/Engine/game/game.cpp index d788dd766..9ed26b0d3 100644 --- a/xlive/Blam/Engine/game/game.cpp +++ b/xlive/Blam/Engine/game/game.cpp @@ -7,6 +7,7 @@ #include "game_time.h" #include "players.h" +#include "ai/ai.h" #include "camera/director.h" #include "cutscene/cinematics.h" #include "cutscene/recorded_animations.h" @@ -23,6 +24,8 @@ #include "networking/logic/life_cycle_manager.h" #include "networking/session/network_session.h" #include "objects/lights.h" +#include "objects/objects.h" +#include "networking/session/network_session.h" #include "physics/havok.h" #include "physics/impacts.h" #include "sapien/editor.h" diff --git a/xlive/Blam/Engine/game/game.h b/xlive/Blam/Engine/game/game.h index ccc6ccaeb..1fd4edf5b 100644 --- a/xlive/Blam/Engine/game/game.h +++ b/xlive/Blam/Engine/game/game.h @@ -29,22 +29,22 @@ struct game_globals_storage bool initializing; bool map_active; int16 active_structure_bsp_index; - int unused_0; + int32 unused_0; s_game_options options; bool game_in_progress; bool game_is_lost; - int ticks_to_reset_game; + int32 ticks_to_reset_game; bool game_is_finished; bool game_sounds_disabled; - short pad_1; - DWORD ticks_till_end; + int16 pad_1; + uint32 ticks_till_end; int32 game_ragdoll_count; - int unused_1; + int32 unused_1; s_game_cluster_bit_vectors cluster_pvs; s_game_cluster_bit_vectors cluster_pvs_local; s_game_cluster_bit_vectors cluster_activation; - byte enable_scripted_camera_pvs; - byte pad_2; + uint8 enable_scripted_camera_pvs; + uint8 pad_2; uint16 pvs_activation_mode; datum pvs_object_datum; }; diff --git a/xlive/Blam/Engine/game/game_engine.h b/xlive/Blam/Engine/game/game_engine.h index bcdc51a4c..94b6ab0da 100644 --- a/xlive/Blam/Engine/game/game_engine.h +++ b/xlive/Blam/Engine/game/game_engine.h @@ -5,7 +5,6 @@ #include "main/game_preferences.h" #include "math/color_math.h" #include "saved_games/game_variant.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/game/game_engine_spawning.h b/xlive/Blam/Engine/game/game_engine_spawning.h index 939023e12..9129b8db3 100644 --- a/xlive/Blam/Engine/game/game_engine_spawning.h +++ b/xlive/Blam/Engine/game/game_engine_spawning.h @@ -1,7 +1,6 @@ #pragma once #include "game/game_engine.h" -#include "tag_files/tag_groups.h" #define k_maximum_number_of_dynamic_spawn_zones 32 #define MAXIMUM_STATIC_SPAWN_ZONES_PER_SCENARIO 128 diff --git a/xlive/Blam/Engine/game/game_globals.cpp b/xlive/Blam/Engine/game/game_globals.cpp index b1a20584b..9b50bc371 100644 --- a/xlive/Blam/Engine/game/game_globals.cpp +++ b/xlive/Blam/Engine/game/game_globals.cpp @@ -1,14 +1,14 @@ #include "stdafx.h" #include "game_globals.h" -#include "units/unit_definitions.h" #include "cache/cache_files.h" +#include "main/level_definitions.h" #include "models/models.h" #include "scenario/scenario.h" #include "scenario/scenario_definitions.h" -#include "shell/shell.h" #include "tag_files/tag_loader/tag_injection.h" +#include "units/unit_definitions.h" #include "H2MOD/Modules/Shell/Config.h" #include "H2MOD/Modules/SpecialEvents/SpecialEvents.h" @@ -41,9 +41,9 @@ static void game_globals_prepare_lmao_representation(s_game_globals_custom_repre static void add_new_representations(s_game_globals_custom_representation_result* representations); static void add_simulation_table_entries(s_game_globals_custom_representation_result* representations); -/* constants */ +/* globals */ -void (*k_game_globals_custom_representation_function_table[k_cartographer_custom_representation_count])(s_game_globals_custom_representation_result*) +static void (*const k_game_globals_custom_representation_function_table[k_cartographer_custom_representation_count])(s_game_globals_custom_representation_result*) { game_globals_prepare_skeleton_representation, game_globals_prepare_flood_representation, @@ -64,7 +64,7 @@ s_game_globals* scenario_get_game_globals(void) return *Memory::GetAddress(0x479E70, 0x4A642C); } -s_camera_track_definition* game_globals_get_default_camera_track() +s_camera_track_definition* game_globals_get_default_camera_track(void) { s_game_globals* game_globals = scenario_get_game_globals(); @@ -81,7 +81,7 @@ s_ui_levels_definition* game_globals_get_ui_levels(void) s_game_globals* globals = scenario_get_game_globals(); if (globals->ui_level_data.count > 0 && globals->ui_level_data.data != NONE) { - return globals->ui_level_data[0]; + return (s_ui_levels_definition*)TAG_BLOCK_GET_ELEMENT(&globals->ui_level_data, 0, s_ui_levels_definition); } return NULL; diff --git a/xlive/Blam/Engine/game/game_globals.h b/xlive/Blam/Engine/game/game_globals.h index ad7f0ec4e..bc34adab7 100644 --- a/xlive/Blam/Engine/game/game_globals.h +++ b/xlive/Blam/Engine/game/game_globals.h @@ -1,15 +1,9 @@ #pragma once -#include "materials.h" - #include "bitmaps/bitmap_group.h" -#include "camera/camera_track_definition.h" #include "interface/interface.h" -#include "math/color_math.h" #include "main/game_preferences.h" -#include "main/level_definitions.h" -#include "objects/damage.h" +#include "math/color_math.h" #include "saved_games/player_profile.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" #include "text/text_group.h" @@ -133,7 +127,7 @@ ASSERT_STRUCT_SIZE(s_ai_globals_definition, 360); // max count: 1 struct s_damage_globals_definition { - tag_block damage_groups; + s_tag_block damage_groups; // struct: s_damage_group_definition }; ASSERT_STRUCT_SIZE(s_damage_globals_definition, 8); @@ -455,12 +449,12 @@ struct s_game_globals_multiplayer_information tag_reference in_game_text; // unic int32 pad[10]; - tag_block general_events; - tag_block slayer_events; - tag_block ctf_events; - tag_block oddball_events; - tag_block<> unk_block; - tag_block king_events; + s_tag_block general_events; // struct: s_multiplayer_event_response_definition + s_tag_block slayer_events; // struct: s_multiplayer_event_response_definition + s_tag_block ctf_events; // struct: s_multiplayer_event_response_definition + s_tag_block oddball_events; // struct: s_multiplayer_event_response_definition + s_tag_block unk_block; + s_tag_block king_events; // struct: s_multiplayer_event_response_definition }; ASSERT_STRUCT_SIZE(s_game_globals_multiplayer_information, 152); @@ -574,15 +568,15 @@ struct s_game_globals tag_block player_information; tag_block player_representation; tag_block falling_damage; - tag_block old_materials; - tag_block materials; + s_tag_block old_materials; // struct: material_definition + s_tag_block materials; // struct: s_global_material_definition tag_block multiplayer_ui; tag_block profile_colors; // max count: k_game_globals_maximum_multiplayer_colors tag_reference multiplayer_globals; // mulg - tag_block runtime_level_data; - tag_block ui_level_data; + s_tag_block runtime_level_data; // struct: s_runtime_levels_definition + s_tag_block ui_level_data; // struct: s_ui_levels_definition // Explaination("Default global lighting", "") tag_reference default_global_lighting; // gldf @@ -598,11 +592,12 @@ void game_globals_apply_tag_patches(void); s_game_globals* scenario_get_game_globals(void); -s_camera_track_definition* game_globals_get_default_camera_track(); +struct s_camera_track_definition* game_globals_get_default_camera_track(void); void scenario_set_game_globals(s_game_globals* globals); -s_ui_levels_definition* game_globals_get_ui_levels(void); +struct s_ui_levels_definition* game_globals_get_ui_levels(void); + s_game_globals_player_representation* game_globals_get_representation(e_character_type type); inline s_game_globals_rasterizer_data* rasterizer_globals_get_data(void) diff --git a/xlive/Blam/Engine/game/materials.h b/xlive/Blam/Engine/game/materials.h index ef8e0400f..3b904a4ed 100644 --- a/xlive/Blam/Engine/game/materials.h +++ b/xlive/Blam/Engine/game/materials.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" #define NUMBER_OF_MATERIAL_TYPES 33 diff --git a/xlive/Blam/Engine/game/multiplayer_globals.h b/xlive/Blam/Engine/game/multiplayer_globals.h index e1a4a4671..482e0fcd1 100644 --- a/xlive/Blam/Engine/game/multiplayer_globals.h +++ b/xlive/Blam/Engine/game/multiplayer_globals.h @@ -3,7 +3,6 @@ #include "math/color_math.h" #include "memory/static_arrays.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/game/player_control.cpp b/xlive/Blam/Engine/game/player_control.cpp index fb5076fae..e8fb15f13 100644 --- a/xlive/Blam/Engine/game/player_control.cpp +++ b/xlive/Blam/Engine/game/player_control.cpp @@ -9,6 +9,7 @@ #include "main/interpolator.h" #include "saved_games/cartographer_player_profile/cartographer_player_profile.h" #include "units/units.h" +#include "units/unit_definitions.h" #include "H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.h" diff --git a/xlive/Blam/Engine/game/player_control.h b/xlive/Blam/Engine/game/player_control.h index e3ae6ac0f..ad1ac1e6e 100644 --- a/xlive/Blam/Engine/game/player_control.h +++ b/xlive/Blam/Engine/game/player_control.h @@ -1,24 +1,7 @@ #pragma once #include "game/aim_assist.h" -#include "units/unit_definitions.h" - -class c_player_input -{ -public: - real_vector2d throttle; - real32 trigger; - real32 secondary_trigger; - real32 yaw_change; - real32 pitch_change; - uint32 field_18; - uint32 flags_1C; - uint32 flags_20; - uint32 flags_24; - real_euler_angles2d desired_angles; - s_aim_assist_targeting_result targeting; - int8 field_50[4]; -}; +/* structs */ struct s_player_action_weapons { @@ -95,11 +78,32 @@ struct s_player_control_camera_info datum slave_object; int16 parent_seat_index; int16 pad; - s_unit_camera* unit_camera; + struct s_unit_camera* unit_camera; real_point3d location; }; ASSERT_STRUCT_SIZE(s_player_control_camera_info, 24); +/* classes */ + +class c_player_input +{ +public: + real_vector2d throttle; + real32 trigger; + real32 secondary_trigger; + real32 yaw_change; + real32 pitch_change; + uint32 field_18; + uint32 flags_1C; + uint32 flags_20; + uint32 flags_24; + real_euler_angles2d desired_angles; + s_aim_assist_targeting_result targeting; + int8 field_50[4]; +}; + +/* prototypes */ + void __cdecl player_control_update(real32 world_seconds_elapsed, real32 game_seconds_elapsed); void player_control_disable_local_camera(bool state); diff --git a/xlive/Blam/Engine/game/players.h b/xlive/Blam/Engine/game/players.h index 023a28514..14c6181f8 100644 --- a/xlive/Blam/Engine/game/players.h +++ b/xlive/Blam/Engine/game/players.h @@ -190,3 +190,7 @@ void players_update_for_checkpoint(void); void players_joined_in_progress_allow_spawn(void); void players_apply_patches(void); + +/* macros */ + +#define player_get() datum_get(player_data_get(), index); diff --git a/xlive/Blam/Engine/graphicslib/graphicslib.vcxproj b/xlive/Blam/Engine/graphicslib/graphicslib.vcxproj new file mode 100644 index 000000000..da9c9c2ee --- /dev/null +++ b/xlive/Blam/Engine/graphicslib/graphicslib.vcxproj @@ -0,0 +1,403 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 18.0 + Win32Proj + {D82C00DC-18C9-49FF-A189-F68274D2F680} + graphicslib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)graphicslib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + true + false + 4700 + Fast + stdafx.h + false + + + CALL $(SolutionDir)GIT-VS-VERSION-GEN.bat "$(IntDir)" "$(SolutionDir)xlive\version_git.h" + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)graphicslib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + CALL $(SolutionDir)GIT-VS-VERSION-GEN.bat "$(IntDir)" "$(SolutionDir)xlive\version_git.h" + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;IMGUI_DISABLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)graphicslib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + CALL $(SolutionDir)GIT-VS-VERSION-GEN.bat "$(IntDir)" "$(SolutionDir)xlive\version_git.h" + + + + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/graphicslib/graphicslib.vcxproj.filters b/xlive/Blam/Engine/graphicslib/graphicslib.vcxproj.filters new file mode 100644 index 000000000..9276b3d6d --- /dev/null +++ b/xlive/Blam/Engine/graphicslib/graphicslib.vcxproj.filters @@ -0,0 +1,597 @@ + + + + + {0119b867-cafb-4ef3-8646-48668c1979c7} + + + {6765c90c-ac48-49a4-b664-ef17adb23f70} + + + {2c1802bb-cbab-4c3e-9417-c8b286e6317a} + + + {b11b4ff1-08fe-4c6e-b79e-4b8f39debaf1} + + + {f734b33b-7204-498b-b1b3-49d7fea5c604} + + + {6f95fadb-9c9e-416d-b0aa-299eeded988f} + + + {c2cedc96-00ea-41d5-99af-cf65683620e9} + + + {5dc874dd-871a-4af1-bf41-33bbdc7ee37d} + + + {fb731e34-53fc-44e7-bc78-9f0f900304de} + + + {d29ec8a1-d044-48a2-b333-726a9ab487f4} + + + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + graphicslib + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer\dx12 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + decorators + + + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + render + + + graphicslib + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer + + + rasterizer\dx12 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9 + + + rasterizer\dx9\shaders\compiled + + + rasterizer\dx9\shaders\compiled + + + rasterizer\dx9\shaders\compiled + + + rasterizer\dx9\shaders\compiled + + + rasterizer\dx9\shaders\compiled + + + rasterizer\dx9\shaders\compiled + + + rasterizer\dx9\shaders\compiled + + + rasterizer\dx9\shaders\compiled + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + effects + + + decorators + + + decorators + + + shaders + + + shaders + + + shaders + + + shaders + + + shaders + + + shaders + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/graphicslib/stdafx.cpp b/xlive/Blam/Engine/graphicslib/stdafx.cpp new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/xlive/Blam/Engine/graphicslib/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/xlive/Blam/Engine/graphicslib/stdafx.h b/xlive/Blam/Engine/graphicslib/stdafx.h new file mode 100644 index 000000000..33b8c312e --- /dev/null +++ b/xlive/Blam/Engine/graphicslib/stdafx.h @@ -0,0 +1,51 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include + +#include + +/* windows */ + +#ifdef _WIN32 + +#define _USE_MATH_DEFINES +#include + +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#endif + +/* 3rd party */ + +#include +#include + +/* game includes */ + +#include "cseries/cseries.h" +#include "cseries/cseries_errors.h" +#include "cseries/cseries_system_memory.h" + +#include "math/integer_math.h" +#include "math/real_math.h" +#include "memory/static_arrays.h" + +#include "tag_files/tag_groups.h" + +#include "Util/Hooks/Hook.h" +#include "Util/Memory.h" diff --git a/xlive/Blam/Engine/hs/hs.h b/xlive/Blam/Engine/hs/hs.h index 68d2f33ea..632e7c5f6 100644 --- a/xlive/Blam/Engine/hs/hs.h +++ b/xlive/Blam/Engine/hs/hs.h @@ -1,6 +1,5 @@ #pragma once #include "tag_files/data_reference.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" /* constants */ diff --git a/xlive/Blam/Engine/hs/hs_runtime.h b/xlive/Blam/Engine/hs/hs_runtime.h index 8bf03e4a3..e15bab70d 100644 --- a/xlive/Blam/Engine/hs/hs_runtime.h +++ b/xlive/Blam/Engine/hs/hs_runtime.h @@ -1,6 +1,5 @@ #pragma once #include "hs.h" -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/input/input_abstraction.h b/xlive/Blam/Engine/input/input_abstraction.h index 8b980a6e4..f4aff0215 100644 --- a/xlive/Blam/Engine/input/input_abstraction.h +++ b/xlive/Blam/Engine/input/input_abstraction.h @@ -1,5 +1,6 @@ #pragma once #include "controllers.h" +#include "input_constants.h" /* macros */ @@ -191,6 +192,16 @@ enum e_mouse_buttons /* structures */ +struct key_stroke +{ + uint8 modifier_flags; + int8 ascii_code; + wchar_t utf16_code; + e_input_key_code key_code; + bool repeating; +}; +ASSERT_STRUCT_SIZE(key_stroke, 0x8); + struct s_input_button { e_input_device_types m_device_type; @@ -271,7 +282,6 @@ struct s_game_input_state }; ASSERT_STRUCT_SIZE(s_game_input_state, 0xB8); - struct s_input_abstraction_globals { s_gamepad_input_preferences preferences[k_number_of_controllers]; diff --git a/xlive/Blam/Engine/input/input_windows.h b/xlive/Blam/Engine/input/input_windows.h index 9cca9dc1a..b427cf208 100644 --- a/xlive/Blam/Engine/input/input_windows.h +++ b/xlive/Blam/Engine/input/input_windows.h @@ -2,7 +2,6 @@ #include "controllers.h" #include "input_abstraction.h" #include "input_constants.h" -#include "tag_files/tag_groups.h" /* constants */ @@ -72,16 +71,6 @@ struct ascii_key wchar_t remapped_character; }; -struct key_stroke -{ - uint8 modifier_flags; - int8 ascii_code; - wchar_t utf16_code; - e_input_key_code key_code; - bool repeating; -}; -ASSERT_STRUCT_SIZE(key_stroke, 0x8); - struct s_gamepad_input_button_state { uint8 trigger_msec_down[2]; @@ -126,7 +115,7 @@ struct input_globals_windows bool feedback_suppress; uint32 update_time; uint32 update_msec; - IDirectInput8A* direct_input; + struct IDirectInput8A* direct_input; s_keyboard_input_state keyboard; int16 buffered_key_read_index; int16 buffered_key_read_count; diff --git a/xlive/Blam/Engine/interface/first_person_weapons.cpp b/xlive/Blam/Engine/interface/first_person_weapons.cpp index 04b039073..957757e5f 100644 --- a/xlive/Blam/Engine/interface/first_person_weapons.cpp +++ b/xlive/Blam/Engine/interface/first_person_weapons.cpp @@ -911,7 +911,7 @@ static void first_person_weapon_apply_ik(int32 user_index, s_first_person_model_ if (interpolator_controls[0].enabled()) { real32 ratio = interpolator_controls[0].get_ratio(); - if (::abs(ratio) >= k_real_epsilon) + if (::fabs(ratio) >= k_real_epsilon) { s_game_globals* globals = scenario_get_game_globals(); ik_point_iterator iterator; diff --git a/xlive/Blam/Engine/interface/first_person_weapons.h b/xlive/Blam/Engine/interface/first_person_weapons.h index 8c1b53bb4..ba4a26c57 100644 --- a/xlive/Blam/Engine/interface/first_person_weapons.h +++ b/xlive/Blam/Engine/interface/first_person_weapons.h @@ -1,6 +1,5 @@ #pragma once #include "animations/animation_manager.h" -#include "saved_games/player_profile.h" /* constants */ @@ -83,9 +82,9 @@ ASSERT_STRUCT_SIZE(first_person_weapon_data, 4112); struct first_person_weapon { - /*e_first_person_weapon_flags*/ uint32 flags; + uint32 flags; /*e_first_person_weapon_flags*/ datum unit_index; - e_character_type character_type; + int8 character_type; /*e_character_type*/ int8 pad[3]; first_person_weapon_data weapon[k_first_person_max_weapons]; c_interpolator_control rate_interpolator_control; diff --git a/xlive/Blam/Engine/interface/hud_definitions.h b/xlive/Blam/Engine/interface/hud_definitions.h index 5eba1b1a8..7afe1c27c 100644 --- a/xlive/Blam/Engine/interface/hud_definitions.h +++ b/xlive/Blam/Engine/interface/hud_definitions.h @@ -8,7 +8,7 @@ enum e_scaling_flags : short scaling_flag_dont_scale_size = FLAG(1), }; -enum e_button_icon_flags : byte +enum e_button_icon_flags : uint8 { button_icon_flag_use_text_from_string_list_instead = FLAG(0), button_icon_flag_override_default_color = FLAG(1), @@ -22,7 +22,7 @@ struct icon_hud_element_definition short width_offset; point2d offset_from_reference_corner; pixel32 override_icon_color; - byte frame_rate; + uint8 frame_rate; e_button_icon_flags flags; short text_index; diff --git a/xlive/Blam/Engine/interface/hud_messaging.h b/xlive/Blam/Engine/interface/hud_messaging.h index cc19f8928..c384abbe6 100644 --- a/xlive/Blam/Engine/interface/hud_messaging.h +++ b/xlive/Blam/Engine/interface/hud_messaging.h @@ -1,6 +1,5 @@ #pragma once #include "tag_files/data_reference.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" /* structures */ diff --git a/xlive/Blam/Engine/interface/interface.cpp b/xlive/Blam/Engine/interface/interface.cpp index c02c21ea2..c5a70a483 100644 --- a/xlive/Blam/Engine/interface/interface.cpp +++ b/xlive/Blam/Engine/interface/interface.cpp @@ -3,9 +3,9 @@ #include "cutscene/cinematics.h" #include "game/game_globals.h" -#include "rasterizer/dx9/rasterizer_dx9_dynamic_geometry.h" -#include "rasterizer/dx9/rasterizer_dx9_dynavobgeom.h" #include "rasterizer/rasterizer_globals.h" +#include "rasterizer/rasterizer_main.h" +#include "rasterizer/dx9/rasterizer_dx9_dynavobgeom.h" #include "render/render.h" /* constants */ @@ -13,7 +13,7 @@ enum { k_splitscreen_original_game_height = 480, - k_splitscreen_line_colour = D3DCOLOR_ARGB(255, 0, 0, 0) + k_splitscreen_line_colour = PIXEL32_ARGB(255, 0, 0, 0) }; /* globals */ @@ -78,7 +78,7 @@ void __cdecl interface_draw_bitmap( vertex_data[vertex_index].pos_y = pos_y; vertex_data[vertex_index].bounds_x = bounds_x; vertex_data[vertex_index].bounds_y = bounds_y; - vertex_data[vertex_index].color = { D3DCOLOR_ARGB((uint8)(alpha * 255.f), 255, 255, 255) }; // Set color to white with alpha from parameter + vertex_data[vertex_index].color = { PIXEL32_ARGB((uint8)(alpha * 255.f), 255, 255, 255) }; // Set color to white with alpha from parameter } rasterizer_dynamic_screen_geometry_parameters parameters; diff --git a/xlive/Blam/Engine/interface/interface.h b/xlive/Blam/Engine/interface/interface.h index 473663106..b40cd83de 100644 --- a/xlive/Blam/Engine/interface/interface.h +++ b/xlive/Blam/Engine/interface/interface.h @@ -1,5 +1,4 @@ #pragma once -#include "math/real_math.h" /* enums */ diff --git a/xlive/Blam/Engine/interface/interfacelib.vcxproj b/xlive/Blam/Engine/interface/interfacelib.vcxproj new file mode 100644 index 000000000..81600a9b8 --- /dev/null +++ b/xlive/Blam/Engine/interface/interfacelib.vcxproj @@ -0,0 +1,369 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + 18.0 + Win32Proj + {F59089C4-6D57-47EF-93A6-B6A49E168EF0} + interfacelib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)interfacelib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + .\;..\;..\..\..\;..\..\..\3rdparty;..\..\..\XLive + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + true + false + 4700 + Fast + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)interfacelib.pch + $(IntDir) + $(IntDir) + Level4 + false + .\;..\;..\..\..\;..\..\..\3rdparty;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;IMGUI_DISABLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)interfacelib.pch + $(IntDir) + $(IntDir) + Level4 + false + .\;..\;..\..\..\;..\..\..\3rdparty;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/interface/interfacelib.vcxproj.filters b/xlive/Blam/Engine/interface/interfacelib.vcxproj.filters new file mode 100644 index 000000000..8f6821f4f --- /dev/null +++ b/xlive/Blam/Engine/interface/interfacelib.vcxproj.filters @@ -0,0 +1,528 @@ + + + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interfacelib + + + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface\screens + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interface + + + interfacelib + + + + + {02446882-83a4-4576-a291-416d75bf0dbe} + + + {ce8da0e6-db54-40cc-82bb-f6a7a6bd8a06} + + + {553b88c6-c883-4f01-829b-c40f2215abac} + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/interface/motion_sensor.h b/xlive/Blam/Engine/interface/motion_sensor.h index 92ebcac3e..6c06283f3 100644 --- a/xlive/Blam/Engine/interface/motion_sensor.h +++ b/xlive/Blam/Engine/interface/motion_sensor.h @@ -10,7 +10,7 @@ enum e_motion_sensor_blip_size : int16 struct s_local_player_motion_sensor_sample { - byte gap[68]; + uint8 gap[68]; }; ASSERT_STRUCT_SIZE(s_local_player_motion_sensor_sample, 0x44); @@ -18,7 +18,7 @@ class c_local_player_motion_sensor_data { public: s_local_player_motion_sensor_sample samples[9]; - byte gap_264[130]; + uint8 gap_264[130]; int32 field_2E8; int32 field_2EC; diff --git a/xlive/Blam/Engine/interface/new_hud_definitions.h b/xlive/Blam/Engine/interface/new_hud_definitions.h index 3d8fbc0a7..05fc790be 100644 --- a/xlive/Blam/Engine/interface/new_hud_definitions.h +++ b/xlive/Blam/Engine/interface/new_hud_definitions.h @@ -2,7 +2,6 @@ #include "math/function_definitions.h" #include "memory/static_arrays.h" #include "render/render.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" #include "text/text.h" @@ -160,7 +159,7 @@ enum e_special_hud_type : short special_hud_type_territory_meter = 7 }; -enum e_hud_input_type : byte +enum e_hud_input_type : uint8 { hud_input_type_basic_zero = 0, hud_input_type_basic_one = 1, @@ -332,10 +331,10 @@ struct s_hud_widget_state_definition e_widget_state_weapon_flags no_weapon_flags; e_widget_state_game_engine_state_flags no_game_engine_state_flags; - byte age_cutoff; - byte clip_cutoff; - byte total_cutoff; - byte pad; + uint8 age_cutoff; + uint8 clip_cutoff; + uint8 total_cutoff; + uint8 pad; }; ASSERT_STRUCT_SIZE(s_hud_widget_inputs_definition, 4); diff --git a/xlive/Blam/Engine/interface/new_hud_draw.cpp b/xlive/Blam/Engine/interface/new_hud_draw.cpp index db4c70536..0519cd05e 100644 --- a/xlive/Blam/Engine/interface/new_hud_draw.cpp +++ b/xlive/Blam/Engine/interface/new_hud_draw.cpp @@ -11,8 +11,6 @@ #include "camera/camera.h" #include "game/players.h" -#include "rasterizer/dx9/rasterizer_dx9.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" #include "rasterizer/dx9/rasterizer_dx9_shader_submit_new.h" #include "rasterizer/rasterizer_text.h" #include "render/render.h" @@ -44,15 +42,15 @@ typedef void(__cdecl* t_render_ingame_user_interface_hud_indicators_element_hook static const pixel32 k_draw_hud_bitmap_widget_shield_pixel_colors[9] { - D3DCOLOR_ARGB(0, 0, 0, 0), - D3DCOLOR_ARGB(0, 255, 0, 0), - D3DCOLOR_ARGB(0, 0, 255, 0), - D3DCOLOR_ARGB(0, 255, 255, 0), - D3DCOLOR_ARGB(0, 127, 0, 255), - D3DCOLOR_ARGB(0, 69, 5, 154), - D3DCOLOR_ARGB(0, 156, 70, 193), - D3DCOLOR_ARGB(0, 00, 85, 170), - D3DCOLOR_ARGB(0, 0,120,240), + PIXEL32_ARGB(0, 0, 0, 0), + PIXEL32_ARGB(0, 255, 0, 0), + PIXEL32_ARGB(0, 0, 255, 0), + PIXEL32_ARGB(0, 255, 255, 0), + PIXEL32_ARGB(0, 127, 0, 255), + PIXEL32_ARGB(0, 69, 5, 154), + PIXEL32_ARGB(0, 156, 70, 193), + PIXEL32_ARGB(0, 00, 85, 170), + PIXEL32_ARGB(0, 0,120,240), }; /* globals */ @@ -69,8 +67,6 @@ uint8 g_draw_hud_user_draw_player_indicators_mask; /* prototypes */ -static void rasterizer_setup_2d_vertex_shader_user_interface_constants(void); - static void __cdecl render_ingame_user_interface_hud_indicators_element_hook(int32* a1, datum tag_index, datum bitmap_index, int32* a4, datum shader_index); /* private code */ @@ -849,62 +845,14 @@ void __cdecl render_ingame_user_interface_hud_element( real_rectangle2d* bounds, datum shader_tag_index) { - rasterizer_setup_2d_vertex_shader_user_interface_constants(); + rasterizer_dx9_setup_2d_vertex_shader_user_interface_constants(); p_draw_ingame_user_interface_hud_element(left, top, x, y, scale, rotation_rad, bitmap_tag_index, bitmap, bounds, shader_tag_index); return; } -static void rasterizer_setup_2d_vertex_shader_user_interface_constants(void) -{ - IDirect3DDevice9Ex* global_d3d_device = rasterizer_dx9_device_get_interface(); - - real_vector4d vc[5]; - int16 width, height; - - s_render* render = render_get(); - - rectangle2d screen_bounds = render->camera.viewport_bounds; - width = rectangle2d_width(&screen_bounds); - height = rectangle2d_height(&screen_bounds); - - // vertex shaders use normalized device coordinates system (NDC) - vc[0].i = 2.0f / (real32)width; // x - vc[0].j = 0.0f; - vc[0].k = 0.0f; - vc[0].l = -(1.0f / (real32)width + 1.0f) - ((real32)screen_bounds.left * 2.0f / width); // offset from x - - vc[1].i = 0.0f; - vc[1].j = -(2.0f / (real32)height); // y - vc[1].k = 0.0f; - vc[1].l = (1.0f / (real32)height + 1.0f) + ((real32)screen_bounds.top * 2.0f / height); // offset from y - - vc[2].i = 0.0f; - vc[2].j = 0.0f; - vc[2].k = 0.0f; // z - vc[2].l = 0.5f; // acts as an offset, facing (<=1.0f is towards the viewport, above 1.0f facing from the viewport) - - vc[3].i = 0.0f; - vc[3].j = 0.0f; - vc[3].k = 0.0f; - vc[3].l = 1.0f; // w scaling component - - // the c181 register seems unused? - vc[4].i = 0.0f; - vc[4].j = 0.0f; - vc[4].k = 0.0f; - vc[4].l = 0.0f; - - // avoid unnecessary API calls by testing the user mode memory cache - if (rasterizer_get_main_vertex_shader_cache()->test_cache(177, vc, NUMBEROF(vc))) - { - global_d3d_device->SetVertexShaderConstantF(177, (const real32*)vc, NUMBEROF(vc)); - } - return; -} - static void __cdecl render_ingame_user_interface_hud_indicators_element_hook(int32* a1, datum tag_index, datum bitmap_index, int32* a4, datum shader_index) { - rasterizer_setup_2d_vertex_shader_user_interface_constants(); + rasterizer_dx9_setup_2d_vertex_shader_user_interface_constants(); p_render_ingame_user_interface_hud_indicators_element(a1, tag_index, bitmap_index, a4, shader_index); return; } diff --git a/xlive/Blam/Engine/interface/screens/screen_4way_signin.h b/xlive/Blam/Engine/interface/screens/screen_4way_signin.h index 57ecebc4a..d530e1004 100644 --- a/xlive/Blam/Engine/interface/screens/screen_4way_signin.h +++ b/xlive/Blam/Engine/interface/screens/screen_4way_signin.h @@ -1,6 +1,5 @@ #pragma once -#include "interface/user_interface_widget_window.h" enum e_4_way_signin_type { diff --git a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h index 8f1114684..aa624fee9 100644 --- a/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h +++ b/xlive/Blam/Engine/interface/screens/screen_brightness_menu.h @@ -2,7 +2,6 @@ #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_button_settings.h b/xlive/Blam/Engine/interface/screens/screen_button_settings.h index 6c2cdfa21..6f27c48ec 100644 --- a/xlive/Blam/Engine/interface/screens/screen_button_settings.h +++ b/xlive/Blam/Engine/interface/screens/screen_button_settings.h @@ -1,7 +1,6 @@ #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_cartographer_account_manager.cpp b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp index 2d5aea605..21e38d135 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.cpp @@ -22,6 +22,8 @@ #include "H2MOD/Modules/Shell/Config.h" #include "H2MOD/Utils/Utils.h" +#include + /* enums */ enum e_cartographer_screen_type_account_list_string_table 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 5e1f092c3..e080f0a61 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_account_manager.h @@ -1,7 +1,6 @@ #pragma once #include "interface/user_interface_widget_list.h" #include "interface/user_interface_widget_list_item.h" -#include "interface/user_interface_widget_window.h" /* constants */ diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h index d10c325fe..ade46143f 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_errors.h @@ -44,7 +44,7 @@ class c_cartographer_error_menu : protected c_screen_widget public: static void* load_by_error_id(e_cartographer_error_id error_id); - static void* load(s_screen_parameters* a1); + static void* load(struct s_screen_parameters* a1); c_cartographer_error_menu(e_user_interface_channel_type _ui_channel, e_user_interface_render_window _window_index, uint16 _flags); @@ -53,8 +53,8 @@ class c_cartographer_error_menu : protected c_screen_widget virtual ~c_cartographer_error_menu() = default; virtual void pre_destroy() override; - virtual bool handle_event(s_event_record* event) override; - virtual void initialize(s_screen_parameters* screen_parameters) override; + virtual bool handle_event(struct s_event_record* event) override; + virtual void initialize(struct s_screen_parameters* screen_parameters) override; virtual const void* load_proc(void) const override; private: diff --git a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h index eb0cc6ece..436bf2105 100644 --- a/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h +++ b/xlive/Blam/Engine/interface/screens/screen_cartographer_menus.h @@ -5,7 +5,6 @@ #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" /* macro defines */ diff --git a/xlive/Blam/Engine/interface/screens/screen_display_mode.cpp b/xlive/Blam/Engine/interface/screens/screen_display_mode.cpp index 43a12e4b4..24f44c178 100644 --- a/xlive/Blam/Engine/interface/screens/screen_display_mode.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_display_mode.cpp @@ -114,7 +114,7 @@ void c_display_mode_edit_list::set_using_mp_screen(bool param) void c_display_mode_edit_list::handle_item_pressed_event(s_event_record** pevent, datum* pitem_index) { int16 absolute_index = DATUM_INDEX_TO_ABSOLUTE_INDEX(*pitem_index); - // ASSERT(absolute_index <= _rasterizer_settings_display_mode_last_user_selectable); + ASSERT(absolute_index <= _rasterizer_settings_display_mode_last_user_selectable); absolute_index = absolute_index > _item_last ? _item_first : absolute_index; const e_rasterizer_window_mode display_mode = item_type_to_display_mode((e_display_mode_settings_list_items)absolute_index); diff --git a/xlive/Blam/Engine/interface/screens/screen_display_mode.h b/xlive/Blam/Engine/interface/screens/screen_display_mode.h index 71e273056..d385330de 100644 --- a/xlive/Blam/Engine/interface/screens/screen_display_mode.h +++ b/xlive/Blam/Engine/interface/screens/screen_display_mode.h @@ -2,7 +2,6 @@ #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" #include "main/game_preferences.h" /* macro defines */ diff --git a/xlive/Blam/Engine/interface/screens/screen_main_menu.cpp b/xlive/Blam/Engine/interface/screens/screen_main_menu.cpp index 072f44f84..e271d9a74 100644 --- a/xlive/Blam/Engine/interface/screens/screen_main_menu.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_main_menu.cpp @@ -12,12 +12,17 @@ #include "interface/user_interface_guide.h" #include "interface/user_interface_utilities.h" #include "main/game_preferences.h" -#include "Networking/online/online_account_xbox.h" -#include "Networking/transport/transport.h" -#include "Networking/panorama/panorama_friends.h" - +#include "networking/online/online_account_xbox.h" +#include "networking/transport/transport.h" +#include "networking/panorama/panorama_friends.h" #include "shell/shell.h" +#include "H2MOD/Modules/Accounts/AccountLogin.h" +#include "H2MOD/Modules/Shell/Config.h" +#include "H2MOD/Utils/Utils.h" + +#include + /* enums */ enum e_main_menu_list_items : uint16 @@ -50,8 +55,9 @@ enum e_main_menu_list_skin_texts /* constants */ -const char* k_main_menu_list_name = "main menu list"; -const wchar_t* k_online_button_text[k_language_count] = +static const char* k_main_menu_list_name = "main menu list"; + +static const wchar_t* k_online_button_text[k_language_count] = { L"ONLINE", L"オンライン", @@ -67,11 +73,29 @@ const wchar_t* k_online_button_text[k_language_count] = /* prototypes */ static bool __cdecl screen_show_campaign_options_without_achievement(e_controller_index controller_index); + static bool __cdecl screen_show_screen_4way_signin_splitscreen_offline(e_controller_index controller_index); + static bool __cdecl screen_show_screen_4way_signin_system_link_offline(e_controller_index controller_index); + static bool __cdecl screen_show_screen_4way_signin_xbox_live_callback(void); -/* public */ +static void online_account_transition_to_offline(void); + +static __declspec(naked) void jmp_c_main_menu_list() +{ + CLASS_HOOK_JMP(c_main_menu_list__c_main_menu_list_ctor, c_main_menu_list::c_main_menu_list_ctor); +} + +/* public code */ + +void c_main_menu_list::apply_instance_patches() +{ + if (shell_is_dedicated_server()) + return; + + PatchCall(Memory::GetAddress(0xB724), jmp_c_main_menu_list); //replace our c_main_menu_list inside c_screen_main_menu ctor +} c_main_menu_list::c_main_menu_list(int16 user_flags) : c_list_widget(user_flags), @@ -108,11 +132,6 @@ void c_main_menu_list::c_main_menu_list_ctor(int16 user_flags) new (this)c_main_menu_list(user_flags); } -__declspec(naked) void jmp_c_main_menu_list() -{ - CLASS_HOOK_JMP(c_main_menu_list__c_main_menu_list_ctor, c_main_menu_list::c_main_menu_list_ctor); -} - c_list_item_widget* c_main_menu_list::get_list_items() { return m_list_items; @@ -528,11 +547,14 @@ static bool __cdecl screen_show_screen_4way_signin_xbox_live_callback(void) return true; } - -void c_main_menu_list::apply_instance_patches() +static void online_account_transition_to_offline(void) { - if (shell_is_dedicated_server()) - return; + BYTE abEnet[6]; + BYTE abOnline[20]; + XNetRandom(abEnet, sizeof(abEnet)); + XNetRandom(abOnline, sizeof(abOnline)); + ConfigureUserDetails("[Username]", "12345678901234567890123456789012", rand(), 0, H2Config_ip_lan, ByteToHexStr(abEnet, sizeof(abEnet)).c_str(), ByteToHexStr(abOnline, sizeof(abOnline)).c_str(), false); - PatchCall(Memory::GetAddress(0xB724), jmp_c_main_menu_list); //replace our c_main_menu_list inside c_screen_main_menu ctor + XUserSignInSetStatusChanged(0); + return; } diff --git a/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.cpp b/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.cpp index 84f529497..60f94c82b 100644 --- a/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.cpp @@ -3,7 +3,6 @@ #include "cache/cache_files.h" #include "interface/user_interface_screen_widget_definition.h" -#include "interface/user_interface_widget_window.h" #include "interface/user_interface_networking.h" #include "tag_files/tag_loader/tag_injection.h" diff --git a/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.h b/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.h index 88ded4198..9e512eed0 100644 --- a/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.h +++ b/xlive/Blam/Engine/interface/screens/screen_multiplayer_pregame_lobby.h @@ -1,6 +1,5 @@ #pragma once #include "game/game_allegiance.h" -#include "interface/user_interface_widget_window.h" #include "interface/user_interface_widget_text.h" #include "interface/user_interface_widget_button.h" #include "interface/user_interface_widget_text_entry.h" diff --git a/xlive/Blam/Engine/interface/screens/screen_multiplayer_video_settings_menu.h b/xlive/Blam/Engine/interface/screens/screen_multiplayer_video_settings_menu.h index f8c77e1e3..066efb1ea 100644 --- a/xlive/Blam/Engine/interface/screens/screen_multiplayer_video_settings_menu.h +++ b/xlive/Blam/Engine/interface/screens/screen_multiplayer_video_settings_menu.h @@ -2,7 +2,6 @@ #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" /* macro defines */ diff --git a/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.cpp b/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.cpp index ba7c9dbee..1d330be35 100644 --- a/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.cpp @@ -6,8 +6,6 @@ #include "networking/logic/network_logic.h" #include "networking/transport/transport_security.h" -#include - /* typedefs */ typedef c_screen_network_squad_browser* (__cdecl* load_network_browser_t)(s_screen_parameters*); diff --git a/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.h b/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.h index 5983e6a01..510307d11 100644 --- a/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.h +++ b/xlive/Blam/Engine/interface/screens/screen_network_squad_browser.h @@ -1,7 +1,6 @@ #pragma once #include "interface/user_interface_widget_list.h" #include "interface/user_interface_widget_list_item.h" -#include "interface/user_interface_widget_window.h" /* enums */ 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 10fc9e4b6..e201bd803 100644 --- a/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.h +++ b/xlive/Blam/Engine/interface/screens/screen_press_start_introduction.h @@ -1,6 +1,5 @@ #pragma once #include "interface/user_interface_controller.h" -#include "interface/user_interface_widget_window.h" #include "interface/user_interface_widget_button.h" diff --git a/xlive/Blam/Engine/interface/screens/screen_settings.h b/xlive/Blam/Engine/interface/screens/screen_settings.h index 758c61e06..5d072520c 100644 --- a/xlive/Blam/Engine/interface/screens/screen_settings.h +++ b/xlive/Blam/Engine/interface/screens/screen_settings.h @@ -2,7 +2,6 @@ #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_splitscreen_setting.h b/xlive/Blam/Engine/interface/screens/screen_splitscreen_setting.h index 2d77a7060..2bdbd838a 100644 --- a/xlive/Blam/Engine/interface/screens/screen_splitscreen_setting.h +++ b/xlive/Blam/Engine/interface/screens/screen_splitscreen_setting.h @@ -1,7 +1,6 @@ #pragma once #include "interface/user_interface_widget_list.h" #include "interface/user_interface_widget_list_item.h" -#include "interface/user_interface_widget_window.h" #include "main/game_preferences.h" /* constants */ diff --git a/xlive/Blam/Engine/interface/screens/screen_squad_settings.h b/xlive/Blam/Engine/interface/screens/screen_squad_settings.h index 5bb4ad38b..00240f7c2 100644 --- a/xlive/Blam/Engine/interface/screens/screen_squad_settings.h +++ b/xlive/Blam/Engine/interface/screens/screen_squad_settings.h @@ -2,7 +2,6 @@ #include "interface/user_interface_widget_list.h" #include "interface/user_interface_widget_list_item.h" -#include "interface/user_interface_widget_window.h" /* constants */ diff --git a/xlive/Blam/Engine/interface/screens/screen_video_settings.cpp b/xlive/Blam/Engine/interface/screens/screen_video_settings.cpp index b96a005eb..db4802626 100644 --- a/xlive/Blam/Engine/interface/screens/screen_video_settings.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_video_settings.cpp @@ -11,6 +11,7 @@ #include "screen_vsync_setting.h" #include "screen_splitscreen_setting.h" +#include "cache/cache_files.h" #include "interface/user_interface_bitmap_block.h" #include "interface/user_interface_controller.h" #include "interface/user_interface_memory.h" @@ -18,12 +19,8 @@ #include "interface/user_interface_utilities.h" #include "rasterizer/rasterizer_settings.h" -#include "tag_files/tag_loader/tag_injection.h" - #include "H2MOD/Modules/Shell/Config.h" -/* macro defines */ - /* constants */ static const char* k_video_setting_list_name = "video settings list"; diff --git a/xlive/Blam/Engine/interface/screens/screen_video_settings.h b/xlive/Blam/Engine/interface/screens/screen_video_settings.h index 0eb49fbff..c2b833b15 100644 --- a/xlive/Blam/Engine/interface/screens/screen_video_settings.h +++ b/xlive/Blam/Engine/interface/screens/screen_video_settings.h @@ -2,7 +2,6 @@ #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" /* 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 b39aac075..85cffe5bc 100644 --- a/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h +++ b/xlive/Blam/Engine/interface/screens/screen_virtual_keyboard.h @@ -1,7 +1,5 @@ #pragma once #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/screens/screen_vsync_setting.cpp b/xlive/Blam/Engine/interface/screens/screen_vsync_setting.cpp index 051e6e1de..41c0a669e 100644 --- a/xlive/Blam/Engine/interface/screens/screen_vsync_setting.cpp +++ b/xlive/Blam/Engine/interface/screens/screen_vsync_setting.cpp @@ -4,7 +4,7 @@ #include "interface/user_interface_memory.h" #include "rasterizer/rasterizer_globals.h" #include "rasterizer/rasterizer_settings.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" +#include "rasterizer/rasterizer_main.h" #include "H2MOD/Modules/Shell/Config.h" @@ -100,10 +100,10 @@ void c_vsync_edit_list::handle_item_pressed_event(s_event_record** pevent, datum const bool choice = DATUM_INDEX_TO_ABSOLUTE_INDEX(*pitem_index) == _item_on ? true : false; H2Config_use_vsync = choice; - if (rasterizer_dx9_main_globals_get()->global_d3d_device) + if (rasterizer_is_initialized()) { rasterizer_globals_get()->reset_screen = true; - rasterizer_dx9_reset(false); + rasterizer_reset(false); } user_interface_back_out_from_channel(this->get_parent_channel(), this->get_parent_render_window()); diff --git a/xlive/Blam/Engine/interface/screens/screen_vsync_setting.h b/xlive/Blam/Engine/interface/screens/screen_vsync_setting.h index d10963e87..a7c616df2 100644 --- a/xlive/Blam/Engine/interface/screens/screen_vsync_setting.h +++ b/xlive/Blam/Engine/interface/screens/screen_vsync_setting.h @@ -2,7 +2,6 @@ #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" #include "main/game_preferences.h" /* constants */ 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 7cd52dbad..8627bc429 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 @@ -4,6 +4,8 @@ /* typedefs */ typedef void (__cdecl* proc_task_cb_t)(class c_screen_xbox_live_task_progress_dialog*); +enum e_user_interface_channel_type; +enum e_user_interface_render_window; /* classes */ @@ -33,15 +35,15 @@ class c_screen_xbox_live_task_progress_dialog : c_screen_widget static void add_task(proc_task_cb_t callback); static void add_task_ex(datum task_datum, e_controller_index controller_index, proc_task_cb_t update_function, proc_task_cb_t close_function, uint8* data); static void apply_patches_on_map_load(); - static void* load(s_screen_parameters* parameters); + static void* load(struct s_screen_parameters* parameters); // c_screen_xbox_live_task_progress_dialog virtual functions virtual ~c_screen_xbox_live_task_progress_dialog(); virtual void update() override; - virtual bool handle_event(s_event_record* event) override; - virtual void initialize(s_screen_parameters* parameters) override; + virtual bool handle_event(struct s_event_record* event) override; + virtual void initialize(struct s_screen_parameters* parameters) 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/terminal.cpp b/xlive/Blam/Engine/interface/terminal.cpp index 26759d8cb..7b33e24c8 100644 --- a/xlive/Blam/Engine/interface/terminal.cpp +++ b/xlive/Blam/Engine/interface/terminal.cpp @@ -4,6 +4,7 @@ #ifdef TERMINAL_ENABLED #include "cseries/threads_windows.h" +#include "input/input_windows.h" #include "interface/hud.h" #include "main/console.h" #include "memory/data.h" diff --git a/xlive/Blam/Engine/interface/terminal.h b/xlive/Blam/Engine/interface/terminal.h index cc73bca71..e6945c619 100644 --- a/xlive/Blam/Engine/interface/terminal.h +++ b/xlive/Blam/Engine/interface/terminal.h @@ -3,7 +3,7 @@ #ifdef TERMINAL_ENABLED #include "dialogs/edit_text.h" -#include "input/input_windows.h" +#include "input/input_abstraction.h" #include "math/color_math.h" /* constants */ diff --git a/xlive/Blam/Engine/interface/user_interface.cpp b/xlive/Blam/Engine/interface/user_interface.cpp index f95d07dd1..355e9f265 100644 --- a/xlive/Blam/Engine/interface/user_interface.cpp +++ b/xlive/Blam/Engine/interface/user_interface.cpp @@ -504,7 +504,7 @@ void __cdecl user_interface_return_to_mainmenu(bool a1) void __cdecl user_interface_update(real32 dt) { static real32 user_interface_precise_accumulator_msec = 0.f; - user_interface_precise_accumulator_msec += (dt * 1000.f) - floor(dt * 1000.f); + user_interface_precise_accumulator_msec += (dt * 1000.f) - (real32)floor(dt * 1000.f); if (user_interface_precise_accumulator_msec >= 1.f) { *Memory::GetAddress(0x971900) += (int32)user_interface_precise_accumulator_msec; diff --git a/xlive/Blam/Engine/interface/user_interface.h b/xlive/Blam/Engine/interface/user_interface.h index 5f998a537..fdb8c402c 100644 --- a/xlive/Blam/Engine/interface/user_interface.h +++ b/xlive/Blam/Engine/interface/user_interface.h @@ -1,6 +1,5 @@ #pragma once #include "input/controllers.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" /* constants */ @@ -380,7 +379,7 @@ struct s_user_interface_tag_globals tag_reference shared_globals; // wigl // Explaination("Screen Widgets", "These are the screen widgets") - s_tag_block screen_widgets; // s_user_interface_widget_reference + s_tag_block screen_widgets; // struct: s_user_interface_widget_reference // Explaination("Multiplayer Variant Settings Interface", "This blob defines the ui for setting multiplayer game variant parameters") tag_reference mp_variant_settings_ui; // goof diff --git a/xlive/Blam/Engine/interface/user_interface_controller.cpp b/xlive/Blam/Engine/interface/user_interface_controller.cpp index 41afa5cb9..d379eb153 100644 --- a/xlive/Blam/Engine/interface/user_interface_controller.cpp +++ b/xlive/Blam/Engine/interface/user_interface_controller.cpp @@ -14,7 +14,6 @@ #include "scenario/scenario.h" #include "sound/sound_manager.h" -#include "tag_files/tag_groups.h" #include "text/unicode.h" /* typedefs */ diff --git a/xlive/Blam/Engine/interface/user_interface_screen_widget_definition.h b/xlive/Blam/Engine/interface/user_interface_screen_widget_definition.h index a0eac905a..1d9838193 100644 --- a/xlive/Blam/Engine/interface/user_interface_screen_widget_definition.h +++ b/xlive/Blam/Engine/interface/user_interface_screen_widget_definition.h @@ -2,7 +2,6 @@ #include "user_interface_shared_globals.h" #include "math/color_math.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/interface/user_interface_shared_globals.h b/xlive/Blam/Engine/interface/user_interface_shared_globals.h index 44989926d..1475725b8 100644 --- a/xlive/Blam/Engine/interface/user_interface_shared_globals.h +++ b/xlive/Blam/Engine/interface/user_interface_shared_globals.h @@ -4,7 +4,6 @@ #include "math/color_math.h" #include "math/integer_math.h" #include "tag_files/tag_block.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" /* constants */ diff --git a/xlive/Blam/Engine/interface/user_interface_text.cpp b/xlive/Blam/Engine/interface/user_interface_text.cpp index 34f446b07..99e6bd876 100644 --- a/xlive/Blam/Engine/interface/user_interface_text.cpp +++ b/xlive/Blam/Engine/interface/user_interface_text.cpp @@ -5,6 +5,7 @@ #include "interface/hud.h" #include "input/input_constants.h" +#include "input/input_windows.h" #include "main/game_preferences.h" c_user_interface_text::c_user_interface_text() diff --git a/xlive/Blam/Engine/interface/user_interface_text.h b/xlive/Blam/Engine/interface/user_interface_text.h index 493fe4676..cb1763e39 100644 --- a/xlive/Blam/Engine/interface/user_interface_text.h +++ b/xlive/Blam/Engine/interface/user_interface_text.h @@ -1,6 +1,6 @@ #pragma once #include "math/color_math.h" -#include "input/input_windows.h" +#include "input/input_constants.h" /* classes */ diff --git a/xlive/Blam/Engine/interface/user_interface_text_chat_receiver.h b/xlive/Blam/Engine/interface/user_interface_text_chat_receiver.h index d679a49b2..2fa62a5f2 100644 --- a/xlive/Blam/Engine/interface/user_interface_text_chat_receiver.h +++ b/xlive/Blam/Engine/interface/user_interface_text_chat_receiver.h @@ -1,6 +1,5 @@ #pragma once #include "user_interface_text_chat.h" -#include "tag_files/tag_groups.h" /* classes */ diff --git a/xlive/Blam/Engine/interface/user_interface_utilities.h b/xlive/Blam/Engine/interface/user_interface_utilities.h index 91dfca7f8..12621648c 100644 --- a/xlive/Blam/Engine/interface/user_interface_utilities.h +++ b/xlive/Blam/Engine/interface/user_interface_utilities.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* forward declarations */ diff --git a/xlive/Blam/Engine/interface/user_interface_widget_list.h b/xlive/Blam/Engine/interface/user_interface_widget_list.h index dc58c4a56..9791420f8 100644 --- a/xlive/Blam/Engine/interface/user_interface_widget_list.h +++ b/xlive/Blam/Engine/interface/user_interface_widget_list.h @@ -2,7 +2,6 @@ #include "user_interface_widget.h" #include "signal_slot.h" #include "memory/data.h" -#include "tag_files/tag_groups.h" /* enums */ diff --git a/xlive/Blam/Engine/interface/user_interface_widget_text.h b/xlive/Blam/Engine/interface/user_interface_widget_text.h index b050629c4..fcdb43e6a 100644 --- a/xlive/Blam/Engine/interface/user_interface_widget_text.h +++ b/xlive/Blam/Engine/interface/user_interface_widget_text.h @@ -1,7 +1,6 @@ #pragma once #include "user_interface_widget.h" #include "user_interface_text_block.h" -#include "tag_files/tag_groups.h" /* classes */ diff --git a/xlive/Blam/Engine/interfacelib/stdafx.cpp b/xlive/Blam/Engine/interfacelib/stdafx.cpp new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/xlive/Blam/Engine/interfacelib/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/xlive/Blam/Engine/interfacelib/stdafx.h b/xlive/Blam/Engine/interfacelib/stdafx.h new file mode 100644 index 000000000..dc8ade211 --- /dev/null +++ b/xlive/Blam/Engine/interfacelib/stdafx.h @@ -0,0 +1,55 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include + +#include +#include + +/* windows */ + +#ifdef _WIN32 + +#define _USE_MATH_DEFINES +#include + +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include + +// Use Xinput 9.1.0 and Dinput 0x0800 +#define XINPUT_USE_9_1_0 +#define DIRECTINPUT_VERSION 0x0800 + +#include +#include + +#pragma comment(lib, "IPHLPAPI.lib") + +#endif + +/* 3rd party */ + +#include + +/* game includes */ + +#include "cseries/cseries.h" +#include "cseries/cseries_errors.h" +#include "cseries/cseries_system_memory.h" + +#include "math/integer_math.h" +#include "math/real_math.h" +#include "memory/static_arrays.h" +#include "tag_files/tag_groups.h" + +#include "H2MOD/Utils/curl_constants.h" +#include "Util/Hooks/Hook.h" +#include "Util/Memory.h" + +#include "interface/user_interface_widget_window.h" diff --git a/xlive/Blam/Engine/items/item_collection_definition.h b/xlive/Blam/Engine/items/item_collection_definition.h index a081d7418..be1c2544e 100644 --- a/xlive/Blam/Engine/items/item_collection_definition.h +++ b/xlive/Blam/Engine/items/item_collection_definition.h @@ -1,7 +1,6 @@ #pragma once #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" -#include "tag_files/tag_groups.h" // max count: 32 struct item_permutation_definition diff --git a/xlive/Blam/Engine/items/vehicle_collection_definitions.h b/xlive/Blam/Engine/items/vehicle_collection_definitions.h index ba4dd2145..ef1cf97c0 100644 --- a/xlive/Blam/Engine/items/vehicle_collection_definitions.h +++ b/xlive/Blam/Engine/items/vehicle_collection_definitions.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/items/weapon_definitions.cpp b/xlive/Blam/Engine/items/weapon_definitions.cpp index 56fa63e97..c5a96eb87 100644 --- a/xlive/Blam/Engine/items/weapon_definitions.cpp +++ b/xlive/Blam/Engine/items/weapon_definitions.cpp @@ -11,7 +11,7 @@ void weapon_definitions_apply_patches(void) return; } -weapon_first_person_interface_definition* first_person_interface_definition_get(const weapon_definition* definition, e_character_type character_type) +weapon_first_person_interface_definition* first_person_interface_definition_get(const weapon_definition* definition, int8 character_type) { weapon_first_person_interface_definition* result = NULL; int32 index = 0; diff --git a/xlive/Blam/Engine/items/weapon_definitions.h b/xlive/Blam/Engine/items/weapon_definitions.h index f8462aa2a..4681e2036 100644 --- a/xlive/Blam/Engine/items/weapon_definitions.h +++ b/xlive/Blam/Engine/items/weapon_definitions.h @@ -523,6 +523,6 @@ ASSERT_STRUCT_SIZE(weapon_definition, 796); /* prototypes */ -weapon_first_person_interface_definition* first_person_interface_definition_get(const weapon_definition* definition, enum e_character_type : int8 character_type); +weapon_first_person_interface_definition* first_person_interface_definition_get(const weapon_definition* definition, int8 character_type); void weapon_definitions_apply_patches(void); diff --git a/xlive/Blam/Engine/main/console.cpp b/xlive/Blam/Engine/main/console.cpp index e7a065632..84cb6b57c 100644 --- a/xlive/Blam/Engine/main/console.cpp +++ b/xlive/Blam/Engine/main/console.cpp @@ -10,6 +10,7 @@ #include "debug/menu/debug_menu_main.h" #endif #include "hs/hs.h" +#include "input/input_windows.h" #include "interface/terminal.h" #include "interface/user_interface_guide.h" #include "shell/shell.h" diff --git a/xlive/Blam/Engine/main/interpolator.h b/xlive/Blam/Engine/main/interpolator.h index 1920afdd1..2c49e1e3b 100644 --- a/xlive/Blam/Engine/main/interpolator.h +++ b/xlive/Blam/Engine/main/interpolator.h @@ -2,7 +2,7 @@ #include "game/player_constants.h" #include "interface/first_person_weapons.h" #include "models/render_models.h" -#include "objects/objects.h" +#include "objects/object_constants.h" /* constants */ diff --git a/xlive/Blam/Engine/main/main.cpp b/xlive/Blam/Engine/main/main.cpp index 907d4fd25..0fe435140 100644 --- a/xlive/Blam/Engine/main/main.cpp +++ b/xlive/Blam/Engine/main/main.cpp @@ -19,9 +19,10 @@ #include "cseries/async.h" #include "cseries/cseries_windows_debug.h" #include "cseries/debug_memory.h" +#ifdef PROFILE_ENABLED #include "cseries/profile.h" +#endif #include "cseries/stack_walk_windows.h" -#include "cutscene/cinematics.h" #ifdef DEBUG_MENU_ENABLED #include "debug/menu/debug_menu_main.h" #endif @@ -34,9 +35,11 @@ #include "networking/logic/life_cycle_manager.h" #include "networking/logic/network_search.h" #include "networking/network_globals.h" +#ifdef PROFILE_ENABLED #include "physics/collision_usage.h" +#endif #include "rasterizer/rasterizer_globals.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" +#include "rasterizer/rasterizer_main.h" #include "saved_games/game_state.h" #include "saved_games/saved_game_files.h" #include "shell/shell.h" @@ -45,9 +48,10 @@ #include "sound/sound_manager.h" #include "text/font_group.h" -#include "H2MOD.h" #include "H2MOD/Modules/EventHandler/EventHandler.hpp" #include "H2MOD/Modules/MapManager/MapManager.h" + +#include // Needed for gXnIpMgr #include "XLive/xnet/IpManagement/XnIp.h" /* structures */ @@ -214,6 +218,8 @@ void main_save_core_name(const char* name) void main_loop_body(void) { EventHandler::GameLoopEventExecute(EventExecutionType::execute_before); + + // TODO: figure out a better place to put this if (!shell_is_dedicated_server()) { mapManager->MapDownloadUpdateTick(); @@ -540,8 +546,7 @@ static void main_save_map_private(void) // Patch added for tabbing in and out? if (!shell_is_dedicated_server()) { - IDirect3DDevice9* d3d_device = rasterizer_dx9_device_get_interface(); - if (d3d_device && FAILED(d3d_device->TestCooperativeLevel())) + if (rasterizer_device_is_lost()) { rasterizer_globals_get()->reset_screen = true; } diff --git a/xlive/Blam/Engine/main/main_game.cpp b/xlive/Blam/Engine/main/main_game.cpp index 01828b31c..10a994eb4 100644 --- a/xlive/Blam/Engine/main/main_game.cpp +++ b/xlive/Blam/Engine/main/main_game.cpp @@ -14,7 +14,7 @@ #include "saved_games/game_state.h" #include "saved_games/game_variant.h" -#include +#include /* constants */ @@ -72,7 +72,7 @@ static void main_game_launch_set_multiplayer_details(void); // Set default details for the mainmenu static void main_game_launch_set_ui_shell_details(void); -static void main_game_internal_pregame_load(void); +static bool main_game_internal_pregame_load(void); static void main_game_load_panic(void); @@ -393,14 +393,14 @@ static void main_game_launch_set_ui_shell_details(void) return; } -static void main_game_internal_pregame_load(void) +static bool main_game_internal_pregame_load(void) { s_main_game_globals* main_game_globals = main_game_globals_get(); ASSERT(main_game_globals->game_loaded_status == _game_loaded_status_none); - texture_cache_open_pregame(); + bool result = texture_cache_open_pregame() != false; main_game_globals->game_loaded_status = _game_loaded_status_none; - return; + return result; } static void main_game_load_panic(void) diff --git a/xlive/Blam/Engine/main/main_render.cpp b/xlive/Blam/Engine/main/main_render.cpp index acb6136bc..b0b23f145 100644 --- a/xlive/Blam/Engine/main/main_render.cpp +++ b/xlive/Blam/Engine/main/main_render.cpp @@ -6,8 +6,6 @@ #include "cutscene/cinematics.h" #include "game/player_mapping.h" #include "game/players.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" -#include "rasterizer/dx9/rasterizer_dx9_errors.h" #include "rasterizer/rasterizer_main.h" #include "render/render_cartographer_ingame_ui.h" @@ -45,7 +43,7 @@ void main_render_apply_patches(void) PatchCall(Memory::GetAddress(0x19228E), main_render_hook); PatchCall(Memory::GetAddress(0x27009A), main_render_player_view); - PatchCall(Memory::GetAddress(0x2700A5), main_render_previous_backbuffer); + PatchCall(Memory::GetAddress(0x2700A5), main_render_pregame); return; } @@ -155,7 +153,7 @@ void __cdecl main_render_player_view(void) } -void __cdecl main_render_previous_backbuffer(int32 a1, int32 a2) +void __cdecl main_render_pregame(int32 a1, int32 a2) { window_bound* g_window_bounds = window_bound_get(); @@ -174,38 +172,7 @@ void __cdecl main_render_previous_backbuffer(int32 a1, int32 a2) } render_nonplayer_frame(&g_window_bounds[0]); - - - s_rasterizer_dx9_main_globals* rasterizer_dx9_globals = rasterizer_dx9_main_globals_get(); - IDirect3DSurface9* backbuffer; - - if (screenshot_in_progress()) - { - backbuffer = rasterizer_dx9_globals->global_d3d_surface_screenshot; - rasterizer_dx9_globals->global_d3d_surface_screenshot->AddRef(); - } - else - { - rasterizer_dx9_log( - rasterizer_dx9_globals->global_d3d_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer) - ); - } - - rasterizer_dx9_log( - rasterizer_dx9_globals->global_d3d_device->StretchRect( - rasterizer_dx9_globals->global_d3d_surface_render_primary, - NULL, - backbuffer, - NULL, - D3DTEXF_NONE - ) - ); - - if (backbuffer) - { - backbuffer->Release(); - } - + rasterizer_main_render_pregame(); return; } diff --git a/xlive/Blam/Engine/main/main_render.h b/xlive/Blam/Engine/main/main_render.h index 1c1375a28..4cc1bb654 100644 --- a/xlive/Blam/Engine/main/main_render.h +++ b/xlive/Blam/Engine/main/main_render.h @@ -19,4 +19,4 @@ void __cdecl main_render(void); void __cdecl main_render_player_view(void); -void __cdecl main_render_previous_backbuffer(int32 a1, int32 a2); +void __cdecl main_render_pregame(int32 a1, int32 a2); diff --git a/xlive/Blam/Engine/main/main_screenshot.cpp b/xlive/Blam/Engine/main/main_screenshot.cpp index c0706aa60..f8a2e2277 100644 --- a/xlive/Blam/Engine/main/main_screenshot.cpp +++ b/xlive/Blam/Engine/main/main_screenshot.cpp @@ -11,8 +11,6 @@ #include "game/game_time.h" #include "main/console.h" #include "main/main.h" -#include "rasterizer/dx9/rasterizer_dx9_errors.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" #include "rasterizer/rasterizer_main.h" #include "render/render.h" #include "shell/shell.h" @@ -135,32 +133,18 @@ bool __cdecl screenshot_render(window_bound* window) if (screenshot_globals->take_screenshot || movie_globals->in_progress) { s_rasterizer_globals* rasterizer_globals = rasterizer_globals_get(); - s_rasterizer_dx9_main_globals* rasterizer_dx9_globals = rasterizer_dx9_main_globals_get(); - IDirect3DDevice9Ex* global_d3d_device = rasterizer_dx9_device_get_interface(); int16 screen_width = rectangle2d_width(&rasterizer_globals->screen_bounds); int16 screen_height = rectangle2d_height(&rasterizer_globals->screen_bounds); - HRESULT hr; - rasterizer_dx9_log_hr( - hr, - global_d3d_device->CreateRenderTarget( - screen_width, - screen_height, - D3DFMT_A8R8G8B8, - D3DMULTISAMPLE_NONE, - 0, - true, - &rasterizer_dx9_globals->global_d3d_surface_screenshot, - NULL - ) - ); - if (FAILED(hr)) + + result = rasterizer_initialize_screenshot_render_target(screen_width, screen_height); + if (!result) { - result = false; return result; } + // Continue if we meet the movie checks if (!movie_globals->in_progress || movie_should_continue()) { @@ -544,12 +528,7 @@ bool __cdecl screenshot_render(window_bound* window) screenshot_globals->cubemap_screenshot = false; // Cleanup rasterizer target - - if (rasterizer_dx9_globals->global_d3d_surface_screenshot) - { - rasterizer_dx9_globals->global_d3d_surface_screenshot->Release(); - rasterizer_dx9_globals->global_d3d_surface_screenshot = NULL; - } + rasterizer_cleanup_screenshot_render_target(); } return result; diff --git a/xlive/Blam/Engine/main/map_manager.h b/xlive/Blam/Engine/main/map_manager.h index 0614b3d0e..6037104db 100644 --- a/xlive/Blam/Engine/main/map_manager.h +++ b/xlive/Blam/Engine/main/map_manager.h @@ -1,4 +1,5 @@ #pragma once +#include "math/crypto_windows.h" /* constants */ diff --git a/xlive/Blam/Engine/main/map_repository.cpp b/xlive/Blam/Engine/main/map_repository.cpp index a56cec8a7..828f2582c 100644 --- a/xlive/Blam/Engine/main/map_repository.cpp +++ b/xlive/Blam/Engine/main/map_repository.cpp @@ -6,6 +6,7 @@ #include "interface/user_interface_memory.h" #include "memory/data.h" #include "multithreading/synchronization.h" +#include "networking/network_event.h" #include "scenario/scenario_definitions.h" #include "shell/shell.h" #include "tag_files/files.h" @@ -130,9 +131,11 @@ bool c_map_manager::read_custom_map_data_cache_from_file(const utf8* path, { if (!file_open(&cache_file, flags, &open_file_error_code)) { - LOG_TRACE_GAME("{} - failed to open custom map data cache file!", - __FUNCTION__); - + event( + _event_verbose, + "h2mod:map_repository: %s - failed to open custom map data cache file!", + __FUNCTION__ + ); break; } @@ -140,26 +143,32 @@ bool c_map_manager::read_custom_map_data_cache_from_file(const utf8* path, if (!file_read(&cache_file, sizeof(s_custom_map_file_cache_header), true, custom_map_data_header)) { invalid_file = true; - LOG_TRACE_GAME("{} - failed to read custom map data cache file header!", - __FUNCTION__); - + event( + _event_verbose, + "h2mod:map_repository: %s - failed to read custom map data cache file header!", + __FUNCTION__ + ); break; } if (custom_map_data_header->signature != custom_map_cache_signature) { - LOG_TRACE_GAME("{} - invalid custom map data cache file signature! deleting file if possible, name is reserved!", - __FUNCTION__); - + event( + _event_verbose, + "h2mod:map_repository: %s - invalid custom map data cache file signature! deleting file if possible, name is reserved!", + __FUNCTION__ + ); invalid_file = true; break; } if (custom_map_data_header->version != k_custom_map_data_cache_header_version) { - LOG_TRACE_GAME("{} - custom map data cache file header version mismatch! deleting file if possible", - __FUNCTION__); - + event( + _event_verbose, + "h2mod:map_repository: %s - custom map data cache file header version mismatch! deleting file if possible", + __FUNCTION__ + ); invalid_file = true; break; } @@ -167,11 +176,13 @@ bool c_map_manager::read_custom_map_data_cache_from_file(const utf8* path, entry_count = custom_map_data_header->entry_count; if (entry_count > k_maximum_number_of_custom_multiplayer_maps_new) { - LOG_TRACE_GAME("{} - custom map data cache file exceeds new map limit size, {} > max: {}", + event( + _event_verbose, + "h2mod:map_repository: %s - custom map data cache file exceeds new map limit size, {} > max: {}", __FUNCTION__, entry_count, - k_maximum_number_of_custom_multiplayer_maps_new); - + k_maximum_number_of_custom_multiplayer_maps_new + ); break; } @@ -180,9 +191,11 @@ bool c_map_manager::read_custom_map_data_cache_from_file(const utf8* path, if (!file_read(&cache_file, file_custom_map_entries_size, true, entry_list)) { - LOG_TRACE_GAME("{} - failed reading custom map data cache file!", - __FUNCTION__); - + event( + _event_error, + "h2mod:map_repository: %s - failed reading custom map data cache file!", + __FUNCTION__ + ); break; } @@ -202,10 +215,14 @@ bool c_map_manager::read_custom_map_data_cache_from_file(const utf8* path, if (success) { - LOG_TRACE_GAME("loaded custom map paths: "); + event(_event_verbose, "h2mod:map_repository loaded custom map paths: "); for (uint32 i = 0; i < entry_count; i++) { - LOG_TRACE_GAME(L" custom map path: {}", entry_list[i].file_path); + event( + _event_verbose, + "h2mod:map_repository: custom map path: %ws", + entry_list[i].file_path + ); } } @@ -226,8 +243,12 @@ bool c_map_manager::write_custom_map_data_cache_to_file(const utf8* path, s_cust { if (!file_open(&cache_file, _permission_write_bit, &open_file_error_code)) { - LOG_ERROR_GAME("{} - failed to open custom map cache file, error code: {}", __FUNCTION__, (uint32)open_file_error_code); - + event( + _event_error, + "h2mod:map_repository: %s - failed to open custom map cache file, error code: %u", + __FUNCTION__, + (uint32)open_file_error_code + ); break; } @@ -237,20 +258,29 @@ bool c_map_manager::write_custom_map_data_cache_to_file(const utf8* path, s_cust if (!file_write(&cache_file, size_to_write, custom_map_data_cache)) { - LOG_ERROR_GAME("{} - failed to write custom map cache to file!", - __FUNCTION__); - + event( + _event_error, + "h2mod:map_repository: %s - failed to write custom map cache to file!", + __FUNCTION__ + ); break; } - LOG_TRACE_GAME("{} - saved custom map data cache, map count: {}, write size: {}", - __FUNCTION__, custom_map_data_cache->entry_count, size_to_write); + event( + _event_verbose, + "h2mod:map_repository: %s - saved custom map data cache, map count: %u, write size: %u", + __FUNCTION__, + custom_map_data_cache->entry_count, + size_to_write + ); if (!file_set_eof(&cache_file, cache_file.api_result)) { - LOG_ERROR_GAME("{} - failed to set custom map cache file size!", - __FUNCTION__); - + event( + _event_error, + "h2mod:map_repository: %s - failed to set custom map cache file size!", + __FUNCTION__ + ); break; } @@ -265,7 +295,11 @@ bool c_map_manager::write_custom_map_data_cache_to_file(const utf8* path, s_cust } else if (!create_file_success && open_file_error_code == _file_open_error_not_found) { - LOG_ERROR_GAME("{} - failed to create custom map data cache while file not present!", __FUNCTION__); + event( + _event_error, + "h2mod:map_repository: %s - failed to create custom map data cache while file not present!", + __FUNCTION__ + ); } return success; @@ -296,7 +330,11 @@ void __thiscall c_map_manager::save_custom_map_data() || !WideCharToMultiByte(CP_UTF8, 0, path_wide, -1, path_multibyte, MAX_PATH, 0, 0) || !write_custom_map_data_cache_to_file(path_multibyte, custom_map_data_to_save)) { - LOG_ERROR_GAME("{} - failed to save custom map data cache!", __FUNCTION__); + event( + _event_error, + "h2mod:map_repository: %s - failed to save custom map data cache!", + __FUNCTION__ + ); } } @@ -339,8 +377,11 @@ void __thiscall c_map_manager::map_repository_load() custom_map_cache_file_header->signature = custom_map_cache_signature; custom_map_cache_file_header->version = k_custom_map_data_cache_header_version; - LOG_ERROR_GAME("{} - failed to read custom map data cache!", - __FUNCTION__); + event( + _event_error, + "h2mod:map_repository: %s - failed to read custom map data cache!", + __FUNCTION__ + ); } //load_map_data_cache_from_file_cache(custom_map_cache_file_header); @@ -927,22 +968,38 @@ static bool __cdecl validate_and_read_custom_map_data(s_custom_map_entry* custom return false; if (header.header_signature != 'head' || header.footer_signature != 'foot' || header.file_size <= 0 || header.version != 8) { - LOG_TRACE_FUNCW(L"\"{}\" has invalid header", file_name); + event( + _event_error, + "h2mod:map_repository: \"%ws\" has invalid header", + file_name + ); return false; } if (header.type > 5 || header.type < 0) { - LOG_TRACE_FUNCW(L"\"{}\" has bad scenario type", file_name); + event( + _event_error, + "h2mod:map_repository: \"%ws\" has bad scenario type", + file_name + ); return false; } if (strnlen_s(header.name, k_custom_map_name_length) >= 32 || strnlen_s(header.version_string, 32) >= 32) { - LOG_TRACE_FUNCW(L"\"{}\" has invalid version or name string", file_name); + event( + _event_error, + "h2mod:map_repository: \"%ws\" has invalid version or name string", + file_name + ); return false; } if (header.type != _scenario_type_multiplayer && header.type != _scenario_type_solo) { - LOG_TRACE_FUNCW(L"\"{}\" is not playable", file_name); + event( + _event_error, + "h2mod:map_repository: \"%ws\" is not playable", + file_name + ); return false; } @@ -955,7 +1012,11 @@ static bool __cdecl validate_and_read_custom_map_data(s_custom_map_entry* custom auto validate_and_add_custom_map_internal = Memory::GetAddress(0x4F690, 0x56890); if (!validate_and_add_custom_map_internal(custom_map_entry)) { - LOG_TRACE_FUNCW(L"warning \"{}\" has bad checksums or is blacklisted, map may not work correctly", file_name); + event( + _event_error, + "h2mod:map_repository: \"%ws\" has bad checksums or is blacklisted, map may not work correctly", + file_name + ); std::wstring fallback_name; if (strnlen_s(header.name, sizeof(header.name)) > 0) { wchar_t fallback_name_c[32]; @@ -974,4 +1035,4 @@ static bool __cdecl validate_and_read_custom_map_data(s_custom_map_entry* custom } // '50 map limit removal' region end -#pragma endregion \ No newline at end of file +#pragma endregion diff --git a/xlive/Blam/Engine/math/color_math.cpp b/xlive/Blam/Engine/math/color_math.cpp index 604475a72..1b1711d3d 100644 --- a/xlive/Blam/Engine/math/color_math.cpp +++ b/xlive/Blam/Engine/math/color_math.cpp @@ -60,14 +60,14 @@ const real_rgb_color* const global_real_rgb_darkgreen = &global_real_argb_color_ const real_rgb_color* const global_real_rgb_salmon = &global_real_argb_color_table[15].rgb; const real_rgb_color* const global_real_rgb_violet = &global_real_argb_color_table[16].rgb; -const pixel32 global_white_pixel32 = D3DCOLOR_ARGB(255, 255, 255, 255); -const pixel32 global_yellow_pixel32 = D3DCOLOR_ARGB(255, 255, 255, 0); +const pixel32 global_white_pixel32 = PIXEL32_ARGB(255, 255, 255, 255); +const pixel32 global_yellow_pixel32 = PIXEL32_ARGB(255, 255, 255, 0); /* public code */ pixel32 real_argb_color_to_pixel32(const real_argb_color* color) { - return D3DCOLOR_ARGB( + return PIXEL32_ARGB( (int32)(color->alpha * 255), (int32)(color->red * 255), (int32)(color->green * 255), diff --git a/xlive/Blam/Engine/math/real_math.h b/xlive/Blam/Engine/math/real_math.h index aebc71764..2a241f791 100644 --- a/xlive/Blam/Engine/math/real_math.h +++ b/xlive/Blam/Engine/math/real_math.h @@ -22,7 +22,7 @@ typedef real32 real_angle; union real_euler_angles2d { real32 n[2]; - struct { real_angle yaw, pitch; }; + struct { real32 yaw, pitch; }; }; ASSERT_STRUCT_SIZE(real_euler_angles2d, sizeof(real_angle) * 2); @@ -287,7 +287,7 @@ inline bool valid_real(real32 value) inline bool valid_realcmp(real32 a, real32 b) { real32 result = a - b; - return valid_real(result) && ::abs(result) < 0.01f; + return valid_real(result) && ::fabs(result) < 0.01f; } inline bool valid_real_normal3d(const real_vector3d* normal) @@ -402,7 +402,7 @@ inline real_point3d* point_from_line3d(const real_point3d* p, const real_vector3 inline real32 normalize3d(real_vector3d* v1) { real32 length = magnitude3d(v1); - if (::abs(length) >= k_real_epsilon) + if (::fabs(length) >= k_real_epsilon) { scale_vector3d(v1, 1.0f / length, v1); } diff --git a/xlive/Blam/Engine/memory/static_arrays.h b/xlive/Blam/Engine/memory/static_arrays.h index fbfa98e4d..90387a945 100644 --- a/xlive/Blam/Engine/memory/static_arrays.h +++ b/xlive/Blam/Engine/memory/static_arrays.h @@ -283,7 +283,7 @@ class c_static_flags : public c_static_flags_no_init }; template -struct c_static_string +class c_static_string { public: c_static_string(void) diff --git a/xlive/Blam/Engine/models/render_model_definitions.h b/xlive/Blam/Engine/models/render_model_definitions.h index b4d405f22..c1a61c3e6 100644 --- a/xlive/Blam/Engine/models/render_model_definitions.h +++ b/xlive/Blam/Engine/models/render_model_definitions.h @@ -2,9 +2,6 @@ #include "errors/error_reports.h" #include "geometry/geometry_block.h" #include "geometry/geometry_definitions_new.h" -#include "render/render_prt.h" -#include "structures/structures.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_import_definitions.h" enum e_render_model_definition_flags : int16 @@ -133,7 +130,7 @@ ASSERT_STRUCT_SIZE(render_model_marker_group, 12); // max count: MAXIMUM_SECTIONS_PER_RENDER_MODEL struct section_render_leaves { - tag_block node_render_leaves; + s_tag_block node_render_leaves; // struct: node_render_leaves }; ASSERT_STRUCT_SIZE(section_render_leaves, 8); @@ -166,7 +163,7 @@ struct render_model_definition tag_block errors; real_angle dont_draw_over_camera_cosine_angle; // dont draw fp model when camera > this angle cosine (-1,1) Sugg. -0.2. 0 disables. - tag_block prt_info; - tag_block section_render_leaves; + s_tag_block prt_info; // struct: prt_info + s_tag_block section_render_leaves; // struct: section_render_leaves }; ASSERT_STRUCT_SIZE(render_model_definition, 132); diff --git a/xlive/Blam/Engine/models/render_models.h b/xlive/Blam/Engine/models/render_models.h index b3ea69439..1d025ec13 100644 --- a/xlive/Blam/Engine/models/render_models.h +++ b/xlive/Blam/Engine/models/render_models.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/networking/Session/network_session.cpp b/xlive/Blam/Engine/networking/Session/network_session.cpp index e7e230280..fa9c5937b 100644 --- a/xlive/Blam/Engine/networking/Session/network_session.cpp +++ b/xlive/Blam/Engine/networking/Session/network_session.cpp @@ -41,21 +41,6 @@ bool NetworkSession::PlayerIsActive(datum player_index) return GetActiveNetworkSession()->is_session_player_active(player_index); } -std::vector NetworkSession::GetActivePlayerIndicesList() -{ - std::vector activePlayersIndices; - if (GetPlayerCount() > 0) - { - for (int32 playerIndex = 0; playerIndex < k_maximum_players; playerIndex++) - { - if (PlayerIsActive(playerIndex)) - activePlayersIndices.emplace_back(playerIndex); - } - } - - return activePlayersIndices; -} - c_network_session* NetworkSession::GetNetworkSessions() { return *Memory::GetAddress(0x51C474, 0x520B94); diff --git a/xlive/Blam/Engine/networking/Session/network_session.h b/xlive/Blam/Engine/networking/Session/network_session.h index d1dca8b0d..02fcd56d3 100644 --- a/xlive/Blam/Engine/networking/Session/network_session.h +++ b/xlive/Blam/Engine/networking/Session/network_session.h @@ -4,8 +4,6 @@ #include "input/controllers.h" #include "networking/network_constants.h" #include "networking/network_game_definitions.h" -#include "networking/transport/transport.h" -#include "networking/transport/transport_security.h" #include "saved_games/game_variant.h" /* enums */ @@ -108,7 +106,6 @@ namespace NetworkSession /* Use this to verify if a player is currently active in the network session */ /* Otherwise you will wonder why you don't get the right data/player index etc. */ bool PlayerIsActive(datum player_index); - std::vector GetActivePlayerIndicesList(); int32 GetPlayerCount(); const wchar_t* GetPlayerName(datum player_index); @@ -254,7 +251,7 @@ struct s_network_session_player s_player_identifier identifier; // -0xA int32 peer_index; // -0x8 int32 peer_user_index; // -0x4 - WORD player_flags; // 0x0 + uint16 player_flags; // 0x0 bool properties_valid; char pad[1]; int32 controller_index; diff --git a/xlive/Blam/Engine/networking/messages/network_message_handler.cpp b/xlive/Blam/Engine/networking/messages/network_message_handler.cpp index 11f803ab8..09ac521e3 100644 --- a/xlive/Blam/Engine/networking/messages/network_message_handler.cpp +++ b/xlive/Blam/Engine/networking/messages/network_message_handler.cpp @@ -11,7 +11,6 @@ #include "networking/session/network_session.h" #include "networking/session/network_session_manager.h" #include "networking/session/network_observer.h" -#include "networking/transport/transport_security.h" #include "networking/network_event.h" #include "H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.h" @@ -260,7 +259,7 @@ void c_network_message_handler::handle_request_map_filename(const transport_addr if (mapManager->GetMapFilename(map_filename)) { session->get_transport_session_id(&data.session_data.identifier); - wcsncpy_s(data.file_name, map_filename.c_str(), map_filename.length()); + ustrncpy(data.file_name, map_filename.c_str(), map_filename.length()); data.map_download_id = received_data->map_download_id; event( diff --git a/xlive/Blam/Engine/networking/messages/network_messages_session_protocol.h b/xlive/Blam/Engine/networking/messages/network_messages_session_protocol.h index 0f9303459..43bfc94d0 100644 --- a/xlive/Blam/Engine/networking/messages/network_messages_session_protocol.h +++ b/xlive/Blam/Engine/networking/messages/network_messages_session_protocol.h @@ -1,6 +1,5 @@ #pragma once -#include "network_message_type_collection.h" /* prototypes */ -void __cdecl network_message_types_register_session_protocol(c_network_message_type_collection* message_collection); +void __cdecl network_message_types_register_session_protocol(class c_network_message_type_collection* message_collection); diff --git a/xlive/Blam/Engine/networking/network_game_definitions.h b/xlive/Blam/Engine/networking/network_game_definitions.h index 13f8a7f5f..191a28251 100644 --- a/xlive/Blam/Engine/networking/network_game_definitions.h +++ b/xlive/Blam/Engine/networking/network_game_definitions.h @@ -1,5 +1,5 @@ #pragma once -#include "networking/transport/transport.h" +#include "networking/transport/transport_security.h" #include "saved_games/player_profile.h" /* enums */ diff --git a/xlive/Blam/Engine/networking/network_globals.cpp b/xlive/Blam/Engine/networking/network_globals.cpp index 66bd8faaf..857ce82ca 100644 --- a/xlive/Blam/Engine/networking/network_globals.cpp +++ b/xlive/Blam/Engine/networking/network_globals.cpp @@ -33,6 +33,7 @@ #include "networking/session/network_session.h" #include "networking/session/network_session_manager.h" #include "networking/session/network_text_chat_manager.h" +#include "transport/transport.h" #include "shell/shell.h" diff --git a/xlive/Blam/Engine/networking/network_loading.cpp b/xlive/Blam/Engine/networking/network_loading.cpp index ffaad9c15..cf64543a3 100644 --- a/xlive/Blam/Engine/networking/network_loading.cpp +++ b/xlive/Blam/Engine/networking/network_loading.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" - #include "network_loading.h" -#include "main/main.h" #include "networking/network_globals.h" #include "simulation/simulation.h" diff --git a/xlive/Blam/Engine/networking/network_utilities.cpp b/xlive/Blam/Engine/networking/network_utilities.cpp index 5a42a95bf..0fe23729e 100644 --- a/xlive/Blam/Engine/networking/network_utilities.cpp +++ b/xlive/Blam/Engine/networking/network_utilities.cpp @@ -47,6 +47,7 @@ void __cdecl network_utilities_get_game_version(int32* executable_type, int32* e *executable_type = EXECUTABLE_TYPE; *executable_version = EXECUTABLE_VERSION; *compatible_version = COMPATIBLE_VERSION; + return; } /* private code */ diff --git a/xlive/Blam/Engine/networking/online/online_account_xbox.cpp b/xlive/Blam/Engine/networking/online/online_account_xbox.cpp index 6f7fb4942..dfdbfa48d 100644 --- a/xlive/Blam/Engine/networking/online/online_account_xbox.cpp +++ b/xlive/Blam/Engine/networking/online/online_account_xbox.cpp @@ -1,9 +1,7 @@ #include "stdafx.h" #include "online_account_xbox.h" + #include "interface/user_interface_guide.h" -#include "H2MOD/Modules/Accounts/AccountLogin.h" -#include "H2MOD/Modules/Shell/Config.h" -#include "H2MOD/Utils/Utils.h" /* public code */ @@ -24,14 +22,3 @@ bool __cdecl online_connected_to_xbox_live() //return INVOKE(0x1AC4A3, 0x0, online_connected_to_xbox_live); return user_interface_guide_state_manager_get()->m_sign_in_state == eXUserSigninState_SignedInToLive; } - -void online_account_transition_to_offline() -{ - BYTE abEnet[6]; - BYTE abOnline[20]; - XNetRandom(abEnet, sizeof(abEnet)); - XNetRandom(abOnline, sizeof(abOnline)); - ConfigureUserDetails("[Username]", "12345678901234567890123456789012", rand(), 0, H2Config_ip_lan, ByteToHexStr(abEnet, sizeof(abEnet)).c_str(), ByteToHexStr(abOnline, sizeof(abOnline)).c_str(), false); - - XUserSignInSetStatusChanged(0); -} \ No newline at end of file diff --git a/xlive/Blam/Engine/networking/online/online_account_xbox.h b/xlive/Blam/Engine/networking/online/online_account_xbox.h index a8b98c96a..017d2cb63 100644 --- a/xlive/Blam/Engine/networking/online/online_account_xbox.h +++ b/xlive/Blam/Engine/networking/online/online_account_xbox.h @@ -14,5 +14,3 @@ bool online_xuid_is_guest_account(XUID xuid); uint8 online_xuid_get_guest_account_number(XUID xuid); bool __cdecl online_connected_to_xbox_live(); - -void online_account_transition_to_offline(); \ No newline at end of file diff --git a/xlive/Blam/Engine/networking/online/online_task_xbox.h b/xlive/Blam/Engine/networking/online/online_task_xbox.h index 091b025e4..2c57943b0 100644 --- a/xlive/Blam/Engine/networking/online/online_task_xbox.h +++ b/xlive/Blam/Engine/networking/online/online_task_xbox.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/networking/transport/transport.h b/xlive/Blam/Engine/networking/transport/transport.h index 9e79d84c1..cf29713e9 100644 --- a/xlive/Blam/Engine/networking/transport/transport.h +++ b/xlive/Blam/Engine/networking/transport/transport.h @@ -1,5 +1,4 @@ #pragma once -#include "transport_security.h" /* constants */ @@ -41,13 +40,6 @@ struct s_transport_globals }; ASSERT_STRUCT_SIZE(s_transport_globals, 136); -struct s_transport_session_description -{ - s_transport_secure_identifier id; - s_transport_secure_key key; - s_transport_secure_address host_address; -}; - /* prototypes */ void network_transport_apply_patches(void); diff --git a/xlive/Blam/Engine/networking/transport/transport_security.h b/xlive/Blam/Engine/networking/transport/transport_security.h index c27692170..28d49b9a4 100644 --- a/xlive/Blam/Engine/networking/transport/transport_security.h +++ b/xlive/Blam/Engine/networking/transport/transport_security.h @@ -22,6 +22,13 @@ struct s_transport_unique_identifier uint8 ab[6]; }; +struct s_transport_session_description +{ + s_transport_secure_identifier id; + s_transport_secure_key key; + s_transport_secure_address host_address; +}; + /* prototypes */ // Return true if both secure addresses are the same diff --git a/xlive/Blam/Engine/networkinglib/networkinglib.vcxproj b/xlive/Blam/Engine/networkinglib/networkinglib.vcxproj new file mode 100644 index 000000000..67e1da009 --- /dev/null +++ b/xlive/Blam/Engine/networkinglib/networkinglib.vcxproj @@ -0,0 +1,370 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + 18.0 + Win32Proj + {97fcedec-adf6-4ad9-8600-d28ad461bb3c} + networkinglib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)networkinglib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 + true + true + true + false + 4700 + Fast + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)networkinglib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 + true + true + 4700 + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)networkinglib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 + true + true + 4700 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/networkinglib/networkinglib.vcxproj.filters b/xlive/Blam/Engine/networkinglib/networkinglib.vcxproj.filters new file mode 100644 index 000000000..dfe78d50a --- /dev/null +++ b/xlive/Blam/Engine/networkinglib/networkinglib.vcxproj.filters @@ -0,0 +1,567 @@ + + + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + networkinglib + + + networking\couch + + + networking\delivery + + + networking\delivery + + + networking\locator + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic\storage + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\online + + + networking\online + + + networking\online + + + networking\online + + + networking\online + + + networking\panorama + + + networking\panorama + + + networking\panorama + + + networking\panorama + + + networking\panorama + + + networking\replication + + + networking\replication + + + networking\replication + + + networking\replication + + + networking\session + + + networking\session + + + networking\session + + + networking\session + + + networking\transport + + + networking\transport + + + networking\transport + + + networking\transport + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation\game_interface + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + simulation + + + networkinglib + + + networking\couch + + + networking\delivery + + + networking\delivery + + + networking\locator + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic + + + networking\logic\storage + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\messages + + + networking\online + + + networking\online + + + networking\online + + + networking\online + + + networking\online + + + networking\panorama + + + networking\panorama + + + networking\panorama + + + networking\panorama + + + networking\panorama + + + networking\replication + + + networking\replication + + + networking\replication + + + networking\replication + + + networking\replication + + + networking\session + + + networking\session + + + networking\session + + + networking\session + + + networking\transport + + + networking\transport + + + networking\transport + + + networking\transport + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + networking + + + + + {8a05898e-225a-4a19-9128-51b3b99e70ae} + + + {7fee07fb-503a-486a-9a63-99c8be795358} + + + {f0a123dc-f8c4-4dd3-b6bb-83fc6d157a05} + + + {539df1da-83a0-4c00-9264-d1eaca55d2fa} + + + {bceea38e-cbd8-4164-8b40-b22268b15a3d} + + + {caa79337-f117-45e6-85cf-2b6492aa1305} + + + {d07045b0-28f6-433c-8958-8c7eb83e7a86} + + + {f16909b5-c119-4bf3-bbc1-45c7dd5282dd} + + + {fd8b8754-f12d-46f1-a9fb-4ad2f67ae325} + + + {3a968000-4ea9-4f3c-a97e-b0cc9b98dabe} + + + {42aa1856-491e-4e16-a296-9bc8d12fafc4} + + + {841c15f4-ac4b-4861-9ced-83568e2e41a9} + + + {360fddc3-c85d-4c22-bf6d-41a689805168} + + + {d80e8216-0104-48cf-8f52-2b3490f90f7e} + + + {06fb9377-dc68-48d3-86ed-065c82bf6e3a} + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/networkinglib/stdafx.cpp b/xlive/Blam/Engine/networkinglib/stdafx.cpp new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/xlive/Blam/Engine/networkinglib/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/xlive/Blam/Engine/networkinglib/stdafx.h b/xlive/Blam/Engine/networkinglib/stdafx.h new file mode 100644 index 000000000..fadcdf33f --- /dev/null +++ b/xlive/Blam/Engine/networkinglib/stdafx.h @@ -0,0 +1,50 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include + +#include +#include +#include +#include +#include + +/* windows */ + +#ifdef _WIN32 + +#define _USE_MATH_DEFINES +#include + +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include + +#pragma comment(lib, "IPHLPAPI.lib") + +#endif + +/* 3rd party */ + +#include + +/* game includes */ + +#include "cseries/cseries.h" +#include "cseries/cseries_errors.h" +#include "cseries/cseries_system_memory.h" + + +#include "math/crypto_windows.h" +#include "math/integer_math.h" +#include "math/real_math.h" +#include "memory/static_arrays.h" +#include "networking/network_game_definitions.h" +#include "tag_files/tag_groups.h" + +#include "Util/Hooks/Hook.h" +#include "Util/Memory.h" diff --git a/xlive/Blam/Engine/objects/damage.cpp b/xlive/Blam/Engine/objects/damage.cpp index 088de0436..f7cbcd4ee 100644 --- a/xlive/Blam/Engine/objects/damage.cpp +++ b/xlive/Blam/Engine/objects/damage.cpp @@ -63,4 +63,5 @@ void __cdecl object_apply_damage_aftermath(datum object_index, s_damage_aftermat { SET_BIT(aftermath_data->flags, _damage_aftermath_has_explosion_physics, currentVariantSettings.explosionPhysics); INVOKE(0x17A25D, 0x0, object_apply_damage_aftermath, object_index, aftermath_data); + return; } \ No newline at end of file diff --git a/xlive/Blam/Engine/objects/damage.h b/xlive/Blam/Engine/objects/damage.h index ddf6b19a2..45fc4e1bf 100644 --- a/xlive/Blam/Engine/objects/damage.h +++ b/xlive/Blam/Engine/objects/damage.h @@ -1,7 +1,6 @@ #pragma once #include "game/game_allegiance.h" #include "objects/object_location.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" /* enums */ diff --git a/xlive/Blam/Engine/objects/damage_effects.h b/xlive/Blam/Engine/objects/damage_effects.h index e13ccdb9c..91782cda4 100644 --- a/xlive/Blam/Engine/objects/damage_effects.h +++ b/xlive/Blam/Engine/objects/damage_effects.h @@ -3,7 +3,6 @@ #include "effects/player_effects.h" #include "game/player_vibration.h" #include "tag_files/tag_block.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" enum e_damage_effect_flags diff --git a/xlive/Blam/Engine/objects/object_constants.h b/xlive/Blam/Engine/objects/object_constants.h index be2caa3fd..1300811f7 100644 --- a/xlive/Blam/Engine/objects/object_constants.h +++ b/xlive/Blam/Engine/objects/object_constants.h @@ -1,5 +1,12 @@ #pragma once +/* constants */ + +enum +{ + k_maximum_objects_per_map = 2048 +}; + /* enums */ enum e_object_change_color_index diff --git a/xlive/Blam/Engine/objects/object_definition.h b/xlive/Blam/Engine/objects/object_definition.h index 42f47f553..2ed3fc580 100644 --- a/xlive/Blam/Engine/objects/object_definition.h +++ b/xlive/Blam/Engine/objects/object_definition.h @@ -6,7 +6,6 @@ #include "math/color_math.h" #include "math/function_definitions.h" -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/objects/object_placement.h b/xlive/Blam/Engine/objects/object_placement.h index 94207b79c..5d02732a9 100644 --- a/xlive/Blam/Engine/objects/object_placement.h +++ b/xlive/Blam/Engine/objects/object_placement.h @@ -6,7 +6,6 @@ #include "object_scenario_definitions.h" #include "math/color_math.h" -#include "tag_files/tag_groups.h" /* structures */ diff --git a/xlive/Blam/Engine/objects/object_types.h b/xlive/Blam/Engine/objects/object_types.h index 6aaf7c22a..e1830e654 100644 --- a/xlive/Blam/Engine/objects/object_types.h +++ b/xlive/Blam/Engine/objects/object_types.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/objects/objects.cpp b/xlive/Blam/Engine/objects/objects.cpp index 654454928..10bcb4fb1 100644 --- a/xlive/Blam/Engine/objects/objects.cpp +++ b/xlive/Blam/Engine/objects/objects.cpp @@ -14,11 +14,11 @@ #include "game/game_time.h" #include "items/weapons.h" #include "main/interpolator.h" -#include "main/main_game.h" #include "memory/memory_pool.h" #include "models/models.h" #include "objects/lights.h" #include "objects/widgets/widgets.h" +#include "physics/collision_bsp.h" #include "physics/collisions.h" #include "physics/havok.h" #include "physics/havok_memory.h" @@ -28,6 +28,7 @@ #include "structures/cluster_partitions.h" #include "structures/structure_bsp_definitions.h" #include "tag_files/tag_files.h" +#include "units/units.h" /* constants */ diff --git a/xlive/Blam/Engine/objects/objects.h b/xlive/Blam/Engine/objects/objects.h index 8045f20da..64d903360 100644 --- a/xlive/Blam/Engine/objects/objects.h +++ b/xlive/Blam/Engine/objects/objects.h @@ -6,10 +6,7 @@ #include "math/real_math.h" /* constants */ -enum -{ - k_maximum_objects_per_map = 2048 -}; + /* enums */ diff --git a/xlive/Blam/Engine/objects/widgets/antenna_definitions.h b/xlive/Blam/Engine/objects/widgets/antenna_definitions.h index a35383d78..001d88330 100644 --- a/xlive/Blam/Engine/objects/widgets/antenna_definitions.h +++ b/xlive/Blam/Engine/objects/widgets/antenna_definitions.h @@ -1,6 +1,5 @@ #pragma once #include "math/color_math.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/objectslib/objectslib.vcxproj b/xlive/Blam/Engine/objectslib/objectslib.vcxproj new file mode 100644 index 000000000..cdac7510c --- /dev/null +++ b/xlive/Blam/Engine/objectslib/objectslib.vcxproj @@ -0,0 +1,282 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + 18.0 + Win32Proj + {68DADF6D-A81D-4B73-9017-1076C047E0B1} + objectslib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)objectslib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 + true + true + true + false + 4700 + Fast + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)objectslib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 + true + true + 4700 + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)objectslib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\..\..\3rdparty;.\;..\;..\..\..\;..\..\..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 + true + true + 4700 + stdafx.h + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/objectslib/objectslib.vcxproj.filters b/xlive/Blam/Engine/objectslib/objectslib.vcxproj.filters new file mode 100644 index 000000000..7ea943b98 --- /dev/null +++ b/xlive/Blam/Engine/objectslib/objectslib.vcxproj.filters @@ -0,0 +1,273 @@ + + + + + {2fcb53b1-5599-47d4-b4e6-b6e23c14b9a5} + + + {7c094cbf-90ce-4166-ba3f-5f43fdf642e7} + + + {1eaa32b1-b1f5-4df7-9ecf-af7f3b8e6225} + + + {b6c651e1-384f-472b-beea-30176428c6aa} + + + {d6d6c655-2d10-466a-bff7-f1da2295d173} + + + {3fefe3d1-64ad-4b15-8b61-8c9710091792} + + + {78b2b26f-fba2-46cd-b262-f56fd29ce2f3} + + + {f8a08e05-1b2f-48d1-b875-6aa95eedc885} + + + + + objectslib + + + objects\widgets + + + objects\widgets + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + units + + + units + + + units + + + units + + + units + + + units + + + units + + + units + + + units + + + units + + + units + + + units + + + items + + + items + + + items + + + items + + + items + + + items + + + items + + + items + + + items + + + items + + + items + + + items + + + units + + + creatures + + + creatures + + + devices + + + devices + + + devices + + + devices + + + devices + + + widgets + + + widgets + + + + + objectslib + + + objects\widgets + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + objects + + + units + + + units + + + units + + + units + + + units + + + items + + + items + + + items + + + items + + + creatures + + + devices + + + widgets + + + widgets + + + \ No newline at end of file diff --git a/xlive/Blam/Engine/objectslib/stdafx.cpp b/xlive/Blam/Engine/objectslib/stdafx.cpp new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/xlive/Blam/Engine/objectslib/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/xlive/Blam/Engine/objectslib/stdafx.h b/xlive/Blam/Engine/objectslib/stdafx.h new file mode 100644 index 000000000..c891a83ee --- /dev/null +++ b/xlive/Blam/Engine/objectslib/stdafx.h @@ -0,0 +1,43 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include +#include + +#include + +/* windows */ + +#ifdef _WIN32 + +#define WIN32_LEAN_AND_MEAN + +#define _USE_MATH_DEFINES +#include + +#include +#include + +#endif + +/* 3rd party libs */ + +#include + +/* game includes */ + +#include "cseries/cseries.h" +#include "cseries/cseries_errors.h" +#include "cseries/cseries_system_memory.h" + +#include "math/crypto_windows.h" +#include "math/integer_math.h" +#include "math/real_math.h" +#include "memory/static_arrays.h" + +#include "tag_files/tag_groups.h" + +#include "Util/Hooks/Hook.h" +#include "Util/Memory.h" diff --git a/xlive/Blam/Engine/physics/collision_model_definitions.h b/xlive/Blam/Engine/physics/collision_model_definitions.h index d9a6084e0..dd9c4d2bc 100644 --- a/xlive/Blam/Engine/physics/collision_model_definitions.h +++ b/xlive/Blam/Engine/physics/collision_model_definitions.h @@ -2,7 +2,6 @@ #include "collision_bsp_definition.h" #include "errors/error_reports.h" #include "havok/physics/collide/shape/convex/triangle/hkTriangle.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_import_definitions.h" diff --git a/xlive/Blam/Engine/physics/physics_models.h b/xlive/Blam/Engine/physics/physics_models.h index 0566f614f..9a82c6045 100644 --- a/xlive/Blam/Engine/physics/physics_models.h +++ b/xlive/Blam/Engine/physics/physics_models.h @@ -1,10 +1,13 @@ #pragma once - -#define k_maximum_shapes_per_physics_model 1024 #include "havok/physics/collide/shape/capsule/hkCapsuleShape.h" #include "havok/physics/collide/shape/misc/transform/hkTransformShape.h" #include "havok/physics/collide/shape/shpere/hkShpere.h" +enum +{ + k_maximum_shapes_per_physics_model = 1024, +}; + enum e_physics_constraint : int16 { _physics_constraint_hinge = 0, diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_9on12.h b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_9on12.h index 87eabb103..c8d8e5252 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_9on12.h +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_9on12.h @@ -1,5 +1,4 @@ #pragma once -#include /* defines */ @@ -7,8 +6,8 @@ /* globals */ extern bool g_rasterizer_dx9on12_enabled; -extern IDirect3DDevice9On12* g_d3d9on12_device; +extern struct IDirect3DDevice9On12* g_d3d9on12_device; /* prototypes */ -int32 rasterizer_dx9_create_through_d3d9on12(IDirect3D9Ex** d3d, bool use_warp); +int32 rasterizer_dx9_create_through_d3d9on12(struct IDirect3D9Ex** d3d, bool use_warp); diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynamic_geometry.h b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynamic_geometry.h index 61fc02712..76a064f16 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynamic_geometry.h +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynamic_geometry.h @@ -1,62 +1,4 @@ #pragma once -#include "math/color_math.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" - -/* constants */ - -enum -{ - k_dynamic_geometry_map_max_count = 3 -}; - -/* structures */ - -struct s_dynamic_vertex_data -{ - real32 pos_x; - real32 pos_y; - real32 bounds_x; - real32 bounds_y; - pixel32 color; -}; -ASSERT_STRUCT_SIZE(s_dynamic_vertex_data, 20) - -struct s_dynamic_geometry_map_color_parameters -{ - real_rgb_color* color; - void* pad; -}; - -struct s_dynamic_geometry_map_alpha -{ - real32* alpha; -}; - -struct rasterizer_dynamic_screen_geometry_parameters -{ - void* meter_parameters; - real_vector2d* offset; - bool map_anchor_screen[k_dynamic_geometry_map_max_count]; - int8 pad_B; - struct bitmap_data* map[k_dynamic_geometry_map_max_count]; - bool map_wrapped[k_dynamic_geometry_map_max_count]; - int8 pad_1B; - real_vector2d* map_offset[k_dynamic_geometry_map_max_count]; - real_vector4d vs_constants_second_4; - real_vector2d field_34; - real32 width_ratio; - real32 height_ratio; - real_vector4d vs_constants_second_0; - s_dynamic_geometry_map_color_parameters* map_tint[k_dynamic_geometry_map_max_count]; - int8 field_60[32]; - s_dynamic_geometry_map_alpha* map_alpha[k_dynamic_geometry_map_max_count]; - e_framebuffer_blend_function map0_to_1_blend_function; - e_framebuffer_blend_function map1_to_2_blend_function; - e_framebuffer_blend_function framebuffer_blend_function; - bool point_sampled; - int8 pad_97; -}; -ASSERT_STRUCT_SIZE(rasterizer_dynamic_screen_geometry_parameters, 152) /* prototypes */ diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynavobgeom.h b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynavobgeom.h index 09a13fb72..037c4b10c 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynavobgeom.h +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_dynavobgeom.h @@ -1,5 +1,62 @@ #pragma once -#include "rasterizer_dx9_dynamic_geometry.h" +#include "math/color_math.h" +#include "rasterizer/rasterizer_main.h" + +/* constants */ + +enum +{ + k_dynamic_geometry_map_max_count = 3 +}; + +/* structures */ + +struct s_dynamic_vertex_data +{ + real32 pos_x; + real32 pos_y; + real32 bounds_x; + real32 bounds_y; + pixel32 color; +}; +ASSERT_STRUCT_SIZE(s_dynamic_vertex_data, 20) + +struct s_dynamic_geometry_map_color_parameters +{ + real_rgb_color* color; + void* pad; +}; + +struct s_dynamic_geometry_map_alpha +{ + real32* alpha; +}; + +struct rasterizer_dynamic_screen_geometry_parameters +{ + void* meter_parameters; + real_vector2d* offset; + bool map_anchor_screen[k_dynamic_geometry_map_max_count]; + int8 pad_B; + struct bitmap_data* map[k_dynamic_geometry_map_max_count]; + bool map_wrapped[k_dynamic_geometry_map_max_count]; + int8 pad_1B; + real_vector2d* map_offset[k_dynamic_geometry_map_max_count]; + real_vector4d vs_constants_second_4; + real_vector2d field_34; + real32 width_ratio; + real32 height_ratio; + real_vector4d vs_constants_second_0; + s_dynamic_geometry_map_color_parameters* map_tint[k_dynamic_geometry_map_max_count]; + int8 field_60[32]; + s_dynamic_geometry_map_alpha* map_alpha[k_dynamic_geometry_map_max_count]; + e_framebuffer_blend_function map0_to_1_blend_function; + e_framebuffer_blend_function map1_to_2_blend_function; + e_framebuffer_blend_function framebuffer_blend_function; + bool point_sampled; + int8 pad_97; +}; +ASSERT_STRUCT_SIZE(rasterizer_dynamic_screen_geometry_parameters, 152) /* prototypes */ diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.cpp b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.cpp index e04673a71..b3e54401d 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.cpp +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.cpp @@ -25,6 +25,7 @@ #include "cseries/debug_memory.h" #include "game/game.h" #include "main/main.h" +#include "main/main_screenshot.h" #include "networking/network_configuration.h" #include "networking/network_event.h" #include "rasterizer/rasterizer_cinematics.h" @@ -45,9 +46,10 @@ #include "shell/shell.h" #include "shell/shell_windows.h" -#include "H2MOD/GUI/XLiveRendering.h" #include "H2MOD/Modules/Shell/Config.h" +#include + #if WINVER > 0x0600 && WINVER < 0x0602 #include #pragma comment(lib, "dwmapi") @@ -188,8 +190,6 @@ static const D3DVERTEXELEMENT9 global_d3d_vd_source[] = static rasterizer_dx9_set_texture_stage_t p_rasterizer_dx9_set_texture_stage; static rasterizer_dx9_initialize_t p_rasterizer_dx9_initialize; -static datum g_last_bitmap_tag_index = 0; - static s_rasterizer_parameters g_rasterizer_parameters = {}; /* prototypes */ @@ -253,7 +253,7 @@ void rasterizer_dx9_main_apply_patches(void) PatchCall(Memory::GetAddress(0x26375D), rasterizer_dx9_device_initialize); // Redirect dx9 initialization function so we can use d3d9on12 and do other cool stuff - DETOUR_ATTACH(p_rasterizer_dx9_initialize, Memory::GetAddress(0x263359, 0x0), rasterizer_initialize); + DETOUR_ATTACH(p_rasterizer_dx9_initialize, Memory::GetAddress(0x263359, 0x0), rasterizer_dx9_initialize); // disable gamma correction by using D3D9::SetGammaRamp, TODO: implement a shader to take care of this, because D3D9::SetGammaRamp function seems to have 2 issues: // 1) it's very heavy on NVIDIA/Intel (not sure about AMD) GPUs (or there is something wrong with the drivers), causing stuttering on maps that override gamma (like Warlock, Turf, Backwash) @@ -282,11 +282,6 @@ IDirect3DDevice9Ex* rasterizer_dx9_device_get_interface(void) return rasterizer_dx9_main_globals_get()->global_d3d_device; } -datum last_bitmap_tag_index_get(void) -{ - return g_last_bitmap_tag_index; -} - D3DCAPS9* rasterizer_dx9_caps_get(void) { return Memory::GetAddress(0x9DA900); @@ -297,6 +292,12 @@ int32* hardware_vertex_processing_get(void) return Memory::GetAddress(0x9DA8B0); } +bool rasterizer_dx9_device_is_lost(void) +{ + IDirect3DDevice9* d3d_device = rasterizer_dx9_device_get_interface(); + return d3d_device && FAILED(d3d_device->TestCooperativeLevel()); +} + bool __cdecl rasterizer_dx9_reset(bool create_window) { return INVOKE(0x26370F, 0x0, rasterizer_dx9_reset, create_window); @@ -377,7 +378,6 @@ void rasterizer_dx9_present(bitmap_data* screenshot_bitmap, bool a2) void __cdecl rasterizer_dx9_set_texture_direct(int16 stage, datum bitmap_tag_index, int16 bitmap_data_index, real32 a4) { - g_last_bitmap_tag_index = bitmap_tag_index; p_rasterizer_dx9_set_texture_stage(stage, bitmap_tag_index, bitmap_data_index, a4); return; } @@ -493,9 +493,9 @@ bool __cdecl rasterizer_dx9_device_initialize(s_rasterizer_parameters* parameter D3DPRESENT_PARAMETERS d3d_present_parameters = {}; d3d_present_parameters.hDeviceWindow = window_globals->hWnd; - d3d_present_parameters.BackBufferFormat = rasterizer_globals->display_parameters.backbuffer_format; + d3d_present_parameters.BackBufferFormat = (D3DFORMAT)rasterizer_globals->display_parameters.backbuffer_format; d3d_present_parameters.Windowed = !is_fullscreen; - d3d_present_parameters.AutoDepthStencilFormat = rasterizer_globals->display_parameters.depthstencil_format; + d3d_present_parameters.AutoDepthStencilFormat = (D3DFORMAT)rasterizer_globals->display_parameters.depthstencil_format; d3d_present_parameters.BackBufferWidth = rectangle2d_width(&rasterizer_globals->screen_bounds); d3d_present_parameters.Flags = 0; d3d_present_parameters.EnableAutoDepthStencil = false; @@ -543,7 +543,7 @@ bool __cdecl rasterizer_dx9_device_initialize(s_rasterizer_parameters* parameter fs_disp_mode.Width = d3d_present_parameters.BackBufferWidth; fs_disp_mode.Height = d3d_present_parameters.BackBufferHeight; fs_disp_mode.RefreshRate = d3d_present_parameters.FullScreen_RefreshRateInHz; - fs_disp_mode.Format = rasterizer_globals->display_parameters.backbuffer_format; + fs_disp_mode.Format = (D3DFORMAT)rasterizer_globals->display_parameters.backbuffer_format; fs_disp_mode.ScanLineOrdering = D3DSCANLINEORDERING_PROGRESSIVE; rasterizer_dx9_log_hr( hr, @@ -589,7 +589,7 @@ bool __cdecl rasterizer_dx9_device_initialize(s_rasterizer_parameters* parameter fs_disp_mode.Width = d3d_present_parameters.BackBufferWidth; fs_disp_mode.Height = d3d_present_parameters.BackBufferHeight; fs_disp_mode.RefreshRate = d3d_present_parameters.FullScreen_RefreshRateInHz; - fs_disp_mode.Format = rasterizer_globals->display_parameters.backbuffer_format; + fs_disp_mode.Format = (D3DFORMAT)rasterizer_globals->display_parameters.backbuffer_format; fs_disp_mode.ScanLineOrdering = D3DSCANLINEORDERING_PROGRESSIVE; D3DDISPLAYMODEEX* p_fs_disp_mode = is_fullscreen ? &fs_disp_mode : NULL; @@ -721,7 +721,7 @@ void __cdecl rasterizer_dx9_initialize_camera_projection( return; } -bool __cdecl rasterizer_initialize(void) +bool __cdecl rasterizer_dx9_initialize(void) { bool result = true; @@ -926,6 +926,69 @@ void __cdecl rasterizer_dx9_window_change_display_settings(DWORD flags) return; } +void rasterizer_dx9_main_render_pregame(void) +{ + s_rasterizer_dx9_main_globals* rasterizer_dx9_globals = rasterizer_dx9_main_globals_get(); + IDirect3DSurface9* backbuffer; + if (screenshot_in_progress()) + { + backbuffer = rasterizer_dx9_globals->global_d3d_surface_screenshot; + rasterizer_dx9_globals->global_d3d_surface_screenshot->AddRef(); + } + else + { + rasterizer_dx9_globals->global_d3d_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); + } + + rasterizer_dx9_log( + rasterizer_dx9_globals->global_d3d_device->StretchRect( + rasterizer_dx9_globals->global_d3d_surface_render_primary, + NULL, + backbuffer, + NULL, + D3DTEXF_NONE + ) + ); + if (backbuffer) + { + backbuffer->Release(); + } + return; +} + +bool rasterizer_dx9_initialize_screenshot_render_target(uint32 screen_width, uint32 screen_height) +{ + s_rasterizer_dx9_main_globals* rasterizer_dx9_globals = rasterizer_dx9_main_globals_get(); + IDirect3DDevice9Ex* global_d3d_device = rasterizer_dx9_device_get_interface(); + + HRESULT hr; + rasterizer_dx9_log_hr( + hr, + global_d3d_device->CreateRenderTarget( + screen_width, + screen_height, + D3DFMT_A8R8G8B8, + D3DMULTISAMPLE_NONE, + 0, + true, + &rasterizer_dx9_globals->global_d3d_surface_screenshot, + NULL + ) + ); + return SUCCEEDED(hr); +} + +void rasterizer_dx9_cleanup_screenshot_render_target(void) +{ + s_rasterizer_dx9_main_globals* rasterizer_dx9_globals = rasterizer_dx9_main_globals_get(); + if (rasterizer_dx9_globals->global_d3d_surface_screenshot) + { + rasterizer_dx9_globals->global_d3d_surface_screenshot->Release(); + rasterizer_dx9_globals->global_d3d_surface_screenshot = NULL; + } + return; +} + /* private code */ static PALETTEENTRY* g_d3d_palettes_get(void) @@ -1309,7 +1372,7 @@ static bool rasterizer_dx9_create_device_interface(void) } else if (rasterizer_globals->use_d3d9_ex) { - hr = rasterizer_globals->d3d9_create_ex_proc(D3D_SDK_VERSION, &dx9_globals->global_d3d_interface); + hr = ((decltype(Direct3DCreate9Ex)*)(rasterizer_globals->d3d9_create_ex_proc))(D3D_SDK_VERSION, &dx9_globals->global_d3d_interface); if (FAILED(hr)) { error(_error_delayed, "### ERROR failed to create D3D object with the Ex version of D3D"); diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.h b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.h index d1037b2a3..7e6ae720a 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.h +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_main.h @@ -3,32 +3,18 @@ #include "bitmaps/bitmap_group.h" #include "math/color_math.h" -#include "rasterizer/rasterizer_globals.h" +#include "rasterizer/rasterizer_main.h" /* enums */ -enum e_framebuffer_blend_function : int16 -{ - _framebuffer_blend_function_alpha_blend = 0, - _framebuffer_blend_function_multiply = 1, - _framebuffer_blend_function_double_multiply = 2, - _framebuffer_blend_function_add = 3, - _framebuffer_blend_function_subtract = 4, - _framebuffer_blend_function_component_min = 5, - _framebuffer_blend_function_component_max = 6, - _framebuffer_blend_function_alpha_multiply_add = 7, - _framebuffer_blend_function_constant_color_blend = 8, - _framebuffer_blend_function_inverse_constant_color_blend = 9, - _framebuffer_blend_function_none = 10, - k_shader_framebuffer_blend_function_count = 12 -}; + /* structures */ struct s_rasterizer_dx9_main_globals { IDirect3D9Ex* global_d3d_interface; - D3DMULTISAMPLE_TYPE global_d3d_primary_multisampletype; + uint32 global_d3d_primary_multisampletype; // D3DMULTISAMPLE_TYPE uint32 global_d3d_primary_multisamplequality; IDirect3DSurface9* global_d3d_surface_render_primary; IDirect3DSurface9* global_d3d_surface_render_primary_z; @@ -75,12 +61,12 @@ s_rasterizer_dx9_main_globals* rasterizer_dx9_main_globals_get(void); IDirect3DDevice9Ex* rasterizer_dx9_device_get_interface(void); -datum last_bitmap_tag_index_get(void); - D3DCAPS9* rasterizer_dx9_caps_get(void); int32* hardware_vertex_processing_get(void); +bool rasterizer_dx9_device_is_lost(void); + bool __cdecl rasterizer_dx9_reset(bool create_window); void __cdecl rasterizer_dx9_reset_depth_buffer(void); @@ -125,7 +111,7 @@ void __cdecl rasterizer_dx9_initialize_camera_projection( const struct render_projection* projection, e_rasterizer_target rasterizer_target); -bool __cdecl rasterizer_initialize(void); +bool __cdecl rasterizer_dx9_initialize(void); bool __cdecl rasterizer_dx9_vertex_shaders_initialize(void); @@ -136,3 +122,9 @@ bool __cdecl rasterizer_dx9_render_scene_end(void); void __cdecl rasterizer_dx9_clear_render_target(uint32 flags, pixel32 color, real32 z, bool stencil); void __cdecl rasterizer_dx9_window_change_display_settings(DWORD flags); + +void rasterizer_dx9_main_render_pregame(void); + +bool rasterizer_dx9_initialize_screenshot_render_target(uint32 screen_width, uint32 screen_height); + +void rasterizer_dx9_cleanup_screenshot_render_target(void); diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.cpp b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.cpp index 865d9dd5b..292e948c1 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.cpp +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.cpp @@ -1,10 +1,12 @@ #include "stdafx.h" #include "rasterizer_dx9_shader_submit_new.h" +#include "rasterizer_dx9.h" #include "rasterizer_dx9_main.h" #include "rasterizer_dx9_targets.h" #include "cache/cache_files.h" +#include "camera/camera.h" #include "game/game_globals.h" #include "interface/new_hud_draw.h" #include "objects/light_definitions.h" @@ -13,6 +15,7 @@ #include "render/render.h" #include "render/render_first_person.h" #include "shaders/shader_definitions.h" +#include "shaders/shader_passes.h" /* globals */ @@ -302,6 +305,53 @@ int32* rasterizer_unknown_shader_submit_unknown_value_get() return Memory::GetAddress(0x9765D8); } +void rasterizer_dx9_setup_2d_vertex_shader_user_interface_constants(void) +{ + real_vector4d vc[5]; + int16 width, height; + + const s_render* render = render_get(); + + width = rectangle2d_width(&render->camera.viewport_bounds); + height = rectangle2d_height(&render->camera.viewport_bounds); + + // vertex shaders use normalized device coordinates system (NDC) + vc[0].i = 2.0f / (real32)width; // x + vc[0].j = 0.0f; + vc[0].k = 0.0f; + vc[0].l = -(1.0f / (real32)width + 1.0f) - ((real32)render->camera.viewport_bounds.left * 2.0f / width); // offset from x + + vc[1].i = 0.0f; + vc[1].j = -(2.0f / (real32)height); // y + vc[1].k = 0.0f; + vc[1].l = (1.0f / (real32)height + 1.0f) + ((real32)render->camera.viewport_bounds.top * 2.0f / height); // offset from y + + vc[2].i = 0.0f; + vc[2].j = 0.0f; + vc[2].k = 0.0f; // z + vc[2].l = 0.5f; // acts as an offset, facing (<=1.0f is towards the viewport, above 1.0f facing from the viewport) + + vc[3].i = 0.0f; + vc[3].j = 0.0f; + vc[3].k = 0.0f; + vc[3].l = 1.0f; // w scaling component + + // the c181 register seems unused? + vc[4].i = 0.0f; + vc[4].j = 0.0f; + vc[4].k = 0.0f; + vc[4].l = 0.0f; + + IDirect3DDevice9Ex* global_d3d_device = rasterizer_dx9_device_get_interface(); + + // avoid unnecessary API calls by testing the user mode memory cache + if (rasterizer_get_main_vertex_shader_cache()->test_cache(177, vc, NUMBEROF(vc))) + { + global_d3d_device->SetVertexShaderConstantF(177, (const real32*)vc, NUMBEROF(vc)); + } + return; +} + /* private code */ void __fastcall c_shader_submission_interface_new__stage_texture( diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.h b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.h index c64455845..96e677870 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.h +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_shader_submit_new.h @@ -1,7 +1,5 @@ #pragma once #include "math/real_math.h" -#include "shaders/shader_postprocess_definitions.h" -#include "shaders/shader_passes.h" // TODO: finish reversing @@ -30,13 +28,13 @@ class c_shader_submission_interface_new int32 field_0; int32 field_4; datum m_extern_shader_index; - s_shader_postprocess_definition_new* m_shader_postprocess_definition; - s_shader_template_postprocess_definition_new* m_template_postprocess_definition; - s_shader_template_postprocess_level_of_detail_new* m_levels_of_detail; - s_shader_template_postprocess_pass_new* m_passes; - s_shader_template_postprocess_implementation_new* m_implementations; - s_shader_pass_postprocess_definition_new* m_shader_pass_postprocess_definition; - s_shader_pass_postprocess_implementation_new* m_shader_pass_implementation; + struct s_shader_postprocess_definition_new* m_shader_postprocess_definition; + struct s_shader_template_postprocess_definition_new* m_template_postprocess_definition; + struct s_shader_template_postprocess_level_of_detail_new* m_levels_of_detail; + struct s_shader_template_postprocess_pass_new* m_passes; + struct s_shader_template_postprocess_implementation_new* m_implementations; + struct s_shader_pass_postprocess_definition_new* m_shader_pass_postprocess_definition; + struct s_shader_pass_postprocess_implementation_new* m_shader_pass_implementation; real32 m_field_28; real32 m_field_2C; int8 m_dirty_value_externs[8]; @@ -60,7 +58,7 @@ class c_shader_submission_interface_new int32 field_182C; int32 m_vertex_shader_constant_count; int8 field_1834[8]; - IDirect3DPixelShader9* m_pixel_shader_handle; + struct IDirect3DPixelShader9* m_pixel_shader_handle; int32 m_pixel_shader_index; int32 field_1844; real_vector4d field_1848[32]; @@ -85,4 +83,6 @@ void __cdecl rasterizer_flags_unknown_function_1(); void __cdecl rasterizer_flags_unknown_function_2(int32* a1); // referenced before submitting a shader -int32* rasterizer_unknown_shader_submit_unknown_value_get(); \ No newline at end of file +int32* rasterizer_unknown_shader_submit_unknown_value_get(); + +void rasterizer_dx9_setup_2d_vertex_shader_user_interface_constants(void); diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp index ee2f24126..4274b5ae6 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.cpp @@ -614,7 +614,7 @@ bool __cdecl rasterizer_dx9_primary_targets_initialize(void) const int16 screen_bounds_height = rectangle2d_height(&rasterizer_globals->screen_bounds); bool success = false; - const D3DFORMAT backbuffer_fmt = rasterizer_globals->display_parameters.backbuffer_format; + const D3DFORMAT backbuffer_fmt = (D3DFORMAT)rasterizer_globals->display_parameters.backbuffer_format; HRESULT hr; rasterizer_dx9_log_hr( @@ -633,10 +633,10 @@ bool __cdecl rasterizer_dx9_primary_targets_initialize(void) success = SUCCEEDED(hr); if (success) { - const D3DMULTISAMPLE_TYPE type = rasterizer_globals->d3d9_sm3_supported ? D3DMULTISAMPLE_NONE : dx9_globals->global_d3d_primary_multisampletype; + const D3DMULTISAMPLE_TYPE type = (D3DMULTISAMPLE_TYPE)(rasterizer_globals->d3d9_sm3_supported ? D3DMULTISAMPLE_NONE : dx9_globals->global_d3d_primary_multisampletype); const uint32 quality = rasterizer_globals->d3d9_sm3_supported ? 0 : dx9_globals->global_d3d_primary_multisamplequality; - const D3DFORMAT depthstencil_fmt = rasterizer_globals->display_parameters.depthstencil_format; + const D3DFORMAT depthstencil_fmt = (D3DFORMAT)rasterizer_globals->display_parameters.depthstencil_format; // Get the surface of the previously created render resolved texture rasterizer_dx9_log_hr( @@ -781,7 +781,7 @@ bool __cdecl rasterizer_dx9_secondary_targets_initialize(void) screen_bounds_height, 1, D3DUSAGE_RENDERTARGET, - rasterizer_globals->display_parameters.backbuffer_format, + (D3DFORMAT)rasterizer_globals->display_parameters.backbuffer_format, D3DPOOL_DEFAULT, &dx9_globals->global_d3d_texture_backbuffer, NULL @@ -803,7 +803,7 @@ bool __cdecl rasterizer_dx9_secondary_targets_initialize(void) { const bool sm3_supported = rasterizer_globals->d3d9_sm3_supported; - const D3DFORMAT format = (sm3_supported ? rasterizer_globals->display_parameters.backbuffer_format : rasterizer_globals->display_parameters.depthstencil_format); + const D3DFORMAT format = (D3DFORMAT)(sm3_supported ? rasterizer_globals->display_parameters.backbuffer_format : rasterizer_globals->display_parameters.depthstencil_format); const D3DMULTISAMPLE_TYPE type = D3DMULTISAMPLE_NONE; const uint32 quality = 0; @@ -818,7 +818,7 @@ bool __cdecl rasterizer_dx9_secondary_targets_initialize(void) screen_bounds_height, 1, D3DUSAGE_RENDERTARGET, - rasterizer_globals->display_parameters.backbuffer_format, + (D3DFORMAT)rasterizer_globals->display_parameters.backbuffer_format, D3DPOOL_DEFAULT, &g_d3d_texture_render_z_as_target_z, NULL diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.h b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.h index 918dc7c09..e34812062 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.h +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_targets.h @@ -55,8 +55,8 @@ enum e_rasterizer_target : int16 struct s_rasterizer_target { - IDirect3DTexture9* d3d_texture_storage; - IDirect3DSurface9* d3d_surface_storage[4]; + struct IDirect3DTexture9* d3d_texture_storage; + struct IDirect3DSurface9* d3d_surface_storage[4]; int32 mip_count; uint32 size_x; uint32 size_y; @@ -82,31 +82,31 @@ void rasterizer_dx9_copy_target(e_rasterizer_target src_target, e_rasterizer_tar void __cdecl rasterizer_dx9_staged_texture_surface_size(int32 texture_stage, uint32* out_width, uint32* out_height); -IDirect3DSurface9* rasterizer_dx9_target_get_main_mip_surface(e_rasterizer_target rasterizer_target); +struct IDirect3DSurface9* rasterizer_dx9_target_get_main_mip_surface(e_rasterizer_target rasterizer_target); -bool __cdecl rasterizer_dx9_set_render_target_internal(IDirect3DSurface9* target, IDirect3DSurface9* z_stencil, bool use_depth); +bool __cdecl rasterizer_dx9_set_render_target_internal(struct IDirect3DSurface9* target, struct IDirect3DSurface9* z_stencil, bool use_depth); -void __cdecl rasterizer_set_render_target_internal_hook_set_main_render_surface(IDirect3DSurface9* target, IDirect3DSurface9* z_stencil, bool a3); +void __cdecl rasterizer_set_render_target_internal_hook_set_main_render_surface(struct IDirect3DSurface9* target, struct IDirect3DSurface9* z_stencil, bool a3); -void __cdecl rasterizer_set_render_target_internal_hook_set_viewport(IDirect3DSurface9* target, IDirect3DSurface9* z_stencil, bool a3); +void __cdecl rasterizer_set_render_target_internal_hook_set_viewport(struct IDirect3DSurface9* target, struct IDirect3DSurface9* z_stencil, bool a3); e_rasterizer_target __cdecl rasterizer_dx9_get_overlay_destination_target(void); -IDirect3DSurface9* __cdecl rasterizer_dx9_get_render_target_surface(e_rasterizer_target rasterizer_target, int16 mipmap_index); +struct IDirect3DSurface9* __cdecl rasterizer_dx9_get_render_target_surface(e_rasterizer_target rasterizer_target, int16 mipmap_index); bool __cdecl rasterizer_dx9_set_target_as_texture(int16 stage, e_rasterizer_target rasterizer_target); -bool rasterizer_dx9_set_target_as_texture_internal(int16 stage, e_rasterizer_target rasterizer_target, IDirect3DTexture9* d3d_texture); +bool rasterizer_dx9_set_target_as_texture_internal(int16 stage, e_rasterizer_target rasterizer_target, struct IDirect3DTexture9* d3d_texture); void __cdecl rasterizer_dx9_set_target(e_rasterizer_target rasterizer_target, int32 mipmap_index, bool use_depth); bool __cdecl rasterizer_target_get_resolution(int32 rasterizer_target, uint32* resolution_x, uint32* resolution_y); -IDirect3DSurface9** rasterizer_dx9_last_target_get(void); +struct IDirect3DSurface9** rasterizer_dx9_last_target_get(void); -IDirect3DSurface9** rasterizer_dx9_last_z_target_get(void); +struct IDirect3DSurface9** rasterizer_dx9_last_z_target_get(void); -IDirect3DSurface9** rasterizer_dx9_last_z_stencil_get(void); +struct IDirect3DSurface9** rasterizer_dx9_last_z_stencil_get(void); bool __cdecl rasterizer_dx9_primary_targets_initialize(void); diff --git a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_weather.h b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_weather.h index a412f44b1..18ea71af4 100644 --- a/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_weather.h +++ b/xlive/Blam/Engine/rasterizer/dx9/rasterizer_dx9_weather.h @@ -27,4 +27,4 @@ bool __cdecl rasterizer_dx9_weather_plate_build_vertex_buffer( void* output, c_animated_background_plate* ctx); -bool rasterizer_dx9_draw_weather_particles(c_particle_system_lite* system); +bool rasterizer_dx9_draw_weather_particles(class c_particle_system_lite* system); diff --git a/xlive/Blam/Engine/rasterizer/rasterizer_globals.h b/xlive/Blam/Engine/rasterizer/rasterizer_globals.h index 92cf62abd..f987a17a6 100644 --- a/xlive/Blam/Engine/rasterizer/rasterizer_globals.h +++ b/xlive/Blam/Engine/rasterizer/rasterizer_globals.h @@ -2,7 +2,10 @@ /* constants */ -#define k_max_texture_stages 4 +enum +{ + k_max_texture_stages = 4, +}; /* enums */ @@ -30,8 +33,8 @@ struct s_rasterizer_globals_display_parameters int64 pad_3; int16 refresh_rate; int16 pad; - D3DFORMAT backbuffer_format; - D3DFORMAT depthstencil_format; + uint32 backbuffer_format; // D3DFORMAT + uint32 depthstencil_format; // D3DFORMAT int16 font_width; int16 font_height; e_display_type display_type; @@ -86,7 +89,7 @@ struct s_rasterizer_globals bool rasterizer_initialized; bool use_d3d9_ex; int8 pad[2]; - decltype(Direct3DCreate9Ex)* d3d9_create_ex_proc; + void* d3d9_create_ex_proc; // decltype(Direct3DCreate9Ex)* uint32 resolution_x; uint32 resolution_y; rectangle2d screen_bounds; @@ -127,10 +130,10 @@ uint32 rasterizer_get_width(void); uint32 rasterizer_get_height(void); -void rasterizer_get_screen_bounds(rectangle2d* screen_bounds); +void rasterizer_get_screen_bounds(union rectangle2d* screen_bounds); -void rasterizer_get_frame_bounds(rectangle2d* frame_bounds); +void rasterizer_get_frame_bounds(union rectangle2d* frame_bounds); -void rasterizer_get_screen_and_frame_bounds(rectangle2d* screen_bounds, rectangle2d* frame_bounds); +void rasterizer_get_screen_and_frame_bounds(union rectangle2d* screen_bounds, union rectangle2d* frame_bounds); void rasterizer_get_z_planes(real32* z_near, real32* z_far); diff --git a/xlive/Blam/Engine/rasterizer/rasterizer_main.cpp b/xlive/Blam/Engine/rasterizer/rasterizer_main.cpp index 426182f64..5cccf8e21 100644 --- a/xlive/Blam/Engine/rasterizer/rasterizer_main.cpp +++ b/xlive/Blam/Engine/rasterizer/rasterizer_main.cpp @@ -15,6 +15,13 @@ void rasterizer_main_apply_patches(void) { // present hooks for the frame limiter PatchCall(Memory::GetAddress(0x19073C), rasterizer_present_hook); + rasterizer_dx9_main_apply_patches(); + return; +} + +void rasterizer_sapien_apply_patches(void) +{ + rasterizer_dx9_sapien_apply_patches(); return; } @@ -35,6 +42,50 @@ e_display_type rasterizer_get_display_type(void) return ui_shell ? _display_type_4_by_3 : rasterizer_globals_get()->display_parameters.display_type; } + +uint32 rasterizer_get_adapter_count(void) +{ + return rasterizer_dx9_main_globals_get()->global_d3d_interface->GetAdapterCount(); +} + +bool rasterizer_is_initialized(void) +{ + return rasterizer_dx9_main_globals_get()->global_d3d_device != NULL; +} + +bool rasterizer_initialize(void) +{ + return rasterizer_dx9_initialize(); +} + +void rasterizer_reset(bool create_window) +{ + rasterizer_dx9_reset(create_window); + return; +} + +bool rasterizer_initialize_screenshot_render_target(uint32 screen_width, uint32 screen_height) +{ + return rasterizer_dx9_initialize_screenshot_render_target(screen_width, screen_height);; +} + +void rasterizer_cleanup_screenshot_render_target(void) +{ + rasterizer_dx9_cleanup_screenshot_render_target(); + return; +} + +bool rasterizer_device_is_lost(void) +{ + return rasterizer_dx9_device_is_lost(); +} + +void rasterizer_main_render_pregame(void) +{ + rasterizer_dx9_main_render_pregame(); + return; +} + /* private code */ static void __cdecl rasterizer_present_hook(bitmap_data* bitmap) diff --git a/xlive/Blam/Engine/rasterizer/rasterizer_main.h b/xlive/Blam/Engine/rasterizer/rasterizer_main.h index fe72227ab..a2171ab17 100644 --- a/xlive/Blam/Engine/rasterizer/rasterizer_main.h +++ b/xlive/Blam/Engine/rasterizer/rasterizer_main.h @@ -3,6 +3,24 @@ #include "math/color_math.h" +/* enums */ + +enum e_framebuffer_blend_function : int16 +{ + _framebuffer_blend_function_alpha_blend = 0, + _framebuffer_blend_function_multiply = 1, + _framebuffer_blend_function_double_multiply = 2, + _framebuffer_blend_function_add = 3, + _framebuffer_blend_function_subtract = 4, + _framebuffer_blend_function_component_min = 5, + _framebuffer_blend_function_component_max = 6, + _framebuffer_blend_function_alpha_multiply_add = 7, + _framebuffer_blend_function_constant_color_blend = 8, + _framebuffer_blend_function_inverse_constant_color_blend = 9, + _framebuffer_blend_function_none = 10, + k_shader_framebuffer_blend_function_count = 12 +}; + /* structures */ struct s_rasterizer_debug_options @@ -207,8 +225,26 @@ ASSERT_STRUCT_SIZE(s_rasterizer_debug_options, 736); void rasterizer_main_apply_patches(void); +void rasterizer_sapien_apply_patches(void); + struct s_rasterizer_debug_options* rasterizer_debug_options_get(void); void rasterizer_present_frame_screenshot_wrapper(struct bitmap_data* bitmap); e_display_type rasterizer_get_display_type(void); + +uint32 rasterizer_get_adapter_count(void); + +bool rasterizer_is_initialized(void); + +bool rasterizer_initialize(void); + +void rasterizer_reset(bool create_window); + +bool rasterizer_initialize_screenshot_render_target(uint32 screen_width, uint32 screen_height); + +void rasterizer_cleanup_screenshot_render_target(void); + +bool rasterizer_device_is_lost(void); + +void rasterizer_main_render_pregame(void); diff --git a/xlive/Blam/Engine/rasterizer/rasterizer_settings.cpp b/xlive/Blam/Engine/rasterizer/rasterizer_settings.cpp index 6e5bbe411..ee4c0ebc8 100644 --- a/xlive/Blam/Engine/rasterizer/rasterizer_settings.cpp +++ b/xlive/Blam/Engine/rasterizer/rasterizer_settings.cpp @@ -4,10 +4,9 @@ #include "rasterizer_globals.h" #include "interface/user_interface_text.h" +#include "rasterizer/dx9/rasterizer_dx9_main.h" #include "shell/shell.h" #include "shell/shell_windows.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" - /* typedefs */ @@ -145,21 +144,21 @@ void __cdecl rasterizer_settings_set_antialiasing(uint32* out_quality) s_rasterizer_dx9_main_globals* dx9_globals = rasterizer_dx9_main_globals_get(); IDirect3D9Ex* d3d9_interface = dx9_globals->global_d3d_interface; - + uint32 backbuffer_quality = 0; uint32 depth_quality = 0; if (multisample_type && SUCCEEDED(d3d9_interface->CheckDeviceMultiSampleType( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - rasterizer_globals->display_parameters.backbuffer_format, - D3DFORMAT(rasterizer_globals->display_parameters.window_mode != _rasterizer_window_mode_real_fullscreen), + (D3DFORMAT)rasterizer_globals->display_parameters.backbuffer_format, + (rasterizer_globals->display_parameters.window_mode != _rasterizer_window_mode_real_fullscreen), multisample_type, &backbuffer_quality)) && SUCCEEDED(d3d9_interface->CheckDeviceMultiSampleType( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - rasterizer_globals->display_parameters.depthstencil_format, + (D3DFORMAT)rasterizer_globals->display_parameters.depthstencil_format, rasterizer_globals->display_parameters.window_mode != _rasterizer_window_mode_real_fullscreen, multisample_type, &depth_quality))) diff --git a/xlive/Blam/Engine/rasterizer/rasterizer_settings.h b/xlive/Blam/Engine/rasterizer/rasterizer_settings.h index e270ffa03..cde46111e 100644 --- a/xlive/Blam/Engine/rasterizer/rasterizer_settings.h +++ b/xlive/Blam/Engine/rasterizer/rasterizer_settings.h @@ -1,6 +1,5 @@ #pragma once #include "rasterizer_globals.h" -#include "tag_files/tag_groups.h" /* constants */ @@ -20,7 +19,7 @@ enum e_display_aspect_ratio : int32 enum { - _rasterizer_settings_display_mode_last_user_selectable = _rasterizer_window_mode_windowed, + _rasterizer_settings_display_mode_last_user_selectable = _rasterizer_window_mode_borderless, }; /* structures */ diff --git a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp index c6628431f..1f5b42b21 100644 --- a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp +++ b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.cpp @@ -8,18 +8,21 @@ #include "rasterizer/rasterizer_globals.h" #include "rasterizer/rasterizer_text.h" #include "rasterizer/dx9/rasterizer_dx9.h" -#include "shell/shell_windows.h" #include "networking/logic/life_cycle_manager.h" #include "networking/session/network_observer.h" #include "networking/session/network_session.h" +#include "shell/shell_windows.h" #include "text/draw_string.h" #include "text/font_cache.h" #include "text/unicode.h" +#ifndef IMGUI_DISABLE #include "H2MOD/GUI/imgui_integration/imgui_handler.h" +#endif #include "H2MOD/Modules/Accounts/AccountLogin.h" -#include "H2MOD/Modules/Achievements/Achievements.h" #include "H2MOD/Modules/Updater/Updater.h" + +#include "XLive/achievements/XAchievements.h" #include "version_git.h" /* defines */ @@ -77,13 +80,13 @@ void render_cartographer_ingame_ui(void) rasterizer_dx9_perf_event_begin("render cartographer ingame ui", NULL); render_cartographer_status_bar(g_cartographer_build_text); render_cartographer_update_message(g_auto_update_text, sizeOfDownload, sizeOfDownloaded); - if (!AchievementMap.empty()) + + if (achievement_has_entry()) { - auto it = AchievementMap.begin(); - it->second = true; - if (!render_cartographer_achievement_message(it->first.c_str())) + const char* string = achievement_get_first(); + if (!render_cartographer_achievement_message(string)) { - AchievementMap.erase(it); + achievement_pop_first(); } } render_cartographer_git_build_info(); @@ -159,11 +162,11 @@ void render_cartographer_git_build_info(void) wchar_t result_text_buffer[1024]; - swprintf(result_text_buffer, NUMBEROF(result_text_buffer), L"%S %S", __DATE__, __TIME__); + usnprintf(result_text_buffer, NUMBEROF(result_text_buffer), L"%S %S", __DATE__, __TIME__); rasterizer_draw_unicode_string(&bounds, result_text_buffer); bounds.top += line_height; bounds.bottom = bounds.top + line_height; - swprintf(result_text_buffer, NUMBEROF(result_text_buffer), L"%S %S branch: %S", GEN_GIT_VER_VERSION_STRING, GET_GIT_VER_USERNAME, GET_GIT_VER_BRANCH); + usnprintf(result_text_buffer, NUMBEROF(result_text_buffer), L"%S %S branch: %S", GEN_GIT_VER_VERSION_STRING, GET_GIT_VER_USERNAME, GET_GIT_VER_BRANCH); rasterizer_draw_unicode_string(&bounds, result_text_buffer); #endif } @@ -258,7 +261,7 @@ void render_cartographer_update_message(const char* update_text, int64 update_si { wchar_t update_message_buffer[256]; real32 percent_complete = 100.f * ((real32)update_downloaded_bytes / update_size_bytes); - swprintf_s(update_message_buffer, NUMBEROF(update_message_buffer), L"(progress: %.2f%%)", percent_complete); + usnprintf(update_message_buffer, NUMBEROF(update_message_buffer), L"(progress: %.2f%%)", percent_complete); rasterizer_draw_unicode_string(&bounds, update_message_buffer); } @@ -274,7 +277,7 @@ void render_main_game_time_debug(void) rectangle2d bounds; wchar_t main_game_time_debug_text[512]; - swprintf_s(main_game_time_debug_text, ARRAYSIZE(main_game_time_debug_text), + usnprintf(main_game_time_debug_text, ARRAYSIZE(main_game_time_debug_text), L"dt default: %.6f dt performance counter: %.6f", g_main_game_time_debug.dt_default, g_main_game_time_debug.dt_performance_counter @@ -359,7 +362,9 @@ void render_netdebug_text(void) real_argb_color text_color_console = *global_real_argb_white; text_color_console.alpha *= (65.f / 100.f); - swprintf_s(netdebug_text, ARRAYSIZE(netdebug_text), + usnprintf( + netdebug_text, + ARRAYSIZE(netdebug_text), L"[up^ rtt: %3d msec, pck rate: %.1f, throughput: %.3f bps, loss: %3d %%]", netdebug_data->client_rtt_msec, (real32)netdebug_data->client_packet_rate / 10.f, diff --git a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.h b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.h index 986efd7ab..72a98e60c 100644 --- a/xlive/Blam/Engine/render/render_cartographer_ingame_ui.h +++ b/xlive/Blam/Engine/render/render_cartographer_ingame_ui.h @@ -1,7 +1,9 @@ #pragma once -/* public code */ +/* prototypes */ void render_cartographer_ingame_ui(void); -extern bool g_display_netdebug_text; \ No newline at end of file +/* globals */ + +extern bool g_display_netdebug_text; diff --git a/xlive/Blam/Engine/render/render_lod_new.cpp b/xlive/Blam/Engine/render/render_lod_new.cpp index 8d68d56b6..857cee296 100644 --- a/xlive/Blam/Engine/render/render_lod_new.cpp +++ b/xlive/Blam/Engine/render/render_lod_new.cpp @@ -11,6 +11,7 @@ #include "objects/objects.h" #include "rasterizer/rasterizer_memory.h" #include "render/render_objects.h" +#include "render/render_prt.h" #include "H2MOD/Modules/Shell/Config.h" @@ -366,7 +367,7 @@ void __cdecl object_build_render_cache_and_info( if (TEST_BIT(info->field_170, 6)) { render_model_definition* render_model = (render_model_definition*)tag_get_fast(info->render_model_tag_defs[render_model_storage_index]); - prt_info* prt = render_model->prt_info[0]; + prt_info* prt = (prt_info*)TAG_BLOCK_GET_ELEMENT(&render_model->prt_info, 0, prt_info); object_render_valid = sub_59EB0C( a6, diff --git a/xlive/Blam/Engine/render/render_weather.h b/xlive/Blam/Engine/render/render_weather.h index f2dedacbc..240fa205c 100644 --- a/xlive/Blam/Engine/render/render_weather.h +++ b/xlive/Blam/Engine/render/render_weather.h @@ -7,7 +7,10 @@ /* constants */ -#define MAX_PARTICLES_LITE 4096 +enum +{ + MAX_PARTICLES_LITE = 4096 +}; /* enums */ @@ -93,7 +96,7 @@ ASSERT_STRUCT_SIZE(c_particle_system_lite, 140); /* globals */ -extern IDirect3DPixelShader9* g_d3d9_weather_shaders[k_dx9_weather_shader_type_count]; +extern struct IDirect3DPixelShader9* g_d3d9_weather_shaders[k_dx9_weather_shader_type_count]; /* prototypes */ diff --git a/xlive/Blam/Engine/render/weather_definitions.h b/xlive/Blam/Engine/render/weather_definitions.h index 3710c4308..801c70d81 100644 --- a/xlive/Blam/Engine/render/weather_definitions.h +++ b/xlive/Blam/Engine/render/weather_definitions.h @@ -1,10 +1,12 @@ #pragma once #include "math/color_math.h" -#include "render/render_weather.h" #include "tag_files/tag_reference.h" -#define MAX_WIND_PRIMITIVES 128 -#define k_animated_background_plate_textures 3 +enum +{ + MAX_WIND_PRIMITIVES = 128, + k_animated_background_plate_textures = 3, +}; enum e_wind_primitive_type : uint16 { @@ -50,7 +52,7 @@ class c_wind_model real32 turbulence_rate_of_change; real_vector3d turbulence_scale; real32 gravity_constant; - tag_block wind_primitives; + s_tag_block wind_primitives; // struct: c_wind_primitive int32 pad_3; }; ASSERT_STRUCT_SIZE(c_wind_model, 156); @@ -110,8 +112,8 @@ ASSERT_STRUCT_SIZE(c_animated_background_plate, 936); class c_weather_system { public: - tag_block m_particle_system; - tag_block m_background_plates; + s_tag_block m_particle_system; // struct: c_particle_system_lite + s_tag_block m_background_plates; // struct: c_animated_background_plate c_wind_model m_wind_model; real32 m_fade_radius; }; diff --git a/xlive/Blam/Engine/sapien/patches_initialize.cpp b/xlive/Blam/Engine/sapien/patches_initialize.cpp index 8d1016688..efe6131d0 100644 --- a/xlive/Blam/Engine/sapien/patches_initialize.cpp +++ b/xlive/Blam/Engine/sapien/patches_initialize.cpp @@ -2,13 +2,13 @@ #include "patches_initialize.h" #include "main/map_repository.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" +#include "rasterizer/rasterizer_main.h" /* public code */ void sapien_apply_patches(void) { map_repository_apply_sapien_patches(); - rasterizer_dx9_sapien_apply_patches(); + rasterizer_sapien_apply_patches(); return; } diff --git a/xlive/Blam/Engine/scenario/scenario_definitions.h b/xlive/Blam/Engine/scenario/scenario_definitions.h index a51552173..d8e414554 100644 --- a/xlive/Blam/Engine/scenario/scenario_definitions.h +++ b/xlive/Blam/Engine/scenario/scenario_definitions.h @@ -2,7 +2,6 @@ #include "game/game_allegiance.h" #include "math/periodic_functions.h" #include "tag_files/data_reference.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" /* constants */ @@ -308,7 +307,7 @@ enum e_respawn_timer_starts : short respawn_timer_starts_on_body_depletion = 1 }; -enum e_netgame_item_classification : byte +enum e_netgame_item_classification : uint8 { netgame_item_classification_weapon = 0, netgame_item_classification_primary_light_land = 1, @@ -334,12 +333,12 @@ struct scenario_netgame_equipment short respawn_on_empty_time_seconds; e_respawn_timer_starts respawn_timer_starts; e_netgame_item_classification classification; - byte pad1[3]; - int64_t pad2[5]; + uint8 pad1[3]; + int64 pad2[5]; real_point3d position; real_euler_angles3d orientation; tag_reference item_vehicle_collection; // itmc/vehc but allows any tag - int64_t pad3[6]; + int64 pad3[6]; }; ASSERT_STRUCT_SIZE(scenario_netgame_equipment, 144); diff --git a/xlive/Blam/Engine/scenario/scenario_fog.h b/xlive/Blam/Engine/scenario/scenario_fog.h index 120861407..f9272b9b2 100644 --- a/xlive/Blam/Engine/scenario/scenario_fog.h +++ b/xlive/Blam/Engine/scenario/scenario_fog.h @@ -2,7 +2,6 @@ #include "math/color_math.h" #include "render/render_cameras.h" #include "tag_files/tag_block.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" #define MAXIMUM_ATMOSPHERIC_FOG_PALETTE_ENTRIES_PER_SCENARIO 127 diff --git a/xlive/Blam/Engine/scenario/scenario_interpolators.h b/xlive/Blam/Engine/scenario/scenario_interpolators.h index f457d19e8..8341a3974 100644 --- a/xlive/Blam/Engine/scenario/scenario_interpolators.h +++ b/xlive/Blam/Engine/scenario/scenario_interpolators.h @@ -1,6 +1,5 @@ #pragma once #include "math/function_definitions.h" -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/scenario/scenario_kill_trigger_volumes.h b/xlive/Blam/Engine/scenario/scenario_kill_trigger_volumes.h index c3402f105..7f5cdce7a 100644 --- a/xlive/Blam/Engine/scenario/scenario_kill_trigger_volumes.h +++ b/xlive/Blam/Engine/scenario/scenario_kill_trigger_volumes.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* structures */ diff --git a/xlive/Blam/Engine/shaders/pixel_shader.h b/xlive/Blam/Engine/shaders/pixel_shader.h index 82b35757a..adc7f6d26 100644 --- a/xlive/Blam/Engine/shaders/pixel_shader.h +++ b/xlive/Blam/Engine/shaders/pixel_shader.h @@ -41,7 +41,7 @@ ASSERT_STRUCT_SIZE(s_pixel_shader_constant_defaults, 4) // max count: 100 struct s_pixel_shader { - IDirect3DPixelShader9* pixel_shader_handle_runtime[3]; + struct IDirect3DPixelShader9* pixel_shader_handle_runtime[3]; tag_block constant_register_defaults; /**************************************** diff --git a/xlive/Blam/Engine/shaders/shader_definitions.h b/xlive/Blam/Engine/shaders/shader_definitions.h index a28952e29..f9c3e83ca 100644 --- a/xlive/Blam/Engine/shaders/shader_definitions.h +++ b/xlive/Blam/Engine/shaders/shader_definitions.h @@ -4,7 +4,6 @@ #include "cache/predicted_resources.h" #include "math/color_math.h" #include "math/function_definitions.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" #define k_number_of_shader_animation_property_types 14 diff --git a/xlive/Blam/Engine/shaders/shader_postprocess_definitions.h b/xlive/Blam/Engine/shaders/shader_postprocess_definitions.h index dc48a9f42..de4307507 100644 --- a/xlive/Blam/Engine/shaders/shader_postprocess_definitions.h +++ b/xlive/Blam/Engine/shaders/shader_postprocess_definitions.h @@ -5,7 +5,6 @@ #include "math/color_math.h" #include "math/function_definitions.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/shaders/shader_templates.h b/xlive/Blam/Engine/shaders/shader_templates.h index a76c11a11..64f2a702c 100644 --- a/xlive/Blam/Engine/shaders/shader_templates.h +++ b/xlive/Blam/Engine/shaders/shader_templates.h @@ -4,7 +4,6 @@ #include "math/color_math.h" #include "tag_files/data_reference.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/shell/shell.cpp b/xlive/Blam/Engine/shell/shell.cpp index a8543ee62..cd4093f41 100644 --- a/xlive/Blam/Engine/shell/shell.cpp +++ b/xlive/Blam/Engine/shell/shell.cpp @@ -12,7 +12,7 @@ #include "math/real_math.h" #include "networking/network_configuration.h" #include "networking/session/network_observer.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" +#include "rasterizer/rasterizer_main.h" #include "saved_games/game_state.h" #ifdef _WINDOWS #include "shell/shell_windows.h" diff --git a/xlive/Blam/Engine/shell/shell_windows.cpp b/xlive/Blam/Engine/shell/shell_windows.cpp index 4cb8c79d9..1126ce90a 100644 --- a/xlive/Blam/Engine/shell/shell_windows.cpp +++ b/xlive/Blam/Engine/shell/shell_windows.cpp @@ -5,9 +5,10 @@ #include "shell_windows_internals.h" #include "shell_windows_pcc.h" +#include "cartographer/discord/discord_interface.h" #include "input/input_windows.h" #include "main/main.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" +#include "rasterizer/rasterizer_main.h" #include "H2MOD/Modules/CustomMenu/CustomLanguage.h" #include "H2MOD/Modules/OnScreenDebug/OnscreenDebug.h" @@ -16,13 +17,7 @@ #include "H2MOD/Modules/Shell/Startup/Startup.h" #ifndef IMGUI_DISABLE - #include "imgui.h" - -/* prototypes */ - -extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - #endif /* constants */ @@ -32,6 +27,18 @@ enum k_max_monitor_count = 9 }; +static const wchar_t k_discord_dll_filename[] = L"discord_game_sdk.dll"; + +/* prototypes */ + +extern void h2log_onscreen_initialize(void); + +extern void h2log_initialize(void); + +#ifndef IMGUI_DISABLE +extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +#endif + /* globals */ static LARGE_INTEGER g_startup_counter; @@ -80,6 +87,8 @@ static void shell_windows_initialize_arguments(void); static bool __cdecl shell_windows_is_remote_desktop(void); +static void discord_initialize(void); + static bool shell_set_game_cursor_state_hook(bool enabled); static void DuplicateDataBlob(DATA_BLOB* pDataIn, DATA_BLOB* pDataOut); @@ -121,6 +130,7 @@ bool shell_platform_initialize(void) shell_windows_throttle_framerate_initialize(); + h2log_onscreen_initialize(); InitOnScreenDebugText(); // TODO: initialize the ini config in the same place between client and dedi @@ -130,6 +140,8 @@ bool shell_platform_initialize(void) PostH2Config(); } + discord_initialize(); + h2log_initialize(); // If the intro is already disabled via command line flag don't try and set it via the config option @@ -266,7 +278,7 @@ uint32 shell_windows_get_monitor_index(void) result = shell_command_line_flag_get(_shell_command_line_flag_monitor_count); // Set monitor index to 0 if the monitor index set by the shell flag isn't a valid monitor - if (result >= rasterizer_dx9_main_globals_get()->global_d3d_interface->GetAdapterCount()) + if (result >= rasterizer_get_adapter_count()) { result = 0; } @@ -660,6 +672,22 @@ static bool __cdecl shell_windows_is_remote_desktop(void) return INVOKE(0x39EA2, 0x0, shell_windows_is_remote_desktop); } +static void discord_initialize(void) +{ + HMODULE module = LoadLibraryW(k_discord_dll_filename); + if (module && !shell_is_dedicated_server() + && H2Config_discord_enable +#ifdef TEST_DISCORD_INSTANCE + && g_instance_number == 1 +#endif + ) + { + discord_game_status_create(module); + } + + return; +} + static void DuplicateDataBlob(DATA_BLOB* pDataIn, DATA_BLOB* pDataOut) { pDataOut->cbData = pDataIn->cbData; diff --git a/xlive/Blam/Engine/shell/shell_windows_internals.cpp b/xlive/Blam/Engine/shell/shell_windows_internals.cpp index 6f10103ac..e3a8f8ccb 100644 --- a/xlive/Blam/Engine/shell/shell_windows_internals.cpp +++ b/xlive/Blam/Engine/shell/shell_windows_internals.cpp @@ -1,6 +1,4 @@ - #include "stdafx.h" - #include "shell_windows_internals.h" NTSTATUS NtQueryTimerResolutionHelper(PULONG MinimumResolution, PULONG MaximumResolution, PULONG CurrentResolution) diff --git a/xlive/Blam/Engine/simulation/game_interface/simulation_game_action.h b/xlive/Blam/Engine/simulation/game_interface/simulation_game_action.h index 3e73d0435..ee6e1d644 100644 --- a/xlive/Blam/Engine/simulation/game_interface/simulation_game_action.h +++ b/xlive/Blam/Engine/simulation/game_interface/simulation_game_action.h @@ -1,11 +1,13 @@ #pragma once +/* enums */ + enum e_simulation_action_update : uint32 { _simulation_action_update_grenade_count_bit = 22 }; - +/* prototypes */ void __cdecl simulation_action_object_create(datum object_index); diff --git a/xlive/Blam/Engine/simulation/game_interface/simulation_game_generics.h b/xlive/Blam/Engine/simulation/game_interface/simulation_game_generics.h index f7b44928a..46ec36361 100644 --- a/xlive/Blam/Engine/simulation/game_interface/simulation_game_generics.h +++ b/xlive/Blam/Engine/simulation/game_interface/simulation_game_generics.h @@ -1,6 +1,5 @@ #pragma once #include "simulation_game_objects.h" -#include "tag_files/tag_groups.h" struct s_simulation_generic_creation_data { diff --git a/xlive/Blam/Engine/simulation/game_interface/simulation_game_units.h b/xlive/Blam/Engine/simulation/game_interface/simulation_game_units.h index f0c31eadb..109970044 100644 --- a/xlive/Blam/Engine/simulation/game_interface/simulation_game_units.h +++ b/xlive/Blam/Engine/simulation/game_interface/simulation_game_units.h @@ -1,6 +1,6 @@ #pragma once #include "simulation_game_objects.h" -#include "game/players.h" +#include "saved_games/player_profile.h" #include "units/units.h" struct s_simulation_unit_state_data diff --git a/xlive/Blam/Engine/simulation/game_interface/simulation_game_vehicles.h b/xlive/Blam/Engine/simulation/game_interface/simulation_game_vehicles.h index 1cb8a500c..89e84427d 100644 --- a/xlive/Blam/Engine/simulation/game_interface/simulation_game_vehicles.h +++ b/xlive/Blam/Engine/simulation/game_interface/simulation_game_vehicles.h @@ -1,6 +1,5 @@ #pragma once #include "simulation_game_objects.h" -#include "tag_files/tag_groups.h" struct s_simulation_vehicle_creation_data { diff --git a/xlive/Blam/Engine/simulation/machine_id.h b/xlive/Blam/Engine/simulation/machine_id.h index 6ffc6e7da..063635ed1 100644 --- a/xlive/Blam/Engine/simulation/machine_id.h +++ b/xlive/Blam/Engine/simulation/machine_id.h @@ -2,5 +2,5 @@ struct s_machine_identifier { - byte machine_identifier[6]; + uint8 machine_identifier[6]; }; diff --git a/xlive/Blam/Engine/simulation/simulation.cpp b/xlive/Blam/Engine/simulation/simulation.cpp index 1f507b06e..6b821e5cc 100644 --- a/xlive/Blam/Engine/simulation/simulation.cpp +++ b/xlive/Blam/Engine/simulation/simulation.cpp @@ -9,6 +9,7 @@ #include "game/game.h" #include "game/players.h" #include "objects/objects.h" +#include "units/units.h" #include "simulation/game_interface/simulation_game_action.h" s_simulation_globals* simulation_get_globals() diff --git a/xlive/Blam/Engine/simulation/simulation.h b/xlive/Blam/Engine/simulation/simulation.h index cc678b8ae..76212bb5a 100644 --- a/xlive/Blam/Engine/simulation/simulation.h +++ b/xlive/Blam/Engine/simulation/simulation.h @@ -5,6 +5,7 @@ #include "simulation_world.h" #include "game/player_control.h" +#include "units/unit_control.h" enum { diff --git a/xlive/Blam/Engine/simulation/simulation_actors.h b/xlive/Blam/Engine/simulation/simulation_actors.h index 4a1dffa7a..a3b44334a 100644 --- a/xlive/Blam/Engine/simulation/simulation_actors.h +++ b/xlive/Blam/Engine/simulation/simulation_actors.h @@ -1,5 +1,5 @@ #pragma once -#include "units/units.h" +#include "units/unit_control.h" struct c_simulation_actor { diff --git a/xlive/Blam/Engine/simulation/simulation_encoding.cpp b/xlive/Blam/Engine/simulation/simulation_encoding.cpp index 072e387a8..38001aca4 100644 --- a/xlive/Blam/Engine/simulation/simulation_encoding.cpp +++ b/xlive/Blam/Engine/simulation/simulation_encoding.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "simulation_encoding.h" +#include "simulation/simulation_players.h" + /* public code */ void __cdecl simulation_player_update_encode(c_bitstream* packet, const simulation_player_update* player_update) diff --git a/xlive/Blam/Engine/simulation/simulation_encoding.h b/xlive/Blam/Engine/simulation/simulation_encoding.h index cf2f8c14b..d3e1a5212 100644 --- a/xlive/Blam/Engine/simulation/simulation_encoding.h +++ b/xlive/Blam/Engine/simulation/simulation_encoding.h @@ -1,8 +1,5 @@ #pragma once #include "machine_id.h" -#include "simulation_players.h" - -#include "memory/bitstream.h" #include "networking/network_constants.h" /* structures */ @@ -15,6 +12,6 @@ struct simulation_machine_update /* prototypes */ -void __cdecl simulation_player_update_encode(c_bitstream* packet, const simulation_player_update* player_update); +void __cdecl simulation_player_update_encode(class c_bitstream* packet, const struct simulation_player_update* player_update); -bool __cdecl simulation_player_update_decode(c_bitstream* packet, simulation_player_update* player_update); +bool __cdecl simulation_player_update_decode(class c_bitstream* packet, struct simulation_player_update* player_update); diff --git a/xlive/Blam/Engine/simulation/simulation_queue_events.cpp b/xlive/Blam/Engine/simulation/simulation_queue_events.cpp index 87cd62ac1..65590d97b 100644 --- a/xlive/Blam/Engine/simulation/simulation_queue_events.cpp +++ b/xlive/Blam/Engine/simulation/simulation_queue_events.cpp @@ -6,7 +6,8 @@ #include "simulation/simulation_world.h" #include "simulation/simulation_gamestate_entities.h" -#include "H2MOD/GUI/ImGui_Integration/Console/ImGui_ConsoleImpl.h" +//#include "H2MOD/GUI/ImGui_Integration/Console/ImGui_ConsoleImpl.h" +#define SIM_EVENT_QUEUE_DBG(...) #include "memory/bitstream.h" diff --git a/xlive/Blam/Engine/simulation/simulation_world.cpp b/xlive/Blam/Engine/simulation/simulation_world.cpp index d3bdffed1..2bbe064b8 100644 --- a/xlive/Blam/Engine/simulation/simulation_world.cpp +++ b/xlive/Blam/Engine/simulation/simulation_world.cpp @@ -10,7 +10,8 @@ #include "networking/network_event.h" #include "saved_games/game_state_procs.h" -#include "H2MOD/GUI/imgui_integration/Console/ImGui_ConsoleImpl.h" +//#include "H2MOD/GUI/imgui_integration/Console/ImGui_ConsoleImpl.h" +#define SIM_EVENT_QUEUE_DBG(...) // TODO verify if these buffers get saturated quickly // if that's the case, increse the buffer size diff --git a/xlive/Blam/Engine/sound/sound_cache_file_definitions.h b/xlive/Blam/Engine/sound/sound_cache_file_definitions.h index a9a51d3f6..95eba3281 100644 --- a/xlive/Blam/Engine/sound/sound_cache_file_definitions.h +++ b/xlive/Blam/Engine/sound/sound_cache_file_definitions.h @@ -2,7 +2,6 @@ #include "geometry/geometry_block.h" #include "math/function_definitions.h" #include "tag_files/data_reference.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_block.h" #include "tag_files/tag_reference.h" diff --git a/xlive/Blam/Engine/structures/structure_audibility.h b/xlive/Blam/Engine/structures/structure_audibility.h index 11513c07b..a5c5d1a38 100644 --- a/xlive/Blam/Engine/structures/structure_audibility.h +++ b/xlive/Blam/Engine/structures/structure_audibility.h @@ -52,21 +52,21 @@ struct s_structure_audibility // max: k_maximum_machine_door_portal_associations*2*((((MAXIMUM_CLUSTERS_PER_STRUCTURE)+(LONG_BITS-1))>>LONG_BITS_BITS)) // 4096 - tag_block encoded_door_pas; + s_tag_block encoded_door_pas; // struct: int32 // max: MAXIMUM_CLUSTERS_PER_STRUCTURE*((((k_maximum_machine_door_portal_associations)+(LONG_BITS-1))>>LONG_BITS_BITS)) // 2048 - tag_block cluster_door_portal_encoded_pas; + s_tag_block cluster_door_portal_encoded_pas; // struct: int32 // max: (((((MAXIMUM_CLUSTERS_PER_STRUCTURE*(MAXIMUM_CLUSTERS_PER_STRUCTURE-1))/2)+(LONG_BITS-1))>>LONG_BITS_BITS)) // 4088 - tag_block ai_deafening_pas; + s_tag_block ai_deafening_pas; // struct: int32 // max: (MAXIMUM_CLUSTERS_PER_STRUCTURE*(MAXIMUM_CLUSTERS_PER_STRUCTURE-1))/2 // 130816 - tag_block cluster_distances; + s_tag_block cluster_distances; // struct: int8 // max: k_maximum_machine_door_portal_associations - tag_block machine_door_mapping; + s_tag_block machine_door_mapping; // struct: int8 }; ASSERT_STRUCT_SIZE(s_structure_audibility, 52); \ No newline at end of file diff --git a/xlive/Blam/Engine/structures/structure_bsp_definitions.h b/xlive/Blam/Engine/structures/structure_bsp_definitions.h index bb5d72895..c6a7dba05 100644 --- a/xlive/Blam/Engine/structures/structure_bsp_definitions.h +++ b/xlive/Blam/Engine/structures/structure_bsp_definitions.h @@ -1,20 +1,8 @@ #pragma once -#include "instanced_geometry_definitions.h" -#include "leaf_map.h" -#include "structure_audibility.h" -#include "structure_lightmap_definitions.h" -#include "structure_runtime_decals.h" - -#include "ai/path.h" -#include "cache/predicted_resources.h" -#include "decorators/decorator_definitions.h" -#include "game/game_portals.h" -#include "physics/collision_bsp_definition.h" +#include "geometry/geometry_block.h" +#include "geometry/geometry_definitions_new.h" +#include "objects/object_types.h" #include "physics/structure_physics.h" -#include "render/render_debug_structure.h" -#include "render/render_water.h" -#include "sound/sound_clusters.h" -#include "tag_files/tag_import_definitions.h" /* constants */ @@ -94,7 +82,7 @@ struct cluster_portal real32 bounding_radius; e_cluster_portal_flags flags; // max: MAXIMUM_VERTICES_PER_CLUSTER_PORTAL - tag_block vertices; + s_tag_block vertices; // struct: real_point3d }; ASSERT_STRUCT_SIZE(cluster_portal, 36); @@ -115,7 +103,7 @@ struct structure_weather_polyhedron real_point3d bounding_sphere_center; real32 bounding_sphere_radius; // max: MAXIMUM_PLANES_PER_WEATHER_POLYHEDRON - tag_block planes; + s_tag_block planes; // struct: real_plane3d }; ASSERT_STRUCT_SIZE(structure_weather_polyhedron, 24); @@ -124,12 +112,12 @@ struct structure_weather_palette_entry { char name[k_tag_string_length]; tag_reference weather_system; // weat - short pad[2]; - int pad1[8]; + int16 pad[2]; + int32 pad1[8]; tag_reference wind; // wind real_vector3d wind_direction; - float wind_magnitude; - int pad2; + real32 wind_magnitude; + int32 pad2; char wind_scale_function[k_tag_string_length]; }; ASSERT_STRUCT_SIZE(structure_weather_palette_entry, 136); @@ -168,10 +156,10 @@ ASSERT_STRUCT_SIZE(detail_object_cell_definition, 32); // used to access dobc tag files struct structure_detail_object_data { - tag_block cells; - tag_block instances; - tag_block counts; - tag_block reference_z_vectors; + s_tag_block cells; // struct: detail_object_cell_definition + s_tag_block instances; // struct: detail_object + s_tag_block counts; // struct: detail_object_count + s_tag_block reference_z_vectors; // struct: real_vector4d int32 pad_1; }; ASSERT_STRUCT_SIZE(structure_detail_object_data, 36); @@ -182,7 +170,7 @@ struct structure_cluster geometry_section_info geometry_section_info; geometry_block_info section_block_info; // max: 1 - tag_block cluster_data; + s_tag_block cluster_data; // struct: geometry_section // Explaination("CLUSTER INFO", "EMPTY STRING") real_rectangle3d bounds; @@ -205,15 +193,15 @@ struct structure_cluster e_structure_cluster_flags flags; int16 pad_2; - tag_block predicted_resources; + s_tag_block predicted_resources; //struct: predicted_resource // max: MAXIMUM_CLUSTER_PORTALS_PER_CLUSTER - tag_block portal_indices; + s_tag_block portal_indices; // struct: uint16 int32 checksum_from_structure; // max: k_maximum_instance_geometry_instances_per_cluster - tag_block instanced_geometry_indices; + s_tag_block instanced_geometry_indices; // struct: uint16 // max: MAXIMUM_STRIP_INDICES_PER_GEOMETRY_SECTION - tag_block strip_indices; + s_tag_block strip_indices; // struct: uint16 /**************************************** * definition_name: cluster_mopp_code_data * flags: 0 @@ -287,46 +275,46 @@ ASSERT_STRUCT_SIZE(s_transparent_plane, 20); struct structure_bsp { - tag_block import_info; + s_tag_block import_info; // struct: tag_import_info int32 pad_1; - tag_block collision_materials; - tag_block collision; + s_tag_block collision_materials; // struct: structure_collision_material + s_tag_block collision; // struct: collision_bsp // bounds of the valid height in Z where vehicles can operate or get pushed by an unstoppable force. real_bounds vehicle_z_limits; - tag_block unused_nodes; - tag_block leaves; + s_tag_block unused_nodes; // struct: unused_structure_node + s_tag_block leaves; // struct: structure_leaf real_rectangle3d world_bounds; - tag_block surface_references; + s_tag_block surface_references; // struct: structure_surface_reference data_reference cluster_data; - tag_block cluster_portals; + s_tag_block cluster_portals; // struct: cluster_portal - tag_block fog_planes; + s_tag_block fog_planes; // struct: s_structure_fog_plane int8 pad_2[24]; - tag_block weather_palette; - tag_block weather_polyhedra; - tag_block detail_objects; - tag_block clusters; - tag_block materials; + s_tag_block weather_palette; // struct: structure_weather_palette_entry + s_tag_block weather_polyhedra; // struct: structure_weather_polyhedron + s_tag_block detail_objects; // struct: structure_detail_object_data + s_tag_block clusters; // struct: structure_cluster + s_tag_block materials; // struct: geometry_material // Max: MAXIMUM_SKIES_PER_SCENARIO - tag_block sky_owner_cluster; + s_tag_block sky_owner_cluster; // struct:uint16 - tag_block conveyor_surfaces; - tag_block breakable_surfaces; - tag_block pathfinding_data; + s_tag_block conveyor_surfaces; // struct: structure_conveyor_surface + s_tag_block breakable_surfaces; // struct: structure_breakable_surface + s_tag_block pathfinding_data; // struct: pathfinding_data // max: MAXIMUM_EDGES_PER_COLLISION_BSP - tag_block pathfinding_edges; + s_tag_block pathfinding_edges; // struct: uint8 - tag_block background_sound_palette; - tag_block sound_environment_palette; + s_tag_block background_sound_palette; // struct: structure_background_sound_palette_entry + s_tag_block sound_environment_palette; // struct: structure_sound_environment_palette_entry /**************************************** * definition_name: structure_bsp_cluster_encoded_sound_data @@ -336,24 +324,24 @@ struct structure_bsp // DataSize(131072) data_reference sound_pas_data; - tag_block markers; - tag_block runtime_decals; - tag_block environment_object_palette; - tag_block environment_objects; - tag_block lightmap_data; + s_tag_block markers; // struct: structure_marker + s_tag_block runtime_decals; // struct: structure_runtime_decal + s_tag_block environment_object_palette; // struct: structure_environment_object_palette_entry + s_tag_block environment_objects; // struct: structure_environment_object + s_tag_block lightmap_data; // struct: structure_lightmap_data uint32 pad_3; - tag_block map_leaves; - tag_block leaf_connections; - tag_block errors; - tag_block precomputed_lighting; - tag_block instanced_geometry_definitions; - tag_block< structure_instanced_geometry_instance> instanced_geometry_instances; + s_tag_block map_leaves; // struct: map_leaf + s_tag_block leaf_connections; // struct: leaf_connection + s_tag_block errors; // struct: error_report_category + s_tag_block precomputed_lighting; // struct: structure_precomputed_lighting + s_tag_block instanced_geometry_definitions; // struct: structure_instanced_geometry_definition + s_tag_block instanced_geometry_instances; // struct: structure_instanced_geometry_instance - tag_block ambience_sound_clusters; - tag_block reverb_sound_clusters; - tag_block transparent_planes; + s_tag_block ambience_sound_clusters; // struct: s_structure_sound_cluster + s_tag_block reverb_sound_clusters; // struct: s_structure_sound_cluster + s_tag_block transparent_planes; // struct: s_transparent_plane int8 pad_4[96]; /// Distances this far and longer from limit origin will pull you back in. @@ -361,20 +349,20 @@ struct structure_bsp /// Center of space in which vehicle can move. real_point3d vehicle_spherical_limit_center; - tag_block debug_info; + s_tag_block debug_info; // struct: s_structure_debug_info - // TagReference("DECP") - tag_reference decorators; + tag_reference decorators; // DECP s_structure_physics structure_physics; - tag_block water_definitions; - tag_block portal_device_map; - tag_block audibility; - tag_block fake_lightprobes; - tag_block decorator_placement; + s_tag_block water_definitions; // struct: s_water_definition + s_tag_block portal_device_map; // struct: s_structure_portal_device_map + s_tag_block audibility; // struct: s_structure_audibility + s_tag_block fake_lightprobes; // struct: s_object_fake_lightprobe + s_tag_block decorator_placement; // struct: c_decorator_placement_definition }; ASSERT_STRUCT_SIZE(structure_bsp, 572); int16 get_global_structure_bsp_index(void); -structure_bsp* get_global_structure_bsp(void); \ No newline at end of file + +structure_bsp* get_global_structure_bsp(void); diff --git a/xlive/Blam/Engine/structures/structure_lightmap_definitions.h b/xlive/Blam/Engine/structures/structure_lightmap_definitions.h index 26764dcf5..4441f7e78 100644 --- a/xlive/Blam/Engine/structures/structure_lightmap_definitions.h +++ b/xlive/Blam/Engine/structures/structure_lightmap_definitions.h @@ -1,11 +1,15 @@ #pragma once #include "objects/object_identifier.h" #include "render/render_lights.h" +#include "tag_files/data_reference.h" #include "tag_files/tag_reference.h" -#define MAXIMUM_LIGHTS_PER_MAP 350 -#define MAXIMUM_LIGHTMAP_GROUPS_PER_STRUCTURE 128 -#define k_maximum_fake_lightprobes_per_structure_bsp 128 +enum +{ + MAXIMUM_LIGHTS_PER_MAP = 350, + MAXIMUM_LIGHTMAP_GROUPS_PER_STRUCTURE = 128, + k_maximum_fake_lightprobes_per_structure_bsp = 128, +}; enum e_structure_precomputed_lighting_type : uint16 { diff --git a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection.h b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection.h index d04d2d06e..e60d4dcff 100644 --- a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection.h +++ b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection.h @@ -1,6 +1,5 @@ #pragma once #include "tag_injection_manager.h" -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.cpp b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.cpp index f614e3747..c1a62ab79 100644 --- a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.cpp +++ b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.cpp @@ -13,9 +13,11 @@ #include "networking/network_event.h" #include "physics/collision_model_definitions.h" #include "physics/physics_model_definitions.h" +#include "render/render_weather.h" #include "render/weather_definitions.h" #include "scenario/scenario_definitions.h" #include "shell/shell.h" +#include "tag_files/files.h" #include "tag_files/tag_loader/xml/xml_definition_loader.h" #include "units/biped_definitions.h" #include "units/vehicle_definitions.h" @@ -84,30 +86,41 @@ bool c_tag_injecting_manager::find_map(const wchar_t* map_name, c_static_wchar_s { bool result = false; - c_static_wchar_string test_path; - test_path.set(m_base_map_directory.get_string()); - test_path.append(map_name); - test_path.append(L".map"); + + c_static_wchar_string test_path_wide; + test_path_wide.set(m_base_map_directory.get_string()); + test_path_wide.append(map_name); + test_path_wide.append(L".map"); - if (PathFileExists(test_path.get_string())) + char test_path[MAX_PATH]; + wchar_string_to_utf8_string(test_path_wide.get_string(), test_path, MAX_PATH); + + s_file_reference reference; + file_reference_create_from_path(&reference, test_path, false); + if (file_exists(&reference)) { if (out_string) { - out_string->set(test_path.get_string()); + out_string->set(test_path_wide.get_string()); } result = true; } else { // Test if map exists in mods folder - test_path.set(m_mods_map_directory.get_string()); - test_path.append(map_name); - test_path.append(L".map"); - if (PathFileExists(test_path.get_string())) + test_path_wide.set(m_mods_map_directory.get_string()); + test_path_wide.append(map_name); + test_path_wide.append(L".map"); + + // Setup file reference with new path + wchar_string_to_utf8_string(test_path_wide.get_string(), test_path, MAX_PATH); + file_reference_create_from_path(&reference, test_path, false); + + if (file_exists(&reference)) { if (out_string) { - out_string->set(test_path.get_string()); + out_string->set(test_path_wide.get_string()); } result = true; } @@ -293,7 +306,9 @@ void c_tag_injecting_manager::load_raw_data_from_cache(datum injected_index) con auto weather_tag = reinterpret_cast(tag_data); for (auto i = 0; i < weather_tag->m_particle_system.count; i++) { - pc_geometry_cache_preload_geometry(&weather_tag->m_particle_system[i]->m_geometry, (e_pc_geometry_cache_preload_flags)(_pc_geometry_cache_preload_flag_2 | _pc_geometry_cache_preload_blocking)); + c_particle_system_lite* system_block = TAG_BLOCK_GET_ELEMENT(&weather_tag->m_particle_system, i, c_particle_system_lite); + + pc_geometry_cache_preload_geometry(&system_block->m_geometry, (e_pc_geometry_cache_preload_flags)(_pc_geometry_cache_preload_flag_2 | _pc_geometry_cache_preload_blocking)); } break; } @@ -488,20 +503,25 @@ bool c_tag_injecting_manager::initialize_agent(tag_group group) wchar_t wide_tag_class[5]; utf8_string_to_wchar_string(tag_class, wide_tag_class, NUMBEROF(wide_tag_class)); - c_static_wchar_string plugin_path; - plugin_path.set(m_plugins_directory.get_string()); - plugin_path.append(wide_tag_class); - plugin_path.append(L".xml"); + c_static_wchar_string plugin_path_wide; + plugin_path_wide.set(m_plugins_directory.get_string()); + plugin_path_wide.append(wide_tag_class); + plugin_path_wide.append(L".xml"); // Exit and create a popup if a plugin is missing - if (!PathFileExists(plugin_path.get_string())) + char plugin_path[MAX_PATH]; + wchar_string_to_utf8_string(plugin_path_wide.get_string(), plugin_path, MAX_PATH); + + s_file_reference plugin_fileref; + file_reference_create_from_path(&plugin_fileref, plugin_path, false); + if (!file_exists(&plugin_fileref)) { - event(_event_error, "tags:injection: [%s] Plugin file could not be located %ws", __FUNCTION__, plugin_path.get_string()); + event(_event_error, "tags:injection: [%s] Plugin file could not be located %ws", __FUNCTION__, plugin_path_wide.get_string()); g_force_cartographer_update = true; } else { - m_agents[tag_group_index].init(group, plugin_path.get_string()); + m_agents[tag_group_index].init(group, plugin_path_wide.get_string()); m_agents_initialized.set(tag_group_index, true); result = true; } diff --git a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.h b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.h index 62de416c4..6aee08a0c 100644 --- a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.h +++ b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_manager.h @@ -2,7 +2,6 @@ #include "tag_injection_table.h" #include "cache/cache_files.h" -#include "tag_files/tag_groups.h" #include "xml/xml_agent.h" /* constants */ diff --git a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_table.h b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_table.h index 934b98ded..7da9335a1 100644 --- a/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_table.h +++ b/xlive/Blam/Engine/tag_files/tag_loader/tag_injection_table.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* constants */ diff --git a/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.cpp b/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.cpp index 5409f91ca..a28988605 100644 --- a/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.cpp +++ b/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.cpp @@ -4,7 +4,6 @@ #include "xml_definition_block.h" #include "networking/network_event.h" -#include "tag_files/tag_groups.h" #include diff --git a/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.h b/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.h index e5c3f0147..c94aaaa81 100644 --- a/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.h +++ b/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_agent.h @@ -1,7 +1,6 @@ #pragma once #include "xml_definition_block.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_loader/tag_injection_define.h" /* classes */ diff --git a/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_definition_loader.cpp b/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_definition_loader.cpp index 2ea735d64..2128274c5 100644 --- a/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_definition_loader.cpp +++ b/xlive/Blam/Engine/tag_files/tag_loader/xml/xml_definition_loader.cpp @@ -8,7 +8,6 @@ #include "networking/network_event.h" #include "tag_files/data_reference.h" #include "tag_files/tag_block.h" -#include "tag_files/tag_groups.h" #include "tag_files/tag_reference.h" #include "tag_files/tag_loader/tag_injection.h" #include "tag_files/tag_loader/tag_injection_define.h" diff --git a/xlive/Blam/Engine/tag_files/tag_reference.h b/xlive/Blam/Engine/tag_files/tag_reference.h index 568fcb621..d3c789c0b 100644 --- a/xlive/Blam/Engine/tag_files/tag_reference.h +++ b/xlive/Blam/Engine/tag_files/tag_reference.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" struct tag_reference { diff --git a/xlive/Blam/Engine/text/text_group.h b/xlive/Blam/Engine/text/text_group.h index 9aea6556c..5c709f6de 100644 --- a/xlive/Blam/Engine/text/text_group.h +++ b/xlive/Blam/Engine/text/text_group.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" #define k_max_strings_per_language 0x8000 diff --git a/xlive/Blam/Engine/text/unicode.cpp b/xlive/Blam/Engine/text/unicode.cpp index 9689dfb80..a9f6afad6 100644 --- a/xlive/Blam/Engine/text/unicode.cpp +++ b/xlive/Blam/Engine/text/unicode.cpp @@ -78,7 +78,7 @@ wchar_t* ustrncpy(wchar_t* dest, const wchar_t* src, size_t count) ASSERT(dest != NULL); ASSERT(src != NULL); ASSERT(count > 0); - wcsncpy_s(dest, count, src, UINT_MAX); + wcsncpy_s(dest, count, src, _TRUNCATE); return dest; } diff --git a/xlive/Blam/Engine/text/unicode.h b/xlive/Blam/Engine/text/unicode.h index af07cc5f9..a8caba3d1 100644 --- a/xlive/Blam/Engine/text/unicode.h +++ b/xlive/Blam/Engine/text/unicode.h @@ -317,43 +317,43 @@ wchar_t utoupper(wchar_t c); wchar_t utolower(wchar_t c); -wchar_t ufgetc(_iobuf* stream); +wchar_t ufgetc(struct _iobuf* stream); -wchar_t ufputc(wchar_t c, _iobuf* stream); +wchar_t ufputc(wchar_t c, struct _iobuf* stream); -wchar_t uungetc(wchar_t c, _iobuf* stream); +wchar_t uungetc(wchar_t c, struct _iobuf* stream); -wchar_t* ufgets(wchar_t* string, int32 size, _iobuf* stream); +wchar_t* ufgets(wchar_t* string, int32 size, struct _iobuf* stream); -int32 ufputs(const wchar_t* string, _iobuf* stream); +int32 ufputs(const wchar_t* string, struct _iobuf* stream); wchar_t* ugets(wchar_t* string, size_t count); int32 uputs(const wchar_t* string); -int32 ufprintf(_iobuf* stream, const wchar_t* format, ...); +int32 ufprintf(struct _iobuf* stream, const wchar_t* format, ...); int32 uprintf(const wchar_t* format, ...); int32 usnprintf(wchar_t* string, size_t size, const wchar_t* format, ...); -int32 uvfprintf(_iobuf* stream, const wchar_t* format, char* ap); +int32 uvfprintf(struct _iobuf* stream, const wchar_t* format, char* ap); int32 uvprintf(const wchar_t* format, char* ap); int32 uvsnprintf(wchar_t* string, size_t size, const wchar_t* format, char* ap); -_iobuf* ufdopen(int32 fd, const wchar_t* path); +struct _iobuf* ufdopen(int32 fd, const wchar_t* path); -_iobuf* ufopen(const wchar_t* path, const wchar_t* mode); +struct _iobuf* ufopen(const wchar_t* path, const wchar_t* mode); -int32 ufclose(_iobuf* stream); +int32 ufclose(struct _iobuf* stream); -_iobuf* ufreopen(const wchar_t* path, const wchar_t* mode, _iobuf* stream); +struct _iobuf* ufreopen(const wchar_t* path, const wchar_t* mode, struct _iobuf* stream); void uperror(const wchar_t* string); -_iobuf* upopen(const wchar_t* command, const wchar_t* mode); +struct _iobuf* upopen(const wchar_t* command, const wchar_t* mode); int32 uremove(const wchar_t* path); diff --git a/xlive/Blam/Engine/units/unit_action_system.h b/xlive/Blam/Engine/units/unit_action_system.h index 8767841ac..b028cb894 100644 --- a/xlive/Blam/Engine/units/unit_action_system.h +++ b/xlive/Blam/Engine/units/unit_action_system.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* enums */ diff --git a/xlive/Blam/Engine/units/unit_control.h b/xlive/Blam/Engine/units/unit_control.h new file mode 100644 index 000000000..41a1cdc1a --- /dev/null +++ b/xlive/Blam/Engine/units/unit_control.h @@ -0,0 +1,28 @@ +#pragma once +#include "game/aim_assist.h" + +/* structures */ + +struct unit_control_data +{ + string_id animation_state; + uint16 aiming_speed; + uint16 weapon_set_identifier; + uint8 field_8; + uint8 field_9; + uint16 grenade_index; + uint16 zoom_level; + int8 gap_E[2]; + int64 control_flags; + real_vector3d throttle; + real32 primary_trigger; + real32 secondary_trigger; + real_vector3d facing_vector; + real_vector3d aiming_vector; + real_vector3d looking_vector; + int32 field_50; + int32 field_54; + int32 field_58; + s_aim_assist_targeting_result target_info; +}; +ASSERT_STRUCT_SIZE(unit_control_data, 0x80); diff --git a/xlive/Blam/Engine/units/units.cpp b/xlive/Blam/Engine/units/units.cpp index dc7e1bbeb..f14bfa871 100644 --- a/xlive/Blam/Engine/units/units.cpp +++ b/xlive/Blam/Engine/units/units.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "units.h" +#include "unit_control.h" #include "unit_definitions.h" #include "cache/cache_files.h" diff --git a/xlive/Blam/Engine/units/units.h b/xlive/Blam/Engine/units/units.h index 3a98ea1ee..304594fe5 100644 --- a/xlive/Blam/Engine/units/units.h +++ b/xlive/Blam/Engine/units/units.h @@ -83,30 +83,6 @@ struct s_unit_304 int8 gap_0[16]; }; -struct unit_control_data -{ - string_id animation_state; - uint16 aiming_speed; - uint16 weapon_set_identifier; - uint8 field_8; - uint8 field_9; - uint16 grenade_index; - uint16 zoom_level; - int8 gap_E[2]; - int64 control_flags; - real_vector3d throttle; - real32 primary_trigger; - real32 secondary_trigger; - real_vector3d facing_vector; - real_vector3d aiming_vector; - real_vector3d looking_vector; - int32 field_50; - int32 field_54; - int32 field_58; - s_aim_assist_targeting_result target_info; -}; -ASSERT_STRUCT_SIZE(unit_control_data, 0x80); - struct _unit_datum { int8 gap_12C[4]; @@ -242,7 +218,7 @@ void __cdecl unit_get_head_position_interpolated(datum unit_index, real_point3d* void __cdecl unit_get_camera_position(datum unit_index, real_point3d* out_point); -void __cdecl unit_control(datum unit_index, const unit_control_data* control_data); +void __cdecl unit_control(datum unit_index, const struct unit_control_data* control_data); e_game_team unit_get_team_index(datum unit_index); diff --git a/xlive/CartographerDllConf.h b/xlive/CartographerDllConf.h index bd44ec5a1..4e08a9042 100644 --- a/xlive/CartographerDllConf.h +++ b/xlive/CartographerDllConf.h @@ -1,2 +1,13 @@ #pragma once + +/* macros */ + +#define CARTOGRAPHER_HEAP_DEBUG 0 + +#if CARTOGRAPHER_HEAP_DEBUG +#define _CRTDBG_MAP_ALLOC +#endif + +/* includes */ + #include "version.h" diff --git a/xlive/H2MOD.cpp b/xlive/H2MOD.cpp index 41cd62f36..3b2774d33 100644 --- a/xlive/H2MOD.cpp +++ b/xlive/H2MOD.cpp @@ -66,7 +66,6 @@ #include "rasterizer/dx9/rasterizer_dx9_fog.h" #include "rasterizer/dx9/rasterizer_dx9_fullscreen_passes.h" #include "rasterizer/dx9/rasterizer_dx9_lens_flares.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" #include "rasterizer/dx9/rasterizer_dx9_shader_submit_new.h" #include "rasterizer/dx9/rasterizer_dx9_screen_effect.h" #include "rasterizer/dx9/rasterizer_dx9_water.h" @@ -112,6 +111,8 @@ #include "H2MOD/Variants/VariantSystem.h" #include "H2MOD/Variants/H2X/H2X.h" +#include + /* typedefs */ typedef void(__cdecl* user_interface_controller_set_desired_team_index_t)(e_controller_index controller_index, e_game_team team); @@ -272,7 +273,12 @@ void H2MOD::custom_sound_play(const wchar_t* soundName, int delay) //std::unique_lock lck(H2MOD::sound_mutex); std::chrono::high_resolution_clock::time_point timePoint = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds(delay); - LOG_TRACE_GAME(L"[H2MOD-SoundQueue] - attempting to play sound {0} - delaying {1} miliseconds first", soundName, delay); + event( + _event_verbose, + "[H2MOD-SoundQueue] - attempting to play sound %ws - delaying %d miliseconds first", + soundName, + delay + ); if (delay > 0) std::this_thread::sleep_until(timePoint); @@ -367,7 +373,7 @@ static void toggle_xbox_tickrate(s_game_options* options, bool toggle) { options->game_tick_rate = toggle ? 30 : 60; WriteValue(Memory::GetAddress(0x264ABB, 0x1DB8B) + 1, (int32)options->game_tick_rate); - LOG_TRACE_GAME("[h2mod] set game options tickrate to {}", options->game_tick_rate); + event(_event_verbose, "[h2mod] set game options tickrate to %hd", options->game_tick_rate); return; } @@ -455,7 +461,7 @@ static bool __cdecl OnMapLoad(s_game_options* options) } else { - event(_event_status, "h2mod: engine type: {}", (int)options->game_mode); + event(_event_status, "h2mod: engine type: %d", (int32)options->game_mode); if (!shell_is_dedicated_server()) { @@ -718,7 +724,6 @@ static void h2mod_apply_hooks(void) rasterizer_dx9_fog_apply_patches(); rasterizer_dx9_fullscreen_passes_apply_patches(); rasterizer_dx9_lens_flares_apply_patches(); - rasterizer_dx9_main_apply_patches(); rasterizer_dx9_screen_effect_apply_patches(); rasterizer_dx9_shader_submit_new_apply_patches(); rasterizer_dx9_targets_apply_patches(); @@ -802,7 +807,7 @@ static int __cdecl showErrorScreen(int a1, int widget_type, int a3, __int16 a4, { if (widget_type == 0x117) { - LOG_TRACE_FUNC("Ignoring need to reinstall maps"); + //LOG_TRACE_FUNC("Ignoring need to reinstall maps"); return 0; } return p_show_error_screen(a1, widget_type, a3, a4, a5, a6); diff --git a/xlive/H2MOD/GUI/XLiveRendering.h b/xlive/H2MOD/GUI/XLiveRendering.h deleted file mode 100644 index abca934b9..000000000 --- a/xlive/H2MOD/GUI/XLiveRendering.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -typedef struct _XLIVE_INITIALIZE_INFO { - UINT cbSize; - DWORD dwFlags; - IDirect3DDevice9Ex* pD3D; - VOID* pD3DPP; - LANGID langID; - WORD wReserved1; - PCHAR pszAdapterName; - WORD wLivePortOverride; - WORD wReserved2; -} XLIVE_INITIALIZE_INFO; - -typedef struct XLIVE_INPUT_INFO { - UINT cbSize; - HWND hWnd; - UINT uMSG; - WPARAM wParam; - LPARAM lParam; - BOOL fHandled; - LRESULT lRet; -} XLIVE_INPUT_INFO; - -namespace XLiveRendering -{ - void InitializeD3D9(D3DPRESENT_PARAMETERS* presentParameters); - void D3D9ReleaseResources(); -}; - -HRESULT WINAPI XLiveInitialize(XLIVE_INITIALIZE_INFO* pXii); - -int WINAPI XLiveOnResetDevice(D3DPRESENT_PARAMETERS* pD3DPP); diff --git a/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp b/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp index 222f28f97..ebe530ce4 100644 --- a/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp +++ b/xlive/H2MOD/GUI/imgui_integration/AdvancedSettings.cpp @@ -18,6 +18,7 @@ #include "networking/logic/life_cycle_manager.h" #include "networking/session/network_session.h" #include "rasterizer/rasterizer_globals.h" +#include "saved_games/cartographer_player_profile/cartographer_player_profile.h" #include "H2MOD.h" #include "H2MOD/Modules/CustomMenu/CustomLanguage.h" diff --git a/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.cpp b/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.cpp index 276bbe7de..e01dbb15c 100644 --- a/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.cpp +++ b/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.cpp @@ -3,6 +3,7 @@ #ifdef TERMINAL_ENABLED +#include "ComVar.h" #include "CommandCollection.h" const char command_error_invalid_parameter_count[] = "# %s command error: invalid parameter count"; @@ -103,4 +104,12 @@ bool ConsoleCommand::HandleCommandLine(const char* commandLine, size_t commandLi return result; } +void ConsoleCommand::VarAsStr(char* outVar, size_t outSize) const +{ + if (SetsVariable()) + { + csstrncpy(outVar, m_var_ptr->AsString().c_str(), outSize - 1); + } +} + #endif diff --git a/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.h b/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.h index 9449b3edd..579d89e8e 100644 --- a/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.h +++ b/xlive/H2MOD/GUI/imgui_integration/Console/CommandHandler.h @@ -3,7 +3,6 @@ #ifdef TERMINAL_ENABLED #include "CommandsUtil.h" -#include "ComVar.h" struct ConsoleCommandCtxData; typedef int CommandFlags; @@ -32,7 +31,7 @@ class ConsoleCommand final ConsoleCommand(const char* _name, const char* _command_description, int _min_parameter_count, int _max_parameter_count, ExecuteCommandCallbackT* _callback, CommandFlags _flags = CommandFlag_None); - ConsoleCommand(ComVarBase* _command_var, const char* _name, const char* _command_description, int _min_parameter_count, int _max_parameter_count, ExecuteCommandCallbackT* _input_callback, CommandFlags _flags = CommandFlag_None); + ConsoleCommand(class ComVarBase* _command_var, const char* _name, const char* _command_description, int _min_parameter_count, int _max_parameter_count, ExecuteCommandCallbackT* _input_callback, CommandFlags _flags = CommandFlag_None); ~ConsoleCommand() = default; @@ -92,13 +91,7 @@ class ConsoleCommand final // returns true if command line has been handled static bool HandleCommandLine(const char* command_line, size_t command_line_length, TextOutputCb* consoleOutputCb); - void VarAsStr(char* outVar, size_t outSize) const - { - if (SetsVariable()) - { - csstrncpy(outVar, m_var_ptr->AsString().c_str(), outSize - 1); - } - } + void VarAsStr(char* outVar, size_t outSize) const; protected: diff --git a/xlive/H2MOD/GUI/imgui_integration/Console/CommandsUtil.h b/xlive/H2MOD/GUI/imgui_integration/Console/CommandsUtil.h index 410d2e078..e51bb6bc9 100644 --- a/xlive/H2MOD/GUI/imgui_integration/Console/CommandsUtil.h +++ b/xlive/H2MOD/GUI/imgui_integration/Console/CommandsUtil.h @@ -143,7 +143,7 @@ class CircularStringBuffer m_line_buf_size = newLineBufSize; size_t newBufferSize = GetBufferSize(); - ASSERT(newBufferSize > GetBufferSize()); + assert(newBufferSize > GetBufferSize()); char* new_buffer = (char*)malloc(newBufferSize); if (m_buf != NULL) @@ -168,7 +168,7 @@ class CircularStringBuffer size_t nullCharIdx = characterCount; - ASSERT(characterCount < m_line_buf_size - 1 || source[nullCharIdx] == '\0'); + assert(characterCount < m_line_buf_size - 1 || source[nullCharIdx] == '\0'); char* destinationBuffer; size_t destinationBufferSize = GetNewlineBuffer(m_line_buf_size, &destinationBuffer); @@ -223,7 +223,7 @@ class CircularStringBuffer const char* GetStringAtIndex(size_t headerIdx) const { - ASSERT(headerIdx < GetHeaderCount()); + assert(headerIdx < GetHeaderCount()); const StringLineHeader& string_header = GetHeader(headerIdx); return GetStringAtIdx(string_header.idx); } diff --git a/xlive/H2MOD/GUI/imgui_integration/Console/ImGui_ConsoleImpl.h b/xlive/H2MOD/GUI/imgui_integration/Console/ImGui_ConsoleImpl.h index a2a0e6b68..63e0ab9f2 100644 --- a/xlive/H2MOD/GUI/imgui_integration/Console/ImGui_ConsoleImpl.h +++ b/xlive/H2MOD/GUI/imgui_integration/Console/ImGui_ConsoleImpl.h @@ -3,6 +3,7 @@ #ifdef TERMINAL_ENABLED #include "CommandHandler.h" +#include "ComVar.h" class CartographerConsole; typedef CartographerConsole CartConsole; diff --git a/xlive/H2MOD/GUI/imgui_integration/WeaponOffsets.cpp b/xlive/H2MOD/GUI/imgui_integration/WeaponOffsets.cpp index ba45beb92..9eab43d45 100644 --- a/xlive/H2MOD/GUI/imgui_integration/WeaponOffsets.cpp +++ b/xlive/H2MOD/GUI/imgui_integration/WeaponOffsets.cpp @@ -12,6 +12,8 @@ /* globals */ +extern s_saved_game_cartographer_player_profile* g_advanced_settings_current_cartographer_profile; + static c_static_string<256> g_weapon_offsets_temp_string; /* prototypes */ diff --git a/xlive/H2MOD/GUI/imgui_integration/imgui_handler.cpp b/xlive/H2MOD/GUI/imgui_integration/imgui_handler.cpp index 9622c7850..07960111f 100644 --- a/xlive/H2MOD/GUI/imgui_integration/imgui_handler.cpp +++ b/xlive/H2MOD/GUI/imgui_integration/imgui_handler.cpp @@ -5,7 +5,6 @@ #include "game/player_control.h" #include "interface/user_interface_guide.h" -#include "rasterizer/dx9/rasterizer_dx9_main.h" #include "imgui.h" #include "backends/imgui_impl_dx9.h" @@ -17,6 +16,8 @@ #include "imgui_ProdigyCleanTTF.h" +#include +#include const char* k_advanced_settings_window_name = "advanced_settings"; const char* k_weapon_offsets_window_name = "Weapon Offsets"; @@ -188,7 +189,7 @@ namespace ImGuiHandler fontConfig.SizePixels, &fontConfig); - ImGui_ImplDX9_Init(rasterizer_dx9_device_get_interface()); + ImGui_ImplDX9_Init(g_xlive_d3d_device); atexit([]() { ImGui_ImplDX9_Shutdown(); @@ -196,6 +197,7 @@ namespace ImGuiHandler ImGui::DestroyContext(); }); } + float WidthPercentage(float percent) { auto Width = ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x; @@ -217,7 +219,7 @@ namespace ImGuiHandler D3DXIMAGE_INFO imgInfo; PDIRECT3DTEXTURE9 texture = nullptr; //HRESULT hr = D3DXCreateTextureFromFileA(g_pDevice, filename, &texture); - const HRESULT hr = D3DXCreateTextureFromFileEx(rasterizer_dx9_device_get_interface(), filename, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_FROM_FILE, 0, + const HRESULT hr = D3DXCreateTextureFromFileEx(g_xlive_d3d_device, filename, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_FROM_FILE, 0, D3DFMT_FROM_FILE, D3DPOOL_DEFAULT, D3DX_FILTER_NONE, D3DX_FILTER_NONE, 0, &imgInfo, NULL, &texture); if (hr != S_OK) @@ -246,7 +248,7 @@ namespace ImGuiHandler } - PDIRECT3DTEXTURE9 GetTexture(s_imgui_images image) + void* GetTexture(s_imgui_images image) { switch (image) { case patch_notes: diff --git a/xlive/H2MOD/GUI/imgui_integration/imgui_handler.h b/xlive/H2MOD/GUI/imgui_integration/imgui_handler.h index fbd78923f..6b633d435 100644 --- a/xlive/H2MOD/GUI/imgui_integration/imgui_handler.h +++ b/xlive/H2MOD/GUI/imgui_integration/imgui_handler.h @@ -3,7 +3,6 @@ #ifndef IMGUI_DISABLE #include "input/controllers.h" -#include "saved_games/cartographer_player_profile/cartographer_player_profile.h" /* constants */ @@ -36,7 +35,6 @@ enum e_imgui_window_type /* globals */ -extern s_saved_game_cartographer_player_profile* g_advanced_settings_current_cartographer_profile; extern e_controller_index g_advanced_settings_current_controller_index; namespace ImGuiHandler @@ -67,9 +65,9 @@ namespace ImGuiHandler float WidthPercentage(float percent); void TextVerticalPad(const char* label); bool LoadTextureFromFile(const wchar_t* filename, s_imgui_images image, int* out_width, int* out_height); - PDIRECT3DTEXTURE9 GetTexture(s_imgui_images image); + void* GetTexture(s_imgui_images image); void release_motd_texture(); - e_imgui_aspect_ratio GetAspectRatio(const real_point2d* display_size); + e_imgui_aspect_ratio GetAspectRatio(const union real_point2d* display_size); namespace ImMOTD { void Render(bool* p_open); void Open(); diff --git a/xlive/H2MOD/Modules/Accounts/AccountLogin.cpp b/xlive/H2MOD/Modules/Accounts/AccountLogin.cpp index de83f7f91..7286df281 100644 --- a/xlive/H2MOD/Modules/Accounts/AccountLogin.cpp +++ b/xlive/H2MOD/Modules/Accounts/AccountLogin.cpp @@ -440,30 +440,9 @@ bool HandleGuiLogin(char* ltoken, char* identifier, char* password, int* out_mas return result; } -#pragma region Online Server Sign-in -// 5257: ?? -HRESULT WINAPI XLiveManageCredentials(LPCWSTR lpszLiveIdName, LPCWSTR lpszLiveIdPassword, DWORD dwCredFlags, PXOVERLAPPED pXOverlapped) +void AccountDediLogin(PXOVERLAPPED pOverlapped) { - LOG_TRACE_XLIVE(L"XLiveManageCredentials (lpszLiveIdName = {}, lpszLiveIdPassword = {}, dwCredFlags = {:#x}, pXOverlapped = {:p})", - lpszLiveIdName, lpszLiveIdPassword, dwCredFlags, (void*)pXOverlapped); - - if (pXOverlapped) - { - pXOverlapped->InternalLow = ERROR_SUCCESS; - pXOverlapped->InternalHigh = 0; - pXOverlapped->dwExtendedError = 0; - } - - // not done - error now - return S_OK; -} - -// #5259: XLiveSignin -HRESULT WINAPI XLiveSignin(PWSTR pszLiveIdName, PWSTR pszLiveIdPassword, DWORD dwFlags, PXOVERLAPPED pOverlapped) -{ - LOG_TRACE_XLIVE("XLiveSignin() - signin in"); - addDebugText("Logging the Dedi Server in..."); // clear LAN login info if we are logged in locally @@ -484,34 +463,15 @@ HRESULT WINAPI XLiveSignin(PWSTR pszLiveIdName, PWSTR pszLiveIdPassword, DWORD d XUserSignInSetStatusChanged(0); } } - + if (pOverlapped) { pOverlapped->InternalLow = ERROR_SUCCESS; pOverlapped->InternalHigh = 0; pOverlapped->dwExtendedError = S_OK; } - - return S_OK; -} - -// #5258: XLiveSignout -HRESULT WINAPI XLiveSignout(PXOVERLAPPED pXOverlapped) -{ - LOG_TRACE_XLIVE("XLiveSignout"); - - XUserSignOut(0); - - if (pXOverlapped) - { - pXOverlapped->InternalLow = ERROR_SUCCESS; - pXOverlapped->InternalHigh = 0; - pXOverlapped->dwExtendedError = S_OK; - } - - return S_OK; + return; } -#pragma endregion Online Server Sign-in #pragma endregion Halo 2 Master Login diff --git a/xlive/H2MOD/Modules/Accounts/AccountLogin.h b/xlive/H2MOD/Modules/Accounts/AccountLogin.h index 1f452e726..534996744 100644 --- a/xlive/H2MOD/Modules/Accounts/AccountLogin.h +++ b/xlive/H2MOD/Modules/Accounts/AccountLogin.h @@ -18,6 +18,9 @@ const char* GetMasterStateStr(); void UpdateMasterLoginStatus(bool developer = false); void UpdateMasterStatus(int state, const char* state_str, ...); bool HandleGuiLogin(char* token, char* identifier, char* password, int* master_login_interpret_result); + +void AccountDediLogin(PXOVERLAPPED pOverlapped); + int ConfigureUserDetails(const char* username, const char* login_token, unsigned long long xuid, unsigned long xnaddr, unsigned long lanaddr, const char* machineUID, const char* abOnline, bool onlineSignIn, bool developer = false); extern bool AccountEdit_remember; diff --git a/xlive/H2MOD/Modules/Achievements/Achievements.cpp b/xlive/H2MOD/Modules/Achievements/Achievements.cpp index f765d01a5..784b60447 100644 --- a/xlive/H2MOD/Modules/Achievements/Achievements.cpp +++ b/xlive/H2MOD/Modules/Achievements/Achievements.cpp @@ -17,9 +17,6 @@ bool g_achievement_list[42]; using namespace rapidjson; - -std::unordered_map AchievementMap; - static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) { ((std::string*)userp)->append((char*)contents, size * nmemb); diff --git a/xlive/H2MOD/Modules/Achievements/Achievements.h b/xlive/H2MOD/Modules/Achievements/Achievements.h index 0de3f7f52..669770555 100644 --- a/xlive/H2MOD/Modules/Achievements/Achievements.h +++ b/xlive/H2MOD/Modules/Achievements/Achievements.h @@ -4,4 +4,3 @@ void AchievementUnlock(unsigned long long xuid, int achievement_id, XOVERLAPPED* void GetAchievements(unsigned long long xuid); extern bool g_achievement_list[42]; -extern std::unordered_map AchievementMap; diff --git a/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.cpp b/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.cpp index 54a042a4c..f02001272 100644 --- a/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.cpp +++ b/xlive/H2MOD/Modules/CustomMenu/CustomMenuGlobals.cpp @@ -1,8 +1,10 @@ #include "stdafx.h" #include "CustomMenuGlobals.h" -std::chrono::time_point lastOuterMenuUse; -void* lastOuterMenuFuncPtr = 0; +#include + +static std::chrono::time_point lastOuterMenuUse; +static void* lastOuterMenuFuncPtr = 0; void* ui_custom_cartographer_load_menu(proc_ui_screen_load_cb_t p_ui_screen_proc_cb) { return ui_custom_cartographer_load_menu(p_ui_screen_proc_cb, 1, 0); diff --git a/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.cpp b/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.cpp index aaec56396..85bc6263d 100644 --- a/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.cpp +++ b/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.cpp @@ -21,7 +21,7 @@ CustomVariantSettings::s_variant_settings currentVariantSettings; CustomVariantSettings::s_variant_settings defaultCustomVariantSettings; -std::unordered_map customVariantSettingsMap; +std::unordered_map customVariantSettingsMap; namespace CustomVariantSettings { diff --git a/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.h b/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.h index 2dd0c034e..f0649adc8 100644 --- a/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.h +++ b/xlive/H2MOD/Modules/CustomVariantSettings/CustomVariantSettings.h @@ -55,6 +55,5 @@ namespace CustomVariantSettings } extern CustomVariantSettings::s_variant_settings currentVariantSettings; -extern std::unordered_map customVariantSettingsMap; #define k_custom_variant_settings_packet_size (sizeof(CustomVariantSettings::s_variant_settings)) \ No newline at end of file diff --git a/xlive/H2MOD/Modules/GamePhysics/Patches/ProjectileFix.cpp b/xlive/H2MOD/Modules/GamePhysics/Patches/ProjectileFix.cpp index 4d42e889f..e65bd3010 100644 --- a/xlive/H2MOD/Modules/GamePhysics/Patches/ProjectileFix.cpp +++ b/xlive/H2MOD/Modules/GamePhysics/Patches/ProjectileFix.cpp @@ -95,6 +95,7 @@ const char* tag_names[] datum trigger_projectile_datum_index = NONE; #pragma region H3 collision data research +#if ENABLE_H3_COLLISION_DATA_SOURCE __declspec(naked) void update_projectile_collision_data() { __asm @@ -144,6 +145,8 @@ void __cdecl matrix4x3_transform_point(void* matrix, real_vector3d* v1, real_vec p_matrix4x3_transform_point(matrix, v1, out); } +#endif + #pragma endregion void ProjectileFix::ApplyProjectileVelocity() diff --git a/xlive/H2MOD/Modules/Input/ControllerInput.cpp b/xlive/H2MOD/Modules/Input/ControllerInput.cpp new file mode 100644 index 000000000..b4572dbe7 --- /dev/null +++ b/xlive/H2MOD/Modules/Input/ControllerInput.cpp @@ -0,0 +1,21 @@ +#include "stdafx.h" +#include "ControllerInput.h" + +ControllerInput::CustomControllerLayout::CustomControllerLayout(void) +{ + DPAD_UP = XINPUT_GAMEPAD_DPAD_UP; + DPAD_DOWN = XINPUT_GAMEPAD_DPAD_DOWN; + DPAD_LEFT = XINPUT_GAMEPAD_DPAD_LEFT; + DPAD_RIGHT = XINPUT_GAMEPAD_DPAD_RIGHT; + START = XINPUT_GAMEPAD_START; + BACK = XINPUT_GAMEPAD_BACK; + LEFT_THUMB = XINPUT_GAMEPAD_LEFT_THUMB; + RIGHT_THUMB = XINPUT_GAMEPAD_RIGHT_THUMB; + LEFT_SHOULDER = XINPUT_GAMEPAD_LEFT_SHOULDER; + RIGHT_SHOULDER = XINPUT_GAMEPAD_RIGHT_SHOULDER; + A = XINPUT_GAMEPAD_A; + B = XINPUT_GAMEPAD_B; + X = XINPUT_GAMEPAD_X; + Y = XINPUT_GAMEPAD_Y; + return; +} diff --git a/xlive/H2MOD/Modules/Input/ControllerInput.h b/xlive/H2MOD/Modules/Input/ControllerInput.h index 8def01562..d1ae0309a 100644 --- a/xlive/H2MOD/Modules/Input/ControllerInput.h +++ b/xlive/H2MOD/Modules/Input/ControllerInput.h @@ -3,20 +3,23 @@ namespace ControllerInput { struct CustomControllerLayout { - WORD DPAD_UP = XINPUT_GAMEPAD_DPAD_UP; - WORD DPAD_DOWN = XINPUT_GAMEPAD_DPAD_DOWN; - WORD DPAD_LEFT = XINPUT_GAMEPAD_DPAD_LEFT; - WORD DPAD_RIGHT = XINPUT_GAMEPAD_DPAD_RIGHT; - WORD START = XINPUT_GAMEPAD_START; - WORD BACK = XINPUT_GAMEPAD_BACK; - WORD LEFT_THUMB = XINPUT_GAMEPAD_LEFT_THUMB; - WORD RIGHT_THUMB = XINPUT_GAMEPAD_RIGHT_THUMB; - WORD LEFT_SHOULDER = XINPUT_GAMEPAD_LEFT_SHOULDER; - WORD RIGHT_SHOULDER = XINPUT_GAMEPAD_RIGHT_SHOULDER; - WORD A = XINPUT_GAMEPAD_A; - WORD B = XINPUT_GAMEPAD_B; - WORD X = XINPUT_GAMEPAD_X; - WORD Y = XINPUT_GAMEPAD_Y; + WORD DPAD_UP; + WORD DPAD_DOWN; + WORD DPAD_LEFT; + WORD DPAD_RIGHT; + WORD START; + WORD BACK; + WORD LEFT_THUMB; + WORD RIGHT_THUMB; + WORD LEFT_SHOULDER; + WORD RIGHT_SHOULDER; + WORD A; + WORD B; + WORD X; + WORD Y; + + public: + CustomControllerLayout(void); void ToArray(WORD* out) { WORD temp[] = { DPAD_UP , DPAD_DOWN , DPAD_LEFT, DPAD_RIGHT, START, BACK, LEFT_THUMB, RIGHT_THUMB, LEFT_SHOULDER, RIGHT_SHOULDER, A, B ,X, Y }; diff --git a/xlive/H2MOD/Modules/MapManager/MapManager.cpp b/xlive/H2MOD/Modules/MapManager/MapManager.cpp index d3c453412..052234616 100644 --- a/xlive/H2MOD/Modules/MapManager/MapManager.cpp +++ b/xlive/H2MOD/Modules/MapManager/MapManager.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" #include "MapManager.h" -#include "H2MOD/Modules/OnScreenDebug/OnscreenDebug.h" #include "cartographer/config/endpoints.h" #include "main/map_repository.h" @@ -13,9 +12,13 @@ #include "shell/shell.h" #include "text/unicode.h" +#include "H2MOD/Modules/OnScreenDebug/OnscreenDebug.h" + +#include + std::unique_ptr mapManager(std::make_unique()); -const wchar_t* k_map_download_source_text[k_language_count] = +static const wchar_t* k_map_download_source_text[k_language_count] = { L"repository", }; @@ -375,7 +378,12 @@ bool MapDownloadQuery::DownloadFromRepo() { if (curl) { fp = ufopen(map_path.get_string(), L"wb"); if (fp == nullptr) { - LOG_TRACE_GAME(L"{} - unable to open map file at: {}", __FUNCTIONW__, map_path.get_string()); + event( + _event_verbose, + "%s - unable to open map file at: %ws", + __FUNCTION__, + map_path.get_string() + ); curl_easy_cleanup(curl); return false; } diff --git a/xlive/H2MOD/Modules/OnScreenDebug/OnscreenDebug.cpp b/xlive/H2MOD/Modules/OnScreenDebug/OnscreenDebug.cpp index c52c6274f..ab60cb76e 100644 --- a/xlive/H2MOD/Modules/OnScreenDebug/OnscreenDebug.cpp +++ b/xlive/H2MOD/Modules/OnScreenDebug/OnscreenDebug.cpp @@ -1,12 +1,16 @@ #include "stdafx.h" +#include "OnscreenDebug.h" -#include "H2MOD/Modules/Shell/Startup/Startup.h" #include "H2MOD/GUI/ImGui_Integration/Console/ImGui_ConsoleImpl.h" -bool initialisedDebugText = false; +static bool initialisedDebugText = false; // we change global variables, async debug text could result in hazzard +#ifdef TERMINAL_ENABLED std::recursive_mutex addTextMutex; +#endif + +extern void h2log_onscreen_log(const char* text); /* // @@ -26,14 +30,14 @@ void addDebugTextInternal(char* text) { lenInput = endChar - text; } +#ifdef TERMINAL_ENABLED std::lock_guard lg(addTextMutex); -#ifdef TERMINAL_ENABLED CircularStringBuffer* output = GetMainConsoleInstance()->GetTabOutput(_console_tab_logs); output->AddString(StringFlag_None, text, lenInput); #endif #ifndef SPDLOG_DISABLED - g_onscreendebug_log->debug(text); + h2log_onscreen_log(text); #endif if (endChar) { return addDebugTextInternal(endChar + 1); @@ -50,7 +54,6 @@ void addDebugText(const wchar_t* format, ...) if (stringLength == -1) { - LOG_TRACE_GAME("{} - error trying to get string length size", __FUNCTION__); return; } @@ -77,7 +80,6 @@ void addDebugText(const char* format, ...) if (stringLength == -1) { - LOG_TRACE_GAME("{} - error trying to get string length size", __FUNCTION__); return; } @@ -93,10 +95,6 @@ void addDebugText(const char* format, ...) void InitOnScreenDebugText() { #ifndef SPDLOG_DISABLED initialisedDebugText = true; - - c_static_wchar_string path; - log_file_name_prepare(L"h2onscreendebug", &path); - g_onscreendebug_log = h2log::create("OnScreenDebug", path.get_string(), 0); // we always create onscreendebuglog, which logs everything (log level 0) addDebugText("Initialized onscreendebug log"); #endif } \ No newline at end of file diff --git a/xlive/H2MOD/Modules/PlaylistLoader/PlaylistLoader.cpp b/xlive/H2MOD/Modules/PlaylistLoader/PlaylistLoader.cpp index 9d14cd5e3..ea0614942 100644 --- a/xlive/H2MOD/Modules/PlaylistLoader/PlaylistLoader.cpp +++ b/xlive/H2MOD/Modules/PlaylistLoader/PlaylistLoader.cpp @@ -7,6 +7,7 @@ #include "H2MOD/Modules/EventHandler/EventHandler.hpp" #include "H2MOD/Utils/Utils.h" +extern std::unordered_map customVariantSettingsMap; namespace playlist_loader { @@ -152,20 +153,19 @@ namespace playlist_loader //Grab or create the Custom Settings for the current variant. CustomVariantSettings::s_variant_settings* settings; - const auto variant_string = std::wstring(variant); - if (customVariantSettingsMap.count(variant_string) > 0) - settings = &customVariantSettingsMap.at(variant_string); + if (customVariantSettingsMap.count(variant) > 0) + settings = &customVariantSettingsMap.at(variant); else { - customVariantSettingsMap[variant_string] = CustomVariantSettings::s_variant_settings(); - settings = &customVariantSettingsMap.at(variant_string); + customVariantSettingsMap[variant] = CustomVariantSettings::s_variant_settings(); + settings = &customVariantSettingsMap.at(variant); } std::wstring wproperty(property_value); size_t pos = 0; std::wstring t; byte cIndex = 0; - event(_event_verbose, "h2mod:playlistloader: Variant: %ws Custom Setting Detected: %ws = %ws", variant_string.c_str(), property_name, property_value); + event(_event_verbose, "h2mod:playlistloader: Variant: %ws Custom Setting Detected: %ws = %ws", variant, property_name, property_value); switch (custom_setting_type) { case gravity: diff --git a/xlive/H2MOD/Modules/Shell/Config.cpp b/xlive/H2MOD/Modules/Shell/Config.cpp index e1a497329..78925fe4b 100644 --- a/xlive/H2MOD/Modules/Shell/Config.cpp +++ b/xlive/H2MOD/Modules/Shell/Config.cpp @@ -866,6 +866,13 @@ bool config_use_instance_name(const wchar_t** instance_name) return shell_is_dedicated_server() && *instance_name != NULL; } +const char* h2config_get_dedi_server_name(void) +{ + return H2Config_dedi_server_name; +} + +/* private code */ + static bool config_local_instance_exists(wchar_t* config_file_path, size_t count) { // Get local config path diff --git a/xlive/H2MOD/Modules/Shell/Config.h b/xlive/H2MOD/Modules/Shell/Config.h index 9bdd1c883..de5e16251 100644 --- a/xlive/H2MOD/Modules/Shell/Config.h +++ b/xlive/H2MOD/Modules/Shell/Config.h @@ -7,6 +7,8 @@ void SaveH2Config(); void ReadH2Config(); bool config_use_instance_name(const wchar_t** instance_name); +const char* h2config_get_dedi_server_name(void); + #ifndef _CARTOGRAPHER_DLL_CONF // temporary config files // for testing purposes @@ -50,7 +52,6 @@ extern bool H2Config_disable_ingame_keyboard; extern bool H2Config_hide_ingame_chat; extern bool H2Config_xDelay; extern bool H2Config_voice_chat; -extern char H2Config_dedi_server_name[XUSER_NAME_SIZE]; extern char H2Config_dedi_server_playlist[MAX_PATH]; extern int H2Config_additional_pcr_time; extern bool H2Config_debug_log; diff --git a/xlive/H2MOD/Modules/Shell/H2MODShell.cpp b/xlive/H2MOD/Modules/Shell/H2MODShell.cpp index fc4c20dbe..ee9281297 100644 --- a/xlive/H2MOD/Modules/Shell/H2MODShell.cpp +++ b/xlive/H2MOD/Modules/Shell/H2MODShell.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "H2MODShell.h" +#include "networking/network_event.h" + void _Shell::OpenMessageBox(HWND hWnd, UINT uType, const char* caption, const char* format, ...) { va_list valist; @@ -11,7 +13,7 @@ void _Shell::OpenMessageBox(HWND hWnd, UINT uType, const char* caption, const c if (stringLength == -1) { - LOG_TRACE_GAME("{} - error trying to get string length size", __FUNCTION__); + event(_event_verbose, "%s - error trying to get string length size", __FUNCTION__); return; } diff --git a/xlive/H2MOD/Modules/Shell/Startup/Startup.cpp b/xlive/H2MOD/Modules/Shell/Startup/Startup.cpp index eec19c456..135be0ec3 100644 --- a/xlive/H2MOD/Modules/Shell/Startup/Startup.cpp +++ b/xlive/H2MOD/Modules/Shell/Startup/Startup.cpp @@ -8,6 +8,7 @@ #include "sapien/patches_initialize.h" #include "shell/shell.h" #include "shell/shell_windows.h" +#include "tag_files/files.h" #include "tool/tool_patches_initialize.h" #include "H2MOD.h" @@ -15,6 +16,8 @@ #include "H2MOD/Modules/OnScreenDebug/OnscreenDebug.h" #include "H2MOD/Utils/Utils.h" +#include + /* constants */ static const wchar_t k_client_process_name[] = L"Halo2Client"; @@ -125,7 +128,7 @@ void H2DedicatedServerStartup() { // use only after initLocalAppData has been called // by default useAppDataLocalPath is set to true, if not specified -void log_file_name_prepare(const wchar_t* logFileName, c_static_wchar_string* path) +void log_file_name_prepare(const wchar_t* logFileName, c_static_wchar_string* path_wide) { const bool is_dedi = shell_is_dedicated_server(); const wchar_t* process_name = is_dedi ? k_server_process_name : k_client_process_name; @@ -149,21 +152,27 @@ void log_file_name_prepare(const wchar_t* logFileName, c_static_wchar_stringset(g_h2_process_file_path); - path->append(L"\\"); + path_wide->set(g_h2_process_file_path); + path_wide->append(L"\\"); } else { - path->set(g_h2_appdata_local_path); + path_wide->set(g_h2_appdata_local_path); } - path->append(folders.get_string()); + path_wide->append(folders.get_string()); // try making logs directory - SHCreateDirectoryEx(NULL, path->get_string(), NULL); + s_file_reference path_ref; + + char path[MAX_PATH]; + wchar_string_to_utf8_string(path_wide->get_string(), path, MAX_PATH); + + file_reference_create_from_path(&path_ref, path, true); + file_create_parent_directories_if_not_present(&path_ref); - path->append(L"\\"); - path->append(logFileName); - path->append(L".log"); + path_wide->append(L"\\"); + path_wide->append(logFileName); + path_wide->append(L".log"); return; } diff --git a/xlive/H2MOD/Modules/SpecialEvents/Events/Birthday.cpp b/xlive/H2MOD/Modules/SpecialEvents/Events/Birthday.cpp index c08cb6a17..387a80822 100644 --- a/xlive/H2MOD/Modules/SpecialEvents/Events/Birthday.cpp +++ b/xlive/H2MOD/Modules/SpecialEvents/Events/Birthday.cpp @@ -5,7 +5,6 @@ #include "cache/cache_files.h" #include "tag_files/tag_loader/tag_injection.h" -#include "tag_files/tag_groups.h" /* public code */ diff --git a/xlive/H2MOD/Modules/SpecialEvents/Events/Christmas.cpp b/xlive/H2MOD/Modules/SpecialEvents/Events/Christmas.cpp index e824454ea..ef80a1289 100644 --- a/xlive/H2MOD/Modules/SpecialEvents/Events/Christmas.cpp +++ b/xlive/H2MOD/Modules/SpecialEvents/Events/Christmas.cpp @@ -88,7 +88,7 @@ void christmas_event_map_load(void) const scenario_structure_bsp_reference* reference = TAG_BLOCK_GET_ELEMENT(&scenario->structure_bsps, 0, scenario_structure_bsp_reference); structure_bsp* bsp_definition = (structure_bsp*)tag_get_fast(reference->structure_bsp.index); - structure_weather_palette_entry* weat_block = (structure_weather_palette_entry*)tag_injection_extend_block(&bsp_definition->weather_palette, bsp_definition->weather_palette.type_size(), 1); + structure_weather_palette_entry* weat_block = (structure_weather_palette_entry*)tag_injection_extend_block(&bsp_definition->weather_palette, sizeof(structure_weather_palette_entry), 1); const char new_name[] = "snow_cs"; csstrncpy(weat_block->name, new_name, NUMBEROF(new_name)); @@ -97,7 +97,8 @@ void christmas_event_map_load(void) for (int32 i = 0; i < bsp_definition->clusters.count; ++i) { - bsp_definition->clusters[i]->weather_index = (int16)bsp_definition->weather_palette.count - 1; + structure_cluster* cluster = TAG_BLOCK_GET_ELEMENT(&bsp_definition->clusters, i, structure_cluster); + cluster->weather_index = (int16)bsp_definition->weather_palette.count - 1; } // Change sword model to candy cane diff --git a/xlive/H2MOD/Modules/SpecialEvents/SpecialEventHelpers.h b/xlive/H2MOD/Modules/SpecialEvents/SpecialEventHelpers.h index 8d62b5391..e4702bfaa 100644 --- a/xlive/H2MOD/Modules/SpecialEvents/SpecialEventHelpers.h +++ b/xlive/H2MOD/Modules/SpecialEvents/SpecialEventHelpers.h @@ -1,5 +1,4 @@ #pragma once -#include "tag_files/tag_groups.h" /* structs */ diff --git a/xlive/H2MOD/Modules/SpecialEvents/SpecialEvents.cpp b/xlive/H2MOD/Modules/SpecialEvents/SpecialEvents.cpp index 344a4e7c0..5b81890dc 100644 --- a/xlive/H2MOD/Modules/SpecialEvents/SpecialEvents.cpp +++ b/xlive/H2MOD/Modules/SpecialEvents/SpecialEvents.cpp @@ -8,7 +8,7 @@ #include "Events/Paddy.h" #include "game/game.h" -#include "networking/Session/network_session.h" +#include "networking/session/network_session.h" #include "tag_files/tag_loader/tag_injection.h" #include "H2MOD/GUI/imgui_integration/imgui_handler.h" diff --git a/xlive/H2MOD/Modules/h2log/h2log.cpp b/xlive/H2MOD/Modules/h2log/h2log.cpp index f79d06cad..bfa18b43a 100644 --- a/xlive/H2MOD/Modules/h2log/h2log.cpp +++ b/xlive/H2MOD/Modules/h2log/h2log.cpp @@ -131,6 +131,24 @@ void h2log_initialize() return; } +void h2log_onscreen_initialize(void) +{ +#ifndef SPDLOG_DISABLED + c_static_wchar_string path; + log_file_name_prepare(L"h2onscreendebug", &path); + g_onscreendebug_log = h2log::create("OnScreenDebug", path.get_string(), 0); // we always create onscreendebuglog, which logs everything (log level 0) +#endif + return; +} + +void h2log_onscreen_log(const char* text) +{ +#ifndef SPDLOG_DISABLED + g_onscreendebug_log->debug(text); +#endif + return; +} + void h2log_dispose() { #ifndef SPDLOG_DISABLED diff --git a/xlive/H2MOD/Modules/h2log/h2log.h b/xlive/H2MOD/Modules/h2log/h2log.h index 411d5e081..fc55df8a2 100644 --- a/xlive/H2MOD/Modules/h2log/h2log.h +++ b/xlive/H2MOD/Modules/h2log/h2log.h @@ -387,4 +387,9 @@ do \ #endif void h2log_initialize(); + +void h2log_onscreen_initialize(void); + +void h2log_onscreen_log(const char* text); + void h2log_dispose(); diff --git a/xlive/Util/curl-interface.cpp b/xlive/H2MOD/Utils/curl-interface.cpp similarity index 100% rename from xlive/Util/curl-interface.cpp rename to xlive/H2MOD/Utils/curl-interface.cpp diff --git a/xlive/H2MOD/Utils/curl-interface.h b/xlive/H2MOD/Utils/curl-interface.h new file mode 100644 index 000000000..9772df6b4 --- /dev/null +++ b/xlive/H2MOD/Utils/curl-interface.h @@ -0,0 +1,6 @@ +#pragma once + +/* prototypes */ + +void* curl_interface_init(); +void* curl_interface_init_no_verify(); diff --git a/xlive/H2MOD/Utils/curl_constants.h b/xlive/H2MOD/Utils/curl_constants.h new file mode 100644 index 000000000..ab8f74fed --- /dev/null +++ b/xlive/H2MOD/Utils/curl_constants.h @@ -0,0 +1,9 @@ +#pragma once + +// curl errors +enum +{ + ERROR_CODE_CURL_SOCKET_FAILED = -40, + ERROR_CODE_CURL_HANDLE = -41, + ERROR_CODE_CURL_EASY_PERF = -42, +}; diff --git a/xlive/H2MOD/Variants/GunGame/GunGame.cpp b/xlive/H2MOD/Variants/GunGame/GunGame.cpp index f3cf5a3be..a95fc4180 100644 --- a/xlive/H2MOD/Variants/GunGame/GunGame.cpp +++ b/xlive/H2MOD/Variants/GunGame/GunGame.cpp @@ -5,7 +5,7 @@ #include "game/game_options.h" #include "game/players.h" #include "networking/network_event.h" -#include "networking/Session/network_session.h" +#include "networking/session/network_session.h" #include "simulation/game_interface/simulation_game_action.h" #include "units/bipeds.h" diff --git a/xlive/H2MOD/Variants/Infection/Infection.cpp b/xlive/H2MOD/Variants/Infection/Infection.cpp index ee5ca32d8..cc5159175 100644 --- a/xlive/H2MOD/Variants/Infection/Infection.cpp +++ b/xlive/H2MOD/Variants/Infection/Infection.cpp @@ -12,6 +12,7 @@ #include "networking/session/network_session.h" #include "networking/network_event.h" #include "networking/network_game_definitions.h" +#include "networking/session/network_session.h" #include "scenario/scenario.h" #include "scenario/scenario_definitions.h" #include "shell/shell.h" @@ -70,25 +71,46 @@ static void set_zombie_player_status(uint64 identifier); int Infection::calculateZombiePlayerIndex() { + int32 result = NONE; + c_network_session* session = NULL; network_life_cycle_in_squad_session(&session); - if (session->get_player_count() > 0) + uint32 player_in_game_count = 0; + + // Get the number of players ingame { - std::mt19937 mt_rand(rd()); - std::vector activePlayersIndices = NetworkSession::GetActivePlayerIndicesList(); - std::uniform_int_distribution dist(0, session->get_player_count() - 1); - - if (activePlayersIndices.empty()) - return NONE; + c_player_in_game_iterator player_it; + while (player_it.next()) + { + ++player_in_game_count; + } + } - int32 infectedPlayerIndex = activePlayersIndices[dist(mt_rand)]; - event(_event_verbose, "h2mod:infection: random infection player index: %d, with name: %ws", infectedPlayerIndex, session->get_player_name(infectedPlayerIndex)); + if (player_in_game_count > 0) + { + std::mt19937 mt_rand(rd()); + std::uniform_int_distribution dist(0, player_in_game_count - 1); + const int32 active_index = dist(mt_rand); + + // Get the index in the actual array + { + c_player_in_game_iterator player_it; + for (int32 i = 0; player_it.next(); ++i) + { + if (i == active_index) + { + result = player_it.get_absolute_index(); + break; + } + } + } + - return infectedPlayerIndex; + event(_event_verbose, "h2mod:infection: random infection player index: %d, with name: %ws", result, session->get_player_name(result)); } - return NONE; + return result; } void Infection::sendTeamChange() diff --git a/xlive/H2MOD/h2modlib.vcxproj b/xlive/H2MOD/h2modlib.vcxproj new file mode 100644 index 000000000..da852b71c --- /dev/null +++ b/xlive/H2MOD/h2modlib.vcxproj @@ -0,0 +1,313 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + 18.0 + Win32Proj + {E5F3AACF-82B6-49ED-ABE8-8E256E7909CD} + h2modlib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + + Disabled + WIN32;CURL_STATICLIB;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)h2modlib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + ..\3rdparty;..\3rdparty\imgui\imgui;..\3rdparty\libcurl;..\3rdparty\spdlog\include;..\3rdparty\zlib\src;.\;..\;..\Blam\Engine;..\XLive + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 + true + true + true + false + 4700 + Fast + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)h2modlib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\3rdparty;..\3rdparty\imgui\imgui;..\3rdparty\libcurl;..\3rdparty\spdlog\include;..\3rdparty\zlib\src;.\;..\;..\Blam\Engine;..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 + true + true + 4700 + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;SPDLOG_DISABLED;IMGUI_DISABLE;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)h2modlib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\3rdparty;..\3rdparty\imgui\imgui;..\3rdparty\libcurl;..\3rdparty\spdlog\include;..\3rdparty\zlib\src;.\;..\;..\Blam\Engine;..\XLive + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 + true + true + 4700 + stdafx.h + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xlive/H2MOD/h2modlib.vcxproj.filters b/xlive/H2MOD/h2modlib.vcxproj.filters new file mode 100644 index 000000000..b2456c419 --- /dev/null +++ b/xlive/H2MOD/h2modlib.vcxproj.filters @@ -0,0 +1,418 @@ + + + + + + GUI\imgui_integration + + + GUI\imgui_integration\Console + + + GUI\imgui_integration\Console + + + GUI\imgui_integration\Console + + + GUI\imgui_integration\Console + + + GUI\imgui_integration + + + GUI\imgui_integration + + + GUI\imgui_integration + + + GUI\imgui_integration + + + GUI\imgui_integration + + + GUI\imgui_integration + + + Variants + + + Variants\GraveRobber + + + Variants\GunGame + + + Variants\H2X + + + Variants\Infection + + + Utils + + + Modules\Accounts + + + Modules\Accounts + + + Modules\Accounts + + + Modules\Achievements + + + Modules\CustomMenu + + + Modules\CustomMenu + + + Modules\CustomVariantSettings + + + Modules\DirectorHooks + + + Modules\EventHandler + + + Modules\GamePhysics\Patches + + + Modules\Input + + + Modules\Input + + + Modules\MainMenu + + + Modules\MainMenu + + + Modules\MapManager + + + Modules\OnScreenDebug + + + Modules\PlaylistLoader + + + Modules\RenderHooks + + + Modules\Shell + + + Modules\Shell + + + Modules\Shell\Startup + + + Modules\SpecialEvents + + + Modules\SpecialEvents + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events\MapObjectPlacements\Halloween + + + Modules\SpecialEvents\Events\MapObjectPlacements\Halloween + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events + + + Modules\TagFixes + + + Modules\Updater + + + Utils + + + + + + + GUI\imgui_integration + + + GUI\imgui_integration\Console + + + GUI\imgui_integration\Console + + + GUI\imgui_integration\Console + + + GUI\imgui_integration\Console + + + GUI\imgui_integration\Console + + + GUI\imgui_integration + + + GUI\imgui_integration + + + GUI\imgui_integration + + + GUI\imgui_integration + + + GUI\imgui_integration + + + Variants + + + Variants\GraveRobber + + + Variants\GunGame + + + Variants\H2X + + + Variants\Infection + + + Utils + + + Modules\Accounts + + + Modules\Accounts + + + Modules\Accounts + + + Modules\Achievements + + + Modules\CustomMenu + + + Modules\CustomMenu + + + Modules\CustomVariantSettings + + + Modules\DirectorHooks + + + Modules\EventHandler + + + Modules\GamePhysics\Patches + + + Modules\Input + + + Modules\Input + + + Modules\MainMenu + + + Modules\MainMenu + + + Modules\MapManager + + + Modules\OnScreenDebug + + + Modules\PlaylistLoader + + + Modules\RenderHooks + + + Modules\Shell + + + Modules\Shell + + + Modules\Shell\Startup + + + Modules\SpecialEvents + + + Modules\SpecialEvents + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events\MapObjectPlacements\Halloween + + + Modules\SpecialEvents\Events\MapObjectPlacements\Halloween + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events + + + Modules\SpecialEvents\Events + + + Modules\TagFixes + + + Modules\Updater + + + Utils + + + Utils + + + + + + {e7cf5ce1-c8c0-4f17-8ade-8b72392ae734} + + + {f99ff8ee-a8a2-4159-924b-774fe515ac32} + + + {524d9d14-4f9a-473b-a667-90a61bd241c2} + + + {a6582c68-9295-46c9-8f06-f84d65117e4b} + + + {aa3d219e-69f3-4151-bc3a-ce2a8e0ec638} + + + {ca71ef5e-c77a-4bf0-bd8d-53692af5f59d} + + + {9ee4da64-b901-4acd-aa7b-8300712886e8} + + + {9f56a325-cd70-4770-9d56-d6ff004da5f1} + + + {289f39fb-b780-4afe-9334-d2ac143dfe52} + + + {2e6c5267-4c45-4ad2-b8a6-284416ce5109} + + + {4ebbf9a8-877d-402b-9771-60bec9f49bb5} + + + {0104adcb-2520-4f6f-8662-f78be34258cd} + + + {a745338b-a084-4a42-ac7c-2d605c7d9338} + + + {9495d55e-9b03-45f8-8917-52c0c9bf29bc} + + + {94733467-dd52-43d6-b085-e7627d56800e} + + + {d46d22fc-a345-4d11-a0e4-c03ec74c4639} + + + {065bc1cc-2556-4da4-b7bd-2a49305e936d} + + + {151f917a-543b-43a1-8a2d-00c66cb86d86} + + + {94e33398-bea0-43ee-8d4a-ea4cb8c303ef} + + + {becb905a-c722-4f54-81d1-b793a65d4838} + + + {1349ac2c-8e3a-46a2-853f-7fb9efedf6d8} + + + {572eb2e5-3a14-479e-b81f-2b5b234bd4e4} + + + {514b2a40-1a55-4b5c-95ec-17d9aab71de9} + + + {dfe72296-15c4-4550-8d3a-ae1fb35e0b85} + + + {aeaae3d7-7b98-4b28-a028-d262f0ad0579} + + + {3a7f5ae3-d06e-4f7d-93db-a5c834630afc} + + + {687acfc5-e214-4a1d-a4d0-38e21f9229dd} + + + {8999a703-37b9-4821-9636-71892ef28ab5} + + + {d6bcd813-a7e8-4276-8b28-af350bc56f00} + + + {66338986-0a28-43e4-b5f2-83f19f7708c8} + + + {be1953c5-d296-40fc-8575-078d60cb0f5d} + + + {2966df25-6bcc-4a2a-8f51-3f671a45fa18} + + + {da859bd6-cef9-4653-b5c9-487ce0b4739e} + + + {08b3c8ad-9ada-4814-8fde-6f1ca701e230} + + + \ No newline at end of file diff --git a/xlive/H2MOD/stdafx.cpp b/xlive/H2MOD/stdafx.cpp new file mode 100644 index 000000000..a58542229 --- /dev/null +++ b/xlive/H2MOD/stdafx.cpp @@ -0,0 +1,3 @@ +#include "stdafx.h" + +std::random_device rd; diff --git a/xlive/H2MOD/stdafx.h b/xlive/H2MOD/stdafx.h new file mode 100644 index 000000000..d8bc82ef2 --- /dev/null +++ b/xlive/H2MOD/stdafx.h @@ -0,0 +1,81 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* windows */ + +#ifdef _WIN32 + +#define _USE_MATH_DEFINES +#include + +#define _WINSOCK_DEPRECATED_NO_WARNINGS + +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include +#include +#include + +// Use Xinput 9.1.0 and Dinput 0x0800 +#define XINPUT_USE_9_1_0 +#define DIRECTINPUT_VERSION 0x0800 + +#include +#include + +#endif + +/* 3rd party libs */ + +#include +#include + +#include + +/* game includes */ + +#include "cseries/cseries.h" +#include "cseries/cseries_errors.h" +#include "cseries/cseries_system_memory.h" + +#ifdef _WIN32 +#include "cseries/cseries_windows.h" +#endif + +#include "math/crypto_windows.h" +#include "math/integer_math.h" +#include "math/real_math.h" +#include "memory/static_arrays.h" + +#include "tag_files/tag_groups.h" + +#include "H2MOD/Utils/curl-interface.h" +#include "H2MOD/Utils/curl_constants.h" + +#include "Util/Hooks/Hook.h" +#include "Util/Memory.h" + +extern std::random_device rd; + +// use this macro to define _time and _clock namespaces +#define STD_CHRONO_DEFINE_TIME_AND_CLOCK(_time_name, _clock_name) \ + namespace _time_name = std::chrono; \ + using _clock_name = std::chrono::steady_clock; \ + using namespace std::chrono_literals; \ No newline at end of file diff --git a/xlive/Project_Cartographer.vcxproj b/xlive/Project_Cartographer.vcxproj index a3997a8a9..6cc66ef93 100644 --- a/xlive/Project_Cartographer.vcxproj +++ b/xlive/Project_Cartographer.vcxproj @@ -115,49 +115,49 @@ $(SolutionDir)Halo2\ - .\objects\$(Configuration)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ false $(IncludePath) - $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) + $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;../objects/$(Configuration)/h2modlib;../objects/$(Configuration)/xlivelib;../objects/$(Configuration)/ailib;../objects/$(Configuration)/blamlib;../objects/$(Configuration)/graphicslib;../objects/$(Configuration)/interfacelib;../objects/$(Configuration)/networkinglib;../objects/$(Configuration)/objectslib;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) $(ExternalIncludePath);$(DXSDK_DIR)Include $(SolutionDir)Halo2\ - .\objects\$(Configuration)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ false $(IncludePath) - $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) + $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;../objects/$(Configuration)/h2modlib;../objects/$(Configuration)/xlivelib;../objects/$(Configuration)/ailib;../objects/$(Configuration)/blamlib;../objects/$(Configuration)/graphicslib;../objects/$(Configuration)/interfacelib;../objects/$(Configuration)/networkinglib;../objects/$(Configuration)/objectslib;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) $(ExternalIncludePath);$(DXSDK_DIR)Include $(SolutionDir)Halo2\ - .\objects\$(Configuration)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ false $(IncludePath) - $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) + $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;../objects/$(Configuration)/h2modlib;../objects/$(Configuration)/xlivelib;../objects/$(Configuration)/ailib;../objects/$(Configuration)/blamlib;../objects/$(Configuration)/graphicslib;../objects/$(Configuration)/interfacelib;../objects/$(Configuration)/networkinglib;../objects/$(Configuration)/objectslib;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) $(ExternalIncludePath);$(DXSDK_DIR)Include $(SolutionDir)Halo2\ - .\objects\$(Configuration)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ false $(IncludePath) - $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) + $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;../objects/$(Configuration)/h2modlib;../objects/$(Configuration)/xlivelib;../objects/$(Configuration)/ailib;../objects/$(Configuration)/blamlib;../objects/$(Configuration)/graphicslib;../objects/$(Configuration)/interfacelib;../objects/$(Configuration)/networkinglib;../objects/$(Configuration)/objectslib;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/release;3rdparty/miniupnpc/lib/release;3rdparty/detours/lib.X86;$(LibraryPath) $(ExternalIncludePath);$(DXSDK_DIR)Include $(SolutionDir)Halo2\ - .\objects\$(Configuration)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ true - $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/debug/;3rdparty/miniupnpc/lib/debug;3rdparty/detours/lib.X86;$(LibraryPath) + $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;../objects/$(Configuration)/h2modlib;../objects/$(Configuration)/xlivelib;../objects/$(Configuration)/ailib;../objects/$(Configuration)/blamlib;../objects/$(Configuration)/graphicslib;../objects/$(Configuration)/interfacelib;../objects/$(Configuration)/networkinglib;../objects/$(Configuration)/objectslib;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/debug/;3rdparty/miniupnpc/lib/debug;3rdparty/detours/lib.X86;$(LibraryPath) $(IncludePath) $(ExternalIncludePath);$(DXSDK_DIR)Include $(SolutionDir)Halo2\ - .\objects\$(Configuration)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ true - $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/debug/;3rdparty/miniupnpc/lib/debug;3rdparty/detours/lib.X86;$(LibraryPath) + $(WindowsSDK_LibraryPath_x86);$(DXSDK_DIR)Lib\x86;../objects/$(Configuration)/h2modlib;../objects/$(Configuration)/xlivelib;../objects/$(Configuration)/ailib;../objects/$(Configuration)/blamlib;../objects/$(Configuration)/graphicslib;../objects/$(Configuration)/interfacelib;../objects/$(Configuration)/networkinglib;../objects/$(Configuration)/objectslib;3rdparty/discord/lib;3rdparty/imgui/lib;3rdparty/spdlog/lib;3rdparty/tinyxml/lib;3rdparty/zlib/lib;3rdparty/libcurl/lib/nghttp2/;3rdparty/libcurl/lib/wolfssl/;3rdparty/libcurl/lib/curl/debug/;3rdparty/miniupnpc/lib/debug;3rdparty/detours/lib.X86;$(LibraryPath) $(IncludePath) $(ExternalIncludePath);$(DXSDK_DIR)Include @@ -174,7 +174,7 @@ true Speed true - WIN32;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) true MultiThreaded true @@ -185,11 +185,11 @@ $(IntDir) Level4 false - .\;.\3rdparty\;.\3rdparty\detours\include;.\3rdparty\discord\include;.\3rdparty\imgui\imgui;.\3rdparty\libcurl;.\3rdparty\miniupnpc\include;.\3rdparty\spdlog\include;.\3rdparty\tinyxml;.\3rdparty\zlib\src;.\Blam\Engine + .\3rdparty\spdlog\include;.\;.\XLive;.\Blam\Engine true false true - 4505;4100 + 4505;4100;4201 Sync true Use @@ -198,20 +198,21 @@ stdcpp17 Fast - /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + /DPSAPI_VERSION=1 /utf-8 true true 4700 + false NDEBUG;%(PreprocessorDefinitions) 0x0409 - imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) + iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;h2modlib$(Platform)$(Configuration).lib;xlivelib$(Platform)$(Configuration).lib;ailib$(Platform)$(Configuration).lib;blamlib$(Platform)$(Configuration).lib;graphicslib$(Platform)$(Configuration).lib;interfacelib$(Platform)$(Configuration).lib;networkinglib$(Platform)$(Configuration).lib;objectslib$(Platform)$(Configuration).lib;imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) false - .\xlive_exports.def + .\Xlive\xlive_exports.def $(IntDir)xlive.pdb false @@ -228,6 +229,7 @@ true true true + true true @@ -249,7 +251,7 @@ true Speed true - WIN32;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;SPDLOG_DISABLED;IMGUI_DISABLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SPDLOG_DISABLED;IMGUI_DISABLE;%(PreprocessorDefinitions) true MultiThreaded true @@ -260,11 +262,11 @@ $(IntDir) Level4 false - .\;.\3rdparty\;.\3rdparty\detours\include;.\3rdparty\discord\include;.\3rdparty\imgui\imgui;.\3rdparty\libcurl;.\3rdparty\miniupnpc\include;.\3rdparty\spdlog\include;.\3rdparty\tinyxml;.\3rdparty\zlib\src;.\Blam\Engine + .\3rdparty\spdlog\include;.\;.\XLive;.\Blam\Engine true false true - 4505;4100 + 4505;4100;4201 Sync true Use @@ -273,20 +275,21 @@ stdcpp17 Fast - /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + /DPSAPI_VERSION=1 /utf-8 true true 4700 + false NDEBUG;%(PreprocessorDefinitions) 0x0409 - tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) + iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;h2modlib$(Platform)$(Configuration).lib;xlivelib$(Platform)$(Configuration).lib;ailib$(Platform)$(Configuration).lib;blamlib$(Platform)$(Configuration).lib;graphicslib$(Platform)$(Configuration).lib;interfacelib$(Platform)$(Configuration).lib;networkinglib$(Platform)$(Configuration).lib;objectslib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) false - .\xlive_exports.def + .\Xlive\xlive_exports.def $(IntDir)xlive.pdb false @@ -304,6 +307,7 @@ true true true + true true @@ -325,7 +329,7 @@ true Speed true - WIN32;LLVM;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + WIN32;LLVM;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) true MultiThreaded true @@ -336,10 +340,11 @@ $(IntDir) Level4 false - .\;.\3rdparty\;.\3rdparty\detours\include;.\3rdparty\discord\include;.\3rdparty\imgui\imgui;.\3rdparty\libcurl;.\3rdparty\miniupnpc\include;.\3rdparty\spdlog\include;.\3rdparty\tinyxml;.\3rdparty\zlib\src;.\Blam\Engine + .\3rdparty\spdlog\include;.\;.\XLive;.\Blam\Engine true false - true + + Sync @@ -357,10 +362,10 @@ 0x0409 - imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) + iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;h2modlib$(Platform)$(Configuration).lib;xlivelib$(Platform)$(Configuration).lib;ailib$(Platform)$(Configuration).lib;blamlib$(Platform)$(Configuration).lib;graphicslib$(Platform)$(Configuration).lib;interfacelib$(Platform)$(Configuration).lib;networkinglib$(Platform)$(Configuration).lib;objectslib$(Platform)$(Configuration).lib;imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) false - .\xlive_exports.def + .\Xlive\xlive_exports.def $(IntDir)xlive.pdb false @@ -399,7 +404,7 @@ true Speed true - WIN32;LLVM;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;IMGUI_DISABLE;%(PreprocessorDefinitions) + WIN32;LLVM;NDEBUG;_WINDOWS;_USRDLL;IMGUI_DISABLE;%(PreprocessorDefinitions) true MultiThreaded true @@ -410,10 +415,11 @@ $(IntDir) Level4 false - .\;.\3rdparty\;.\3rdparty\detours\include;.\3rdparty\discord\include;.\3rdparty\imgui\imgui;.\3rdparty\libcurl;.\3rdparty\miniupnpc\include;.\3rdparty\spdlog\include;.\3rdparty\tinyxml;.\3rdparty\zlib\src;.\Blam\Engine + .\3rdparty\spdlog\include;.\;.\XLive;.\Blam\Engine true false - true + + Sync @@ -424,17 +430,17 @@ stdcpp17 Fast - /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + /DPSAPI_VERSION=1 /utf-8 /maxcpucount:2 %(AdditionalOptions) NDEBUG;%(PreprocessorDefinitions) 0x0409 - tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) + iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;h2modlib$(Platform)$(Configuration).lib;xlivelib$(Platform)$(Configuration).lib;ailib$(Platform)$(Configuration).lib;blamlib$(Platform)$(Configuration).lib;graphicslib$(Platform)$(Configuration).lib;interfacelib$(Platform)$(Configuration).lib;networkinglib$(Platform)$(Configuration).lib;objectslib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl.lib;%(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) false - .\xlive_exports.def + .\Xlive\xlive_exports.def $(IntDir)xlive.pdb false @@ -469,7 +475,7 @@ Disabled - WIN32;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;PROFILE_ENABLED;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) false Default MultiThreadedDebug @@ -480,32 +486,33 @@ Level4 false EditAndContinue - .\;.\3rdparty\;.\3rdparty\detours\include;.\3rdparty\discord\include;.\3rdparty\imgui\imgui;.\3rdparty\libcurl;.\3rdparty\miniupnpc\include;.\3rdparty\spdlog\include;.\3rdparty\tinyxml;.\3rdparty\zlib\src;.\Blam\Engine + .\3rdparty\spdlog\include;.\;.\XLive;.\Blam\Engine Use true false Sync - 4505;4100 + 4505;4100;4201 stdcpp17 StreamingSIMDExtensions2 - /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + /DPSAPI_VERSION=1 /utf-8 true true true false 4700 Fast + false _DEBUG;%(PreprocessorDefinitions) 0x0409 - imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;dxguid.lib;psapi.lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl-d.lib;%(AdditionalDependencies) + iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;h2modlib$(Platform)$(Configuration).lib;xlivelib$(Platform)$(Configuration).lib;ailib$(Platform)$(Configuration).lib;blamlib$(Platform)$(Configuration).lib;graphicslib$(Platform)$(Configuration).lib;interfacelib$(Platform)$(Configuration).lib;networkinglib$(Platform)$(Configuration).lib;objectslib$(Platform)$(Configuration).lib;imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl-d.lib;%(AdditionalDependencies) true - .\xlive_exports_debug.def + .\Xlive\xlive_exports_debug.def true $(IntDir)xlive.pdb false @@ -531,7 +538,7 @@ Disabled - WIN32;LLVM;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;PROFILE_ENABLED;%(PreprocessorDefinitions) + WIN32;LLVM;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) false Default MultiThreadedDebug @@ -542,7 +549,7 @@ Level4 false EditAndContinue - .\;.\3rdparty\;.\3rdparty\detours\include;.\3rdparty\discord\include;.\3rdparty\imgui\imgui;.\3rdparty\libcurl;.\3rdparty\miniupnpc\include;.\3rdparty\spdlog\include;.\3rdparty\tinyxml;.\3rdparty\zlib\src;.\Blam\Engine + .\3rdparty\spdlog\include;.\;.\XLive;.\Blam\Engine Use true false @@ -553,8 +560,9 @@ stdcpp17 StreamingSIMDExtensions2 - /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) - true + /DPSAPI_VERSION=1 /utf-8 /maxcpucount:2 %(AdditionalOptions) + + false Fast @@ -563,9 +571,9 @@ 0x0409 - imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;dxguid.lib;psapi.lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl-d.lib;%(AdditionalDependencies) + iphlpapi.lib;version.lib;Crypt32.lib;Shlwapi.lib;Dbghelp.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;d3d9.lib;d3dx9.lib;psapi.lib;h2modlib$(Platform)$(Configuration).lib;xlivelib$(Platform)$(Configuration).lib;ailib$(Platform)$(Configuration).lib;blamlib$(Platform)$(Configuration).lib;graphicslib$(Platform)$(Configuration).lib;interfacelib$(Platform)$(Configuration).lib;networkinglib$(Platform)$(Configuration).lib;objectslib$(Platform)$(Configuration).lib;imguilib$(Platform)$(Configuration).lib;tinyxmllib$(Platform)$(Configuration).lib;zlib$(Platform)$(Configuration).lib;detours.lib;libminiupnpc.lib;wolfssl.lib;nghttp2.lib;libcurl-d.lib;%(AdditionalDependencies) true - .\xlive_exports_debug.def + .\Xlive\xlive_exports_debug.def true $(IntDir)xlive.pdb false @@ -584,2009 +592,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Create + Create Create Create Create Create - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2595,10 +620,6 @@ - - - - diff --git a/xlive/Project_Cartographer.vcxproj.filters b/xlive/Project_Cartographer.vcxproj.filters index e2242febc..5ce0c620a 100644 --- a/xlive/Project_Cartographer.vcxproj.filters +++ b/xlive/Project_Cartographer.vcxproj.filters @@ -1,2077 +1,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Util\Hooks + + + Util + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + Util\Hooks + + + Util + + + resources + + + resources + - - + + resources + + + resources + - + + {e1c15bc0-6dc2-43b5-9d8f-aeb537d9cf6f} + + + {e3d14697-ee87-4d87-9bae-70ea4f8b2b7e} + + + {036a3791-bff0-41d5-9b81-3fc709987f50} + + + {872da493-6d13-4b6a-a218-825a5b7fc072} + - - + + resources\bitmaps + \ No newline at end of file diff --git a/xlive/Project_Cartographer.vcxproj.user b/xlive/Project_Cartographer.vcxproj.user index 2430adeb6..43c8aabd8 100644 --- a/xlive/Project_Cartographer.vcxproj.user +++ b/xlive/Project_Cartographer.vcxproj.user @@ -57,6 +57,6 @@ -nointro -windowed -novsync| - true + false \ No newline at end of file diff --git a/xlive/Util/Hooks/Hook.h b/xlive/Util/Hooks/Hook.h index 419529e88..c5ebe0044 100644 --- a/xlive/Util/Hooks/Hook.h +++ b/xlive/Util/Hooks/Hook.h @@ -3,7 +3,6 @@ /* macros */ -#define WIN32_LEAN_AND_MEAN #define JMP_OP_CODE 0xEB #define JNZ_OP_CODE 0x75 @@ -24,46 +23,6 @@ do \ #define DETOUR_COMMIT() \ DetourTransactionCommit(); -#ifdef LLVM -#define CLASS_HOOK_DECLARE_LABEL(name, member) static auto name = &member - -#else -#define CLASS_HOOK_DECLARE_LABEL(name, member) -#endif - -#ifdef LLVM -#define CLASS_HOOK_JMP(name, member) __asm jmp (name) -#else -#define CLASS_HOOK_JMP(name, member) __asm jmp (member) -#endif - - -// Invokes a function -// ADDR_CLIENT: file offset in halo2.exe -// ADDR_SERVER: file offset in h2server.exe -// TYPE: function -// __VA_ARGS__: arguments for the function we want to invoke -// NOTE: -// if server or client is equal to 0 then we pass the same address for both (ONLY ON RELEASE BUILDS) -// REASON: -// optimizes out a cmov or related instruction when building release whenever we call a function that doesn't have a dedi address specified -#ifdef NDEBUG -#define INVOKE_BY_TYPE(_addr_client, _addr_server, _type, ...) \ -Memory::GetAddress<_type>(_addr_client == 0 ? _addr_server : _addr_client, _addr_server == 0 ? _addr_client : _addr_server)(__VA_ARGS__) -#else -#define INVOKE_BY_TYPE(_addr_client, _addr_server, _type, ...) \ -Memory::GetAddress<_type>(_addr_client, _addr_server)(__VA_ARGS__) -#endif - -#define INVOKE(_addr_client, _addr_server, _fn_decl, ...) INVOKE_BY_TYPE(_addr_client, _addr_server, decltype(_fn_decl)*, __VA_ARGS__) -// ### TODO find better name -#define INVOKE_TYPE(_addr_client, _addr_server, _type, ...) INVOKE_BY_TYPE(_addr_client, _addr_server, _type, __VA_ARGS__) - -#define INVOKE_VFPTR_FN(_get_table_fn, _index, _type, ...) \ - (this->**_get_table_fn<_type>(_index))(__VA_ARGS__) - -#define INVOKE_CLASS_FN(classobj, functionPtr) ((classobj)->*(functionPtr)) - /* prototypes */ void *DetourFunc(BYTE *src, const BYTE *dst, const unsigned int len); diff --git a/xlive/Util/Memory.h b/xlive/Util/Memory.h index 27374daaf..336055396 100644 --- a/xlive/Util/Memory.h +++ b/xlive/Util/Memory.h @@ -1,7 +1,6 @@ #pragma once #include "cseries/cseries.h" -#include "cseries/cseries_windows.h" /* constants */ @@ -11,6 +10,44 @@ enum k_base_image_address_h2server = 0x00400000, }; +// Invokes a function +// ADDR_CLIENT: file offset in halo2.exe +// ADDR_SERVER: file offset in h2server.exe +// TYPE: function +// __VA_ARGS__: arguments for the function we want to invoke +// NOTE: +// if server or client is equal to 0 then we pass the same address for both (ONLY ON RELEASE BUILDS) +// REASON: +// optimizes out a cmov or related instruction when building release whenever we call a function that doesn't have a dedi address specified +#ifdef NDEBUG +#define INVOKE_BY_TYPE(_addr_client, _addr_server, _type, ...) \ +Memory::GetAddress<_type>(_addr_client == 0 ? _addr_server : _addr_client, _addr_server == 0 ? _addr_client : _addr_server)(__VA_ARGS__) +#else +#define INVOKE_BY_TYPE(_addr_client, _addr_server, _type, ...) \ +Memory::GetAddress<_type>(_addr_client, _addr_server)(__VA_ARGS__) +#endif + +#define INVOKE(_addr_client, _addr_server, _fn_decl, ...) INVOKE_BY_TYPE(_addr_client, _addr_server, decltype(_fn_decl)*, __VA_ARGS__) +// ### TODO find better name +#define INVOKE_TYPE(_addr_client, _addr_server, _type, ...) INVOKE_BY_TYPE(_addr_client, _addr_server, _type, __VA_ARGS__) + +#define INVOKE_VFPTR_FN(_get_table_fn, _index, _type, ...) \ + (this->**_get_table_fn<_type>(_index))(__VA_ARGS__) + +#define INVOKE_CLASS_FN(classobj, functionPtr) ((classobj)->*(functionPtr)) + +#ifdef LLVM +#define CLASS_HOOK_DECLARE_LABEL(name, member) static auto name = &member +#else +#define CLASS_HOOK_DECLARE_LABEL(name, member) +#endif + +#ifdef LLVM +#define CLASS_HOOK_JMP(name, member) __asm jmp (name) +#else +#define CLASS_HOOK_JMP(name, member) __asm jmp (member) +#endif + /* enums */ enum e_h2_type diff --git a/xlive/Util/curl-interface.h b/xlive/Util/curl-interface.h deleted file mode 100644 index dd587a48e..000000000 --- a/xlive/Util/curl-interface.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include "curl/curl.h" - -// curl errors -#define ERROR_CODE_CURL_SOCKET_FAILED -40 -#define ERROR_CODE_CURL_HANDLE -41 -#define ERROR_CODE_CURL_EASY_PERF -42 - -CURL* curl_interface_init(); -CURL* curl_interface_init_no_verify(); \ No newline at end of file diff --git a/xlive/XLive/ServerList/ServerList.cpp b/xlive/XLive/ServerList/ServerList.cpp index 1a3551e7e..0c36cf3d2 100644 --- a/xlive/XLive/ServerList/ServerList.cpp +++ b/xlive/XLive/ServerList/ServerList.cpp @@ -11,12 +11,12 @@ #include "H2MOD/Modules/Accounts/Accounts.h" #include "H2MOD/Utils/Utils.h" +#include #include #include using namespace rapidjson; - /* constants */ static const char k_cartographer_add_server_url[] = k_cartographer_url_https"/live/add_server.php"; @@ -317,7 +317,7 @@ bool CServerList::SearchResultParseAndWrite(const std::string& serverResultData, ZeroMemory(*stringBuffer, X_PROPERTY_UNICODE_BUFFER_SIZE); - ustrncpy(*stringBuffer, str.c_str(), str.length() + 1); + wcsncpy_s(*stringBuffer, str.length() + 1, str.c_str(), _TRUNCATE); userProperty.value.string.cbData = (wcsnlen(*stringBuffer, 64) + 1) * sizeof(WCHAR); userProperty.value.string.pwszData = *stringBuffer; @@ -788,7 +788,8 @@ void CServerList::AddServer(DWORD dwUserIndex, DWORD dwServerType, XNKID xnkid, XUSER_SIGNIN_INFO* signedInUser = XUserGetSignInInfo(dwUserIndex); - const char* server_name = strnlen_s(H2Config_dedi_server_name, XUSER_MAX_NAME_LENGTH) > 0 ? H2Config_dedi_server_name : signedInUser->szUserName; + const char* dedi_server_name = h2config_get_dedi_server_name(); + const char* server_name = strnlen_s(dedi_server_name, XUSER_MAX_NAME_LENGTH) > 0 ? dedi_server_name : signedInUser->szUserName; Value token(kStringType); if (H2CurrentAccountLoginToken) diff --git a/xlive/XLive/ServerList/ServerList.h b/xlive/XLive/ServerList/ServerList.h index 535f3cc84..4067e098d 100644 --- a/xlive/XLive/ServerList/ServerList.h +++ b/xlive/XLive/ServerList/ServerList.h @@ -58,10 +58,6 @@ #define XLOCATOR_SERVER_PAGE_REPORT_ITEM_COUNT_MIN 24 -#define XLOCATOR_SERVER_PAGE_MIN_ITEMS 50 -#define XLOCATOR_SERVER_PAGE_MAX_ITEMS_OLD 200 -#define XLOCATOR_SERVER_PAGE_MAX_ITEMS 2000 // Increased because we hit the limit - /* structs */ typedef struct _XLOCATOR_SEARCHRESULT { diff --git a/xlive/XLive/XAM/notify.cpp b/xlive/XLive/XAM/notify.cpp new file mode 100644 index 000000000..6b2225bbf --- /dev/null +++ b/xlive/XLive/XAM/notify.cpp @@ -0,0 +1,9 @@ +#include "stdafx.h" +#include "notify.h" + +// #653 +int WINAPI XNotifyDelayUI(int a1) +{ + LOG_TRACE_XLIVE("XNotifyDelayUI"); + return 0; +} diff --git a/xlive/XLive/XAM/notify.h b/xlive/XLive/XAM/notify.h new file mode 100644 index 000000000..a07668861 --- /dev/null +++ b/xlive/XLive/XAM/notify.h @@ -0,0 +1,5 @@ +#pragma once + +/* prototypes */ + +int WINAPI XNotifyDelayUI(int a1); diff --git a/xlive/H2MOD/GUI/XLiveRendering.cpp b/xlive/XLive/XAM/uithread.cpp similarity index 66% rename from xlive/H2MOD/GUI/XLiveRendering.cpp rename to xlive/XLive/XAM/uithread.cpp index a4baa611d..c9c29dec3 100644 --- a/xlive/H2MOD/GUI/XLiveRendering.cpp +++ b/xlive/XLive/XAM/uithread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "XLiveRendering.h" +#include "uithread.h" #include "imgui.h" @@ -7,18 +7,17 @@ #include "H2MOD/GUI/ImGui_Integration/ImGui_Handler.h" #include "H2MOD/Modules/Input/KeyboardInput.h" -extern void initialize_instance(); - #ifndef IMGUI_DISABLE extern LRESULT IMGUI_IMPL_API ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); #endif static HWND H2hWnd; static D3DPRESENT_PARAMETERS g_d3dPresentParameters; -static IDirect3DDevice9Ex* g_xlive_d3d_device; -static CRITICAL_SECTION g_render_section; -void XLiveRendering::InitializeD3D9(D3DPRESENT_PARAMETERS* presentParameters) +IDirect3DDevice9Ex* g_xlive_d3d_device; +CRITICAL_SECTION g_render_section; + +void InitializeD3D9(D3DPRESENT_PARAMETERS* presentParameters) { InitializeCriticalSection(&g_render_section); @@ -29,7 +28,7 @@ void XLiveRendering::InitializeD3D9(D3DPRESENT_PARAMETERS* presentParameters) #endif } -void XLiveRendering::D3D9ReleaseResources() +void D3D9ReleaseResources() { #ifndef IMGUI_DISABLE ImGuiHandler::release_motd_texture(); @@ -37,43 +36,9 @@ void XLiveRendering::D3D9ReleaseResources() #endif } -// #5297: XLiveInitializeEx -int WINAPI XLiveInitializeEx(XLIVE_INITIALIZE_INFO* pXii, DWORD dwVersion) -{ - LOG_TRACE_XLIVE("XLiveInitializeEx()"); - - initialize_instance(); - - g_xlive_d3d_device = pXii->pD3D; - if (g_xlive_d3d_device) - { - XLiveRendering::InitializeD3D9((D3DPRESENT_PARAMETERS*)pXii->pD3DPP); - } - - LOG_TRACE_XLIVE("XLiveInitializeEx() - dwVersion = {0:x}", dwVersion); - return 0; -} - -// #5000: XLiveInitialize -HRESULT WINAPI XLiveInitialize(XLIVE_INITIALIZE_INFO* pXii) -{ - return XLiveInitializeEx(pXii, 0); -} - -// #5003: XLiveUninitialize -int WINAPI XLiveUninitialize() -{ - LOG_TRACE_XLIVE("XLiveUninitialize"); - - XLiveRendering::D3D9ReleaseResources(); - - DeleteCriticalSection(&g_render_section); - return 0; -} - // #5005: XLiveOnCreateDevice int WINAPI XLiveOnCreateDevice(IUnknown* pD3D, VOID* vD3DPP) -{ +{ //LOG_TRACE_XLIVE("XLiveOnCreateDevice (pD3D = %X, pD3DPP = %X)", pD3D, vD3DPP); return 0; } @@ -86,7 +51,7 @@ int WINAPI XLiveOnResetDevice(D3DPRESENT_PARAMETERS* pD3DPP) //Have to invalidate ImGUI on device reset, otherwise it hangs the device in a reset loop. //https://github.com/ocornut/imgui/issues/1464#issuecomment-347469716 - XLiveRendering::D3D9ReleaseResources(); + D3D9ReleaseResources(); //LOG_TRACE_XLIVE("XLiveOnResetDevice"); return 0; @@ -95,8 +60,8 @@ int WINAPI XLiveOnResetDevice(D3DPRESENT_PARAMETERS* pD3DPP) // #5006 XLiveOnDestroyDevice HRESULT WINAPI XLiveOnDestroyDevice() { - XLiveRendering::D3D9ReleaseResources(); - + D3D9ReleaseResources(); + //LOG_TRACE_XLIVE("XLiveOnDestroyDevice"); return S_OK; } @@ -117,7 +82,7 @@ int WINAPI XLiveInput(XLIVE_INPUT_INFO* pPii) // hotkeys KeyboardInput::ExecuteHotkey(pPii->wParam); } - + return S_OK; } @@ -138,7 +103,7 @@ HRESULT WINAPI XLiveRender() return E_UNEXPECTED; } - if (FAILED(g_xlive_d3d_device->TestCooperativeLevel())) + if (FAILED(g_xlive_d3d_device->TestCooperativeLevel())) { LeaveCriticalSection(&g_render_section); return E_UNEXPECTED; @@ -152,3 +117,5 @@ HRESULT WINAPI XLiveRender() return S_OK; } + + diff --git a/xlive/XLive/XAM/uithread.h b/xlive/XLive/XAM/uithread.h new file mode 100644 index 000000000..c1653b196 --- /dev/null +++ b/xlive/XLive/XAM/uithread.h @@ -0,0 +1,32 @@ +#pragma once + +/* structures */ + +typedef struct XLIVE_INPUT_INFO { + UINT cbSize; + HWND hWnd; + UINT uMSG; + WPARAM wParam; + LPARAM lParam; + BOOL fHandled; + LRESULT lRet; +} XLIVE_INPUT_INFO; + +/* prototypes */ + +void InitializeD3D9(D3DPRESENT_PARAMETERS* presentParameters); + +void D3D9ReleaseResources(); + +int WINAPI XLiveOnCreateDevice(IUnknown* pD3D, VOID* vD3DPP); + +int WINAPI XLiveOnResetDevice(D3DPRESENT_PARAMETERS* pD3DPP); + +HRESULT WINAPI XLiveOnDestroyDevice(); + + +/* globals */ + +extern IDirect3DDevice9Ex* g_xlive_d3d_device; + +extern CRITICAL_SECTION g_render_section; diff --git a/xlive/XLive/XAM/xam.cpp b/xlive/XLive/XAM/xam.cpp index f476cccdf..4d046892b 100644 --- a/xlive/XLive/XAM/xam.cpp +++ b/xlive/XLive/XAM/xam.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "xam.h" +#include "uithread.h" + /* structs */ struct NOTIFY_LISTEN @@ -20,6 +22,7 @@ int notify_xlive_ui = -1; /* public code */ + // #5270: XNotifyCreateListener HANDLE WINAPI XNotifyCreateListener(ULONGLONG qwAreas) { @@ -350,16 +353,41 @@ BOOL WINAPI XNotifyGetNext(HANDLE hNotification, DWORD dwMsgFilter, PDWORD pdwId return exit_code; } -// #652: XNotifyPositionUI -DWORD WINAPI XNotifyPositionUI(DWORD dwPosition) +// #5297: XLiveInitializeEx +int WINAPI XLiveInitializeEx(XLIVE_INITIALIZE_INFO* pXii, DWORD dwVersion) { - LOG_TRACE_XLIVE("XNotifyPositionUI ({})", dwPosition); + LOG_TRACE_XLIVE("XLiveInitializeEx()"); + + g_xlive_d3d_device = pXii->pD3D; + if (g_xlive_d3d_device) + { + InitializeD3D9((D3DPRESENT_PARAMETERS*)pXii->pD3DPP); + } + + LOG_TRACE_XLIVE("XLiveInitializeEx() - dwVersion = {0:x}", dwVersion); return 0; } -// #653 -int WINAPI XNotifyDelayUI(int a1) +// #5000: XLiveInitialize +HRESULT WINAPI XLiveInitialize(XLIVE_INITIALIZE_INFO* pXii) { - LOG_TRACE_XLIVE("XNotifyDelayUI"); + return XLiveInitializeEx(pXii, 0); +} + +// #5003: XLiveUninitialize +int WINAPI XLiveUninitialize() +{ + LOG_TRACE_XLIVE("XLiveUninitialize"); + + D3D9ReleaseResources(); + + DeleteCriticalSection(&g_render_section); + return 0; +} + +// #652: XNotifyPositionUI +DWORD WINAPI XNotifyPositionUI(DWORD dwPosition) +{ + LOG_TRACE_XLIVE("XNotifyPositionUI ({})", dwPosition); return 0; } diff --git a/xlive/XLive/XAM/xam.h b/xlive/XLive/XAM/xam.h index 9968fa993..f367e7f95 100644 --- a/xlive/XLive/XAM/xam.h +++ b/xlive/XLive/XAM/xam.h @@ -107,4 +107,19 @@ #define XN_PARTY_MEMBERS_CHANGED XNID(4, _XNAREA_PARTY, 0x0002) #define XN_PARTY_LAST XNID(XNID_CURRENTVERSION+1, _XNAREA_PARTY, 0x0006) -int WINAPI XNotifyDelayUI(int a1); + +typedef struct _XLIVE_INITIALIZE_INFO { + UINT cbSize; + DWORD dwFlags; + IDirect3DDevice9Ex* pD3D; + VOID* pD3DPP; + LANGID langID; + WORD wReserved1; + PCHAR pszAdapterName; + WORD wLivePortOverride; + WORD wReserved2; +} XLIVE_INITIALIZE_INFO; + +HRESULT WINAPI XLiveInitialize(XLIVE_INITIALIZE_INFO* pXii); + +int WINAPI XLiveOnResetDevice(D3DPRESENT_PARAMETERS* pD3DPP); diff --git a/xlive/XLive/XStorage/XStorage.cpp b/xlive/XLive/XStorage/XStorage.cpp index 39f2a445e..7be266b49 100644 --- a/xlive/XLive/XStorage/XStorage.cpp +++ b/xlive/XLive/XStorage/XStorage.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #include "XStorage.h" +#include + extern void Check_Overlapped(PXOVERLAPPED pOverlapped); // #5344: XStorageBuildServerPath diff --git a/xlive/XLive/XUser/XUserContext.cpp b/xlive/XLive/XUser/XUserContext.cpp index fbfaf970e..530ab36f1 100644 --- a/xlive/XLive/XUser/XUserContext.cpp +++ b/xlive/XLive/XUser/XUserContext.cpp @@ -16,7 +16,7 @@ DWORD WINAPI XUserGetContext(DWORD dwUserIndex, XUSER_CONTEXT* pContext, PXOVERL DWORD WINAPI XUserSetContext(DWORD dwUserIndex, DWORD dwContextId, DWORD dwContextValue) { LOG_TRACE_XLIVE("XUserSetContext (userIndex = {0}, contextId = {1}, contextValue = {2})", dwUserIndex, dwContextId, dwContextValue); - discord_interface_set_context((e_context_id)dwContextId, dwContextValue); + discord_interface_set_context(dwContextId, dwContextValue); return ERROR_SUCCESS; } diff --git a/xlive/XLive/achievements/XAchievements.cpp b/xlive/XLive/achievements/XAchievements.cpp index 5ae36b6fd..c76719a96 100644 --- a/xlive/XLive/achievements/XAchievements.cpp +++ b/xlive/XLive/achievements/XAchievements.cpp @@ -6,9 +6,29 @@ static DWORD achievementCount = 0; static DWORD achievementEnumeratorFlags = 0; static DWORD achievementEnumeratorIndex = 0; +static std::unordered_map AchievementMap; HANDLE g_dwFakeAchievementContent = INVALID_HANDLE_VALUE; +bool achievement_has_entry(void) +{ + return !AchievementMap.empty(); +} + +const char* achievement_get_first(void) +{ + auto it = AchievementMap.begin(); + const char* string = it->first.c_str(); + it->second = true; + return string; +} + +void achievement_pop_first(void) +{ + AchievementMap.erase(AchievementMap.begin()); + return; +} + // #5278: XUserWriteAchievements DWORD WINAPI XUserWriteAchievements(DWORD dwNumAchievements, PXUSER_ACHIEVEMENT pAchievement, PXOVERLAPPED pOverlapped) @@ -200,7 +220,6 @@ DWORD WINAPI XUserWriteAchievements(DWORD dwNumAchievements, PXUSER_ACHIEVEMENT default: AchievementData.append("Unknown|We're honestly not sure wtf? :"); - AchievementData.append(std::to_string(achievementID)); break; } diff --git a/xlive/XLive/achievements/XAchievements.h b/xlive/XLive/achievements/XAchievements.h index 0219c94b5..c92107107 100644 --- a/xlive/XLive/achievements/XAchievements.h +++ b/xlive/XLive/achievements/XAchievements.h @@ -1,4 +1,5 @@ #pragma once + extern HANDLE g_dwFakeAchievementContent; #define XACHIEVEMENT_TYPE_COMPLETION 1 @@ -47,4 +48,10 @@ typedef struct DWORD dwFlags; } XACHIEVEMENT_DETAILS, *PXACHIEVEMENT_DETAILS; +bool achievement_has_entry(void); + +const char* achievement_get_first(void); + +void achievement_pop_first(void); + int AchievementEnumerator(DWORD cbBuffer, CHAR* pvBuffer, PDWORD pcItemsReturned, XOVERLAPPED* pOverlapped); \ No newline at end of file diff --git a/xlive/XLive/stdafx.cpp b/xlive/XLive/stdafx.cpp new file mode 100644 index 000000000..fd4f341c7 --- /dev/null +++ b/xlive/XLive/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" diff --git a/xlive/XLive/stdafx.h b/xlive/XLive/stdafx.h new file mode 100644 index 000000000..925e4aa87 --- /dev/null +++ b/xlive/XLive/stdafx.h @@ -0,0 +1,67 @@ +#pragma once +#include "CartographerDllConf.h" + +/* c runtime */ + +#include +#include + +#include +#include +#include +#include +#include + +/* windows */ + +#ifdef _WIN32 + +#include + +#define WINVER 0x0601 +#define _WIN32_WINNT 0x0601 + +#include + +#define _WINSOCK_DEPRECATED_NO_WARNINGS + +#define _USE_MATH_DEFINES +#include + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#include +#include +#include +#include +#include + +#include +#include + +#pragma comment(lib, "IPHLPAPI.lib") + +#endif + +/* 3rd party */ + +#include + +#include +#include + +/* game includes */ + +#include "H2MOD/Modules/h2log/h2log.h" +#include "H2MOD/Utils/curl-interface.h" +#include "H2MOD/Utils/curl_constants.h" + +// TODO: remove these from here +#include "cseries/cseries.h" +#include "memory/static_arrays.h" + +// use this macro to define _time and _clock namespaces +#define STD_CHRONO_DEFINE_TIME_AND_CLOCK(_time_name, _clock_name) \ + namespace _time_name = std::chrono; \ + using _clock_name = std::chrono::steady_clock; \ + using namespace std::chrono_literals; diff --git a/xlive/XLive/xlive.cpp b/xlive/XLive/xlive.cpp new file mode 100644 index 000000000..6be689704 --- /dev/null +++ b/xlive/XLive/xlive.cpp @@ -0,0 +1,48 @@ +#include "stdafx.h" +#include "xlive.h" + +#include "H2MOD/Modules/Accounts/AccountLogin.h" + +// 5257: XLiveManageCredentials +HRESULT WINAPI XLiveManageCredentials(LPCWSTR lpszLiveIdName, LPCWSTR lpszLiveIdPassword, DWORD dwCredFlags, PXOVERLAPPED pXOverlapped) +{ + LOG_TRACE_XLIVE(L"XLiveManageCredentials (lpszLiveIdName = {}, lpszLiveIdPassword = {}, dwCredFlags = {:#x}, pXOverlapped = {:p})", + lpszLiveIdName, lpszLiveIdPassword, dwCredFlags, (void*)pXOverlapped); + + if (pXOverlapped) + { + pXOverlapped->InternalLow = ERROR_SUCCESS; + pXOverlapped->InternalHigh = 0; + pXOverlapped->dwExtendedError = 0; + } + + // not done - error now + return S_OK; +} + +// #5259: XLiveSignin +HRESULT WINAPI XLiveSignin(PWSTR pszLiveIdName, PWSTR pszLiveIdPassword, DWORD dwFlags, PXOVERLAPPED pOverlapped) +{ + LOG_TRACE_XLIVE("XLiveSignin() - signin in"); + + AccountDediLogin(pOverlapped); + + return S_OK; +} + +// #5258: XLiveSignout +HRESULT WINAPI XLiveSignout(PXOVERLAPPED pXOverlapped) +{ + LOG_TRACE_XLIVE("XLiveSignout"); + + XUserSignOut(0); + + if (pXOverlapped) + { + pXOverlapped->InternalLow = ERROR_SUCCESS; + pXOverlapped->InternalHigh = 0; + pXOverlapped->dwExtendedError = S_OK; + } + + return S_OK; +} \ No newline at end of file diff --git a/xlive/XLive/xlive.h b/xlive/XLive/xlive.h new file mode 100644 index 000000000..6f70f09be --- /dev/null +++ b/xlive/XLive/xlive.h @@ -0,0 +1 @@ +#pragma once diff --git a/xlive/xlive_exports.def b/xlive/XLive/xlive_exports.def similarity index 100% rename from xlive/xlive_exports.def rename to xlive/XLive/xlive_exports.def diff --git a/xlive/xlive_exports_debug.def b/xlive/XLive/xlive_exports_debug.def similarity index 100% rename from xlive/xlive_exports_debug.def rename to xlive/XLive/xlive_exports_debug.def diff --git a/xlive/xlivedefs.h b/xlive/XLive/xlivedefs.h similarity index 94% rename from xlive/xlivedefs.h rename to xlive/XLive/xlivedefs.h index ac0737dff..df3a83460 100644 --- a/xlive/xlivedefs.h +++ b/xlive/XLive/xlivedefs.h @@ -104,6 +104,10 @@ #define XSESSION_CREATE_JOIN_VIA_PRESENCE_FRIENDS_ONLY 0x00000800 // Session is only joinable via presence for friends of the host +#define XLOCATOR_SERVER_PAGE_MIN_ITEMS 50 +#define XLOCATOR_SERVER_PAGE_MAX_ITEMS_OLD 200 +#define XLOCATOR_SERVER_PAGE_MAX_ITEMS 2000 // Increased because we hit the limit + typedef struct { IN_ADDR ina; // IP address (zero if not static/DHCP) @@ -183,26 +187,6 @@ typedef struct DWORD dwNumProbeRepliesSent; // Number of probe replies sent } XNQOSLISTENSTATS; - -INT WINAPI XNetCleanup(); - -INT WINAPI XNetRandom(BYTE * pb, UINT cb); - -INT WINAPI XNetCreateKey(XNKID * pxnkid, XNKEY * pxnkey); -INT WINAPI XNetRegisterKey(const XNKID * pxnkid, const XNKEY * pxnkey); -INT WINAPI XNetUnregisterKey(const XNKID * pxnkid); -INT WINAPI XNetReplaceKey(const XNKID * pxnkidUnregister, const XNKID * pxnkidReplace); - -INT WINAPI XNetXnAddrToInAddr(const XNADDR * pxna, const XNKID * pxnkid, IN_ADDR * pina); -INT WINAPI XNetServerToInAddr(const IN_ADDR ina, DWORD dwServiceId, IN_ADDR * pina); -INT WINAPI XNetTsAddrToInAddr(const TSADDR * ptsa, DWORD dwServiceId, const XNKID * pxnkid, IN_ADDR * pina); -INT WINAPI XNetInAddrToXnAddr(const IN_ADDR ina, XNADDR * pxna, XNKID * pxnkid); -INT WINAPI XNetInAddrToServer(const IN_ADDR ina, IN_ADDR *pina); -INT WINAPI XNetInAddrToString(const IN_ADDR ina, char * pchBuf, INT cchBuf); -INT WINAPI XNetUnregisterInAddr(const IN_ADDR ina); -INT WINAPI XNetXnAddrToMachineId(const XNADDR * pxnaddr, ULONGLONG * pqwMachineId); - - #define XNET_XNADDR_PLATFORM_XBOX1 0x00000000 // Platform type is original Xbox #define XNET_XNADDR_PLATFORM_XBOX360 0x00000001 // Platform type is Xbox 360 #define XNET_XNADDR_PLATFORM_WINPC 0x00000002 // Platform type is Windows PC @@ -215,13 +199,6 @@ INT WINAPI XNetGetXnAddrPlatform(const XNADDR * pxnaddr, DWORD * pdwPlatform); #define XNET_CONNECT_STATUS_CONNECTED 0x00000002 // Connection is established #define XNET_CONNECT_STATUS_LOST 0x00000003 // Connection was lost -INT WINAPI XNetConnect(const IN_ADDR ina); -INT WINAPI XNetGetConnectStatus(const IN_ADDR ina); - - -INT WINAPI XNetDnsLookup(const char * pszHost, WSAEVENT hEvent, XNDNS ** ppxndns); -INT WINAPI XNetDnsRelease(XNDNS * pxndns); - #define XNET_GET_XNADDR_PENDING 0x00000000 // Address acquisition is not yet complete #define XNET_GET_XNADDR_NONE 0x00000001 // XNet is uninitialized or no debugger found #define XNET_GET_XNADDR_ETHERNET 0x00000002 // Host has ethernet address (no IP address) diff --git a/xlive/xliveless.cpp b/xlive/XLive/xliveless.cpp similarity index 100% rename from xlive/xliveless.cpp rename to xlive/XLive/xliveless.cpp diff --git a/xlive/xliveless.h b/xlive/XLive/xliveless.h similarity index 83% rename from xlive/xliveless.h rename to xlive/XLive/xliveless.h index 2e4bc2f2e..3c366d063 100644 --- a/xlive/xliveless.h +++ b/xlive/XLive/xliveless.h @@ -9,10 +9,6 @@ #define SAFE_FREE(p) { if(p) { free(p); (p)=NULL; } } #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } #define ARRAYOF(x) (sizeof(x)/sizeof(*x)) -#define STRINGIFY(x) #x -#define TOSTRING(x) STRINGIFY(x) #define BYTESOF(a, b) ((a) * sizeof(b)) -extern HMODULE hThis; - #endif diff --git a/xlive/XLive/xlivelib.vcxproj b/xlive/XLive/xlivelib.vcxproj new file mode 100644 index 000000000..9a897f6d4 --- /dev/null +++ b/xlive/XLive/xlivelib.vcxproj @@ -0,0 +1,263 @@ + + + + + debug_msvc + Win32 + + + release_min_msvc + Win32 + + + release_msvc + Win32 + + + + 18.0 + Win32Proj + {8329696B-F8D4-4DB5-97AC-E863B07B0FBA} + xlivelib + 10.0.26100.0 + + + + StaticLibrary + true + v143 + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + StaticLibrary + false + v143 + true + Unicode + x64 + + + + + + + + + + + + + + + + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\objects\$(Configuration)\$(ProjectName)\ + $(ProjectName)$(Platform)$(Configuration) + $(DXSDK_DIR)Include;$(ExternalIncludePath) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + + + + Disabled + WIN32;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;_DEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ASSERTS_ENABLED;EVENTS_ENABLED;ERRORS_ENABLED;DEBUG_MEMORY_ENABLED;RASTERIZER_PROFILE_ENABLED;VALIDATE_REAL_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;DEBUG_MENU_ENABLED;HS_COMPILER_ENABLED;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions) + false + Default + MultiThreadedDebug + true + $(IntDir)xlivelib.pch + $(IntDir) + $(IntDir) + Level4 + false + EditAndContinue + ..\3rdparty;..\3rdparty\imgui\imgui;..\3rdparty\libcurl;..\3rdparty\miniupnpc\include;..\3rdparty\spdlog\include;.\;..\;..\Blam\Engine + Use + true + false + Sync + 4505;4100;4201 + + + stdcpp17 + StreamingSIMDExtensions2 + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + true + false + 4700 + Fast + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;TERMINAL_ENABLED;ERRORS_ENABLED;EVENTS_ENABLED;OBJECT_OVERRIDE_ENABLED;OBJECT_DEBUG;UI_DEBUG;HS_COMPILER_ENABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)xlivelib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\3rdparty;..\3rdparty\imgui\imgui;..\3rdparty\libcurl;..\3rdparty\miniupnpc\include;..\3rdparty\spdlog\include;.\;..\;..\Blam\Engine + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + + + MaxSpeed + AnySuitable + true + Speed + true + WIN32;MINIUPNP_STATICLIB;NGHTTP2_STATICLIB;CURL_STATICLIB;NDEBUG;_WINDOWS;_USRDLL;IMGUI_DISABLE;SPDLOG_DISABLED;%(PreprocessorDefinitions) + true + MultiThreaded + true + StreamingSIMDExtensions2 + true + $(IntDir)xlivelib.pch + $(IntDir) + $(IntDir) + Level4 + false + ..\3rdparty;..\3rdparty\imgui\imgui;..\3rdparty\libcurl;..\3rdparty\miniupnpc\include;..\3rdparty\spdlog\include;.\;..\;..\Blam\Engine + true + false + true + 4505;4100;4201 + Sync + true + Use + false + + + stdcpp17 + Fast + /DPSAPI_VERSION=1 /utf-8 %(AdditionalOptions) + true + true + 4700 + stdafx.h + false + + + + + + + + + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xlive/XLive/xlivelib.vcxproj.filters b/xlive/XLive/xlivelib.vcxproj.filters new file mode 100644 index 000000000..5ceb414bc --- /dev/null +++ b/xlive/XLive/xlivelib.vcxproj.filters @@ -0,0 +1,218 @@ + + + + + H2MOD\Modules\h2log + + + xlive + + + xlive + + + xlive + + + xlive\ServerList + + + xlive\Cryptography + + + xlive\achievements + + + xlive\Voice + + + xlive\XAM + + + xlive\XAM + + + xlive\XAM + + + xlive\xbox + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet\Sockets + + + xlive\xnet\IpManagement + + + xlive\XSession + + + xlive\XStorage + + + xlive\XUser + + + xlive\XUser + + + xlive\XUser + + + xlive\XUser + + + + + H2MOD\Modules\h2log + + + xlive + + + xlive + + + xlive + + + xlive + + + xlive\ServerList + + + xlive\Cryptography + + + xlive\achievements + + + xlive\Voice + + + xlive\XAM + + + xlive\XAM + + + xlive\XAM + + + xlive\xbox + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet + + + xlive\xnet\Sockets + + + xlive\xnet\IpManagement + + + xlive\XSession + + + xlive\XStorage + + + xlive\XUser + + + xlive\XUser + + + xlive\XUser + + + xlive\XUser + + + + + xlive + + + xlive + + + + + {8e002223-e530-4f53-b783-b4596e32b376} + + + {f534d894-5e53-4c53-9ce6-d66ea9da3820} + + + {4b987489-4a0d-46f3-962d-acf3e581fe5e} + + + {35f21df1-f855-492b-a106-82e51b3d2ae1} + + + {24f4ec0c-fc5b-47fe-a8aa-54305443e044} + + + {8a4b41ff-32a0-4e25-93f2-980b1b66a490} + + + {6390c75d-f004-4043-b0ac-4b5c9dc8b4c4} + + + {c779b558-c5fa-4fa4-8c73-2e7edd6b806f} + + + {2dee9268-8ec9-4240-b79c-4d9c881aec65} + + + {17ff870b-a041-46b0-90f8-b2abe66e4eb5} + + + {ff0a40ab-ca94-41a2-ac58-16c2062ef438} + + + {2cb295a5-4879-4223-bdd9-82313517a098} + + + {9e06a581-4c06-445a-b649-06284f7d560f} + + + {40cf4065-c376-4606-bc94-1022ddb53354} + + + {9303eb66-809d-432f-9b15-b41a9ffb050e} + + + {12a8a9cf-6d3e-46ac-97e4-7ae1a5203844} + + + \ No newline at end of file diff --git a/xlive/XLive/xnet/IpManagement/XnIp.cpp b/xlive/XLive/xnet/IpManagement/XnIp.cpp index 8bb3ea93c..46f41980a 100644 --- a/xlive/XLive/xnet/IpManagement/XnIp.cpp +++ b/xlive/XLive/xnet/IpManagement/XnIp.cpp @@ -1,15 +1,39 @@ #include "stdafx.h" #include "XnIp.h" -#include "H2MOD/GUI/imgui_integration/Console/CommandHandler.h" #include "H2MOD/Utils/Utils.h" #include "XLive/Cryptography/Rc4.h" +#include "Xlive/xnet/Sockets/XSocket.h" #include "XLive/xnet/NIC.h" #include "XLive/xnet/net_utils.h" TEST_N_DEF(XL1); +#pragma region NAT handling + +/* forward declarations */ + +typedef int(__cdecl TextOutputCb)(int strFlags, const char* fmt, ...); + +// TODO: currently we use multiple system sockets +// to send data to the corresponding virtual socket +// when in practice we could just use one +struct PortMapping +{ + enum class PortMapState : int + { + XNIP_NET_ADDRESS_MAPPINGS_UNAVAILABLE, + XNIP_NET_ADDRESS_MAP_AVAILABLE, + }; + + PortMapState state; + sockaddr_in address; + WORD virtualPort; +}; + +#pragma endregion + XnIpManager gXnIpMgr; // local user xbox network address @@ -17,6 +41,83 @@ XnIp XnIpManager::m_ipLocal; XECRYPT_RC4_STATE gRc4StateRand; +XBroadcastPacket::XBroadcastPacket() +{ + pckHeader.signature = EXNIP_PACKET_SIGNATURE_XNET_BROADCAST; + strncpy_s(pckHeader.signatureString, XNIP_BROADCAST_HEADER_STR, XNIP_MAX_PCK_STR_HDR_LEN); + ZeroMemory(&data, sizeof(data)); + data.titleId = (DWORD)-1; + data.name.sin_addr.s_addr = htonl(INADDR_BROADCAST); +}; + + +void XnIpPckTransportStats::PckDataSampleUpdate() +{ + if (!initialized) + { + initialized = true; + pckSent = 0; + pckRecvd = 0; + pckBytesSent = 0; + pckBytesRecvd = 0; + + pckSentPerSecIdx = 0; + pckRecvdPerSecIdx = 0; + pckCurrentSendPerSecIdx = -1; + pckCurrentRecvdPerSecIdx = -1; + + memset(pckSentPerSec, 0, sizeof(pckSentPerSec)); + memset(pckRecvdPerSec, 0, sizeof(pckRecvdPerSec)); + + lastTimeUpdate = timeGetTime(); + } + else + { + const ULONGLONG sample_end_time = 1ull * 1000ull; + + if (timeGetTime() - lastTimeUpdate >= sample_end_time) + { + pckSentPerSecIdx = (pckSentPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; + pckRecvdPerSecIdx = (pckRecvdPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; + + pckSentPerSec[pckSentPerSecIdx] = 0; + pckBytesSentPerSec[pckSentPerSecIdx] = 0; + + pckRecvdPerSec[pckRecvdPerSecIdx] = 0; + pckBytesRecvdPerSec[pckRecvdPerSecIdx] = 0; + + pckCurrentSendPerSecIdx = (pckCurrentSendPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; + pckCurrentRecvdPerSecIdx = (pckCurrentRecvdPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; + + lastTimeUpdate = timeGetTime(); + } + } +} + +void XnIpPckTransportStats::PckSendStatsUpdate(unsigned int _pckXmit, unsigned int _pckXmitBytes) +{ + PckDataSampleUpdate(); + + pckSent += _pckXmit; + pckBytesSent += _pckXmitBytes; + + pckSentPerSec[pckSentPerSecIdx] += _pckXmit; + pckBytesSentPerSec[pckSentPerSecIdx] += _pckXmitBytes; +} + +void XnIpPckTransportStats::PckRecvdStatsUpdate(unsigned int _pckRecvd, unsigned int _pckRecvdBytes) +{ + PckDataSampleUpdate(); + + pckRecvd += _pckRecvd; + pckBytesRecvd += _pckRecvdBytes; + + pckRecvdPerSec[pckRecvdPerSecIdx] += _pckRecvd; + pckBytesRecvdPerSec[pckRecvdPerSecIdx] += _pckRecvdBytes; + + lastPacketReceivedTime = timeGetTime(); +} + void XnIpManager::Initialize(const XNetStartupParams* netStartupParams) { memcpy(&m_startupParams, netStartupParams, sizeof(XNetStartupParams)); @@ -81,14 +182,14 @@ void XnIpManager::LogConnectionsToConsole(TextOutputCb* outputCb) const const char* err_message = "cannot log XNet connections when no keys are registered (you need to host/be in a game)"; LOG_CRITICAL_NETWORK(err_message); if (outputCb) - outputCb(StringFlag_None, "# %s", err_message); + outputCb(0, "# %s", err_message); return; } const char* xnet_connections_str = "XNet connections: "; LOG_CRITICAL_NETWORK(xnet_connections_str); if (outputCb) - outputCb(StringFlag_None, "# %s", xnet_connections_str); + outputCb(0, "# %s", xnet_connections_str); for (int i = 0; i < GetMaxXnConnections(); i++) { @@ -112,13 +213,13 @@ void XnIpManager::LogConnectionsToConsole(TextOutputCb* outputCb) const } if (outputCb) - outputCb(StringFlag_None, "# %s", logString.c_str()); + outputCb(0, "# %s", logString.c_str()); } } LOG_CRITICAL_NETWORK("available XnIp connection slots: {}", GetMaxXnConnections()); if (outputCb) - outputCb(StringFlag_None, "# available XnIp connection slots: %d", GetMaxXnConnections()); + outputCb(0, "# available XnIp connection slots: %d", GetMaxXnConnections()); } #endif @@ -184,6 +285,16 @@ void XnIpManager::LogConnectionsErrorDetails(const sockaddr_in* address, int err } } +int XnIpManager::GetMinSockRecvBufferSizeInBytes() const +{ + return m_startupParams.cfgSockDefaultRecvBufsizeInK * SOCK_K_UNIT; +} +int XnIpManager::GetMinSockSendBufferSizeInBytes() const +{ + return m_startupParams.cfgSockDefaultSendBufsizeInK * SOCK_K_UNIT; +} + + int XnIpManager::HandleRecvdPacket(XVirtualSocket* xsocket, sockaddr_in* lpFrom, WSABUF* lpBuffers, DWORD dwBufferCount, LPDWORD lpBytesRecvdCount) { // check first if the packet received has the size bigger or equal to the XNet packet header first @@ -762,6 +873,30 @@ int XnIp::GetConnectionIndex(IN_ADDR connectionId) return (int)(connectionId.s_addr >> 24); } +bool XnIp::IsValid(IN_ADDR identifier) const +{ + bool valid = m_valid + && identifier.s_addr == GetConnectionId().s_addr; + + if (!valid) + { + LOG_CRITICAL_NETWORK("{} - m_valid: {} or {:X} != {:X}", __FUNCTION__, m_valid, identifier.s_addr, GetConnectionId().s_addr); + return false; + } + + return valid; +} + +void XnIp::UpdateInteractionTimeHappened() +{ + m_lastConnectionInteractionTime = timeGetTime(); +} + +bool XnIp::ConnectionTimedOut() const +{ + return timeGetTime() - m_lastConnectionInteractionTime >= XnIp_ConnectionTimeOut; +} + void XnIp::SavePortMapping(XVirtualSocket* xsocket, WORD virtualPort, const sockaddr_in* addr) const { LOG_TRACE_NETWORK("{} - socket: {}, connection index: {}, identifier: {:X}", __FUNCTION__, @@ -796,6 +931,91 @@ void XnIp::SendXNetRequestAllSockets(eXnip_ConnectRequestType reqType) return; } +void XnIp::InsertPortMapping(PortMapping* mapping) +{ + PortMapping* pMap = (PortMapping*)malloc(sizeof(*mapping)); + memcpy(pMap, mapping, sizeof(*pMap)); + m_netAddrMappings.insert(pMap); +} + +const sockaddr_in* XnIp::GetPortMapping(WORD virtualPort) const +{ + NetElement* elem = m_netAddrMappings.first(); + while (elem) + { + PortMapping* mapping = (PortMapping*)elem->data; + if (mapping->virtualPort == virtualPort) + { + return &mapping->address; + } + + elem = elem->next; + } + + return NULL; +} + +void XnIp::UpdatePortMapping(WORD virtualPort, const sockaddr_in* addr) const +{ + NetElement* elem = m_netAddrMappings.first(); + while (elem) + { + PortMapping* mapping = (PortMapping*)elem->data; + if (mapping->virtualPort == virtualPort) + { + mapping->state = PortMapping::PortMapState::XNIP_NET_ADDRESS_MAP_AVAILABLE; + memcpy(&mapping->address, addr, sizeof(mapping->address)); + break; + } + + elem = elem->next; + } +} + +bool XnIp::PortMappingAvailable(WORD virtualPort) const +{ + NetElement* elem = m_netAddrMappings.first(); + + bool result = false; + while (elem) + { + PortMapping* mapping = (PortMapping*)elem->data; + if (mapping->virtualPort == virtualPort + && mapping->state == PortMapping::PortMapState::XNIP_NET_ADDRESS_MAP_AVAILABLE) + { + return true; + } + + elem = elem->next; + } + + return result; +} + +bool XnIp::PortMappingsAvailable() const +{ + NetElement* elem = m_netAddrMappings.first(); + + bool result = true; + if (!elem) + { + return false; + } + + while (elem) + { + PortMapping* mapping = (PortMapping*)elem->data; + if (mapping->state != PortMapping::PortMapState::XNIP_NET_ADDRESS_MAP_AVAILABLE) + { + return false; + } + + elem = elem->next; + } + + return result; +} + void XnIp::SendXNetRequest(XVirtualSocket* xsocket, eXnip_ConnectRequestType reqType) { sockaddr_in sendToAddr; diff --git a/xlive/XLive/xnet/IpManagement/XnIp.h b/xlive/XLive/xnet/IpManagement/XnIp.h index ccb6dcb77..e8a7db7ec 100644 --- a/xlive/XLive/xnet/IpManagement/XnIp.h +++ b/xlive/XLive/xnet/IpManagement/XnIp.h @@ -1,8 +1,6 @@ #pragma once #include "../xnet.h" -#include "../Sockets/XSocket.h" - #include "../net_utils.h" @@ -47,26 +45,6 @@ enum eXnIp_ConnectionRequestBitFlags XnIp_HasPortMappingsUpdated = 0, }; -#pragma region NAT handling - -// TODO: currently we use multiple system sockets -// to send data to the corresponding virtual socket -// when in practice we could just use one -struct PortMapping -{ - enum class PortMapState : int - { - XNIP_NET_ADDRESS_MAPPINGS_UNAVAILABLE, - XNIP_NET_ADDRESS_MAP_AVAILABLE, - }; - - PortMapState state; - sockaddr_in address; - WORD virtualPort; -}; - -#pragma endregion - struct XNetPacketHeader { DWORD signature; @@ -75,14 +53,7 @@ struct XNetPacketHeader struct XBroadcastPacket { - XBroadcastPacket() - { - pckHeader.signature = EXNIP_PACKET_SIGNATURE_XNET_BROADCAST; - strncpy_s(pckHeader.signatureString, XNIP_BROADCAST_HEADER_STR, XNIP_MAX_PCK_STR_HDR_LEN); - ZeroMemory(&data, sizeof(data)); - data.titleId = (DWORD)-1; - data.name.sin_addr.s_addr = htonl(INADDR_BROADCAST); - }; + XBroadcastPacket(); XNetPacketHeader pckHeader; struct @@ -148,72 +119,11 @@ struct XnIpPckTransportStats ULONGLONG lastPacketReceivedTime; - void PckDataSampleUpdate() - { - if (!initialized) - { - initialized = true; - pckSent = 0; - pckRecvd = 0; - pckBytesSent = 0; - pckBytesRecvd = 0; - - pckSentPerSecIdx = 0; - pckRecvdPerSecIdx = 0; - pckCurrentSendPerSecIdx = -1; - pckCurrentRecvdPerSecIdx = -1; - - memset(pckSentPerSec, 0, sizeof(pckSentPerSec)); - memset(pckRecvdPerSec, 0, sizeof(pckRecvdPerSec)); - - lastTimeUpdate = timeGetTime(); - } - else - { - const ULONGLONG sample_end_time = 1ull * 1000ull; - - if (timeGetTime() - lastTimeUpdate >= sample_end_time) - { - pckSentPerSecIdx = (pckSentPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; - pckRecvdPerSecIdx = (pckRecvdPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; + void PckDataSampleUpdate(); - pckSentPerSec[pckSentPerSecIdx] = 0; - pckBytesSentPerSec[pckSentPerSecIdx] = 0; + void PckSendStatsUpdate(unsigned int _pckXmit, unsigned int _pckXmitBytes); - pckRecvdPerSec[pckRecvdPerSecIdx] = 0; - pckBytesRecvdPerSec[pckRecvdPerSecIdx] = 0; - - pckCurrentSendPerSecIdx = (pckCurrentSendPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; - pckCurrentRecvdPerSecIdx = (pckCurrentRecvdPerSecIdx + 1) % XNIP_MAX_NET_STATS_SAMPLES; - - lastTimeUpdate = timeGetTime(); - } - } - } - - void PckSendStatsUpdate(unsigned int _pckXmit, unsigned int _pckXmitBytes) - { - PckDataSampleUpdate(); - - pckSent += _pckXmit; - pckBytesSent += _pckXmitBytes; - - pckSentPerSec[pckSentPerSecIdx] += _pckXmit; - pckBytesSentPerSec[pckSentPerSecIdx] += _pckXmitBytes; - } - - void PckRecvdStatsUpdate(unsigned int _pckRecvd, unsigned int _pckRecvdBytes) - { - PckDataSampleUpdate(); - - pckRecvd += _pckRecvd; - pckBytesRecvd += _pckRecvdBytes; - - pckRecvdPerSec[pckRecvdPerSecIdx] += _pckRecvd; - pckBytesRecvdPerSec[pckRecvdPerSecIdx] += _pckRecvdBytes; - - lastPacketReceivedTime = timeGetTime(); - } + void PckRecvdStatsUpdate(unsigned int _pckRecvd, unsigned int _pckRecvdBytes); private: ULONGLONG lastTimeUpdate; @@ -291,25 +201,6 @@ struct XnIp return m_xnaddr.ina; } - bool IsValid(IN_ADDR identifier) const - { - bool valid = m_valid - && identifier.s_addr == GetConnectionId().s_addr; - - if (!valid) - { - LOG_CRITICAL_NETWORK("{} - m_valid: {} or {:X} != {:X}", __FUNCTION__, m_valid, identifier.s_addr, GetConnectionId().s_addr); - return false; - } - - return valid; - } - - void UpdateInteractionTimeHappened() - { - m_lastConnectionInteractionTime = timeGetTime(); - } - IN_ADDR GetConnectionId() const { return m_connectionId; @@ -350,108 +241,34 @@ struct XnIp return GetConnectStatus() == XNET_CONNECT_STATUS_LOST; } - bool ConnectionTimedOut() const - { - return timeGetTime() - m_lastConnectionInteractionTime >= XnIp_ConnectionTimeOut; - } - static int GetConnectionIndex(IN_ADDR connectionId); - void SavePortMapping(XVirtualSocket* xsocket, WORD virtualPort, const sockaddr_in* addr) const; - void HandleConnectionPacket(XVirtualSocket* xsocket, const XNetRequestPacket* reqPacket, const sockaddr_in* recvAddr, LPDWORD lpBytesRecvdCount); - void HandleDisconnectPacket(XVirtualSocket* xsocket, const XNetRequestPacket* disconnectReqPck, const sockaddr_in* recvAddr) const; // TODO: + bool IsValid(IN_ADDR identifier) const; + + void UpdateInteractionTimeHappened(); + + bool ConnectionTimedOut() const; + + void SavePortMapping(struct XVirtualSocket* xsocket, WORD virtualPort, const struct sockaddr_in* addr) const; + void HandleConnectionPacket(struct XVirtualSocket* xsocket, const XNetRequestPacket* reqPacket, const struct sockaddr_in* recvAddr, LPDWORD lpBytesRecvdCount); + void HandleDisconnectPacket(struct XVirtualSocket* xsocket, const XNetRequestPacket* disconnectReqPck, const struct sockaddr_in* recvAddr) const; // TODO: void UpdateNonceKeyFromPacket(const XNetRequestPacket* reqPacket); /* sends a request over the socket to the other socket end, with the same identifier */ - void SendXNetRequest(XVirtualSocket* xsocket, eXnip_ConnectRequestType reqType); + void SendXNetRequest(struct XVirtualSocket* xsocket, eXnip_ConnectRequestType reqType); /* sends a request to all open sockets */ void SendXNetRequestAllSockets(eXnip_ConnectRequestType reqType); - void InsertPortMapping(PortMapping* mapping) - { - PortMapping* pMap = (PortMapping*)malloc(sizeof(*mapping)); - memcpy(pMap, mapping, sizeof(*pMap)); - m_netAddrMappings.insert(pMap); - } - - const sockaddr_in* GetPortMapping(WORD virtualPort) const - { - NetElement* elem = m_netAddrMappings.first(); - while (elem) - { - PortMapping* mapping = (PortMapping*)elem->data; - if (mapping->virtualPort == virtualPort) - { - return &mapping->address; - } - - elem = elem->next; - } - - return NULL; - } + void InsertPortMapping(struct PortMapping* mapping); - void UpdatePortMapping(WORD virtualPort, const sockaddr_in* addr) const - { - NetElement* elem = m_netAddrMappings.first(); - while (elem) - { - PortMapping* mapping = (PortMapping*)elem->data; - if (mapping->virtualPort == virtualPort) - { - mapping->state = PortMapping::PortMapState::XNIP_NET_ADDRESS_MAP_AVAILABLE; - memcpy(&mapping->address, addr, sizeof(mapping->address)); - break; - } + const struct sockaddr_in* GetPortMapping(WORD virtualPort) const; - elem = elem->next; - } - } + void UpdatePortMapping(WORD virtualPort, const struct sockaddr_in* addr) const; - bool PortMappingAvailable(WORD virtualPort) const - { - NetElement* elem = m_netAddrMappings.first(); + bool PortMappingAvailable(WORD virtualPort) const; - bool result = false; - while (elem) - { - PortMapping* mapping = (PortMapping*)elem->data; - if (mapping->virtualPort == virtualPort - && mapping->state == PortMapping::PortMapState::XNIP_NET_ADDRESS_MAP_AVAILABLE) - { - return true; - } - - elem = elem->next; - } - - return result; - } - - bool PortMappingsAvailable() const - { - NetElement* elem = m_netAddrMappings.first(); - - bool result = true; - if (!elem) - { - return false; - } - - while (elem) - { - PortMapping* mapping = (PortMapping*)elem->data; - if (mapping->state != PortMapping::PortMapState::XNIP_NET_ADDRESS_MAP_AVAILABLE) - { - return false; - } - - elem = elem->next; - } - - return result; - } + bool PortMappingsAvailable() const; void DiscardPortMappings() { @@ -480,14 +297,14 @@ class XnIpManager // Connection data getters XnIp* GetConnection(const IN_ADDR ina) const; - int GetEstablishedConnectionIdentifierByRecvAddr(XVirtualSocket* xsocket, const sockaddr_in* addr, IN_ADDR* outConnectionIdentifier) const; + int GetEstablishedConnectionIdentifierByRecvAddr(struct XVirtualSocket* xsocket, const struct sockaddr_in* addr, IN_ADDR* outConnectionIdentifier) const; // Miscellaneous void ClearLostConnections(); // local network address static XnIp* GetLocalUserXn(); - static u_short GetQoSPort(); + static unsigned short GetQoSPort(); static void UnregisterLocalConnectionInfo(); static void SetupLocalConnectionInfo(unsigned long xnaddr, unsigned long lanaddr, unsigned short baseport, const char* machineUID, const char* abOnline); @@ -496,9 +313,9 @@ class XnIpManager void UpdatePacketReceivedCounters(IN_ADDR ipIdentifier, unsigned int bytesRecvdCount) const; // Packet handlers - int HandleRecvdPacket(XVirtualSocket* xsocket, sockaddr_in* lpFrom, WSABUF* lpBuffers, DWORD dwBufferCount, LPDWORD bytesRecvdCount); - void HandleXNetRequestPacket(XVirtualSocket* xsocket, const XNetRequestPacket* reqPaket, const sockaddr_in* recvAddr, LPDWORD lpBytesRecvdCount); - void HandleDisconnectPacket(XVirtualSocket* xsocket, const XNetRequestPacket* disconnectReqPck, const sockaddr_in* recvAddr) const; + int HandleRecvdPacket(struct XVirtualSocket* xsocket, sockaddr_in* lpFrom, WSABUF* lpBuffers, DWORD dwBufferCount, LPDWORD bytesRecvdCount); + void HandleXNetRequestPacket(struct XVirtualSocket* xsocket, const XNetRequestPacket* reqPaket, const struct sockaddr_in* recvAddr, LPDWORD lpBytesRecvdCount); + void HandleDisconnectPacket(struct XVirtualSocket* xsocket, const XNetRequestPacket* disconnectReqPck, const struct sockaddr_in* recvAddr) const; // XnIp handling function XnIp* XnIpLookup(const XNADDR* pxna, const XNKID* xnkid) const; @@ -521,8 +338,8 @@ class XnIpManager int GetMaxXnConnections() const { return m_startupParams.cfgSecRegMax; } int GetReqQoSBufferSize() const { return m_startupParams.cfgQosDataLimitDiv4 * 4; } int GetMaxXnKeyPairs() const { return m_startupParams.cfgKeyRegMax; } - int GetMinSockRecvBufferSizeInBytes() const { return m_startupParams.cfgSockDefaultRecvBufsizeInK * SOCK_K_UNIT; } - int GetMinSockSendBufferSizeInBytes() const { return m_startupParams.cfgSockDefaultSendBufsizeInK * SOCK_K_UNIT; } + int GetMinSockRecvBufferSizeInBytes() const; + int GetMinSockSendBufferSizeInBytes() const; int GetRegisteredKeyCount() const { diff --git a/xlive/XLive/xnet/Sockets/XSocket.cpp b/xlive/XLive/xnet/Sockets/XSocket.cpp index c2c88e747..fb79a5ce4 100644 --- a/xlive/XLive/xnet/Sockets/XSocket.cpp +++ b/xlive/XLive/xnet/Sockets/XSocket.cpp @@ -921,6 +921,16 @@ int XVirtualSocket::SetBufferSize(int optname, INT bufSize) return 0; } +bool XVirtualSocket::SockAddrInEqual(const sockaddr_in* a1, const sockaddr_in* a2) +{ + return (a1->sin_addr.s_addr == a2->sin_addr.s_addr && a1->sin_port == a2->sin_port); +} + +bool XVirtualSocket::SockAddrInInvalid(const sockaddr_in* a1) +{ + return a1->sin_addr.s_addr == 0 || a1->sin_port == 0; +} + int XVirtualSocket::UdpSend(const char* buf, int len, int flags, sockaddr* to, int tolen) { return XSocketSendTo((SOCKET)this, buf, len, flags, to, tolen); @@ -938,6 +948,30 @@ void XSocketManager::SocketsDisposeAll() MainLinkDispose(); } +void XSocketManager::XInternalSocket::Dispose() +{ + if (m_systemSockHandle != INVALID_SOCKET) + { + if (m_multicast) + { + ip_mreq mreq; + + // localhost only + mreq.imr_interface.s_addr = htonl(INADDR_LOOPBACK); + mreq.imr_multiaddr.s_addr = htonl(XSOCK_MUTICAST_ADDR); + + setsockopt( + m_systemSockHandle, IPPROTO_IP, IP_DROP_MEMBERSHIP, (char*)&mreq, sizeof(mreq) + ); + } + + closesocket(m_systemSockHandle); + + } + m_systemSockHandle = INVALID_SOCKET; + m_port = 0; +} + void XSocketManager::Initialize() { } @@ -1083,4 +1117,9 @@ bool XSocketManager::MainLinkSocketReset(WORD port) void XSocketManager::MainLinkDispose() { m_mainUdpSocket.Dispose(); -} \ No newline at end of file +} + +SOCKET XSocketManager::GetMainUdpSocketSystemHandle() const +{ + return m_mainUdpSocket.m_systemSockHandle; +} diff --git a/xlive/XLive/xnet/Sockets/XSocket.h b/xlive/XLive/xnet/Sockets/XSocket.h index 4243709e2..434c66868 100644 --- a/xlive/XLive/xnet/Sockets/XSocket.h +++ b/xlive/XLive/xnet/Sockets/XSocket.h @@ -42,29 +42,7 @@ class XSocketManager SOCKET m_systemSockHandle = INVALID_SOCKET; bool m_multicast; - void Dispose() - { - if (m_systemSockHandle != INVALID_SOCKET) - { - if (m_multicast) - { - ip_mreq mreq; - - // localhost only - mreq.imr_interface.s_addr = htonl(INADDR_LOOPBACK); - mreq.imr_multiaddr.s_addr = htonl(XSOCK_MUTICAST_ADDR); - - setsockopt( - m_systemSockHandle, IPPROTO_IP, IP_DROP_MEMBERSHIP, (char*)&mreq, sizeof(mreq) - ); - } - - closesocket(m_systemSockHandle); - - } - m_systemSockHandle = INVALID_SOCKET; - m_port = 0; - } + void Dispose(); ~XInternalSocket() { @@ -87,10 +65,7 @@ class XSocketManager bool MainLinkSocketReset(WORD port); void MainLinkDispose(); - SOCKET GetMainUdpSocketSystemHandle() const - { - return m_mainUdpSocket.m_systemSockHandle; - } + SOCKET GetMainUdpSocketSystemHandle() const; bool CreateSocketUDP(XInternalSocket* sock, unsigned long interfaceAddress, WORD port, bool multicast, bool allow_address_reuse); @@ -167,15 +142,9 @@ struct XVirtualSocket /* sets the socket send/recv buffer size */ int SetBufferSize(int optName, INT bufSize); - static bool SockAddrInEqual(const sockaddr_in* a1, const sockaddr_in* a2) - { - return (a1->sin_addr.s_addr == a2->sin_addr.s_addr && a1->sin_port == a2->sin_port); - } + static bool SockAddrInEqual(const sockaddr_in* a1, const sockaddr_in* a2); - static bool SockAddrInInvalid(const sockaddr_in* a1) - { - return a1->sin_addr.s_addr == 0 || a1->sin_port == 0; - } + static bool SockAddrInInvalid(const sockaddr_in* a1); int UdpSend(const char* buf, int len, int flags, sockaddr *to, int tolen); diff --git a/xlive/XLive/xnet/XNetQoS.cpp b/xlive/XLive/xnet/XNetQoS.cpp index d1b0640a9..328d2adbf 100644 --- a/xlive/XLive/xnet/XNetQoS.cpp +++ b/xlive/XLive/xnet/XNetQoS.cpp @@ -1,8 +1,10 @@ #include "stdafx.h" #include "XNetQoS.h" +#include +#include +#include #include -#include #include "IpManagement/XnIp.h" static CXNetQoS XNetQoS; diff --git a/xlive/XLive/xnet/xnet.cpp b/xlive/XLive/xnet/xnet.cpp index ba97da719..ca2e0d718 100644 --- a/xlive/XLive/xnet/xnet.cpp +++ b/xlive/XLive/xnet/xnet.cpp @@ -58,16 +58,16 @@ INT WINAPI XNetXnAddrToMachineId(const XNADDR * pxnaddr, ULONGLONG * pqwMachineI } // #67: XNetDnsLookup -int WINAPI XNetDnsLookup(const char * pszHost, DWORD hEvent, void ** ppxndns) +INT WINAPI XNetDnsLookup(const char* pszHost, WSAEVENT hEvent, XNDNS** ppxndns) { LOG_TRACE_NETWORK("XNetDnsLookup"); if (ppxndns) *ppxndns = NULL; - return 1; // ERROR + return ERROR_INVALID_FUNCTION; // ERROR } // #68: XNetDnsRelease -int WINAPI XNetDnsRelease(void * pxndns) +INT WINAPI XNetDnsRelease(XNDNS* pxndns) { LOG_TRACE_NETWORK("XNetDnsRelease"); return 0; diff --git a/xlive/XLive/xnet/xnet.h b/xlive/XLive/xnet/xnet.h index 27cab8044..442c9a56e 100644 --- a/xlive/XLive/xnet/xnet.h +++ b/xlive/XLive/xnet/xnet.h @@ -5,13 +5,13 @@ typedef struct // // Must be set to sizeof(XNetStartupParams). There is no default. // - BYTE cfgSizeOfStruct; + BYTE cfgSizeOfStruct; // // One or more of the XNET_STARTUP_xxx flags OR'd together. // // The default is 0 (no flags specified). - BYTE cfgFlags; + BYTE cfgFlags; // // The maximum number of SOCK_DGRAM (UDP or VDP) sockets that can be @@ -19,7 +19,7 @@ typedef struct // // The default is 8 sockets. // - BYTE cfgSockMaxDgramSockets; + BYTE cfgSockMaxDgramSockets; // // The maximum number of SOCK_STREAM (TCP) sockets that can be opened at @@ -30,21 +30,21 @@ typedef struct // // The default is 32 sockets. // - BYTE cfgSockMaxStreamSockets; + BYTE cfgSockMaxStreamSockets; // // The default receive buffer size for a socket, in units of K (1024 bytes). // // The default is 16 units (16K). // - BYTE cfgSockDefaultRecvBufsizeInK; + BYTE cfgSockDefaultRecvBufsizeInK; // // The default send buffer size for a socket, in units of K (1024 bytes). // // The default is 16 units (16K). // - BYTE cfgSockDefaultSendBufsizeInK; + BYTE cfgSockDefaultSendBufsizeInK; // // The maximum number of XNKID / XNKEY pairs that can be registered at the @@ -52,7 +52,7 @@ typedef struct // // The default is 8 key pair registrations. // - BYTE cfgKeyRegMax; + BYTE cfgKeyRegMax; // // The maximum number of security associations that can be registered at @@ -66,7 +66,7 @@ typedef struct // // The default is 32 security associations. // - BYTE cfgSecRegMax; + BYTE cfgSecRegMax; // // The maximum amount of QoS data, in units of DWORD (4 bytes), that can be @@ -75,7 +75,7 @@ typedef struct // // The default is 64 (256 bytes). // - BYTE cfgQosDataLimitDiv4; + BYTE cfgQosDataLimitDiv4; // // The amount of time to wait for a response after sending a QoS packet @@ -85,7 +85,7 @@ typedef struct // // The default is 2 seconds. // - BYTE cfgQosProbeTimeoutInSeconds; + BYTE cfgQosProbeTimeoutInSeconds; // // The maximum number of times to retry a given QoS packet when no response @@ -94,7 +94,7 @@ typedef struct // // The default is 3 retries. // - BYTE cfgQosProbeRetries; + BYTE cfgQosProbeRetries; // // The maximum number of simultaneous QoS lookup responses that a QoS @@ -104,7 +104,7 @@ typedef struct // // The default is 8 responses. // - BYTE cfgQosSrvMaxSimultaneousResponses; + BYTE cfgQosSrvMaxSimultaneousResponses; // // The maximum amount of time for QoS listeners to wait for the second @@ -112,7 +112,31 @@ typedef struct // // The default is 2 seconds. // - BYTE cfgQosPairWaitTimeInSeconds; + BYTE cfgQosPairWaitTimeInSeconds; } XNetStartupParams; +INT WINAPI XNetCleanup(); + +INT WINAPI XNetConnect(const IN_ADDR ina); +INT WINAPI XNetGetConnectStatus(const IN_ADDR ina); + +INT WINAPI XNetRandom(BYTE* pb, UINT cb); + +INT WINAPI XNetCreateKey(XNKID* pxnkid, XNKEY* pxnkey); +INT WINAPI XNetRegisterKey(const XNKID* pxnkid, const XNKEY* pxnkey); +INT WINAPI XNetUnregisterKey(const XNKID* pxnkid); +INT WINAPI XNetReplaceKey(const XNKID* pxnkidUnregister, const XNKID* pxnkidReplace); + +INT WINAPI XNetXnAddrToInAddr(const XNADDR* pxna, const XNKID* pxnkid, IN_ADDR* pina); +INT WINAPI XNetServerToInAddr(const IN_ADDR ina, DWORD dwServiceId, IN_ADDR* pina); +INT WINAPI XNetTsAddrToInAddr(const TSADDR* ptsa, DWORD dwServiceId, const XNKID* pxnkid, IN_ADDR* pina); +INT WINAPI XNetInAddrToXnAddr(const IN_ADDR ina, XNADDR* pxna, XNKID* pxnkid); +INT WINAPI XNetInAddrToServer(const IN_ADDR ina, IN_ADDR* pina); +INT WINAPI XNetInAddrToString(const IN_ADDR ina, char* pchBuf, INT cchBuf); +INT WINAPI XNetUnregisterInAddr(const IN_ADDR ina); +INT WINAPI XNetXnAddrToMachineId(const XNADDR* pxnaddr, ULONGLONG* pqwMachineId); + +INT WINAPI XNetDnsLookup(const char* pszHost, WSAEVENT hEvent, XNDNS** ppxndns); + +INT WINAPI XNetDnsRelease(XNDNS* pxndns); diff --git a/xlive/dllmain.cpp b/xlive/dllmain.cpp index 8b1e34a45..f03dc7c3e 100644 --- a/xlive/dllmain.cpp +++ b/xlive/dllmain.cpp @@ -12,35 +12,38 @@ #include "H2MOD/Modules/Shell/H2MODShell.h" #endif +#include -/* constants */ +/* externs */ -#define k_discord_dll_filename L"discord_game_sdk.dll" +extern void DeinitCustomLanguage(); -/* globals */ +extern void h2log_dispose(void); -HMODULE hThis = NULL; +/* prototypes */ -/* externs */ +static void initialize_instance(void); -/* prototypes */ +static void discord_dispose(void); + +static void heap_debug_initialize(void); + +static void exit_instance(void); -void discord_initialize(void); -void discord_dispose(void); -void heap_debug_initialize(void); -void initialize_instance(void); -void exit_instance(void); +/* globals */ + +HMODULE hThis = NULL; -/* entry point */ +/* public code */ -BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: hThis = hModule; srand((unsigned int)time(NULL)); - InitH2Startup(); + initialize_instance(); break; case DLL_THREAD_ATTACH: @@ -54,25 +57,17 @@ BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpRese return TRUE; } -/* private code */ - -void discord_initialize(void) +static void initialize_instance(void) { - HMODULE module = LoadLibraryW(k_discord_dll_filename); - if (module && !shell_is_dedicated_server() - && H2Config_discord_enable -#ifdef TEST_DISCORD_INSTANCE - && g_instance_number == 1 -#endif - ) - { - discord_game_status_create(module); - } - + heap_debug_initialize(); + InitH2Startup(); return; } -void discord_dispose(void) + +/* private code */ + +static void discord_dispose(void) { if (!shell_is_dedicated_server() && H2Config_discord_enable @@ -86,7 +81,7 @@ void discord_dispose(void) return; } -void heap_debug_initialize(void) +static void heap_debug_initialize(void) { #if CARTOGRAPHER_HEAP_DEBUG int CurrentFlags; @@ -99,27 +94,12 @@ void heap_debug_initialize(void) return; } -void initialize_instance(void) -{ - static bool init = false; - - if (!init) - { - init = true; - - heap_debug_initialize(); - discord_initialize(); - } - return; -} - -void exit_instance(void) +static void exit_instance(void) { discord_dispose(); tag_injection_deinitialize(); new_hud_draw_deinitialize(); - extern void DeinitCustomLanguage(); DeinitCustomLanguage(); DeinitH2Config(); diff --git a/xlive/stdafx.cpp b/xlive/stdafx.cpp index 200aeb37b..ae821ce0d 100644 --- a/xlive/stdafx.cpp +++ b/xlive/stdafx.cpp @@ -1,10 +1,8 @@ #include "stdafx.h" -std::random_device rd; - // for laptops with configured with multiple GPUs // signal the operating system to prefer the high performance GPU over the integrated one when possible extern "C" { - __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; - __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; + __declspec(dllexport) unsigned int NvOptimusEnablement = 0x00000001; + __declspec(dllexport) unsigned int AmdPowerXpressRequestHighPerformance = 0x00000001; } \ No newline at end of file diff --git a/xlive/stdafx.h b/xlive/stdafx.h index 2b82d3707..ff4cd4cdc 100644 --- a/xlive/stdafx.h +++ b/xlive/stdafx.h @@ -1,18 +1,16 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// #pragma once +#include "CartographerDllConf.h" -#define CARTOGRAPHER_HEAP_DEBUG 0 +/* c runtime */ -#if CARTOGRAPHER_HEAP_DEBUG - #define _CRTDBG_MAP_ALLOC -#endif +#include -#ifdef _DEBUG -#define D3D_DEBUG_INFO -#endif +#include +#include + +/* windows */ + +#ifdef _WIN32 #include @@ -21,96 +19,36 @@ #include -#define _WINSOCK_DEPRECATED_NO_WARNINGS -// sets the dinput/xinput version, Halo 2 uses the older 9.1.0 version and DirectInput 0x0800 -#define XINPUT_USE_9_1_0 -#define DIRECTINPUT_VERSION 0x0800 - -#define TEST_N_DEF(TEST) - #define _USE_MATH_DEFINES #include -#include - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// initialize GUIDs locally -#include - -// game input -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include "xliveless.h" -#include "xlivedefs.h" +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// cartographer includes +#include +#include // initialize GUIDs locally -#include "H2MOD/Modules/h2log/h2log.h" - -#include "version.h" - -#include "CartographerDllConf.h" +#endif -#include "Util/curl-interface.h" -#include "Util/Hooks/Hook.h" -#include "Util/Memory.h" +/* 3rd party */ -// blam includes +/* game includes */ #include "cseries/cseries.h" #include "cseries/cseries_errors.h" #include "cseries/cseries_system_memory.h" -#include "cseries/cseries_windows.h" -#include "math/crypto_windows.h" -#include "math/integer_math.h" #include "math/real_math.h" #include "memory/static_arrays.h" -#include - -#pragma comment(lib, "IPHLPAPI.lib") - -static_assert(EXECUTABLE_TYPE >= 0 && EXECUTABLE_TYPE <= 7, "EXECUTABLE_TYPE VALUE BELOW 0 OR EXCEEDS 7"); -static_assert(EXECUTABLE_VERSION > 0 && EXECUTABLE_VERSION < 65535, "EXECUTABLE_VERSION VALUE EXCEEDS 65534"); -static_assert(COMPATIBLE_VERSION > 0 && COMPATIBLE_VERSION < 65535, "COMPATIBLE_VERSION VALUE EXCEEDS 65534"); - -extern std::random_device rd; +#include "tag_files/tag_groups.h" // use this macro to define _time and _clock namespaces #define STD_CHRONO_DEFINE_TIME_AND_CLOCK(_time_name, _clock_name) \ namespace _time_name = std::chrono; \ using _clock_name = std::chrono::steady_clock; \ using namespace std::chrono_literals; + + +static_assert(EXECUTABLE_TYPE >= 0 && EXECUTABLE_TYPE <= 7, "EXECUTABLE_TYPE VALUE BELOW 0 OR EXCEEDS 7"); +static_assert(EXECUTABLE_VERSION > 0 && EXECUTABLE_VERSION < 65535, "EXECUTABLE_VERSION VALUE EXCEEDS 65534"); +static_assert(COMPATIBLE_VERSION > 0 && COMPATIBLE_VERSION < 65535, "COMPATIBLE_VERSION VALUE EXCEEDS 65534");