From: Akihiko Odaki <[email protected]>

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Message-ID: <[email protected]>
[ Marc-André - update replay-dump.py ]
Signed-off-by: Marc-André Lureau <[email protected]>
---
 replay/replay-input.c  | 20 +++-----------------
 replay/replay.c        |  2 +-
 scripts/replay-dump.py |  8 +++++++-
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/replay/replay-input.c b/replay/replay-input.c
index acf0993c728..c86e00af0ef 100644
--- a/replay/replay-input.c
+++ b/replay/replay-input.c
@@ -23,8 +23,7 @@ void replay_save_input_event(QemuInputEvent *evt)
 
     switch (evt->type) {
     case INPUT_EVENT_KIND_KEY:
-        replay_put_dword(KEY_VALUE_KIND_QCODE);
-        replay_put_dword(qemu_input_linux_to_qcode(evt->key.key));
+        replay_put_dword(evt->key.key);
         replay_put_byte(evt->key.down);
         break;
     case INPUT_EVENT_KIND_BTN:
@@ -55,25 +54,12 @@ void replay_save_input_event(QemuInputEvent *evt)
 QemuInputEvent *replay_read_input_event(void)
 {
     QemuInputEvent *evt = g_new(QemuInputEvent, 1);
-    int qcode;
 
     evt->type = replay_get_dword();
     switch (evt->type) {
     case INPUT_EVENT_KIND_KEY:
-        switch (replay_get_dword()) {
-        case KEY_VALUE_KIND_NUMBER:
-            qcode = qemu_input_key_number_to_qcode(replay_get_qword());
-            evt->key.down = replay_get_byte();
-            break;
-        case KEY_VALUE_KIND_QCODE:
-            qcode = (QKeyCode)replay_get_dword();
-            evt->key.down = replay_get_byte();
-            break;
-        default:
-            g_assert_not_reached();
-        }
-        evt->key.key = qcode < qemu_input_map_qcode_to_linux_len ?
-                       qemu_input_map_qcode_to_linux[qcode] : 0;
+        evt->key.key = replay_get_dword();
+        evt->key.down = replay_get_byte();
         break;
     case INPUT_EVENT_KIND_BTN:
         evt->btn.button = (InputButton)replay_get_dword();
diff --git a/replay/replay.c b/replay/replay.c
index 2e5c6fa82ea..14437b32566 100644
--- a/replay/replay.c
+++ b/replay/replay.c
@@ -22,7 +22,7 @@
 
 /* Current version of the replay mechanism.
    Increase it when file format changes. */
-#define REPLAY_VERSION              0xe0200d
+#define REPLAY_VERSION              0xe0200e
 /* Size of replay log header */
 #define HEADER_SIZE                 (sizeof(uint32_t) + sizeof(uint64_t))
 
diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
index 081aaa36c5e..ce1031b4ad4 100755
--- a/scripts/replay-dump.py
+++ b/scripts/replay-dump.py
@@ -398,6 +398,9 @@ def decode_end(eid, name, dumpfile):
 # EVENT_AUDIO_IN has changed
 v13_event_table = v12_event_table
 
+# EVENT_ASYNC_INPUT has changed
+v14_event_table = v13_event_table
+
 def parse_arguments():
     "Grab arguments for script"
     parser = argparse.ArgumentParser()
@@ -416,7 +419,10 @@ def decode_file(filename):
     # see REPLAY_VERSION
     print("HEADER: version 0x%x" % (version))
 
-    if version == 0xe0200d:
+    if version == 0xe0200e:
+        event_decode_table = v14_event_table
+        replay_state.checkpoint_start = 30
+    elif version == 0xe0200d:
         event_decode_table = v13_event_table
         replay_state.checkpoint_start = 30
     elif version == 0xe0200c:
-- 
2.54.0


Reply via email to