barry-ran / QtScrcpy

Android real-time display control software
https://blog.csdn.net/rankun1/article/details/87970523
Apache License 2.0
20.35k stars 2.69k forks source link

Why does my JSON Keymapping return a ‘json error: keyMapNodes node format error’? #1035

Open Gambrinus69 opened 2 months ago

Gambrinus69 commented 2 months ago

I have tried writing and modifying it in various ways, but I can't find the problem. Could you please help me? It is for the Wild Rift game.

{
    "old-switchKey": "Key_QuoteLeft",
    "switchKey": "Key_Backspace",
    "mouseMoveMap": {
        "startPos": {
            "x": 0.5,
            "y": 0.5
        },
        "speedRatioX": 3.25,
        "speedRatioY": 1.25
    },
    "keyMapNodes": [{
            "comment": "Joystick",
            "type": "KMT_STEER_WHEEL",
            "centerPos": {
                "x": 0.177196,
                "y": 0.74938
            },
            "leftOffset": 0.15,
            "rightOffset": 0.15,
            "upOffset": 0.15,
            "downOffset": 0.15,
            "leftKey": "Key_A",
            "rightKey": "Key_D",
            "upKey": "Key_W",
            "downKey": "Key_S"
        },
        {
            "comment": "Backearse",
            "type": "KMT_CLICK",
            "key": "Key_B",
            "pos": {
                "x": 0.251156,
                "y": 0.883375
            }
        },
        {
            "comment": "Habilidad 1",
            "type": "KMT_DRAG",
            "key": "BackButton",
            "startPos": {
                "x": 0.7,
                "y": 0.8
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Habilidad 2",
            "type": "KMT_DRAG",
            "key": "ForwardButton",
            "startPos": {
                "x": 0.9,
                "y": 0.8
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Habilidad 3",
            "type": "KMT_DRAG",
            "key": "Key_Alt",
            "startPos": {
                "x": 0.8,
                "y": 0.7
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Habilidad 4",
            "type": "KMT_DRAG",
            "key": "Key_Space",
            "startPos": {
                "x": 0.9,
                "y": 0.8
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Up hab 1",
            "type": "KMT_CLICK",
            "key": "Key_1",
            "pos": {
                "x": 0.653313,
                "y": 0.784119
            }
        },
        {
            "comment": "Up hab 2",
            "type": "KMT_CLICK",
            "key": "Key_2",
            "pos": {
                "x": 0.679507,
                "y": 0.647643
            }
        },
        {
            "comment": "Up hab 3",
            "type": "KMT_CLICK",
            "key": "Key_3",
            "pos": {
                "x": 0.731895,
                "y": 0.531017
            }
        },
        {
            "comment": "Up hab 4",
            "type": "KMT_CLICK",
            "key": "Key_4",
            "pos": {
                "x": 0.808937,
                "y": 0.468983
            }
        },
        {
            "comment": "Basico",
            "type": "KMT_CLICK",
            "key": "MOUSE_RIGHT",
            "pos": {
                "x": 0.836672,
                "y": 0.863524
            }
        },
        {
            "comment": "Basico apuntado",
            "type": "KMT_DRAG",
            "key": "Key_Shift",
            "startPos": {
                "x": 0.853621,
                "y": 0.80397
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Atk minions",
            "type": "KMT_CLICK",
            "key": "Key_X",
            "pos": {
                "x": 0.784284,
                "y": 0.930521
            }
        },
        {
            "comment": "Atk torretas",
            "type": "KMT_CLICK",
            "key": "Key_Z",
            "pos": {
                "x": 0.904468,
                "y": 0.677419
            }
        },
        {
            "comment": "Hechizo F",
            "type": "KMT_DRAG",
            "key": "Key_F",
            "startPos": {
                "x": 0.523883,
                "y": 0.883375
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Hechizo G",
            "type": "KMT_DRAG",
            "key": "Key_G",
            "startPos": {
                "x": 0.599384,
                "y": 0.880893
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Hechizo botas",
            "type": "KMT_DRAG",
            "key": "Key_CapsLock",
            "startPos": {
                "x": 0.622496,
                "y": 0.741935
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Ward",
            "type": "KMT_DRAG",
            "key": "Key_V",
            "startPos": {
                "x": 0.859784,
                "y": 0.394541
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Ojete",
            "type": "KMT_DRAG",
            "key": "Key_Control",
            "startPos": {
                "x": 0.771957,
                "y": 0.255583
            },
            "endPos": "mouse",
            "onRelease": true
        },
        {
            "comment": "Tabulador",
            "type": "KMT_CLICK",
            "key": "Key_Tab",
            "pos": {
                "x": 0.845917,
                "y": 0.0397022
            }
        },
        {
            "comment": "Tienda F4",
            "type": "KMT_CLICK",
            "key": "Key_F4",
            "pos": {
                "x": 0.0948529,
                "y": 0.363281
            }
        }
    ]
}
JohnPleb commented 2 months ago

many errors in your keymap read https://github.com/barry-ran/QtScrcpy/blob/dev/docs/KeyMapDes.md for reference add switchMap when using kmt_clicks

    {
        "comment": "Backearse",
        "type": "KMT_CLICK",
        "key": "Key_B",
        "pos":
        {
            "x": 0.251156,
            "y": 0.883375
        },
        "switchMap": false
    },

those "endPos": "mouse", "onRelease": true inside KMT_DRAGS wont work aswell, for reference inside tiktok,json

        {
            "comment": "上滑",
            "type": "KMT_DRAG",
            "key": "Key_Up",
            "startPos": {
                "x": 0.5,
                "y": 0.7
            },
            "endPos": {
                "x": 0.5,
                "y": 0.3
            }
        },
sonicy098 commented 1 month ago

you added some stuff there.. did you build it yourself with modifications? if so i can't help. but if not, the comment above me is relevant to you