1
0
Fork 0
forked from suyu/suyu

Compare commits

..

21 commits

Author SHA1 Message Date
068052078f
CI: Enable android artifacts 2024-03-25 14:36:04 -03:00
177bb48d6c Update README.md 2024-03-25 16:59:22 +01:00
1f2bbfdf6d Increase Limit ( FSR Sharp , AUDIO ) Android
Increase Limit FSR Sharp 
( 0 - 200 )
Increase Limit Audio ( 0-120 )
2024-03-25 12:50:04 +01:00
9b3fa0d3da Add 32:9 Android
Fix Issue Aspec Ratio For Android
2024-03-25 12:45:48 +01:00
77042ae6f7 Add 32:9 Android
This Fix Issue Aspec Ratio For Android
2024-03-25 12:42:41 +01:00
dbee1677c4
MR 3 manual merge
Merge branch 'RadsammyT-dev-fork' into dev
2024-03-25 16:22:29 +08:00
4b06697954 Merge branch 'dev' into dev-fork 2024-03-25 05:34:28 +01:00
d4375a21ef
Revert a9312c837e . Use proper GCC binary location and CCACHE changes in
the CI
2024-03-25 01:16:32 -03:00
0c2bdc6f61
Fix wrong URL on DownloadExternals. Change Clang and GCC executables on CI scripts 2024-03-24 23:15:50 -03:00
f033d7e1e9 Merge branch 'dev' into dev-fork 2024-03-25 01:27:14 +01:00
ba411a17e0 change application id
when we enable discord rpc for use this will change the yuzu icon to suyu.
2024-03-25 01:14:35 +01:00
bbe9f86554
ci: Execute CI if verify.yml has been changed 2024-03-24 21:03:20 -03:00
2857540817
resolve merge conflict in .forgejo/workflows/verify.yml
i hope to fucking god this works
2024-03-24 00:23:29 -04:00
ee2caf179e Merge branch 'dev' into dev-fork 2024-03-23 21:58:00 +01:00
f9f4622b28
ci: Container options in verify.yml negaetes the options in the runner configuration 2024-03-23 17:57:35 -03:00
ede4f2d8f4
PR#3 review: remove <filename> from --help + formatting changes
ran clang-format on suyu_cmd/suyu.cpp
and removed one blank line on library_applet_accessor.cpp so formatting CI doesn't complain
2024-03-23 16:40:29 -04:00
cb9f9da7b6 Merge branch 'dev' into dev-fork 2024-03-23 20:41:24 +01:00
bce23c24e0
PR#3 review: fix -l arg breaking
because optarg goes NULL when encountering an optional argument, so I have to do this instead to get the argument. See case 'p'.
2024-03-23 14:51:33 -04:00
caa93cda48
PR#3 review: (hopefully) unfuck formatting changes
squash: re-deanonymize AppletIdToProgramId()
2024-03-23 00:52:56 -04:00
f9c3b8dc75
PR#3 review: -l's arg is now optional 2024-03-23 00:28:01 -04:00
1ed34b1e47 suyu_cmd: allow launching of applets by supplying FrontendAppletParameters as an arg
Based off of a patch i saved before I nuked my local copy of the suyu repo from gitlab and replaced it with the one local-hosted
2024-03-23 03:32:14 +01:00
18 changed files with 189 additions and 138 deletions

View file

@ -1,6 +1,7 @@
#!/bin/bash -ex
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
# SPDX-FileCopyrightText: 2024 suyu Emulator Project
# SPDX-License-Identifier: GPL-3.0-or-later
export NDK_CCACHE="$(which ccache)"
@ -9,7 +10,7 @@ ccache -s
BUILD_FLAVOR="mainline"
BUILD_TYPE="release"
if [ "${GITHUB_REPOSITORY}" == "suyu-emu/suyu" ]; then
if [ "${GITHUB_REPOSITORY}" == "suyu/suyu" ]; then
BUILD_TYPE="relWithDebInfo"
fi

View file

@ -11,7 +11,7 @@ BUILD_FLAVOR="mainline"
BUILD_TYPE_LOWER="release"
BUILD_TYPE_UPPER="Release"
if [ "${GITHUB_REPOSITORY}" == "suyu-emu/suyu" ]; then
if [ "${GITHUB_REPOSITORY}" == "suyu/suyu" ]; then
BUILD_TYPE_LOWER="relWithDebInfo"
BUILD_TYPE_UPPER="RelWithDebInfo"
fi

