twitch_plays 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/twitch_plays/os/win.rb +21 -13
- data/lib/twitch_plays/os.rb +2 -2
- data/lib/twitch_plays/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a72f64b05fbae46266299815ff2e34d699498cf2
|
4
|
+
data.tar.gz: 7985cd2648c0f6fa7dae75afd588159b9229ec42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7ffc367b16600ffbd85787c81a8eca02ed8e210ff53f6a3de8a629045dc4ee7487e6dd5f881646c360e032d69770b82eb6a94dcf9b6a88059f1add7fd626793
|
7
|
+
data.tar.gz: a9b9402a998c642a73457600f4e534237c6c7385199e18bf410a64cff7557926c5ea437faaed6a94177e89b8b8ef678ce6f12c8e472683c4c5cf1f9de41d5367
|
data/lib/twitch_plays/os/win.rb
CHANGED
@@ -6,6 +6,14 @@ module TwitchPlays
|
|
6
6
|
module User32
|
7
7
|
extend FFI::Library
|
8
8
|
|
9
|
+
if FFI::Platform::ADDRESS_SIZE == 64
|
10
|
+
LONG_PTR = :int64
|
11
|
+
ULONG_PTR = :uint64
|
12
|
+
else
|
13
|
+
LONG_PTR = :long
|
14
|
+
ULONG_PTR = :ulong
|
15
|
+
end
|
16
|
+
|
9
17
|
INPUT_MOUSE = 0x00
|
10
18
|
INPUT_KEYBOARD = 0x01
|
11
19
|
|
@@ -39,18 +47,18 @@ module TwitchPlays
|
|
39
47
|
class MouseInput < FFI::Struct
|
40
48
|
layout(:dx, :long,
|
41
49
|
:dy, :long,
|
42
|
-
:mouse_data, :
|
43
|
-
:flags, :
|
44
|
-
:time, :
|
45
|
-
:extra_info,
|
50
|
+
:mouse_data, :ulong,
|
51
|
+
:flags, :ulong,
|
52
|
+
:time, :ulong,
|
53
|
+
:extra_info, ULONG_PTR)
|
46
54
|
end
|
47
55
|
|
48
56
|
class KeyboardInput < FFI::Struct
|
49
57
|
layout(:vk, :ushort,
|
50
58
|
:scan, :ushort,
|
51
|
-
:flags, :
|
52
|
-
:time, :
|
53
|
-
:extra_info,
|
59
|
+
:flags, :ulong,
|
60
|
+
:time, :ulong,
|
61
|
+
:extra_info, ULONG_PTR)
|
54
62
|
end
|
55
63
|
|
56
64
|
class InputEvent < FFI::Union
|
@@ -59,14 +67,14 @@ module TwitchPlays
|
|
59
67
|
end
|
60
68
|
|
61
69
|
class Input < FFI::Struct
|
62
|
-
layout(:type, :
|
70
|
+
layout(:type, :ulong,
|
63
71
|
:evt, InputEvent)
|
64
72
|
end
|
65
73
|
|
66
74
|
ffi_lib 'user32'
|
67
75
|
ffi_convention :stdcall
|
68
76
|
|
69
|
-
attach_function :SendInput, [:uint,
|
77
|
+
attach_function :SendInput, [:uint, Input.ptr, :int], :uint
|
70
78
|
end
|
71
79
|
|
72
80
|
TRANSLATE_KEYS = {
|
@@ -105,7 +113,7 @@ module TwitchPlays
|
|
105
113
|
evt[:flags] = 0
|
106
114
|
evt[:time] = 0
|
107
115
|
evt[:extra_info] = 0
|
108
|
-
User32.SendInput(1,
|
116
|
+
User32.SendInput(1, input, User32::Input.size)
|
109
117
|
end
|
110
118
|
|
111
119
|
def self.touch_move(dx, dy)
|
@@ -118,7 +126,7 @@ module TwitchPlays
|
|
118
126
|
evt[:flags] = User32::MOUSEEVENTF_MOVE
|
119
127
|
evt[:time] = 0
|
120
128
|
evt[:extra_info] = 0
|
121
|
-
User32.SendInput(1,
|
129
|
+
User32.SendInput(1, input, User32::Input.size)
|
122
130
|
end
|
123
131
|
|
124
132
|
def self.touch_press
|
@@ -131,7 +139,7 @@ module TwitchPlays
|
|
131
139
|
evt[:flags] = User32::MOUSEEVENTF_LEFTDOWN
|
132
140
|
evt[:time] = 0
|
133
141
|
evt[:extra_info] = 0
|
134
|
-
User32.SendInput(1,
|
142
|
+
User32.SendInput(1, input, User32::Input.size)
|
135
143
|
end
|
136
144
|
|
137
145
|
def self.touch_release
|
@@ -144,7 +152,7 @@ module TwitchPlays
|
|
144
152
|
evt[:flags] = User32::MOUSEEVENTF_LEFTUP
|
145
153
|
evt[:time] = 0
|
146
154
|
evt[:extra_info] = 0
|
147
|
-
User32.SendInput(1,
|
155
|
+
User32.SendInput(1, input, User32::Input.size)
|
148
156
|
end
|
149
157
|
end
|
150
158
|
end
|
data/lib/twitch_plays/os.rb
CHANGED
data/lib/twitch_plays/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitch_plays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Steward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cinch
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.4.2
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Yet another Twitch Plays Pokemon clone.
|