mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Some stubs for better compatibility
This commit is contained in:
@ -346,6 +346,7 @@ add_library(skyline SHARED
|
||||
${source_DIR}/skyline/services/fssrv/IStorage.cpp
|
||||
${source_DIR}/skyline/services/fssrv/IDirectory.cpp
|
||||
${source_DIR}/skyline/services/fssrv/IMultiCommitManager.cpp
|
||||
${source_DIR}/skyline/services/fssrv/ISaveDataInfoReader.cpp
|
||||
${source_DIR}/skyline/services/nvdrv/INvDrvServices.cpp
|
||||
${source_DIR}/skyline/services/nvdrv/driver.cpp
|
||||
${source_DIR}/skyline/services/nvdrv/core/nvmap.cpp
|
||||
@ -403,6 +404,12 @@ add_library(skyline SHARED
|
||||
${source_DIR}/skyline/services/mii/IStaticService.cpp
|
||||
${source_DIR}/skyline/services/mii/IDatabaseService.cpp
|
||||
${source_DIR}/skyline/services/olsc/IOlscServiceForApplication.cpp
|
||||
${source_DIR}/skyline/services/clkrst/IClkrstManager.cpp
|
||||
${source_DIR}/skyline/services/clkrst/IClkrstSession.cpp
|
||||
${source_DIR}/skyline/services/psm/IPsmServer.cpp
|
||||
${source_DIR}/skyline/services/psm/IPsmSession.cpp
|
||||
${source_DIR}/skyline/services/ts/IMeasurementServer.cpp
|
||||
${source_DIR}/skyline/services/ts/ISession.cpp
|
||||
${source_DIR}/skyline/services/ntc/IEnsureNetworkClockAvailabilityService.cpp
|
||||
)
|
||||
target_include_directories(skyline PRIVATE ${source_DIR}/skyline)
|
||||
|
14
app/src/main/cpp/skyline/services/clkrst/IClkrstManager.cpp
Normal file
14
app/src/main/cpp/skyline/services/clkrst/IClkrstManager.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "IClkrstSession.h"
|
||||
#include "IClkrstManager.h"
|
||||
|
||||
namespace skyline::service::clkrst {
|
||||
IClkrstManager::IClkrstManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IClkrstManager::OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IClkrstSession), session, response);
|
||||
return {};
|
||||
}
|
||||
}
|
23
app/src/main/cpp/skyline/services/clkrst/IClkrstManager.h
Normal file
23
app/src/main/cpp/skyline/services/clkrst/IClkrstManager.h
Normal file
@ -0,0 +1,23 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::clkrst {
|
||||
|
||||
class IClkrstManager : public BaseService {
|
||||
public:
|
||||
IClkrstManager(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PCV_services#OpenSession
|
||||
*/
|
||||
Result OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IClkrstManager, OpenSession)
|
||||
)
|
||||
};
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "IClkrstSession.h"
|
||||
|
||||
namespace skyline::service::clkrst {
|
||||
IClkrstSession::IClkrstSession(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
17
app/src/main/cpp/skyline/services/clkrst/IClkrstSession.h
Normal file
17
app/src/main/cpp/skyline/services/clkrst/IClkrstSession.h
Normal file
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::clkrst {
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PCV_services#IClkrstSession
|
||||
*/
|
||||
class IClkrstSession : public BaseService {
|
||||
public:
|
||||
IClkrstSession(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
}
|
@ -4,13 +4,28 @@
|
||||
#include "IFriendService.h"
|
||||
|
||||
namespace skyline::service::friends {
|
||||
IFriendService::IFriendService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
IFriendService::IFriendService(const DeviceState &state, ServiceManager &manager)
|
||||
: completionEvent(std::make_shared<type::KEvent>(state, false)),
|
||||
BaseService(state, manager) {}
|
||||
|
||||
Result IFriendService::GetCompletionEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
KHandle handle{state.process->InsertItem(completionEvent)};
|
||||
Logger::Debug("Friend Completion Event Handle: 0x{:X}", handle);
|
||||
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFriendService::GetFriendList(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u32>(0); // Count of friends
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFriendService::CheckFriendListAvailability(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u8>(1);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFriendService::GetBlockedUserListIds(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u32>(0); // No blocked users
|
||||
return {};
|
||||
|
@ -11,11 +11,18 @@ namespace skyline::service::friends {
|
||||
* @url https://switchbrew.org/wiki/Friend_services#IFriendService
|
||||
*/
|
||||
class IFriendService : public BaseService {
|
||||
private:
|
||||
std::shared_ptr<kernel::type::KEvent> completionEvent;
|
||||
|
||||
public:
|
||||
IFriendService(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
Result GetCompletionEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
Result GetFriendList(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
Result CheckFriendListAvailability(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
Result GetBlockedUserListIds(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
Result DeclareOpenOnlinePlaySession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
@ -27,7 +34,9 @@ namespace skyline::service::friends {
|
||||
Result GetPlayHistoryRegistrationKey(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IFriendService, GetCompletionEvent),
|
||||
SFUNC(0x2775, IFriendService, GetFriendList),
|
||||
SFUNC(0x2788, IFriendService, CheckFriendListAvailability ),
|
||||
SFUNC(0x28A0, IFriendService, GetBlockedUserListIds),
|
||||
SFUNC(0x2968, IFriendService, DeclareOpenOnlinePlaySession),
|
||||
SFUNC(0x2969, IFriendService, DeclareCloseOnlinePlaySession),
|
||||
|
@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <os.h>
|
||||
#include "results.h"
|
||||
#include "IFile.h"
|
||||
#include "IDirectory.h"
|
||||
@ -91,4 +93,24 @@ namespace skyline::service::fssrv {
|
||||
response.Push<u64>(90000000);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystem::GetFileTimeStampRaw(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
struct FileTimeStampRaw {
|
||||
u64 created{};
|
||||
u64 accessed{};
|
||||
u64 modified{};
|
||||
u64 _pad_{};
|
||||
};
|
||||
|
||||
std::string path{request.inputBuf.at(0).as_string(true)};
|
||||
struct stat fileStatus{};
|
||||
const auto statResult{stat((state.os->publicAppFilesPath + "/switch/sdmc/" + path).c_str(), &fileStatus)};
|
||||
FileTimeStampRaw fileTimeStampRaw{
|
||||
static_cast<u64>(fileStatus.st_ctim.tv_nsec),
|
||||
static_cast<u64>(fileStatus.st_atim.tv_nsec),
|
||||
static_cast<u64>(fileStatus.st_mtim.tv_nsec),
|
||||
};
|
||||
response.Push(fileTimeStampRaw);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,11 @@ namespace skyline::service::fssrv {
|
||||
*/
|
||||
Result GetFreeSpaceSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/Filesystem_services#GetFileTimeStampRaw
|
||||
*/
|
||||
Result GetFileTimeStampRaw(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IFileSystem, CreateFile),
|
||||
SFUNC(0x1, IFileSystem, DeleteFile),
|
||||
@ -76,7 +81,8 @@ namespace skyline::service::fssrv {
|
||||
SFUNC(0x8, IFileSystem, OpenFile),
|
||||
SFUNC(0x9, IFileSystem, OpenDirectory),
|
||||
SFUNC(0xA, IFileSystem, Commit),
|
||||
SFUNC(0xB, IFileSystem, GetFreeSpaceSize)
|
||||
SFUNC(0xB, IFileSystem, GetFreeSpaceSize),
|
||||
SFUNC(0xE, IFileSystem, GetFileTimeStampRaw)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "IStorage.h"
|
||||
#include "IMultiCommitManager.h"
|
||||
#include "IFileSystemProxy.h"
|
||||
#include "ISaveDataInfoReader.h"
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
@ -74,6 +75,21 @@ namespace skyline::service::fssrv {
|
||||
return OpenSaveDataFileSystem(session, request, response);
|
||||
}
|
||||
|
||||
Result IFileSystemProxy::OpenSaveDataInfoReader(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ISaveDataInfoReader), session, response);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystemProxy::OpenSaveDataInfoReaderBySaveDataSpaceId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ISaveDataInfoReader), session, response);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystemProxy::OpenSaveDataInfoReaderOnlyCacheStorage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ISaveDataInfoReader), session, response);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IFileSystemProxy::OpenDataStorageByCurrentProcess(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
if (!state.loader->romFs)
|
||||
return result::NoRomFsAvailable;
|
||||
|
@ -89,6 +89,18 @@ namespace skyline::service::fssrv {
|
||||
*/
|
||||
Result OpenReadOnlySaveDataFileSystem(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/Filesystem_services#OpenSaveDataInfoReader
|
||||
*/
|
||||
Result OpenSaveDataInfoReader(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/Filesystem_services#OpenSaveDataInfoReaderBySaveDataSpaceId
|
||||
*/
|
||||
Result OpenSaveDataInfoReaderBySaveDataSpaceId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
Result OpenSaveDataInfoReaderOnlyCacheStorage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief Returns a handle to an instance of #IStorage
|
||||
* @url https://switchbrew.org/wiki/Filesystem_services#IStorage for the application's data storage
|
||||
@ -120,6 +132,9 @@ namespace skyline::service::fssrv {
|
||||
SFUNC(0x22, IFileSystemProxy, GetCacheStorageSize),
|
||||
SFUNC(0x33, IFileSystemProxy, OpenSaveDataFileSystem),
|
||||
SFUNC(0x35, IFileSystemProxy, OpenReadOnlySaveDataFileSystem),
|
||||
SFUNC(0x3C, IFileSystemProxy, OpenSaveDataInfoReader),
|
||||
SFUNC(0x3D, IFileSystemProxy, OpenSaveDataInfoReaderBySaveDataSpaceId),
|
||||
SFUNC(0x3E, IFileSystemProxy, OpenSaveDataInfoReaderOnlyCacheStorage),
|
||||
SFUNC(0xC8, IFileSystemProxy, OpenDataStorageByCurrentProcess),
|
||||
SFUNC(0xCA, IFileSystemProxy, OpenDataStorageByDataId),
|
||||
SFUNC(0xCB, IFileSystemProxy, OpenPatchDataStorageByCurrentProcess),
|
||||
|
@ -0,0 +1,8 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "ISaveDataInfoReader.h"
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
ISaveDataInfoReader::ISaveDataInfoReader(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/Filesystem_services#ISaveDataInfoReader
|
||||
*/
|
||||
class ISaveDataInfoReader : public BaseService {
|
||||
public:
|
||||
ISaveDataInfoReader(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
}
|
@ -113,6 +113,16 @@ namespace skyline::service::nifm {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IGeneralService::GetInternetConnectionStatus(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
struct Status {
|
||||
u8 type{1};
|
||||
u8 wifiStrength{3};
|
||||
u8 state{4};
|
||||
} status{};
|
||||
response.Push(status);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IGeneralService::IsAnyInternetRequestAccepted(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u8>(*state.settings->isInternetEnabled);
|
||||
return {};
|
||||
|
@ -121,6 +121,8 @@ namespace skyline::service::nifm {
|
||||
*/
|
||||
Result GetCurrentIpConfigInfo(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
Result GetInternetConnectionStatus(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/Network_Interface_services#IsAnyInternetRequestAccepted
|
||||
*/
|
||||
@ -132,6 +134,7 @@ namespace skyline::service::nifm {
|
||||
SFUNC(0x5, IGeneralService, GetCurrentNetworkProfile),
|
||||
SFUNC(0xC, IGeneralService, GetCurrentIpAddress),
|
||||
SFUNC(0xF, IGeneralService, GetCurrentIpConfigInfo),
|
||||
SFUNC(0x12, IGeneralService, GetInternetConnectionStatus),
|
||||
SFUNC(0x15, IGeneralService, IsAnyInternetRequestAccepted)
|
||||
)
|
||||
};
|
||||
|
24
app/src/main/cpp/skyline/services/psm/IPsmServer.cpp
Normal file
24
app/src/main/cpp/skyline/services/psm/IPsmServer.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "IPsmServer.h"
|
||||
#include "IPsmSession.h"
|
||||
|
||||
namespace skyline::service::psm {
|
||||
IPsmServer::IPsmServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IPsmServer::GetBatteryChargePercentage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u32>(100);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPsmServer::GetChargerType(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u32>(1);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPsmServer::OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IPsmSession), session, response);
|
||||
return {};
|
||||
}
|
||||
}
|
32
app/src/main/cpp/skyline/services/psm/IPsmServer.h
Normal file
32
app/src/main/cpp/skyline/services/psm/IPsmServer.h
Normal file
@ -0,0 +1,32 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::psm {
|
||||
|
||||
class IPsmServer : public BaseService {
|
||||
public:
|
||||
IPsmServer(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#GetBatteryChargePercentage
|
||||
*/
|
||||
Result GetBatteryChargePercentage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#GetChargerType
|
||||
*/
|
||||
Result GetChargerType(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
Result OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IPsmServer, GetBatteryChargePercentage),
|
||||
SFUNC(0x1, IPsmServer, GetChargerType),
|
||||
SFUNC(0x7, IPsmServer, OpenSession)
|
||||
)
|
||||
};
|
||||
}
|
33
app/src/main/cpp/skyline/services/psm/IPsmSession.cpp
Normal file
33
app/src/main/cpp/skyline/services/psm/IPsmSession.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "IPsmSession.h"
|
||||
|
||||
namespace skyline::service::psm {
|
||||
IPsmSession::IPsmSession(const DeviceState &state, ServiceManager &manager)
|
||||
: stateChangeEvent(std::make_shared<type::KEvent>(state, false)),
|
||||
BaseService(state, manager) {}
|
||||
|
||||
Result IPsmSession::BindStateChangeEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle{state.process->InsertItem(stateChangeEvent)};
|
||||
Logger::Debug("Bind State Change Event Handle: 0x{:X}", handle);
|
||||
response.copyHandles.push_back(handle);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPsmSession::UnbindStateChangeEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPsmSession::SetChargerTypeChangeEventEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPsmSession::SetPowerSupplyChangeEventEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IPsmSession::SetBatteryVoltageStateChangeEventEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return {};
|
||||
}
|
||||
}
|
53
app/src/main/cpp/skyline/services/psm/IPsmSession.h
Normal file
53
app/src/main/cpp/skyline/services/psm/IPsmSession.h
Normal file
@ -0,0 +1,53 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::psm {
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#IPsmSession
|
||||
*/
|
||||
class IPsmSession : public BaseService {
|
||||
private:
|
||||
std::shared_ptr<kernel::type::KEvent> stateChangeEvent;
|
||||
|
||||
public:
|
||||
IPsmSession(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#BindStateChangeEvent
|
||||
*/
|
||||
Result BindStateChangeEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#UnbindStateChangeEvent
|
||||
*/
|
||||
Result UnbindStateChangeEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#SetChargerTypeChangeEventEnabled
|
||||
*/
|
||||
Result SetChargerTypeChangeEventEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#SetPowerSupplyChangeEventEnabled
|
||||
*/
|
||||
Result SetPowerSupplyChangeEventEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#SetBatteryVoltageStateChangeEventEnabled
|
||||
*/
|
||||
Result SetBatteryVoltageStateChangeEventEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IPsmSession, BindStateChangeEvent),
|
||||
SFUNC(0x1, IPsmSession, UnbindStateChangeEvent),
|
||||
SFUNC(0x2, IPsmSession, SetChargerTypeChangeEventEnabled),
|
||||
SFUNC(0x3, IPsmSession, SetPowerSupplyChangeEventEnabled),
|
||||
SFUNC(0x4, IPsmSession, SetBatteryVoltageStateChangeEventEnabled)
|
||||
)
|
||||
};
|
||||
}
|
@ -57,6 +57,9 @@
|
||||
#include "ro/IRoInterface.h"
|
||||
#include "mii/IStaticService.h"
|
||||
#include "olsc/IOlscServiceForApplication.h"
|
||||
#include "clkrst/IClkrstManager.h"
|
||||
#include "ts/IMeasurementServer.h"
|
||||
#include "psm/IPsmServer.h"
|
||||
#include "ntc/IEnsureNetworkClockAvailabilityService.h"
|
||||
#include "serviceman.h"
|
||||
|
||||
@ -146,6 +149,9 @@ namespace skyline::service {
|
||||
SERVICE_CASE(mii::IStaticService, "mii:e")
|
||||
SERVICE_CASE(mii::IStaticService, "mii:u")
|
||||
SERVICE_CASE(olsc::IOlscServiceForApplication, "olsc:u")
|
||||
SERVICE_CASE(clkrst::IClkrstManager, "clkrst")
|
||||
SERVICE_CASE(ts::IMeasurementServer, "ts")
|
||||
SERVICE_CASE(psm::IPsmServer, "psm")
|
||||
SERVICE_CASE(ntc::IEnsureNetworkClockAvailabilityService, "ntc")
|
||||
default:
|
||||
std::string_view nameString(span(reinterpret_cast<char *>(&name), sizeof(name)).as_string(true));
|
||||
|
@ -10,4 +10,9 @@ namespace skyline::service::settings {
|
||||
request.outputBuf.at(0).as<SysVerTitle>() = {.major=9, .minor=0, .micro=0, .revMajor=4, .revMinor=0, .platform="NX", .verHash="4de65c071fd0869695b7629f75eb97b2551dbf2f", .dispVer="9.0.0", .dispTitle="NintendoSDK Firmware for NX 9.0.0-4.0"};
|
||||
return {};
|
||||
}
|
||||
|
||||
Result ISystemSettingsServer::GetColorSetId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u32>(0); // Basic White
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,14 @@ namespace skyline::service::settings {
|
||||
*/
|
||||
Result GetFirmwareVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/Settings_services#GetColorSetId
|
||||
*/
|
||||
Result GetColorSetId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x3, ISystemSettingsServer, GetFirmwareVersion)
|
||||
SFUNC(0x3, ISystemSettingsServer, GetFirmwareVersion),
|
||||
SFUNC(0x17, ISystemSettingsServer, GetColorSetId)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
20
app/src/main/cpp/skyline/services/ts/IMeasurementServer.cpp
Normal file
20
app/src/main/cpp/skyline/services/ts/IMeasurementServer.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "ISession.h"
|
||||
#include "IMeasurementServer.h"
|
||||
|
||||
namespace skyline::service::ts {
|
||||
IMeasurementServer::IMeasurementServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IMeasurementServer::GetTemperature(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
u8 location{request.Pop<u8>()};
|
||||
response.Push<u32>(!location ? 35 : 20);
|
||||
return {};
|
||||
}
|
||||
|
||||
Result IMeasurementServer::OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ISession), session, response);
|
||||
return {};
|
||||
}
|
||||
}
|
29
app/src/main/cpp/skyline/services/ts/IMeasurementServer.h
Normal file
29
app/src/main/cpp/skyline/services/ts/IMeasurementServer.h
Normal file
@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::ts {
|
||||
|
||||
class IMeasurementServer : public BaseService {
|
||||
public:
|
||||
IMeasurementServer(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#GetTemperature
|
||||
*/
|
||||
Result GetTemperature(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#OpenSession_2
|
||||
*/
|
||||
Result OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x1, IMeasurementServer, GetTemperature),
|
||||
SFUNC(0x4, IMeasurementServer, OpenSession)
|
||||
)
|
||||
};
|
||||
}
|
8
app/src/main/cpp/skyline/services/ts/ISession.cpp
Normal file
8
app/src/main/cpp/skyline/services/ts/ISession.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "ISession.h"
|
||||
|
||||
namespace skyline::service::ts {
|
||||
ISession::ISession(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
17
app/src/main/cpp/skyline/services/ts/ISession.h
Normal file
17
app/src/main/cpp/skyline/services/ts/ISession.h
Normal file
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::ts {
|
||||
|
||||
/**
|
||||
* @url https://switchbrew.org/wiki/PTM_services#ISession
|
||||
*/
|
||||
class ISession : public BaseService {
|
||||
public:
|
||||
ISession(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user