J2Kbr / GtunerIV

Gtuner IV - Titan Two's software bug report.
http://www.consoletuner.com
25 stars 4 forks source link

Feature Request: Input Translator GPC2 parsing function into variable #350

Closed Scachi closed 4 years ago

Scachi commented 4 years ago

I modified my pubg script to support directly connected mouse & keyboard with different mappings for different in-game action (like hip aiming, ads, softaim (ots), inventory) like you can do with a xim.

I tried to do it in a way that allows me to add a single header file to do the mapping changes via using byte copy feature (alt+click) of the different mappings in the Input Translator: keyboard mapping, mouse mapping, mouse xy converter

The only bad thing about this approach is that it is a bit complex to modify if the user wants to change a mapping. He needs to:

  1. open the matching input translator file
  2. do the changes
  3. alt-click copy bytecode
  4. paste into the correct position in the header file keeping my specific name of the variable.

To make this as userfriendly as possible it would be cool to have a function that is able to read specific functions from a .git file into a variable. This way the user can adjust the input translator files easily WITHOUT having to mess with the code at all, using the existing Input translator gui to do their changes:

  1. open the git file he want to change.
  2. does his changes, press save
  3. reinstall (compile & install) the script

This requires us to be able to include .git files into a script upload (as the files are required to be able to compile then). Pseudo code example (in the style of pmem read) to read parts of a git file, will require some keyword to know which data to get for keymap, mousemap, mousexy(default), mousexy(alternate)

uint8 kmap_inventory;
git_read(&kmap_inventory, GIT_KMAP,  "z_inventory.git") // keyboard mapping
uint8 mmap_ads;
git_read(&mmap_ads , GIT_MMAP, "z_ads.git") // mouse mapping

The full script with all the git files (the mapping stuff is done in the file directKM.gph): PUBG_multiple_mappings.zip

J2Kbr commented 4 years ago

Feature implemented on Gtuner IV 1.08 (to be released soon).

The GIT file is added to the source code with preprocessor directive #import "<filename>", example:

#import "#03-temp.git"

init {
    remapper(_03_temp_cmap);
    keymapping(_03_temp_kmap);
    mousemapping(_03_temp_mmap);
    mxyconverter(_03_temp_mxyc);
}

The input translator sections are declared according the filename with related sufix: _cmap, _kmap, _mmap and _mxyc. If the filename contains non-alphanumeric characters, those are replaced with '_'.

All GIT files referred by #import directive are included for publishing along the GPC script.

Scachi commented 4 years ago

This is so cool. Thank you very much !