aboutsummaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/ipc/recorder.h
blob: de0e512be3998bed94aee8fb272b348542466a97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2019 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#pragma once

#include <memory>
#include <QDockWidget>
#include "core/hle/kernel/ipc_debugger/recorder.h"

class QTreeWidgetItem;

namespace Ui {
class IPCRecorder;
}

namespace Core {
class System;
}

class IPCRecorderWidget : public QDockWidget {
    Q_OBJECT

public:
    explicit IPCRecorderWidget(Core::System& system, QWidget* parent = nullptr);
    ~IPCRecorderWidget();

    void OnEmulationStarting();

signals:
    void EntryUpdated(IPCDebugger::RequestRecord record);

private:
    QString GetStatusStr(const IPCDebugger::RequestRecord& record) const;
    void OnEntryUpdated(IPCDebugger::RequestRecord record);
    void SetEnabled(bool enabled);
    void Clear();
    void ApplyFilter(int index);
    void ApplyFilterToAll();
    QString GetServiceName(const IPCDebugger::RequestRecord& record) const;
    QString GetFunctionName(const IPCDebugger::RequestRecord& record) const;
    void OpenRecordDialog(QTreeWidgetItem* item, int column);

private:
    std::unique_ptr<Ui::IPCRecorder> ui;
    IPCDebugger::CallbackHandle handle;
    Core::System& system;
    // The offset between record id and row id, assuming record ids are assigned
    // continuously and only the 'Clear' action can be performed, this is enough.
    // The initial value is 1, which means record 1 = row 0.
    int id_offset = 1;
    std::vector<IPCDebugger::RequestRecord> records;
};

Q_DECLARE_METATYPE(IPCDebugger::RequestRecord);