Changeset 1163 for Daodan/src/Oni


Ignore:
Timestamp:
Oct 24, 2021, 4:50:48 AM (3 years ago)
Author:
rossy
Message:

Daodan: Add new local input system based on Raw Input

Location:
Daodan/src/Oni
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/Oni/GameState.h

    r1161 r1163  
    13531353  int field_FC;
    13541354  int field_100;
    1355   char field_104;
     1355  char SlowMotion;
    13561356  char gap_105[3];
    1357   int SlowMotion;
     1357  int SlowMotionTimer;
    13581358  char gap_10c[4];
    13591359  int field_110;
     
    13621362  char field_138;
    13631363  char gap_139[7];
    1364   int field_140;
     1364  int LastSixtieths;
    13651365  int GameTime;
    1366   int field_148;
     1366  int TargetGameTime;
    13671367  int field_14C;
    13681368  OniLevel* Level;
  • Daodan/src/Oni/Oni.h

    r1017 r1163  
    99#define ONICALL __fastcall
    1010
     11typedef struct {
     12        short x;
     13        short y;
     14} IMtPoint;
    1115
     16// The following headers were written when Daodan used -fpack-struct, and
     17// should be rewritten
     18#pragma pack(push, 1)
    1219#include "stdtypes.h"
    1320#include "BFW_Motoko_Draw.h"
     
    1724#include "GL.h"
    1825#include "OBJt.h"
     26#pragma pack(pop)
     27
     28#include "Input.h"
    1929
    2030#define DDmAssert(expr) assert(expr);
     
    3444} UUtRect;
    3545
    36 typedef struct {
    37         uint32_t input;
    38         float analog;
    39 } LItDeviceInput;
    40 
    4146#include "Symbols_Var.h"
    4247#include "Symbols_Func.h"
  • Daodan/src/Oni/Symbols_Func.h

    r1017 r1163  
    5757
    5858DefFunc(void, ONrGameState_Timer_Start, ONICALL, (char* function, int time), 0x004FD370);
    59 DefFunc(void, ONrGameState_HandleUtilityInput, ONICALL, (const void* inInput), 0x004f6200);
     59DefFunc(void, ONrGameState_HandleUtilityInput, ONICALL, (GameInput *input), 0x004f6200);
    6060DefFunc(uint8_t, ONrDebugKey_WentDown, ONICALL, (uint32_t inKey), 0x005050d0);
    6161
     
    177177DefFunc(void, LIrActionBuffer_Add, ONICALL, (void* unknown, LItDeviceInput* input), 0x00403b30);
    178178
     179// Called during the game loop to run the Windows message loop
     180DefFunc(UUtBool, LIiPlatform_InputEvent_GetEvent, ONICALL, (void), 0x004036d0);
     181
     182// Called by the game loop to get the latest input frames
     183DefFunc(void, LIrActionBuffer_Get, ONICALL, (short* count, LItActionBuffer **buffers), 0x00403be0);
     184
     185// Gets the mouse position
     186DefFunc(void, LIrPlatform_InputEvent_GetMouse, ONICALL, (int active, LItInputEvent *info), 0x00402ca0);
     187
     188// Checks if a keyboard key is pressed
     189DefFunc(UUtBool, LIrPlatform_TestKey, ONICALL, (int key, int active), 0x00403930);
     190
     191// Translates a key name (from key_config.txt) to a key code
     192DefFunc(int, LIrTranslate_InputName, ONICALL, (char *name), 0x00403a90);
     193
     194// Updates TargetGameTime in the game state
     195DefFunc(void, ONrGameState_UpdateServerTime, ONICALL, (GameState *game_state), 0x004fbeb0);
     196
     197// Basically stricmp, but it only ever does ASCII case folding
     198DefFunc(int, UUrString_Compare_NoCase, ONICALL, (const char *str1, const char *str2), 0x004266d0);
     199
     200// A safe strcpy which lets you specify the size of the target buffer and always
     201// NUL-terminates. Kind of like strlcpy. Just don't call it with dest_size = 0.
     202DefFunc(void, UUrString_Copy, ONICALL, (char *dest, const char *src, size_t dest_size), 0x004265f0);
    179203
    180204#undef DefFunc
  • Daodan/src/Oni/Symbols_Var.h

    r994 r1163  
    8484//#define OBJgFlag_DrawNameDistance     (*((void*)0x005ec634))
    8585
     86// Oni's platform input system stores the window HWND in this global
     87#define LIgPlatform_HWND (*((HWND *)0x0055cae8))
     88
     89// Is Oni's input system active? True in gameplay and false in menus.
     90// LIrPlatform_Mode_Set gets called when this changes.
     91#define LIgMode_Internal (*((UUtBool *)0x0055fd40))
     92
     93// List of bindings from Oni's internal key codes to LItActionDescriptions
     94#define LIgBindingArray ((LItBinding *)0x0055fa20)
     95
     96// Is "Invert Mouse" checked in the Options menu? If so, platform specific input
     97// code should invert the cursor's Y offset when building LItActionBuffers.
     98#define LIgMode_InvertMouse (*((UUtBool *)0x0052ecf4))
     99
     100// This is a map from DirectInput scan codes to Oni's internal key codes, the
     101// latter of which mostly match ASCII for a US keyboard layout. DirectInput scan
     102// codes are mostly the same as the PS2 make codes that Windows uses in other
     103// APIs except that extended keys are represented by bit 0x80 being set.
     104#define LIgPlatform_ScanCodeToChar ((uint8_t *)0x005292b8)
     105
     106// Script variable to enable/disable centering the cursor in the window when
     107// processing input. On by default.
     108#define LIgCenterCursor (*((int *)0x0052d88d))
     109
     110// List of bindable input actions
     111#define LIgActionDescriptions ((LItActionDescription*)0x0052db18)
     112
    86113#endif
Note: See TracChangeset for help on using the changeset viewer.