Skip to content

Commit

Permalink
Added xor_buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
theTwister authored and theTwister committed Sep 14, 2023
1 parent 813aa4f commit b7f138f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions game/source/interface/debug_menu/debug_menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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];
}

2 changes: 1 addition & 1 deletion game/source/interface/debug_menu/debug_menu_main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit b7f138f

Please sign in to comment.