vars: pull g_Layout

This commit is contained in:
Marcin Kurczewski 2024-09-06 17:11:30 +02:00
parent ba5979cc32
commit bdcce925b9
No known key found for this signature in database
GPG Key ID: CC65E6FD28CAE42A
7 changed files with 52 additions and 13 deletions

View File

@ -1652,9 +1652,9 @@ typedef enum {
IS_INVISIBLE = 3,
} ITEM_STATUS;
typedef struct __unaligned {
typedef struct __unaligned { // decompiled
uint16_t key[14];
} CONTROL_LAYOUT;
} INPUT_LAYOUT;
typedef enum {
IN_FORWARD = 0x00000001,
@ -4207,7 +4207,7 @@ typedef enum {
0x004664E8 - const char *g_ErrorMessages[43];
0x00466BB0 + int32_t g_RandControl;
0x00466BB4 + int32_t g_RandDraw;
0x00466F70 - CONTROL_LAYOUT g_Layout[2];
0x00466F70 + INPUT_LAYOUT g_Layout[2];
0x00467DD0 + const int32_t g_AtanBaseTable[8];
0x00467DF0 + const int16_t g_AtanAngleTable[0x800];
0x00468DF4 + const int16_t g_SinTable[0x402];
@ -4391,7 +4391,7 @@ typedef enum {
0x00519EE0 - HWR_TEXTURE_HANDLE g_HWR_PageHandles[32];
0x00519F60 - D3DTLVERTEX *g_HWR_VertexPtr;
0x0051A0CC - void *g_GameMemoryPtr;
0x0051A0D0 - BOOL g_ConflictLayout[14];
0x0051A0D0 + BOOL g_ConflictLayout[14];
0x0051A108 - uint8_t g_DIKeys[256];
0x0051A208 - int32_t g_Input;
0x0051A20C - int8_t g_IsVidModeLock;

View File

@ -5,6 +5,8 @@
#include "global/vars.h"
#include "specific/s_input.h"
bool g_ConflictLayout[14] = { false };
bool Input_Update(void)
{
bool result = S_Input_Update();

View File

@ -1,7 +1,13 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "global/types.h"
typedef struct {
uint16_t key[14];
} INPUT_LAYOUT;
extern INPUT_LAYOUT g_Layout[2];
extern bool g_ConflictLayout[14];
bool Input_Update(void);
int32_t __cdecl Input_GetDebounced(int32_t input);

View File

@ -1,3 +1,4 @@
#include "game/input.h"
#include "game/option/option.h"
#include "game/text.h"
#include "global/funcs.h"
@ -325,7 +326,7 @@ void __cdecl Option_Controls_ShowControls(void)
left_col = right_col - 200;
}
const CONTROL_LAYOUT *const layout = &g_Layout[g_LayoutPage];
const INPUT_LAYOUT *const layout = &g_Layout[g_LayoutPage];
g_ControlsTextA[0] =
Text_Create(left_col, -25, 16, g_KeyNames[layout->key[0]]);

View File

@ -1618,10 +1618,6 @@ typedef enum {
IS_INVISIBLE = 3,
} ITEM_STATUS;
typedef struct __unaligned {
uint16_t key[14];
} CONTROL_LAYOUT;
typedef enum {
IN_FORWARD = 0x00000001,
IN_BACK = 0x00000002,

View File

@ -96,7 +96,6 @@
#define g_DumpY (*(int16_t*)0x00466BE6)
#define g_DumpWidth (*(int16_t*)0x00466BE8)
#define g_DumpHeight (*(int16_t*)0x00466BEA)
#define g_Layout (*(CONTROL_LAYOUT(*)[2])0x00466F70)
#define g_KeyNames (*(const char *(*)[])0x00466FA8)
#define g_DetailLevel (*(int32_t*)0x0046773C)
#define g_MidSort (*(int32_t*)0x0046C300) // = 0
@ -345,7 +344,6 @@
#define g_ZWriteEnableState (*(bool*)0x00519F70)
#define g_HWR_TexturePageIndexes (*(int32_t(*)[32])0x00519F78)
#define g_GameMemoryPtr (*(void **)0x0051A0CC)
#define g_ConflictLayout (*(BOOL(*)[14])0x0051A0D0)
#define g_DIKeys (*(uint8_t(*)[256])0x0051A108)
#define g_Input (*(int32_t*)0x0051A208)
#define g_IsVidModeLock (*(int8_t*)0x0051A20C)

View File

@ -2,6 +2,7 @@
#include "decomp/decomp.h"
#include "game/console.h"
#include "game/input.h"
#include "game/inventory/backpack.h"
#include "game/lara/lara_control.h"
#include "global/const.h"
@ -14,6 +15,41 @@
#define KEY_DOWN(key) ((g_DIKeys[(key)] & 0x80))
INPUT_LAYOUT g_Layout[2] = {
{ .key = {
DIK_UP,
DIK_DOWN,
DIK_LEFT,
DIK_RIGHT,
DIK_DELETE,
DIK_NEXT,
DIK_RSHIFT,
DIK_RMENU,
DIK_RCONTROL,
DIK_SPACE,
DIK_SLASH,
DIK_NUMPAD0,
DIK_END,
DIK_ESCAPE,
} },
{ .key = {
DIK_NUMPAD8,
DIK_NUMPAD2,
DIK_NUMPAD4,
DIK_NUMPAD6,
DIK_NUMPAD7,
DIK_NUMPAD9,
DIK_NUMPAD1,
DIK_ADD,
DIK_NUMPADENTER,
DIK_NUMPAD3,
DIK_SUBTRACT,
DIK_NUMPAD0,
DIK_NUMPAD5,
DIK_DECIMAL,
} }
};
static bool m_IsF3Pressed = false;
static bool m_IsF4Pressed = false;
static bool m_IsF7Pressed = false;