mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 13:21:49 +01:00
Stub some services for homebrews
This commit is contained in:
parent
35fb874a42
commit
fb069d2031
@ -345,6 +345,7 @@ add_library(skyline SHARED
|
|||||||
${source_DIR}/skyline/services/fssrv/IStorage.cpp
|
${source_DIR}/skyline/services/fssrv/IStorage.cpp
|
||||||
${source_DIR}/skyline/services/fssrv/IDirectory.cpp
|
${source_DIR}/skyline/services/fssrv/IDirectory.cpp
|
||||||
${source_DIR}/skyline/services/fssrv/IMultiCommitManager.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/INvDrvServices.cpp
|
||||||
${source_DIR}/skyline/services/nvdrv/driver.cpp
|
${source_DIR}/skyline/services/nvdrv/driver.cpp
|
||||||
${source_DIR}/skyline/services/nvdrv/core/nvmap.cpp
|
${source_DIR}/skyline/services/nvdrv/core/nvmap.cpp
|
||||||
@ -400,6 +401,9 @@ add_library(skyline SHARED
|
|||||||
${source_DIR}/skyline/services/mii/IStaticService.cpp
|
${source_DIR}/skyline/services/mii/IStaticService.cpp
|
||||||
${source_DIR}/skyline/services/mii/IDatabaseService.cpp
|
${source_DIR}/skyline/services/mii/IDatabaseService.cpp
|
||||||
${source_DIR}/skyline/services/olsc/IOlscServiceForApplication.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
|
||||||
)
|
)
|
||||||
target_include_directories(skyline PRIVATE ${source_DIR}/skyline)
|
target_include_directories(skyline PRIVATE ${source_DIR}/skyline)
|
||||||
# target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense
|
# target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense
|
||||||
|
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 {};
|
||||||
|
}
|
||||||
|
}
|
20
app/src/main/cpp/skyline/services/clkrst/IClkrstManager.h
Normal file
20
app/src/main/cpp/skyline/services/clkrst/IClkrstManager.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <os.h>
|
||||||
#include "results.h"
|
#include "results.h"
|
||||||
#include "IFile.h"
|
#include "IFile.h"
|
||||||
#include "IDirectory.h"
|
#include "IDirectory.h"
|
||||||
@ -91,4 +93,24 @@ namespace skyline::service::fssrv {
|
|||||||
response.Push<u64>(90000000);
|
response.Push<u64>(90000000);
|
||||||
return {};
|
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);
|
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(
|
SERVICE_DECL(
|
||||||
SFUNC(0x0, IFileSystem, CreateFile),
|
SFUNC(0x0, IFileSystem, CreateFile),
|
||||||
SFUNC(0x1, IFileSystem, DeleteFile),
|
SFUNC(0x1, IFileSystem, DeleteFile),
|
||||||
@ -76,7 +81,8 @@ namespace skyline::service::fssrv {
|
|||||||
SFUNC(0x8, IFileSystem, OpenFile),
|
SFUNC(0x8, IFileSystem, OpenFile),
|
||||||
SFUNC(0x9, IFileSystem, OpenDirectory),
|
SFUNC(0x9, IFileSystem, OpenDirectory),
|
||||||
SFUNC(0xA, IFileSystem, Commit),
|
SFUNC(0xA, IFileSystem, Commit),
|
||||||
SFUNC(0xB, IFileSystem, GetFreeSpaceSize)
|
SFUNC(0xB, IFileSystem, GetFreeSpaceSize),
|
||||||
|
SFUNC(0xE, IFileSystem, GetFileTimeStampRaw)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "IStorage.h"
|
#include "IStorage.h"
|
||||||
#include "IMultiCommitManager.h"
|
#include "IMultiCommitManager.h"
|
||||||
#include "IFileSystemProxy.h"
|
#include "IFileSystemProxy.h"
|
||||||
|
#include "ISaveDataInfoReader.h"
|
||||||
|
|
||||||
namespace skyline::service::fssrv {
|
namespace skyline::service::fssrv {
|
||||||
IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||||
@ -74,6 +75,21 @@ namespace skyline::service::fssrv {
|
|||||||
return OpenSaveDataFileSystem(session, request, response);
|
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) {
|
Result IFileSystemProxy::OpenDataStorageByCurrentProcess(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
if (!state.loader->romFs)
|
if (!state.loader->romFs)
|
||||||
return result::NoRomFsAvailable;
|
return result::NoRomFsAvailable;
|
||||||
|
@ -89,6 +89,18 @@ namespace skyline::service::fssrv {
|
|||||||
*/
|
*/
|
||||||
Result OpenReadOnlySaveDataFileSystem(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
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
|
* @brief Returns a handle to an instance of #IStorage
|
||||||
* @url https://switchbrew.org/wiki/Filesystem_services#IStorage for the application's data storage
|
* @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(0x22, IFileSystemProxy, GetCacheStorageSize),
|
||||||
SFUNC(0x33, IFileSystemProxy, OpenSaveDataFileSystem),
|
SFUNC(0x33, IFileSystemProxy, OpenSaveDataFileSystem),
|
||||||
SFUNC(0x35, IFileSystemProxy, OpenReadOnlySaveDataFileSystem),
|
SFUNC(0x35, IFileSystemProxy, OpenReadOnlySaveDataFileSystem),
|
||||||
|
SFUNC(0x3C, IFileSystemProxy, OpenSaveDataInfoReader),
|
||||||
|
SFUNC(0x3D, IFileSystemProxy, OpenSaveDataInfoReaderBySaveDataSpaceId),
|
||||||
|
SFUNC(0x3E, IFileSystemProxy, OpenSaveDataInfoReaderOnlyCacheStorage),
|
||||||
SFUNC(0xC8, IFileSystemProxy, OpenDataStorageByCurrentProcess),
|
SFUNC(0xC8, IFileSystemProxy, OpenDataStorageByCurrentProcess),
|
||||||
SFUNC(0xCA, IFileSystemProxy, OpenDataStorageByDataId),
|
SFUNC(0xCA, IFileSystemProxy, OpenDataStorageByDataId),
|
||||||
SFUNC(0xCB, IFileSystemProxy, OpenPatchDataStorageByCurrentProcess),
|
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);
|
||||||
|
};
|
||||||
|
}
|
8
app/src/main/cpp/skyline/services/psm/IPsmServer.cpp
Normal file
8
app/src/main/cpp/skyline/services/psm/IPsmServer.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 "IPsmServer.h"
|
||||||
|
|
||||||
|
namespace skyline::service::psm {
|
||||||
|
IPsmServer::IPsmServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||||
|
}
|
14
app/src/main/cpp/skyline/services/psm/IPsmServer.h
Normal file
14
app/src/main/cpp/skyline/services/psm/IPsmServer.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// 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);
|
||||||
|
};
|
||||||
|
}
|
@ -57,6 +57,8 @@
|
|||||||
#include "ro/IRoInterface.h"
|
#include "ro/IRoInterface.h"
|
||||||
#include "mii/IStaticService.h"
|
#include "mii/IStaticService.h"
|
||||||
#include "olsc/IOlscServiceForApplication.h"
|
#include "olsc/IOlscServiceForApplication.h"
|
||||||
|
#include "clkrst/IClkrstManager.h"
|
||||||
|
#include "psm/IPsmServer.h"
|
||||||
#include "serviceman.h"
|
#include "serviceman.h"
|
||||||
|
|
||||||
#define SERVICE_CASE(class, name, ...) \
|
#define SERVICE_CASE(class, name, ...) \
|
||||||
@ -144,6 +146,8 @@ namespace skyline::service {
|
|||||||
SERVICE_CASE(mii::IStaticService, "mii:e")
|
SERVICE_CASE(mii::IStaticService, "mii:e")
|
||||||
SERVICE_CASE(mii::IStaticService, "mii:u")
|
SERVICE_CASE(mii::IStaticService, "mii:u")
|
||||||
SERVICE_CASE(olsc::IOlscServiceForApplication, "olsc:u")
|
SERVICE_CASE(olsc::IOlscServiceForApplication, "olsc:u")
|
||||||
|
SERVICE_CASE(clkrst::IClkrstManager, "clkrst")
|
||||||
|
SERVICE_CASE(psm::IPsmServer, "psm")
|
||||||
default:
|
default:
|
||||||
std::string_view nameString(span(reinterpret_cast<char *>(&name), sizeof(name)).as_string(true));
|
std::string_view nameString(span(reinterpret_cast<char *>(&name), sizeof(name)).as_string(true));
|
||||||
throw std::out_of_range(fmt::format("CreateService called with an unknown service name: {}", nameString));
|
throw std::out_of_range(fmt::format("CreateService called with an unknown service name: {}", nameString));
|
||||||
|
Loading…
Reference in New Issue
Block a user