Skip to content

Commit

Permalink
Check that the environment is Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Aug 1, 2024
1 parent 9106d15 commit 6b66a87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 11 additions & 7 deletions src/core/jstick.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,19 @@ void js_guid_create(_js_device *jdev) {
(*(word + 5)) = jdev->usb.product_id - 300;
(*(word + 6)) = jdev->usb.version;
(*(word + 7)) = jdev->usb.version - 400;

BYTE *byte = (BYTE *)&word[2];
int idx = 0;
for (const char *s = jdev->uniq; *s; ++s) {
byte[idx++] ^= *s;
if (idx > 11) {
idx = 0;
#if defined (_linux__)
if (ustrlen(jdev->uniq)) {
BYTE *byte = (BYTE *)&word[2];
int idx = 0;

for (const char *s = jdev->uniq; *s; ++s) {
byte[idx++] ^= *s;
if (idx > 11) {
idx = 0;
}
}
}
#endif
} else {
word += 2;
memcpy((char *)word, (char *)jdev->desc, sizeof(jdev->guid.data) - 4);
Expand Down
4 changes: 3 additions & 1 deletion src/core/jstick.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ typedef struct _js_device {
int size;
} report;
#endif
#endif
#if defined (__linux__)
uTCHAR uniq[64];
#endif
// comuni
enum _js_gamepad_type type;
uTCHAR desc[128];
uTCHAR uniq[64];
_js_info info;
_js_data data;
_input_guid guid;
Expand Down

0 comments on commit 6b66a87

Please sign in to comment.