├── .gitattributes
├── .github
└── workflows
│ └── build.yaml
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── chimera.ini
├── compressor
├── CMakeLists.txt
├── chimera-compress.manifest
├── main.cpp
└── version.rc
├── contrib
└── tag-release
├── controller_config
├── README.md
├── linux
│ ├── README.md
│ ├── xbox_360.txt
│ ├── xbox_og.txt
│ └── xbox_one.txt
└── windows
│ ├── README.md
│ ├── dualshock_4.txt
│ ├── dualshock_4_ds4windows.txt
│ ├── switch_pro.txt
│ ├── xbox_360.txt
│ └── xbox_one.txt
├── dependencies.cmake
├── fonts
├── Hack-Bold.ttf
├── Interstate-Bold.otf
├── hack-license.md
└── interstate-license.md
├── icon
├── chimera.ico
└── chimera.jxl
└── src
├── chimera
├── annoyance
│ ├── auto_get_list.S
│ ├── auto_get_list.cpp
│ ├── auto_get_list.hpp
│ ├── drm.S
│ ├── drm.cpp
│ ├── drm.hpp
│ ├── exception_dialog.cpp
│ ├── exception_dialog.hpp
│ ├── keystone.cpp
│ ├── keystone.hpp
│ ├── multi_instance.cpp
│ ├── multi_instance.hpp
│ ├── novideo.cpp
│ ├── novideo.hpp
│ ├── registry.cpp
│ ├── registry.hpp
│ ├── tab_out_video.S
│ ├── tab_out_video.cpp
│ ├── tab_out_video.hpp
│ ├── update.S
│ ├── update.cpp
│ ├── update.hpp
│ ├── watson.cpp
│ └── watson.hpp
├── bookmark
│ ├── bookmark.cpp
│ └── bookmark.hpp
├── chimera.cmake
├── chimera.cpp
├── chimera.hpp
├── command
│ ├── client
│ │ ├── controller
│ │ │ ├── aim_assist.cpp
│ │ │ ├── auto_uncrouch.S
│ │ │ ├── auto_uncrouch.cpp
│ │ │ ├── block_button_quotes.cpp
│ │ │ ├── deadzones.S
│ │ │ ├── deadzones.cpp
│ │ │ └── diagonals.cpp
│ │ ├── custom_chat
│ │ │ ├── chat_block_ips.cpp
│ │ │ ├── chat_block_server_messages.cpp
│ │ │ └── chat_color_help.cpp
│ │ ├── debug
│ │ │ ├── budget.cpp
│ │ │ ├── load_ui_map.cpp
│ │ │ ├── send_chat_message.cpp
│ │ │ ├── show_coordinates.cpp
│ │ │ └── show_fps.cpp
│ │ ├── enhancement
│ │ │ ├── block_all_bullshit.cpp
│ │ │ ├── block_buffering.cpp
│ │ │ ├── block_extra_weapon.S
│ │ │ ├── block_extra_weapon.cpp
│ │ │ ├── fp_reverb.cpp
│ │ │ ├── set_color.S
│ │ │ ├── set_color.cpp
│ │ │ ├── set_name.cpp
│ │ │ └── throttle_fps.cpp
│ │ ├── lua
│ │ │ └── reload_scripts.cpp
│ │ ├── mouse
│ │ │ ├── block_mouse_acceleration.cpp
│ │ │ └── mouse_sensitivity.cpp
│ │ ├── server
│ │ │ ├── master_server.cpp
│ │ │ ├── spam_to_join.S
│ │ │ ├── spam_to_join.cpp
│ │ │ ├── spectate.S
│ │ │ └── spectate.cpp
│ │ └── visual
│ │ │ ├── af.cpp
│ │ │ ├── block_auto_center.cpp
│ │ │ ├── block_camera_shake.cpp
│ │ │ ├── block_gametype_indicator.cpp
│ │ │ ├── block_gametype_rules.cpp
│ │ │ ├── block_hold_f1.cpp
│ │ │ ├── block_letterbox.cpp
│ │ │ ├── block_loading_screen.cpp
│ │ │ ├── block_multitexture_overlays.cpp
│ │ │ ├── block_server_ip.cpp
│ │ │ ├── block_zoom_blur.cpp
│ │ │ ├── camo_fix.cpp
│ │ │ ├── console_prompt_color.cpp
│ │ │ ├── force_alternate_bump_attenuation.cpp
│ │ │ ├── fov.cpp
│ │ │ ├── interpolate.cpp
│ │ │ ├── meme_zone.cpp
│ │ │ ├── model_detail.cpp
│ │ │ ├── shrink_empty_weapons.cpp
│ │ │ ├── simple_score_screen.cpp
│ │ │ ├── split_screen_hud.cpp
│ │ │ ├── uncap_cinematic.cpp
│ │ │ └── widescreen_fix.cpp
│ ├── command.cmake
│ ├── command.cpp
│ ├── command.hpp
│ ├── core
│ │ ├── chimera
│ │ │ ├── about.cpp
│ │ │ ├── chimera.cpp
│ │ │ ├── language.cpp
│ │ │ └── signature_info.cpp
│ │ ├── debug
│ │ │ ├── apply_damage.cpp
│ │ │ ├── block_damage.cpp
│ │ │ ├── devmode.cpp
│ │ │ ├── map_info.cpp
│ │ │ ├── player_info.cpp
│ │ │ ├── teleport.cpp
│ │ │ └── tps.cpp
│ │ └── server
│ │ │ ├── allow_all_passengers.cpp
│ │ │ ├── block_equipment_rotation.S
│ │ │ ├── block_equipment_rotation.cpp
│ │ │ ├── delete_empty_weapons.cpp
│ │ │ └── player_list.cpp
│ ├── hotkey.cpp
│ └── hotkey.hpp
├── config
│ ├── config.cpp
│ ├── config.hpp
│ ├── ini.cpp
│ └── ini.hpp
├── console
│ ├── console.S
│ ├── console.cpp
│ └── console.hpp
├── custom_chat
│ ├── custom_chat.S
│ ├── custom_chat.cpp
│ ├── custom_chat.hpp
│ └── emoji_map.hpp
├── event
│ ├── camera.cpp
│ ├── camera.hpp
│ ├── command.cpp
│ ├── command.hpp
│ ├── connect.S
│ ├── connect.cpp
│ ├── connect.hpp
│ ├── d3d9_end_scene.S
│ ├── d3d9_end_scene.cpp
│ ├── d3d9_end_scene.hpp
│ ├── d3d9_reset.S
│ ├── d3d9_reset.cpp
│ ├── d3d9_reset.hpp
│ ├── damage.S
│ ├── damage.cpp
│ ├── damage.hpp
│ ├── event.hpp
│ ├── frame.cpp
│ ├── frame.hpp
│ ├── game_loop.cpp
│ ├── game_loop.hpp
│ ├── map_load.cpp
│ ├── map_load.hpp
│ ├── rcon_message.cpp
│ ├── rcon_message.hpp
│ ├── revert.cpp
│ ├── revert.hpp
│ ├── tick.cpp
│ └── tick.hpp
├── fix
│ ├── abolish_safe_mode.cpp
│ ├── abolish_safe_mode.hpp
│ ├── af.S
│ ├── af.cpp
│ ├── af.hpp
│ ├── aim_assist.S
│ ├── aim_assist.cpp
│ ├── aim_assist.hpp
│ ├── alternate_bump_attenuation.S
│ ├── alternate_bump_attenuation.cpp
│ ├── alternate_bump_attenuation.hpp
│ ├── auto_center.cpp
│ ├── auto_center.hpp
│ ├── biped_ui_spawn.cpp
│ ├── biped_ui_spawn.hpp
│ ├── bitmap_formats.cpp
│ ├── bitmap_formats.hpp
│ ├── blue_32bit_color_fix.cpp
│ ├── blue_32bit_color_fix.hpp
│ ├── bullshit_server_data.S
│ ├── bullshit_server_data.cpp
│ ├── bullshit_server_data.hpp
│ ├── camera_shake_fix.S
│ ├── camera_shake_fix.cpp
│ ├── camera_shake_fix.hpp
│ ├── checkpoint_fix.S
│ ├── checkpoint_fix.cpp
│ ├── checkpoint_fix.hpp
│ ├── chicago_multiply_fix.cpp
│ ├── chicago_multiply_fix.hpp
│ ├── contrail_fix.S
│ ├── contrail_fix.cpp
│ ├── contrail_fix.hpp
│ ├── custom_map_lobby_fix.cpp
│ ├── custom_map_lobby_fix.hpp
│ ├── death_reset_time.cpp
│ ├── death_reset_time.hpp
│ ├── descope_fix.cpp
│ ├── descope_fix.hpp
│ ├── extend_limits.S
│ ├── extend_limits.cpp
│ ├── extend_limits.hpp
│ ├── extended_description_fix.cpp
│ ├── extended_description_fix.hpp
│ ├── floor_decal_memery.S
│ ├── floor_decal_memery.cpp
│ ├── floor_decal_memery.hpp
│ ├── force_crash.cpp
│ ├── force_crash.hpp
│ ├── fov_fix.cpp
│ ├── fov_fix.hpp
│ ├── fp_animation.cpp
│ ├── fp_animation.hpp
│ ├── fp_reverb.S
│ ├── fp_reverb.cpp
│ ├── fp_reverb.hpp
│ ├── glass_fix.S
│ ├── glass_fix.cpp
│ ├── glass_fix.hpp
│ ├── hud_bitmap_scale.S
│ ├── hud_bitmap_scale.cpp
│ ├── hud_bitmap_scale.hpp
│ ├── internal_shaders.S
│ ├── internal_shaders.cpp
│ ├── internal_shaders.hpp
│ ├── interpolate
│ │ ├── antenna.cpp
│ │ ├── antenna.hpp
│ │ ├── camera.cpp
│ │ ├── camera.hpp
│ │ ├── flag.cpp
│ │ ├── flag.hpp
│ │ ├── fp.cpp
│ │ ├── fp.hpp
│ │ ├── interpolate.cpp
│ │ ├── interpolate.hpp
│ │ ├── light.cpp
│ │ ├── light.hpp
│ │ ├── object.cpp
│ │ ├── object.hpp
│ │ ├── particle.cpp
│ │ └── particle.hpp
│ ├── invalid_command_crash.S
│ ├── invalid_command_crash.cpp
│ ├── invalid_command_crash.hpp
│ ├── jason_jones_hacks.cpp
│ ├── jason_jones_hacks.hpp
│ ├── leak_descriptors.cpp
│ ├── leak_descriptors.hpp
│ ├── model_detail.S
│ ├── model_detail.cpp
│ ├── model_detail.hpp
│ ├── motion_sensor_fix.S
│ ├── motion_sensor_fix.cpp
│ ├── motion_sensor_fix.hpp
│ ├── multitexture_overlay_fix.S
│ ├── multitexture_overlay_fix.cpp
│ ├── multitexture_overlay_fix.hpp
│ ├── name_fade.S
│ ├── name_fade.cpp
│ ├── name_fade.hpp
│ ├── sane_defaults.S
│ ├── sane_defaults.cpp
│ ├── sane_defaults.hpp
│ ├── scope_blur_fix.S
│ ├── scope_blur_fix.cpp
│ ├── scope_blur_fix.hpp
│ ├── scoreboard_fade_fix.S
│ ├── scoreboard_fade_fix.cpp
│ ├── scoreboard_fade_fix.hpp
│ ├── specular_memes.S
│ ├── specular_memes.cpp
│ ├── specular_memes.hpp
│ ├── sun_fix.cpp
│ ├── sun_fix.hpp
│ ├── timer_offset.cpp
│ ├── timer_offset.hpp
│ ├── uncompressed_sound_fix.cpp
│ ├── uncompressed_sound_fix.hpp
│ ├── vehicle_team_desync.S
│ ├── vehicle_team_desync.cpp
│ ├── vehicle_team_desync.hpp
│ ├── video_mode.S
│ ├── video_mode.cpp
│ ├── video_mode.hpp
│ ├── water_fix.S
│ ├── water_fix.cpp
│ ├── water_fix.hpp
│ ├── weapon_swap_ticks.S
│ ├── weapon_swap_ticks.cpp
│ ├── weapon_swap_ticks.hpp
│ ├── weather_fix.S
│ ├── weather_fix.cpp
│ ├── weather_fix.hpp
│ ├── widescreen_element_reposition_hud.S
│ ├── widescreen_element_reposition_letterbox.S
│ ├── widescreen_element_reposition_menu.S
│ ├── widescreen_element_reposition_menu_text.S
│ ├── widescreen_fix.cpp
│ ├── widescreen_fix.hpp
│ ├── widescreen_mouse.S
│ ├── xbox_channel_order.S
│ ├── xbox_channel_order.cpp
│ ├── xbox_channel_order.hpp
│ ├── z_fighting.S
│ ├── z_fighting.cpp
│ └── z_fighting.hpp
├── halo_data
│ ├── antenna.cpp
│ ├── antenna.hpp
│ ├── camera.cpp
│ ├── camera.hpp
│ ├── chat.S
│ ├── chat.cpp
│ ├── chat.hpp
│ ├── contrail.cpp
│ ├── contrail.hpp
│ ├── controls.cpp
│ ├── controls.hpp
│ ├── cutscene.cpp
│ ├── cutscene.hpp
│ ├── damage.S
│ ├── damage.cpp
│ ├── damage.hpp
│ ├── decal.cpp
│ ├── decal.hpp
│ ├── effect.cpp
│ ├── effect.hpp
│ ├── flag.cpp
│ ├── flag.hpp
│ ├── game_engine.cpp
│ ├── game_engine.hpp
│ ├── globals.cpp
│ ├── globals.hpp
│ ├── hud_fonts.S
│ ├── hud_fonts.cpp
│ ├── hud_fonts.hpp
│ ├── keyboard.cpp
│ ├── keyboard.hpp
│ ├── light.cpp
│ ├── light.hpp
│ ├── main_menu_music.cpp
│ ├── main_menu_music.hpp
│ ├── map.S
│ ├── map.cpp
│ ├── map.hpp
│ ├── menu.S
│ ├── menu.cpp
│ ├── menu.hpp
│ ├── multiplayer.cpp
│ ├── multiplayer.hpp
│ ├── object.S
│ ├── object.cpp
│ ├── object.hpp
│ ├── pad.hpp
│ ├── particle.cpp
│ ├── particle.hpp
│ ├── path.cpp
│ ├── path.hpp
│ ├── pause.cpp
│ ├── pause.hpp
│ ├── player.cpp
│ ├── player.hpp
│ ├── port.cpp
│ ├── port.hpp
│ ├── resolution.cpp
│ ├── resolution.hpp
│ ├── resource_map.hpp
│ ├── script.S
│ ├── script.cpp
│ ├── script.hpp
│ ├── server.cpp
│ ├── server.hpp
│ ├── shader_effects.hpp
│ ├── shaders
│ │ ├── fx
│ │ │ ├── EffectCollection_ps_2_0.bin
│ │ │ └── fx.bin
│ │ ├── generate_shader_blobs.py
│ │ ├── shader_blob.hpp
│ │ └── vertex
│ │ │ └── vsh.bin
│ ├── table.hpp
│ ├── tag.cpp
│ ├── tag.hpp
│ ├── tag_class.cpp
│ ├── tag_class.hpp
│ └── type.hpp
├── localization
│ ├── language
│ │ ├── 0
│ │ ├── 1
│ │ └── 2
│ ├── localization.cpp
│ ├── localization.hpp
│ └── localizer.py
├── lua
│ ├── lua_callback.cpp
│ ├── lua_callback.hpp
│ ├── lua_filesystem.cpp
│ ├── lua_filesystem.hpp
│ ├── lua_game.cpp
│ ├── lua_game.hpp
│ ├── lua_io.cpp
│ ├── lua_io.hpp
│ ├── lua_script.cpp
│ ├── lua_script.hpp
│ ├── lua_variables.cpp
│ ├── lua_variables.hpp
│ ├── scripting.cpp
│ └── scripting.hpp
├── map_loading
│ ├── compression.cpp
│ ├── compression.hpp
│ ├── crc32.c
│ ├── crc32.hpp
│ ├── fast_load.S
│ ├── fast_load.cpp
│ ├── fast_load.hpp
│ ├── get_file_name_from_handle.c
│ ├── get_file_name_from_handle.h
│ ├── laa.cpp
│ ├── laa.hpp
│ ├── map_loading.S
│ ├── map_loading.cpp
│ └── map_loading.hpp
├── master_server
│ ├── master_server.cpp
│ └── master_server.hpp
├── math_trig
│ ├── math_trig.cpp
│ └── math_trig.hpp
├── miscellaneous
│ ├── controller.S
│ ├── controller.cpp
│ └── controller.hpp
├── output
│ ├── color_codes
│ ├── color_codes_generator.py
│ ├── draw_text.S
│ ├── draw_text.cpp
│ ├── draw_text.hpp
│ ├── error_box.cpp
│ ├── error_box.hpp
│ ├── output.S
│ ├── output.cpp
│ └── output.hpp
├── signature
│ ├── hac
│ │ ├── HAC2_LICENSE
│ │ ├── codefinder.cpp
│ │ └── codefinder.h
│ ├── hook.cpp
│ ├── hook.hpp
│ ├── signature.cpp
│ └── signature.hpp
├── version.cmake
└── version.rc
├── lua
├── COPYRIGHT
├── lapi.c
├── lapi.h
├── lauxlib.c
├── lauxlib.h
├── lbaselib.c
├── lbitlib.c
├── lcode.c
├── lcode.h
├── lcorolib.c
├── lctype.c
├── lctype.h
├── ldblib.c
├── ldebug.c
├── ldebug.h
├── ldo.c
├── ldo.h
├── ldump.c
├── lfunc.c
├── lfunc.h
├── lgc.c
├── lgc.h
├── linit.c
├── liolib.c
├── llex.c
├── llex.h
├── llimits.h
├── lmathlib.c
├── lmem.c
├── lmem.h
├── loadlib.c
├── lobject.c
├── lobject.h
├── lopcodes.c
├── lopcodes.h
├── loslib.c
├── lparser.c
├── lparser.h
├── lprefix.h
├── lstate.c
├── lstate.h
├── lstring.c
├── lstring.h
├── lstrlib.c
├── ltable.c
├── ltable.h
├── ltablib.c
├── ltm.c
├── ltm.h
├── lua.c
├── lua.cmake
├── lua.h
├── lua.hpp
├── luac.c
├── luaconf.h
├── lualib.h
├── lundump.c
├── lundump.h
├── lutf8lib.c
├── lvm.c
├── lvm.h
├── lzio.c
└── lzio.h
├── map_downloader
├── map_downloader.cmake
├── map_downloader.cpp
├── map_downloader.hpp
└── test
│ └── test.cpp
└── monolith
├── monolith.c
├── monolith.cmake
└── strings
├── dialog.rc
├── guidelines.rc
├── halo.ico
├── icon.rc
├── splash.bmp
├── splash.rc
├── strings.rc
├── stringtable.rc
├── unknown.rc
└── version.rc
/.gitattributes:
--------------------------------------------------------------------------------
1 | src/lua/** linguist-vendored
2 | ext/** linguist-vendored
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.7z*
2 | *.bat
3 | *.cmd
4 | *.sh
5 | src/chimera/version.hpp
6 | mingw32/
7 | build/
8 |
--------------------------------------------------------------------------------
/compressor/chimera-compress.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | UTF-8
13 | true
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/compressor/version.rc:
--------------------------------------------------------------------------------
1 | LANGUAGE 9, 1
2 |
3 | 1 VERSIONINFO
4 | FILEVERSION 1, 0, 3, 0
5 | PRODUCTVERSION 1, 0, 3, 0
6 | BEGIN
7 | BLOCK "StringFileInfo"
8 | BEGIN
9 | BLOCK "040904b0"
10 | BEGIN
11 | VALUE "CompanyName", "Snowy ^.^"
12 | VALUE "FileDescription", "Chimera Map Compressor"
13 | VALUE "FileVersion", "1.0.3"
14 | VALUE "InternalName", "chimera-compress"
15 | VALUE "OriginalFilename", "chimera-compress.exe"
16 | VALUE "ProductName", "Chimera Compress"
17 | VALUE "ProductVersion", "1.0.3"
18 | VALUE "LegalCopyright", "'16'17'18 Snowy"
19 | END
20 | END
21 | BLOCK "VarFileInfo"
22 | BEGIN
23 | VALUE "Translation", 0x409, 1200
24 | END
25 | END
26 |
27 | IDI_ICON1 ICON "../icon/chimera.ico"
28 | 1 24 "chimera-compress.manifest"
29 |
--------------------------------------------------------------------------------
/contrib/tag-release:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | tagname="1.0.0r$(git rev-list --count HEAD)"
6 | git tag "$tagname"
7 | echo "Tagged current commit as $tagname"
8 |
--------------------------------------------------------------------------------
/controller_config/README.md:
--------------------------------------------------------------------------------
1 | To use a controller config, paste the contents of the entire text file to the
2 | `[controller]` section in chimera.ini. Set `enabled=1` or uncomment `enabled=1`
3 | if using the included chimera.ini. For example:
4 |
5 | ```ini
6 | [controller]
7 |
8 | ;===============================================================================
9 | ; Controller settings
10 | ;
11 | ; This is used to configure gamepads.
12 | ;===============================================================================
13 |
14 | ; Enable this to use this feature
15 | enabled=1
16 |
17 | ;
18 | ```
19 |
20 | Note that the Windows and Linux drivers map the buttons/axes differently. For
21 | example, Xbox One controllers have the left & right triggers mapped to one axis
22 | on Windows, but they're mapped to separate axes on Linux. The Home button is
23 | also mapped on Linux but not on Windows.
24 |
--------------------------------------------------------------------------------
/controller_config/linux/README.md:
--------------------------------------------------------------------------------
1 | # Controller configurations (Linux)
2 | These configuration files are for when running Halo on Linux. Below is a list
3 | of them and what controllers they apply to.
4 |
5 | ## xbox_360.txt
6 | - Microsoft Xbox 360
7 | - Steam Controller (via [Steam](https://store.steampowered.com/))
8 |
9 | ## xbox_one.txt
10 | - Microsoft Xbox One
11 | - Microsoft Xbox One S
12 |
--------------------------------------------------------------------------------
/controller_config/linux/xbox_360.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: Xbox 360 controllers on Linux
2 |
3 | axis_2_n=Left Stick Up
4 | axis_2_p=Left Stick Down
5 | axis_1_n=Left Stick Left
6 | axis_1_p=Left Stick Right
7 |
8 | axis_5_n=Right Stick Up
9 | axis_5_p=Right Stick Down
10 | axis_4_n=Right Stick Left
11 | axis_4_p=Right Stick Right
12 |
13 | axis_6_p=Right Trigger
14 | axis_3_p=Left Trigger
15 |
16 | button_1=A
17 | button_2=B
18 | button_3=X
19 | button_4=Y
20 | button_5=Left Bumper
21 | button_6=Right Bumper
22 | button_7=Back
23 | button_8=Start
24 | button_9=Guide
25 | button_10=Left Stick
26 | button_11=Right Stick
27 |
28 | pov_1_w=D-Pad Left
29 | pov_1_e=D-Pad Right
30 | pov_1_n=D-Pad Up
31 | pov_1_s=D-Pad Down
32 |
--------------------------------------------------------------------------------
/controller_config/linux/xbox_og.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: Xbox (original) controllers
2 |
3 | axis_2_n=Left Stick Up
4 | axis_2_p=Left Stick Down
5 | axis_1_n=Left Stick Left
6 | axis_1_p=Left Stick Right
7 |
8 | axis_5_n=Right Stick Up
9 | axis_5_p=Right Stick Down
10 | axis_4_n=Right Stick Left
11 | axis_4_p=Right Stick Right
12 |
13 | axis_6_p=Right Trigger
14 | axis_3_p=Left Trigger
15 |
16 | button_1=A
17 | button_2=B
18 | button_3=Black
19 | button_4=X
20 | button_5=Y
21 | button_6=White
22 | button_7=Back
23 | button_8=Start
24 | button_9=Left Stick
25 | button_10=Right Stick
26 |
27 | pov_1_w=D-Pad Left
28 | pov_1_e=D-Pad Right
29 | pov_1_n=D-Pad Up
30 | pov_1_s=D-Pad Down
31 |
--------------------------------------------------------------------------------
/controller_config/linux/xbox_one.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: Xbox One and Xbox One S controllers on Linux
2 |
3 | axis_2_n=Left Stick Up
4 | axis_2_p=Left Stick Down
5 | axis_1_n=Left Stick Left
6 | axis_1_p=Left Stick Right
7 |
8 | axis_5_n=Right Stick Up
9 | axis_5_p=Right Stick Down
10 | axis_4_n=Right Stick Left
11 | axis_4_p=Right Stick Right
12 |
13 | axis_6_p=Right Trigger
14 | axis_3_p=Left Trigger
15 |
16 | button_1=A
17 | button_2=B
18 | button_3=X
19 | button_4=Y
20 | button_5=Left Bumper
21 | button_6=Right Bumper
22 | button_7=View
23 | button_8=Menu
24 | button_9=Home
25 | button_10=Left Stick
26 | button_11=Right Stick
27 |
28 | pov_1_w=D-Pad Left
29 | pov_1_e=D-Pad Right
30 | pov_1_n=D-Pad Up
31 | pov_1_s=D-Pad Down
32 |
--------------------------------------------------------------------------------
/controller_config/windows/README.md:
--------------------------------------------------------------------------------
1 | # Controller configurations (Windows)
2 | These configuration files are for when running Halo on Windows. Below is a list
3 | of them and what controllers they apply to.
4 |
5 | ## dualshock_4.txt
6 | - Sony DualShock 4
7 |
8 | ## switch_pro.txt
9 | - Nintendo Switch Pro Controller (wired)
10 | - Similar wired controllers licensed for the Nintendo Switch
11 |
12 | ## xbox_360.txt
13 | - Microsoft Xbox 360
14 | - Razer Serval (via [Razer Synapse 2.0](https://www2.razer.com/au-en/synapse-2))
15 | - Sony DualShock 4 (via [DS4Windows](http://ds4windows.com/))
16 | - Steam Controller (via [Steam](https://store.steampowered.com/))
17 |
18 | ## xbox_one.txt
19 | - Microsoft Xbox One
20 | - Microsoft Xbox One S
21 |
--------------------------------------------------------------------------------
/controller_config/windows/dualshock_4.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: DualShock 4 controllers on Windows 10 (default Microsoft drivers)
2 |
3 | axis_1_n=Right Stick Up
4 | axis_1_p=Right Stick Down
5 | axis_2_n=Right Stick Left
6 | axis_2_p=Right Stick Right
7 |
8 | axis_3_n=Left Stick Up
9 | axis_3_p=Left Stick Down
10 | axis_4_n=Left Stick Left
11 | axis_4_p=Left Stick Right
12 |
13 | button_1=Square
14 | button_2=Cross
15 | button_3=Circle
16 | button_4=Triangle
17 | button_5=L1
18 | button_6=R1
19 | button_7=L2
20 | button_8=R2
21 | button_9=Share
22 | button_10=Options
23 | button_11=L3
24 | button_12=R3
25 | button_13=PS
26 | button_14=Touch Pad
27 |
28 | pov_1_w=D-Pad Left
29 | pov_1_e=D-Pad Right
30 | pov_1_n=D-Pad Up
31 | pov_1_s=D-Pad Down
32 |
--------------------------------------------------------------------------------
/controller_config/windows/dualshock_4_ds4windows.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: DualShock 4 controllers on Windows 10 using DS4Windows
2 |
3 | axis_1_n=Right Stick Up
4 | axis_1_p=Right Stick Down
5 | axis_2_n=Right Stick Left
6 | axis_2_p=Right Stick Right
7 |
8 | axis_3_n=Left Stick Up
9 | axis_3_p=Left Stick Down
10 | axis_4_n=Left Stick Left
11 | axis_4_p=Left Stick Right
12 |
13 | button_1=Cross
14 | button_2=Circle
15 | button_3=Square
16 | button_4=Triangle
17 | button_5=L1
18 | button_6=R1
19 | button_7=L2
20 | button_8=R2
21 | button_9=L3
22 | button_10=R3
23 | button_11=Share
24 | button_12=Options
25 | button_13=PS
26 | button_14=Touch Pad
27 |
28 | pov_1_w=D-Pad Left
29 | pov_1_e=D-Pad Right
30 | pov_1_n=D-Pad Up
31 | pov_1_s=D-Pad Down
32 |
--------------------------------------------------------------------------------
/controller_config/windows/switch_pro.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: Nintendo Switch Wired Pro controllers on Windows 10
2 |
3 | axis_1_n=Right Stick Up
4 | axis_1_p=Right Stick Down
5 | axis_2_n=Right Stick Left
6 | axis_2_p=Right Stick Right
7 |
8 | axis_3_n=Left Stick Up
9 | axis_3_p=Left Stick Down
10 | axis_4_n=Left Stick Left
11 | axis_4_p=Left Stick Right
12 |
13 | button_1=Y
14 | button_2=B
15 | button_3=A
16 | button_4=X
17 | button_5=L
18 | button_6=R
19 | button_7=ZL
20 | button_8=ZR
21 | button_9=-
22 | button_10=+
23 | button_11=Left Stick
24 | button_12=Right Stick
25 | button_13=Home
26 | button_14=Capture
27 |
28 | pov_1_w=D-Pad Left
29 | pov_1_e=D-Pad Right
30 | pov_1_n=D-Pad Up
31 | pov_1_s=D-Pad Down
32 |
--------------------------------------------------------------------------------
/controller_config/windows/xbox_360.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: Xbox 360 controllers on Windows
2 | ;
3 | ; This also applies to a number of other controller configs, since emulating
4 | ; Xbox 360 controllers seems to be pretty common.
5 | ;
6 | ; See https://github.com/SnowyMouse/chimera/blob/master/controller_config/windows/README.md
7 | ; for a list.
8 |
9 | axis_1_n=Left Stick Up
10 | axis_1_p=Left Stick Down
11 | axis_2_n=Left Stick Left
12 | axis_2_p=Left Stick Right
13 |
14 | axis_3_n=Right Stick Up
15 | axis_3_p=Right Stick Down
16 | axis_4_n=Right Stick Left
17 | axis_4_p=Right Stick Right
18 |
19 | axis_5_n=Right Trigger
20 | axis_5_p=Left Trigger
21 |
22 | button_1=A
23 | button_2=B
24 | button_3=X
25 | button_4=Y
26 | button_5=Left Bumper
27 | button_6=Right Bumper
28 | button_7=Back
29 | button_8=Start
30 | button_9=Left Stick
31 | button_10=Right Stick
32 |
33 | pov_1_w=D-Pad Left
34 | pov_1_e=D-Pad Right
35 | pov_1_n=D-Pad Up
36 | pov_1_s=D-Pad Down
37 |
--------------------------------------------------------------------------------
/controller_config/windows/xbox_one.txt:
--------------------------------------------------------------------------------
1 | ; Applies to: Xbox One and Xbox One S controllers on Windows
2 |
3 | axis_1_n=Left Stick Up
4 | axis_1_p=Left Stick Down
5 | axis_2_n=Left Stick Left
6 | axis_2_p=Left Stick Right
7 |
8 | axis_3_n=Right Stick Up
9 | axis_3_p=Right Stick Down
10 | axis_4_n=Right Stick Left
11 | axis_4_p=Right Stick Right
12 |
13 | axis_5_n=Right Trigger
14 | axis_5_p=Left Trigger
15 |
16 | button_1=A
17 | button_2=B
18 | button_3=X
19 | button_4=Y
20 | button_5=Left Bumper
21 | button_6=Right Bumper
22 | button_7=Menu
23 | button_8=View
24 | button_9=Left Stick
25 | button_10=Right Stick
26 |
27 | pov_1_w=D-Pad Left
28 | pov_1_e=D-Pad Right
29 | pov_1_n=D-Pad Up
30 | pov_1_s=D-Pad Down
31 |
--------------------------------------------------------------------------------
/fonts/Hack-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/fonts/Hack-Bold.ttf
--------------------------------------------------------------------------------
/fonts/Interstate-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/fonts/Interstate-Bold.otf
--------------------------------------------------------------------------------
/fonts/interstate-license.md:
--------------------------------------------------------------------------------
1 | Copr. 1993, Tobias Frere-Jones. Designed by Tobias Frere-Jones. Produced by The Font Bureau, Inc.
2 |
3 | The font is available for personal use only. Please carefully review the terms of commercial use of the font with its owner.
4 |
5 | https://www.azfonts.net/load_font/interst1.html
6 |
--------------------------------------------------------------------------------
/icon/chimera.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/icon/chimera.ico
--------------------------------------------------------------------------------
/icon/chimera.jxl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/icon/chimera.jxl
--------------------------------------------------------------------------------
/src/chimera/annoyance/auto_get_list.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .data
6 | getting_from_internet: .long 0
7 |
8 | .text
9 |
10 | .globl _auto_get_list_thing_asm
11 | _auto_get_list_thing_asm:
12 | ;# This will be 1 if we're on the INTERNET page. We need this for later
13 | mov byte ptr [getting_from_internet], al
14 | mov al, 0
15 | ret
16 |
17 | .globl _auto_get_list_thing_add_asm
18 | _auto_get_list_thing_add_asm:
19 | ;# Check if we're on internet. If this is zero, then don't do anything to esi. Otherwise, set esi (the time to next query) to -1
20 | cmp byte ptr [getting_from_internet], 0
21 | je done_getting_list_automatically
22 |
23 | ;# Set to -1 (never refresh)
24 | or esi, -1
25 |
26 | done_getting_list_automatically:
27 | ret
28 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/auto_get_list.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../config/ini.hpp"
5 | #include "../signature/hook.hpp"
6 | #include "../signature/signature.hpp"
7 |
8 | namespace Chimera {
9 | extern "C" {
10 | std::uint32_t auto_get_list_thing_asm() noexcept;
11 | std::uint32_t auto_get_list_thing_add_asm() noexcept;
12 | }
13 |
14 | void set_up_auto_get_list() noexcept {
15 | auto &chimera = get_chimera();
16 |
17 | if(!chimera.get_ini()->get_value_bool("server_list.auto_query").value_or(false)) {
18 | return;
19 | }
20 |
21 | static Hook hook_get, hook_add;
22 | auto *auto_query_master_list_sig = chimera.get_signature("auto_query_master_list_sig").data();
23 | auto *auto_query_master_list_add_sig = chimera.get_signature("auto_query_master_list_add_sig").data();
24 |
25 | write_jmp_call(auto_query_master_list_sig, hook_get, nullptr, reinterpret_cast(auto_get_list_thing_asm), false);
26 | write_jmp_call(auto_query_master_list_add_sig, hook_add, nullptr, reinterpret_cast(auto_get_list_thing_add_asm), false);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/auto_get_list.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_AUTO_GET_LIST_HPP
4 | #define CHIMERA_AUTO_GET_LIST_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Automatically get the list when you go on the INTERNET (because literally every game does this)
9 | */
10 | void set_up_auto_get_list() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/drm.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _fun_cd_key_hash_function_asm
8 | _fun_cd_key_hash_function_asm:
9 | push [esp+0x30]
10 | call _fun_cd_key_hash_gen_asm
11 | add esp, 4
12 | ret
13 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/drm.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_DRM_HPP
4 | #define CHIMERA_DRM_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Make Halo's annoying DRM less annoying (required in order for Chimera's strings.dll to function properly)
9 | *
10 | * Note: This does NOT crack the game, as you need a valid CD key to install/update the game.
11 | */
12 | void reduce_drm() noexcept;
13 |
14 | /**
15 | * Set the CD hash
16 | */
17 | void set_cd_hash() noexcept;
18 | }
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/exception_dialog.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "exception_dialog.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../output/error_box.hpp"
7 | #include "../config/ini.hpp"
8 | #include "../chimera.hpp"
9 |
10 | namespace Chimera {
11 | void set_up_remove_exception_dialog() noexcept {
12 | static Hook hook;
13 | write_jmp_call(get_chimera().get_signature("gathering_exception_sig").data(), hook, reinterpret_cast(+[]() {
14 | auto ini = get_chimera().get_ini();
15 | show_error_box(
16 | "Segmentation fault",
17 | "The game has encountered a segmentation fault.",
18 | ini != nullptr && ini->get_value_bool("error_handling.show_segmentation_fault").value_or(false)
19 | );
20 | std::exit(68); // NOT nice
21 | }));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/exception_dialog.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_REMOVE_EXCEPTION_DIALOG_HPP
4 | #define CHIMERA_REMOVE_EXCEPTION_DIALOG_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Remove this
9 | */
10 | void set_up_remove_exception_dialog() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/keystone.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | void remove_keystone() noexcept {
9 | overwrite(get_chimera().get_signature("load_keystone_sig").data(), static_cast(0x9090));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/keystone.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_KEYSTONE_HPP
4 | #define CHIMERA_KEYSTONE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Remove keystone.dll (speeds up load time and makes Halo more stable)
9 | */
10 | void remove_keystone() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/multi_instance.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../output/error_box.hpp"
7 |
8 | namespace Chimera {
9 | void enable_multiple_instance() noexcept {
10 | if(!get_chimera().feature_present("client_multiple_instances")) {
11 | show_error_box("Error", "Multiple instances is not supported on this client. (client is probably modified)");
12 | std::exit(1);
13 | }
14 |
15 | static SigByte nop5[] = { 0x90, 0x90, 0x90, 0x90, 0x90 };
16 | write_code_s(get_chimera().get_signature(!get_chimera().feature_present("client_demo") ? "multiple_instance_1_fv_sig" : "multiple_instance_1_demo_sig").data(), nop5);
17 |
18 | static SigByte save_patch[] = { 0xEB, 0x4A };
19 | write_code_s(get_chimera().get_signature("multiple_instance_2_sig").data(), save_patch);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/multi_instance.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MULTIPLE_INSTANCE_HPP
4 | #define CHIMERA_MULTIPLE_INSTANCE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Enable multiple instances
9 | */
10 | void enable_multiple_instance() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/novideo.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | static std::uint32_t *novideo = nullptr;
9 |
10 | static void do_it_do_it() {
11 | *novideo = 1;
12 | }
13 |
14 | void enable_novideo() noexcept {
15 | static Hook hook;
16 | auto *instruction = get_chimera().get_signature("novideo_sig").data() + 2;
17 | novideo = *reinterpret_cast(instruction + 1);
18 | write_jmp_call(instruction, hook, nullptr, reinterpret_cast(do_it_do_it));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/novideo.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_NOVIDEO_HPP
4 | #define CHIMERA_NOVIDEO_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Enable novideo
9 | */
10 | void enable_novideo() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/registry.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | void remove_registry_checks() noexcept {
9 | SigByte load_eula_code[] = { 0xE9, 0x93, 0x00, 0x00, 0x00 };
10 | write_code_s(get_chimera().get_signature("load_eula_sig").data(), load_eula_code);
11 | overwrite(get_chimera().get_signature("registry_check_1_sig").data(), static_cast(0xC3));
12 |
13 | SigByte registry_check_2_code[] = { 0x31, 0xC0, 0xC3 };
14 | write_code_s(get_chimera().get_signature("registry_check_2_sig").data(), registry_check_2_code);
15 | write_code_s(get_chimera().get_signature("registry_check_3_sig").data(), registry_check_2_code);
16 | write_code_s(get_chimera().get_signature("registry_check_4_sig").data(), registry_check_2_code);
17 | write_code_s(get_chimera().get_signature("gamma_sig").data(), registry_check_2_code);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/registry.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_EULA_HPP
4 | #define CHIMERA_EULA_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Remove Halo's annoying checks (speeds up loading, removes registry changes, prevents safe mode from happening after crash)
9 | */
10 | void remove_registry_checks() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/tab_out_video.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _tab_out_video_reacquire_device_subroutine_asm
8 | _tab_out_video_reacquire_device_subroutine_asm:
9 | mov eax, dword ptr [_tab_out_video_disable_video_ptr]
10 | mov al, byte ptr [eax]
11 | test al, al
12 | jz _tab_out_video_reacquire_device_subroutine_original_asm
13 | ;# Video is disabled, return early with AL = 0, do not invoke ResetVideoDevice
14 | xor al, al
15 | ;# Since the hook is partially into the function, we need to properly clean up after ourselves.
16 | pop ebx
17 | add esp, 0x38
18 | ret
19 |
20 | .globl _tab_out_video_reacquire_device_subroutine_original_asm
21 | _tab_out_video_reacquire_device_subroutine_original_asm:
22 | ;# Video is not disabled, undo the hook and proceed as normal
23 | jmp dword ptr [_tab_out_video_device_subroutine_original]
24 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/tab_out_video.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_TAB_OUT_VIDEO_HPP
4 | #define CHIMERA_TAB_OUT_VIDEO_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Remove Halo pausing the video when tabbed out (can be annoying for some people)
9 | */
10 | void enable_tab_out_video() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/update.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _block_update_check_asm
8 | _block_update_check_asm:
9 | push eax
10 | mov eax, dword ptr [_update_check_already_checked]
11 | mov byte ptr [eax], 0
12 | pop eax
13 | mov eax, 2
14 | ret
15 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/update.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | extern "C" {
9 | std::uint32_t block_update_check_asm() noexcept;
10 | std::uint8_t *update_check_already_checked; // did we already check for updates?
11 | }
12 |
13 | void enable_block_update_check() noexcept {
14 | auto &chimera = get_chimera();
15 |
16 | static Hook hook;
17 | auto *check_for_update_fn_call_sig = chimera.get_signature("check_for_update_fn_call_sig").data();
18 | const SigByte nop_call[] = { 0x90, 0x90, 0x90, 0x90, 0x90 };
19 | write_code_s(check_for_update_fn_call_sig, nop_call);
20 | write_jmp_call(check_for_update_fn_call_sig, hook, reinterpret_cast(block_update_check_asm), nullptr, false);
21 |
22 | auto *update_already_checked_sig = chimera.get_signature("update_already_checked_sig").data();
23 | update_check_already_checked = *reinterpret_cast(update_already_checked_sig + 14);
24 | const SigByte write_one_to_eax_here[] = { 0xB8, 0x01, 0x00, 0x00, 0x00 };
25 | write_code_s(update_already_checked_sig, write_one_to_eax_here);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/update.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_UPDATE_HPP
4 | #define CHIMERA_UPDATE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Block Halo's update check
9 | */
10 | void enable_block_update_check() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/watson.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | void remove_watson() noexcept {
9 | auto *data = get_chimera().get_signature("create_watson_process_sig").data();
10 |
11 | const SigByte jmp[] = { 0xEB, 0x25, 0x90 };
12 | write_code_s(data, jmp);
13 |
14 | const SigByte xor_eax_eax[] = { 0x90, 0x90, 0x90, 0x90, 0x31, 0xC0 };
15 | write_code_s(data + 35, xor_eax_eax);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/chimera/annoyance/watson.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_WATSON_HPP
4 | #define CHIMERA_WATSON_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Disable Watson (doesn't work in 2020 due to the servers being down - makes crashes even more annoying)
9 | */
10 | void remove_watson() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/command/client/controller/aim_assist.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/signature.hpp"
5 | #include "../../../chimera.hpp"
6 | #include "../../../output/output.hpp"
7 |
8 | namespace Chimera {
9 | bool aim_assist_command(int argc, const char **argv) {
10 | static auto &active = **reinterpret_cast(get_chimera().get_signature("aim_assist_enabled_sig").data() + 1);
11 | if(argc == 1) {
12 | active = STR_TO_BOOL(argv[0]);
13 | }
14 | console_output(BOOL_TO_STR(active));
15 | return true;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/chimera/command/client/controller/auto_uncrouch.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .globl _auto_uncrouch_asm
6 | _auto_uncrouch_asm:
7 | cmp ecx, 0xA
8 | jne FINISH
9 | call _auto_uncrouch_cpp
10 | cmp eax, 1
11 | jne FINISH
12 | ;# If we're supposed to automatically uncrouch, increment ecx by 1 to skip it
13 | inc ecx
14 | mov dword ptr [esp+0x1C], ecx
15 | FINISH:
16 | ret
17 |
--------------------------------------------------------------------------------
/src/chimera/command/client/controller/block_button_quotes.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool block_button_quotes_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 | if(argc) {
13 | bool new_enabled = STR_TO_BOOL(*argv);
14 | if(new_enabled != enabled) {
15 | auto &chimera = get_chimera();
16 | auto &left = chimera.get_signature("quote_left_sig");
17 | auto &right = chimera.get_signature("quote_right_sig");
18 | if(new_enabled) {
19 | static auto *null_str = L"";
20 | overwrite(left.data() + 1, null_str);
21 | overwrite(right.data() + 1, null_str);
22 | }
23 | else {
24 | left.rollback();
25 | right.rollback();
26 | }
27 | enabled = new_enabled;
28 | }
29 | }
30 | console_output(BOOL_TO_STR(enabled));
31 | return true;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/chimera/command/client/controller/deadzones.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .globl _handle_deadzones_asm
6 | _handle_deadzones_asm:
7 | push [esp+0x18]
8 | call _handle_deadzones_cpp
9 | add esp, 4
10 | mov word ptr [esp+0x18], ax
11 | ret
12 |
--------------------------------------------------------------------------------
/src/chimera/command/client/controller/diagonals.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool diagonals_command(int argc, const char **argv) {
11 | static float positive_diagonal = 0.0F;
12 | static float negative_diagonal = 0.0F;
13 | if(argc == 1) {
14 | positive_diagonal = std::stof(*argv);
15 | if(positive_diagonal < 0.0F) {
16 | positive_diagonal = 0.0F;
17 | }
18 | else if(positive_diagonal > 1.0F) {
19 | positive_diagonal = 1.0F;
20 | }
21 | negative_diagonal = positive_diagonal * -1.0F;
22 | auto diagonals_addr = get_chimera().get_signature("diagonals_sig").data();
23 | overwrite(diagonals_addr + 2, &positive_diagonal);
24 | overwrite(diagonals_addr + 27, &negative_diagonal);
25 | }
26 | console_output("%f", positive_diagonal);
27 | return true;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/chimera/command/client/custom_chat/chat_block_ips.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../custom_chat/custom_chat.hpp"
4 | #include "../../../command/command.hpp"
5 | #include "../../../output/output.hpp"
6 |
7 | namespace Chimera {
8 | bool chat_block_ips_command(int argc, const char **argv) {
9 | if(argc) {
10 | set_block_ips(STR_TO_BOOL(*argv));
11 | }
12 | console_output(BOOL_TO_STR(ips_blocked()));
13 | return true;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/command/client/custom_chat/chat_block_server_messages.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../custom_chat/custom_chat.hpp"
4 | #include "../../../command/command.hpp"
5 | #include "../../../output/output.hpp"
6 |
7 | namespace Chimera {
8 | bool chat_block_server_messages_command(int argc, const char **argv) {
9 | if(argc) {
10 | set_server_messages_blocked(STR_TO_BOOL(*argv));
11 | }
12 | console_output(BOOL_TO_STR(server_messages_blocked()));
13 | return true;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/command/client/custom_chat/chat_color_help.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../custom_chat/custom_chat.hpp"
4 | #include "../../../command/command.hpp"
5 | #include "../../../output/output.hpp"
6 |
7 | namespace Chimera {
8 | bool chat_color_help_command(int argc, const char **argv) {
9 | if(argc) {
10 | set_show_color_help(STR_TO_BOOL(*argv));
11 | }
12 | console_output(BOOL_TO_STR(show_color_help()));
13 | return true;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/command/client/debug/load_ui_map.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../halo_data/map.hpp"
4 | #include "../../../halo_data/menu.hpp"
5 | #include "../../../halo_data/multiplayer.hpp"
6 | #include "../../../output/output.hpp"
7 |
8 | namespace Chimera {
9 | bool load_ui_map_command(int, const char **) {
10 | if(server_type() == SERVER_NONE) {
11 | load_ui_map();
12 | load_main_menu();
13 | }
14 | else {
15 | console_output("You should use the \"disconnect\" command");
16 | }
17 | return true;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/chimera/command/client/enhancement/block_all_bullshit.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../config/config.hpp"
4 | #include "../../../chimera.hpp"
5 |
6 | namespace Chimera {
7 | bool Chimera::block_all_bullshit_command(int, const char **) noexcept {
8 | get_chimera().p_config->set_saving(false);
9 | get_chimera().execute_command("chimera_block_gametype_indicator 1", nullptr, true);
10 | get_chimera().execute_command("chimera_block_gametype_rules 1", nullptr, true);
11 | get_chimera().execute_command("chimera_block_hold_f1 1", nullptr, true);
12 | get_chimera().execute_command("chimera_block_loading_screen 1", nullptr, true);
13 | get_chimera().execute_command("chimera_block_mouse_acceleration 1", nullptr, true);
14 | get_chimera().p_config->set_saving(true);
15 | get_chimera().p_config->save();
16 | return true;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/chimera/command/client/enhancement/block_buffering.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../localization/localization.hpp"
4 |
5 | #include "../../command.hpp"
6 | #include "../../../signature/hook.hpp"
7 | #include "../../../signature/signature.hpp"
8 | #include "../../../chimera.hpp"
9 | #include "../../../output/output.hpp"
10 |
11 | namespace Chimera {
12 | bool block_buffering_command(int argc, const char **argv) {
13 | static bool active = false;
14 | if(argc == 1) {
15 | bool new_value = STR_TO_BOOL(argv[0]);
16 | if(new_value != active) {
17 | auto &setting = **reinterpret_cast(get_chimera().get_signature("disable_buffering_sig").data() + 1);
18 | if(new_value && setting) {
19 | console_warning(localize("chimera_block_buffering_command_warning"));
20 | }
21 | overwrite(&setting, static_cast(new_value));
22 | active = new_value;
23 | }
24 | }
25 | console_output(BOOL_TO_STR(active));
26 | return true;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/chimera/command/client/enhancement/block_extra_weapon.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 | .globl _block_extra_weapon_asm
7 | _block_extra_weapon_asm:
8 | pushfd
9 | pushad
10 | ;# Promote ax to a 32-bit integer and push it
11 | movsx eax, ax
12 | push eax
13 |
14 | ;# Call our thing
15 | call _get_next_actual_unblocked_weapon
16 | add esp, 4
17 |
18 | ;# Check if we got 0xFFFFFFFF. If not, set ax to it
19 | cmp eax, 0xFFFFFFFF
20 | je finish_blocking_extra_weapon
21 | mov dword ptr [esp+0x1C], eax
22 |
23 | ;# Done
24 | finish_blocking_extra_weapon:
25 | popad
26 | popfd
27 | ret
28 |
--------------------------------------------------------------------------------
/src/chimera/command/client/enhancement/fp_reverb.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../fix/fp_reverb.hpp"
5 | #include "../../../output/output.hpp"
6 |
7 | namespace Chimera {
8 | bool fp_reverb_command(int argc, const char **argv) {
9 | static bool enabled = false;
10 | if(argc) {
11 | bool new_setting = STR_TO_BOOL(argv[0]);
12 | if(new_setting) {
13 | set_up_fp_reverb_fix();
14 | }
15 | else {
16 | disable_fp_reverb_fix();
17 | }
18 | enabled = new_setting;
19 | }
20 | console_output(BOOL_TO_STR(enabled));
21 | return true;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/chimera/command/client/enhancement/set_color.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 | .globl _get_set_color_setting_asm
7 | _get_set_color_setting_asm:
8 | ;# Set ecx to a pointer to its old value
9 | push ecx
10 | mov ecx, esp
11 |
12 | ;# pushad/fd this stuff so we don't mangle everything
13 | pushfd
14 | pushad
15 |
16 | ;# Get the color setting, backing up ecx (I think srand() mangles it?)
17 | push ecx
18 | call _get_set_color_setting
19 | pop ecx
20 | mov dword ptr [ecx], eax
21 |
22 | ;# Done
23 | popad
24 | popfd
25 |
26 | ;# Now set ecx to the thing
27 | pop ecx
28 |
29 | ;# Done!
30 | ret
31 |
--------------------------------------------------------------------------------
/src/chimera/command/client/lua/reload_scripts.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include
5 | #include "../../command.hpp"
6 | #include "../../../localization/localization.hpp"
7 | #include "../../../output/output.hpp"
8 | #include "../../../chimera.hpp"
9 | #include "../../../lua/lua_script.hpp"
10 |
11 | namespace Chimera {
12 | bool reload_scripts_command(int, const char **) {
13 | // Reload everything
14 | unload_scripts();
15 | load_global_scripts();
16 | load_map_script();
17 |
18 | // Remove the output prefix
19 | extern const char *output_prefix;
20 | output_prefix = nullptr;
21 |
22 | ConsoleColor green = {1, 0.235, 0.82, 0};
23 | console_output(green, localize("chimera_lua_scripts_were_reloaded"));
24 | return true;
25 | }
26 | }
--------------------------------------------------------------------------------
/src/chimera/command/client/server/spam_to_join.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .globl _on_error_dialog_asm
6 | _on_error_dialog_asm:
7 | ;# check if it's index 0x2E which is "The server is full."
8 | cmp si, 0x2E
9 | jne skip_spam_to_join
10 | call _on_spam_to_join
11 | skip_spam_to_join:
12 | ret
13 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/af.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool af_command(int argc, const char **argv) {
11 | static bool active = false;
12 | if(argc == 1) {
13 | bool new_value = STR_TO_BOOL(argv[0]);
14 | if(new_value != active) {
15 | auto &setting = **reinterpret_cast(get_chimera().get_signature("af_is_enabled_sig").data() + 1);
16 | if(new_value && setting) {
17 | console_warning("Anisotropic Filtering is already enabled (likely via config.txt)!");
18 | }
19 | overwrite(&setting, static_cast(new_value));
20 | active = new_value;
21 | }
22 | }
23 | console_output(BOOL_TO_STR(active));
24 | return true;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/block_auto_center.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../signature/hook.hpp"
4 | #include "../../../signature/signature.hpp"
5 | #include "../../../chimera.hpp"
6 | #include "../../../fix/auto_center.hpp"
7 | #include "../../../localization/localization.hpp"
8 | #include "../../../output/output.hpp"
9 |
10 | namespace Chimera {
11 | bool block_auto_center_command(int argc, const char **argv) {
12 | static bool setting = false;
13 | if(argc == 1) {
14 | bool val = STR_TO_BOOL(argv[0]);
15 | if(val != setting) {
16 | set_up_auto_center_fix(val);
17 | setting = val;
18 | }
19 | }
20 | console_output("%s", setting ? "true" : "false");
21 | return true;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/block_camera_shake.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool block_camera_shake_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 |
13 | // Check if the user supplied an argument.
14 | if(argc) {
15 | // Check the value of the argument and see if it differs from the current setting.
16 | bool new_enabled = STR_TO_BOOL(argv[0]);
17 | if(new_enabled != enabled) {
18 | auto &block_camera_shake_sig = get_chimera().get_signature("block_camera_shake_sig");
19 | if(new_enabled) {
20 | overwrite(block_camera_shake_sig.data(), static_cast(0x90));
21 | overwrite(block_camera_shake_sig.data() + 1, static_cast(0xE9));
22 | }
23 | else {
24 | block_camera_shake_sig.rollback();
25 | }
26 | enabled = new_enabled;
27 | }
28 | }
29 |
30 | console_output(BOOL_TO_STR(enabled));
31 |
32 | return true;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/block_gametype_indicator.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool block_gametype_indicator_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 |
13 | // Check if the user supplied an argument.
14 | if(argc) {
15 | // Check the value of the argument and see if it differs from the current setting.
16 | bool new_enabled = STR_TO_BOOL(argv[0]);
17 | if(new_enabled != enabled) {
18 | auto *team_icon_background_name = *reinterpret_cast(get_chimera().get_signature("team_icon_background_name_sig").data() + 1);
19 |
20 | if(new_enabled) {
21 | overwrite(team_icon_background_name, 'x');
22 | }
23 | else {
24 | overwrite(team_icon_background_name, 'u');
25 | }
26 | enabled = new_enabled;
27 | }
28 | }
29 |
30 | console_output(BOOL_TO_STR(enabled));
31 |
32 | return true;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/block_gametype_rules.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool block_gametype_rules_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 |
13 | // Check if the user supplied an argument.
14 | if(argc) {
15 | // Check the value of the argument and see if it differs from the current setting.
16 | bool new_enabled = STR_TO_BOOL(argv[0]);
17 | if(new_enabled != enabled) {
18 | auto &gametype_rules_sig = get_chimera().get_signature("gametype_rules_sig");
19 | if(new_enabled) {
20 | overwrite(gametype_rules_sig.data() + 6, static_cast(0));
21 | }
22 | else {
23 | gametype_rules_sig.rollback();
24 | }
25 | enabled = new_enabled;
26 | }
27 | }
28 |
29 | console_output(BOOL_TO_STR(enabled));
30 |
31 | return true;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/block_hold_f1.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool block_hold_f1_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 |
13 | // Check if the user supplied an argument.
14 | if(argc) {
15 | // Check the value of the argument and see if it differs from the current setting.
16 | bool new_enabled = STR_TO_BOOL(argv[0]);
17 | if(new_enabled != enabled) {
18 | auto &hold_f1_sig = get_chimera().get_signature("hold_f1_sig");
19 | if(new_enabled) {
20 | overwrite(hold_f1_sig.data() + 3, static_cast(0));
21 | }
22 | else {
23 | hold_f1_sig.rollback();
24 | }
25 | enabled = new_enabled;
26 | }
27 | }
28 |
29 | console_output(BOOL_TO_STR(enabled));
30 |
31 | return true;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/block_letterbox.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../output/output.hpp"
4 | #include "../../../command/command.hpp"
5 | #include "../../../event/tick.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../signature/signature.hpp"
8 |
9 | namespace Chimera {
10 | static float **letterbox;
11 | static void block_letterbox() noexcept {
12 | **letterbox = -0.5;
13 | }
14 |
15 | bool block_letterbox_command(int argc, const char **argv) noexcept {
16 | static auto active = false;
17 | if(argc) {
18 | bool new_value = STR_TO_BOOL(argv[0]);
19 | letterbox = *reinterpret_cast(get_chimera().get_signature("letterbox_sig").data() + 2);
20 | if(new_value != active) {
21 | active = new_value;
22 | if(active) {
23 | add_tick_event(block_letterbox);
24 | }
25 | else {
26 | remove_tick_event(block_letterbox);
27 | }
28 | }
29 | }
30 | console_output(BOOL_TO_STR(active));
31 | return true;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/block_multitexture_overlays.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool block_multitexture_overlays_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 |
13 | // Check if the user supplied an argument.
14 | if(argc) {
15 | // Check the value of the argument and see if it differs from the current setting.
16 | bool new_enabled = STR_TO_BOOL(argv[0]);
17 | if(new_enabled != enabled) {
18 | auto &multitexture_overlay_sig = get_chimera().get_signature("multitexture_overlay_sig");
19 | if(new_enabled) {
20 | const SigByte mod[] = { -1, -1, 0x60 };
21 | write_code_s(multitexture_overlay_sig.data(), mod);
22 | }
23 | else {
24 | multitexture_overlay_sig.rollback();
25 | }
26 | enabled = new_enabled;
27 | }
28 | }
29 |
30 | console_output(BOOL_TO_STR(enabled));
31 |
32 | return true;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/force_alternate_bump_attenuation.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../output/output.hpp"
5 | #include "../../../fix/alternate_bump_attenuation.hpp"
6 |
7 | namespace Chimera {
8 | bool force_alternate_bump_attenuation_command(int argc, const char **argv) {
9 | static bool enabled = false;
10 | if(argc) {
11 | bool new_enabled = STR_TO_BOOL(argv[0]);
12 | if(new_enabled != enabled) {
13 | if(!new_enabled) {
14 | disable_forced_alternate_bump_attenuation();
15 | }
16 | else {
17 | enable_forced_alternate_bump_attenuation();
18 | }
19 | enabled = new_enabled;
20 | }
21 | }
22 | console_output(BOOL_TO_STR(enabled));
23 | return true;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/interpolate.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 |
5 | #include "../../command.hpp"
6 | #include "../../../output/output.hpp"
7 | #include "../../../fix/interpolate/interpolate.hpp"
8 |
9 | namespace Chimera {
10 | bool interpolate_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 | if(argc) {
13 | bool new_enabled = STR_TO_BOOL(argv[0]);
14 | if(new_enabled != enabled) {
15 | if(new_enabled) {
16 | set_up_interpolation();
17 | }
18 | else {
19 | disable_interpolation();
20 | }
21 | enabled = new_enabled;
22 | }
23 | }
24 | console_output(BOOL_TO_STR(enabled));
25 | return true;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/meme_zone.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool meme_zone_command(int argc, const char **argv) {
11 | float value = 1.0F;
12 | if(argc == 1) {
13 | try {
14 | value = std::stof(argv[0]);
15 | }
16 | catch(std::exception &) {
17 | value = 0.0F;
18 | }
19 | if(value <= 1.0F) {
20 | value = 1.0F;
21 | }
22 |
23 | overwrite(get_chimera().get_signature("widescreen_text_scaling_sig").data() + 0x9C, value);
24 | overwrite(get_chimera().get_signature("widescreen_element_motion_sensor_scaling_sig").data() + 0xA6, value);
25 | overwrite(get_chimera().get_signature("widescreen_element_scaling_sig").data() + 0x96, value);
26 | }
27 | console_output("%f", value);
28 | return true;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/model_detail.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../fix/model_detail.hpp"
5 | #include "../../../output/output.hpp"
6 |
7 | namespace Chimera {
8 | bool model_detail_command(int argc, const char **argv) {
9 | if(argc) {
10 | set_model_detail(std::atof(*argv));
11 | }
12 | console_output("%f", get_model_detail());
13 | return true;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/uncap_cinematic.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../command.hpp"
4 | #include "../../../signature/hook.hpp"
5 | #include "../../../signature/signature.hpp"
6 | #include "../../../chimera.hpp"
7 | #include "../../../output/output.hpp"
8 |
9 | namespace Chimera {
10 | bool uncap_cinematic_command(int argc, const char **argv) {
11 | static bool enabled = false;
12 | if(argc == 1) {
13 | // Check the value of the argument and see if it differs from the current setting.
14 | bool new_enabled = STR_TO_BOOL(argv[0]);
15 | if(new_enabled != enabled) {
16 | auto &uncap_cinematic_sig = get_chimera().get_signature("uncap_cinematic_sig");
17 | if(new_enabled) {
18 | const SigByte uncap_cinematic_data[] = {0xEB, 0x04, 0xB3, 0x01, 0xEB, 0x02, 0x32, 0xDB, 0x8B, 0x2D};
19 | write_code_s(uncap_cinematic_sig.data(), uncap_cinematic_data);
20 | }
21 | else {
22 | uncap_cinematic_sig.rollback();
23 | }
24 | enabled = new_enabled;
25 | }
26 | }
27 | console_output(BOOL_TO_STR(enabled));
28 | return true;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/chimera/command/client/visual/widescreen_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../../../fix/widescreen_fix.hpp"
4 | #include "../../../output/output.hpp"
5 | #include "../../../localization/localization.hpp"
6 | #include "../../../halo_data/hud_fonts.hpp"
7 | #include "../../command.hpp"
8 |
9 | namespace Chimera {
10 | bool widescreen_fix_command(int argc, const char **argv) {
11 | static auto setting = WidescreenFixSetting::WIDESCREEN_OFF;
12 | if(argc) {
13 | int new_setting = std::atoi(argv[0]);
14 | if(new_setting < 0) {
15 | new_setting = 0;
16 | }
17 | else if(new_setting > 2) {
18 | new_setting = 2;
19 | }
20 | if(new_setting == 0 && STR_TO_BOOL(argv[0])) {
21 | new_setting = 1;
22 | }
23 |
24 | setting = static_cast(new_setting);
25 |
26 | if(!setting && hud_text_mod_initialized()) {
27 | console_warning(localize("chimera_widescreen_fix_command_warning_cannot_disable_font_override_enabled"));
28 | }
29 | else {
30 | set_widescreen_fix(setting);
31 | }
32 | }
33 | console_output("%i", setting);
34 | return true;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/chimera/command/core/server/block_equipment_rotation.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | ;# Load 0
8 | .globl _null_equipment_spawn_rotation
9 | _null_equipment_spawn_rotation:
10 | sub esp, 4
11 | mov dword ptr [esp], 0
12 | fld dword ptr [esp]
13 | add esp, 4
14 | ret
15 |
--------------------------------------------------------------------------------
/src/chimera/command/hotkey.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_HOTKEY_HPP
4 | #define CHIMERA_HOTKEY_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Set up hotkeys
9 | */
10 | void set_up_hotkeys() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/console/console.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .data
6 | console_fade_fn_addr: .long 0
7 |
8 | .text
9 | console_fade_fn_sig: .string "console_fade_fn_sig"
10 |
11 | .globl _fade_out_console_asm
12 | _fade_out_console_asm:
13 | pushfd
14 | pushad
15 |
16 | cmp dword ptr console_fade_fn_addr, 0
17 | jnz do_fade_out_console
18 | lea eax, byte ptr console_fade_fn_sig
19 | push eax
20 | call _address_for_signature
21 | mov console_fade_fn_addr, eax
22 | pop eax
23 |
24 | do_fade_out_console:
25 | call dword ptr console_fade_fn_addr
26 |
27 | popad
28 | popfd
29 | ret
30 |
31 | .globl _override_console_output_eax_asm
32 | _override_console_output_eax_asm:
33 | ;# Color
34 | push ebx
35 | mov ebx, eax
36 | add ebx, 0x103
37 | push ebx
38 |
39 | ;# String
40 | push eax
41 |
42 | call _on_console_output
43 |
44 | ;# Done!
45 | add esp, 8
46 | xor eax, eax
47 | pop ebx
48 | ret
49 |
50 | .globl _override_console_output_edi_asm
51 | _override_console_output_edi_asm:
52 | ;# Color
53 | push ebx
54 | mov ebx, edi
55 | add ebx, 0x103
56 | push ebx
57 |
58 | ;# String
59 | push edi
60 |
61 | call _on_console_output
62 |
63 | ;# Done!
64 | add esp, 8
65 | xor eax, eax
66 | pop ebx
67 | ret
68 |
--------------------------------------------------------------------------------
/src/chimera/custom_chat/custom_chat.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CUSTOM_CHAT_HPP
4 | #define CHIMERA_CUSTOM_CHAT_HPP
5 | namespace Chimera {
6 | /**
7 | * Initialize the custom chat
8 | */
9 | void initialize_custom_chat() noexcept;
10 |
11 | /**
12 | * Check if the custom chat was enabled
13 | * @return true if enabled, false if not
14 | */
15 | bool custom_chat_enabled() noexcept;
16 |
17 | /**
18 | * Add a chat message to the server messages
19 | * @param message message to add
20 | */
21 | void add_server_message(const char *message);
22 |
23 | /**
24 | * Set whether to show color help
25 | * @param show_help true to show color help
26 | */
27 | void set_show_color_help(bool show_help) noexcept;
28 |
29 | /**
30 | * Get whether or not to show color help
31 | * @return true if showing color help
32 | */
33 | bool show_color_help() noexcept;
34 |
35 | /**
36 | * Get whether or not to block ips
37 | * @return true if blocking ips
38 | */
39 | bool ips_blocked() noexcept;
40 |
41 | /**
42 | * Set whether or not to block ips
43 | * @param block should block ips
44 | */
45 | void set_block_ips(bool block) noexcept;
46 | }
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/chimera/event/camera.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CAMERA_HPP
4 | #define CHIMERA_CAMERA_HPP
5 |
6 | #include "event.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Add or replace a precamera event. This event occurs before the camera is read.
11 | * @param function This is the function
12 | * @param priority Priority to use
13 | */
14 | void add_precamera_event(const EventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
15 |
16 | /**
17 | * Remove a precamera event if the function is being used as an event.
18 | * @param function This is the function
19 | */
20 | void remove_precamera_event(const EventFunction function);
21 |
22 | /**
23 | * Add or replace a camera event. This event occurs after the camera is read.
24 | * @param function This is the function
25 | * @param priority Priority to use
26 | */
27 | void add_camera_event(const EventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
28 |
29 | /**
30 | * Remove a camera event if the function is being used as an event.
31 | * @param function This is the function
32 | */
33 | void remove_camera_event(const EventFunction function);
34 | }
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/chimera/event/command.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "command.hpp"
4 |
5 | namespace Chimera {
6 | std::vector> command_events;
7 |
8 | void add_command_event(const CommandEventFunction function, EventPriority priority) {
9 | // Remove if exists
10 | remove_command_event(function);
11 |
12 | // Add the event
13 | command_events.emplace_back(Event { function, priority });
14 | }
15 |
16 | void remove_command_event(const CommandEventFunction function) {
17 | for(std::size_t i = 0; i < command_events.size(); i++) {
18 | if(command_events[i].function == function) {
19 | command_events.erase(command_events.begin() + i);
20 | return;
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/chimera/event/command.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_COMMAND_EVENT_HPP
4 | #define CHIMERA_COMMAND_EVENT_HPP
5 |
6 | #include "../event/event.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * This is an event that is triggered when a command is executed via the console.
11 | * @param command This is the command.
12 | * @return Return true to allow the command to pass or false to not.
13 | */
14 | using CommandEventFunction = bool (*)(const char *command);
15 |
16 | /**
17 | * Add or replace a command event. This event occurs just before a command is executed.
18 | * @param function This is the function to add
19 | * @param priority This is the priority used to determine call order.
20 | */
21 | void add_command_event(const CommandEventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
22 |
23 | /**
24 | * Remove a command event if the function is being used as an event.
25 | * @param function This is the function to remove
26 | */
27 | void remove_command_event(const CommandEventFunction function);
28 | }
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/chimera/event/connect.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _on_preconnect_asm
8 | _on_preconnect_asm:
9 | pushfd
10 | pushad
11 |
12 | lea ecx, dword ptr [ecx+0x2]
13 | push ecx
14 | lea eax, dword ptr [ebx+0x12]
15 | push eax
16 | push ebx
17 | call _on_preconnect
18 | add esp, 0xC
19 | cmp eax, 0
20 | je block_event
21 |
22 | popad
23 | popfd
24 | jmp dword ptr [_continue_preconnect]
25 |
26 | block_event:
27 | popad
28 | popfd
29 | xor eax, eax
30 | ret
31 |
--------------------------------------------------------------------------------
/src/chimera/event/connect.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CONNECT_HPP
4 | #define CHIMERA_CONNECT_HPP
5 |
6 | #include
7 |
8 | #include "event.hpp"
9 |
10 | namespace Chimera {
11 | using ConnectEventFunction = bool (*)(std::uint32_t &ip, std::uint16_t &port, const char *password);
12 |
13 | /**
14 | * Add or replace a preconnect event. This event occurs before a connection is made.
15 | * @param function This is the function
16 | * @param priority Priority to use
17 | */
18 | void add_preconnect_event(const ConnectEventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
19 |
20 | /**
21 | * Remove a preconnect event if the function is being used as an event.
22 | * @param function This is the function
23 | */
24 | void remove_preconnect_event(const ConnectEventFunction function);
25 | }
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/src/chimera/event/d3d9_end_scene.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _on_d3d9_end_scene_asm
8 | _on_d3d9_end_scene_asm:
9 | pushfd
10 | pushad
11 |
12 | push dword ptr [esp+0x28]
13 | call _do_d3d9_end_scene_event
14 | add esp, 4
15 |
16 | popad
17 | popfd
18 | ret
19 |
--------------------------------------------------------------------------------
/src/chimera/event/d3d9_end_scene.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA__EVENT__D3D9_END_SCENE_HPP
4 | #define CHIMERA__EVENT__D3D9_END_SCENE_HPP
5 |
6 | #include
7 |
8 | #include "../event/event.hpp"
9 |
10 | namespace Chimera {
11 | /**
12 | * This is an event that is triggered just before EndScene is called.
13 | * @param device This is the device.
14 | */
15 | using EndSceneEventFunction = void (*)(LPDIRECT3DDEVICE9 device);
16 |
17 | /**
18 | * Add or replace an EndScene event. This event occurs just before EndScene is executed.
19 | * @param function This is the function to add
20 | * @param priority This is the priority used to determine call order.
21 | */
22 | void add_d3d9_end_scene_event(const EndSceneEventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
23 |
24 | /**
25 | * Remove an EndScene event if the function is being used as an event.
26 | * @param function This is the function to remove
27 | */
28 | void remove_d3d9_end_scene_event(const EndSceneEventFunction function);
29 | }
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/src/chimera/event/d3d9_reset.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _on_d3d9_reset_asm
8 | _on_d3d9_reset_asm:
9 | pushfd
10 | pushad
11 |
12 | push dword ptr [esp+0x28]
13 | push dword ptr [esp+0x30]
14 | call _do_d3d9_reset_event
15 | add esp, 8
16 |
17 | popad
18 | popfd
19 | ret
20 |
--------------------------------------------------------------------------------
/src/chimera/event/d3d9_reset.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA__EVENT__D3D9_RESET_HPP
4 | #define CHIMERA__EVENT__D3D9_RESET_HPP
5 |
6 | #include
7 |
8 | #include "../event/event.hpp"
9 |
10 | namespace Chimera {
11 | /**
12 | * This is an event that is triggered just before Reset is called.
13 | * @param device This is the device.
14 | * @param present This is the present parameters.
15 | */
16 | using ResetEventFunction = void (*)(LPDIRECT3DDEVICE9 device, D3DPRESENT_PARAMETERS *present);
17 |
18 | /**
19 | * Add or replace an Reset event. This event occurs just before Reset is executed.
20 | * @param function This is the function to add
21 | * @param priority This is the priority used to determine call order.
22 | */
23 | void add_d3d9_reset_event(const ResetEventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
24 |
25 | /**
26 | * Remove an Reset event if the function is being used as an event.
27 | * @param function This is the function to remove
28 | */
29 | void remove_d3d9_reset_event(const ResetEventFunction function);
30 | }
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/src/chimera/event/damage.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _on_damage_asm
8 | _on_damage_asm:
9 | pushfd
10 | pushad
11 |
12 | push dword ptr [esp+0x28]
13 | lea eax, dword ptr [esp+0x30]
14 | push eax
15 | call _do_damage_event
16 | add esp, 8
17 |
18 | test al,al
19 | jnz do_damage_effect
20 | popad
21 | popfd
22 | ret
23 |
24 | do_damage_effect:
25 | popad
26 | popfd
27 | jmp dword ptr [_do_continue_damage_effect]
28 |
--------------------------------------------------------------------------------
/src/chimera/event/frame.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FRAME_HPP
4 | #define CHIMERA_FRAME_HPP
5 |
6 | #include "event.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Add or replace a preframe event. This event occurs before the frame.
11 | * @param function This is the function
12 | * @param priority Priority to use
13 | */
14 | void add_preframe_event(const EventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
15 |
16 | /**
17 | * Remove a preframe event if the function is being used as an event.
18 | * @param function This is the function
19 | */
20 | void remove_preframe_event(const EventFunction function);
21 |
22 | /**
23 | * Add or replace a frame event. This event occurs after the frame.
24 | * @param function This is the function
25 | * @param priority Priority to use
26 | */
27 | void add_frame_event(const EventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
28 |
29 | /**
30 | * Remove a frame event if the function is being used as an event.
31 | * @param function This is the function
32 | */
33 | void remove_frame_event(const EventFunction function);
34 | }
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/chimera/event/map_load.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_EVENT_MAP_LOAD_HPP
4 | #define CHIMERA_EVENT_MAP_LOAD_HPP
5 |
6 | #include "event.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Add or replace a map load event. This event occurs once a map is loaded.
11 | * @param function This is the function
12 | * @param priority Priority to use
13 | */
14 | void add_map_load_event(const EventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
15 |
16 | /**
17 | * Remove a map load event if the function is being used as an event.
18 | * @param function This is the function
19 | */
20 | void remove_map_load_event(const EventFunction function);
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/chimera/event/rcon_message.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "rcon_message.hpp"
4 |
5 | namespace Chimera {
6 | static std::vector> rcon_message_events;
7 |
8 | void add_rcon_message_event(const RconMessageEvent function, EventPriority priority) {
9 | // Remove if exists
10 | remove_rcon_message_event(function);
11 |
12 | // Enable tick hook if not enabled
13 | set_up_rcon_message_hook();
14 |
15 | // Add the event
16 | rcon_message_events.emplace_back(Event { function, priority });
17 | }
18 |
19 | void remove_rcon_message_event(const RconMessageEvent function) {
20 | for(std::size_t i = 0; i < rcon_message_events.size(); i++) {
21 | if(rcon_message_events[i].function == function) {
22 | rcon_message_events.erase(rcon_message_events.begin() + i);
23 | return;
24 | }
25 | }
26 | }
27 |
28 | bool call_rcon_message_events(const char* message) noexcept {
29 | bool allow = true;
30 | call_in_order_allow(rcon_message_events, allow, message);
31 | return allow;
32 | }
33 | }
--------------------------------------------------------------------------------
/src/chimera/event/rcon_message.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_RCON_MESSAGE_HPP
4 | #define CHIMERA_RCON_MESSAGE_HPP
5 |
6 | #include "../output/output.hpp"
7 | #include "event.hpp"
8 |
9 | namespace Chimera {
10 | using RconMessageEvent = bool (*)(const char *);
11 |
12 | /**
13 | * Add or replace a rcon message event. This event occurs after a RCON command.
14 | * @param function This is the function to add
15 | * @param priority This is the priority used to determine call order.
16 | */
17 | void add_rcon_message_event(const RconMessageEvent function, EventPriority priority);
18 |
19 | /**
20 | * Remove a rcon message event if the function is being used as an event.
21 | * @param function This is the function to remove
22 | */
23 | void remove_rcon_message_event(const RconMessageEvent function);
24 |
25 | /**
26 | * Calls the RCON Message events
27 | */
28 | bool call_rcon_message_events(const char *message) noexcept;
29 | }
30 |
31 | #endif
--------------------------------------------------------------------------------
/src/chimera/event/revert.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_EVENT_REVERT_HPP
4 | #define CHIMERA_EVENT_REVERT_HPP
5 |
6 | #include "event.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Add or replace a revert event. This event occurs before the reverting (or core loading, or restarting level, or loading a new level etc).
11 | * @param function This is the function
12 | * @param priority Priority to use
13 | */
14 | void add_revert_event(const EventFunction function, EventPriority priority = EventPriority::EVENT_PRIORITY_DEFAULT);
15 |
16 | /**
17 | * Remove a revert event if the function is being used as an event.
18 | * @param function This is the function
19 | */
20 | void remove_revert_event(const EventFunction function);
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/chimera/fix/abolish_safe_mode.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "abolish_safe_mode.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/hook.hpp"
6 | #include "../signature/signature.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_abolish_safe_mode() noexcept {
10 | auto *safe_mode = get_chimera().get_signature("auto_save_mode_sig").data();
11 | const SigByte fuck_safe_mode[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
12 | write_code_s(safe_mode, fuck_safe_mode);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/abolish_safe_mode.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_ABOLISH_SAFE_MODE_HPP
4 | #define CHIMERA_ABOLISH_SAFE_MODE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Remove the safe mode for it is evil
9 | */
10 | void set_up_abolish_safe_mode() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/af.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 | .global _schi_set_sampler_states_for_af_asm
7 | _schi_set_sampler_states_for_af_asm:
8 | push esi
9 | push edi
10 | call _set_sampler_states_for_chicago
11 | add esp, 8
12 | ret
13 |
14 | .global _scex_set_sampler_states_for_af_asm
15 | _scex_set_sampler_states_for_af_asm:
16 | push esi
17 | push ebp
18 | call _set_sampler_states_for_chicago
19 | add esp, 8
20 | ret
--------------------------------------------------------------------------------
/src/chimera/fix/af.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_AF_HPP
4 | #define CHIMERA_AF_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Enable AF for models and decals.
9 | */
10 | void set_up_model_af() noexcept;
11 | }
12 |
13 | #endif
--------------------------------------------------------------------------------
/src/chimera/fix/aim_assist.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 | .globl _on_aim_assist
7 | _on_aim_assist:
8 | mov eax, [_using_analog_movement]
9 | cmp byte ptr [eax], 1
10 | jnz not_actually_using_aim_assist
11 | jmp dword ptr [_yes_using_analog_movement_jmp]
12 | not_actually_using_aim_assist:
13 | jmp dword ptr [_not_using_analog_movement_jmp]
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/aim_assist.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "aim_assist.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/hook.hpp"
6 | #include "../signature/signature.hpp"
7 |
8 | extern "C" {
9 | std::uint8_t *using_analog_movement = nullptr;
10 | std::byte *not_using_analog_movement_jmp = nullptr;
11 | std::byte *yes_using_analog_movement_jmp = nullptr;
12 |
13 | void on_aim_assist();
14 | }
15 |
16 | namespace Chimera {
17 | void set_up_aim_assist_fix() noexcept {
18 | auto *should_use_aim_assist_addr = get_chimera().get_signature("should_use_aim_assist_sig").data();
19 | using_analog_movement = *reinterpret_cast(should_use_aim_assist_addr + 2);
20 | static const SigByte nop[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
21 | write_code_s(should_use_aim_assist_addr, nop);
22 |
23 | auto *aim_assist = get_chimera().get_signature("aim_assist_sig").data();
24 | not_using_analog_movement_jmp = aim_assist + 0x2 + 0x6 + 0x36E;
25 | yes_using_analog_movement_jmp = aim_assist + 0x2 + 0x6;
26 | static Hook hook;
27 | const void *old_fn;
28 | write_function_override(aim_assist, hook, reinterpret_cast(on_aim_assist), &old_fn);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/chimera/fix/aim_assist.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_AIM_ASSIST_HPP
4 | #define CHIMERA_AIM_ASSIST_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Set up the aim assist fix
9 | */
10 | void set_up_aim_assist_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/alternate_bump_attenuation.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .global _set_psh_constant_for_alternate_bump_retail_asm
8 | _set_psh_constant_for_alternate_bump_retail_asm:
9 | push edi
10 | push ebx
11 | call _set_psh_constant_for_alternate_bump
12 | add esp, 8
13 | ret
14 |
15 | .global _set_psh_constant_for_alternate_bump_custom_asm
16 | _set_psh_constant_for_alternate_bump_custom_asm:
17 | push edx
18 | push esi
19 | call _set_psh_constant_for_alternate_bump
20 | add esp, 8
21 | ret
--------------------------------------------------------------------------------
/src/chimera/fix/alternate_bump_attenuation.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_ALTERNATE_BUMP_ATTENUATION
4 | #define CHIMERA_ALTERNATE_BUMP_ATTENUATION
5 |
6 | namespace Chimera {
7 | /**
8 | * Enables support for the "use alternate bump attenuation" flag.
9 | */
10 | void set_up_alternate_bump_attenuation_support() noexcept;
11 |
12 | /**
13 | * Always use the alternate bump attenuation behaviour.
14 | */
15 | void enable_forced_alternate_bump_attenuation() noexcept;
16 |
17 | /**
18 | * Only use alternate bump attenuation if the "use alternate bump attenuation" flag is set.
19 | */
20 | void disable_forced_alternate_bump_attenuation() noexcept;
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/chimera/fix/auto_center.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_AUTO_CENTER_HPP
4 | #define CHIMERA_AUTO_CENTER_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix auto look centering
9 | * @param disabled disable auto centering completely instead
10 | */
11 | void set_up_auto_center_fix(bool disabled = false) noexcept;
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/biped_ui_spawn.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_BIPED_UI_SPAWN_HPP
4 | #define CHIMERA_BIPED_UI_SPAWN_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix empty register validation when biped spawns in a UI map
9 | */
10 | void set_up_fix_biped_ui_spawn() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/bitmap_formats.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 |
5 | #include "bitmap_formats.hpp"
6 | #include "../chimera.hpp"
7 | #include "../signature/hook.hpp"
8 | #include "../signature/signature.hpp"
9 |
10 | namespace Chimera {
11 | void set_up_bitmap_formats() noexcept {
12 | auto *y8 = *reinterpret_cast(get_chimera().get_signature("supported_bitmap_formats").data() + 8) + 1;
13 | auto *a8y8 = *reinterpret_cast(get_chimera().get_signature("supported_bitmap_formats").data() + 8) + 3;
14 |
15 | overwrite(y8, D3DFMT_L8);
16 | overwrite(a8y8, D3DFMT_A8L8);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/chimera/fix/bitmap_formats.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_BITMAP_FORMATS_HPP
4 | #define CHIMERA_BITMAP_FORMATS_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Support Y8 and A8Y8 monochrome bitmap formats.
9 | */
10 | void set_up_bitmap_formats() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/blue_32bit_color_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | void set_up_blue_32bit_color_fix() noexcept {
9 | // For whatever reason, they made it so it reads the color as an 8-bit value instead of a 32-bit value when it comes to explosion colors
10 | auto *data = get_chimera().get_signature("blue_32bit_color_sig").data();
11 |
12 | const SigByte BLUE_32BIT_COLOR_FIX[] = { 0x8B, 0x34, 0x3A, 0x90 };
13 | write_code_s(data + 6, BLUE_32BIT_COLOR_FIX);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/fix/blue_32bit_color_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_BLUE_32BIT_COLOR_FIX_HPP
4 | #define CHIMERA_BLUE_32BIT_COLOR_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix 32-bit A8R8G8B8 environment maps resulting in blue particles.
9 | */
10 | void set_up_blue_32bit_color_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/bullshit_server_data.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 | .globl _check_for_bullshit_server_data_asm
7 | _check_for_bullshit_server_data_asm:
8 | pushfd
9 | pushad
10 |
11 | ;# Push a pointer to the buffer
12 | mov ebx, dword ptr [eax + 0x4]
13 | push ebx
14 |
15 | ;# Push a pointer to the key we're dealing with
16 | mov ebx, dword ptr [esp + 0x2C]
17 | push ebx
18 |
19 | ;# Hold eax in the ebx register so we can set it back
20 | mov ebx, eax
21 |
22 | ;# Call it
23 | call _strip_bullshit_server_data
24 | add esp, 0x8
25 |
26 | ;# Move it back
27 | mov dword ptr [ebx + 4], eax
28 |
29 | popad
30 | popfd
31 | ret
32 |
--------------------------------------------------------------------------------
/src/chimera/fix/bullshit_server_data.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../event/tick.hpp"
7 |
8 | namespace Chimera {
9 | extern "C" void *check_for_bullshit_server_data_asm() noexcept;
10 |
11 | void set_up_bullshit_server_data_fix() noexcept {
12 | auto *data = get_chimera().get_signature("read_query_value_sig").data();
13 | static Hook hook;
14 | write_jmp_call(data + 1, hook, reinterpret_cast(check_for_bullshit_server_data_asm), nullptr, false);
15 | }
16 |
17 | extern "C" const std::uint8_t *strip_bullshit_server_data(const char *key, const std::uint8_t *bullshit_server_data) noexcept {
18 | static const char *filtered_out = "Halo";
19 |
20 | // If this is not hostname, do nothing
21 | if(std::strcmp(key, "hostname") != 0) {
22 | return bullshit_server_data;
23 | }
24 |
25 | while(*bullshit_server_data && *bullshit_server_data <= 0x20) {
26 | bullshit_server_data++;
27 | }
28 | if(*bullshit_server_data) {
29 | return bullshit_server_data;
30 | }
31 | else {
32 | return reinterpret_cast(filtered_out);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/chimera/fix/bullshit_server_data.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_BULLSHIT_SERVER_DATA_FIX_HPP
4 | #define CHIMERA_BULLSHIT_SERVER_DATA_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix bullshit server data being supplied
9 | */
10 | void set_up_bullshit_server_data_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/camera_shake_fix.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | ;# Basically just run the meme code to write fixed positions per frame
8 | .global _camera_shake_fix_asm
9 | _camera_shake_fix_asm:
10 | pushfd
11 | pushad
12 | add eax, 40
13 | push eax
14 | sub eax, 36
15 | push eax
16 | call _meme_up_camera_shake
17 | add esp, 8
18 | popad
19 | popfd
20 |
21 | ret
--------------------------------------------------------------------------------
/src/chimera/fix/camera_shake_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CAMERA_SHAKE_FIX_FIX
4 | #define CHIMERA_CAMERA_SHAKE_FIX_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the camera shake being screwed up at high frame rates
9 | */
10 | void set_up_camera_shake_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/checkpoint_fix.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | ;# Basically tie the save loop to the tick counter
8 | .globl _checkpoint_fix_asm
9 | _checkpoint_fix_asm:
10 | ;# Check if game is trying to force an unsafe save. If so, don't interfere
11 | push eax
12 | mov eax, dword ptr [_safe_save]
13 | cmp byte ptr [eax], 0
14 | pop eax
15 | je unsafe_save
16 |
17 | ;# Otherwise, check if a tick event has occured this frame, if not, skip the save function this frame
18 | cmp dword ptr [_ticks_passed], 0
19 | je skip_save_func
20 |
21 | ;# If one or more tick events have occured this frame, run the save function for as many ticks have passed this frame.
22 | try_to_save:
23 | push eax
24 | mov eax, dword ptr [_ticks_passed]
25 | dec eax
26 | mov dword ptr [_ticks_passed], eax
27 | pop eax
28 | call dword ptr [_save_func]
29 | cmp dword ptr [_ticks_passed], 0
30 | jg try_to_save
31 |
32 | skip_save_func:
33 | jmp dword ptr [_skip_save_func]
34 |
35 | ;# reset counters and run save loop
36 | unsafe_save:
37 | mov dword ptr [_ticks_passed], 0
38 | jmp dword ptr [_original_save_call]
39 |
--------------------------------------------------------------------------------
/src/chimera/fix/checkpoint_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CHECKPOINT_FIX_HPP
4 | #define CHIMERA_CHECKPOINT_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix checkpoint running too fast. Normally the checkpoint loop iterates per frame, but we can do it per tick instead.
9 | */
10 | void set_up_checkpoint_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/chicago_multiply_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "chicago_multiply_fix.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_chicago_multiply_fix() noexcept {
10 | auto *chicago_multiply_colorarg0 = get_chimera().get_signature("chicago_multiply_sig").data() + 0xA;
11 | auto *chicago_multiply_colorarg2 = get_chimera().get_signature("chicago_multiply_sig").data() + 0x1C;
12 | auto *chicago_extended_multiply_colorarg0 = get_chimera().get_signature("chicago_extended_multiply_sig").data() + 0xA;
13 | auto *chicago_extended_multiply_colorarg2 = get_chimera().get_signature("chicago_extended_multiply_sig").data() + 0x1C;
14 |
15 | // Basically swap what gets set to colorarg0 and colorarg2 during set texture stage state
16 | overwrite(chicago_multiply_colorarg0, static_cast(0x1A));
17 | overwrite(chicago_multiply_colorarg2, static_cast(0x3));
18 | overwrite(chicago_extended_multiply_colorarg0, static_cast(0x1A));
19 | overwrite(chicago_extended_multiply_colorarg2, static_cast(0x3));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/chimera/fix/chicago_multiply_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CHICAGO_MULTIPLY_FIX_HPP
4 | #define CHIMERA_CHICAGO_MULTIPLY_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix shader_transparent_chicago failing to render when the framebuffer blend function is set to multiply
9 | * while the framebuffer fade mode is set to none
10 | */
11 | void set_up_chicago_multiply_fix() noexcept;
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/contrail_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CONTRAIL_FIX_HPP
4 | #define CHIMERA_CONTRAIL_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix short-living contrails being fucked at high frame rates
9 | */
10 | void set_up_contrail_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/custom_map_lobby_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "custom_map_lobby_fix.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../chimera.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_custom_map_lobby_fix() noexcept {
10 | auto &custom_map_retail_sig = get_chimera().get_signature("custom_map_retail_sig");
11 | overwrite(custom_map_retail_sig.data(), static_cast(0xEB));
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/custom_map_lobby_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CUSTOM_MAP_LOBBY_FIX_HPP
4 | #define CHIMERA_CUSTOM_MAP_LOBBY_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the lobby hiding custom maps
9 | */
10 | void set_up_custom_map_lobby_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/death_reset_time.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include "death_reset_time.hpp"
5 | #include "../event/tick.hpp"
6 | #include "../chimera.hpp"
7 | #include "../signature/hook.hpp"
8 | #include "../signature/signature.hpp"
9 |
10 | namespace Chimera {
11 | static std::uint8_t *dead;
12 | static std::uint16_t *death_time;
13 |
14 | static void death_timer() noexcept {
15 | if(*dead) {
16 | (*death_time)++;
17 | }
18 | }
19 |
20 | void setup_death_reset_time_fix() noexcept {
21 | // Basically make it so the death timer doesn't go up by itself - Chimera makes it go up every tick instead
22 | auto *data = get_chimera().get_signature("death_timer_reset_sig").data();
23 | overwrite(data, static_cast(0x9090));
24 | death_time = *reinterpret_cast(data + 8);
25 | dead = *reinterpret_cast(data + 16);
26 | add_pretick_event(death_timer);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/chimera/fix/death_reset_time.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FIX_DEATH_RESET_TIME_HPP
4 | #define CHIMERA_FIX_DEATH_RESET_TIME_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Enable fixing the death reset time. Normally the death timer increases per frame, but we can make it per tick, instead.
9 | */
10 | void setup_death_reset_time_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/descope_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_DESCOPE_FIX_HPP
4 | #define CHIMERA_DESCOPE_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Set up the descope fix
9 | */
10 | void set_up_descope_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/extend_limits.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _extend_limits_cmp_1
8 | _extend_limits_cmp_1:
9 | push eax
10 | mov eax, [_extend_limits_polies_count]
11 | mov eax, [eax]
12 | cmp eax, [_extend_limits_poly_limit]
13 | pop eax
14 | jmp dword ptr [_extend_limits_count_1]
15 |
16 | .globl _extend_limits_cmp_2
17 | _extend_limits_cmp_2:
18 | push eax
19 | mov eax, [_extend_limits_polies_count]
20 | mov eax, [eax]
21 | cmp eax, [_extend_limits_poly_limit]
22 | pop eax
23 | jmp dword ptr [_extend_limits_count_2]
24 |
25 | .globl _extend_limits_cmp_3
26 | _extend_limits_cmp_3:
27 | push eax
28 | mov eax, [_extend_limits_polies_count]
29 | mov eax, [eax]
30 | cmp eax, [_extend_limits_poly_limit]
31 | pop eax
32 | jmp dword ptr [_extend_limits_count_3]
33 |
--------------------------------------------------------------------------------
/src/chimera/fix/extend_limits.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_EXTEND_LIMITS_HPP
4 | #define CHIMERA_EXTEND_LIMITS_HPP
5 |
6 | #define BSP_POLY_LIMIT 0x7FFE
7 |
8 | namespace Chimera {
9 | /**
10 | * Extend Halo's limits
11 | */
12 | void set_up_extend_limits() noexcept;
13 | }
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/src/chimera/fix/extended_description_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "extended_description_fix.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_extended_description_fix() noexcept {
10 | auto &extended_description_index_sig = get_chimera().get_signature("extended_description_index_sig");
11 |
12 | overwrite(extended_description_index_sig.data(), static_cast(0x09));
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/extended_description_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_EXTENDED_DESCRIPTION_FIX_HPP
4 | #define CHIMERA_EXTENDED_DESCRIPTION_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the extended description index of the profile settings menu
9 | */
10 | void set_up_extended_description_fix() noexcept;
11 | }
12 |
13 | #endif
--------------------------------------------------------------------------------
/src/chimera/fix/floor_decal_memery.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .data
6 | should_override_memes: .long 0
7 |
8 | .text
9 |
10 | .globl _set_decal_memery_asm
11 | _set_decal_memery_asm:
12 | ;# We're going to be doing fun comparison stuff. Better hold the flags here
13 | pushfd
14 |
15 | ;# Don't do anything if we're NOT double multiply
16 | cmp ax, 2
17 | jne finish_set_decal_memery
18 |
19 | ;# Check if we're on the alpha tested layer
20 | push eax
21 | mov eax, [ecx + edx + 0x14]
22 | mov ax, word ptr [eax + 0x4]
23 | cmp ax, 3
24 | jne do_nothing_to_fix_decal_memery
25 |
26 | ;# Override us with the regular multiply call thing
27 | mov dword ptr [should_override_memes], 1
28 |
29 | ;# Finish up here
30 | do_nothing_to_fix_decal_memery:
31 | pop eax
32 |
33 | ;# Done!
34 | finish_set_decal_memery:
35 | popfd
36 | ret
37 |
38 | .globl _fix_decal_memery_asm
39 | _fix_decal_memery_asm:
40 | pushfd
41 | cmp dword ptr [should_override_memes], 1
42 | jne finish_fix_decal_memery
43 | mov ax, 1
44 | mov dword ptr [should_override_memes], 0
45 |
46 | finish_fix_decal_memery:
47 | popfd
48 | ret
49 |
--------------------------------------------------------------------------------
/src/chimera/fix/floor_decal_memery.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "floor_decal_memery.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 | #include "../output/output.hpp"
8 |
9 | namespace Chimera {
10 | extern "C" {
11 | void set_decal_memery_asm() noexcept;
12 | void fix_decal_memery_asm() noexcept;
13 | }
14 |
15 | void set_up_floor_decals_fix() noexcept {
16 | // Basically, we need to get whether or not we're rendering an alpha tested double multiplied decal. If so, meme Halo into rendering it anyway
17 | auto *ptr_1 = get_chimera().get_signature("floor_decal_meme_1_sig").data() + 4;
18 | static Hook hook_1;
19 | write_jmp_call(ptr_1, hook_1, nullptr, reinterpret_cast(set_decal_memery_asm), false);
20 |
21 | auto *ptr_2 = get_chimera().get_signature("floor_decal_meme_2_sig").data() + 7;
22 | static Hook hook_2;
23 | write_jmp_call(ptr_2, hook_2, nullptr, reinterpret_cast(fix_decal_memery_asm), false);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/chimera/fix/floor_decal_memery.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FLOOR_DECAL_MEMERY_HPP
4 | #define CHIMERA_FLOOR_DECAL_MEMERY_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix floor decals with double multiply
9 | */
10 | void set_up_floor_decals_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/force_crash.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "force_crash.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_force_crash_fix() noexcept {
10 | if(get_chimera().feature_present("client_demo")) {
11 | const short mod[] = {0x90,0x90,0x90,0x90,0x90,0x90};
12 | auto *ptr = get_chimera().get_signature("force_crash_demo_sig").data();
13 | write_code_s(ptr, mod);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/chimera/fix/force_crash.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FORCE_CRASH_HPP
4 | #define CHIMERA_FORCE_CRASH_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix Halo writing to 0x00000000 if the strings.dll is bullshit
9 | */
10 | void set_up_force_crash_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/fov_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "fov_fix.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_fov_fix() noexcept {
10 | auto &fix_fov_sig = get_chimera().get_signature("fix_fov_sig");
11 | auto &fix_fov_zoom_blur_1_sig = get_chimera().get_signature("fix_fov_zoom_blur_1_sig");
12 | auto &fix_fov_zoom_blur_2_sig = get_chimera().get_signature("fix_fov_zoom_blur_2_sig");
13 |
14 | const SigByte fix_fov_nop[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
15 | const SigByte fix_zoom_1[] = { 0x85, 0xC0, 0x89, 0xC0 };
16 | const SigByte fix_zoom_2[] = { 0x31, 0xC0, 0x90 };
17 |
18 | // Prevent Halo from lowering the FOV incorrectly
19 | write_code_s(fix_fov_sig.data(), fix_fov_nop);
20 |
21 | // Stop zoom blur being broken at higher FOV's
22 | write_code_s(fix_fov_zoom_blur_1_sig.data(), fix_zoom_1);
23 | write_code_s(fix_fov_zoom_blur_2_sig.data(), fix_zoom_2);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/chimera/fix/fov_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FOV_FIX
4 | #define CHIMERA_FOV_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the FOV being ruined by poor programming
9 | */
10 | void set_up_fov_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/fp_animation.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FP_ANIMATION_FIX
4 | #define CHIMERA_FP_ANIMATION_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the fp model deceleration animation being tied to framerate
9 | */
10 | void set_up_fp_animation_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/fp_reverb.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _override_fp_reverb_position_asm
8 | _override_fp_reverb_position_asm:
9 | pushfd
10 | pushad
11 | push eax ;# Address of sound position we're writing to
12 | push ebx ;# Object ID of the related object
13 | call _move_current_fp_sound_to_camera
14 | add esp, 8
15 | popad
16 | popfd
17 | ret
18 |
--------------------------------------------------------------------------------
/src/chimera/fix/fp_reverb.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FP_REVERB_FIX
4 | #define CHIMERA_FP_REVERB_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the reverberation not working in FP sounds
9 | */
10 | void set_up_fp_reverb_fix() noexcept;
11 |
12 | /**
13 | * Unfix the reverberation not working in FP sounds
14 | */
15 | void disable_fp_reverb_fix() noexcept;
16 | }
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/src/chimera/fix/glass_fix.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 | .global _set_correct_glass_diffuse_psh_asm
7 | _set_correct_glass_diffuse_psh_asm:
8 | mov eax, dword ptr [edi + 0x5C]
9 | test eax, eax
10 | jz use_diffuse_model
11 |
12 | ;# Go to 2nd permutation
13 | add edx, 0x00000084
14 |
15 | use_diffuse_model:
16 | jmp dword ptr [_original_set_glass_diffuse_instr]
17 |
18 | .global _set_correct_glass_reflection_psh_asm
19 | _set_correct_glass_reflection_psh_asm:
20 | cmp word ptr [esp + 0xA4], 00
21 | je reflection_bumped
22 |
23 | mov ax, word ptr [ebx + 0x28]
24 | shr eax, 3
25 | and al, 0x1
26 | test al, al
27 | jz reflection_bumped
28 |
29 | ;# Go to 2nd permutation
30 | add ecx, 0x00000084
31 |
32 | reflection_bumped:
33 | jmp dword ptr [_original_set_glass_reflection_instr]
--------------------------------------------------------------------------------
/src/chimera/fix/glass_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_GLASS_DIFFUSE_FIX_HPP
4 | #define CHIMERA_GLASS_DIFFUSE_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Custom edition does not use the 2nd shader technique for transparent_glass_diffuse,
9 | * transparent_glass_reflection_flat and transparent_glass_reflection_mirror when it should.
10 | * Probably a stuff up from when porting the renderer away from using D3DX effects.
11 | */
12 | void set_up_ce_glass_fix() noexcept;
13 | }
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/src/chimera/fix/hud_bitmap_scale.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_HUD_BITMAP_SCALE_HPP
4 | #define CHIMERA_HUD_BITMAP_SCALE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Support highres scaling flags in bitmap tags: "hud scale 0.5" from MCC and
9 | * the custom "force hud use highres scale"
10 | */
11 | void set_up_hud_bitmap_scale_fix() noexcept;
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/internal_shaders.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERNAL_SHADERS
4 | #define CHIMERA_INTERNAL_SHADERS
5 |
6 | namespace Chimera {
7 | /**
8 | * Replace shaders loaded from games default shader collection files with fixed ones
9 | * located internally within strings.dll
10 | */
11 | void set_up_internal_shaders() noexcept;
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/antenna.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_ANTENNA_HPP
4 | #define CHIMERA_INTERPOLATE_ANTENNA_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Interpolate antennae.
9 | */
10 | void interpolate_antenna_before() noexcept;
11 |
12 | /**
13 | * Uninterpolate antennae.
14 | */
15 | void interpolate_antenna_after() noexcept;
16 |
17 | /**
18 | * Set the tick flag, swapping buffers for the next tick.
19 | */
20 | void interpolate_antenna_on_tick() noexcept;
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/camera.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_CAMERA_HPP
4 | #define CHIMERA_INTERPOLATE_CAMERA_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Interpolate camera.
9 | */
10 | void interpolate_camera_before() noexcept;
11 |
12 | /**
13 | * Uninterpolate camera.
14 | */
15 | void interpolate_camera_after() noexcept;
16 |
17 | /**
18 | * Clear the buffers. This should be done if changing the interpolation setting.
19 | */
20 | void interpolate_camera_clear() noexcept;
21 |
22 | /**
23 | * Set the tick flag, swapping buffers for the next tick.
24 | */
25 | void interpolate_camera_on_tick() noexcept;
26 | }
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/flag.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_FLAG_HPP
4 | #define CHIMERA_INTERPOLATE_FLAG_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Interpolate flag cloth.
9 | */
10 | void interpolate_flag_before() noexcept;
11 |
12 | /**
13 | * Clear the buffers. This should be done if changing the interpolation setting.
14 | */
15 | void interpolate_flag_clear() noexcept;
16 |
17 | /**
18 | * Set the tick flag, swapping buffers for the next tick.
19 | */
20 | void interpolate_flag_on_tick() noexcept;
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/fp.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_FP_HPP
4 | #define CHIMERA_INTERPOLATE_FP_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Interpolate first person.
9 | */
10 | void interpolate_fp_before() noexcept;
11 |
12 | /**
13 | * Uninterpolate first person.
14 | */
15 | void interpolate_fp_after() noexcept;
16 |
17 | /**
18 | * Clear the buffers. This should be done if changing the interpolation setting.
19 | */
20 | void interpolate_fp_clear() noexcept;
21 |
22 | /**
23 | * Set the tick flag, swapping buffers for the next tick.
24 | */
25 | void interpolate_fp_on_tick() noexcept;
26 | }
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/interpolate.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_HPP
4 | #define CHIMERA_INTERPOLATE_HPP
5 |
6 | namespace Chimera {
7 | void set_up_interpolation() noexcept;
8 | void disable_interpolation() noexcept;
9 | }
10 |
11 | #endif
12 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/light.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_LIGHT_HPP
4 | #define CHIMERA_INTERPOLATE_LIGHT_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Interpolate light.
9 | */
10 | void interpolate_light_before() noexcept;
11 |
12 | /**
13 | * Clear the buffers. This should be done if changing the interpolation setting.
14 | */
15 | void interpolate_light_clear() noexcept;
16 |
17 | /**
18 | * Set the tick flag, swapping buffers for the next tick.
19 | */
20 | void interpolate_light_on_tick() noexcept;
21 | }
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/object.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_OBJECT_HPP
4 | #define CHIMERA_INTERPOLATE_OBJECT_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Interpolate objects.
9 | */
10 | void interpolate_object_before() noexcept;
11 |
12 | /**
13 | * Uninterpolate objects. This prevents wonky physics things from happening.
14 | */
15 | void interpolate_object_after() noexcept;
16 |
17 | /**
18 | * Clear the buffers. This should be done if changing the interpolation setting.
19 | */
20 | void interpolate_object_clear() noexcept;
21 |
22 | /**
23 | * Set the tick flag, swapping buffers for the next tick.
24 | */
25 | void interpolate_object_on_tick() noexcept;
26 | }
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/chimera/fix/interpolate/particle.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INTERPOLATE_PARTICLE_HPP
4 | #define CHIMERA_INTERPOLATE_PARTICLE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Interpolate particles.
9 | */
10 | void interpolate_particle() noexcept;
11 |
12 | /**
13 | * Uninterpolate particles.
14 | */
15 | void interpolate_particle_after() noexcept;
16 |
17 | /**
18 | * Clear the buffers. This should be done if changing the interpolation setting.
19 | */
20 | void interpolate_particle_clear() noexcept;
21 |
22 | /**
23 | * Set the tick flag, swapping buffers for the next tick.
24 | */
25 | void interpolate_particle_on_tick() noexcept;
26 | }
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/chimera/fix/invalid_command_crash.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .data
6 | meme_global_text: .string "rasterizer_soft_filter"
7 | ignore_broken_globals: .long 0
8 |
9 | .text
10 |
11 | .globl _handle_invalid_global_crash_asm
12 | _handle_invalid_global_crash_asm:
13 | ;# Ignore?
14 | cmp dword ptr [ignore_broken_globals], 1
15 | je done_handle_invalid_global_crash_asm
16 |
17 | ;# Did we get 0xFFFF?
18 | cmp ax, 0xFFFF
19 |
20 | ;# If not, keep going
21 | jne done_handle_invalid_global_crash_asm
22 |
23 | ;# Otherwise, try again, but this time put "rasterizer_soft_filter" into ebx as this effectively does nothing
24 | lea ebx, [meme_global_text]
25 | call dword ptr [_halo_get_global_index_fn]
26 |
27 | ;# Done!
28 | done_handle_invalid_global_crash_asm:
29 | ret
30 |
31 | .globl _should_ignore_broken_globals_asm
32 | _should_ignore_broken_globals_asm:
33 | mov dword ptr [ignore_broken_globals], 1
34 | ret
35 |
36 | .globl _should_not_ignore_broken_globals_asm
37 | _should_not_ignore_broken_globals_asm:
38 | mov dword ptr [ignore_broken_globals], 0
39 | ret
40 |
--------------------------------------------------------------------------------
/src/chimera/fix/invalid_command_crash.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_INVALID_COMMAND_CRASH_FIX_HPP
4 | #define CHIMERA_INVALID_COMMAND_CRASH_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix invalid commands crashing the game
9 | */
10 | void set_up_invalid_command_crash_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/jason_jones_hacks.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_JASON_JONES_HACKS_HPP
4 | #define CHIMERA_JASON_JONES_HACKS_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Jones jones some known tag issues
9 | */
10 | void set_up_jason_jones_hacks() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/leak_descriptors.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LEAK_DESCRIPTORS_HPP
4 | #define CHIMERA_LEAK_DESCRIPTORS_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix leaking descriptors with maps that have file size values >128 MiB
9 | */
10 | void set_up_fix_leaking_descriptors() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/model_detail.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _model_detail_fix
8 | _model_detail_fix:
9 | fld dword ptr [ebp+0x08]
10 | fdiv dword ptr [_lod_fix_scale]
11 | fstp dword ptr [ebp+0x08]
12 | ret
13 |
--------------------------------------------------------------------------------
/src/chimera/fix/model_detail.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "model_detail.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 | #include "../halo_data/resolution.hpp"
8 | #include "../event/frame.hpp"
9 |
10 | extern "C" {
11 | float lod_fix_scale = 1.0F;
12 | void model_detail_fix() noexcept;
13 | }
14 |
15 | namespace Chimera {
16 | static void set_values();
17 | void set_up_model_detail_fix() noexcept {
18 | static Hook hook;
19 | write_jmp_call(get_chimera().get_signature("model_lod_sig").data(), hook, reinterpret_cast(model_detail_fix));
20 | add_preframe_event(set_values);
21 | }
22 |
23 | static float model_detail = 1.0F;
24 |
25 | static void set_values() {
26 | static std::uint16_t height = 0;
27 | auto resolution = get_resolution();
28 | if(resolution.height != height) {
29 | set_model_detail(model_detail);
30 | }
31 | }
32 |
33 | void set_model_detail(float detail) noexcept {
34 | if(detail < 0.01F) {
35 | detail = 0.01F;
36 | }
37 | model_detail = detail;
38 | lod_fix_scale = static_cast(get_resolution().height) / 640.0F / model_detail;
39 | }
40 |
41 | float get_model_detail() noexcept {
42 | return model_detail;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/chimera/fix/model_detail.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MODEL_DETAIL_HPP
4 | #define CHIMERA_MODEL_DETAIL_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the model detail at resolutions higher than 480p.
9 | */
10 | void set_up_model_detail_fix() noexcept;
11 |
12 | /**
13 | * Set the model detail multiplier
14 | * @param detail detail multiplier
15 | */
16 | void set_model_detail(float detail) noexcept;
17 |
18 | /**
19 | * Get the model detail multiplier
20 | * @return detail detail multiplier
21 | */
22 | float get_model_detail() noexcept;
23 | }
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/src/chimera/fix/motion_sensor_fix.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 | .globl _new_motion_sensor_update_function
7 | _new_motion_sensor_update_function:
8 | ;# Check if we can update
9 | push eax
10 | mov eax, dword ptr [_can_update_motion_sensor]
11 | test al, al
12 |
13 | ;# If nonzero, we can update
14 | jnz do_the_thing
15 | pop eax
16 |
17 | ;# Nope? Okay
18 | ret
19 |
20 | ;# Let's do this!
21 | do_the_thing:
22 |
23 | ;# First, move zero to our _can_update_motion_sensor value
24 | xor eax, eax
25 | mov dword ptr [_can_update_motion_sensor], eax
26 |
27 | ;# We're done. Update
28 | pop eax
29 | jmp dword ptr [_original_motion_sensor_update_function]
30 |
--------------------------------------------------------------------------------
/src/chimera/fix/motion_sensor_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../event/tick.hpp"
7 |
8 | extern "C" {
9 | const void *original_motion_sensor_update_function;
10 | std::uint32_t can_update_motion_sensor = 0;
11 | void new_motion_sensor_update_function();
12 | }
13 |
14 | namespace Chimera {
15 | static void allow_updates() {
16 | can_update_motion_sensor = 1;
17 | }
18 |
19 | void set_up_motion_sensor_fix() noexcept {
20 | auto *data = get_chimera().get_signature("motion_sensor_update_sig").data();
21 | static Hook hook;
22 | write_function_override(data, hook, reinterpret_cast(new_motion_sensor_update_function), &original_motion_sensor_update_function);
23 | add_pretick_event(allow_updates);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/chimera/fix/motion_sensor_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MOTION_SENSOR_FIX_HPP
4 | #define CHIMERA_MOTION_SENSOR_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix motion sensor being fucked at high frame rates
9 | */
10 | void set_up_motion_sensor_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/multitexture_overlay_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MULTITEXTURE_OVERLAY_FIX_HPP
4 | #define CHIMERA_MULTITEXTURE_OVERLAY_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Restore xbox accurate multitexture overlay rendering.
9 | * Basically fix gearboxes inability to count.
10 | */
11 | void set_up_multitexture_overlay_fix() noexcept;
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/name_fade.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _name_fade_fix_dec_asm
8 | _name_fade_fix_dec_asm:
9 | ;# Check if we can change the fade
10 | push eax
11 | mov eax, dword ptr [_can_do_name_fade_dec]
12 | test eax, eax
13 | pop eax
14 |
15 | ;# If not, don't do anything
16 | jz skip_name_fade_fix
17 |
18 | ;# Otherwise, apply the fade
19 | mov [esi+0x80], ecx
20 |
21 | ;# Reset the value
22 | mov dword ptr [_can_do_name_fade_dec], 0
23 |
24 | ;# Done
25 | ret
26 |
27 | .globl _name_fade_fix_inc_asm
28 | _name_fade_fix_inc_asm:
29 | ;# Check if we can change the fade
30 | push eax
31 | mov eax, dword ptr [_can_do_name_fade_inc]
32 | test eax, eax
33 | pop eax
34 |
35 | ;# If not, don't do anything
36 | jz skip_name_fade_fix
37 |
38 | ;# Otherwise, apply the fade
39 | mov [esi+0x80], eax
40 |
41 | ;# Reset the value
42 | mov dword ptr [_can_do_name_fade_inc], 0
43 |
44 | ;# Done
45 | ret
46 |
47 | ;# Skip
48 | skip_name_fade_fix:
49 | ret
50 |
--------------------------------------------------------------------------------
/src/chimera/fix/name_fade.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_NAME_FADE_HPP
4 | #define CHIMERA_NAME_FADE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the name fading too quickly
9 | */
10 | void set_up_name_fade_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/sane_defaults.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _set_sane_defaults_asm
8 | _set_sane_defaults_asm:
9 | mov byte ptr [ebx + 0xA6F], 0 ;# no vsync
10 | mov byte ptr [ebx + 0xA70], 1 ;# specular
11 | mov byte ptr [ebx + 0xA71], 1 ;# shadows
12 | mov byte ptr [ebx + 0xA72], 1 ;# decals
13 | mov byte ptr [ebx + 0xA73], 2 ;# particles
14 | mov byte ptr [ebx + 0xA74], 2 ;# texture quality
15 | mov byte ptr [ebx + 0xB7B], 1 ;# environmental audio
16 | mov byte ptr [ebx + 0xB7C], 1 ;# hardware acceleration (in case we have EAX)
17 | mov byte ptr [ebx + 0xB7D], 2 ;# sound quality
18 | mov byte ptr [ebx + 0xB7F], 2 ;# sound variety
19 | ret
20 |
--------------------------------------------------------------------------------
/src/chimera/fix/sane_defaults.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "sane_defaults.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../chimera.hpp"
7 |
8 | namespace Chimera {
9 | extern "C" void set_sane_defaults_asm() noexcept;
10 |
11 | void set_up_sane_defaults() noexcept {
12 | auto &chimera = get_chimera();
13 | if(!chimera.feature_present("client_fp_reverb")) {
14 | return;
15 | }
16 |
17 | auto *default_settings_sig = chimera.get_signature("default_settings_sig").data();
18 | static Hook hook;
19 | write_jmp_call(reinterpret_cast(default_settings_sig + 7), hook, reinterpret_cast(set_sane_defaults_asm), nullptr, false);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/chimera/fix/sane_defaults.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_SANE_DEFAULTS_FIX
4 | #define CHIMERA_SANE_DEFAULTS_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the bullshit default settings since it's 2020 (or later!)
9 | */
10 | void set_up_sane_defaults() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/scope_blur_fix.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _radius_fix_asm
8 | _radius_fix_asm:
9 | fld dword ptr [esp + 0x38]
10 | fmul dword ptr [_blur_fix_scale]
11 | fstp dword ptr [esp + 0x38]
12 | ret
13 |
--------------------------------------------------------------------------------
/src/chimera/fix/scope_blur_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../halo_data/resolution.hpp"
7 | #include "../event/frame.hpp"
8 |
9 | extern "C" {
10 | float blur_fix_scale = 1.0F;
11 | void radius_fix_asm() noexcept;
12 | }
13 |
14 | namespace Chimera {
15 | static void correct_blur_radius() noexcept {
16 | static std::uint16_t height = 0;
17 | auto resolution = get_resolution();
18 | if(resolution.height != height) {
19 | blur_fix_scale = static_cast(resolution.height) / 480.0F;
20 | }
21 | }
22 |
23 | void set_up_scope_blur_fix() noexcept {
24 | static Hook hook;
25 | write_jmp_call(get_chimera().get_signature("scope_blur_update_sig").data() + 0xE, hook, reinterpret_cast(radius_fix_asm));
26 | add_preframe_event(correct_blur_radius);
27 |
28 | // Prevent game from initializing the alpha render target at 50% scale.
29 | overwrite(get_chimera().get_signature("render_targets_initialize_sig").data() + 10, static_cast(0x9090));
30 | overwrite(get_chimera().get_signature("render_targets_initialize_sig").data() + 24, static_cast(0x9090));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/chimera/fix/scope_blur_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_SCOPE_BLUR_FIX
4 | #define CHIMERA_SCOPE_BLUR_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the scope blur intensity being tied to resolution
9 | */
10 | void set_up_scope_blur_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/scoreboard_fade_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_SCOREBOARD_FADE_FIX_HPP
4 | #define CHIMERA_SCOREBOARD_FADE_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the scoreboard fading too quickly
9 | */
10 | void set_up_scoreboard_fade_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/specular_memes.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _specular_light_draw_set_texture_asm
8 | _specular_light_draw_set_texture_asm:
9 | push eax
10 | mov eax, 0x00000003
11 | mov [esp + 8], eax
12 | pop eax
13 | ret
14 |
15 | .globl _specular_light_adjust_ps_const_custom
16 | _specular_light_adjust_ps_const_custom:
17 | push eax
18 | push ebx
19 | mov eax, dword ptr [_specular_light_is_spotlight]
20 | mov bl, [eax]
21 | cmp bl, 1
22 | pop ebx
23 | pop eax
24 | je skip_custom
25 | mov dword ptr [esp + 0x30], 0x00000000
26 |
27 | skip_custom:
28 | ret
29 |
30 | .globl _specular_light_adjust_ps_const_retail
31 | _specular_light_adjust_ps_const_retail:
32 | push eax
33 | push ebx
34 | mov eax, dword ptr [_specular_light_is_spotlight]
35 | mov bl, [eax]
36 | cmp bl, 1
37 | pop ebx
38 | pop eax
39 | je skip_retail
40 | mov dword ptr [esp + 0x2C], 0x00000000
41 |
42 | skip_retail:
43 | ret
--------------------------------------------------------------------------------
/src/chimera/fix/specular_memes.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_SPECULAR_LIGHT_FIX
4 | #define CHIMERA_SPECULAR_LIGHT_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Meme the specular light draw so it doesn't rely on undefined behaviour to work.
9 | */
10 | void set_up_specular_light_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/sun_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "sun_fix.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/hook.hpp"
6 | #include "../signature/signature.hpp"
7 | #include "../output/output.hpp"
8 | #include "../halo_data/resolution.hpp"
9 | #include "../event/frame.hpp"
10 |
11 | namespace Chimera {
12 | static float z = 0.0625;
13 |
14 | static void correct_sun() noexcept;
15 |
16 | void set_up_sun_fix() noexcept {
17 | if(!get_chimera().feature_present("client_sun")) {
18 | return;
19 | }
20 | auto *sun = get_chimera().get_signature("lens_scale_sig").data();
21 | overwrite(sun + 2, &z);
22 | add_preframe_event(correct_sun);
23 | }
24 |
25 | static void correct_sun() noexcept {
26 | // Since Halo PC scales sun by 768p (even though its default res is 800x600 and supports custom resolution), we scale lens flares by dividing by 768
27 | static std::uint16_t height = 0;
28 | auto new_height = get_resolution().height;
29 | if(new_height != height) {
30 | height = new_height;
31 | float scale = static_cast(new_height) / 768.0F;
32 | z = scale * 0.0625;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/chimera/fix/sun_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_SUN_FIX
4 | #define CHIMERA_SUN_FIX
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix the sun size being based on resolution
9 | */
10 | void set_up_sun_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/timer_offset.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "timer_offset.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_timer_offset_fix() noexcept {
10 | const short mod[] = {0x90,0x90};
11 | auto *ptr = get_chimera().get_signature("equipment_timer_offset_sig").data();
12 | write_code_s(ptr + 8, mod);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/timer_offset.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_TIMER_OFFSET_HPP
4 | #define CHIMERA_TIMER_OFFSET_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix Halo writing to 0x00000000 if the strings.dll is bullshit
9 | */
10 | void set_up_timer_offset_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/uncompressed_sound_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "uncompressed_sound_fix.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../signature/hook.hpp"
7 |
8 | namespace Chimera {
9 | void set_up_uncompressed_sound_fix() noexcept {
10 | static constexpr SigByte FIX[] = { 0x30, 0xDB, 0x90 };
11 | write_code_s(get_chimera().get_signature("uncompressed_sound_fix_sig").data(), FIX);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/uncompressed_sound_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_UNCOMPRESSED_SOUND_FIX_HPP
4 | #define CHIMERA_UNCOMPRESSED_SOUND_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix uncompressed sound tags not playing
9 | */
10 | void set_up_uncompressed_sound_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/vehicle_team_desync.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _on_check_for_desynced_vehicle_entry_asm
8 | _on_check_for_desynced_vehicle_entry_asm:
9 | pushfd
10 | pushad
11 |
12 | ;# Check if we're a dedicated server
13 | call _on_check_for_desynced_vehicle_entry
14 | test eax, eax
15 | jz check_desync_let_halo_do_its_thing
16 |
17 | ;# If we are, do immoral things to eax because Microsoft won't release the game's source code or make a good Halo port
18 | mov dword ptr [esp+0x1C], 1
19 |
20 | check_desync_let_halo_do_its_thing:
21 | popad
22 | popfd
23 | ret
24 |
--------------------------------------------------------------------------------
/src/chimera/fix/vehicle_team_desync.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "vehicle_team_desync.hpp"
4 | #include "../chimera.hpp"
5 | #include "../halo_data/multiplayer.hpp"
6 | #include "../signature/hook.hpp"
7 | #include "../output/output.hpp"
8 | #include "../signature/signature.hpp"
9 |
10 | namespace Chimera {
11 | extern "C" void on_check_for_desynced_vehicle_entry_asm();
12 | extern "C" bool on_check_for_desynced_vehicle_entry() {
13 | return server_type() == ServerType::SERVER_DEDICATED;
14 | }
15 |
16 | void set_up_vehicle_team_desync_fix() noexcept {
17 | if(!get_chimera().feature_present("client_mtv_desync")) {
18 | return;
19 | }
20 |
21 | auto &s1 = get_chimera().get_signature("vehicle_team_desync_1_sig");
22 | auto &s2 = get_chimera().get_signature("vehicle_team_desync_2_sig");
23 |
24 | auto *a = s1.data() + 7;
25 | auto *b = s2.data() + 5;
26 |
27 | static Hook h1, h2;
28 | write_jmp_call(a, h1, nullptr, reinterpret_cast(on_check_for_desynced_vehicle_entry_asm), false);
29 | write_jmp_call(b, h2, nullptr, reinterpret_cast(on_check_for_desynced_vehicle_entry_asm), false);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/chimera/fix/vehicle_team_desync.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FIX_VEHICLE_TEAM_DESYNC_HPP
4 | #define CHIMERA_FIX_VEHICLE_TEAM_DESYNC_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix mtv desyncing Chimera
9 | */
10 | void set_up_vehicle_team_desync_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/video_mode.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _on_set_video_mode_initially
8 | _on_set_video_mode_initially:
9 | push [esp+0x30]
10 | call _set_vsync_setting_initially
11 | add esp, 4
12 | ret
13 |
14 | .globl _on_windowed_check_force_windowed
15 | _on_windowed_check_force_windowed:
16 | or eax, dword ptr [_force_windowed_mode]
17 | test al, al
18 | jz done_forcing_windowed
19 | pushfd
20 | pushad
21 | call _now_set_borderless_windowed_mode
22 | popad
23 | popfd
24 | done_forcing_windowed:
25 | ret
26 |
--------------------------------------------------------------------------------
/src/chimera/fix/video_mode.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_VIDEO_MODE_HPP
4 | #define CHIMERA_VIDEO_MODE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Set Halo's video mode to what is configured in Chimera, if anything is configured
9 | */
10 | void set_up_video_mode() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/water_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_WATER_FIX_HPP
4 | #define CHIMERA_WATER_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fixes water-fog sorting by computing the fog in the pixel shader instead of using
9 | * fixed function fog.
10 | */
11 | void set_up_water_fix() noexcept;
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/fix/weapon_swap_ticks.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../event/tick.hpp"
7 |
8 | extern "C" {
9 | std::uint32_t weapon_swap_tick_counter = 0;
10 | std::uint32_t can_increment_weapon_swap_tick_counter = false;
11 | void weapon_swap_ticks_fix_asm_eax();
12 | void weapon_swap_ticks_fix_asm_ecx();
13 | }
14 |
15 | namespace Chimera {
16 | static void update_tick_count() {
17 | can_increment_weapon_swap_tick_counter = true;
18 | }
19 |
20 | void set_up_weapon_swap_ticks_fix() noexcept {
21 | static Hook hook;
22 |
23 | if(get_chimera().feature_present("client_swap_non_custom")) {
24 | write_jmp_call(get_chimera().get_signature("weapon_swap_ticks_sig").data(), hook, reinterpret_cast(weapon_swap_ticks_fix_asm_eax), nullptr, false);
25 | }
26 | else if(get_chimera().feature_present("client_swap_custom")) {
27 | write_jmp_call(get_chimera().get_signature("weapon_swap_ticks_custom_sig").data(), hook, reinterpret_cast(weapon_swap_ticks_fix_asm_ecx), nullptr, false);
28 | }
29 | else {
30 | return;
31 | }
32 |
33 | add_pretick_event(update_tick_count);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/chimera/fix/weapon_swap_ticks.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_WEAPON_SWAP_TICKS_FIX_HPP
4 | #define CHIMERA_WEAPON_SWAP_TICKS_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix weapons being picked up too fast
9 | */
10 | void set_up_weapon_swap_ticks_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/weather_fix.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _new_weather_update_function
8 | _new_weather_update_function:
9 | ;# Check if we can update
10 | push eax
11 | mov eax, dword ptr [_can_update_weather]
12 | test al, al
13 |
14 | ;# If nonzero, we can update
15 | jnz update_weather
16 |
17 | ;# Otherwise, do nothing
18 | pop eax
19 | add esp, 20
20 | ret
21 |
22 | update_weather:
23 |
24 | ;# reset _can_update_weather value
25 | xor eax, eax
26 | mov dword ptr [_can_update_weather], eax
27 |
28 | ;# Update
29 | pop eax
30 | jmp dword ptr [_original_call]
--------------------------------------------------------------------------------
/src/chimera/fix/weather_fix.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/hook.hpp"
5 | #include "../signature/signature.hpp"
6 | #include "../event/tick.hpp"
7 |
8 | extern "C" {
9 | const void *original_call;
10 | std::uint32_t can_update_weather = 0;
11 | void new_weather_update_function();
12 | }
13 |
14 | namespace Chimera {
15 | static void allow_update() noexcept {
16 | can_update_weather = 1;
17 | }
18 |
19 | void set_up_weather_fix() noexcept {
20 | static Hook hook;
21 | write_function_override(get_chimera().get_signature("weather_update_sig").data() + 0x3, hook, reinterpret_cast(new_weather_update_function), &original_call);
22 | add_tick_event(allow_update);
23 | }
24 | }
--------------------------------------------------------------------------------
/src/chimera/fix/weather_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_WEATHER_FIX_HPP
4 | #define CHIMERA_WEATHER_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Fix some weather effects being weird at high framerates.
9 | */
10 | void set_up_weather_fix() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/widescreen_element_reposition_menu.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | ;# Here is the widescreen_element_reposition_menu function.
8 | .globl _widescreen_element_reposition_menu
9 | _widescreen_element_reposition_menu:
10 |
11 | push eax
12 | mov eax, [esp + 4]
13 | pushfd
14 | pushad
15 | push eax
16 | call _reposition_menu_element
17 | add esp, 4
18 | popad
19 | popfd
20 | pop eax
21 |
22 | jmp dword ptr _widescreen_element_position_menu_fn
23 |
--------------------------------------------------------------------------------
/src/chimera/fix/widescreen_fix.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_WIDESCREEN_FIX_HPP
4 | #define CHIMERA_WIDESCREEN_FIX_HPP
5 |
6 | namespace Chimera {
7 | enum WidescreenFixSetting {
8 | WIDESCREEN_OFF = 0,
9 | WIDESCREEN_ON,
10 | WIDESCREEN_CENTER_HUD
11 | };
12 |
13 | /**
14 | * Set whether or not to have the widescreen fix
15 | * @param new_setting setting for the widescreen fix
16 | */
17 | void set_widescreen_fix(WidescreenFixSetting new_setting) noexcept;
18 |
19 | /**
20 | * Get whether the widescreen fix is enabled
21 | * @return true if the widescreen fix is enabled
22 | */
23 | bool widescreen_fix_enabled() noexcept;
24 | }
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/chimera/fix/widescreen_mouse.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | ;# edx = x, ecx = y
8 |
9 | .globl _widescreen_mouse
10 | _widescreen_mouse:
11 | push edx
12 |
13 | ;# Y bounds is always 0-480
14 | mov edx, dword ptr [_widescreen_mouse_y]
15 | cmp ecx, 480
16 | jg y_too_high
17 | cmp ecx, 0
18 | jl y_too_low
19 | mov dword ptr [edx], ecx
20 | jmp y_done
21 | y_too_low:
22 | mov dword ptr [edx], 0
23 | jmp y_done
24 | y_too_high:
25 | mov dword ptr [edx], 480
26 |
27 | y_done:
28 |
29 | mov edx, dword ptr [_widescreen_mouse_x]
30 | push ebx
31 | push ecx
32 | mov ebx, dword ptr [_widescreen_mouse_left_bounds]
33 | mov ecx, dword ptr [_widescreen_mouse_right_bounds]
34 |
35 | cmp eax, ecx
36 | jg x_too_high
37 | cmp eax, ebx
38 | jl x_too_low
39 | mov dword ptr [edx], eax
40 | jmp x_done
41 | x_too_low:
42 | mov dword ptr [edx], ebx
43 | jmp x_done
44 | x_too_high:
45 | mov dword ptr [edx], ecx
46 |
47 | x_done:
48 | pop ecx
49 | pop ebx
50 | pop edx
51 | ret
52 |
--------------------------------------------------------------------------------
/src/chimera/fix/xbox_channel_order.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .global _set_psh_const_for_xbox_order_asm
8 | _set_psh_const_for_xbox_order_asm:
9 | push edi
10 | call _set_psh_const_for_xbox_order
11 | add esp, 4
12 | ret
13 |
--------------------------------------------------------------------------------
/src/chimera/fix/xbox_channel_order.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "xbox_channel_order.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/hook.hpp"
6 | #include "../signature/signature.hpp"
7 |
8 | namespace Chimera {
9 | extern "C" void set_psh_const_for_xbox_order_asm() noexcept;
10 | static float *c_self_illumination_color_w = nullptr;
11 |
12 | extern "C" void set_psh_const_for_xbox_order(std::byte *shader) noexcept {
13 | auto *model_flags = reinterpret_cast(shader + 0x28);
14 | if((*model_flags >> 6) & 1) {
15 | // gearbox defaults this to 1.0f, which is opposite of MCC. The shader code should be set up accordingly.
16 | *c_self_illumination_color_w = 0.0f;
17 | }
18 | }
19 |
20 | void set_up_xbox_channel_order_support() noexcept {
21 | auto set_shader_const_ptr = get_chimera().get_signature("use_xbox_channel_order_sig").data();
22 |
23 | // The channel order is determined by the alpha channel of this shader constant.
24 | c_self_illumination_color_w = reinterpret_cast(*reinterpret_cast(set_shader_const_ptr + 2));
25 |
26 | static Hook hook;
27 | write_jmp_call(set_shader_const_ptr + 10, hook, reinterpret_cast(set_psh_const_for_xbox_order_asm), nullptr);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/chimera/fix/xbox_channel_order.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_XBOX_CHANNEL_ORDER_HPP
4 | #define CHIMERA_XBOX_CHANNEL_ORDER_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Support the "Use xbox channel order" flag for shader_model
9 | */
10 | void set_up_xbox_channel_order_support() noexcept;
11 | }
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/src/chimera/fix/z_fighting.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .global _frustum_hack_asm
8 | _frustum_hack_asm:
9 | pushfd
10 | pushad
11 | push eax
12 | push ebx
13 | call _meme_the_transparent_decals
14 | add esp, 8
15 | popad
16 | popfd
17 | mov al, byte ptr [_force_zbias_hack]
18 | ret
19 |
20 | .global _frustum_reset_asm
21 | _frustum_reset_asm:
22 | cmp byte ptr [_reset_frustum], 0
23 | je skip_hack_reset
24 | pushfd
25 | pushad
26 | push 0
27 | push 0
28 | call dword ptr [_rasterizer_set_frustum_z]
29 | add esp, 8
30 | mov byte ptr [_reset_frustum], 0
31 | popad
32 | popfd
33 |
34 | skip_hack_reset:
35 | jmp dword ptr [_original_get_zbias]
--------------------------------------------------------------------------------
/src/chimera/fix/z_fighting.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_Z_FIGHT_FIX_HPP
4 | #define CHIMERA_Z_FIGHT_FIX_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Attempts to minimize z-fighting of transparent decals by adjusting the viewing frustum during transparent geometry group draw.
9 | * This helps with z buffer precision issues the game has with modern GPUs (ie anything much newer than 2011).
10 | */
11 | void set_up_z_fighting_fix() noexcept;
12 |
13 | /**
14 | * Sets more optimal Z-bias slope values.
15 | */
16 | void set_z_bias_slope() noexcept;
17 | }
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/antenna.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "antenna.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | AntennaTable &AntennaTable::get_antenna_table() noexcept {
9 | static auto *antenna_table = **reinterpret_cast(get_chimera().get_signature("antenna_table_sig").data() + 2);
10 | return *antenna_table;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/antenna.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_ANTENNA_HPP
4 | #define CHIMERA_ANTENNA_HPP
5 |
6 | #include
7 |
8 | #include "object.hpp"
9 | #include "../math_trig/math_trig.hpp"
10 |
11 | namespace Chimera {
12 | struct Antenna;
13 |
14 | struct AntennaTable : GenericTable {
15 | /**
16 | * Get the antenna table.
17 | * @return Return a reference to the antenna table.
18 | */
19 | static AntennaTable &get_antenna_table() noexcept;
20 | };
21 |
22 | struct AntennaVertex {
23 | Point3D position;
24 | Point3D velocity;
25 | float scale;
26 | std::uint32_t counter;
27 | };
28 |
29 | struct Antenna {
30 | std::uint32_t unknown_0;
31 | std::uint32_t unknown_1;
32 | std::uint32_t tag_id;
33 | std::uint32_t parent_object_id;
34 | Point3D position;
35 | AntennaVertex vertices[0x15];
36 | };
37 | }
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/camera.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "camera.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include
7 |
8 | namespace Chimera {
9 | CameraType camera_type() noexcept {
10 | static auto *cta = reinterpret_cast(*reinterpret_cast(get_chimera().get_signature("camera_type_sig").data() + 0x2) + 0x56);
11 | return *cta;
12 | }
13 |
14 | CameraData &camera_data() noexcept { //0x647600 usually
15 | static std::optional camera_coord_addr;
16 | if(!camera_coord_addr.has_value()) {
17 | camera_coord_addr = reinterpret_cast(*reinterpret_cast(get_chimera().get_signature("camera_coord_sig").data() + 2) - 0x8);
18 | }
19 | return **camera_coord_addr;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/chat.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .data
6 | chat_out_addr: .long 0
7 |
8 | .text
9 |
10 | ;# Handle sending chat
11 | chat_out_sig: .string "chat_out_sig"
12 | .globl _chat_out_asm
13 | _chat_out_asm:
14 | pushfd
15 | pushad
16 |
17 | ;# If we don't have the address, get it
18 | cmp dword ptr chat_out_addr, 0
19 | jnz do_send_chat
20 | lea eax, byte ptr chat_out_sig
21 | push eax
22 | call _address_for_signature
23 | mov chat_out_addr, eax
24 | pop eax
25 |
26 | ;# Prepare our message
27 | do_send_chat:
28 | mov eax, [esp+0x28]
29 | mov edx, [esp+0x2C]
30 | mov esi, [esp+0x2C]
31 | push [esp+0x2C]
32 | sub esp, 4
33 |
34 | ;# Get our ID, too (for trial)
35 | pushfd
36 | pushad
37 | call _chat_get_local_rcon_id
38 | mov [esp+0x24], eax
39 | popad
40 | popfd
41 |
42 | ;# Send the message
43 | call dword ptr chat_out_addr
44 | add esp, 8
45 |
46 | popad
47 | popfd
48 | ret
49 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/chat.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "chat.hpp"
4 | #include
5 | #include
6 | #include
7 |
8 | namespace Chimera {
9 | extern "C" void chat_out_asm(int channel, const wchar_t *message);
10 |
11 | void chat_out(int channel, const wchar_t *message) {
12 | if(!message) {
13 | return;
14 | }
15 | chat_out_asm(channel, message);
16 | }
17 | void chat_out(int channel, const char *message) {
18 | if(!message) {
19 | return;
20 | }
21 |
22 | wchar_t message_to_send[256] = {};
23 | MultiByteToWideChar(CP_UTF8, 0, message, -1, message_to_send, sizeof(message_to_send) / sizeof(*message_to_send));
24 | chat_out_asm(channel, message_to_send);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/chat.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_HALO_DATA_CHAT_HPP
4 | #define CHIMERA_HALO_DATA_CHAT_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Send a chat message
9 | * @param channel channel to send on
10 | * @param message message to send
11 | */
12 | void chat_out(int channel, const wchar_t *message);
13 |
14 | /**
15 | * Send a chat message
16 | * @param channel channel to send on
17 | * @param message message to send
18 | */
19 | void chat_out(int channel, const char *message);
20 | }
21 |
22 | #endif
23 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/contrail.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 |
6 | #include "contrail.hpp"
7 |
8 | namespace Chimera {
9 | ContrailTable &ContrailTable::get_contrail_table() noexcept {
10 | static auto *contrail_table = **reinterpret_cast(get_chimera().get_signature("contrail_table_sig").data() + 2);
11 | return *contrail_table;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/contrail.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_HALO_DATA_CONTRAIL_HPP
4 | #define CHIMERA_HALO_DATA_CONTRAIL_HPP
5 |
6 | #include
7 |
8 | #include "table.hpp"
9 | #include "pad.hpp"
10 | #include "object.hpp"
11 |
12 | namespace Chimera {
13 | struct Contrail;
14 |
15 | struct ContrailTable : GenericTable {
16 | /**
17 | * Get the contrail table.
18 | * @return Return a reference to the contrail table.
19 | */
20 | static ContrailTable &get_contrail_table() noexcept;
21 | };
22 |
23 | struct Contrail {
24 | std::uint16_t id;
25 | std::uint16_t unknown;
26 | std::uint32_t tag_id;
27 | ObjectID parent_object_id;
28 |
29 | // Dont care about the rest really.
30 | PAD(0x38);
31 | };
32 | static_assert(sizeof(Contrail) == 0x44);
33 | }
34 | #endif
35 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/controls.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include "../signature/signature.hpp"
5 | #include "../chimera.hpp"
6 |
7 | #include "controls.hpp"
8 |
9 | namespace Chimera {
10 | Controls &get_controls() noexcept {
11 | static std::optional controls_table;
12 | if(!controls_table.has_value()) {
13 | controls_table = *reinterpret_cast(get_chimera().get_signature("controls_sig").data() + 11);
14 | }
15 | return **controls_table;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/cutscene.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "cutscene.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 | #include
7 |
8 | namespace Chimera {
9 | CinematicGlobals &get_cinematic_globals() noexcept {
10 | static auto *cin_globals = **reinterpret_cast(get_chimera().get_signature("cinematic_globals_sig").data() + 0x2);
11 | return *cin_globals;
12 | }
13 | }
--------------------------------------------------------------------------------
/src/chimera/halo_data/cutscene.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_CUTSCENE_HALO_DATA_HPP
4 | #define CHIMERA_CUTSCENE_HALO_DATA_HPP
5 |
6 | #include
7 | #include "type.hpp"
8 |
9 | namespace Chimera {
10 |
11 | struct CinematicGlobals {
12 | float letter_box_size;
13 | uint32_t letter_box_last_game_time;
14 | bool showing_letter_box;
15 | bool cinematic_in_progress;
16 | bool cinematic_skip_in_progress;
17 | bool cinematic_suppress_bsp_object_creation;
18 | };
19 | static_assert(sizeof(CinematicGlobals) == 0xC);
20 |
21 | /**
22 | * Get the cinematic globals.
23 | * @return Return a reference to the cinematic globals.
24 | */
25 | CinematicGlobals &get_cinematic_globals() noexcept;
26 | }
27 |
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/damage.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .data
6 | apply_damage_addr: .long 0
7 |
8 | .text
9 |
10 | ;# Damage signature
11 | apply_damage_sig: .string "apply_damage_sig"
12 |
13 | .globl _apply_damage_asm
14 | _apply_damage_asm:
15 | pushfd
16 | pushad
17 |
18 | ;# If we don't have the signature, get it
19 | lea eax, dword ptr apply_damage_addr
20 | push eax
21 | lea eax, byte ptr apply_damage_sig
22 | push eax
23 | call _address_for_signature_if_null
24 | add esp, 8
25 |
26 | do_apply_damage:
27 |
28 | ;# Pass some stuff
29 | push 0
30 | push 0xFFFFFFFF
31 | push 0xFFFFFFFF
32 | push 0xFFFFFFFF
33 |
34 | ;# Object ID
35 | push dword ptr [esp+0x3C]
36 |
37 | ;# Struct pointer
38 | push dword ptr [esp+0x3C]
39 |
40 | ;# Call it and hope we don't crash
41 | call dword ptr apply_damage_addr
42 |
43 | ;# Cleanup
44 | add esp, 0x18
45 |
46 | popad
47 | popfd
48 |
49 | ret
50 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/damage.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 |
6 | #include "damage.hpp"
7 |
8 | namespace Chimera {
9 | extern "C" void apply_damage_asm(DamageObjectStructThing *damage, std::uint32_t object);
10 |
11 | void apply_damage(ObjectID object, TagID damage_effect, float multiplier, PlayerID causer_player, ObjectID causer_object) noexcept {
12 | DamageObjectStructThing s;
13 | s.damage_tag_id = damage_effect;
14 | s.causer_player = causer_player;
15 | s.causer_object = causer_object;
16 | s.multiplier = multiplier;
17 | apply_damage_asm(&s, object.whole_id);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/decal.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 |
6 | #include "decal.hpp"
7 |
8 | namespace Chimera {
9 | DecalTable &DecalTable::get_decal_table() noexcept {
10 | static auto *decal_table = **reinterpret_cast(get_chimera().get_signature("decal_table_sig").data() + 1);
11 | return *decal_table;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/decal.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_DECAL_HPP
4 | #define CHIMERA_DECAL_HPP
5 |
6 | #include
7 |
8 | #include "object.hpp"
9 | #include "../math_trig/math_trig.hpp"
10 |
11 | namespace Chimera {
12 | struct DecalTable : GenericTable {
13 | /**
14 | * Get the decal table
15 | * @return reference to the decal table
16 | */
17 | static DecalTable &get_decal_table() noexcept;
18 | };
19 | }
20 |
21 | #endif
22 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/effect.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 |
6 | #include "effect.hpp"
7 |
8 | namespace Chimera {
9 | EffectTable &EffectTable::get_effect_table() noexcept {
10 | static auto *effect_table = **reinterpret_cast(get_chimera().get_signature("effect_table_sig").data() + 1);
11 | return *effect_table;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/effect.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_EFFECT_HPP
4 | #define CHIMERA_EFFECT_HPP
5 |
6 | #include
7 |
8 | #include "object.hpp"
9 | #include "../math_trig/math_trig.hpp"
10 |
11 | namespace Chimera {
12 | struct EffectTable : GenericTable {
13 | /**
14 | * Get the effect table
15 | * @return reference to the effect table
16 | */
17 | static EffectTable &get_effect_table() noexcept;
18 | };
19 | }
20 |
21 | #endif
22 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/flag.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 |
6 | #include "flag.hpp"
7 |
8 | namespace Chimera {
9 | FlagTable &FlagTable::get_flag_table() noexcept {
10 | static auto *flag_table = **reinterpret_cast(get_chimera().get_signature("flag_table_sig").data() + 2);
11 | return *flag_table;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/flag.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_FLAG_HPP
4 | #define CHIMERA_FLAG_HPP
5 |
6 | #include
7 |
8 | #include "object.hpp"
9 | #include "../math_trig/math_trig.hpp"
10 |
11 | namespace Chimera {
12 | struct Flag;
13 |
14 | struct FlagTable : GenericTable {
15 | /**
16 | * Get the flag table.
17 | * @return Return a reference to the flag table.
18 | */
19 | static FlagTable &get_flag_table() noexcept;
20 | };
21 |
22 | /** This is a part of a flag. */
23 | struct FlagPart {
24 | /** Coordinates relative to the world */
25 | Point3D position;
26 |
27 | /** World units per tick */
28 | Point3D velocity;
29 | };
30 | static_assert(sizeof(FlagPart) == 0x18);
31 |
32 | /** This is a flag cloth object. */
33 | struct Flag {
34 | std::uint32_t some_id;
35 | std::uint32_t unknown0;
36 | ObjectID parent_object_id;
37 | std::uint32_t some_id1;
38 | Point3D position;
39 | FlagPart parts[241];
40 | char padding[8];
41 | };
42 | static_assert(sizeof(Flag) == 0x16BC);
43 | }
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/game_engine.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include "../signature/signature.hpp"
5 | #include "../chimera.hpp"
6 |
7 | #include "game_engine.hpp"
8 |
9 | namespace Chimera {
10 | GameEngine game_engine() noexcept {
11 | static auto *game_engine = *reinterpret_cast(get_chimera().get_signature("game_engine_sig").data() + 4);
12 | static std::optional game_engine_used;
13 | if(!game_engine_used.has_value()) {
14 | if(std::strcmp(game_engine, "halom") == 0) {
15 | game_engine_used = GameEngine::GAME_ENGINE_CUSTOM_EDITION;
16 | }
17 | else if(std::strcmp(game_engine, "halor") == 0) {
18 | game_engine_used = GameEngine::GAME_ENGINE_RETAIL;
19 | }
20 | else if(std::strcmp(game_engine, "halod") == 0) {
21 | game_engine_used = GameEngine::GAME_ENGINE_DEMO;
22 | }
23 | }
24 | return game_engine_used.value();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/game_engine.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_GAME_ENGINE_HPP
4 | #define CHIMERA_GAME_ENGINE_HPP
5 |
6 | namespace Chimera {
7 | /** Engine used */
8 | enum GameEngine {
9 | /** Custom Edition */
10 | GAME_ENGINE_CUSTOM_EDITION,
11 |
12 | /** Retail */
13 | GAME_ENGINE_RETAIL,
14 |
15 | /** Demo */
16 | GAME_ENGINE_DEMO
17 | };
18 |
19 | /**
20 | * Get the game engine used
21 | * @return game engine used
22 | */
23 | GameEngine game_engine() noexcept;
24 | }
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/globals.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_GLOBALS_HPP
4 | #define CHIMERA_GLOBALS_HPP
5 |
6 | namespace Chimera {
7 | enum ScriptingGlobalType {
8 | SCRIPTING_GLOBAL_NOT_FOUND = 0,
9 | SCRIPTING_GLOBAL_BOOLEAN,
10 | SCRIPTING_GLOBAL_REAL,
11 | SCRIPTING_GLOBAL_SHORT,
12 | SCRIPTING_GLOBAL_LONG,
13 | SCRIPTING_GLOBAL_UNIMPLEMENTED
14 | };
15 |
16 | union ScriptingGlobalValue {
17 | bool boolean;
18 | float real;
19 | short short_int;
20 | long long_int;
21 | };
22 |
23 | struct ScriptingGlobal {
24 | ScriptingGlobalType type = SCRIPTING_GLOBAL_NOT_FOUND;
25 | ScriptingGlobalValue value;
26 | };
27 |
28 | ScriptingGlobal read_global(const char *global_name) noexcept;
29 |
30 | bool set_global(const char *global_name, ScriptingGlobalValue value) noexcept;
31 | }
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/hud_fonts.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_HALO_DATA_HUD_FONTS_HPP
4 | #define CHIMERA_HALO_DATA_HUD_FONTS_HPP
5 |
6 | namespace Chimera {
7 | struct ColorARGB;
8 |
9 | /**
10 | * Set the scoreboard font
11 | */
12 | void set_up_scoreboard_font() noexcept;
13 |
14 | /**
15 | * Set the name font
16 | */
17 | void set_up_name_font() noexcept;
18 |
19 | /**
20 | * Initialize the sexiest HUD text you'll ever see
21 | */
22 | void initialize_hud_text() noexcept;
23 |
24 | /**
25 | * Get whether or not we initialized this stuff
26 | * @return true if we did it
27 | */
28 | bool hud_text_mod_initialized() noexcept;
29 |
30 | /**
31 | * Get the HUD color
32 | * @return HUD color
33 | */
34 | const ColorARGB &get_hud_text_color() noexcept;
35 | }
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/keyboard.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "keyboard.hpp"
4 | #include "../signature/signature.hpp"
5 | #include "../chimera.hpp"
6 |
7 | namespace Chimera {
8 | KeyboardKeys &get_keyboard_keys() noexcept {
9 | static KeyboardKeys *buffer = nullptr;
10 | if(!buffer) {
11 | buffer = *reinterpret_cast(get_chimera().get_signature("keyboard_keys_sig").data() + 1);
12 | }
13 | return *buffer;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/light.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 |
6 | #include "light.hpp"
7 |
8 | namespace Chimera {
9 | LightTable &LightTable::get_light_table() noexcept {
10 | static auto *light_table = **reinterpret_cast(get_chimera().get_signature("light_table_sig").data() + 2);
11 | return *light_table;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/light.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LIGHT_HPP
4 | #define CHIMERA_LIGHT_HPP
5 |
6 | #include
7 |
8 | #include "object.hpp"
9 | #include "../math_trig/math_trig.hpp"
10 |
11 | namespace Chimera {
12 | struct Light;
13 |
14 | struct LightTable : GenericTable {
15 | /**
16 | * Get the light table
17 | * @return reference to the light table
18 | */
19 | static LightTable &get_light_table() noexcept;
20 | };
21 |
22 | struct Light {
23 | // 0x0
24 | std::uint32_t unknown0;
25 | std::uint32_t some_id;
26 | std::uint32_t unknown1;
27 | std::uint32_t some_counter;
28 | // 0x10
29 | std::uint32_t unknown2;
30 | float red;
31 | float green;
32 | float blue;
33 | // 0x20
34 | std::uint32_t unknown3;
35 | std::uint32_t unknown4;
36 | std::uint32_t unknown5;
37 | std::uint32_t parent_object_id;
38 | // 0x30
39 | Point3D position;
40 | Point3D orientation[2];
41 | // 0x54
42 | char i_stopped_caring_at_this_point[0x28];
43 | };
44 | static_assert(sizeof(Light) == 0x7C);
45 | }
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/main_menu_music.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MAIN_MENU_MUSIC_HPP
4 | #define CHIMERA_MAIN_MENU_MUSIC_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Block the main menu music if we have to
9 | */
10 | void block_main_menu_music_if_needed() noexcept;
11 |
12 | /**
13 | * Set whether or not main menu music is forced
14 | * @param force force it or not
15 | */
16 | void set_force_block_main_menu_music(bool force) noexcept;
17 | }
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/map.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .data
6 | load_ui_map_addr: .long 0
7 |
8 | .text
9 | load_ui_map_sig: .string "load_ui_map_sig"
10 |
11 | .globl _load_ui_map_asm
12 | _load_ui_map_asm:
13 | pushfd
14 | pushad
15 | cmp dword ptr load_ui_map_addr, 0
16 | jnz load_ui_map
17 | lea eax, byte ptr load_ui_map_sig
18 | push eax
19 | call _address_for_signature
20 | mov load_ui_map_addr, eax
21 | pop eax
22 |
23 | load_ui_map:
24 | mov ebx, 0
25 | push ebx
26 | call dword ptr load_ui_map_addr
27 | add esp, 4
28 | popad
29 | popfd
30 |
31 | ret
32 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/menu.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include "../halo_data/tag.hpp"
5 | #include "../halo_data/tag_class.hpp"
6 | #include "../signature/signature.hpp"
7 | #include "../chimera.hpp"
8 | #include "menu.hpp"
9 |
10 | namespace Chimera {
11 | extern "C" void load_ui_widget_asm(const char *ui_widget_path) noexcept;
12 | extern "C" void load_main_menu_asm() noexcept;
13 |
14 | bool load_ui_widget(const char *tag_path) noexcept {
15 | if(get_tag(tag_path, TAG_CLASS_UI_WIDGET_DEFINITION)) {
16 | load_ui_widget_asm(tag_path);
17 | return true;
18 | }
19 | return false;
20 | }
21 |
22 | void load_main_menu() noexcept {
23 | load_main_menu_asm();
24 | }
25 | }
--------------------------------------------------------------------------------
/src/chimera/halo_data/menu.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MENU_HPP
4 | #define CHIMERA_MENU_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Load a UI widget
9 | */
10 | bool load_ui_widget(const char *tag_path) noexcept;
11 |
12 | /**
13 | * Load the UI main menu
14 | */
15 | void load_main_menu() noexcept;
16 | }
17 |
18 | #endif
--------------------------------------------------------------------------------
/src/chimera/halo_data/multiplayer.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 | #include "../output/output.hpp"
6 |
7 | #include "multiplayer.hpp"
8 |
9 | namespace Chimera {
10 | ServerType server_type() {
11 | static auto *server_type = *reinterpret_cast(get_chimera().get_signature("server_type_sig").data() + 3);
12 | return *server_type;
13 | }
14 |
15 | Gametype gametype() {
16 | static auto *gametype = *reinterpret_cast(get_chimera().get_signature("current_gametype_sig").data() + 2);
17 | return *gametype;
18 | }
19 |
20 | bool is_team() {
21 | static auto *is_team = *reinterpret_cast(get_chimera().get_signature("current_gametype_sig").data() + 2) + 4;
22 | return *is_team;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/multiplayer.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MULTIPLAYER_HPP
4 | #define CHIMERA_MULTIPLAYER_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | enum ServerType : std::uint16_t {
10 | SERVER_NONE = 0,
11 | SERVER_DEDICATED = 1,
12 | SERVER_LOCAL = 2
13 | };
14 |
15 | /**
16 | * Return the server type.
17 | * @return Return the server type.
18 | */
19 | ServerType server_type();
20 |
21 | enum Gametype : std::uint16_t {
22 | GAMETYPE_CTF = 1,
23 | GAMETYPE_SLAYER = 2,
24 | GAMETYPE_ODDBALL = 3,
25 | GAMETYPE_KING = 4,
26 | GAMETYPE_RACE = 5
27 | };
28 |
29 | /**
30 | * Return the gametype.
31 | * @return Return the gametype.
32 | */
33 | Gametype gametype();
34 |
35 | /**
36 | * Get if team game
37 | * @return true if team
38 | */
39 | bool is_team();
40 | }
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/pad.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_PAD_HPP
4 | #define CHIMERA_PAD_HPP
5 |
6 | #define MAKE_PAD2(size, name) char zzz_padding_ ## size ## _l ## name [ size ]
7 | #define MAKE_PAD(size, name) MAKE_PAD2(size, name)
8 | #define PAD(size) MAKE_PAD(size, __LINE__)
9 |
10 | #define MAKE_PAD_BIT2(type, size, name) type zzz_padding_ ## size ## _l ## name : size
11 | #define MAKE_PAD_BIT(type, size, name) MAKE_PAD_BIT2(type, size, name)
12 | #define PAD_BIT(type, size) MAKE_PAD_BIT(type, size, __LINE__)
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/particle.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../signature/signature.hpp"
4 | #include "../chimera.hpp"
5 |
6 | #include "particle.hpp"
7 |
8 | namespace Chimera {
9 | ParticleTable &ParticleTable::get_particle_table() noexcept {
10 | static auto *particle_table = **reinterpret_cast(get_chimera().get_signature("particle_table_sig").data() + 2);
11 | return *particle_table;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/path.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "../chimera.hpp"
4 | #include "../signature/signature.hpp"
5 | #include "path.hpp"
6 |
7 | namespace Chimera {
8 | const char *halo_path() noexcept {
9 | static const char *path = nullptr;
10 | if(!path) {
11 | path = *reinterpret_cast(get_chimera().get_signature("path_sig").data() + 1);
12 | }
13 | return path;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/path.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_PATH_HPP
4 | #define CHIMERA_PATH_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Get the Halo profile path
9 | * @return Halo profile path
10 | */
11 | const char *halo_path() noexcept;
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/pause.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include "../signature/signature.hpp"
5 | #include "../chimera.hpp"
6 |
7 | namespace Chimera {
8 | bool game_paused() noexcept {
9 | static std::optional paused_addr;
10 | if(!paused_addr.has_value()) {
11 | paused_addr = *reinterpret_cast(get_chimera().get_signature("game_paused_sig").data() + 2);
12 | }
13 | return *reinterpret_cast(*paused_addr.value() + 2);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/pause.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_PAUSE_HPP
4 | #define CHIMERA_PAUSE_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Get whether the game is paused
9 | */
10 | bool game_paused() noexcept;
11 | }
12 |
13 | #endif
--------------------------------------------------------------------------------
/src/chimera/halo_data/port.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_PORT_HPP
4 | #define CHIMERA_PORT_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | /**
10 | * Set the ports if needed
11 | */
12 | void set_ports() noexcept;
13 |
14 | /**
15 | * Get the client port
16 | * @return client port
17 | */
18 | std::uint16_t get_client_port() noexcept;
19 |
20 | /**
21 | * Get the server port
22 | * @return server port
23 | */
24 | std::uint16_t get_server_port() noexcept;
25 | }
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/resolution.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "resolution.hpp"
4 | #include "../chimera.hpp"
5 | #include "../signature/signature.hpp"
6 |
7 | namespace Chimera {
8 | Resolution &get_resolution() noexcept {
9 | static Resolution *resolution = *reinterpret_cast(get_chimera().get_signature("resolution_sig").data() + 4);
10 | return *resolution;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/resolution.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_RESOLUTION_HPP
4 | #define CHIMERA_RESOLUTION_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | /** This is the resolution of the game. */
10 | struct Resolution {
11 | /** Height in pixels */
12 | std::uint16_t height;
13 |
14 | /** Width in pixels */
15 | std::uint16_t width;
16 | };
17 |
18 | /**
19 | * Get the current resolution of Halo.
20 | * @return Return the current resolution of Halo.
21 | */
22 | Resolution &get_resolution() noexcept;
23 | }
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/resource_map.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_RESOURCE_MAP_HPP
4 | #define CHIMERA_RESOURCE_MAP_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | struct ResourceMapHeader {
10 | /**
11 | * Type of resource map
12 | */
13 | std::uint32_t type;
14 |
15 | /**
16 | * Offset to paths
17 | */
18 | std::uint32_t paths;
19 |
20 | /**
21 | * Offset to resource indices
22 | */
23 | std::uint32_t resources;
24 |
25 | /**
26 | * Number of resources
27 | */
28 | std::uint32_t resource_count;
29 | };
30 | static_assert(sizeof(ResourceMapHeader) == 0x10);
31 |
32 | struct ResourceMapResource {
33 | /**
34 | * Resource path offset from tag paths offset
35 | */
36 | std::uint32_t path_offset;
37 |
38 | /**
39 | * Size of resource
40 | */
41 | std::uint32_t size;
42 |
43 | /**
44 | * Ofset of resource data
45 | */
46 | std::uint32_t data_offset;
47 | };
48 | static_assert(sizeof(ResourceMapResource) == 0xC);
49 | }
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/script.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | .globl _execute_script_asm
8 | _execute_script_asm:
9 | mov eax, [esp+4]
10 | pushfd
11 | pushad
12 | push eax
13 | call dword ptr [esp+0x30]
14 | pop eax
15 | popad
16 | popfd
17 | ret
18 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/script.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include "script.hpp"
5 | #include "../chimera.hpp"
6 | #include "../signature/signature.hpp"
7 |
8 | namespace Chimera {
9 | extern "C" void execute_script_asm(const char *script, std::byte *script_function) noexcept;
10 |
11 | void execute_script(const char *script, bool lower) noexcept {
12 | static std::optional script_function;
13 | static std::uint8_t *do_not_lowercase_script_addr;
14 | if(!script_function.has_value()) {
15 | script_function = get_chimera().get_signature("execute_script_sig").data();
16 | do_not_lowercase_script_addr = *reinterpret_cast(get_chimera().get_signature("do_not_lowercase_script_sig").data() + 1);
17 | }
18 | std::uint8_t value_before = *do_not_lowercase_script_addr;
19 | *do_not_lowercase_script_addr = !lower;
20 | execute_script_asm(script, *script_function);
21 | *do_not_lowercase_script_addr = value_before;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/script.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_SCRIPT_HPP
4 | #define CHIMERA_SCRIPT_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | /**
10 | * Execute the script
11 | * @param script script to execute
12 | * @param lower have Halo lowercase the string
13 | */
14 | void execute_script(const char *script, bool lower = false) noexcept;
15 | }
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/shaders/fx/EffectCollection_ps_2_0.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/src/chimera/halo_data/shaders/fx/EffectCollection_ps_2_0.bin
--------------------------------------------------------------------------------
/src/chimera/halo_data/shaders/fx/fx.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/src/chimera/halo_data/shaders/fx/fx.bin
--------------------------------------------------------------------------------
/src/chimera/halo_data/shaders/shader_blob.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 |
5 | // Vertex Shaders
6 | extern unsigned char vsh_collection[];
7 | extern const size_t vsh_collection_size;
8 |
9 | // D3DX Effects
10 | extern unsigned char fx_collection[];
11 | extern const size_t fx_collection_size;
12 |
13 | // Effects Collection
14 | extern unsigned char ce_effects_collection[];
15 | extern const size_t ce_effects_collection_sze;
16 |
17 |
--------------------------------------------------------------------------------
/src/chimera/halo_data/shaders/vertex/vsh.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/src/chimera/halo_data/shaders/vertex/vsh.bin
--------------------------------------------------------------------------------
/src/chimera/halo_data/type.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_TYPE_HPP
4 | #define CHIMERA_TYPE_HPP
5 |
6 | #include
7 | #include "../math_trig/math_trig.hpp"
8 | #include "pad.hpp"
9 |
10 | namespace Chimera {
11 | using TickCount = std::uint32_t;
12 |
13 | union HaloID {
14 | std::uint32_t whole_id;
15 | struct {
16 | std::uint16_t index;
17 | std::uint16_t id;
18 | } index;
19 |
20 | static HaloID null_id() noexcept {
21 | return { 0xFFFFFFFF };
22 | }
23 |
24 | /**
25 | * Check if the tag is null (0xFFFFFFFF)
26 | * @return true if the tag is null
27 | */
28 | bool is_null() const noexcept {
29 | return *this == null_id();
30 | }
31 |
32 | bool operator==(const HaloID &other) const noexcept {
33 | return this->whole_id == other.whole_id;
34 | }
35 |
36 | bool operator!=(const HaloID &other) const noexcept {
37 | return this->whole_id != other.whole_id;
38 | }
39 | };
40 | static_assert(sizeof(HaloID) == 4);
41 |
42 | using TagID = HaloID;
43 | using ObjectID = HaloID;
44 | using PlayerID = HaloID;
45 | }
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/chimera/localization/localization.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LOCALIZATION_HPP
4 | #define CHIMERA_LOCALIZATION_HPP
5 |
6 | #include "../chimera.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Get the localized form of the string
11 | * @param string string to get
12 | * @return localized form or the string, itself, if not found
13 | */
14 | const char *localize(const char *string, Language = get_chimera().get_language()) noexcept;
15 | }
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/src/chimera/lua/lua_callback.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LUA_CALLBACK_HPP
4 | #define CHIMERA_LUA_CALLBACK_HPP
5 |
6 | #include "lua_script.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Set up Lua callbacks
11 | */
12 | int lua_set_callback(lua_State *state) noexcept;
13 | void setup_callbacks() noexcept;
14 | }
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/chimera/lua/lua_filesystem.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LUA_FS_HPP
4 | #define CHIMERA_LUA_FS_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | /**
10 | * Set up filesystem functions into Lua state
11 | */
12 | void set_fs_functions(lua_State *state) noexcept;
13 | }
14 |
15 | #endif
--------------------------------------------------------------------------------
/src/chimera/lua/lua_game.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LUA_GAME_HPP
4 | #define CHIMERA_LUA_GAME_HPP
5 |
6 | #include "lua_script.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Set up game functions into Lua state
11 | */
12 | void set_game_functions(lua_State *state) noexcept;
13 | }
14 |
15 | #endif
--------------------------------------------------------------------------------
/src/chimera/lua/lua_io.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LUA_IO_HPP
4 | #define CHIMERA_LUA_IO_HPP
5 |
6 | #include "lua_script.hpp"
7 |
8 | namespace Chimera {
9 | /**
10 | * Set up I/O functions into state
11 | */
12 | void set_io_functions(lua_State *state) noexcept;
13 | }
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/src/chimera/lua/lua_variables.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 |
5 | namespace Chimera {
6 | /**
7 | * Refresh client index variable of a given Lua script state
8 | */
9 | void refresh_client_index(lua_State *state) noexcept;
10 |
11 | /**
12 | * Reflesh global variables of a given Lua script state
13 | */
14 | void refresh_variables(lua_State *state) noexcept;
15 | }
--------------------------------------------------------------------------------
/src/chimera/lua/scripting.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LUA_HPP
4 | #define CHIMERA_LUA_HPP
5 |
6 | namespace Chimera {
7 | /**
8 | * Set up Lua scripting
9 | */
10 | void setup_lua_scripting();
11 |
12 | /**
13 | * Kill up Lua scripting
14 | */
15 | void destroy_lua_scripting();
16 | }
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/src/chimera/map_loading/compression.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MAP_COMPRESSION_HPP
4 | #define CHIMERA_MAP_COMPRESSION_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | std::size_t decompress_map_file(const char *input, const char *output);
10 | std::size_t decompress_map_file(const char *input, std::byte *output, std::size_t output_size);
11 | }
12 |
13 | #endif
--------------------------------------------------------------------------------
/src/chimera/map_loading/crc32.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CRC32_HPP
2 | #define CRC32_HPP
3 |
4 | #include
5 |
6 | extern "C" std::uint32_t crc32(std::uint32_t crc, const void *buf, std::size_t size);
7 |
8 | #endif
--------------------------------------------------------------------------------
/src/chimera/map_loading/fast_load.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | ;# Here's the the on_get_crc32_hook function. We just need to call our function, do the stuff Halo PC does and return.
8 | .globl _on_get_crc32_hook
9 | _on_get_crc32_hook:
10 | ;# Call our function
11 | pushfd
12 | pushad
13 | call _on_get_crc32_custom_edition_loading
14 | popad
15 | popfd
16 |
17 | ;# Do this
18 | shl eax, 4
19 | mov ecx, [eax + edx + 12]
20 |
21 | ret
22 |
--------------------------------------------------------------------------------
/src/chimera/map_loading/get_file_name_from_handle.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA__GET_FILE_NAME_FROM_HANDLE_H
4 | #define CHIMERA__GET_FILE_NAME_FROM_HANDLE_H
5 |
6 | #include
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | DWORD WINAPI GetFileNameFromHandle(HANDLE hFile, LPSTR lpszFilePath, DWORD cchFilePath, DWORD dwFlags);
13 |
14 | #ifdef __cplusplus
15 | }
16 | #endif
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/src/chimera/map_loading/laa.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "laa.hpp"
4 | #include
5 | #include
6 | #include
7 | #include "../chimera.hpp"
8 |
9 | namespace Chimera {
10 | bool current_exe_is_laa_patched() {
11 | for(const std::byte *i = reinterpret_cast(0x400000) ;; i++) {
12 | if(memcmp(i, "PE\x00\x00", 4) == 0) {
13 | i += 0x16;
14 | auto value = static_cast(*i);
15 | return value & IMAGE_FILE_LARGE_ADDRESS_AWARE;
16 | }
17 | }
18 | return false;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/chimera/map_loading/laa.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_LAA_HPP
4 | #define CHIMERA_LAA_HPP
5 |
6 | namespace Chimera {
7 | bool current_exe_is_laa_patched();
8 | }
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/src/chimera/map_loading/map_loading.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MAP_LOADING_HPP
4 | #define CHIMERA_MAP_LOADING_HPP
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | namespace Chimera {
12 | struct LoadedMap {
13 | std::string name;
14 | std::filesystem::path path;
15 | std::optional tmp_file;
16 | std::optional memory_location;
17 | std::size_t buffer_size;
18 | std::size_t decompressed_size;
19 | std::size_t loaded_size;
20 | std::size_t file_size;
21 | std::filesystem::file_time_type timestamp; // time it was modified
22 | };
23 |
24 | /**
25 | * Get the loaded map
26 | * @param name name of map
27 | * @return reference to map if found, or nullptr
28 | */
29 | LoadedMap *get_loaded_map(const char *name) noexcept;
30 |
31 | /**
32 | * Set up loading maps outside of the maps directory
33 | */
34 | void set_up_map_loading();
35 |
36 | /**
37 | * Load the map
38 | * @param map_name map to load
39 | * @return loaded map
40 | */
41 | LoadedMap *load_map(const char *map_name);
42 | }
43 | #endif
44 |
--------------------------------------------------------------------------------
/src/chimera/master_server/master_server.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MASTER_SERVER_HPP
4 | #define CHIMERA_MASTER_SERVER_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | /**
10 | * Set the number of threads Halo uses to connect to the master server
11 | * @param threads number of threads (0 - 127)
12 | */
13 | void set_master_server_connection_threads(std::int8_t threads) noexcept;
14 |
15 | /**
16 | * Fix the master server stuff
17 | */
18 | void set_up_master_server() noexcept;
19 |
20 | /**
21 | * Set master server
22 | * @param list list server (if nullptr, use default)
23 | * @param key key server (if nullptr, use default)
24 | * @param natneg1 natneg1 server (if nullptr, use default)
25 | * @param natneg2 natneg2 server (if nullptr, use default)
26 | */
27 | void set_master_server(const char *list, const char *key, const char *natneg1, const char *natneg2);
28 |
29 | /**
30 | * Get master server details
31 | * @param list list server
32 | * @param key key server
33 | * @param natneg1 natneg1 server
34 | * @param natneg2 natneg2 server
35 | */
36 | void get_master_server(const char **list, const char **key, const char **natneg1, const char **natneg2);
37 | }
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/src/chimera/miscellaneous/controller.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_MISC_CONTROLLER_TEXT_HPP
4 | #define CHIMERA_MISC_CONTROLLER_TEXT_HPP
5 |
6 | namespace Chimera {
7 | void set_up_controller();
8 | }
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/src/chimera/output/draw_text.S:
--------------------------------------------------------------------------------
1 | ;# SPDX-License-Identifier: GPL-3.0-only
2 |
3 | .intel_syntax noprefix
4 |
5 | .text
6 |
7 | ;# Here is the display_text() function.
8 | ;#
9 | ;# These are the parameters:
10 | ;# - [esp + 4]: This is a pointer to the string
11 | ;# - [esp + 8]: This is the x1 and y1 values in the format 0xXXXXYYYY
12 | ;# - [esp + 12]: This is the x2 and y2 values in the format 0xXXXXYYYY. These are typically 640x480 unless the text is aligned.
13 | ;# - [esp + 16]: This is the function to use
14 | ;#
15 |
16 | .globl _display_text
17 | _display_text:
18 | ;# Push all registers so we don't mangle them
19 | pushad
20 |
21 | ;# Allocate a struct. This will be the position where our text will be rendered.
22 | sub esp, 8
23 |
24 | ;# Copy our XXXXYYYY value
25 | mov ecx, [esp + 0x30]
26 | mov [esp], ecx
27 |
28 | ;# Copy our WWWWHHHH value
29 | mov ecx, [esp + 0x34]
30 | mov [esp + 4], ecx
31 |
32 | ;# Set ecx to our struct
33 | mov ecx, esp
34 |
35 | ;# Set eax to 0
36 | xor eax, eax
37 |
38 | ;# Push our string and a couple 0s (I don't know what the 0s are for but do it)
39 | push [esp + 0x2C]
40 | push 0
41 | push 0
42 | call dword ptr [esp + 0x44]
43 | add esp, 20
44 |
45 | ;# Pop all registers, restoring them
46 | popad
47 |
48 | ;# Done!
49 | ret
50 |
--------------------------------------------------------------------------------
/src/chimera/output/error_box.cpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include
4 | #include "../chimera.hpp"
5 | #include "../config/ini.hpp"
6 | #include "error_box.hpp"
7 |
8 | namespace Chimera {
9 | void show_error_box(const char *header, const char *text, const std::optional &force, const std::optional &is_client) noexcept {
10 | auto &chimario = get_chimera();
11 | std::fprintf(stderr, "\n\nError [%s]\n\n----------------\n\n%s\n\n----------------\n\n", header, text);
12 | if (
13 | is_client.value_or(chimario.feature_present("client")) &&
14 | (
15 | force.value_or(false) ||
16 | chimario.get_ini() == nullptr ||
17 | !chimario.get_ini()->get_value_bool("error_handling.suppress_fatal_errors").value_or(false)
18 | )
19 | ) {
20 | MessageBox(nullptr, text, header, MB_OK | MB_ICONERROR);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/chimera/output/error_box.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef CHIMERA_ERROR_BOX_HPP
4 | #define CHIMERA_ERROR_BOX_HPP
5 |
6 | #include
7 |
8 | namespace Chimera {
9 | /**
10 | * Show an error box
11 | * @param header header to show
12 | * @param text text to show
13 | * @param force force showing a message box regardless of the suppress_fatal_errors option
14 | * @param is_client specify if Chimera is running as a client (default is to check for client signatures)
15 | */
16 | void show_error_box(const char *header, const char *text, const std::optional &force = std::nullopt, const std::optional &is_client = std::nullopt) noexcept;
17 | }
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/src/chimera/signature/hac/HAC2_LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 - 2018 HAC2
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/src/chimera/signature/hac/codefinder.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifndef _CODEFINDER_H
4 | #define _CODEFINDER_H
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | class CodeFinder {
11 | HANDLE module;
12 | unsigned int length;
13 | const short* signature;
14 | std::vector locations;
15 |
16 | PIMAGE_SECTION_HEADER GetSection(HANDLE module);
17 | void findCode(HANDLE module, const short *signature, size_t size, bool fastFind);
18 | void boyerFind(const short* signature, size_t sigLength, BYTE* memory, size_t memLength);
19 |
20 | public:
21 | CodeFinder(HANDLE module, const short* signature, unsigned int signatureLen);
22 | std::vector::iterator begin();
23 | std::vector::iterator end();
24 | std::vector find();
25 | };
26 |
27 | //Old interface so I don't have to change all of the hooks, for now
28 | std::uintptr_t FindCode(HANDLE module, const short* signature, size_t signatureLen, unsigned int match_num);
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/chimera/version.cmake:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: GPL-3.0-only
2 |
3 | # Set some default values
4 | set(CHIMERA_GIT_COMMIT_COUNT 0)
5 | set(CHIMERA_GIT_COMMIT "\"unknown\"")
6 |
7 | # Set things whether or not things worked
8 | if(${IN_GIT_REPO} STREQUAL "TRUE")
9 | execute_process(
10 | COMMAND "${GIT_EXECUTABLE}" --git-dir "${GIT_DIR}" rev-parse --short HEAD
11 | OUTPUT_VARIABLE CHIMERA_GIT_COMMIT
12 | )
13 | execute_process(
14 | COMMAND "${GIT_EXECUTABLE}" --git-dir "${GIT_DIR}" rev-list --count HEAD
15 | OUTPUT_VARIABLE CHIMERA_GIT_COMMIT_COUNT
16 | )
17 | string(STRIP "${CHIMERA_GIT_COMMIT_COUNT}" CHIMERA_GIT_COMMIT_COUNT)
18 | string(STRIP "${CHIMERA_GIT_COMMIT}" CHIMERA_GIT_COMMIT)
19 | set(CHIMERA_FULL_VERSION_TEXT "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.r${CHIMERA_GIT_COMMIT_COUNT}.${CHIMERA_GIT_COMMIT}")
20 | else()
21 | set(CHIMERA_FULL_VERSION_TEXT "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.unknown")
22 | endif()
23 |
24 | # Overwrite version.hpp
25 | file(WRITE "${OUT_FILE}" "#define CHIMERA_VERSION_STRING \"${CHIMERA_FULL_VERSION_TEXT}\"\n#define CHIMERA_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}\n#define CHIMERA_VERSION_MINOR ${PROJECT_VERSION_MINOR}\n#define CHIMERA_VERSION_PATCH ${PROJECT_VERSION_PATCH}\n#define CHIMERA_GIT_COMMIT_COUNT ${CHIMERA_GIT_COMMIT_COUNT}\n")
26 |
--------------------------------------------------------------------------------
/src/chimera/version.rc:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #include "version.hpp"
4 |
5 | 1 VERSIONINFO
6 | FILEVERSION CHIMERA_VERSION_MAJOR,CHIMERA_VERSION_MINOR,CHIMERA_VERSION_PATCH,CHIMERA_GIT_COMMIT_COUNT
7 | PRODUCTVERSION CHIMERA_VERSION_MAJOR,CHIMERA_VERSION_MINOR,CHIMERA_VERSION_PATCH,CHIMERA_GIT_COMMIT_COUNT
8 | BEGIN
9 | BLOCK "StringFileInfo"
10 | BEGIN
11 | BLOCK "040904B0"
12 | BEGIN
13 | VALUE "Comments", "It's still not finished"
14 | VALUE "CompanyName", "Snowy ^.^"
15 | VALUE "FileDescription", "The Halo PC update that never was."
16 | VALUE "FileVersion", CHIMERA_VERSION_STRING
17 | VALUE "InternalName", "chimera"
18 | VALUE "OriginalFilename", "strings.dll"
19 | VALUE "ProductName", "Chimera"
20 | VALUE "ProductVersion", CHIMERA_VERSION_STRING
21 | VALUE "LegalCopyright", "'16'17'18 Snowy"
22 | END
23 | END
24 | BLOCK "VarFileInfo"
25 | BEGIN
26 | VALUE "Translation", 0x409, 1200
27 | END
28 | END
29 |
--------------------------------------------------------------------------------
/src/lua/COPYRIGHT:
--------------------------------------------------------------------------------
1 | Copyright © 1994–2017 Lua.org, PUC-Rio.
2 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3 |
4 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5 |
6 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/lua/lapi.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef lapi_h
4 | #define lapi_h
5 |
6 |
7 | #include "llimits.h"
8 | #include "lstate.h"
9 |
10 | #define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \
11 | "stack overflow");}
12 |
13 | #define adjustresults(L,nres) \
14 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
15 |
16 | #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \
17 | "not enough elements in the stack")
18 |
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/src/lua/lprefix.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef lprefix_h
4 | #define lprefix_h
5 |
6 |
7 | /*
8 | ** Allows POSIX/XSI stuff
9 | */
10 | #if !defined(LUA_USE_C89) /* { */
11 |
12 | #if !defined(_XOPEN_SOURCE)
13 | #define _XOPEN_SOURCE 600
14 | #elif _XOPEN_SOURCE == 0
15 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */
16 | #endif
17 |
18 | /*
19 | ** Allows manipulation of large files in gcc and some other compilers
20 | */
21 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS)
22 | #define _LARGEFILE_SOURCE 1
23 | #define _FILE_OFFSET_BITS 64
24 | #endif
25 |
26 | #endif /* } */
27 |
28 |
29 | /*
30 | ** Windows stuff
31 | */
32 | #if defined(_WIN32) /* { */
33 |
34 | #if !defined(_CRT_SECURE_NO_WARNINGS)
35 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */
36 | #endif
37 |
38 | #endif /* } */
39 |
40 | #endif
41 |
42 |
--------------------------------------------------------------------------------
/src/lua/lua.cmake:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: GPL-3.0-only
2 |
3 | # We need C99 to build Lua
4 | set(CMAKE_C_STANDARD 99)
5 |
6 | # C compiler flags
7 | set(CMAKE_C_FLAGS "-Wall -Wextra")
8 |
9 | # Set Lua source files
10 | add_library(lua STATIC
11 | src/lua/lapi.c
12 | src/lua/lauxlib.c
13 | src/lua/lbaselib.c
14 | src/lua/lbitlib.c
15 | src/lua/lcode.c
16 | src/lua/lcorolib.c
17 | src/lua/lctype.c
18 | src/lua/ldblib.c
19 | src/lua/ldebug.c
20 | src/lua/ldo.c
21 | src/lua/ldump.c
22 | src/lua/lfunc.c
23 | src/lua/lgc.c
24 | src/lua/linit.c
25 | src/lua/liolib.c
26 | src/lua/llex.c
27 | src/lua/lmathlib.c
28 | src/lua/lmem.c
29 | src/lua/loadlib.c
30 | src/lua/lobject.c
31 | src/lua/lopcodes.c
32 | src/lua/loslib.c
33 | src/lua/lparser.c
34 | src/lua/lstate.c
35 | src/lua/lstring.c
36 | src/lua/lstrlib.c
37 | src/lua/ltable.c
38 | src/lua/ltablib.c
39 | src/lua/ltm.c
40 | src/lua/luac.c
41 | src/lua/lundump.c
42 | src/lua/lutf8lib.c
43 | src/lua/lvm.c
44 | src/lua/lzio.c
45 | )
46 |
--------------------------------------------------------------------------------
/src/lua/lua.hpp:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | // lua.hpp
4 | // Lua header files for C++
5 | // <> not supplied automatically because Lua also compiles as C++
6 |
7 | extern "C" {
8 | #include "lua.h"
9 | #include "lualib.h"
10 | #include "lauxlib.h"
11 | }
12 |
--------------------------------------------------------------------------------
/src/lua/lundump.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0-only
2 |
3 | #ifndef lundump_h
4 | #define lundump_h
5 |
6 | #include "llimits.h"
7 | #include "lobject.h"
8 | #include "lzio.h"
9 |
10 |
11 | /* data to catch conversion errors */
12 | #define LUAC_DATA "\x19\x93\r\n\x1a\n"
13 |
14 | #define LUAC_INT 0x5678
15 | #define LUAC_NUM cast_num(370.5)
16 |
17 | #define MYINT(s) (s[0]-'0')
18 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR))
19 | #define LUAC_FORMAT 0 /* this is the official format */
20 |
21 | /* load one chunk; from lundump.c */
22 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
23 |
24 | /* dump one chunk; from ldump.c */
25 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
26 | void* data, int strip);
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/map_downloader/map_downloader.cmake:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: GPL-3.0-only
2 |
3 | add_library(map_downloader STATIC
4 | src/map_downloader/map_downloader.cpp
5 | )
6 |
7 | add_dependencies(map_downloader local_curl)
8 |
9 | # Target this
10 | target_include_directories(map_downloader PRIVATE ${LOCAL_CURL_INCLUDE_DIR})
11 |
12 | add_executable(hac_map_downloader_test
13 | src/map_downloader/test/test.cpp
14 | )
15 |
16 | add_dependencies(hac_map_downloader_test map_downloader)
17 | target_link_libraries(hac_map_downloader_test map_downloader local_curl ws2_32 bcrypt)
18 | set_target_properties(hac_map_downloader_test PROPERTIES LINK_FLAGS "-m32 -static-libgcc -static-libstdc++ -static -lwinpthread")
19 |
--------------------------------------------------------------------------------
/src/monolith/monolith.cmake:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: GPL-3.0-only
2 |
3 | # Define the source files
4 | add_library(monolith MODULE
5 | src/monolith/monolith.c
6 | src/monolith/strings/strings.rc
7 | )
8 |
9 | target_include_directories(monolith
10 | PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
11 | )
12 |
13 | set_property(SOURCE src/monolith/strings/strings.rc
14 | APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/version.hpp")
15 |
16 | # Set the name
17 | set_target_properties(monolith PROPERTIES PREFIX "")
18 | set_target_properties(monolith PROPERTIES OUTPUT_NAME "strings")
19 |
20 | # lol
21 | add_dependencies(monolith chimera)
22 | set_target_properties(monolith PROPERTIES LINK_FLAGS "-m32 -static-libgcc -static-libstdc++ -static -lwinpthread")
23 | target_link_libraries(monolith chimera ${WINXP_COMPATIBILITY_LIBRARIES} shlwapi version map_downloader local_curl ws2_32 local_zstd)
24 |
--------------------------------------------------------------------------------
/src/monolith/strings/guidelines.rc:
--------------------------------------------------------------------------------
1 | /*
2 | Halo PC Strings.dll resource data
3 | Version 1.0.10.621
4 | */
5 |
6 | LANGUAGE 7, 1
7 |
8 | GUIDELINES DESIGNINFO
9 | BEGIN
10 | 0x1L , 0x5ffffL , 0x66ffffL , 0x407L , 0x18L , 0xcL , 0x47L , 0x165L ,
11 | 0x0L
12 | END
13 |
--------------------------------------------------------------------------------
/src/monolith/strings/halo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/src/monolith/strings/halo.ico
--------------------------------------------------------------------------------
/src/monolith/strings/icon.rc:
--------------------------------------------------------------------------------
1 | /*
2 | Halo PC Strings.dll resource data
3 | Version 1.0.10.621
4 | */
5 |
6 | LANGUAGE 9, 1
7 |
8 | 105 ICON "halo.ico"
9 |
--------------------------------------------------------------------------------
/src/monolith/strings/splash.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SnowyMouse/chimera/17a63e8f51a9e351dd66c06a15a867d0ec46d268/src/monolith/strings/splash.bmp
--------------------------------------------------------------------------------
/src/monolith/strings/splash.rc:
--------------------------------------------------------------------------------
1 | /*
2 | Halo PC Strings.dll resource data
3 | Version 1.0.10.621
4 | */
5 |
6 | LANGUAGE 9, 1
7 |
8 | 134 BITMAP "splash.bmp"
9 |
--------------------------------------------------------------------------------
/src/monolith/strings/strings.rc:
--------------------------------------------------------------------------------
1 | /*
2 | Halo PC Strings.dll resource data
3 | Version 1.0.10.621
4 | */
5 |
6 | #include "guidelines.rc"
7 | #include "splash.rc"
8 | #include "dialog.rc"
9 | #include "stringtable.rc"
10 | #include "icon.rc"
11 |
12 | // Use Chimera Version information
13 | #include "../../chimera/version.rc"
14 | // #include "version.rc"
15 |
16 | #include "unknown.rc"
17 |
--------------------------------------------------------------------------------
/src/monolith/strings/unknown.rc:
--------------------------------------------------------------------------------
1 | /*
2 | Halo PC Strings.dll resource data
3 | Version 1.0.10.621
4 | */
5 |
6 | // TODO: Figure out what this is used for, if at all.
7 | LANGUAGE 4, 1
8 |
9 | 1 255
10 | BEGIN
11 | L"\x0404\000"
12 | END
13 | LANGUAGE 7, 1
14 |
15 | 1 255
16 | BEGIN
17 | L"\x0407\000"
18 | END
19 | LANGUAGE 9, 1
20 |
21 | 1 255
22 | BEGIN
23 | L"\x0409\000"
24 | END
25 | LANGUAGE 10, 1
26 |
27 | 1 255
28 | BEGIN
29 | L"\x040a\000"
30 | END
31 | LANGUAGE 12, 1
32 |
33 | 1 255
34 | BEGIN
35 | L"\x040c\000"
36 | END
37 | LANGUAGE 16, 1
38 |
39 | 1 255
40 | BEGIN
41 | L"\x0410\000"
42 | END
43 | LANGUAGE 17, 1
44 |
45 | 1 255
46 | BEGIN
47 | L"\x0411\000"
48 | END
49 | LANGUAGE 18, 1
50 |
51 | 1 255
52 | BEGIN
53 | L"\x0412\000"
54 | END
55 |
--------------------------------------------------------------------------------
/src/monolith/strings/version.rc:
--------------------------------------------------------------------------------
1 | /*
2 | Halo PC Strings.dll resource data
3 | Version 1.0.10.621
4 | */
5 |
6 | LANGUAGE 9, 1
7 |
8 | 1 VERSIONINFO
9 | FILEVERSION 1, 0, 6, 612
10 | PRODUCTVERSION 1, 0, 6, 612
11 | FILEFLAGSMASK 0x17
12 | FILEOS 0x4
13 | FILETYPE 0x2
14 | BEGIN
15 | BLOCK "StringFileInfo"
16 | BEGIN
17 | BLOCK "040904b0"
18 | BEGIN
19 | VALUE "CompanyName", "Microsoft Corporation"
20 | VALUE "FileDescription", "Halo Strings"
21 | VALUE "FileVersion", "1, 0, 6, 612"
22 | VALUE "InternalName", "Halo Strings"
23 | VALUE "LegalCopyright", "Copyright (C) 2004"
24 | VALUE "OriginalFilename", "Strings.dll"
25 | VALUE "ProductName", "Halo Strings"
26 | VALUE "ProductVersion", "1, 0, 6, 612"
27 | END
28 | END
29 | BLOCK "VarFileInfo"
30 | BEGIN
31 | VALUE "Translation", 0x409, 1200
32 | END
33 | END
34 |
--------------------------------------------------------------------------------