mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-28 22:05:30 +03:00
Update formatter config for new AS and reformat
This commit is contained in:
parent
668f623256
commit
4c9d453008
16
.idea/codeStyles/Project.xml
generated
16
.idea/codeStyles/Project.xml
generated
@ -9,18 +9,9 @@
|
|||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
<value>
|
<value>
|
||||||
<package name="java.util" alias="false" withSubpackages="false" />
|
<package name="java.util" withSubpackages="false" static="false" />
|
||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
|
||||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
<package name="io.ktor" withSubpackages="true" static="false" />
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="SPACE_BEFORE_TYPE_COLON" value="true" />
|
<option name="SPACE_BEFORE_TYPE_COLON" value="true" />
|
||||||
@ -40,6 +31,7 @@
|
|||||||
<option name="CLASS_CONSTRUCTOR_INIT_LIST_WRAP" value="0" />
|
<option name="CLASS_CONSTRUCTOR_INIT_LIST_WRAP" value="0" />
|
||||||
<option name="SUPERCLASS_LIST_WRAP" value="0" />
|
<option name="SUPERCLASS_LIST_WRAP" value="0" />
|
||||||
<option name="ALIGN_INIT_LIST_IN_COLUMNS" value="false" />
|
<option name="ALIGN_INIT_LIST_IN_COLUMNS" value="false" />
|
||||||
|
<option name="SPACE_BEFORE_DICTIONARY_LITERAL_COLON" value="true" />
|
||||||
<option name="ADD_BRIEF_TAG" value="true" />
|
<option name="ADD_BRIEF_TAG" value="true" />
|
||||||
<option name="HEADER_GUARD_STYLE_PATTERN" value="${PROJECT_NAME}_${PROJECT_REL_PATH}_${FILE_NAME}_${EXT}" />
|
<option name="HEADER_GUARD_STYLE_PATTERN" value="${PROJECT_NAME}_${PROJECT_REL_PATH}_${FILE_NAME}_${EXT}" />
|
||||||
<option name="MACROS_NAMING_CONVENTION">
|
<option name="MACROS_NAMING_CONVENTION">
|
||||||
|
@ -17,7 +17,7 @@ namespace skyline::audio {
|
|||||||
struct {
|
struct {
|
||||||
u8 scale : 4; //!< The scale factor for this frame
|
u8 scale : 4; //!< The scale factor for this frame
|
||||||
u8 coefficientIndex : 3;
|
u8 coefficientIndex : 3;
|
||||||
u8 _pad_ :1;
|
u8 _pad_ : 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(FrameHeader) == 0x1);
|
static_assert(sizeof(FrameHeader) == 0x1);
|
||||||
|
@ -26,7 +26,7 @@ namespace skyline {
|
|||||||
void Logger::UpdateTag() {
|
void Logger::UpdateTag() {
|
||||||
std::array<char, 16> name;
|
std::array<char, 16> name;
|
||||||
if (!pthread_getname_np(pthread_self(), name.data(), name.size()))
|
if (!pthread_getname_np(pthread_self(), name.data(), name.size()))
|
||||||
threadName = name.data();
|
threadName = name.data();
|
||||||
else
|
else
|
||||||
threadName = "unk";
|
threadName = "unk";
|
||||||
logTag = std::string("emu-cpp-") + threadName;
|
logTag = std::string("emu-cpp-") + threadName;
|
||||||
|
@ -80,7 +80,7 @@ namespace skyline {
|
|||||||
produceCondition.notify_one();
|
produceCondition.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Append(span <Type> buffer) {
|
inline void Append(span<Type> buffer) {
|
||||||
std::unique_lock lock(productionMutex);
|
std::unique_lock lock(productionMutex);
|
||||||
for (auto &item : buffer) {
|
for (auto &item : buffer) {
|
||||||
auto next{end + 1};
|
auto next{end + 1};
|
||||||
@ -100,7 +100,7 @@ namespace skyline {
|
|||||||
* @param tranformation A function that takes in an item of TransformedType as input and returns an item of Type
|
* @param tranformation A function that takes in an item of TransformedType as input and returns an item of Type
|
||||||
*/
|
*/
|
||||||
template<typename TransformedType, typename Transformation>
|
template<typename TransformedType, typename Transformation>
|
||||||
inline void AppendTranform(span <TransformedType> buffer, Transformation transformation) {
|
inline void AppendTranform(span<TransformedType> buffer, Transformation transformation) {
|
||||||
std::unique_lock lock(productionMutex);
|
std::unique_lock lock(productionMutex);
|
||||||
auto next{end};
|
auto next{end};
|
||||||
for (auto &item : buffer) {
|
for (auto &item : buffer) {
|
||||||
|
@ -20,10 +20,10 @@ namespace skyline {
|
|||||||
struct ChunkDescriptor {
|
struct ChunkDescriptor {
|
||||||
u64 address; //!< The address of the chunk in the GPU address space
|
u64 address; //!< The address of the chunk in the GPU address space
|
||||||
u64 size; //!< The size of the chunk in bytes
|
u64 size; //!< The size of the chunk in bytes
|
||||||
u8* pointer; //!< A pointer to the chunk in the CPU address space (if mapped)
|
u8 *pointer; //!< A pointer to the chunk in the CPU address space (if mapped)
|
||||||
ChunkState state;
|
ChunkState state;
|
||||||
|
|
||||||
ChunkDescriptor(u64 address, u64 size, u8* pointer, ChunkState state) : address(address), size(size), pointer(pointer), state(state) {}
|
ChunkDescriptor(u64 address, u64 size, u8 *pointer, ChunkState state) : address(address), size(size), pointer(pointer), state(state) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return If the given chunk can be contained wholly within this chunk
|
* @return If the given chunk can be contained wholly within this chunk
|
||||||
@ -82,7 +82,7 @@ namespace skyline {
|
|||||||
* @param size The size of the region to map
|
* @param size The size of the region to map
|
||||||
* @return The virtual address of the region base
|
* @return The virtual address of the region base
|
||||||
*/
|
*/
|
||||||
u64 MapAllocate(u8* pointer, u64 size);
|
u64 MapAllocate(u8 *pointer, u64 size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Maps a physical CPU memory region to a fixed virtual memory region
|
* @brief Maps a physical CPU memory region to a fixed virtual memory region
|
||||||
@ -91,7 +91,7 @@ namespace skyline {
|
|||||||
* @param size The size of the region to map
|
* @param size The size of the region to map
|
||||||
* @return The virtual address of the region base
|
* @return The virtual address of the region base
|
||||||
*/
|
*/
|
||||||
u64 MapFixed(u64 address, u8* pointer, u64 size);
|
u64 MapFixed(u64 address, u8 *pointer, u64 size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Unmaps all chunks in the given region from the GPU address space
|
* @brief Unmaps all chunks in the given region from the GPU address space
|
||||||
|
@ -29,7 +29,7 @@ namespace skyline::gpu {
|
|||||||
|
|
||||||
void UpdateSurface(jobject newSurface);
|
void UpdateSurface(jobject newSurface);
|
||||||
|
|
||||||
void Present(const std::shared_ptr<Texture>& texture);
|
void Present(const std::shared_ptr<Texture> &texture);
|
||||||
|
|
||||||
ANativeWindow *window{};
|
ANativeWindow *window{};
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
|
||||||
namespace skyline::gpu {
|
namespace skyline::gpu {
|
||||||
GuestTexture::GuestTexture(const DeviceState &state, u8* pointer, texture::Dimensions dimensions, texture::Format format, texture::TileMode tiling, texture::TileConfig layout) : state(state), pointer(pointer), dimensions(dimensions), format(format), tileMode(tiling), tileConfig(layout) {}
|
GuestTexture::GuestTexture(const DeviceState &state, u8 *pointer, texture::Dimensions dimensions, texture::Format format, texture::TileMode tiling, texture::TileConfig layout) : state(state), pointer(pointer), dimensions(dimensions), format(format), tileMode(tiling), tileConfig(layout) {}
|
||||||
|
|
||||||
std::shared_ptr<Texture> GuestTexture::InitializeTexture(std::optional<texture::Format> format, std::optional<texture::Dimensions> dimensions, texture::Swizzle swizzle) {
|
std::shared_ptr<Texture> GuestTexture::InitializeTexture(std::optional<texture::Format> format, std::optional<texture::Dimensions> dimensions, texture::Swizzle swizzle) {
|
||||||
if (!host.expired())
|
if (!host.expired())
|
||||||
|
@ -123,14 +123,14 @@ namespace skyline {
|
|||||||
const DeviceState &state;
|
const DeviceState &state;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
u8* pointer; //!< The address of the texture in guest memory
|
u8 *pointer; //!< The address of the texture in guest memory
|
||||||
std::weak_ptr<Texture> host; //!< A host texture (if any) that was created from this guest texture
|
std::weak_ptr<Texture> host; //!< A host texture (if any) that was created from this guest texture
|
||||||
texture::Dimensions dimensions;
|
texture::Dimensions dimensions;
|
||||||
texture::Format format;
|
texture::Format format;
|
||||||
texture::TileMode tileMode;
|
texture::TileMode tileMode;
|
||||||
texture::TileConfig tileConfig;
|
texture::TileConfig tileConfig;
|
||||||
|
|
||||||
GuestTexture(const DeviceState &state, u8* pointer, texture::Dimensions dimensions, texture::Format format, texture::TileMode tileMode = texture::TileMode::Linear, texture::TileConfig tileConfig = {});
|
GuestTexture(const DeviceState &state, u8 *pointer, texture::Dimensions dimensions, texture::Format format, texture::TileMode tileMode = texture::TileMode::Linear, texture::TileConfig tileConfig = {});
|
||||||
|
|
||||||
constexpr size_t Size() {
|
constexpr size_t Size() {
|
||||||
return format.GetSize(dimensions);
|
return format.GetSize(dimensions);
|
||||||
|
@ -27,16 +27,16 @@ namespace skyline::input {
|
|||||||
union NpadStyleSet {
|
union NpadStyleSet {
|
||||||
u32 raw;
|
u32 raw;
|
||||||
struct {
|
struct {
|
||||||
bool proController : 1; //!< Pro Controller
|
bool proController : 1; //!< Pro Controller
|
||||||
bool joyconHandheld : 1; //!< Joy-Cons in handheld mode
|
bool joyconHandheld : 1; //!< Joy-Cons in handheld mode
|
||||||
bool joyconDual : 1; //!< Joy-Cons in a pair
|
bool joyconDual : 1; //!< Joy-Cons in a pair
|
||||||
bool joyconLeft : 1; //!< Left Joy-Con only
|
bool joyconLeft : 1; //!< Left Joy-Con only
|
||||||
bool joyconRight : 1; //!< Right Joy-Con only
|
bool joyconRight : 1; //!< Right Joy-Con only
|
||||||
bool gamecube : 1; //!< GameCube controller
|
bool gamecube : 1; //!< GameCube controller
|
||||||
bool palma : 1; //!< Poké Ball Plus controller
|
bool palma : 1; //!< Poké Ball Plus controller
|
||||||
bool nes : 1; //!< NES controller
|
bool nes : 1; //!< NES controller
|
||||||
bool nesHandheld : 1; //!< NES controller in handheld mode
|
bool nesHandheld : 1; //!< NES controller in handheld mode
|
||||||
bool snes : 1; //!< SNES controller
|
bool snes : 1; //!< SNES controller
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(NpadStyleSet) == 0x4);
|
static_assert(sizeof(NpadStyleSet) == 0x4);
|
||||||
@ -72,9 +72,9 @@ namespace skyline::input {
|
|||||||
u32 raw;
|
u32 raw;
|
||||||
struct {
|
struct {
|
||||||
u8 type;
|
u8 type;
|
||||||
NpadId id : 8;
|
NpadId id : 8;
|
||||||
bool isRight : 1; //!< If this is a right Joy-Con (Both) or right LRA in the Pro-Controller (Vibration)
|
bool isRight : 1; //!< If this is a right Joy-Con (Both) or right LRA in the Pro-Controller (Vibration)
|
||||||
bool isSixAxisSingle : 1; //!< If the Six-Axis device is a single unit, either Handheld or Pro-Controller
|
bool isSixAxisSingle : 1; //!< If the Six-Axis device is a single unit, either Handheld or Pro-Controller
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr NpadControllerType GetType() const {
|
constexpr NpadControllerType GetType() const {
|
||||||
|
@ -10,16 +10,16 @@ namespace skyline::input {
|
|||||||
u64 raw;
|
u64 raw;
|
||||||
struct {
|
struct {
|
||||||
bool lControl : 1; //!< Left Control Key
|
bool lControl : 1; //!< Left Control Key
|
||||||
bool lShift : 1; //!< Left Shift Key
|
bool lShift : 1; //!< Left Shift Key
|
||||||
bool lAlt : 1; //!< Left Alt Key
|
bool lAlt : 1; //!< Left Alt Key
|
||||||
bool lWindows : 1; //!< Left Windows Key
|
bool lWindows : 1; //!< Left Windows Key
|
||||||
bool rControl : 1; //!< Right Control Key
|
bool rControl : 1; //!< Right Control Key
|
||||||
bool rShift : 1; //!< Right Shift Key
|
bool rShift : 1; //!< Right Shift Key
|
||||||
bool rAlt : 1; //!< Right Alt Key
|
bool rAlt : 1; //!< Right Alt Key
|
||||||
bool rWindows : 1; //!< Right Windows Key
|
bool rWindows : 1; //!< Right Windows Key
|
||||||
bool capsLock : 1; //!< Caps-Lock Key
|
bool capsLock : 1; //!< Caps-Lock Key
|
||||||
bool scrLock : 1; //!< Scroll-Lock Key
|
bool scrLock : 1; //!< Scroll-Lock Key
|
||||||
bool numLock : 1; //!< Num-Lock Key
|
bool numLock : 1; //!< Num-Lock Key
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,34 +56,34 @@ namespace skyline::input {
|
|||||||
union NpadButton {
|
union NpadButton {
|
||||||
u64 raw;
|
u64 raw;
|
||||||
struct {
|
struct {
|
||||||
bool a : 1; //!< The A button
|
bool a : 1; //!< The A button
|
||||||
bool b : 1; //!< The B button
|
bool b : 1; //!< The B button
|
||||||
bool x : 1; //!< The X button
|
bool x : 1; //!< The X button
|
||||||
bool y : 1; //!< The Y button
|
bool y : 1; //!< The Y button
|
||||||
bool leftStick : 1; //!< The Left-Stick button
|
bool leftStick : 1; //!< The Left-Stick button
|
||||||
bool rightStick : 1; //!< The Right-Stick button
|
bool rightStick : 1; //!< The Right-Stick button
|
||||||
bool l : 1; //!< The L trigger
|
bool l : 1; //!< The L trigger
|
||||||
bool r : 1; //!< The R button
|
bool r : 1; //!< The R button
|
||||||
bool zl : 1; //!< The ZL trigger
|
bool zl : 1; //!< The ZL trigger
|
||||||
bool zr : 1; //!< The ZR trigger
|
bool zr : 1; //!< The ZR trigger
|
||||||
bool plus : 1; //!< The + button
|
bool plus : 1; //!< The + button
|
||||||
bool minus : 1; //!< The - button
|
bool minus : 1; //!< The - button
|
||||||
bool dpadLeft : 1; //!< D-Pad left
|
bool dpadLeft : 1; //!< D-Pad left
|
||||||
bool dpadUp : 1; //!< D-Pad up
|
bool dpadUp : 1; //!< D-Pad up
|
||||||
bool dpadRight : 1; //!< D-Pad right
|
bool dpadRight : 1; //!< D-Pad right
|
||||||
bool dpadDown : 1; //!< D-Pad down
|
bool dpadDown : 1; //!< D-Pad down
|
||||||
bool leftStickLeft : 1; //!< Left stick left
|
bool leftStickLeft : 1; //!< Left stick left
|
||||||
bool leftStickUp : 1; //!< Left stick up
|
bool leftStickUp : 1; //!< Left stick up
|
||||||
bool leftStickRight : 1; //!< Left stick right
|
bool leftStickRight : 1; //!< Left stick right
|
||||||
bool leftStickDown : 1; //!< Left stick down
|
bool leftStickDown : 1; //!< Left stick down
|
||||||
bool rightStickLeft : 1; //!< Right stick left
|
bool rightStickLeft : 1; //!< Right stick left
|
||||||
bool rightStickUp : 1; //!< Right stick up
|
bool rightStickUp : 1; //!< Right stick up
|
||||||
bool rightStickRight : 1; //!< Right stick right
|
bool rightStickRight : 1; //!< Right stick right
|
||||||
bool rightStickDown : 1; //!< Right stick down
|
bool rightStickDown : 1; //!< Right stick down
|
||||||
bool leftSl : 1; //!< Left Joy-Con SL button
|
bool leftSl : 1; //!< Left Joy-Con SL button
|
||||||
bool leftSr : 1; //!< Left Joy-Con SR button
|
bool leftSr : 1; //!< Left Joy-Con SR button
|
||||||
bool rightSl : 1; //!< Right Joy-Con SL button
|
bool rightSl : 1; //!< Right Joy-Con SL button
|
||||||
bool rightSr : 1; //!< Right Joy-Con SR button
|
bool rightSr : 1; //!< Right Joy-Con SR button
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(NpadButton) == 0x8);
|
static_assert(sizeof(NpadButton) == 0x8);
|
||||||
|
@ -17,16 +17,16 @@ namespace skyline::input {
|
|||||||
if (!activated)
|
if (!activated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto& lastEntry{section.entries[section.header.currentEntry]};
|
const auto &lastEntry{section.entries[section.header.currentEntry]};
|
||||||
auto entryIndex{(section.header.currentEntry != constant::HidEntryCount - 1) ? section.header.currentEntry + 1 : 0};
|
auto entryIndex{(section.header.currentEntry != constant::HidEntryCount - 1) ? section.header.currentEntry + 1 : 0};
|
||||||
auto& entry{section.entries[entryIndex]};
|
auto &entry{section.entries[entryIndex]};
|
||||||
entry.globalTimestamp = lastEntry.globalTimestamp + 1;
|
entry.globalTimestamp = lastEntry.globalTimestamp + 1;
|
||||||
entry.localTimestamp = lastEntry.localTimestamp + 1;
|
entry.localTimestamp = lastEntry.localTimestamp + 1;
|
||||||
entry.touchCount = points.size();
|
entry.touchCount = points.size();
|
||||||
|
|
||||||
for (size_t i{}; i < points.size(); i++) {
|
for (size_t i{}; i < points.size(); i++) {
|
||||||
const auto& host{points[i]};
|
const auto &host{points[i]};
|
||||||
auto& guest{entry.data[i]};
|
auto &guest{entry.data[i]};
|
||||||
guest.index = i;
|
guest.index = i;
|
||||||
guest.positionX = host.x;
|
guest.positionX = host.x;
|
||||||
guest.positionY = host.y;
|
guest.positionY = host.y;
|
||||||
|
@ -40,15 +40,15 @@ namespace skyline {
|
|||||||
* @url https://switchbrew.org/wiki/IPC_Marshalling#IPC_Command_Structure
|
* @url https://switchbrew.org/wiki/IPC_Marshalling#IPC_Command_Structure
|
||||||
*/
|
*/
|
||||||
struct CommandHeader {
|
struct CommandHeader {
|
||||||
CommandType type : 16;
|
CommandType type : 16;
|
||||||
u8 xNo : 4;
|
u8 xNo : 4;
|
||||||
u8 aNo : 4;
|
u8 aNo : 4;
|
||||||
u8 bNo : 4;
|
u8 bNo : 4;
|
||||||
u8 wNo : 4;
|
u8 wNo : 4;
|
||||||
u32 rawSize : 10;
|
u32 rawSize : 10;
|
||||||
BufferCFlag cFlag : 4;
|
BufferCFlag cFlag : 4;
|
||||||
u32 : 17;
|
u32 : 17;
|
||||||
bool handleDesc : 1;
|
bool handleDesc : 1;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CommandHeader) == 8);
|
static_assert(sizeof(CommandHeader) == 8);
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ namespace skyline {
|
|||||||
* @url https://switchbrew.org/wiki/IPC_Marshalling#Handle_descriptor
|
* @url https://switchbrew.org/wiki/IPC_Marshalling#Handle_descriptor
|
||||||
*/
|
*/
|
||||||
struct HandleDescriptor {
|
struct HandleDescriptor {
|
||||||
bool sendPid : 1;
|
bool sendPid : 1;
|
||||||
u32 copyCount : 4;
|
u32 copyCount : 4;
|
||||||
u32 moveCount : 4;
|
u32 moveCount : 4;
|
||||||
u32 : 23;
|
u32 : 23;
|
||||||
@ -122,12 +122,12 @@ namespace skyline {
|
|||||||
* @url https://switchbrew.org/wiki/IPC_Marshalling#Buffer_descriptor_X_.22Pointer.22
|
* @url https://switchbrew.org/wiki/IPC_Marshalling#Buffer_descriptor_X_.22Pointer.22
|
||||||
*/
|
*/
|
||||||
struct BufferDescriptorX {
|
struct BufferDescriptorX {
|
||||||
u16 counter0_5 : 6; //!< The first 5 bits of the counter
|
u16 counter0_5 : 6; //!< The first 5 bits of the counter
|
||||||
u16 address36_38 : 3; //!< Bit 36-38 of the address
|
u16 address36_38 : 3; //!< Bit 36-38 of the address
|
||||||
u16 counter9_11 : 3; //!< Bit 9-11 of the counter
|
u16 counter9_11 : 3; //!< Bit 9-11 of the counter
|
||||||
u16 address32_35 : 4; //!< Bit 32-35 of the address
|
u16 address32_35 : 4; //!< Bit 32-35 of the address
|
||||||
u16 size : 16; //!< The 16 bit size of the buffer
|
u16 size : 16; //!< The 16 bit size of the buffer
|
||||||
u32 address0_31 : 32; //!< The first 32-bits of the address
|
u32 address0_31 : 32; //!< The first 32-bits of the address
|
||||||
|
|
||||||
BufferDescriptorX(u64 address, u16 counter, u16 size) : size(size) {
|
BufferDescriptorX(u64 address, u16 counter, u16 size) : size(size) {
|
||||||
address0_31 = static_cast<u32>(address & 0x7FFFFFFF80000000);
|
address0_31 = static_cast<u32>(address & 0x7FFFFFFF80000000);
|
||||||
@ -137,8 +137,8 @@ namespace skyline {
|
|||||||
counter9_11 = static_cast<u16>(address & 0x38);
|
counter9_11 = static_cast<u16>(address & 0x38);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u8* Pointer() {
|
inline u8 *Pointer() {
|
||||||
return reinterpret_cast<u8*>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
|
return reinterpret_cast<u8 *>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u16 Counter() {
|
inline u16 Counter() {
|
||||||
@ -151,12 +151,12 @@ namespace skyline {
|
|||||||
* @url https://switchbrew.org/wiki/IPC_Marshalling#Buffer_descriptor_A.2FB.2FW_.22Send.22.2F.22Receive.22.2F.22Exchange.22
|
* @url https://switchbrew.org/wiki/IPC_Marshalling#Buffer_descriptor_A.2FB.2FW_.22Send.22.2F.22Receive.22.2F.22Exchange.22
|
||||||
*/
|
*/
|
||||||
struct BufferDescriptorABW {
|
struct BufferDescriptorABW {
|
||||||
u32 size0_31 : 32; //!< The first 32 bits of the size
|
u32 size0_31 : 32; //!< The first 32 bits of the size
|
||||||
u32 address0_31 : 32; //!< The first 32 bits of the address
|
u32 address0_31 : 32; //!< The first 32 bits of the address
|
||||||
u8 flags : 2; //!< The buffer flags
|
u8 flags : 2; //!< The buffer flags
|
||||||
u8 address36_38 : 3; //!< Bit 36-38 of the address
|
u8 address36_38 : 3; //!< Bit 36-38 of the address
|
||||||
u32 : 19;
|
u32 : 19;
|
||||||
u8 size32_35 : 4; //!< Bit 32-35 of the size
|
u8 size32_35 : 4; //!< Bit 32-35 of the size
|
||||||
u8 address32_35 : 4; //!< Bit 32-35 of the address
|
u8 address32_35 : 4; //!< Bit 32-35 of the address
|
||||||
|
|
||||||
BufferDescriptorABW(u64 address, u64 size) {
|
BufferDescriptorABW(u64 address, u64 size) {
|
||||||
@ -167,8 +167,8 @@ namespace skyline {
|
|||||||
size32_35 = static_cast<u8>(size & 0x78000000);
|
size32_35 = static_cast<u8>(size & 0x78000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u8* Pointer() {
|
inline u8 *Pointer() {
|
||||||
return reinterpret_cast<u8*>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
|
return reinterpret_cast<u8 *>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u64 Size() {
|
inline u64 Size() {
|
||||||
@ -182,10 +182,10 @@ namespace skyline {
|
|||||||
*/
|
*/
|
||||||
struct BufferDescriptorC {
|
struct BufferDescriptorC {
|
||||||
u64 address : 48; //!< The 48-bit address of the buffer
|
u64 address : 48; //!< The 48-bit address of the buffer
|
||||||
u32 size : 16; //!< The 16-bit size of the buffer
|
u32 size : 16; //!< The 16-bit size of the buffer
|
||||||
|
|
||||||
inline u8* Pointer() {
|
inline u8 *Pointer() {
|
||||||
return reinterpret_cast<u8*>(address);
|
return reinterpret_cast<u8 *>(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferDescriptorC(u64 address, u16 size) : address(address), size(size) {}
|
BufferDescriptorC(u64 address, u16 size) : address(address), size(size) {}
|
||||||
|
@ -48,10 +48,10 @@ namespace skyline {
|
|||||||
*/
|
*/
|
||||||
union MemoryAttribute {
|
union MemoryAttribute {
|
||||||
struct {
|
struct {
|
||||||
bool isBorrowed : 1; //!< This is required for async IPC user buffers
|
bool isBorrowed : 1; //!< This is required for async IPC user buffers
|
||||||
bool isIpcLocked : 1; //!< True when IpcRefCount > 0
|
bool isIpcLocked : 1; //!< True when IpcRefCount > 0
|
||||||
bool isDeviceShared : 1; //!< True when DeviceRefCount > 0
|
bool isDeviceShared : 1; //!< True when DeviceRefCount > 0
|
||||||
bool isUncached : 1; //!< This is used to disable memory caching to share memory with the GPU
|
bool isUncached : 1; //!< This is used to disable memory caching to share memory with the GPU
|
||||||
};
|
};
|
||||||
u32 value{};
|
u32 value{};
|
||||||
};
|
};
|
||||||
@ -108,11 +108,11 @@ namespace skyline {
|
|||||||
|
|
||||||
constexpr MemoryState() : value(0) {}
|
constexpr MemoryState() : value(0) {}
|
||||||
|
|
||||||
constexpr bool operator==(const MemoryState& other) const {
|
constexpr bool operator==(const MemoryState &other) const {
|
||||||
return value == other.value;
|
return value == other.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator!=(const MemoryState& other) const {
|
constexpr bool operator!=(const MemoryState &other) const {
|
||||||
return value != other.value;
|
return value != other.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ namespace skyline {
|
|||||||
u64 address;
|
u64 address;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
bool IsInside(void* ptr) {
|
bool IsInside(void *ptr) {
|
||||||
return (address <= reinterpret_cast<u64>(ptr)) && ((address + size) > reinterpret_cast<u64>(ptr));
|
return (address <= reinterpret_cast<u64>(ptr)) && ((address + size) > reinterpret_cast<u64>(ptr));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -194,13 +194,13 @@ namespace skyline {
|
|||||||
|
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
struct ChunkDescriptor {
|
struct ChunkDescriptor {
|
||||||
u8* ptr;
|
u8 *ptr;
|
||||||
size_t size;
|
size_t size;
|
||||||
memory::Permission permission;
|
memory::Permission permission;
|
||||||
memory::MemoryState state;
|
memory::MemoryState state;
|
||||||
memory::MemoryAttribute attributes;
|
memory::MemoryAttribute attributes;
|
||||||
|
|
||||||
constexpr bool IsCompatible(const ChunkDescriptor& chunk) const {
|
constexpr bool IsCompatible(const ChunkDescriptor &chunk) const {
|
||||||
return chunk.permission == permission && chunk.state.value == state.value && chunk.attributes.value == attributes.value;
|
return chunk.permission == permission && chunk.state.value == state.value && chunk.attributes.value == attributes.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -233,11 +233,11 @@ namespace skyline {
|
|||||||
*/
|
*/
|
||||||
void InitializeVmm(memory::AddressSpaceType type);
|
void InitializeVmm(memory::AddressSpaceType type);
|
||||||
|
|
||||||
void InitializeRegions(u8* codeStart, u64 size);
|
void InitializeRegions(u8 *codeStart, u64 size);
|
||||||
|
|
||||||
void InsertChunk(const ChunkDescriptor &chunk);
|
void InsertChunk(const ChunkDescriptor &chunk);
|
||||||
|
|
||||||
std::optional<ChunkDescriptor> Get(void* ptr);
|
std::optional<ChunkDescriptor> Get(void *ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The cumulative size of all memory mappings in bytes
|
* @return The cumulative size of all memory mappings in bytes
|
||||||
|
@ -25,9 +25,9 @@ namespace skyline::kernel::type {
|
|||||||
* @param size The size of the partition to change the permissions of
|
* @param size The size of the partition to change the permissions of
|
||||||
* @param permission The new permissions to be set for the memory
|
* @param permission The new permissions to be set for the memory
|
||||||
*/
|
*/
|
||||||
virtual void UpdatePermission(u8* ptr, size_t size, memory::Permission permission) = 0;
|
virtual void UpdatePermission(u8 *ptr, size_t size, memory::Permission permission) = 0;
|
||||||
|
|
||||||
bool IsInside(u8* ptr) {
|
bool IsInside(u8 *ptr) {
|
||||||
auto spn{Get()};
|
auto spn{Get()};
|
||||||
return (spn.data() <= ptr) && ((spn.data() + spn.size()) > ptr);
|
return (spn.data() <= ptr) && ((spn.data() + spn.size()) > ptr);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace skyline::kernel::type {
|
|||||||
*/
|
*/
|
||||||
class KPrivateMemory : public KMemory {
|
class KPrivateMemory : public KMemory {
|
||||||
public:
|
public:
|
||||||
u8* ptr{};
|
u8 *ptr{};
|
||||||
size_t size{};
|
size_t size{};
|
||||||
memory::Permission permission;
|
memory::Permission permission;
|
||||||
memory::MemoryState memState;
|
memory::MemoryState memState;
|
||||||
@ -20,14 +20,14 @@ namespace skyline::kernel::type {
|
|||||||
* @param permission The permissions for the allocated memory (As reported to the application, host memory permissions aren't reflected by this)
|
* @param permission The permissions for the allocated memory (As reported to the application, host memory permissions aren't reflected by this)
|
||||||
* @note 'ptr' needs to be in guest-reserved address space
|
* @note 'ptr' needs to be in guest-reserved address space
|
||||||
*/
|
*/
|
||||||
KPrivateMemory(const DeviceState &state, u8* ptr, size_t size, memory::Permission permission, memory::MemoryState memState);
|
KPrivateMemory(const DeviceState &state, u8 *ptr, size_t size, memory::Permission permission, memory::MemoryState memState);
|
||||||
|
|
||||||
void Resize(size_t size);
|
void Resize(size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note Only contents of any overlapping regions will be retained
|
* @note Only contents of any overlapping regions will be retained
|
||||||
*/
|
*/
|
||||||
void Remap(u8* ptr, size_t size);
|
void Remap(u8 *ptr, size_t size);
|
||||||
|
|
||||||
inline span<u8> Get() override {
|
inline span<u8> Get() override {
|
||||||
return span(ptr, size);
|
return span(ptr, size);
|
||||||
@ -39,7 +39,7 @@ namespace skyline::kernel::type {
|
|||||||
* @param size The size of the partition to change the permissions of
|
* @param size The size of the partition to change the permissions of
|
||||||
* @param permission The new permissions to be set for the memory
|
* @param permission The new permissions to be set for the memory
|
||||||
*/
|
*/
|
||||||
void UpdatePermission(u8* ptr, size_t size, memory::Permission permission) override;
|
void UpdatePermission(u8 *ptr, size_t size, memory::Permission permission) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The destructor of private memory, it deallocates the memory
|
* @brief The destructor of private memory, it deallocates the memory
|
||||||
|
@ -32,11 +32,11 @@ namespace skyline {
|
|||||||
std::atomic_bool flag{false};
|
std::atomic_bool flag{false};
|
||||||
i8 priority;
|
i8 priority;
|
||||||
KHandle handle;
|
KHandle handle;
|
||||||
u32* mutex{};
|
u32 *mutex{};
|
||||||
|
|
||||||
WaitStatus(i8 priority, KHandle handle);
|
WaitStatus(i8 priority, KHandle handle);
|
||||||
|
|
||||||
WaitStatus(i8 priority, KHandle handle, u32* mutex);
|
WaitStatus(i8 priority, KHandle handle, u32 *mutex);
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unordered_map<u64, std::vector<std::shared_ptr<WaitStatus>>> mutexes; //!< A map from a mutex's address to a vector of Mutex objects for threads waiting on it
|
std::unordered_map<u64, std::vector<std::shared_ptr<WaitStatus>>> mutexes; //!< A map from a mutex's address to a vector of Mutex objects for threads waiting on it
|
||||||
@ -56,11 +56,11 @@ namespace skyline {
|
|||||||
u8 index{}; //!< The slots are assigned sequentially, this holds the index of the last TLS slot reserved
|
u8 index{}; //!< The slots are assigned sequentially, this holds the index of the last TLS slot reserved
|
||||||
std::shared_ptr<KPrivateMemory> memory;
|
std::shared_ptr<KPrivateMemory> memory;
|
||||||
|
|
||||||
TlsPage(const std::shared_ptr<KPrivateMemory>& memory);
|
TlsPage(const std::shared_ptr<KPrivateMemory> &memory);
|
||||||
|
|
||||||
u8* ReserveSlot();
|
u8 *ReserveSlot();
|
||||||
|
|
||||||
u8* Get(u8 index);
|
u8 *Get(u8 index);
|
||||||
|
|
||||||
bool Full();
|
bool Full();
|
||||||
};
|
};
|
||||||
@ -87,7 +87,7 @@ namespace skyline {
|
|||||||
/**
|
/**
|
||||||
* @return A 0x200 TLS slot allocated inside the TLS/IO region
|
* @return A 0x200 TLS slot allocated inside the TLS/IO region
|
||||||
*/
|
*/
|
||||||
u8* AllocateTlsSlot();
|
u8 *AllocateTlsSlot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note The default values are for the main thread and will use values from the NPDM
|
* @note The default values are for the main thread and will use values from the NPDM
|
||||||
@ -159,7 +159,7 @@ namespace skyline {
|
|||||||
else
|
else
|
||||||
throw exception("KProcess::GetHandle couldn't determine object type");
|
throw exception("KProcess::GetHandle couldn't determine object type");
|
||||||
try {
|
try {
|
||||||
auto& item{handles.at(handle - constant::BaseHandleIndex)};
|
auto &item{handles.at(handle - constant::BaseHandleIndex)};
|
||||||
if (item != nullptr && item->objectType == objectType)
|
if (item != nullptr && item->objectType == objectType)
|
||||||
return std::static_pointer_cast<objectClass>(item);
|
return std::static_pointer_cast<objectClass>(item);
|
||||||
else if (item == nullptr)
|
else if (item == nullptr)
|
||||||
@ -181,7 +181,7 @@ namespace skyline {
|
|||||||
* @param address The address to look for
|
* @param address The address to look for
|
||||||
* @return A shared pointer to the corresponding KMemory object
|
* @return A shared pointer to the corresponding KMemory object
|
||||||
*/
|
*/
|
||||||
std::optional<HandleOut<KMemory>> GetMemoryObject(u8* ptr);
|
std::optional<HandleOut<KMemory>> GetMemoryObject(u8 *ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Closes a handle in the handle table
|
* @brief Closes a handle in the handle table
|
||||||
@ -195,25 +195,25 @@ namespace skyline {
|
|||||||
* @param owner The handle of the current mutex owner
|
* @param owner The handle of the current mutex owner
|
||||||
* @return If the mutex was successfully locked
|
* @return If the mutex was successfully locked
|
||||||
*/
|
*/
|
||||||
bool MutexLock(u32* mutex, KHandle owner);
|
bool MutexLock(u32 *mutex, KHandle owner);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Unlocks the Mutex at the specified address
|
* @brief Unlocks the Mutex at the specified address
|
||||||
* @return If the mutex was successfully unlocked
|
* @return If the mutex was successfully unlocked
|
||||||
*/
|
*/
|
||||||
bool MutexUnlock(u32* mutex);
|
bool MutexUnlock(u32 *mutex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param timeout The amount of time to wait for the conditional variable
|
* @param timeout The amount of time to wait for the conditional variable
|
||||||
* @return If the conditional variable was successfully waited for or timed out
|
* @return If the conditional variable was successfully waited for or timed out
|
||||||
*/
|
*/
|
||||||
bool ConditionalVariableWait(void* conditional, u32* mutex, u64 timeout);
|
bool ConditionalVariableWait(void *conditional, u32 *mutex, u64 timeout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Signals a number of conditional variable waiters
|
* @brief Signals a number of conditional variable waiters
|
||||||
* @param amount The amount of waiters to signal
|
* @param amount The amount of waiters to signal
|
||||||
*/
|
*/
|
||||||
void ConditionalVariableSignal(void* conditional, u64 amount);
|
void ConditionalVariableSignal(void *conditional, u64 amount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Resets the object to an unsignalled state
|
* @brief Resets the object to an unsignalled state
|
||||||
|
@ -35,7 +35,7 @@ namespace skyline::kernel::type {
|
|||||||
return span(guest.ptr, guest.size);
|
return span(guest.ptr, guest.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePermission(u8* ptr, size_t size, memory::Permission permission) override;
|
void UpdatePermission(u8 *ptr, size_t size, memory::Permission permission) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The destructor of shared memory, it deallocates the memory from all processes
|
* @brief The destructor of shared memory, it deallocates the memory from all processes
|
||||||
|
@ -35,7 +35,7 @@ namespace skyline::loader {
|
|||||||
process->NewHandle<kernel::type::KPrivateMemory>(base + patch.size + executable.data.offset, dataSize, memory::Permission{true, true, false}, memory::states::CodeMutable); // RW-
|
process->NewHandle<kernel::type::KPrivateMemory>(base + patch.size + executable.data.offset, dataSize, memory::Permission{true, true, false}, memory::states::CodeMutable); // RW-
|
||||||
state.logger->Debug("Successfully mapped section .data + .bss @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.data.offset, dataSize);
|
state.logger->Debug("Successfully mapped section .data + .bss @ 0x{:X}, Size = 0x{:X}", base + patch.size + executable.data.offset, dataSize);
|
||||||
|
|
||||||
state.nce->PatchCode(executable.text.contents, reinterpret_cast<u32*>(base), patch.size, patch.offsets);
|
state.nce->PatchCode(executable.text.contents, reinterpret_cast<u32 *>(base), patch.size, patch.offsets);
|
||||||
std::memcpy(base + patch.size + executable.text.offset, executable.text.contents.data(), textSize);
|
std::memcpy(base + patch.size + executable.text.offset, executable.text.contents.data(), textSize);
|
||||||
std::memcpy(base + patch.size + executable.ro.offset, executable.ro.contents.data(), roSize);
|
std::memcpy(base + patch.size + executable.ro.offset, executable.ro.contents.data(), roSize);
|
||||||
std::memcpy(base + patch.size + executable.data.offset, executable.data.contents.data(), dataSize - executable.bssSize);
|
std::memcpy(base + patch.size + executable.data.offset, executable.data.contents.data(), dataSize - executable.bssSize);
|
||||||
|
@ -51,9 +51,9 @@ namespace skyline::loader {
|
|||||||
* @brief Information about the placement of an executable in memory
|
* @brief Information about the placement of an executable in memory
|
||||||
*/
|
*/
|
||||||
struct ExecutableLoadInfo {
|
struct ExecutableLoadInfo {
|
||||||
u8* base; //!< The base of the loaded executable
|
u8 *base; //!< The base of the loaded executable
|
||||||
size_t size; //!< The total size of the loaded executable
|
size_t size; //!< The total size of the loaded executable
|
||||||
void* entry; //!< The entry point of the loaded executable
|
void *entry; //!< The entry point of the loaded executable
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,6 +78,6 @@ namespace skyline::loader {
|
|||||||
/**
|
/**
|
||||||
* @return Entry point to the start of the main executable in the ROM
|
* @return Entry point to the start of the main executable in the ROM
|
||||||
*/
|
*/
|
||||||
virtual void* LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) = 0;
|
virtual void *LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace skyline::loader {
|
|||||||
throw exception("Only NCAs with an ExeFS can be loaded directly");
|
throw exception("Only NCAs with an ExeFS can be loaded directly");
|
||||||
}
|
}
|
||||||
|
|
||||||
void* NcaLoader::LoadExeFs(const std::shared_ptr<vfs::FileSystem> &exeFs, const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
void *NcaLoader::LoadExeFs(const std::shared_ptr<vfs::FileSystem> &exeFs, const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
||||||
if (exeFs == nullptr)
|
if (exeFs == nullptr)
|
||||||
throw exception("Cannot load a null ExeFS");
|
throw exception("Cannot load a null ExeFS");
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ namespace skyline::loader {
|
|||||||
|
|
||||||
auto loadInfo{NsoLoader::LoadNso(nsoFile, process, state)};
|
auto loadInfo{NsoLoader::LoadNso(nsoFile, process, state)};
|
||||||
u64 offset{loadInfo.size};
|
u64 offset{loadInfo.size};
|
||||||
u8* base{loadInfo.base};
|
u8 *base{loadInfo.base};
|
||||||
void* entry{loadInfo.entry};
|
void *entry{loadInfo.entry};
|
||||||
|
|
||||||
state.logger->Info("Loaded nso 'rtld' at 0x{:X} (.text @ 0x{:X})", base, entry);
|
state.logger->Info("Loaded nso 'rtld' at 0x{:X} (.text @ 0x{:X})", base, entry);
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ namespace skyline::loader {
|
|||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* NcaLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
void *NcaLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
||||||
process->npdm = vfs::NPDM(nca.exeFs->OpenFile("main.npdm"));
|
process->npdm = vfs::NPDM(nca.exeFs->OpenFile("main.npdm"));
|
||||||
return LoadExeFs(nca.exeFs, process, state);
|
return LoadExeFs(nca.exeFs, process, state);
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ namespace skyline::loader {
|
|||||||
* @param exefs A filesystem object containing the ExeFS filesystem to load into memory
|
* @param exefs A filesystem object containing the ExeFS filesystem to load into memory
|
||||||
* @param process The process to load the ExeFS into
|
* @param process The process to load the ExeFS into
|
||||||
*/
|
*/
|
||||||
static void* LoadExeFs(const std::shared_ptr<vfs::FileSystem> &exefs, const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
static void *LoadExeFs(const std::shared_ptr<vfs::FileSystem> &exefs, const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
||||||
|
|
||||||
void* LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
void *LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace skyline::loader {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* NroLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
void *NroLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
||||||
Executable nroExecutable{};
|
Executable nroExecutable{};
|
||||||
|
|
||||||
nroExecutable.text.contents = GetSegment(header.text);
|
nroExecutable.text.contents = GetSegment(header.text);
|
||||||
|
@ -72,6 +72,6 @@ namespace skyline::loader {
|
|||||||
|
|
||||||
std::vector<u8> GetIcon();
|
std::vector<u8> GetIcon();
|
||||||
|
|
||||||
void* LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
void *LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ namespace skyline::loader {
|
|||||||
return LoadExecutable(process, state, nsoExecutable, offset);
|
return LoadExecutable(process, state, nsoExecutable, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* NsoLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
void *NsoLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
||||||
state.process->memory.InitializeVmm(memory::AddressSpaceType::AddressSpace39Bit);
|
state.process->memory.InitializeVmm(memory::AddressSpaceType::AddressSpace39Bit);
|
||||||
auto loadInfo{LoadNso(backing, process, state)};
|
auto loadInfo{LoadNso(backing, process, state)};
|
||||||
state.process->memory.InitializeRegions(loadInfo.base, loadInfo.size);
|
state.process->memory.InitializeRegions(loadInfo.base, loadInfo.size);
|
||||||
|
@ -83,6 +83,6 @@ namespace skyline::loader {
|
|||||||
*/
|
*/
|
||||||
static ExecutableLoadInfo LoadNso(const std::shared_ptr<vfs::Backing> &backing, const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state, size_t offset = 0);
|
static ExecutableLoadInfo LoadNso(const std::shared_ptr<vfs::Backing> &backing, const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state, size_t offset = 0);
|
||||||
|
|
||||||
void* LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
void *LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace skyline::loader {
|
|||||||
nacp.emplace(controlRomFs->OpenFile("control.nacp"));
|
nacp.emplace(controlRomFs->OpenFile("control.nacp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void* NspLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
void *NspLoader::LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state) {
|
||||||
process->npdm = vfs::NPDM(programNca->exeFs->OpenFile("main.npdm"));
|
process->npdm = vfs::NPDM(programNca->exeFs->OpenFile("main.npdm"));
|
||||||
return NcaLoader::LoadExeFs(programNca->exeFs, process, state);
|
return NcaLoader::LoadExeFs(programNca->exeFs, process, state);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,6 @@ namespace skyline::loader {
|
|||||||
|
|
||||||
std::vector<u8> GetIcon();
|
std::vector<u8> GetIcon();
|
||||||
|
|
||||||
void* LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
void *LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace skyline::nce {
|
|||||||
private:
|
private:
|
||||||
const DeviceState &state;
|
const DeviceState &state;
|
||||||
|
|
||||||
static void SvcHandler(u16 svc, ThreadContext* ctx);
|
static void SvcHandler(u16 svc, ThreadContext *ctx);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void SignalHandler(int signal, siginfo *info, ucontext *context, void *oldTls);
|
static void SignalHandler(int signal, siginfo *info, ucontext *context, void *oldTls);
|
||||||
@ -32,6 +32,6 @@ namespace skyline::nce {
|
|||||||
* @brief Writes the .patch section and mutates the code accordingly
|
* @brief Writes the .patch section and mutates the code accordingly
|
||||||
* @param patch A pointer to the .patch section which should be exactly patchSize in size and located before the .text section
|
* @param patch A pointer to the .patch section which should be exactly patchSize in size and located before the .text section
|
||||||
*/
|
*/
|
||||||
static void PatchCode(std::vector<u8> &text, u32* patch, size_t patchSize, const std::vector<size_t>& offsets);
|
static void PatchCode(std::vector<u8> &text, u32 *patch, size_t patchSize, const std::vector<size_t> &offsets);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ namespace skyline::nce {
|
|||||||
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u8 sig0 : 5; //!< 5-bit signature (0x0)
|
u8 sig0 : 5; //!< 5-bit signature (0x0)
|
||||||
u32 value : 16; //!< 16-bit immediate value
|
u32 value : 16; //!< 16-bit immediate value
|
||||||
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
|
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -49,9 +49,9 @@ namespace skyline::nce {
|
|||||||
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u8 sig0 : 5; //!< 5-bit signature (0x0)
|
u8 sig0 : 5; //!< 5-bit signature (0x0)
|
||||||
u32 value : 16; //!< 16-bit immediate value
|
u32 value : 16; //!< 16-bit immediate value
|
||||||
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
|
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -78,9 +78,9 @@ namespace skyline::nce {
|
|||||||
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u8 destReg : 5; //!< 5-bit destination register
|
u8 destReg : 5; //!< 5-bit destination register
|
||||||
u32 srcReg : 15; //!< 15-bit source register
|
u32 srcReg : 15; //!< 15-bit source register
|
||||||
u16 sig : 12; //!< 16-bit signature (0xD53)
|
u16 sig : 12; //!< 16-bit signature (0xD53)
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -97,9 +97,9 @@ namespace skyline::nce {
|
|||||||
|
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
u8 srcReg : 5; //!< 5-bit destination register
|
u8 srcReg : 5; //!< 5-bit destination register
|
||||||
u32 destReg : 15; //!< 15-bit source register
|
u32 destReg : 15; //!< 15-bit source register
|
||||||
u16 sig : 12; //!< 16-bit signature (0xD51)
|
u16 sig : 12; //!< 16-bit signature (0xD51)
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -133,7 +133,7 @@ namespace skyline::nce {
|
|||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
i32 offset : 26; //!< 26-bit branch offset
|
i32 offset : 26; //!< 26-bit branch offset
|
||||||
u8 sig : 6; //!< 6-bit signature (0x5)
|
u8 sig : 6; //!< 6-bit signature (0x5)
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -167,7 +167,7 @@ namespace skyline::nce {
|
|||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
i32 offset : 26; //!< 26-bit branch offset
|
i32 offset : 26; //!< 26-bit branch offset
|
||||||
u8 sig : 6; //!< 6-bit signature (0x25)
|
u8 sig : 6; //!< 6-bit signature (0x25)
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -219,10 +219,10 @@ namespace skyline::nce {
|
|||||||
union {
|
union {
|
||||||
struct __attribute__((packed)) {
|
struct __attribute__((packed)) {
|
||||||
u8 destReg : 5; //!< 5-bit destination register
|
u8 destReg : 5; //!< 5-bit destination register
|
||||||
u16 imm16 : 16; //!< 16-bit immediate value
|
u16 imm16 : 16; //!< 16-bit immediate value
|
||||||
u8 hw : 2; //!< 2-bit offset
|
u8 hw : 2; //!< 2-bit offset
|
||||||
u8 sig : 8; //!< 8-bit signature (0xA5)
|
u8 sig : 8; //!< 8-bit signature (0xA5)
|
||||||
u8 sf : 1; //!< 1-bit register type
|
u8 sf : 1; //!< 1-bit register type
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -274,10 +274,10 @@ namespace skyline::nce {
|
|||||||
union {
|
union {
|
||||||
struct __attribute__((packed)) {
|
struct __attribute__((packed)) {
|
||||||
u8 destReg : 5; //!< 5-bit destination register
|
u8 destReg : 5; //!< 5-bit destination register
|
||||||
u16 imm16 : 16; //!< 16-bit immediate value
|
u16 imm16 : 16; //!< 16-bit immediate value
|
||||||
u8 hw : 2; //!< 2-bit offset
|
u8 hw : 2; //!< 2-bit offset
|
||||||
u8 sig : 8; //!< 8-bit signature (0xA5)
|
u8 sig : 8; //!< 8-bit signature (0xA5)
|
||||||
u8 sf : 1; //!< 1-bit register type
|
u8 sf : 1; //!< 1-bit register type
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -356,11 +356,11 @@ namespace skyline::nce {
|
|||||||
union {
|
union {
|
||||||
struct __attribute__((packed)) {
|
struct __attribute__((packed)) {
|
||||||
u8 destReg : 5; //!< 5-bit destination register
|
u8 destReg : 5; //!< 5-bit destination register
|
||||||
u8 sig0 : 5; //!< 5-bit signature (0x1F)
|
u8 sig0 : 5; //!< 5-bit signature (0x1F)
|
||||||
u8 imm : 6; //!< 6-bit immediate value
|
u8 imm : 6; //!< 6-bit immediate value
|
||||||
u8 srcReg : 5; //!< 5-bit source register
|
u8 srcReg : 5; //!< 5-bit source register
|
||||||
u16 sig1 : 10; //!< 10-bit signature (0x150)
|
u16 sig1 : 10; //!< 10-bit signature (0x150)
|
||||||
u8 sf : 1; //!< 1-bit register type
|
u8 sf : 1; //!< 1-bit register type
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
@ -384,12 +384,12 @@ namespace skyline::nce {
|
|||||||
union {
|
union {
|
||||||
struct __attribute__((packed)) {
|
struct __attribute__((packed)) {
|
||||||
u8 destReg : 5; //!< 5-bit destination register
|
u8 destReg : 5; //!< 5-bit destination register
|
||||||
u8 srcReg : 5; //!< 5-bit source register
|
u8 srcReg : 5; //!< 5-bit source register
|
||||||
u8 sig0 : 2; //!< 2-bit signature (0x0)
|
u8 sig0 : 2; //!< 2-bit signature (0x0)
|
||||||
u16 imm : 9; //!< 6-bit immediate value
|
u16 imm : 9; //!< 6-bit immediate value
|
||||||
u16 sig1 : 9; //!< 9-bit signature (0x1CA)
|
u16 sig1 : 9; //!< 9-bit signature (0x1CA)
|
||||||
u8 sf : 1; //!< 1-bit register type
|
u8 sf : 1; //!< 1-bit register type
|
||||||
u8 sig2 : 1; //!< 1-bit signature (0x1)
|
u8 sig2 : 1; //!< 1-bit signature (0x1)
|
||||||
};
|
};
|
||||||
u32 raw{};
|
u32 raw{};
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@ namespace skyline::kernel {
|
|||||||
else
|
else
|
||||||
throw exception("Unsupported ROM extension.");
|
throw exception("Unsupported ROM extension.");
|
||||||
|
|
||||||
auto& process{state.process};
|
auto &process{state.process};
|
||||||
process = std::make_shared<kernel::type::KProcess>(state);
|
process = std::make_shared<kernel::type::KProcess>(state);
|
||||||
auto entry{state.loader->LoadProcessData(process, state)};
|
auto entry{state.loader->LoadProcessData(process, state)};
|
||||||
process->InitializeHeap();
|
process->InitializeHeap();
|
||||||
|
@ -32,8 +32,8 @@ namespace skyline::service::audio {
|
|||||||
|
|
||||||
Result IAudioOut::AppendAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
Result IAudioOut::AppendAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
struct Data {
|
struct Data {
|
||||||
i16* nextBuffer;
|
i16 *nextBuffer;
|
||||||
i16* sampleBuffer;
|
i16 *sampleBuffer;
|
||||||
u64 sampleCapacity;
|
u64 sampleCapacity;
|
||||||
u64 sampleSize;
|
u64 sampleSize;
|
||||||
u64 sampleOffset;
|
u64 sampleOffset;
|
||||||
|
@ -52,19 +52,19 @@ namespace skyline::service::audio::IAudioRenderer {
|
|||||||
input += sizeof(UpdateDataHeader);
|
input += sizeof(UpdateDataHeader);
|
||||||
input += inputHeader.behaviorSize; // Unused
|
input += inputHeader.behaviorSize; // Unused
|
||||||
|
|
||||||
span memoryPoolsIn(reinterpret_cast<MemoryPoolIn*>(input), memoryPools.size());
|
span memoryPoolsIn(reinterpret_cast<MemoryPoolIn *>(input), memoryPools.size());
|
||||||
input += inputHeader.memoryPoolSize;
|
input += inputHeader.memoryPoolSize;
|
||||||
for (size_t i{}; i < memoryPools.size(); i++)
|
for (size_t i{}; i < memoryPools.size(); i++)
|
||||||
memoryPools[i].ProcessInput(memoryPoolsIn[i]);
|
memoryPools[i].ProcessInput(memoryPoolsIn[i]);
|
||||||
|
|
||||||
input += inputHeader.voiceResourceSize;
|
input += inputHeader.voiceResourceSize;
|
||||||
|
|
||||||
span voicesIn(reinterpret_cast<VoiceIn*>(input), parameters.voiceCount);
|
span voicesIn(reinterpret_cast<VoiceIn *>(input), parameters.voiceCount);
|
||||||
input += inputHeader.voiceSize;
|
input += inputHeader.voiceSize;
|
||||||
for (u32 i{}; i < voicesIn.size(); i++)
|
for (u32 i{}; i < voicesIn.size(); i++)
|
||||||
voices[i].ProcessInput(voicesIn[i]);
|
voices[i].ProcessInput(voicesIn[i]);
|
||||||
|
|
||||||
span effectsIn(reinterpret_cast<EffectIn*>(input), parameters.effectCount);
|
span effectsIn(reinterpret_cast<EffectIn *>(input), parameters.effectCount);
|
||||||
for (u32 i{}; i < effectsIn.size(); i++)
|
for (u32 i{}; i < effectsIn.size(); i++)
|
||||||
effects[i].ProcessInput(effectsIn[i]);
|
effects[i].ProcessInput(effectsIn[i]);
|
||||||
|
|
||||||
@ -96,21 +96,21 @@ namespace skyline::service::audio::IAudioRenderer {
|
|||||||
|
|
||||||
auto output{request.outputBuf.at(0).data()};
|
auto output{request.outputBuf.at(0).data()};
|
||||||
|
|
||||||
*reinterpret_cast<UpdateDataHeader*>(output) = outputHeader;
|
*reinterpret_cast<UpdateDataHeader *>(output) = outputHeader;
|
||||||
output += sizeof(UpdateDataHeader);
|
output += sizeof(UpdateDataHeader);
|
||||||
|
|
||||||
for (const auto &memoryPool : memoryPools) {
|
for (const auto &memoryPool : memoryPools) {
|
||||||
*reinterpret_cast<MemoryPoolOut*>(output) = memoryPool.output;
|
*reinterpret_cast<MemoryPoolOut *>(output) = memoryPool.output;
|
||||||
output += sizeof(MemoryPoolOut);
|
output += sizeof(MemoryPoolOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &voice : voices) {
|
for (const auto &voice : voices) {
|
||||||
*reinterpret_cast<VoiceOut*>(output) = voice.output;
|
*reinterpret_cast<VoiceOut *>(output) = voice.output;
|
||||||
output += sizeof(VoiceOut);
|
output += sizeof(VoiceOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &effect : effects) {
|
for (const auto &effect : effects) {
|
||||||
*reinterpret_cast<EffectOut*>(output) = effect.output;
|
*reinterpret_cast<EffectOut *>(output) = effect.output;
|
||||||
output += sizeof(EffectOut);
|
output += sizeof(EffectOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace skyline::service::audio::IAudioRenderer {
|
|||||||
static_assert(sizeof(BiquadFilter) == 0xC);
|
static_assert(sizeof(BiquadFilter) == 0xC);
|
||||||
|
|
||||||
struct WaveBuffer {
|
struct WaveBuffer {
|
||||||
u8* pointer;
|
u8 *pointer;
|
||||||
u64 size;
|
u64 size;
|
||||||
u32 firstSampleOffset;
|
u32 firstSampleOffset;
|
||||||
u32 lastSampleOffset;
|
u32 lastSampleOffset;
|
||||||
@ -51,7 +51,7 @@ namespace skyline::service::audio::IAudioRenderer {
|
|||||||
u32 appendedWaveBuffersCount;
|
u32 appendedWaveBuffersCount;
|
||||||
u32 baseWaveBufferIndex;
|
u32 baseWaveBufferIndex;
|
||||||
u32 _unk1_;
|
u32 _unk1_;
|
||||||
u32* adpcmCoeffs;
|
u32 *adpcmCoeffs;
|
||||||
u64 adpcmCoeffsSize;
|
u64 adpcmCoeffsSize;
|
||||||
u32 destination;
|
u32 destination;
|
||||||
u32 _pad0_;
|
u32 _pad0_;
|
||||||
|
@ -38,8 +38,8 @@ namespace skyline::service {
|
|||||||
ServiceManager &manager;
|
ServiceManager &manager;
|
||||||
|
|
||||||
template<typename Class, typename BaseClass, typename BaseFunctionType, BaseFunctionType BaseFunction>
|
template<typename Class, typename BaseClass, typename BaseFunctionType, BaseFunctionType BaseFunction>
|
||||||
static constexpr Result CallBaseFunction(Class* clazz, type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
static constexpr Result CallBaseFunction(Class *clazz, type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
return (static_cast<BaseClass*>(clazz)->*BaseFunction)(session, request, response);
|
return (static_cast<BaseClass *>(clazz)->*BaseFunction)(session, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -113,7 +113,7 @@ namespace skyline::service::hosbinder {
|
|||||||
u32 _pad0_;
|
u32 _pad0_;
|
||||||
} &data = in.Pop<Data>();
|
} &data = in.Pop<Data>();
|
||||||
|
|
||||||
auto& gbpBuffer{in.Pop<GbpBuffer>()};
|
auto &gbpBuffer{in.Pop<GbpBuffer>()};
|
||||||
|
|
||||||
std::shared_ptr<nvdrv::device::NvMap::NvMapObject> nvBuffer{};
|
std::shared_ptr<nvdrv::device::NvMap::NvMapObject> nvBuffer{};
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ namespace skyline::service::nvdrv::device {
|
|||||||
return NvStatus::Success;
|
return NvStatus::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* mapPointer{data.bufferOffset + mapping->pointer};
|
u8 *mapPointer{data.bufferOffset + mapping->pointer};
|
||||||
u64 mapSize{data.mappingSize ? data.mappingSize : mapping->size};
|
u64 mapSize{data.mappingSize ? data.mappingSize : mapping->size};
|
||||||
|
|
||||||
if (data.flags.fixed)
|
if (data.flags.fixed)
|
||||||
@ -183,7 +183,7 @@ namespace skyline::service::nvdrv::device {
|
|||||||
auto mapping{nvmap->GetObject(entry.nvmapHandle)};
|
auto mapping{nvmap->GetObject(entry.nvmapHandle)};
|
||||||
|
|
||||||
u64 mapAddress{static_cast<u64>(entry.gpuOffset) << MinAlignmentShift};
|
u64 mapAddress{static_cast<u64>(entry.gpuOffset) << MinAlignmentShift};
|
||||||
u8* mapPointer{mapping->pointer + (static_cast<u64>(entry.mapOffset) << MinAlignmentShift)};
|
u8 *mapPointer{mapping->pointer + (static_cast<u64>(entry.mapOffset) << MinAlignmentShift)};
|
||||||
u64 mapSize{static_cast<u64>(entry.pages) << MinAlignmentShift};
|
u64 mapSize{static_cast<u64>(entry.pages) << MinAlignmentShift};
|
||||||
|
|
||||||
state.gpu->memoryManager.MapFixed(mapAddress, mapPointer, mapSize);
|
state.gpu->memoryManager.MapFixed(mapAddress, mapPointer, mapSize);
|
||||||
|
@ -25,7 +25,7 @@ namespace skyline::service::nvdrv::device {
|
|||||||
|
|
||||||
NvStatus NvHostChannel::SubmitGpfifo(IoctlType type, span<u8> buffer, span<u8> inlineBuffer) {
|
NvStatus NvHostChannel::SubmitGpfifo(IoctlType type, span<u8> buffer, span<u8> inlineBuffer) {
|
||||||
struct Data {
|
struct Data {
|
||||||
gpu::gpfifo::GpEntry* entries; // In
|
gpu::gpfifo::GpEntry *entries; // In
|
||||||
u32 numEntries; // In
|
u32 numEntries; // In
|
||||||
union {
|
union {
|
||||||
struct __attribute__((__packed__)) {
|
struct __attribute__((__packed__)) {
|
||||||
|
@ -43,7 +43,7 @@ namespace skyline::service::nvdrv::device {
|
|||||||
if (handle-- == 0)
|
if (handle-- == 0)
|
||||||
throw std::out_of_range("0 is an invalid nvmap handle");
|
throw std::out_of_range("0 is an invalid nvmap handle");
|
||||||
std::shared_lock lock(mapMutex);
|
std::shared_lock lock(mapMutex);
|
||||||
auto& object{maps.at(handle)};
|
auto &object{maps.at(handle)};
|
||||||
if (!object)
|
if (!object)
|
||||||
throw std::out_of_range("A freed nvmap handle was requested");
|
throw std::out_of_range("A freed nvmap handle was requested");
|
||||||
return object;
|
return object;
|
||||||
|
@ -72,9 +72,9 @@ namespace skyline::vfs {
|
|||||||
* @param offset The offset where the input should be written
|
* @param offset The offset where the input should be written
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline void WriteObject(const T& object, size_t offset = 0) {
|
inline void WriteObject(const T &object, size_t offset = 0) {
|
||||||
size_t size;
|
size_t size;
|
||||||
if((size = Write(span(reinterpret_cast<u8 *>(&object), sizeof(T)), offset)) != sizeof(T))
|
if ((size = Write(span(reinterpret_cast<u8 *>(&object), sizeof(T)), offset)) != sizeof(T))
|
||||||
throw exception("Object wasn't written fully into output backing: {}/{}", size, sizeof(T));
|
throw exception("Object wasn't written fully into output backing: {}/{}", size, sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace skyline::vfs {
|
|||||||
|
|
||||||
NPDM::NPDM(const std::shared_ptr<vfs::Backing> &backing) {
|
NPDM::NPDM(const std::shared_ptr<vfs::Backing> &backing) {
|
||||||
meta = backing->Read<NpdmMeta>();
|
meta = backing->Read<NpdmMeta>();
|
||||||
if(meta.magic != MetaMagic)
|
if (meta.magic != MetaMagic)
|
||||||
throw exception("NPDM Meta Magic isn't correct: 0x{:X} (\"META\" = 0x{:X})", meta.magic, MetaMagic);
|
throw exception("NPDM Meta Magic isn't correct: 0x{:X} (\"META\" = 0x{:X})", meta.magic, MetaMagic);
|
||||||
if (!constant::HosPriority.Valid(meta.mainThreadPriority))
|
if (!constant::HosPriority.Valid(meta.mainThreadPriority))
|
||||||
throw exception("NPDM Main Thread Priority isn't valid: {}", meta.mainThreadStackSize);
|
throw exception("NPDM Main Thread Priority isn't valid: {}", meta.mainThreadStackSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user