diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 96534afd..8b1e4852 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -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 diff --git a/app/src/main/cpp/skyline/audio/circular_buffer.h b/app/src/main/cpp/skyline/audio/circular_buffer.h index 7862491f..c51f38fc 100644 --- a/app/src/main/cpp/skyline/audio/circular_buffer.h +++ b/app/src/main/cpp/skyline/audio/circular_buffer.h @@ -15,7 +15,7 @@ namespace skyline::audio { template class CircularBuffer { private: - std::array array{}; //!< The internal array holding the circular buffer + std::array array{}; //!< The internal array holding the circular buffer Type *start{array.begin()}; //!< The start/oldest element of the internal array Type *end{array.begin()}; //!< The end/newest element of the internal array bool empty{true}; //!< This boolean is used to differentiate between the buffer being full or empty @@ -145,7 +145,7 @@ namespace skyline::audio { * @brief This appends data from a vector to the buffer * @param sampleData A reference to a vector containing the data to be appended */ - inline void Append(const std::vector &data) { + inline void Append(const std::vector &data) { Append(const_cast(data.data()), data.size()); } }; diff --git a/app/src/main/cpp/skyline/gpu/engines/maxwell_3d.h b/app/src/main/cpp/skyline/gpu/engines/maxwell_3d.h index 6a0eaf88..9df7b43a 100644 --- a/app/src/main/cpp/skyline/gpu/engines/maxwell_3d.h +++ b/app/src/main/cpp/skyline/gpu/engines/maxwell_3d.h @@ -328,26 +328,26 @@ namespace skyline { }; enum class CounterType : u8 { - Zero = 0x0, - InputVertices = 0x1, - InputPrimitives = 0x3, - VertexShaderInvocations = 0x5, - GeometryShaderInvocations = 0x7, - GeometryShaderPrimitives = 0x9, - ZcullStats0 = 0xa, + Zero = 0x0, + InputVertices = 0x1, + InputPrimitives = 0x3, + VertexShaderInvocations = 0x5, + GeometryShaderInvocations = 0x7, + GeometryShaderPrimitives = 0x9, + ZcullStats0 = 0xa, TransformFeedbackPrimitivesWritten = 0xb, - ZcullStats1 = 0xc, - ZcullStats2 = 0xe, - ClipperInputPrimitives = 0xf, - ZcullStats3 = 0x10, - ClipperOutputPrimitives = 0x11, - PrimitivesGenerated = 0x12, - FragmentShaderInvocations = 0x13, - SamplesPassed = 0x15, - TransformFeedbackOffset = 0x1a, - TessControlShaderInvocations = 0x1b, - TessEvaluationShaderInvocations = 0x1d, - TessEvaluationShaderPrimitives = 0x1f + ZcullStats1 = 0xc, + ZcullStats2 = 0xe, + ClipperInputPrimitives = 0xf, + ZcullStats3 = 0x10, + ClipperOutputPrimitives = 0x11, + PrimitivesGenerated = 0x12, + FragmentShaderInvocations = 0x13, + SamplesPassed = 0x15, + TransformFeedbackOffset = 0x1a, + TessControlShaderInvocations = 0x1b, + TessEvaluationShaderInvocations = 0x1d, + TessEvaluationShaderPrimitives = 0x1f }; enum class StructureSize : u8 { diff --git a/app/src/main/cpp/skyline/gpu/macro_interpreter.cpp b/app/src/main/cpp/skyline/gpu/macro_interpreter.cpp index faaadd4d..5cecebb4 100644 --- a/app/src/main/cpp/skyline/gpu/macro_interpreter.cpp +++ b/app/src/main/cpp/skyline/gpu/macro_interpreter.cpp @@ -83,7 +83,7 @@ namespace skyline::gpu { opcode += opcode->immediate; return true; } else { - Opcode* targetOpcode = opcode + opcode->immediate; + Opcode *targetOpcode = opcode + opcode->immediate; // Step into delay slot opcode++; diff --git a/app/src/main/cpp/skyline/gpu/memory_manager.h b/app/src/main/cpp/skyline/gpu/memory_manager.h index fd31e3cd..270b8f98 100644 --- a/app/src/main/cpp/skyline/gpu/memory_manager.h +++ b/app/src/main/cpp/skyline/gpu/memory_manager.h @@ -113,7 +113,7 @@ namespace skyline { */ template void Read(std::span destination, u64 address) const { - Read(reinterpret_cast(destination.data()), address, destination.size_bytes()); + Read(reinterpret_cast(destination.data()), address, destination.size_bytes()); } /** @@ -123,7 +123,7 @@ namespace skyline { template T Read(u64 address) const { T obj; - Read(reinterpret_cast(&obj), address, sizeof(T)); + Read(reinterpret_cast(&obj), address, sizeof(T)); return obj; } @@ -134,7 +134,7 @@ namespace skyline { */ template void Write(std::span source, u64 address) const { - Write(reinterpret_cast(source.data()), address, source.size_bytes()); + Write(reinterpret_cast(source.data()), address, source.size_bytes()); } /** @@ -143,7 +143,7 @@ namespace skyline { */ template void Write(T source, u64 address) const { - Write(reinterpret_cast(&source), address, sizeof(T)); + Write(reinterpret_cast(&source), address, sizeof(T)); } }; } diff --git a/app/src/main/cpp/skyline/loader/nsp.cpp b/app/src/main/cpp/skyline/loader/nsp.cpp index c33715b8..c15ce667 100644 --- a/app/src/main/cpp/skyline/loader/nsp.cpp +++ b/app/src/main/cpp/skyline/loader/nsp.cpp @@ -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; diff --git a/app/src/main/cpp/skyline/services/apm/IManager.cpp b/app/src/main/cpp/skyline/services/apm/IManager.cpp index 06e9c949..9c724671 100644 --- a/app/src/main/cpp/skyline/services/apm/IManager.cpp +++ b/app/src/main/cpp/skyline/services/apm/IManager.cpp @@ -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(state, manager), session, response); + manager.RegisterService(SRVREG(ISession), session, response); } } diff --git a/app/src/main/cpp/skyline/services/audio/IAudioRenderer/voice.cpp b/app/src/main/cpp/skyline/services/audio/IAudioRenderer/voice.cpp index a7f887d7..30cc813e 100644 --- a/app/src/main/cpp/skyline/services/audio/IAudioRenderer/voice.cpp +++ b/app/src/main/cpp/skyline/services/audio/IAudioRenderer/voice.cpp @@ -68,11 +68,11 @@ namespace skyline::service::audio::IAudioRenderer { state.process->ReadMemory(samples.data(), currentBuffer.address, currentBuffer.size); break; case skyline::audio::AudioFormat::ADPCM: { - std::vector adpcmData(currentBuffer.size); - state.process->ReadMemory(adpcmData.data(), currentBuffer.address, currentBuffer.size); - samples = adpcmDecoder->Decode(adpcmData); - } + std::vector 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); } diff --git a/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp b/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp index 79bd4839..89f43f88 100644 --- a/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp +++ b/app/src/main/cpp/skyline/services/friends/IServiceCreator.cpp @@ -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); + } } diff --git a/app/src/main/cpp/skyline/services/friends/IServiceCreator.h b/app/src/main/cpp/skyline/services/friends/IServiceCreator.h index ad4f765b..ec09ba40 100644 --- a/app/src/main/cpp/skyline/services/friends/IServiceCreator.h +++ b/app/src/main/cpp/skyline/services/friends/IServiceCreator.h @@ -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); }; } diff --git a/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp b/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp index 8a8e9641..4661115b 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp +++ b/app/src/main/cpp/skyline/services/fssrv/IFileSystem.cpp @@ -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(0); response.errorCode = constant::status::PathDoesNotExist; diff --git a/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp b/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp index 22a9f100..491e24cb 100644 --- a/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp +++ b/app/src/main/cpp/skyline/services/fssrv/IFileSystemProxy.cpp @@ -31,8 +31,8 @@ namespace skyline::service::fssrv { if (attribute.programId == 0) attribute.programId = state.loader->nacp->nacpContents.saveDataOwnerId; - std::string saveDataPath = [spaceId, &attribute] () { - std::string spaceIdStr = [spaceId] () { + std::string saveDataPath = [spaceId, &attribute]() { + std::string spaceIdStr = [spaceId]() { switch (spaceId) { case SaveDataSpaceId::System: return "/nand/system"; @@ -43,7 +43,7 @@ namespace skyline::service::fssrv { default: throw exception("Unsupported savedata ID: {}", spaceId); }; - } (); + }(); switch (attribute.type) { case SaveDataType::System: @@ -58,7 +58,7 @@ namespace skyline::service::fssrv { default: throw exception("Unsupported savedata type: {}", attribute.type); }; - } (); + }(); manager.RegisterService(std::make_shared(std::make_shared(state.os->appFilesPath + "/switch" + saveDataPath), state, manager), session, response); } diff --git a/app/src/main/cpp/skyline/services/lm/ILogService.cpp b/app/src/main/cpp/skyline/services/lm/ILogService.cpp index ce7c2611..405249cd 100644 --- a/app/src/main/cpp/skyline/services/lm/ILogService.cpp +++ b/app/src/main/cpp/skyline/services/lm/ILogService.cpp @@ -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(state, manager), session, response); + manager.RegisterService(SRVREG(ILogger), session, response); } } diff --git a/app/src/main/cpp/skyline/services/lm/ILogger.cpp b/app/src/main/cpp/skyline/services/lm/ILogger.cpp index b2d613ae..98f13a0a 100644 --- a/app/src/main/cpp/skyline/services/lm/ILogger.cpp +++ b/app/src/main/cpp/skyline/services/lm/ILogger.cpp @@ -56,7 +56,7 @@ namespace skyline::service::lm { logMessage << " "; - switch (fieldType) { + switch (fieldType) { case LogFieldType::Start: offset += length; continue; diff --git a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp index 081edf56..7b4ea242 100644 --- a/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp +++ b/app/src/main/cpp/skyline/services/pctl/IParentalControlServiceFactory.cpp @@ -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(state, manager), session, response); + manager.RegisterService(SRVREG(IParentalControlService), session, response); } } diff --git a/app/src/main/cpp/skyline/vfs/filesystem.h b/app/src/main/cpp/skyline/vfs/filesystem.h index ce47923f..063d3225 100644 --- a/app/src/main/cpp/skyline/vfs/filesystem.h +++ b/app/src/main/cpp/skyline/vfs/filesystem.h @@ -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; } /** diff --git a/app/src/main/cpp/skyline/vfs/os_filesystem.cpp b/app/src/main/cpp/skyline/vfs/os_filesystem.cpp index f357dd93..6abaca1e 100644 --- a/app/src/main/cpp/skyline/vfs/os_filesystem.cpp +++ b/app/src/main/cpp/skyline/vfs/os_filesystem.cpp @@ -59,7 +59,6 @@ namespace skyline::vfs { return true; } - std::shared_ptr 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");