View file

@ -1,19 +1,22 @@
#!/bin/bash -ex
# SPDX-FileCopyrightText: 2021 yuzu Emulator Project
# SPDX-FileCopyrightText: 2024 suyu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# Exit on error, rather than continuing with the rest of the script.
set -e
ccache -s
ccache -sv
mkdir build || true && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DSUYU_USE_PRECOMPILED_HEADERS=OFF \
-DDYNARMIC_USE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_CXX_FLAGS="-march=x86-64-v2" \
-DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ \
-DCMAKE_C_COMPILER=/usr/lib/ccache/clang \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DCMAKE_C_COMPILER=/usr/bin/clang \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DDISPLAY_VERSION=$1 \
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \
@ -22,11 +25,12 @@ cmake .. \
-DSUYU_CRASH_DUMPS=ON \
-DSUYU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \
-DSUYU_USE_BUNDLED_FFMPEG=ON \
-DSUYU_USE_FASTER_LD=ON \
-GNinja
ninja
ccache -s
ccache -sv
ctest -VV -C Release

View file

@ -6,7 +6,7 @@
# Exit on error, rather than continuing with the rest of the script.
set -e
ccache -s
ccache -sv
mkdir build || true && cd build
cmake .. \
@ -15,8 +15,8 @@ cmake .. \
-DSUYU_USE_PRECOMPILED_HEADERS=OFF \
-DDYNARMIC_USE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_CXX_FLAGS="-march=x86-64-v2" \
-DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \
-DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \
-DCMAKE_CXX_COMPILER=/usr/local/bin/g++ \
-DCMAKE_C_COMPILER=/usr/local/bin/gcc \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DDISPLAY_VERSION=$1 \
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF \
@ -24,14 +24,14 @@ cmake .. \
-DUSE_DISCORD_PRESENCE=ON \
-DSUYU_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \
-DSUYU_USE_BUNDLED_FFMPEG=ON \
-DSUYU_ENABLE_LTO=ON \
-DSUYU_ENABLE_LTO=OFF \
-DSUYU_CRASH_DUMPS=ON \
-DSUYU_USE_FASTER_LD=ON \
-GNinja
ninja
ccache -s
ccache -sv
ctest -VV -C Release

View file

@ -16,8 +16,8 @@ on:
- 'externals/**'
- 'CMakeLists.txt'
- 'vcpkg.json'
paths-ignore:
- 'src/android/**'
# paths-ignore:
# - 'src/android/**'
push:
branches: [ "dev" ]
paths:
@ -27,12 +27,13 @@ on:
- 'externals/**'
- 'CMakeLists.txt'
- 'vcpkg.json'
paths-ignore:
- 'src/android/**'
- '.forgejo/workflows/verify.yml'
- '.ci/**'
# paths-ignore:
# - 'src/android/**'
env:
PR_NUMBER: pr${{ github.event.number }}
CCACHE_DIR: '.ccache'
jobs:
format:
@ -76,13 +77,13 @@ jobs:
uses: https://code.forgejo.org/actions/cache@v3
id: ccache-restore
with:
path: .ccache
path: ~/.ccache
key: ${{ runner.os }}-${{ matrix.type }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.type }}-
- name: Create ccache directory
if: steps.ccache-restore.outputs.cache-hit != 'true'
run: mkdir -p .ccache
run: mkdir -p ~/.ccache
- name: Build
run: ./.ci/scripts/${{ matrix.type }}/docker.sh
env:
@ -173,47 +174,44 @@ jobs:
# with:
# name: ${{ env.INDIVIDUAL_EXE }}
# path: ${{ env.INDIVIDUAL_EXE }}
# android:
# runs-on: ubuntu-latest
# needs: format
# steps:
# - uses: https://code.forgejo.org/actions/checkout@v3
# with:
# submodules: recursive
# fetch-depth: 0
# - name: set up JDK 17
# uses: https://github.com/actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
# - name: Set up cache
# uses: https://code.forgejo.org/actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# .ccache
# key: ${{ runner.os }}-android-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-android-
# - name: Query tag name
# uses: https://github.com/olegtarasov/get-tag@v2.1.2
# id: tagName
# - name: Install dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y ccache apksigner glslang-dev glslang-tools
# - name: Build
# run: ./.ci/scripts/android/build.sh
# - name: Copy and sign artifacts
# env:
# ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
# ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
# ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
# run: ./.ci/scripts/android/upload.sh
# - name: Upload
# uses: https://code.forgejo.org/actions/upload-artifact@v3
# with:
# name: android
# path: artifacts/
android:
runs-on: ubuntu-latest
container: fijxu/build-environments:android
needs: format
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: set up JDK 17
uses: https://github.com/actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up cache
uses: https://code.forgejo.org/actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.ccache
key: ${{ runner.os }}-android-${{ github.sha }}
restore-keys: |
${{ runner.os }}-android-
- name: Query tag name
uses: https://github.com/olegtarasov/get-tag@v2.1.2
id: tagName
- name: Build
run: ./.ci/scripts/android/build.sh
- name: Copy and sign artifacts
env:
ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }}
run: ./.ci/scripts/android/upload.sh
- name: Upload
uses: https://code.forgejo.org/actions/upload-artifact@v3
with:
name: android
path: artifacts/

