mirror of
https://github.com/XorTroll/uLaunch.git
synced 2024-11-27 03:20:34 +00:00
Use arc for result stuff
This commit is contained in:
parent
217d3de6cf
commit
dc0957357a
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@ SdOut/
|
||||
*.nacp
|
||||
*.nro
|
||||
*.lst
|
||||
*.gen.hpp
|
||||
.vs/
|
||||
bin/
|
||||
obj/
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -4,3 +4,6 @@
|
||||
[submodule "Atmosphere-libs"]
|
||||
path = libs/Atmosphere-libs
|
||||
url = https://github.com/Atmosphere-NX/Atmosphere-libs
|
||||
[submodule "arc"]
|
||||
path = arc
|
||||
url = https://github.com/XorTroll/arc
|
||||
|
8
Makefile
8
Makefile
@ -5,15 +5,19 @@ VERSION := $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)
|
||||
|
||||
export UL_DEFS := -DUL_VERSION=\"$(VERSION)\"
|
||||
|
||||
.PHONY: all fresh clean pu usystem uloader umenu umanager uscreen
|
||||
.PHONY: all fresh clean pu arc usystem uloader umenu umanager uscreen
|
||||
|
||||
all: usystem uloader umenu umanager uscreen
|
||||
all: arc usystem uloader umenu umanager uscreen
|
||||
|
||||
fresh: clean all
|
||||
|
||||
pu:
|
||||
@$(MAKE) -C libs/Plutonium/
|
||||
|
||||
arc:
|
||||
@python arc/arc.py gen_db default+./libs/uCommon/include/ul/ul_Results.rc.hpp
|
||||
@python arc/arc.py gen_cpp rc UL ./libs/uCommon/include/ul/ul_Results.gen.hpp
|
||||
|
||||
clean:
|
||||
@$(MAKE) clean -C projects/uSystem
|
||||
@$(MAKE) clean -C projects/uLoader
|
||||
|
1
arc
Submodule
1
arc
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 44cf5deecb2dc01b884e745206e51931684ad926
|
BIN
assets/default/Cursor.xcf
Normal file
BIN
assets/default/Cursor.xcf
Normal file
Binary file not shown.
Binary file not shown.
@ -18,13 +18,17 @@
|
||||
#ifndef INCLUDE_NLOHMANN_JSON_HPP_
|
||||
#define INCLUDE_NLOHMANN_JSON_HPP_
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Custom config for this project
|
||||
|
||||
#include <ul/ul_Result.hpp>
|
||||
#define JSON_THROW_USER(exception) ::ul::OnAssertionFailed(::ul::res::ResultAssertionFailed, "JSON libraries threw " #exception "...\n")
|
||||
#define JSON_THROW_USER(exception) ::ul::OnAssertionFailed(::rc::ulaunch::ResultAssertionFailed, "JSON libraries threw " #exception "...\n")
|
||||
#define JSON_TRY_USER if(true)
|
||||
#define JSON_CATCH_USER(exception) if(false)
|
||||
#define JSON_INTERNAL_CATCH_USER(exception) if(false)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm> // all_of, find, for_each
|
||||
#include <cstddef> // nullptr_t, ptrdiff_t, size_t
|
||||
#include <functional> // hash, less
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/loader/loader_TargetTypes.hpp>
|
||||
#include <ul/smi/smi_Results.hpp>
|
||||
#include <ul/ul_Result.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace ul::smi {
|
||||
|
@ -1,15 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::smi {
|
||||
|
||||
UL_RC_DEFINE_SUBMODULE(1);
|
||||
|
||||
UL_RC_DEFINE(OutOfPushSpace, 1);
|
||||
UL_RC_DEFINE(OutOfPopSpace, 2);
|
||||
UL_RC_DEFINE(InvalidInHeaderMagic, 3);
|
||||
UL_RC_DEFINE(InvalidOutHeaderMagic, 4);
|
||||
UL_RC_DEFINE(WaitTimeout, 5);
|
||||
|
||||
}
|
@ -6,38 +6,15 @@
|
||||
#include <stratosphere.hpp>
|
||||
#endif
|
||||
|
||||
#include <ul/ul_Results.gen.hpp>
|
||||
|
||||
namespace ul {
|
||||
|
||||
// All 2380-**** results are from us
|
||||
|
||||
constexpr u32 Module = 380;
|
||||
constexpr u32 SubmoduleOffset = 100;
|
||||
|
||||
#define UL_RC_DEFINE_SUBMODULE(val) constexpr u32 Submodule = val
|
||||
#define UL_RC_DEFINE(name, val) constexpr Result Result ## name = MAKERESULT(Module, Submodule * SubmoduleOffset + val)
|
||||
|
||||
constexpr Result ResultSuccess = 0;
|
||||
|
||||
/*
|
||||
|
||||
Result submodules:
|
||||
0 -> misc
|
||||
1 -> smi
|
||||
2 -> sf (ipc)
|
||||
3 -> loader
|
||||
4 -> smi
|
||||
5 -> util
|
||||
6 -> menu
|
||||
|
||||
*/
|
||||
using namespace rc;
|
||||
using namespace rc::ulaunch;
|
||||
|
||||
namespace res {
|
||||
|
||||
UL_RC_DEFINE_SUBMODULE(0);
|
||||
|
||||
UL_RC_DEFINE(AssertionFailed, 1);
|
||||
UL_RC_DEFINE(InvalidTransform, 2);
|
||||
|
||||
template<typename T>
|
||||
inline ::Result TransformIntoResult(const T t) {
|
||||
return static_cast<::Result>(t);
|
||||
@ -45,7 +22,7 @@ namespace ul {
|
||||
|
||||
#ifdef ATMOSPHERE
|
||||
template<>
|
||||
inline ::Result TransformIntoResult<ams::Result>(const ams::Result ams_rc) {
|
||||
inline ::Result TransformIntoResult<::ams::Result>(const ::ams::Result ams_rc) {
|
||||
return ams_rc.GetValue();
|
||||
}
|
||||
#endif
|
||||
@ -90,7 +67,7 @@ namespace ul {
|
||||
#define UL_ASSERT_TRUE(expr) ({ \
|
||||
const auto _tmp_expr = (expr); \
|
||||
if(!_tmp_expr) { \
|
||||
::ul::OnAssertionFailed(::ul::res::ResultAssertionFailed, #expr " asserted to be false...\n"); \
|
||||
::ul::OnAssertionFailed(::rc::ulaunch::ResultAssertionFailed, #expr " asserted to be false...\n"); \
|
||||
} \
|
||||
})
|
||||
|
||||
|
38
libs/uCommon/include/ul/ul_Results.rc.hpp
Normal file
38
libs/uCommon/include/ul/ul_Results.rc.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
R_DEFINE_NAMESPACE_RESULT_MODULE(ulaunch, 380);
|
||||
|
||||
namespace ulaunch {
|
||||
|
||||
R_DEFINE_ERROR_RANGE(Misc, 1, 99);
|
||||
R_DEFINE_ERROR_RESULT(AssertionFailed, 1);
|
||||
R_DEFINE_ERROR_RESULT(InvalidTransform, 2);
|
||||
|
||||
R_DEFINE_ERROR_RANGE(Smi, 101, 199);
|
||||
R_DEFINE_ERROR_RESULT(OutOfPushSpace, 101);
|
||||
R_DEFINE_ERROR_RESULT(OutOfPopSpace, 102);
|
||||
R_DEFINE_ERROR_RESULT(InvalidInHeaderMagic, 103);
|
||||
R_DEFINE_ERROR_RESULT(InvalidOutHeaderMagic, 104);
|
||||
R_DEFINE_ERROR_RESULT(WaitTimeout, 105);
|
||||
|
||||
R_DEFINE_ERROR_RANGE(SystemSf, 201, 299);
|
||||
R_DEFINE_ERROR_RESULT(InvalidProcess, 201);
|
||||
R_DEFINE_ERROR_RESULT(NoMessagesAvailable, 202);
|
||||
|
||||
R_DEFINE_ERROR_RANGE(Loader, 301, 399);
|
||||
R_DEFINE_ERROR_RESULT(InvalidProcessType, 301);
|
||||
R_DEFINE_ERROR_RESULT(InvalidTargetInputMagic, 302);
|
||||
R_DEFINE_ERROR_RESULT(InvalidTargetInputSize, 303);
|
||||
|
||||
R_DEFINE_ERROR_RANGE(SystemSmi, 401, 499);
|
||||
R_DEFINE_ERROR_RESULT(ApplicationActive, 401);
|
||||
R_DEFINE_ERROR_RESULT(InvalidSelectedUser, 402);
|
||||
R_DEFINE_ERROR_RESULT(AlreadyQueued, 403);
|
||||
R_DEFINE_ERROR_RESULT(ApplicationNotActive, 404);
|
||||
R_DEFINE_ERROR_RESULT(NoHomebrewTakeoverApplication, 405);
|
||||
|
||||
R_DEFINE_ERROR_RANGE(Util, 501, 599);
|
||||
R_DEFINE_ERROR_RESULT(InvalidJson, 501);
|
||||
|
||||
R_DEFINE_ERROR_RANGE(Menu, 601, 699);
|
||||
R_DEFINE_ERROR_RESULT(RomfsNotFound, 601);
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::util {
|
||||
|
||||
UL_RC_DEFINE_SUBMODULE(5);
|
||||
|
||||
UL_RC_DEFINE(InvalidJson, 1);
|
||||
|
||||
}
|
@ -41,6 +41,5 @@ namespace ul::util {
|
||||
|
||||
std::string FormatAccount(const AccountUid value);
|
||||
std::string FormatResultDisplay(const Result rc);
|
||||
std::string FormatResultHex(const Result rc);
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#include <ul/util/util_Json.hpp>
|
||||
#include <ul/fs/fs_Stdio.hpp>
|
||||
#include <ul/util/util_Results.hpp>
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::util {
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <ul/util/util_String.hpp>
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::util {
|
||||
|
||||
@ -37,14 +38,17 @@ namespace ul::util {
|
||||
}
|
||||
|
||||
std::string FormatResultDisplay(const Result rc) {
|
||||
char res[0x20] = {};
|
||||
sprintf(res, "%04d-%04d", R_MODULE(rc) + 2000, R_DESCRIPTION(rc));
|
||||
return res;
|
||||
}
|
||||
char res[0x40] = {};
|
||||
|
||||
std::string FormatResultHex(const Result rc) {
|
||||
char res[0x20] = {};
|
||||
sprintf(res, "0x%X", rc);
|
||||
const char *mod_name;
|
||||
const char *rc_name;
|
||||
if(rc::GetResultNameAny(rc, mod_name, rc_name)) {
|
||||
sprintf(res, "%04d-%04d/0x%X/%s::%s", R_MODULE(rc) + 2000, R_DESCRIPTION(rc), R_VALUE(rc), mod_name, rc_name);
|
||||
}
|
||||
else {
|
||||
sprintf(res, "%04d-%04d/0x%X", R_MODULE(rc) + 2000, R_DESCRIPTION(rc), R_VALUE(rc));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::loader {
|
||||
|
||||
UL_RC_DEFINE_SUBMODULE(3);
|
||||
|
||||
UL_RC_DEFINE(InvalidProcessType, 1);
|
||||
UL_RC_DEFINE(InvalidTargetInputMagic, 2);
|
||||
UL_RC_DEFINE(InvalidTargetInputSize, 3);
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
#include <ul/loader/loader_Input.hpp>
|
||||
#include <ul/loader/loader_ProgramIdUtils.hpp>
|
||||
#include <ul/loader/loader_Results.hpp>
|
||||
#include <ul/ul_Result.hpp>
|
||||
#include <ul/util/util_Scope.hpp>
|
||||
#include <ul/util/util_String.hpp>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 6.8 KiB |
@ -1,11 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::menu {
|
||||
|
||||
UL_RC_DEFINE_SUBMODULE(6);
|
||||
|
||||
UL_RC_DEFINE(RomfsNotFound, 1);
|
||||
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 8.0 KiB |
@ -7,7 +7,6 @@
|
||||
#include <ul/menu/smi/smi_MenuMessageHandler.hpp>
|
||||
#include <ul/menu/am/am_LibraryAppletUtils.hpp>
|
||||
#include <ul/menu/am/am_LibnxLibappletWrap.hpp>
|
||||
#include <ul/menu/menu_Results.hpp>
|
||||
|
||||
using namespace ul::util::size;
|
||||
|
||||
@ -79,7 +78,7 @@ int main() {
|
||||
|
||||
// Check if our RomFs data exists...
|
||||
if(!ul::fs::ExistsFile(RomfsFile)) {
|
||||
UL_RC_ASSERT(ul::menu::ResultRomfsNotFound);
|
||||
UL_RC_ASSERT(ul::ResultRomfsNotFound);
|
||||
}
|
||||
|
||||
// Try to mount it
|
||||
|
@ -26,7 +26,7 @@ namespace ul::menu::ui {
|
||||
}
|
||||
case smi::MenuMessage::GameCardMountFailure: {
|
||||
// TODO: move somewhere else?
|
||||
g_MenuApplication->DisplayDialog(GetLanguageString("gamecard"), GetLanguageString("gamecard_mount_failed") + " " + util::FormatResultHex(first_msg.gc_mount_failure.mount_rc), { GetLanguageString("ok") }, true);
|
||||
g_MenuApplication->DisplayDialog(GetLanguageString("gamecard"), GetLanguageString("gamecard_mount_failed") + " " + util::FormatResultDisplay(first_msg.gc_mount_failure.mount_rc), { GetLanguageString("ok") }, true);
|
||||
this->msg_queue.pop();
|
||||
break;
|
||||
}
|
||||
|
@ -5,15 +5,15 @@
|
||||
|
||||
namespace ul::system::sf {
|
||||
|
||||
struct MenuMessageContext : ams::sf::LargeData, ams::sf::PrefersMapAliasTransferMode {
|
||||
struct MenuMessageContext : ::ams::sf::LargeData, ::ams::sf::PrefersMapAliasTransferMode {
|
||||
smi::MenuMessageContext actual_ctx;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#define UL_SYSTEM_SF_I_PRIVATE_SERVICE_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, Initialize, (const ams::sf::ClientProcessId &client_pid), (client_pid)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, TryPopMessageContext, (ams::sf::Out<::ul::system::sf::MenuMessageContext> out_msg), (out_msg))
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, Initialize, (const ::ams::sf::ClientProcessId &client_pid), (client_pid)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, TryPopMessageContext, (::ams::sf::Out<::ul::system::sf::MenuMessageContext> out_msg), (out_msg))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::ul::system::sf, IPrivateService, UL_SYSTEM_SF_I_PRIVATE_SERVICE_INTERFACE_INFO, 0xCAFEBABE)
|
||||
|
||||
@ -26,9 +26,9 @@ namespace ul::system::sf {
|
||||
public:
|
||||
PrivateService() : initialized(false) {}
|
||||
|
||||
ams::Result Initialize(const ams::sf::ClientProcessId &client_pid);
|
||||
ams::Result TryPopMessageContext(ams::sf::Out<MenuMessageContext> out_msg);
|
||||
::ams::Result Initialize(const ::ams::sf::ClientProcessId &client_pid);
|
||||
::ams::Result TryPopMessageContext(::ams::sf::Out<MenuMessageContext> out_msg);
|
||||
};
|
||||
static_assert(ams::ul::system::sf::IsIPrivateService<PrivateService>);
|
||||
static_assert(::ams::ul::system::sf::IsIPrivateService<PrivateService>);
|
||||
|
||||
}
|
@ -7,8 +7,8 @@ namespace ul::system::sf {
|
||||
|
||||
// Note: domains and pointer buffer are required since ECS sessions will make use of them (like normal fs interfaces)
|
||||
|
||||
using Allocator = ams::sf::ExpHeapAllocator;
|
||||
using ObjectFactory = ams::sf::ObjectFactory<ams::sf::ExpHeapAllocator::Policy>;
|
||||
using Allocator = ::ams::sf::ExpHeapAllocator;
|
||||
using ObjectFactory = ::ams::sf::ObjectFactory<::ams::sf::ExpHeapAllocator::Policy>;
|
||||
|
||||
struct ServerOptions {
|
||||
static constexpr size_t PointerBufferSize = 0x800;
|
||||
@ -26,25 +26,25 @@ namespace ul::system::sf {
|
||||
};
|
||||
|
||||
constexpr size_t MaxPrivateSessions = 1;
|
||||
constexpr ams::sm::ServiceName PrivateServiceName = ams::sm::ServiceName::Encode(ul::sf::PrivateServiceName);
|
||||
constexpr ::ams::sm::ServiceName PrivateServiceName = ::ams::sm::ServiceName::Encode(ul::sf::PrivateServiceName);
|
||||
|
||||
/*
|
||||
constexpr size_t MaxPublicSessions = 0x20;
|
||||
constexpr ams::sm::ServiceName PublicServiceName = ams::sm::ServiceName::Encode(ul::sf::PublicServiceName);
|
||||
constexpr ::ams::sm::ServiceName PublicServiceName = ::ams::sm::ServiceName::Encode(ul::sf::PublicServiceName);
|
||||
*/
|
||||
|
||||
constexpr size_t MaxEcsExtraSessions = 5;
|
||||
constexpr size_t MaxSessions = MaxPrivateSessions + MaxEcsExtraSessions;
|
||||
|
||||
class ServerManager final : public ams::sf::hipc::ServerManager<Port_Count, ServerOptions, MaxSessions> {
|
||||
class ServerManager final : public ::ams::sf::hipc::ServerManager<Port_Count, ServerOptions, MaxSessions> {
|
||||
private:
|
||||
virtual ams::Result OnNeedsToAccept(int port_index, Server *server) override;
|
||||
virtual ::ams::Result OnNeedsToAccept(int port_index, Server *server) override;
|
||||
};
|
||||
|
||||
Result Initialize();
|
||||
Allocator &GetManagerAllocator();
|
||||
|
||||
ams::Result RegisterSession(const ams::os::NativeHandle session_handle, ams::sf::cmif::ServiceObjectHolder &&obj);
|
||||
::ams::Result RegisterSession(const ::ams::os::NativeHandle session_handle, ::ams::sf::cmif::ServiceObjectHolder &&obj);
|
||||
|
||||
template<typename Impl, typename T, typename ...Args>
|
||||
inline auto MakeShared(Args ...args) {
|
||||
|
@ -1,12 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::system::sf {
|
||||
|
||||
UL_RC_DEFINE_SUBMODULE(2);
|
||||
|
||||
UL_RC_DEFINE(InvalidProcess, 1);
|
||||
UL_RC_DEFINE(NoMessagesAvailable, 2);
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/ul_Result.hpp>
|
||||
|
||||
namespace ul::system::smi {
|
||||
|
||||
UL_RC_DEFINE_SUBMODULE(4);
|
||||
|
||||
UL_RC_DEFINE(ApplicationActive, 1);
|
||||
UL_RC_DEFINE(InvalidSelectedUser, 2);
|
||||
UL_RC_DEFINE(AlreadyQueued, 3);
|
||||
UL_RC_DEFINE(ApplicationNotActive, 4);
|
||||
UL_RC_DEFINE(NoHomebrewTakeoverApplication, 5);
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
|
||||
#pragma once
|
||||
#include <ul/smi/smi_Protocol.hpp>
|
||||
#include <ul/system/smi/smi_Results.hpp>
|
||||
|
||||
namespace ul::system::smi {
|
||||
|
||||
|
@ -340,13 +340,13 @@ namespace {
|
||||
UL_RC_TRY(reader.Pop(launch_app_id));
|
||||
|
||||
if(app::IsActive()) {
|
||||
return smi::ResultApplicationActive;
|
||||
return ul::ResultApplicationActive;
|
||||
}
|
||||
if(!accountUidIsValid(&g_SelectedUser)) {
|
||||
return smi::ResultInvalidSelectedUser;
|
||||
return ul::ResultInvalidSelectedUser;
|
||||
}
|
||||
if(g_ApplicationLaunchFlag > 0) {
|
||||
return smi::ResultAlreadyQueued;
|
||||
return ul::ResultAlreadyQueued;
|
||||
}
|
||||
|
||||
g_ApplicationLaunchFlag = launch_app_id;
|
||||
@ -354,7 +354,7 @@ namespace {
|
||||
}
|
||||
case ul::smi::SystemMessage::ResumeApplication: {
|
||||
if(!app::IsActive()) {
|
||||
return smi::ResultApplicationNotActive;
|
||||
return ul::ResultApplicationNotActive;
|
||||
}
|
||||
|
||||
UL_RC_TRY(app::SetForeground());
|
||||
@ -374,19 +374,19 @@ namespace {
|
||||
UL_RC_TRY(reader.Pop(temp_ipt));
|
||||
|
||||
if(app::IsActive()) {
|
||||
return smi::ResultApplicationActive;
|
||||
return ul::ResultApplicationActive;
|
||||
}
|
||||
if(!accountUidIsValid(&g_SelectedUser)) {
|
||||
return smi::ResultInvalidSelectedUser;
|
||||
return ul::ResultInvalidSelectedUser;
|
||||
}
|
||||
if(g_ApplicationLaunchFlag > 0) {
|
||||
return smi::ResultAlreadyQueued;
|
||||
return ul::ResultAlreadyQueued;
|
||||
}
|
||||
|
||||
u64 hb_application_takeover_program_id;
|
||||
UL_ASSERT_TRUE(g_Config.GetEntry(ul::cfg::ConfigEntryId::HomebrewApplicationTakeoverApplicationId, hb_application_takeover_program_id));
|
||||
if(hb_application_takeover_program_id == 0) {
|
||||
return smi::ResultNoHomebrewTakeoverApplication;
|
||||
return ul::ResultNoHomebrewTakeoverApplication;
|
||||
}
|
||||
|
||||
g_LoaderApplicationLaunchFlag = temp_ipt;
|
||||
|
@ -21,15 +21,15 @@ namespace ul::system::ecs {
|
||||
|
||||
FsFileSystem sd_fs;
|
||||
UL_RC_TRY(fsOpenSdCardFileSystem(&sd_fs));
|
||||
std::shared_ptr<ams::fs::fsa::IFileSystem> remote_sd_fs = std::make_shared<ams::fs::RemoteFileSystem>(sd_fs);
|
||||
auto subdir_fs = std::make_shared<ams::fssystem::SubDirectoryFileSystem>(std::move(remote_sd_fs));
|
||||
ams::fs::Path exefs_fs_path;
|
||||
std::shared_ptr<::ams::fs::fsa::IFileSystem> remote_sd_fs = std::make_shared<::ams::fs::RemoteFileSystem>(sd_fs);
|
||||
auto subdir_fs = std::make_shared<::ams::fssystem::SubDirectoryFileSystem>(std::move(remote_sd_fs));
|
||||
::ams::fs::Path exefs_fs_path;
|
||||
UL_RC_TRY(exefs_fs_path.Initialize(exefs_path.c_str(), exefs_path.length()));
|
||||
UL_RC_TRY(exefs_fs_path.Normalize(ams::fs::PathFlags{}));
|
||||
UL_RC_TRY(exefs_fs_path.Normalize(::ams::fs::PathFlags{}));
|
||||
UL_RC_TRY(subdir_fs->Initialize(exefs_fs_path));
|
||||
|
||||
auto sd_ifs_ipc = sf::MakeShared<ams::fssrv::sf::IFileSystem, ams::fssrv::impl::FileSystemInterfaceAdapter>(std::move(subdir_fs), false);
|
||||
UL_RC_TRY(sf::RegisterSession(move_h, ams::sf::cmif::ServiceObjectHolder(std::move(sd_ifs_ipc))));
|
||||
auto sd_ifs_ipc = sf::MakeShared<::ams::fssrv::sf::IFileSystem, ::ams::fssrv::impl::FileSystemInterfaceAdapter>(std::move(subdir_fs), false);
|
||||
UL_RC_TRY(sf::RegisterSession(move_h, ::ams::sf::cmif::ServiceObjectHolder(std::move(sd_ifs_ipc))));
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <ul/system/sf/sf_IPrivateService.hpp>
|
||||
#include <ul/system/sf/sf_Results.hpp>
|
||||
#include <ul/system/la/la_LibraryApplet.hpp>
|
||||
#include <queue>
|
||||
|
||||
@ -8,7 +7,7 @@ extern std::queue<ul::smi::MenuMessageContext> *g_MenuMessageQueue;
|
||||
|
||||
namespace ul::system::sf {
|
||||
|
||||
ams::Result PrivateService::Initialize(const ams::sf::ClientProcessId &client_pid) {
|
||||
::ams::Result PrivateService::Initialize(const ::ams::sf::ClientProcessId &client_pid) {
|
||||
if(!this->initialized) {
|
||||
u64 program_id = 0;
|
||||
UL_RC_TRY(pminfoInitialize());
|
||||
@ -28,7 +27,7 @@ namespace ul::system::sf {
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
ams::Result PrivateService::TryPopMessageContext(ams::sf::Out<MenuMessageContext> out_msg_ctx) {
|
||||
::ams::Result PrivateService::TryPopMessageContext(::ams::sf::Out<MenuMessageContext> out_msg_ctx) {
|
||||
if(!this->initialized) {
|
||||
return ResultInvalidProcess;
|
||||
}
|
||||
|
@ -37,10 +37,10 @@ namespace {
|
||||
|
||||
namespace ul::system::sf {
|
||||
|
||||
ams::Result ServerManager::OnNeedsToAccept(int port_index, Server *server) {
|
||||
::ams::Result ServerManager::OnNeedsToAccept(int port_index, Server *server) {
|
||||
switch(port_index) {
|
||||
case Port_PrivateService: {
|
||||
return this->AcceptImpl(server, MakeShared<ams::ul::system::sf::IPrivateService, PrivateService>());
|
||||
return this->AcceptImpl(server, MakeShared<::ams::ul::system::sf::IPrivateService, PrivateService>());
|
||||
}
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
@ -48,8 +48,8 @@ namespace ul::system::sf {
|
||||
|
||||
Result Initialize() {
|
||||
InitializeHeap();
|
||||
UL_RC_TRY(ams::os::CreateThread(&g_ManagerThread, &IpcManagerThread, nullptr, g_ManagerThreadStack, sizeof(g_ManagerThreadStack), 10));
|
||||
ams::os::StartThread(&g_ManagerThread);
|
||||
UL_RC_TRY(::ams::os::CreateThread(&g_ManagerThread, &IpcManagerThread, nullptr, g_ManagerThreadStack, sizeof(g_ManagerThreadStack), 10));
|
||||
::ams::os::StartThread(&g_ManagerThread);
|
||||
|
||||
return ResultSuccess;
|
||||
}
|
||||
@ -59,7 +59,7 @@ namespace ul::system::sf {
|
||||
return g_ManagerAllocator;
|
||||
}
|
||||
|
||||
ams::Result RegisterSession(const ams::os::NativeHandle session_handle, ams::sf::cmif::ServiceObjectHolder &&obj) {
|
||||
::ams::Result RegisterSession(const ::ams::os::NativeHandle session_handle, ::ams::sf::cmif::ServiceObjectHolder &&obj) {
|
||||
return g_Manager.RegisterSession(session_handle, std::move(obj));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user