Compare commits

...

5 Commits

Author SHA1 Message Date
drHyperion451 d492bf496d Merge branch 'dev' into 'dev'
Error handling for the icns generator script

See merge request suyu-emu/suyu!92
2024-03-09 01:46:21 +00:00
niansa 16e19b0b3c Implement option to start QLaunch from Tools menu 2024-03-09 01:28:33 +00:00
drHyperion451 850876afde Swapped 'echo' with 'read' instead 2024-03-08 23:42:48 +00:00
drHyperion451 8234e0117e Merge branch suyu:dev into dev 2024-03-08 23:31:28 +00:00
drHyperion451 ee608ce097 Error handling for the icns generator script 2024-03-08 11:58:21 +00:00
6 changed files with 107 additions and 15 deletions

View File

@ -1,14 +1,61 @@
mkdir suyu.iconset
convert -background none -resize 16x16 suyu.svg suyu.iconset/icon_16x16.png;
convert -background none -resize 32x32 suyu.svg suyu.iconset/icon_16x16@2x.png;
convert -background none -resize 32x32 suyu.svg suyu.iconset/icon_32x32.png;
convert -background none -resize 64x64 suyu.svg suyu.iconset/icon_32x32@2x.png;
convert -background none -resize 128x128 suyu.svg suyu.iconset/icon_128x128.png;
convert -background none -resize 256x256 suyu.svg suyu.iconset/icon_256x256.png;
convert -background none -resize 256x256 suyu.svg suyu.iconset/icon_128x128@2x.png;
convert -background none -resize 512x512 suyu.svg suyu.iconset/icon_256x256@2x.png;
convert -background none -resize 512x512 suyu.svg suyu.iconset/icon_512x512.png;
convert -background none -resize 1024x1024 suyu.svg suyu.iconset/icon_512x512@2x.png;
#!/bin/bash
# icns_generator.sh GNU GPLv3 License
# Run this script when a new logo is made and the suyu.svg file inside.
# You should install Imagemagick to make the conversions: $brew install imagemagick
iconutil -c icns suyu.iconset
rm -rf suyu.iconset
# Change working dir to where this script is located.
cd "${0%/*}"
# Error Handling Stuff:
## Check command availability
check_command() {
if ! command -v "$1" &> /dev/null; then
read -s -n 1 -p "Error: '$1' command not found. Please install $2."
exit 1
fi
}
## Convert image with error handling
convert_image() {
convert -background none -resize "$2" "$1" "$3" || {
read -s -n 1 -p "Error: Conversion failed for $1"
exit 1
}
}
# Check required commands
check_command "convert" "ImageMagick"
check_command "iconutil" "macOS"
# Create the iconset directory
mkdir suyu.iconset || {
read -s -n 1 -p "Error: Unable to create suyu.iconset directory."
exit 1
}
# Convert images
convert_image suyu.svg 16x16 suyu.iconset/icon_16x16.png
convert_image suyu.svg 32x32 suyu.iconset/icon_16x16@2x.png
convert_image suyu.svg 32x32 suyu.iconset/icon_32x32.png
convert_image suyu.svg 64x64 suyu.iconset/icon_32x32@2x.png
convert_image suyu.svg 128x128 suyu.iconset/icon_128x128.png
convert_image suyu.svg 256x256 suyu.iconset/icon_256x256.png
convert_image suyu.svg 256x256 suyu.iconset/icon_128x128@2x.png
convert_image suyu.svg 512x512 suyu.iconset/icon_256x256@2x.png
convert_image suyu.svg 512x512 suyu.iconset/icon_512x512.png
convert_image suyu.svg 1024x1024 suyu.iconset/icon_512x512@2x.png
# Create the ICNS file
iconutil -c icns suyu.iconset || {
read -s -n 1 -p "Error: Failed to create ICNS file."
exit 1
}
# Remove the temporary iconset directory
rm -rf suyu.iconset || {
read -s -n 1 -p "Error: Unable to remove suyu.iconset directory."
exit 1
}
read -s -n 1 -p "Icon generation completed successfully."
echo ""

View File

