mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-04 00:38:47 +00:00
updates
- implemented frontend - namespaced Core - imported qdevicewatcher - fixed bug in logging (more like in misc)
This commit is contained in:
@@ -14,6 +14,7 @@ add_executable(threeSD
|
||||
|
||||
target_link_libraries(threeSD PRIVATE common core)
|
||||
target_link_libraries(threeSD PRIVATE Qt5::Widgets)
|
||||
target_link_libraries(threeSD PRIVATE qdevicewatcher)
|
||||
target_link_libraries(threeSD PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||
|
||||
if (APPLE)
|
||||
|
||||
+107
-2
@@ -2,23 +2,128 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <string>
|
||||
#include <QApplication>
|
||||
#include <QStorageInfo>
|
||||
#include <qdevicewatcher.h>
|
||||
#include "common/file_util.h"
|
||||
#include "frontend/main.h"
|
||||
#include "ui_main.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include "common/common_paths.h"
|
||||
#include "common/file_util.h"
|
||||
#endif
|
||||
|
||||
MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<Ui::MainDialog>()) {
|
||||
ui->setupUi(this);
|
||||
|
||||
setFixedWidth(width());
|
||||
ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)->setText(tr("Refresh"));
|
||||
|
||||
LoadPresetConfig();
|
||||
|
||||
connect(ui->advancedButton, &QPushButton::clicked, [this] {
|
||||
if (ui->customGroupBox->isVisible()) {
|
||||
HideAdvanced();
|
||||
} else {
|
||||
ShowAdvanced();
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, [this](QAbstractButton* button) {
|
||||
if (button == ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)) {
|
||||
LoadPresetConfig();
|
||||
}
|
||||
});
|
||||
|
||||
// Set up device watcher
|
||||
auto* device_watcher = new QDeviceWatcher(this);
|
||||
device_watcher->start();
|
||||
connect(device_watcher, &QDeviceWatcher::deviceAdded, this, &MainDialog::LoadPresetConfig);
|
||||
connect(device_watcher, &QDeviceWatcher::deviceChanged, this, &MainDialog::LoadPresetConfig);
|
||||
connect(device_watcher, &QDeviceWatcher::deviceRemoved, this, &MainDialog::LoadPresetConfig);
|
||||
}
|
||||
|
||||
MainDialog::~MainDialog() = default;
|
||||
|
||||
void MainDialog::LoadPresetConfig() {
|
||||
ui->configSelect->clear();
|
||||
preset_config_list.clear();
|
||||
|
||||
for (const auto& storage : QStorageInfo::mountedVolumes()) {
|
||||
if (!storage.isValid() || !storage.isReady()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto list = Core::LoadPresetConfig(storage.rootPath().toStdString());
|
||||
for (std::size_t i = 0; i < list.size(); ++i) {
|
||||
preset_config_list.emplace_back(list[i]);
|
||||
ui->configSelect->addItem(QString::fromStdString(list[i].sdmc_path));
|
||||
}
|
||||
}
|
||||
|
||||
if (preset_config_list.empty()) {
|
||||
// Clear the text
|
||||
ui->sdmcPath->setText(QString{});
|
||||
ui->userPath->setText(
|
||||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::UserDir)));
|
||||
ui->movableSedPath->setText(QString{});
|
||||
ui->bootrom9Path->setText(QString{});
|
||||
ui->safeModeFirmPath->setText(QString{});
|
||||
ui->seeddbPath->setText(QString{});
|
||||
ui->secretSectorPath->setText(QString{});
|
||||
|
||||
ui->advancedButton->setVisible(false);
|
||||
ShowAdvanced();
|
||||
ui->configSelect->addItem(tr("None"));
|
||||
ui->configSelect->setCurrentText(tr("None"));
|
||||
} else {
|
||||
ui->advancedButton->setVisible(true);
|
||||
if (ui->customGroupBox->isVisible()) {
|
||||
HideAdvanced();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainDialog::ShowAdvanced() {
|
||||
ui->configSelect->setEnabled(false);
|
||||
ui->advancedButton->setText(tr("Hide Custom Config"));
|
||||
ui->customGroupBox->setVisible(true);
|
||||
|
||||
setMaximumHeight(1000000);
|
||||
adjustSize();
|
||||
|
||||
const int index = ui->configSelect->currentIndex();
|
||||
ui->configSelect->addItem(tr("Custom"));
|
||||
ui->configSelect->setCurrentText(tr("Custom"));
|
||||
|
||||
if (index == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load preset data
|
||||
const auto config = preset_config_list[static_cast<u32>(index)];
|
||||
ui->sdmcPath->setText(QString::fromStdString(config.sdmc_path));
|
||||
ui->userPath->setText(QString::fromStdString(config.user_path));
|
||||
ui->movableSedPath->setText(QString::fromStdString(config.movable_sed_path));
|
||||
ui->bootrom9Path->setText(QString::fromStdString(config.bootrom_path));
|
||||
ui->safeModeFirmPath->setText(QString::fromStdString(config.safe_mode_firm_path));
|
||||
ui->seeddbPath->setText(QString::fromStdString(config.seed_db_path));
|
||||
ui->secretSectorPath->setText(QString::fromStdString(config.secret_sector_path));
|
||||
}
|
||||
|
||||
void MainDialog::HideAdvanced() {
|
||||
ui->configSelect->setEnabled(true);
|
||||
ui->advancedButton->setText(tr("Customize..."));
|
||||
ui->customGroupBox->setVisible(false);
|
||||
|
||||
LoadPresetConfig();
|
||||
|
||||
setMaximumHeight(130);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Init settings params
|
||||
QCoreApplication::setOrganizationName("zhaowenlan1779");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <QDialog>
|
||||
#include "core/importer.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainDialog;
|
||||
@@ -19,5 +20,10 @@ public:
|
||||
~MainDialog() override;
|
||||
|
||||
private:
|
||||
void LoadPresetConfig();
|
||||
void ShowAdvanced();
|
||||
void HideAdvanced();
|
||||
|
||||
std::vector<Core::Config> preset_config_list;
|
||||
std::unique_ptr<Ui::MainDialog> ui;
|
||||
};
|
||||
|
||||
+148
-149
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>450</height>
|
||||
<height>130</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -26,11 +26,11 @@
|
||||
<item>
|
||||
<widget class="QComboBox" name="configSelect">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -40,7 +40,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="advancedButton">
|
||||
<property name="text">
|
||||
<string>Advanced...</string>
|
||||
<string>Customize...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -54,160 +54,159 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox">
|
||||
<widget class="QGroupBox" name="customGroupBox">
|
||||
<property name="title">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>SDMC:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="sdmcPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sdmcPathExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>SDMC (Required)</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Path to the Nintendo 3DS/<ID0>/<ID1> folder.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>User Directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="userPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="userPathExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="sdmcPath">
|
||||
<property name="toolTip">
|
||||
<string>Path to the Nintendo 3DS/<ID0>/<ID1> folder.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>movable.sed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="movableSedPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="movableSedExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="sdmcPathExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>boot9.bin:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="bootrom9Path"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="bootrom9Explore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Citra User Directory (Required)</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Path to the User Directory of Citra to put imported content into.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Safe mode firm Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="safeModeFirmPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="safeModeFirmExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="userPath">
|
||||
<property name="toolTip">
|
||||
<string>Path to the User Directory of Citra to put imported content into.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>seeddb.bin:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="seeddbPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="seeddbExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="userPathExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>sector0x96.bin:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="secretSectorPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="secretSectorExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>movable.sed (Required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="movableSedPath"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="movableSedExplore">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>boot9.bin (Required)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="bootrom9Path"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="bootrom9Explore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Safe mode firm</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Path to the safe mode firm.<br>This is a folder, and needs to contain another folder named 'new' or 'old' corresponding to the system's type.<br>The 'new' or 'old' folder should hold files from the 'content' folder of the firm title in NAND. (i.e. tmd and app)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="safeModeFirmPath">
|
||||
<property name="toolTip">
|
||||
<string>Path to the safe mode firm.<br>This is a folder, and needs to contain another folder named 'new' or 'old' corresponding to the system's type.<br>The 'new' or 'old' folder should hold files from the 'content' folder of the firm title in NAND. (i.e. tmd and app)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="safeModeFirmExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>seeddb.bin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="seeddbPath"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QToolButton" name="seeddbExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>sector0x96.bin</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="secretSectorPath"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QToolButton" name="secretSectorExplore">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user