- Added trophy decryption when extracting a fpkg. trp icons and xmls are dumped to game_data/<title> (can be restored if deleted by accident by opening the trophy viewer)

- Added a trophy viewer (right click on game ==> trophy viewer)
- Enabled Run button.
- Switched gui settings to toml.
- Added recent files (6 max)
- Applied @raphaelthegreat suggestions and corrections (Thanks a lot).
- Fixed several bugs and crashes.
- Full screen should disabled by default.
- Added region in list mode.
- Added a simple temp elf list widget.
- Added messages when extracting pkg (ex: installing a patch before the game...etc)
This commit is contained in:
raziel1000 2024-06-10 20:42:21 -06:00
parent 71dda8c776
commit 0f27e0edf2
49 changed files with 1616 additions and 891 deletions

View file

@ -3,10 +3,19 @@
#pragma once
#include <QAbstractButton>
#include <QActionGroup>
#include <QDragEnterEvent>
#include <QMainWindow>
#include <QMimeData>
#include <QScopedPointer>
#include <emulator.h>
#include <fmt/core.h>
#include "common/config.h"
#include "common/path_util.h"
#include "core/file_format/psf.h"
#include "core/file_sys/fs.h"
#include "elf_viewer.h"
#include "game_grid_frame.h"
#include "game_info.h"
#include "game_list_frame.h"
@ -15,26 +24,19 @@
#include "main_window_ui.h"
#include "pkg_viewer.h"
class GuiSettings;
class GameListFrame;
class MainWindow : public QMainWindow {
Q_OBJECT
std::unique_ptr<Ui_MainWindow> ui;
bool m_is_list_mode = true;
bool m_save_slider_pos = false;
int m_other_slider_pos = 0;
signals:
void WindowResized(QResizeEvent* event);
void ExtractionFinished();
public:
explicit MainWindow(std::shared_ptr<GuiSettings> gui_settings, QWidget* parent = nullptr);
explicit MainWindow(QWidget* parent = nullptr);
~MainWindow();
bool Init();
void InstallPkg();
void InstallDragDropPkg(std::string file, int pkgNum, int nPkg);
void InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg);
void InstallDirectory();
private Q_SLOTS:
@ -45,38 +47,40 @@ private Q_SLOTS:
void HandleResize(QResizeEvent* event);
private:
Ui_MainWindow* ui;
void AddUiWidgets();
void CreateActions();
void CreateRecentGameActions();
void CreateDockWindows();
void LoadGameLists();
void CreateConnects();
void SetLastUsedTheme();
void SetLastIconSizeBullet();
void SetUiIcons(bool isWhite);
void InstallPkg();
void AddRecentFiles(QString filePath);
QIcon RecolorIcon(const QIcon& icon, bool isWhite);
bool isIconBlack = false;
bool isTableList = true;
QActionGroup* m_icon_size_act_group = nullptr;
QActionGroup* m_list_mode_act_group = nullptr;
QActionGroup* m_theme_act_group = nullptr;
QActionGroup* m_recent_files_group = nullptr;
PKG pkg;
// Dockable widget frames
QMainWindow* m_main_window = nullptr;
WindowThemes m_window_themes;
GameListUtils m_game_list_utils;
QDockWidget* m_dock_widget = nullptr;
QScopedPointer<QDockWidget> m_dock_widget;
// Game Lists
GameListFrame* m_game_list_frame = nullptr;
GameGridFrame* m_game_grid_frame = nullptr;
// Packge Viewer
PKGViewer* m_pkg_viewer = nullptr;
QScopedPointer<GameListFrame> m_game_list_frame;
QScopedPointer<GameGridFrame> m_game_grid_frame;
QScopedPointer<ElfViewer> m_elf_viewer;
// Status Bar.
QStatusBar* statusBar = nullptr;
QScopedPointer<QStatusBar> statusBar;
PSF psf;
std::shared_ptr<GameInfoClass> m_game_info = std::make_shared<GameInfoClass>();
std::shared_ptr<GuiSettings> m_gui_settings;
protected:
void dragEnterEvent(QDragEnterEvent* event1) override {
@ -93,7 +97,11 @@ protected:
int nPkg = urlList.size();
for (const QUrl& url : urlList) {
pkgNum++;
InstallDragDropPkg(url.toLocalFile().toStdString(), pkgNum, nPkg);
std::filesystem::path path(url.toLocalFile().toStdString());
#ifdef _WIN64
path = std::filesystem::path(url.toLocalFile().toStdWString());
#endif
InstallDragDropPkg(path, pkgNum, nPkg);
}
}
}