View file

@ -132,7 +132,7 @@ if (SUYU_USE_BUNDLED_VCPKG)
set(VCPKG_DOWNLOADS_PATH ${PROJECT_SOURCE_DIR}/externals/vcpkg/downloads)
set(NASM_VERSION "2.16.01")
set(NASM_DESTINATION_PATH ${VCPKG_DOWNLOADS_PATH}/nasm-${NASM_VERSION}-win64.zip)
set(NASM_DOWNLOAD_URL "https://gitlab.com/suyu-emu/ext-windows-bin/raw/master/nasm/nasm-${NASM_VERSION}-win64.zip")
set(NASM_DOWNLOAD_URL "https://git.suyu.dev/suyu/ext-windows-bin/raw/branch/master/nasm/nasm-${NASM_VERSION}-win64.zip")
if (NOT EXISTS ${NASM_DESTINATION_PATH})
file(DOWNLOAD ${NASM_DOWNLOAD_URL} ${NASM_DESTINATION_PATH} SHOW_PROGRESS STATUS NASM_STATUS)
@ -374,8 +374,6 @@ if(ENABLE_QT6 AND Qt6_LOCATION)
list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}")
endif()
# QT6 searches for Vulkan::Headers, too, so we have to define it before QT6 has a chance to do it.
add_subdirectory(externals)
function(set_suyu_qt_components)
# Best practice is to ask for all components at once, so they are from the same version
@ -632,7 +630,7 @@ if (NOT CLANG_FORMAT)
message(STATUS "Clang format not found! Downloading...")
set(CLANG_FORMAT "${PROJECT_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe")
file(DOWNLOAD
https://gitlab.com/suyu-emu/ext-windows-bin/raw/master/clang-format${CLANG_FORMAT_POSTFIX}.exe
https://git.suyu.dev/suyu/ext-windows-bin/raw/branch/master/clang-format${CLANG_FORMAT_POSTFIX}.exe
"${CLANG_FORMAT}" SHOW_PROGRESS
STATUS DOWNLOAD_SUCCESS)
if (NOT DOWNLOAD_SUCCESS EQUAL 0)
@ -712,6 +710,7 @@ if (SUYU_USE_FASTER_LD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
endif()
add_subdirectory(externals)
add_subdirectory(src)
# Set suyu project or suyu-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not

View file

@ -7,21 +7,21 @@
# prefix_var: name of a variable which will be set with the path to the extracted contents
function(download_bundled_external remote_path lib_name prefix_var)
set(package_base_url "https://git.suyu.dev/suyu")
set(package_base_url "https://git.suyu.dev/suyu/")
set(package_repo "no_platform")
set(package_extension "no_platform")
set(package_head "?ref_type=heads")
if (WIN32)
set(package_repo "ext-windows-bin/-/raw/master/")
set(package_repo "ext-windows-bin/raw/branch/master/")
set(package_extension ".7z")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(package_repo "ext-linux-bin/-/raw/main/")
set(package_repo "ext-linux-bin/raw/branch/main/")
set(package_extension ".tar.xz")
# elseif (APPLE)
# set(package_repo "ext-osx-bin/-/raw/main/")
# set(package_extension ".dmg")
elseif (ANDROID)
set(package_repo "ext-android-bin/-/raw/main/")
set(package_repo "ext-android-bin/raw/branch/main/")
set(package_extension ".tar.xz")
else()
message(FATAL_ERROR "No package available for this platform")

View file

@ -57,6 +57,8 @@ You can also contact any of the developers on Discord to learn more about the cu
* __macOS__: [Releases](https://git.suyu.dev/suyu/suyu/releases)
* __Android__: [Releases](https://git.suyu.dev/suyu/suyu/releases)
If you want daily builds then go here. https://git.suyu.dev/suyu/suyu/actions
We have official builds [here.](https://git.suyu.dev/suyu/suyu/releases) If any website or person is claiming to have a build for suyu, take that with a grain of salt.
## Building

View file

@ -241,6 +241,8 @@ abstract class SettingsItem(
IntSetting.FSR_SHARPENING_SLIDER,
titleId = R.string.fsr_sharpness,
descriptionId = R.string.fsr_sharpness_description,
min = 0,
max = 200,
units = "%"
)
)
@ -327,6 +329,8 @@ abstract class SettingsItem(
ByteSetting.AUDIO_VOLUME,
titleId = R.string.audio_volume,
descriptionId = R.string.audio_volume_description,
min = 0,
max = 120,
units = "%"
)
)

View file

@ -142,6 +142,7 @@
<item>@string/ratio_force_four_three</item>
<item>@string/ratio_force_twenty_one_nine</item>
<item>@string/ratio_force_sixteen_ten</item>
<item>@string/ratio_force_thirty_two_nine</item>
<item>@string/ratio_stretch</item>
</string-array>
@ -151,6 +152,7 @@
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</integer-array>
<string-array name="rendererScalingFilterNames">

View file

@ -601,6 +601,7 @@
<string name="ratio_force_four_three">Force 4:3</string>
<string name="ratio_force_twenty_one_nine">Force 21:9</string>
<string name="ratio_force_sixteen_ten">Force 16:10</string>
<string name="ratio_force_thirty_two_nine">Force 32:9</string>
<string name="ratio_stretch">Stretch to window</string>
<!-- CPU Backend -->

View file

@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
@ -336,8 +335,4 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) {
applet->process->Run();
}
void AppletManager::ReTrackApplication(std::shared_ptr<Applet> applet) {
m_window_system->RequestApplicationToGetForeground();
}
} // namespace Service::AM

View file

@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
@ -47,7 +46,6 @@ public:
public:
void SetWindowSystem(WindowSystem* window_system);
void ReTrackApplication(std::shared_ptr<Applet> applet);
private:
Core::System& m_system;

View file

@ -1,5 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/applet_data_broker.h"
@ -102,12 +101,6 @@ Result ILibraryAppletAccessor::PushInData(SharedPointer<IStorage> storage) {
Result ILibraryAppletAccessor::PopOutData(Out<SharedPointer<IStorage>> out_storage) {
LOG_DEBUG(Service_AM, "called");
if(!m_applet->caller_applet.expired()) {
LOG_DEBUG(Service_AM, "resuming caller");
system.GetAppletManager().ReTrackApplication(m_applet->caller_applet.lock());
} else {
LOG_CRITICAL(Service_AM, "Failed to track application. The emulator will freeze!");
}
R_RETURN(m_broker->GetOutData().Pop(out_storage.Get()));
}

View file

@ -47,53 +47,6 @@ bool ShouldCreateGuestApplet(AppletId applet_id) {
return true;
}
AppletProgramId AppletIdToProgramId(AppletId applet_id) {
switch (applet_id) {
case AppletId::OverlayDisplay:
return AppletProgramId::OverlayDisplay;
case AppletId::QLaunch:
return AppletProgramId::QLaunch;
case AppletId::Starter:
return AppletProgramId::Starter;
case AppletId::Auth:
return AppletProgramId::Auth;
case AppletId::Cabinet:
return AppletProgramId::Cabinet;
case AppletId::Controller:
return AppletProgramId::Controller;
case AppletId::DataErase:
return AppletProgramId::DataErase;
case AppletId::Error:
return AppletProgramId::Error;
case AppletId::NetConnect:
return AppletProgramId::NetConnect;
case AppletId::ProfileSelect:
return AppletProgramId::ProfileSelect;
case AppletId::SoftwareKeyboard:
return AppletProgramId::SoftwareKeyboard;
case AppletId::MiiEdit:
return AppletProgramId::MiiEdit;
case AppletId::Web:
return AppletProgramId::Web;
case AppletId::Shop:
return AppletProgramId::Shop;
case AppletId::PhotoViewer:
return AppletProgramId::PhotoViewer;
case AppletId::Settings:
return AppletProgramId::Settings;
case AppletId::OfflineWeb:
return AppletProgramId::OfflineWeb;
case AppletId::LoginShare:
return AppletProgramId::LoginShare;
case AppletId::WebAuth:
return AppletProgramId::WebAuth;
case AppletId::MyPage:
return AppletProgramId::MyPage;
default:
return static_cast<AppletProgramId>(0);
}
}
std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system,
WindowSystem& window_system,
std::shared_ptr<Applet> caller_applet,
@ -163,6 +116,53 @@ std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet(Core::System& syste
} // namespace
AppletProgramId AppletIdToProgramId(AppletId applet_id) {
switch (applet_id) {
case AppletId::OverlayDisplay:
return AppletProgramId::OverlayDisplay;
case AppletId::QLaunch:
return AppletProgramId::QLaunch;
case AppletId::Starter:
return AppletProgramId::Starter;
case AppletId::Auth:
return AppletProgramId::Auth;
case AppletId::Cabinet:
return AppletProgramId::Cabinet;
case AppletId::Controller:
return AppletProgramId::Controller;
case AppletId::DataErase:
return AppletProgramId::DataErase;
case AppletId::Error:
return AppletProgramId::Error;
case AppletId::NetConnect:
return AppletProgramId::NetConnect;
case AppletId::ProfileSelect:
return AppletProgramId::ProfileSelect;
case AppletId::SoftwareKeyboard:
return AppletProgramId::SoftwareKeyboard;
case AppletId::MiiEdit:
return AppletProgramId::MiiEdit;
case AppletId::Web:
return AppletProgramId::Web;
case AppletId::Shop:
return AppletProgramId::Shop;
case AppletId::PhotoViewer:
return AppletProgramId::PhotoViewer;
case AppletId::Settings:
return AppletProgramId::Settings;
case AppletId::OfflineWeb:
return AppletProgramId::OfflineWeb;
case AppletId::LoginShare:
return AppletProgramId::LoginShare;
case AppletId::WebAuth:
return AppletProgramId::WebAuth;
case AppletId::MyPage:
return AppletProgramId::MyPage;
default:
return static_cast<AppletProgramId>(0);
}
}
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet,
WindowSystem& window_system)
: ServiceFramework{system_, "ILibraryAppletCreator"},

