mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-13 13:15:59 +00:00
file formats and qt (#88)
* added psf file format * clang format fix * crypto functions for pkg decryption * pkg decryption * initial add of qt gui , not yet usable * renamed ini for qt gui settings into shadps4qt.ini * file detection and loader support * option to build QT qui * clang format fix * fixed reuse * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.h Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * uppercase fix * clang format fix * small fixes * let's try windows qt build ci * some more fixes for ci * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/pkg.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update .github/workflows/windows-qt.yml Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * Update src/core/file_format/psf.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * loader namespace * Update src/core/loader.cpp Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> * constexpr magic * linux qt ci by qurious * fix for linux qt * Make script executable * ci fix? --------- Co-authored-by: raziel1000 <ckraziel@gmail.com> Co-authored-by: GPUCode <47210458+GPUCode@users.noreply.github.com> Co-authored-by: GPUCode <geoster3d@gmail.com>
This commit is contained in:
parent
99d013f612
commit
02cbebbf78
53 changed files with 5781 additions and 42 deletions
77
src/qt_gui/settings.cpp
Normal file
77
src/qt_gui/settings.cpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
Settings::Settings(QObject* parent) : QObject(parent), m_settings_dir(ComputeSettingsDir()) {}
|
||||
|
||||
Settings::~Settings() {
|
||||
if (m_settings) {
|
||||
m_settings->sync();
|
||||
}
|
||||
}
|
||||
|
||||
QString Settings::GetSettingsDir() const {
|
||||
return m_settings_dir.absolutePath();
|
||||
}
|
||||
|
||||
QString Settings::ComputeSettingsDir() {
|
||||
return ""; // TODO currently we configure same dir , make it configurable
|
||||
}
|
||||
|
||||
void Settings::RemoveValue(const QString& key, const QString& name) const {
|
||||
if (m_settings) {
|
||||
m_settings->beginGroup(key);
|
||||
m_settings->remove(name);
|
||||
m_settings->endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::RemoveValue(const GuiSave& entry) const {
|
||||
RemoveValue(entry.key, entry.name);
|
||||
}
|
||||
|
||||
QVariant Settings::GetValue(const QString& key, const QString& name, const QVariant& def) const {
|
||||
return m_settings ? m_settings->value(key + "/" + name, def) : def;
|
||||
}
|
||||
|
||||
QVariant Settings::GetValue(const GuiSave& entry) const {
|
||||
return GetValue(entry.key, entry.name, entry.def);
|
||||
}
|
||||
|
||||
QVariant Settings::List2Var(const q_pair_list& list) {
|
||||
QByteArray ba;
|
||||
QDataStream stream(&ba, QIODevice::WriteOnly);
|
||||
stream << list;
|
||||
return QVariant(ba);
|
||||
}
|
||||
|
||||
q_pair_list Settings::Var2List(const QVariant& var) {
|
||||
q_pair_list list;
|
||||
QByteArray ba = var.toByteArray();
|
||||
QDataStream stream(&ba, QIODevice::ReadOnly);
|
||||
stream >> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
void Settings::SetValue(const GuiSave& entry, const QVariant& value) const {
|
||||
if (m_settings) {
|
||||
m_settings->beginGroup(entry.key);
|
||||
m_settings->setValue(entry.name, value);
|
||||
m_settings->endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::SetValue(const QString& key, const QVariant& value) const {
|
||||
if (m_settings) {
|
||||
m_settings->setValue(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::SetValue(const QString& key, const QString& name, const QVariant& value) const {
|
||||
if (m_settings) {
|
||||
m_settings->beginGroup(key);
|
||||
m_settings->setValue(name, value);
|
||||
m_settings->endGroup();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue