Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…wisted into release/1.1
  • Loading branch information
AlexKhayrullin committed Mar 12, 2022
2 parents d93ddc0 + 68a11e4 commit 8c11a58
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 9 deletions.
Binary file not shown.
Binary file not shown.
53 changes: 44 additions & 9 deletions SonicTimeTwisted.gmx/SonicTimeTwisted.project.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Config>Configs\PlayStation</Config>
<Config>Configs\Browser</Config>
</Configs>
<datafiles number="110" name="datafiles">
<datafiles number="111" name="datafiles">
<datafile>
<name>translations.txt</name>
<exists>-1</exists>
Expand Down Expand Up @@ -45,7 +45,7 @@
</ConfigOptions>
<filename>translations.txt</filename>
</datafile>
<datafiles number="110" name="translations">
<datafiles number="111" name="translations">
<datafile>
<name>English.json</name>
<exists>-1</exists>
Expand Down Expand Up @@ -81,7 +81,7 @@
</ConfigOptions>
<filename>English.json</filename>
</datafile>
<datafiles number="110" name="Russian">
<datafiles number="111" name="Russian">
<datafile>
<name>sprFontHud.png</name>
<exists>-1</exists>
Expand Down Expand Up @@ -433,7 +433,7 @@
</ConfigOptions>
<filename>Russian.json</filename>
</datafile>
<datafiles number="110" name="BrazilianPortuguese">
<datafiles number="111" name="BrazilianPortuguese">
<datafile>
<name>sprFontHud.png</name>
<exists>-1</exists>
Expand Down Expand Up @@ -785,7 +785,7 @@
</ConfigOptions>
<filename>BrazilianPortuguese.json</filename>
</datafile>
<datafiles number="110" name="French">
<datafiles number="111" name="French">
<datafile>
<name>sprFontHud.png</name>
<exists>-1</exists>
Expand Down Expand Up @@ -1137,7 +1137,7 @@
</ConfigOptions>
<filename>French.json</filename>
</datafile>
<datafiles number="110" name="Ukrainian">
<datafiles number="111" name="Ukrainian">
<datafile>
<name>sprFontHud.png</name>
<exists>-1</exists>
Expand Down Expand Up @@ -1489,7 +1489,7 @@
</ConfigOptions>
<filename>Ukrainian.json</filename>
</datafile>
<datafiles number="110" name="Italian">
<datafiles number="111" name="Italian">
<datafile>
<name>sprFontHud.png</name>
<exists>-1</exists>
Expand Down Expand Up @@ -1842,8 +1842,8 @@
<filename>Italian.json</filename>
</datafile>
</datafiles>
<datafiles number="110" name="android">
<datafiles number="110" name="gamepad">
<datafiles number="111" name="android">
<datafiles number="111" name="gamepad">
<datafile>
<name>045e_02fd_xbox_wireless_controller.csv</name>
<exists>-1</exists>
Expand Down Expand Up @@ -1951,6 +1951,41 @@
</ConfigOptions>
<filename>gamecontrollerdb.txt</filename>
</datafile>
<datafile>
<name>libnikxfix.so</name>
<exists>-1</exists>
<size>10144</size>
<exportAction>2</exportAction>
<exportDir></exportDir>
<overwrite>0</overwrite>
<freeData>-1</freeData>
<removeEnd>0</removeEnd>
<store>0</store>
<ConfigOptions>
<Config name="Default">
<CopyToMask>134217856</CopyToMask>
</Config>
<Config name="AndroidSmartphone">
<CopyToMask>134217856</CopyToMask>
</Config>
<Config name="AndroidConsole">
<CopyToMask>134217856</CopyToMask>
</Config>
<Config name="MacOS">
<CopyToMask>134217856</CopyToMask>
</Config>
<Config name="Linux">
<CopyToMask>134217856</CopyToMask>
</Config>
<Config name="PlayStation">
<CopyToMask>134217856</CopyToMask>
</Config>
<Config name="Browser">
<CopyToMask>134217856</CopyToMask>
</Config>
</ConfigOptions>
<filename>libnikxfix.so</filename>
</datafile>
</datafiles>
<NewExtensions>
<extension index="0">extensions\SttAndroid</extension>
Expand Down
Binary file added SonicTimeTwisted.gmx/datafiles/libnikxfix.so
Binary file not shown.
13 changes: 13 additions & 0 deletions extras/linux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# libnikXfix

This is a small library that fixes YoYo Games's bug where any non-latin keyboard layout wouldn't work.

Compilation steps and all are explained in the `nikxfix.c` file.

All you need is Ubuntu 14.04 and gcc-multilib.

The only dependency is GNU's libC.

To-be-loaded via `LD_LIBRARY_PATH` and then `LD_PRELOAD`.

Have fun.
54 changes: 54 additions & 0 deletions extras/linux/nikxfix.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
libnikXfix by nkrapivindev, Sonic Time Twisted edition.
Install gcc-multilib
Compile me as:
gcc -m32 -fPIC -ldl -shared nikxfix.c -o libnikxfix.so
Then update the lib in included files [root]/SonicTimeTwisted.gmx/datafiles/
Enjoy!
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <dlfcn.h>

typedef int (*XLookupString_type)(XKeyEvent*, char*, int, KeySym*, XComposeStatus*);
static XLookupString_type XLookupString_orig = NULL;

#define NPRINT(...) do { printf("[nikXfix]: "); printf(__VA_ARGS__); printf("\n"); fflush(stdout); } while (0)

int XLookupString(
XKeyEvent* event_struct,
char* buffer_return,
int bytes_buffer,
KeySym* keysym_return,
XComposeStatus* status_in_out
) {
int rc; /* return code */

if (!XLookupString_orig) {
NPRINT("Trying to resolve XLookupString...");
XLookupString_orig = dlsym(RTLD_NEXT, "XLookupString");
if (!XLookupString_orig) {
NPRINT("Unable to resolve XLookupString!");
abort();
}
NPRINT("XLookupString is resolved to 0x%p", XLookupString_orig);
}

/* restricts the bitmask to 8bit range only, excluding all locale info, change if this breaks things! */
if (event_struct) event_struct->state &= 0xFFu;
rc = XLookupString_orig(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out);

/* big fun */
#ifdef DEBUG
NPRINT("rc=%d,keycode=0x%X,state=0x%X", rc, event_struct->keycode, event_struct->state);
#endif

return rc;
}


0 comments on commit 8c11a58

Please sign in to comment.