Compare commits
3 Commits
1.8.0-prer
...
nim
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8696bd5d4 | ||
|
|
af7baa6b34 | ||
|
|
6de1361c8b |
@@ -6,7 +6,7 @@
|
||||
[subrepo]
|
||||
remote = https://github.com/Atmosphere-NX/Atmosphere-libs
|
||||
branch = master
|
||||
commit = de221b5d73fe688ebd93fc3a180ab3cec2ec2c34
|
||||
parent = 0b52596087a9195f22cc2f6e6dc0ee35cee80357
|
||||
commit = a40d4593d7e46ea296802e5c50fd0da2d9f92a76
|
||||
parent = 6de1361c8be886eda16faf87c73b9e4d01187bca
|
||||
method = merge
|
||||
cmdver = 0.4.1
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "stratosphere/lr.hpp"
|
||||
#include "stratosphere/map.hpp"
|
||||
#include "stratosphere/ncm.hpp"
|
||||
#include "stratosphere/nim.hpp"
|
||||
#include "stratosphere/patcher.hpp"
|
||||
#include "stratosphere/pm.hpp"
|
||||
#include "stratosphere/reg.hpp"
|
||||
@@ -58,7 +59,6 @@
|
||||
#include "stratosphere/spl.hpp"
|
||||
#include "stratosphere/updater.hpp"
|
||||
|
||||
|
||||
/* Include FS last. */
|
||||
#include "stratosphere/fs.hpp"
|
||||
#include "stratosphere/fssrv.hpp"
|
||||
|
||||
19
libraries/libstratosphere/include/stratosphere/nim.hpp
Normal file
19
libraries/libstratosphere/include/stratosphere/nim.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stratosphere/nim/nim_network_install_manager_api.hpp>
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <stratosphere/nim/nim_system_update_task_id.hpp>
|
||||
|
||||
namespace ams::nim {
|
||||
|
||||
/* Management. */
|
||||
void InitializeForNetworkInstallManager();
|
||||
void FinalizeForNetworkInstallManager();
|
||||
|
||||
/* Service API. */
|
||||
Result DestroySystemUpdateTask(const SystemUpdateTaskId& id);
|
||||
s32 ListSystemUpdateTask(SystemUpdateTaskId *out_list, size_t out_list_size);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/nim/nim_task_id_common.hpp>
|
||||
|
||||
namespace ams::nim {
|
||||
|
||||
AMS_NIM_DEFINE_TASK_ID(SystemUpdateTaskId, 8);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/nim/nim_task_id_common.hpp>
|
||||
|
||||
namespace ams::nim {
|
||||
|
||||
#define AMS_NIM_DEFINE_TASK_ID(ID, ALIGN) \
|
||||
struct alignas(ALIGN) ID { \
|
||||
util::Uuid uuid; \
|
||||
\
|
||||
ALWAYS_INLINE bool IsValid() const { \
|
||||
return this->uuid != util::InvalidUuid; \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
static_assert(alignof(ID) == ALIGN); \
|
||||
\
|
||||
ALWAYS_INLINE bool operator==(const ID &lhs, const ID &rhs) { \
|
||||
return lhs.uuid == rhs.uuid; \
|
||||
} \
|
||||
\
|
||||
ALWAYS_INLINE bool operator!=(const ID &lhs, const ID &rhs) { \
|
||||
return lhs.uuid != rhs.uuid; \
|
||||
} \
|
||||
\
|
||||
constexpr inline ID Invalid##ID = { util::InvalidUuid }
|
||||
|
||||
}
|
||||
@@ -18,6 +18,30 @@
|
||||
|
||||
namespace ams::fs {
|
||||
|
||||
namespace {
|
||||
|
||||
/* NOTE: Nintendo does not attach a generator to a mounted SD card filesystem. */
|
||||
/* However, it is desirable for homebrew to be able to access SD via common path. */
|
||||
class SdCardCommonMountNameGenerator : public fsa::ICommonMountNameGenerator, public impl::Newable {
|
||||
public:
|
||||
explicit SdCardCommonMountNameGenerator() { /* ... */ }
|
||||
|
||||
virtual Result GenerateCommonMountName(char *dst, size_t dst_size) override {
|
||||
/* Determine how much space we need. */
|
||||
const size_t needed_size = strnlen(impl::SdCardFileSystemMountName, MountNameLengthMax) + 2;
|
||||
AMS_ABORT_UNLESS(dst_size >= needed_size);
|
||||
|
||||
/* Generate the name. */
|
||||
auto size = std::snprintf(dst, dst_size, "%s:", impl::SdCardFileSystemMountName);
|
||||
AMS_ASSERT(static_cast<size_t>(size) == needed_size - 1);
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
Result MountSdCard(const char *name) {
|
||||
/* Validate the mount name. */
|
||||
R_TRY(impl::CheckMountName(name));
|
||||
@@ -30,8 +54,13 @@ namespace ams::fs {
|
||||
auto fsa = std::make_unique<RemoteFileSystem>(fs);
|
||||
R_UNLESS(fsa != nullptr, fs::ResultAllocationFailureInSdCardA());
|
||||
|
||||
/* Allocate a new mountname generator. */
|
||||
/* NOTE: Nintendo does not attach a generator. */
|
||||
auto generator = std::make_unique<SdCardCommonMountNameGenerator>();
|
||||
R_UNLESS(generator != nullptr, fs::ResultAllocationFailureInSdCardA());
|
||||
|
||||
/* Register. */
|
||||
return fsa::Register(name, std::move(fsa));
|
||||
return fsa::Register(name, std::move(fsa), std::move(generator));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020 Adubbz, Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace ams::nim {
|
||||
|
||||
namespace {
|
||||
|
||||
bool g_initialized;
|
||||
|
||||
}
|
||||
/* Management. */
|
||||
void InitializeForNetworkInstallManager() {
|
||||
AMS_ASSERT(!g_initialized);
|
||||
R_ABORT_UNLESS(nimInitialize());
|
||||
g_initialized = true;
|
||||
}
|
||||
|
||||
void FinalizeForNetworkInstallManager() {
|
||||
AMS_ASSERT(g_initialized);
|
||||
nimExit();
|
||||
g_initialized = false;
|
||||
}
|
||||
|
||||
/* Service API. */
|
||||
Result DestroySystemUpdateTask(const SystemUpdateTaskId& id) {
|
||||
static_assert(sizeof(SystemUpdateTaskId) == sizeof(::NimSystemUpdateTaskId));
|
||||
return nimDestroySystemUpdateTask(reinterpret_cast<const ::NimSystemUpdateTaskId *>(std::addressof(id)));
|
||||
}
|
||||
|
||||
s32 ListSystemUpdateTask(SystemUpdateTaskId *out_list, size_t out_list_size) {
|
||||
static_assert(sizeof(SystemUpdateTaskId) == sizeof(::NimSystemUpdateTaskId));
|
||||
|
||||
s32 count;
|
||||
R_ABORT_UNLESS(nimListSystemUpdateTask(std::addressof(count), reinterpret_cast<::NimSystemUpdateTaskId *>(out_list), out_list_size));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user