Format code and misc cleanup

This commit is contained in:
Billy Laws 2020-08-09 15:02:38 +01:00 committed by ◱ PixelyIon
parent fcae5d54da
commit ade8a711fb
17 changed files with 60 additions and 46 deletions

View File

@ -39,9 +39,12 @@ add_library(skyline SHARED
${source_DIR}/skyline/audio/resampler.cpp
${source_DIR}/skyline/audio/adpcm_decoder.cpp
${source_DIR}/skyline/gpu.cpp
${source_DIR}/skyline/gpu/macro_interpreter.cpp
${source_DIR}/skyline/gpu/memory_manager.cpp
${source_DIR}/skyline/gpu/gpfifo.cpp
${source_DIR}/skyline/gpu/syncpoint.cpp
${source_DIR}/skyline/gpu/texture.cpp
${source_DIR}/skyline/gpu/engines/maxwell_3d.cpp
${source_DIR}/skyline/os.cpp
${source_DIR}/skyline/loader/loader.cpp
${source_DIR}/skyline/loader/nro.cpp
@ -124,6 +127,7 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/account/IProfile.cpp
${source_DIR}/skyline/services/friends/IServiceCreator.cpp
${source_DIR}/skyline/services/friends/IFriendService.cpp
${source_DIR}/skyline/services/friends/INotificationService.cpp
${source_DIR}/skyline/services/nfp/IUserManager.cpp
${source_DIR}/skyline/services/nfp/IUser.cpp
${source_DIR}/skyline/services/nifm/IStaticService.cpp
@ -131,6 +135,7 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/nifm/IRequest.cpp
${source_DIR}/skyline/services/socket/bsd/IClient.cpp
${source_DIR}/skyline/services/ssl/ISslService.cpp
${source_DIR}/skyline/services/ssl/ISslContext.cpp
${source_DIR}/skyline/services/prepo/IPrepoService.cpp
${source_DIR}/skyline/vfs/os_filesystem.cpp
${source_DIR}/skyline/vfs/partition_filesystem.cpp

View File

@ -24,7 +24,7 @@ namespace skyline::loader {
}
}
if (!programNca.has_value() || !controlNca.has_value())
if (!programNca || !controlNca)
throw exception("Incomplete NSP file");
romFs = programNca->romFs;

View File

@ -10,6 +10,6 @@ namespace skyline::service::apm {
}) {}
void IManager::OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(std::make_shared<ISession>(state, manager), session, response);
manager.RegisterService(SRVREG(ISession), session, response);
}
}

View File

@ -71,8 +71,8 @@ namespace skyline::service::audio::IAudioRenderer {
std::vector<u8> adpcmData(currentBuffer.size);
state.process->ReadMemory(adpcmData.data(), currentBuffer.address, currentBuffer.size);
samples = adpcmDecoder->Decode(adpcmData);
}
break;
}
default:
throw exception("Unsupported PCM format used by Voice: {}", format);
}

View File

@ -2,14 +2,20 @@
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include "IFriendService.h"
#include "INotificationService.h"
#include "IServiceCreator.h"
namespace skyline::service::friends {
IServiceCreator::IServiceCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::friends_IServiceCreator, "friends:IServiceCreator", {
{0x0, SFUNC(IServiceCreator::CreateFriendService)}
{0x0, SFUNC(IServiceCreator::CreateFriendService)},
{0x1, SFUNC(IServiceCreator::CreateNotificationService)},
}) {}
void IServiceCreator::CreateFriendService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(SRVREG(IFriendService), session, response);
}
void IServiceCreator::CreateNotificationService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(SRVREG(INotificationService), session, response);
}
}

View File

@ -18,5 +18,10 @@ namespace skyline::service::friends {
* @brief This opens an IFriendService that can be used by applications to access user friend info
*/
void CreateFriendService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @brief This opens an INotificationService that can be used by applications to receive notifications
*/
void CreateNotificationService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
};
}

View File

@ -27,8 +27,8 @@ namespace skyline::service::fssrv {
auto type = backing->GetEntryType(path);
if (type.has_value()) {
response.Push(type.value());
if (type) {
response.Push(*type);
} else {
response.Push<u32>(0);
response.errorCode = constant::status::PathDoesNotExist;

View File

@ -10,6 +10,6 @@ namespace skyline::service::lm {
}) {}
void ILogService::OpenLogger(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(std::make_shared<ILogger>(state, manager), session, response);
manager.RegisterService(SRVREG(ILogger), session, response);
}
}

View File

@ -8,10 +8,9 @@ namespace skyline::service::pctl {
IParentalControlServiceFactory::IParentalControlServiceFactory(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::pctl_IParentalControlServiceFactory, "pctl:IParentalControlServiceFactory", {
{0x0, SFUNC(IParentalControlServiceFactory::CreateService)},
{0x1, SFUNC(IParentalControlServiceFactory::CreateService)}
}) {}
void IParentalControlServiceFactory::CreateService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
manager.RegisterService(std::make_shared<IParentalControlService>(state, manager), session, response);
manager.RegisterService(SRVREG(IParentalControlService), session, response);
}
}

View File

@ -64,7 +64,7 @@ namespace skyline::vfs {
*/
inline bool FileExists(std::string path) {
auto entry = GetEntryType(path);
return entry.has_value() && entry.value() == Directory::EntryType::File;
return entry && *entry == Directory::EntryType::File;
}
/**
@ -74,7 +74,7 @@ namespace skyline::vfs {
*/
inline bool DirectoryExists(std::string path) {
auto entry = GetEntryType(path);
return entry.has_value() && entry.value() == Directory::EntryType::Directory;
return entry && *entry == Directory::EntryType::Directory;
}
/**

View File

@ -59,7 +59,6 @@ namespace skyline::vfs {
return true;
}
std::shared_ptr<Backing> OsFileSystem::OpenFile(std::string path, Backing::Mode mode) {
if (!(mode.read || mode.write))
throw exception("Cannot open a file that is neither readable or writable");