@ -15,8 +15,8 @@ IGlobalStateController::IGlobalStateController(Core::System& system_)
{0, nullptr, "RequestToEnterSleep"},
{1, nullptr, "EnterSleep"},
{2, nullptr, "StartSleepSequence"},
{3, nullptr, "StartShutdownSequence"},
{4, nullptr, "StartRebootSequence"},
{3, D<&IGlobalStateController::StartShutdownSequence>, "StartShutdownSequence"},
{4, D<&IGlobalStateController::StartRebootSequence>, "StartRebootSequence"},
{9, nullptr, "IsAutoPowerDownRequested"},
{10, D<&IGlobalStateController::LoadAndApplyIdlePolicySettings>, "LoadAndApplyIdlePolicySettings"},
{11, nullptr, "NotifyCecSettingsChanged"},
@ -31,6 +31,18 @@ IGlobalStateController::IGlobalStateController(Core::System& system_)
RegisterHandlers(functions);
}
Result IGlobalStateController::StartShutdownSequence() {
LOG_INFO(Service_AM, "called");
system.Exit();
R_SUCCEED();
}
Result IGlobalStateController::StartRebootSequence() {
LOG_INFO(Service_AM, "called");
system.Exit();
R_SUCCEED();
}
IGlobalStateController::~IGlobalStateController() = default;
Result IGlobalStateController::LoadAndApplyIdlePolicySettings() {

View File

@ -18,6 +18,8 @@ public:
~IGlobalStateController() override;
private:
Result StartShutdownSequence();
Result StartRebootSequence();
Result LoadAndApplyIdlePolicySettings();
Result ShouldSleepOnBoot(Out<bool> out_should_sleep_on_boot);
Result GetHdcpAuthenticationFailedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);

View File

@ -1577,6 +1577,7 @@ void GMainWindow::ConnectMenuEvents() {
[this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); });
connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit);
connect_menu(ui->action_Open_Controller_Menu, &GMainWindow::OnOpenControllerMenu);
connect_menu(ui->action_Load_Home_Menu, &GMainWindow::OnHomeMenu);
connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot);
// TAS
@ -4291,6 +4292,29 @@ void GMainWindow::OnOpenControllerMenu() {
LibraryAppletParameters(ControllerAppletId, Service::AM::AppletId::Controller));
}
void GMainWindow::OnHomeMenu() {
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
if (!bis_system) {
QMessageBox::warning(this, tr("No firmware available"),
tr("Please install the firmware to use the Home Menu."));
return;
}
auto qlaunch_applet_nca = bis_system->GetEntry(QLaunchId, FileSys::ContentRecordType::Program);
if (!qlaunch_applet_nca) {
QMessageBox::warning(this, tr("Home Menu Applet"),
tr("Home Menu is not available. Please reinstall firmware."));
return;
}
system->GetFrontendAppletHolder().SetCurrentAppletId(Service::AM::AppletId::QLaunch);
const auto filename = QString::fromStdString((qlaunch_applet_nca->GetFullPath()));
UISettings::values.roms_path = QFileInfo(filename).path().toStdString();
BootGame(filename, LibraryAppletParameters(QLaunchId, Service::AM::AppletId::QLaunch));
}
void GMainWindow::OnCaptureScreenshot() {
if (emu_thread == nullptr || !emu_thread->IsRunning()) {
return;

View File

@ -399,6 +399,7 @@ private slots:
void OnCabinet(Service::NFP::CabinetMode mode);
void OnMiiEdit();
void OnOpenControllerMenu();
void OnHomeMenu();
void OnCaptureScreenshot();
void OnCheckFirmwareDecryption();
void OnLanguageChanged(const QString& locale);

View File

@ -173,6 +173,7 @@
<addaction name="action_Load_Album"/>
<addaction name="action_Load_Mii_Edit"/>
<addaction name="action_Open_Controller_Menu"/>
<addaction name="action_Load_Home_Menu"/>
<addaction name="separator"/>
<addaction name="action_Capture_Screenshot"/>
<addaction name="menuTAS"/>
@ -475,6 +476,11 @@
<string>Install Decryption Keys</string>
</property>
</action>
<action name="action_Load_Home_Menu">
<property name="text">
<string>Open Home Menu</string>
</property>
</action>
</widget>
<resources>
<include location="suyu.qrc"/>