Skip to content

Commit 7ee706d

Browse files
committed
windows fixes, again
1 parent 0fae710 commit 7ee706d

5 files changed

Lines changed: 19 additions & 11 deletions

File tree

app/readme.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

input.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import vgamepad as vg
2+
import sys
23

34
xbox_buttons = {
45
"a": vg.XUSB_BUTTON.XUSB_GAMEPAD_A,
@@ -114,5 +115,8 @@ def input(self,input,value):
114115
elif input == joystick_index[0]:
115116
self.gamepad.left_joystick_float(value[0], value[1])
116117
elif input == joystick_index[1]:
117-
self.gamepad.right_joystick_float(value[0], value[1])
118+
if sys.platform == "win32":
119+
self.gamepad.right_joystick_float(value[0], value[1])
120+
else:
121+
self.gamepad.right_joystick_float(value[0], -value[1])
118122
self.gamepad.update()

main.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
import argparse
66
import qrcode
77
import os
8+
import sys
89
from aiohttp import web
910
from input import Gamepad
1011
from plyer import notification
1112

12-
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
13+
if hasattr(sys, '_MEIPASS'):
14+
BASE_DIR = sys._MEIPASS
15+
else:
16+
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
1317

1418
async def socket_handler(websocket):
1519
try:
@@ -53,7 +57,8 @@ async def socket_handler(websocket):
5357
)
5458

5559
async def http_handler(request):
56-
return web.FileResponse("./app/index.html")
60+
index_html = os.path.join(BASE_DIR, "app", "index.html")
61+
return web.FileResponse(index_html)
5762

5863
async def miniapi_handler(request):
5964
data = {"port": request.app["socketport"], "ip": request.app["host_ip"]}
@@ -87,10 +92,12 @@ async def main(ip, port, socketport):
8792
runner = web.AppRunner(app)
8893
await runner.setup()
8994
http_site = web.TCPSite(runner, ip, port)
95+
await http_site.start()
9096
print(f"App: http://{host_ip}:{port}")
97+
print("\nYou can connect your phone using the QR code below:\n")
9198
print_qr(f"http://{host_ip}:{port}")
9299

93-
await asyncio.gather(http_site.start(), asyncio.Future())
100+
await asyncio.Future()
94101

95102

96103
if __name__ == "__main__":

main.spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ a = Analysis(
55
['main.py'],
66
pathex=[],
77
binaries=[],
8-
datas=[('app', 'app'), ("lib/ViGEmClient.dll", "vgamepad/win/vigem/client/x64")],
9-
hiddenimports=[],
8+
datas=[('app', 'app'), ('icon.ico', '.'), ("lib/ViGEmClient.dll", "vgamepad/win/vigem/client/x64")],
9+
hiddenimports=['plyer.platforms.win.notification','plyer.platforms.linux.notification',],
1010
hookspath=[],
1111
hooksconfig={},
1212
runtime_hooks=[],
@@ -29,7 +29,7 @@ exe = EXE(
2929
upx=True,
3030
upx_exclude=[],
3131
runtime_tmpdir=None,
32-
console=False,
32+
console=True,
3333
disable_windowed_traceback=False,
3434
argv_emulation=False,
3535
target_arch=None,

webapp/src/components/joystick.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function JoystickC({
1414
if (!joystick) return;
1515

1616
const handleMove = (m: IJoystickUpdateEvent) => {
17-
sendData({ input: joystick, value: [m.x || 0, (m.y || 0) * -1] });
17+
sendData({ input: joystick, value: [m.x || 0, m.y || 0] });
1818
};
1919

2020
const handleStop = () => {

0 commit comments

Comments
 (0)