mirror of
https://github.com/palera1n/palera1n.git
synced 2026-11-21 04:43:41 +01:00
feat: overrides, no-colors, bootargs, early-exit
- This moves globals variables to `globals.c` - GUI updated for these new options - cleaned up payload code
This commit is contained in:
20 files changed
+406
-130
No files matched your search
@@ -19,6 +19,10 @@ public:
|
||||
m_deviceState = state;
|
||||
}
|
||||
|
||||
virtual void OnShow(wxShowEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
protected:
|
||||
MainFrame* GetMainFrame() const
|
||||
{
|
||||
@@ -29,7 +33,6 @@ protected:
|
||||
{
|
||||
return m_deviceState;
|
||||
}
|
||||
|
||||
private:
|
||||
MainFrame* m_frame;
|
||||
DeviceState m_deviceState;
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
|
||||
#include "AppFrame.hpp"
|
||||
#include "DevicePanel.hpp"
|
||||
|
||||
#include "../state.hpp"
|
||||
#include "../sequence.hpp"
|
||||
#include "../utils.h"
|
||||
#include "../globals.h"
|
||||
#include "../paleinfo.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
@@ -31,6 +34,7 @@
|
||||
DfuPanel::DfuPanel(MainFrame* frame, wxWindow* parent)
|
||||
: DevicePanel(frame, parent)
|
||||
{
|
||||
Bind(wxEVT_SHOW, &DfuPanel::OnShow, this);
|
||||
auto* root = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_headerText = new wxStaticText(this, wxID_ANY, "Time to put the device into DFU mode. Locate the buttons as marked below\non your device and check the instructions on the right.");
|
||||
@@ -141,6 +145,22 @@ void DfuPanel::SetDeviceState(const DeviceState& state)
|
||||
}
|
||||
}
|
||||
|
||||
void DfuPanel::OnShow(wxShowEvent& event)
|
||||
{
|
||||
if (event.IsShown())
|
||||
{
|
||||
if (palerain_flags & palerain_option_quick) {
|
||||
m_isEnteringDfu = true;
|
||||
m_backButton->Disable();
|
||||
m_startButton->Disable();
|
||||
|
||||
StartSequence(m_sequence);
|
||||
}
|
||||
}
|
||||
|
||||
DevicePanel::OnShow(event);
|
||||
}
|
||||
|
||||
void DfuPanel::LoadDevice(const std::string& productType)
|
||||
{
|
||||
const wxColour kActive =
|
||||
|
||||
@@ -14,6 +14,7 @@ class DfuPanel : public DevicePanel
|
||||
public:
|
||||
explicit DfuPanel(MainFrame* frame, wxWindow* parent);
|
||||
void SetDeviceState(const DeviceState& state) override;
|
||||
void OnShow(wxShowEvent& event) override;
|
||||
void LoadDevice(const std::string& productType);
|
||||
void StartSequence(const DfuSequence& seq);
|
||||
void RunStep();
|
||||
|
||||
+18
-4
@@ -10,8 +10,11 @@
|
||||
|
||||
#include "AppFrame.hpp"
|
||||
#include "DevicePanel.hpp"
|
||||
#include "../state.hpp"
|
||||
|
||||
#include "../state.hpp"
|
||||
#include "../globals.h"
|
||||
#include "../utils.h"
|
||||
#include "../paleinfo.h"
|
||||
#include "../gen/images/logo.h"
|
||||
|
||||
const char* deviceTextString = "Connect your iPhone, iPod touch, iPad, or AppleTV to begin.";
|
||||
@@ -82,11 +85,21 @@ MainPanel::MainPanel(MainFrame* frame, wxWindow* parent)
|
||||
|
||||
root->AddStretchSpacer();
|
||||
|
||||
auto* btn = new wxButton(this, wxID_ANY, "Options");
|
||||
auto* quickMode = new wxCheckBox(this, wxID_ANY, "Quick Mode");
|
||||
auto* optionsButton = new wxButton(this, wxID_ANY, "Options");
|
||||
m_startButton = new wxButton(this, wxID_ANY, "Start");
|
||||
m_startButton->Disable();
|
||||
|
||||
btn->Bind(wxEVT_BUTTON, [frame](wxCommandEvent&)
|
||||
quickMode->SetValue(palerain_flags & palerain_option_quick);
|
||||
quickMode->Bind(wxEVT_CHECKBOX, [&](wxCommandEvent& e)
|
||||
{
|
||||
if (e.IsChecked())
|
||||
palerain_flags |= palerain_option_quick;
|
||||
else
|
||||
palerain_flags &= ~palerain_option_quick;
|
||||
});
|
||||
|
||||
optionsButton->Bind(wxEVT_BUTTON, [frame](wxCommandEvent&)
|
||||
{
|
||||
frame->ShowSettings();
|
||||
});
|
||||
@@ -105,7 +118,8 @@ MainPanel::MainPanel(MainFrame* frame, wxWindow* parent)
|
||||
|
||||
auto* bottomRow = new wxBoxSizer(wxHORIZONTAL);
|
||||
bottomRow->AddStretchSpacer();
|
||||
bottomRow->Add(btn, 0, wxRIGHT | wxBOTTOM, 10);
|
||||
bottomRow->Add(quickMode, 0, wxRIGHT | wxTOP, 1);
|
||||
bottomRow->Add(optionsButton, 0, wxRIGHT | wxLEFT | wxBOTTOM, 10);
|
||||
bottomRow->Add(m_startButton, 0, wxRIGHT | wxLEFT | wxBOTTOM, 10);
|
||||
|
||||
root->Add(bottomRow, 0, wxEXPAND);
|
||||
|
||||
+44
-19
@@ -4,9 +4,15 @@
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "AppFrame.hpp"
|
||||
#include "DevicePanel.hpp"
|
||||
|
||||
#include "../state.hpp"
|
||||
#include "../utils.h"
|
||||
#include "../globals.h"
|
||||
#include "../paleinfo.h"
|
||||
|
||||
#include <libimobiledevice/libimobiledevice.h>
|
||||
#include <libimobiledevice/lockdown.h>
|
||||
@@ -15,6 +21,7 @@
|
||||
RecoveryPanel::RecoveryPanel(MainFrame* frame, wxWindow* parent)
|
||||
: DevicePanel(frame, parent)
|
||||
{
|
||||
Bind(wxEVT_SHOW, &RecoveryPanel::OnShow, this);
|
||||
auto* root = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
root->Add(new wxStaticText(this, wxID_ANY,
|
||||
@@ -92,34 +99,52 @@ void RecoveryPanel::SetDeviceState(const DeviceState& state)
|
||||
}
|
||||
}
|
||||
|
||||
void RecoveryPanel::OnShow(wxShowEvent& event)
|
||||
{
|
||||
if (event.IsShown())
|
||||
{
|
||||
if (palerain_flags & palerain_option_quick)
|
||||
{
|
||||
m_statusText->SetLabel("Entering recovery mode...");
|
||||
m_backButton->Disable();
|
||||
m_nextButton->Disable();
|
||||
EnterRecoveryMode();
|
||||
}
|
||||
}
|
||||
|
||||
DevicePanel::OnShow(event);
|
||||
}
|
||||
|
||||
void RecoveryPanel::EnterRecoveryMode()
|
||||
{
|
||||
const auto& state = GetDeviceState();
|
||||
std::thread([this]()
|
||||
{
|
||||
const auto deviceState = GetDeviceState();
|
||||
if (!deviceState.connected)
|
||||
return;
|
||||
|
||||
if (!state.connected)
|
||||
return;
|
||||
idevice_t device = nullptr;
|
||||
lockdownd_client_t client = nullptr;
|
||||
|
||||
idevice_t device = nullptr;
|
||||
lockdownd_client_t client = nullptr;
|
||||
if (idevice_new(&device, deviceState.udid.c_str()) != IDEVICE_E_SUCCESS)
|
||||
return;
|
||||
|
||||
if (idevice_new(&device, state.udid.c_str()) != IDEVICE_E_SUCCESS)
|
||||
return;
|
||||
|
||||
if (lockdownd_client_new_with_handshake(
|
||||
if (lockdownd_client_new_with_handshake(
|
||||
device,
|
||||
&client,
|
||||
"palera1n") != LOCKDOWN_E_SUCCESS)
|
||||
{
|
||||
{
|
||||
idevice_free(device);
|
||||
return;
|
||||
}
|
||||
|
||||
m_isEnteringRecovery = true;
|
||||
|
||||
lockdownd_enter_recovery(client);
|
||||
|
||||
lockdownd_client_free(client);
|
||||
idevice_free(device);
|
||||
return;
|
||||
}
|
||||
|
||||
m_isEnteringRecovery = true;
|
||||
|
||||
lockdownd_enter_recovery(client);
|
||||
|
||||
lockdownd_client_free(client);
|
||||
idevice_free(device);
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void RecoveryPanel::SetStatusText(const wxString& text)
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
void SetDeviceState(const DeviceState& state) override;
|
||||
void SetStatusText(const wxString& text);
|
||||
void EnterRecoveryMode();
|
||||
void OnShow(wxShowEvent& event) override;
|
||||
private:
|
||||
wxButton* m_backButton = nullptr;
|
||||
wxButton* m_nextButton = nullptr;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "AppFrame.hpp"
|
||||
#include "DevicePanel.hpp"
|
||||
#include "../utils.h"
|
||||
#include "../globals.h"
|
||||
#include "../paleinfo.h"
|
||||
|
||||
SettingsPanel::SettingsPanel(MainFrame* frame, wxWindow* parent)
|
||||
@@ -66,6 +67,18 @@ SettingsPanel::SettingsPanel(MainFrame* frame, wxWindow* parent)
|
||||
root->Add(new wxStaticText(this, wxID_ANY, "Boot Arguments:"), 0, wxALL, 10);
|
||||
|
||||
auto* bootArgs = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
bootArgs->SetValue(wxString(boot_args, wxConvUTF8));
|
||||
bootArgs->Bind(wxEVT_TEXT, [&](wxCommandEvent& e)
|
||||
{
|
||||
wxString value = e.GetString();
|
||||
if (value.length() > (sizeof(boot_args) - 0x20)) {
|
||||
LOG_ERROR("Boot arguments too long");
|
||||
return;
|
||||
}
|
||||
snprintf(boot_args, sizeof(boot_args), "%s", value.ToStdString().c_str());
|
||||
});
|
||||
|
||||
root->Add(bootArgs, 0, wxLEFT | wxRIGHT | wxEXPAND, 30);
|
||||
|
||||
root->Add(option_revert, 0, wxLEFT | wxRIGHT | wxTOP, 10);
|
||||
|
||||
Reference in new issue
Block a user