From b7f138f68eb69afe2af5623656250b24e18fe622 Mon Sep 17 00:00:00 2001 From: theTwister Date: Thu, 14 Sep 2023 23:02:40 +0100 Subject: [PATCH] Added `xor_buffers` --- .../interface/debug_menu/debug_menu_main.cpp | 18 ++++++++++++++++++ .../interface/debug_menu/debug_menu_main.hpp | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/game/source/interface/debug_menu/debug_menu_main.cpp b/game/source/interface/debug_menu/debug_menu_main.cpp index 5ab7ef121..f3b8ecfde 100644 --- a/game/source/interface/debug_menu/debug_menu_main.cpp +++ b/game/source/interface/debug_menu/debug_menu_main.cpp @@ -2,6 +2,7 @@ #include "cache/restricted_memory_regions.hpp" #include "cseries/cseries.hpp" +#include "input/controllers.hpp" #include "input/input.hpp" #include "interface/debug_menu/debug_menu.hpp" #include "interface/debug_menu/debug_menu_scroll.hpp" @@ -10,6 +11,7 @@ #include "math/color_math.hpp" #include "memory/module.hpp" #include "rasterizer/rasterizer.hpp" +#include "shell/shell.hpp" #include "text/draw_string.hpp" void patch_debug_menu() @@ -115,6 +117,16 @@ void debug_menu_dispose_from_old_map() void debug_menu_update() { + // debug_menu_update_current_gamepad_state + csmemset(&g_debug_menu_globals.current_gamepad_state, 0, sizeof(g_debug_menu_globals.current_gamepad_state)); + for (long controller_index = first_controller(); controller_index != k_no_controller; controller_index = next_controller(controller_index)) + { + //if (player_index_from_controller_index(controller_index) != k_no_controller) + //{ + // if (gamepad_state const* state = input_get_gamepad_state(controller_index)) + // xor_buffers(&g_debug_menu_globals.current_gamepad_state, state, sizeof(gamepad_state)); + //} + } } void debug_menu_open() @@ -259,3 +271,9 @@ void* debug_menu_malloc(long size) return result; } +void xor_buffers(void* destination, void const* source, long buffer_size) +{ + for (long i = 0; i < buffer_size; i++) + ((byte*)destination)[i] ^= ((byte const*)source)[i]; +} + diff --git a/game/source/interface/debug_menu/debug_menu_main.hpp b/game/source/interface/debug_menu/debug_menu_main.hpp index 2983550f3..363da6c1a 100644 --- a/game/source/interface/debug_menu/debug_menu_main.hpp +++ b/game/source/interface/debug_menu/debug_menu_main.hpp @@ -43,5 +43,5 @@ extern float debug_menu_get_title_height(); extern float debug_menu_get_item_indent_x(); extern float debug_menu_get_item_indent_y(); extern void* debug_menu_malloc(long size); -extern void debug_menu_parse(c_debug_menu* root_menu, char const* file_name); +extern void xor_buffers(void* destination, void const* source, long buffer_size);