TegraRcmGUI/qkourou.h

88 lines
2.3 KiB
C
Raw Permalink Normal View History

2020-06-24 20:30:39 +02:00
#ifndef QKOUROU_H
#define QKOUROU_H
#include <QObject>
#include <QWidget>
2020-06-24 20:31:54 +02:00
#include <QThread>
#include "kourou/kourou.h"
2020-12-11 12:46:53 +01:00
#include "qobjects/hekate_ini.h"
#include "packages.h"
2020-06-24 20:30:39 +02:00
2020-06-24 20:31:54 +02:00
typedef enum _qKourouAction : int
2020-06-24 20:30:39 +02:00
{
2020-06-24 20:31:54 +02:00
INIT_DEVICE,
AUTO_INJECT,
PAYLOAD_INJECT
} qKourouAction;
2020-12-11 12:46:53 +01:00
class Kourou;
2020-06-24 20:31:54 +02:00
class TegraRcmGUI;
2020-12-11 12:46:53 +01:00
class qProgressWidget;
class HekateIni;
class Packages;
2020-06-24 20:31:54 +02:00
///
/// \brief The QKourou class is a Qt thread safe reimplemented class of Kourou class, for TegraRcmGUI
///
class QKourou : public QWidget {
Q_OBJECT
2020-06-24 20:30:39 +02:00
public:
2020-06-24 20:31:54 +02:00
QKourou(QWidget *parent, Kourou* device, TegraRcmGUI* gui);
2020-12-11 12:46:53 +01:00
~QKourou();
2020-06-24 20:31:54 +02:00
bool isLocked() { return m_locked; }
QByteArray ariane_bin;
bool autoLaunchAriane = true;
bool autoInjectPayload = false;
bool arianeIsLoading = false;
2020-12-11 12:46:53 +01:00
HekateIni *m_hekate_ini = nullptr;
HekateIni *&hekate_ini = m_hekate_ini;
Kourou* device() { return m_device; }
2020-06-24 20:31:54 +02:00
private:
2020-12-11 12:46:53 +01:00
QWidget *parent;
2020-06-24 20:31:54 +02:00
Kourou *m_device;
TegraRcmGUI *m_gui;
bool m_locked = false;
bool m_force_lock = false;
bool m_askForDriverInstall = true;
2020-12-11 12:46:53 +01:00
bool m_APX_device_reconnect = true;
2020-06-24 20:31:54 +02:00
std::string tmp_string;
2020-12-11 12:46:53 +01:00
2020-06-24 20:31:54 +02:00
void hack(const char* payload_path, u8 *payload_buff, u32 buff_size);
void setLockEnabled(bool enable) { m_locked = enable; }
bool waitUntilUnlock(uint timeout_s = 10);
bool waitUntilRcmReady(uint timeout_s = 10);
2020-12-11 12:46:53 +01:00
bool waitUntilArianeReady(bool skip_rcm = false, uint timeout_s = 10);
2020-06-24 20:31:54 +02:00
bool waitUntilInit(uint timeout_s = 10);
bool rebootToRcm();
DWORD autoInject();
public slots:
void initDevice(bool silent, KLST_DEVINFO_HANDLE deviceInfo = nullptr);
void getDeviceInfo();
void hack(const char* payload_path);
void hack(u8 *payload_buff, u32 buff_size);
void initNoDriverDeviceLookUpLoop();
void noDriverDeviceLookUp();
void setAutoRcmEnabled(bool state);
2020-12-11 12:46:53 +01:00
void installSDFiles(QString input_path, bool ignore_ini = false);
void copyFiles(QList<Packages::Package*> pkgs);
void getKeys();
2020-06-24 20:31:54 +02:00
signals:
void clb_deviceInfo(UC_DeviceInfo di);
void clb_error(int error);
void clb_deviceStateChange();
void clb_finished(int res);
2020-12-11 12:46:53 +01:00
void clb_driverMissing();
void pushMessage(const QString);
void initProgressWidget(const QString, int);
void sendStatusLbl(const QString);
void closeProgressWidget();
2020-06-24 20:30:39 +02:00
};
#endif // QKOUROU_H