2024-06-21 05:19:37 +00:00
|
|
|
#include <mods/input/input.h>
|
|
|
|
#include <symbols/minecraft.h>
|
|
|
|
#include <libreborn/libreborn.h>
|
|
|
|
#include <SDL/SDL.h>
|
|
|
|
|
|
|
|
#include "input-internal.h"
|
|
|
|
|
|
|
|
// Translator
|
2024-09-21 01:30:47 +00:00
|
|
|
static int32_t sdl_key_to_minecraft_key_injection(Common_sdl_key_to_minecraft_key_t original, const int32_t sdl_key) {
|
2024-06-21 05:19:37 +00:00
|
|
|
switch (sdl_key) {
|
|
|
|
#define KEY(name, value) case SDLK_##name: return MC_KEY_##name;
|
|
|
|
#include <mods/input/key-list.h>
|
|
|
|
#undef KEY
|
|
|
|
default: {
|
|
|
|
// Call Original Method
|
|
|
|
return original(sdl_key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Init
|
|
|
|
void _init_keys() {
|
|
|
|
overwrite_calls(Common_sdl_key_to_minecraft_key, sdl_key_to_minecraft_key_injection);
|
|
|
|
}
|