Skip to content

Commit

Permalink
Merge pull request #3 from pavasgdb/master
Browse files Browse the repository at this point in the history
Stage-3 Completion
  • Loading branch information
Sarangc1203 authored Jun 17, 2020
2 parents 6239c70 + c1975c2 commit dcf95e5
Show file tree
Hide file tree
Showing 82 changed files with 3,701 additions and 1,037 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
.pub-cache/
.pub/
/build/
/dist/
ios/Flutter/Flutter\ 2.framework/Flutter
ios/Flutter/Flutter\ 2.framework/Headers/*

Expand All @@ -43,3 +44,6 @@ app.*.map.json

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
dist/driver.exe
driver.spec
vXboxInterface.dll
6 changes: 6 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/aio_pc_controller/v15/.suo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.aio_pc_controller"
minSdkVersion 16
minSdkVersion 18
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
3 changes: 3 additions & 0 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />

</manifest>
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="aio_pc_controller"
android:label="KeyKonnekt"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down Expand Up @@ -44,4 +44,4 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />

</manifest>
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
Expand Down
Binary file added assets/launcher/android_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/launcher/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/launcher/foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/launcher/ios_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
166 changes: 166 additions & 0 deletions dinput.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
import ctypes

DIK_ESCAPE =0x01
DIK_1 =0x02
DIK_2 =0x03
DIK_3 =0x04
DIK_4 =0x05
DIK_5 =0x06
DIK_6 =0x07
DIK_7 =0x08
DIK_8 =0x09
DIK_9 =0x0A
DIK_0 =0x0B
DIK_MINUS =0x0C #/* - on main keyboard */
DIK_EQUALS =0x0D
DIK_BACK =0x0E #/* backspace */
DIK_TAB =0x0F
DIK_Q =0x10
DIK_W =0x11
DIK_E =0x12
DIK_R =0x13
DIK_T =0x14
DIK_Y =0x15
DIK_U =0x16
DIK_I =0x17
DIK_O =0x18
DIK_P =0x19
DIK_LBRACKET =0x1A
DIK_RBRACKET =0x1B
DIK_RETURN =0x1C #/* Enter on main keyboard */
DIK_LCONTROL =0x1D
DIK_A =0x1E
DIK_S =0x1F
DIK_D =0x20
DIK_F =0x21
DIK_G =0x22
DIK_H =0x23
DIK_J =0x24
DIK_K =0x25
DIK_L =0x26
DIK_SEMICOLON =0x27
DIK_APOSTROPHE =0x28
DIK_GRAVE =0x29 #/* accent grave */
DIK_LSHIFT =0x2A
DIK_BACKSLASH =0x2B
DIK_Z =0x2C
DIK_X =0x2D
DIK_C =0x2E
DIK_V =0x2F
DIK_B =0x30
DIK_N =0x31
DIK_M =0x32
DIK_COMMA =0x33
DIK_PERIOD =0x34 #/* . on main keyboard */
DIK_SLASH =0x35 #/* / on main keyboard */
DIK_RSHIFT =0x36
DIK_MULTIPLY =0x37 #/* * on numeric keypad */
DIK_LMENU =0x38 #/* left Alt */
DIK_SPACE =0x39
DIK_CAPITAL =0x3A
DIK_F1 =0x3B
DIK_F2 =0x3C
DIK_F3 =0x3D
DIK_F4 =0x3E
DIK_F5 =0x3F
DIK_F6 =0x40
DIK_F7 =0x41
DIK_F8 =0x42
DIK_F9 =0x43
DIK_F10 =0x44
DIK_NUMLOCK =0x45
DIK_SCROLL =0x46 #/* Scroll Lock */
DIK_NUMPAD7 =0x47
DIK_NUMPAD8 =0x48
DIK_NUMPAD9 =0x49
DIK_SUBTRACT =0x4A #/* - on numeric keypad */
DIK_NUMPAD4 =0x4B
DIK_NUMPAD5 =0x4C
DIK_NUMPAD6 =0x4D
DIK_ADD =0x4E #/* + on numeric keypad */
DIK_NUMPAD1 =0x4F
DIK_NUMPAD2 =0x50
DIK_NUMPAD3 =0x51
DIK_NUMPAD0 =0x52
DIK_DECIMAL =0x53 #/* . on numeric keypad */
DIK_F11 =0x57
DIK_F12 =0x58

# C struct redefinitions
PUL = ctypes.POINTER(ctypes.c_ulong)
class KeyBdInput(ctypes.Structure):
_fields_ = [("wVk", ctypes.c_ushort),
("wScan", ctypes.c_ushort),
("dwFlags", ctypes.c_ulong),
("time", ctypes.c_ulong),
("dwExtraInfo", PUL)]

class HardwareInput(ctypes.Structure):
_fields_ = [("uMsg", ctypes.c_ulong),
("wParamL", ctypes.c_short),
("wParamH", ctypes.c_ushort)]

class MouseInput(ctypes.Structure):
_fields_ = [("dx", ctypes.c_long),
("dy", ctypes.c_long),
("mouseData", ctypes.c_ulong),
("dwFlags", ctypes.c_ulong),
("time",ctypes.c_ulong),
("dwExtraInfo", PUL)]

class Input_I(ctypes.Union):
_fields_ = [("ki", KeyBdInput),
("mi", MouseInput),
("hi", HardwareInput)]

class Input(ctypes.Structure):
_fields_ = [("type", ctypes.c_ulong),
("ii", Input_I)]

# Actuals Functions

def PressKey(hexKeyCode):
extra = ctypes.c_ulong(0)
ii_ = Input_I()
ii_.ki = KeyBdInput( 0, hexKeyCode, 0x0008, 0, ctypes.pointer(extra) )
x = Input( ctypes.c_ulong(1), ii_ )
ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))

def ReleaseKey(hexKeyCode):
extra = ctypes.c_ulong(0)
ii_ = Input_I()
ii_.ki = KeyBdInput( 0, hexKeyCode, 0x0008 | 0x0002, 0, ctypes.pointer(extra) )
x = Input( ctypes.c_ulong(1), ii_ )
ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))

def handleInputs(type, inp):
if type == 1:
if inp == 'w':
PressKey(DIK_W)
elif inp == 'a':
PressKey(DIK_A)
elif inp == 's':
PressKey(DIK_S)
elif inp == 'd':
PressKey(DIK_D)
elif inp == 'shift':
PressKey(DIK_LSHIFT)
elif inp == 'space':
PressKey(DIK_SPACE)
else:
print("Not handled by dinput.py yet")
else:
if inp == 'w':
ReleaseKey(DIK_W)
elif inp == 'a':
ReleaseKey(DIK_A)
elif inp == 's':
ReleaseKey(DIK_S)
elif inp == 'd':
ReleaseKey(DIK_D)
elif inp == 'shift':
ReleaseKey(DIK_LSHIFT)
elif inp == 'space':
ReleaseKey(DIK_SPACE)
else:
print("Not handled by dinput.py yet")
Loading

0 comments on commit dcf95e5

Please sign in to comment.