View file

@ -35,4 +35,6 @@ private:
const std::shared_ptr<Applet> m_applet;
};
AppletProgramId AppletIdToProgramId(AppletId applet_id);
} // namespace Service::AM

View file

@ -24,7 +24,8 @@ DiscordImpl::DiscordImpl(Core::System& system_) : system{system_} {
DiscordEventHandlers handlers{};
// The number is the client ID for suyu, it's used for images and the
// application name
Discord_Initialize("712465656758665259", &handlers, 1, nullptr);
// NOTE: This application is owned by million1156 (million@alyocord.com)
Discord_Initialize("1221314350216646828", &handlers, 1, nullptr);
}
DiscordImpl::~DiscordImpl() {

View file

@ -5,6 +5,7 @@
#include <iostream>
#include <memory>
#include <regex>
#include <sstream>
#include <string>
#include <thread>
@ -23,9 +24,12 @@
#include "core/core_timing.h"
#include "core/cpu_manager.h"
#include "core/crypto/key_manager.h"
#include "core/file_sys/content_archive.h"
#include "core/file_sys/nca_metadata.h"
#include "core/file_sys/registered_cache.h"
#include "core/file_sys/vfs/vfs_real.h"
#include "core/hle/service/am/applet_manager.h"
#include "core/hle/service/am/service/library_applet_creator.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/loader/loader.h"
#include "frontend_common/config.h"
@ -68,7 +72,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
static void PrintHelp(const char* argv0) {
std::cout << "Usage: " << argv0
<< " [options] <filename>\n"
<< " [options]\n"
"-c, --config Load the specified configuration file\n"
"-f, --fullscreen Start in fullscreen mode\n"
"-g, --game File path of the game to load\n"
@ -77,7 +81,13 @@ static void PrintHelp(const char* argv0) {
" Nickname, password, address and port for multiplayer\n"
"-p, --program Pass following string as arguments to executable\n"
"-u, --user Select a specific user profile from 0 to 7\n"
"-v, --version Output version information and exit\n";
"-v, --version Output version information and exit\n"
"-l, "
"--applet-params="
"\"program_id,applet_id,applet_type,launch_type,prog_index,prev_prog_index\"\n"
" Numerical parameters for launching an applet. If no\n"
" game is provided, then the applet will launch off of\n"
" the applet_id.\n";
}
static void PrintVersion() {
@ -212,6 +222,7 @@ int main(int argc, char** argv) {
bool use_multiplayer = false;
bool fullscreen = false;
Service::AM::FrontendAppletParameters load_parameters{};
std::string nickname{};
std::string password{};
std::string address{};
@ -223,6 +234,7 @@ int main(int argc, char** argv) {
{"fullscreen", no_argument, 0, 'f'},
{"help", no_argument, 0, 'h'},
{"game", required_argument, 0, 'g'},
{"applet-params", optional_argument, 0, 'l'},
{"multiplayer", required_argument, 0, 'm'},
{"program", optional_argument, 0, 'p'},
{"user", required_argument, 0, 'u'},
@ -232,7 +244,7 @@ int main(int argc, char** argv) {
};
while (optind < argc) {
int arg = getopt_long(argc, argv, "g:fhvp::c:u:", long_options, &option_index);
int arg = getopt_long(argc, argv, "g:fhvp::c:u:l::", long_options, &option_index);
if (arg != -1) {
switch (static_cast<char>(arg)) {
case 'c':
@ -250,6 +262,27 @@ int main(int argc, char** argv) {
filepath = str_arg;
break;
}
case 'l': {
std::string str_arg(argv[optind++]);
str_arg.append(",0"); // FALLBACK: if string is partially completed ("1234,3")
// this will set all those unset to 0. otherwise we get
// all 3s.
std::stringstream stream(str_arg);
std::string sub;
std::getline(stream, sub, ',');
load_parameters.program_id = std::stoull(sub);
std::getline(stream, sub, ',');
load_parameters.applet_id = static_cast<Service::AM::AppletId>(std::stoul(sub));
std::getline(stream, sub, ',');
load_parameters.applet_type = static_cast<Service::AM::AppletType>(std::stoi(sub));
std::getline(stream, sub, ',');
load_parameters.launch_type = static_cast<Service::AM::LaunchType>(std::stoi(sub));
std::getline(stream, sub, ',');
load_parameters.program_index = std::stoi(sub);
std::getline(stream, sub, ',');
load_parameters.previous_program_index = std::stoi(sub);
break;
}
case 'm': {
use_multiplayer = true;
const std::string str_arg(optarg);
@ -331,7 +364,7 @@ int main(int argc, char** argv) {
Common::ConfigureNvidiaEnvironmentFlags();
if (filepath.empty()) {
if (filepath.empty() && !static_cast<u32>(load_parameters.applet_id)) {
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
return -1;
}
@ -367,9 +400,27 @@ int main(int argc, char** argv) {
system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
system.GetUserChannel().clear();
Service::AM::FrontendAppletParameters load_parameters{
.applet_id = Service::AM::AppletId::Application,
};
if (static_cast<u32>(load_parameters.applet_id)) {
// code below based off of suyu/main.cpp : GMainWindow::OnHomeMenu()
Service::AM::AppletProgramId applet_prog_id =
Service::AM::AppletIdToProgramId(load_parameters.applet_id);
auto sysnand = system.GetFileSystemController().GetSystemNANDContents();
if (!sysnand) {
LOG_CRITICAL(Frontend, "Failed to load applet: Firmware not installed.");
return -1;
}
auto user_applet_nca = sysnand->GetEntry(static_cast<u64>(applet_prog_id),
FileSys::ContentRecordType::Program);
if (!user_applet_nca) {
LOG_CRITICAL(Frontend, "Failed to load applet: applet cannot be found.");
return -1;
}
if (filepath.empty())
filepath = user_applet_nca->GetFullPath();
} else {
load_parameters.applet_id = Service::AM::AppletId::Application;
}
const Core::SystemResultStatus load_result{system.Load(*emu_window, filepath, load_parameters)};
switch (load_result) {