Update formatter config for new AS and reformat

This commit is contained in:
Billy Laws 2020-11-08 19:54:15 +00:00 committed by ◱ PixelyIon
parent 668f623256
commit 4c9d453008
41 changed files with 185 additions and 193 deletions

View File

@ -9,18 +9,9 @@
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</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" />
<package name="java.util" withSubpackages="false" static="false" />
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
<package name="io.ktor" withSubpackages="true" static="false" />
</value>
</option>
<option name="SPACE_BEFORE_TYPE_COLON" value="true" />
@ -40,6 +31,7 @@
<option name="CLASS_CONSTRUCTOR_INIT_LIST_WRAP" value="0" />
<option name="SUPERCLASS_LIST_WRAP" value="0" />
<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="HEADER_GUARD_STYLE_PATTERN" value="${PROJECT_NAME}_${PROJECT_REL_PATH}_${FILE_NAME}_${EXT}" />
<option name="MACROS_NAMING_CONVENTION">

View File

@ -17,7 +17,7 @@ namespace skyline::audio {
struct {
u8 scale : 4; //!< The scale factor for this frame
u8 coefficientIndex : 3;
u8 _pad_ :1;
u8 _pad_ : 1;
};
};
static_assert(sizeof(FrameHeader) == 0x1);

View File

@ -26,7 +26,7 @@ namespace skyline {
void Logger::UpdateTag() {
std::array<char, 16> name;
if (!pthread_getname_np(pthread_self(), name.data(), name.size()))
threadName = name.data();
threadName = name.data();
else
threadName = "unk";
logTag = std::string("emu-cpp-") + threadName;

View File

@ -80,7 +80,7 @@ namespace skyline {
produceCondition.notify_one();
}
inline void Append(span <Type> buffer) {
inline void Append(span<Type> buffer) {
std::unique_lock lock(productionMutex);
for (auto &item : buffer) {
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
*/
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);
auto next{end};
for (auto &item : buffer) {

View File

@ -20,10 +20,10 @@ namespace skyline {
struct ChunkDescriptor {
u64 address; //!< The address of the chunk in the GPU address space
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;
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
@ -82,7 +82,7 @@ namespace skyline {
* @param size The size of the region to map
* @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
@ -91,7 +91,7 @@ namespace skyline {
* @param size The size of the region to map
* @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

View File

@ -29,7 +29,7 @@ namespace skyline::gpu {
void UpdateSurface(jobject newSurface);
void Present(const std::shared_ptr<Texture>& texture);
void Present(const std::shared_ptr<Texture> &texture);
ANativeWindow *window{};
};

View File

@ -7,7 +7,7 @@
#include "texture.h"
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) {
if (!host.expired())

View File

@ -123,14 +123,14 @@ namespace skyline {
const DeviceState &state;
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
texture::Dimensions dimensions;
texture::Format format;
texture::TileMode tileMode;
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() {
return format.GetSize(dimensions);

View File

@ -27,16 +27,16 @@ namespace skyline::input {
union NpadStyleSet {
u32 raw;
struct {
bool proController : 1; //!< Pro Controller
bool proController : 1; //!< Pro Controller
bool joyconHandheld : 1; //!< Joy-Cons in handheld mode
bool joyconDual : 1; //!< Joy-Cons in a pair
bool joyconLeft : 1; //!< Left Joy-Con only
bool joyconRight : 1; //!< Right Joy-Con only
bool gamecube : 1; //!< GameCube controller
bool palma : 1; //!< Poké Ball Plus controller
bool nes : 1; //!< NES controller
bool nesHandheld : 1; //!< NES controller in handheld mode
bool snes : 1; //!< SNES controller
bool joyconDual : 1; //!< Joy-Cons in a pair
bool joyconLeft : 1; //!< Left Joy-Con only
bool joyconRight : 1; //!< Right Joy-Con only
bool gamecube : 1; //!< GameCube controller
bool palma : 1; //!< Poké Ball Plus controller
bool nes : 1; //!< NES controller
bool nesHandheld : 1; //!< NES controller in handheld mode
bool snes : 1; //!< SNES controller
};
};
static_assert(sizeof(NpadStyleSet) == 0x4);
@ -72,9 +72,9 @@ namespace skyline::input {
u32 raw;
struct {
u8 type;
NpadId id : 8;
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
NpadId id : 8;
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
};
constexpr NpadControllerType GetType() const {

View File

@ -10,16 +10,16 @@ namespace skyline::input {
u64 raw;
struct {
bool lControl : 1; //!< Left Control Key
bool lShift : 1; //!< Left Shift Key
bool lAlt : 1; //!< Left Alt Key
bool lShift : 1; //!< Left Shift Key
bool lAlt : 1; //!< Left Alt Key
bool lWindows : 1; //!< Left Windows Key
bool rControl : 1; //!< Right Control Key
bool rShift : 1; //!< Right Shift Key
bool rAlt : 1; //!< Right Alt Key
bool rShift : 1; //!< Right Shift Key
bool rAlt : 1; //!< Right Alt Key
bool rWindows : 1; //!< Right Windows Key
bool capsLock : 1; //!< Caps-Lock Key
bool scrLock : 1; //!< Scroll-Lock Key
bool numLock : 1; //!< Num-Lock Key
bool scrLock : 1; //!< Scroll-Lock Key
bool numLock : 1; //!< Num-Lock Key
};
};

View File

@ -56,34 +56,34 @@ namespace skyline::input {
union NpadButton {
u64 raw;
struct {
bool a : 1; //!< The A button
bool b : 1; //!< The B button
bool x : 1; //!< The X button
bool y : 1; //!< The Y button
bool leftStick : 1; //!< The Left-Stick button
bool rightStick : 1; //!< The Right-Stick button
bool l : 1; //!< The L trigger
bool r : 1; //!< The R button
bool zl : 1; //!< The ZL trigger
bool zr : 1; //!< The ZR trigger
bool plus : 1; //!< The + button
bool minus : 1; //!< The - button
bool dpadLeft : 1; //!< D-Pad left
bool dpadUp : 1; //!< D-Pad up
bool dpadRight : 1; //!< D-Pad right
bool dpadDown : 1; //!< D-Pad down
bool leftStickLeft : 1; //!< Left stick left
bool leftStickUp : 1; //!< Left stick up
bool leftStickRight : 1; //!< Left stick right
bool leftStickDown : 1; //!< Left stick down
bool rightStickLeft : 1; //!< Right stick left
bool rightStickUp : 1; //!< Right stick up
bool a : 1; //!< The A button
bool b : 1; //!< The B button
bool x : 1; //!< The X button
bool y : 1; //!< The Y button
bool leftStick : 1; //!< The Left-Stick button
bool rightStick : 1; //!< The Right-Stick button
bool l : 1; //!< The L trigger
bool r : 1; //!< The R button
bool zl : 1; //!< The ZL trigger
bool zr : 1; //!< The ZR trigger
bool plus : 1; //!< The + button
bool minus : 1; //!< The - button
bool dpadLeft : 1; //!< D-Pad left
bool dpadUp : 1; //!< D-Pad up
bool dpadRight : 1; //!< D-Pad right
bool dpadDown : 1; //!< D-Pad down
bool leftStickLeft : 1; //!< Left stick left
bool leftStickUp : 1; //!< Left stick up
bool leftStickRight : 1; //!< Left stick right
bool leftStickDown : 1; //!< Left stick down
bool rightStickLeft : 1; //!< Right stick left
bool rightStickUp : 1; //!< Right stick up
bool rightStickRight : 1; //!< Right stick right
bool rightStickDown : 1; //!< Right stick down
bool leftSl : 1; //!< Left Joy-Con SL button
bool leftSr : 1; //!< Left Joy-Con SR button
bool rightSl : 1; //!< Right Joy-Con SL button
bool rightSr : 1; //!< Right Joy-Con SR button
bool rightStickDown : 1; //!< Right stick down
bool leftSl : 1; //!< Left Joy-Con SL button
bool leftSr : 1; //!< Left Joy-Con SR button
bool rightSl : 1; //!< Right Joy-Con SL button
bool rightSr : 1; //!< Right Joy-Con SR button
};
};
static_assert(sizeof(NpadButton) == 0x8);

View File

@ -17,16 +17,16 @@ namespace skyline::input {
if (!activated)
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& entry{section.entries[entryIndex]};
auto &entry{section.entries[entryIndex]};
entry.globalTimestamp = lastEntry.globalTimestamp + 1;
entry.localTimestamp = lastEntry.localTimestamp + 1;
entry.touchCount = points.size();
for (size_t i{}; i < points.size(); i++) {
const auto& host{points[i]};
auto& guest{entry.data[i]};
const auto &host{points[i]};
auto &guest{entry.data[i]};
guest.index = i;
guest.positionX = host.x;
guest.positionY = host.y;

View File

@ -40,15 +40,15 @@ namespace skyline {
* @url https://switchbrew.org/wiki/IPC_Marshalling#IPC_Command_Structure
*/
struct CommandHeader {
CommandType type : 16;
u8 xNo : 4;
u8 aNo : 4;
u8 bNo : 4;
u8 wNo : 4;
u32 rawSize : 10;
CommandType type : 16;
u8 xNo : 4;
u8 aNo : 4;
u8 bNo : 4;
u8 wNo : 4;
u32 rawSize : 10;
BufferCFlag cFlag : 4;
u32 : 17;
bool handleDesc : 1;
bool handleDesc : 1;
};
static_assert(sizeof(CommandHeader) == 8);
@ -56,7 +56,7 @@ namespace skyline {
* @url https://switchbrew.org/wiki/IPC_Marshalling#Handle_descriptor
*/
struct HandleDescriptor {
bool sendPid : 1;
bool sendPid : 1;
u32 copyCount : 4;
u32 moveCount : 4;
u32 : 23;
@ -122,12 +122,12 @@ namespace skyline {
* @url https://switchbrew.org/wiki/IPC_Marshalling#Buffer_descriptor_X_.22Pointer.22
*/
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 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 size : 16; //!< The 16 bit size of the buffer
u32 address0_31 : 32; //!< The first 32-bits of the address
u16 size : 16; //!< The 16 bit size of the buffer
u32 address0_31 : 32; //!< The first 32-bits of the address
BufferDescriptorX(u64 address, u16 counter, u16 size) : size(size) {
address0_31 = static_cast<u32>(address & 0x7FFFFFFF80000000);
@ -137,8 +137,8 @@ namespace skyline {
counter9_11 = static_cast<u16>(address & 0x38);
}
inline u8* Pointer() {
return reinterpret_cast<u8*>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
inline u8 *Pointer() {
return reinterpret_cast<u8 *>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
}
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
*/
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
u8 flags : 2; //!< The buffer flags
u8 flags : 2; //!< The buffer flags
u8 address36_38 : 3; //!< Bit 36-38 of the address
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
BufferDescriptorABW(u64 address, u64 size) {
@ -167,8 +167,8 @@ namespace skyline {
size32_35 = static_cast<u8>(size & 0x78000000);
}
inline u8* Pointer() {
return reinterpret_cast<u8*>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
inline u8 *Pointer() {
return reinterpret_cast<u8 *>(static_cast<u64>(address0_31) | static_cast<u64>(address32_35) << 32 | static_cast<u64>(address36_38) << 36);
}
inline u64 Size() {
@ -182,10 +182,10 @@ namespace skyline {
*/
struct BufferDescriptorC {
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() {
return reinterpret_cast<u8*>(address);
inline u8 *Pointer() {
return reinterpret_cast<u8 *>(address);
}
BufferDescriptorC(u64 address, u16 size) : address(address), size(size) {}

View File

@ -48,10 +48,10 @@ namespace skyline {
*/
union MemoryAttribute {
struct {
bool isBorrowed : 1; //!< This is required for async IPC user buffers
bool isIpcLocked : 1; //!< True when IpcRefCount > 0
bool isBorrowed : 1; //!< This is required for async IPC user buffers
bool isIpcLocked : 1; //!< True when IpcRefCount > 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{};
};
@ -108,11 +108,11 @@ namespace skyline {
constexpr MemoryState() : value(0) {}
constexpr bool operator==(const MemoryState& other) const {
constexpr bool operator==(const MemoryState &other) const {
return value == other.value;
}
constexpr bool operator!=(const MemoryState& other) const {
constexpr bool operator!=(const MemoryState &other) const {
return value != other.value;
}
@ -173,7 +173,7 @@ namespace skyline {
u64 address;
size_t size;
bool IsInside(void* ptr) {
bool IsInside(void *ptr) {
return (address <= reinterpret_cast<u64>(ptr)) && ((address + size) > reinterpret_cast<u64>(ptr));
}
};
@ -194,13 +194,13 @@ namespace skyline {
namespace kernel {
struct ChunkDescriptor {
u8* ptr;
u8 *ptr;
size_t size;
memory::Permission permission;
memory::MemoryState state;
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;
}
};
@ -233,11 +233,11 @@ namespace skyline {
*/
void InitializeVmm(memory::AddressSpaceType type);
void InitializeRegions(u8* codeStart, u64 size);
void InitializeRegions(u8 *codeStart, u64 size);
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

View File

@ -25,9 +25,9 @@ namespace skyline::kernel::type {
* @param size The size of the partition to change the permissions of
* @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()};
return (spn.data() <= ptr) && ((spn.data() + spn.size()) > ptr);
}

View File

@ -11,7 +11,7 @@ namespace skyline::kernel::type {
*/
class KPrivateMemory : public KMemory {
public:
u8* ptr{};
u8 *ptr{};
size_t size{};
memory::Permission permission;
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)
* @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);
/**
* @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 {
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 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

View File

@ -32,11 +32,11 @@ namespace skyline {
std::atomic_bool flag{false};
i8 priority;
KHandle handle;
u32* mutex{};
u32 *mutex{};
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
@ -56,11 +56,11 @@ namespace skyline {
u8 index{}; //!< The slots are assigned sequentially, this holds the index of the last TLS slot reserved
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();
};
@ -87,7 +87,7 @@ namespace skyline {
/**
* @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
@ -159,7 +159,7 @@ namespace skyline {
else
throw exception("KProcess::GetHandle couldn't determine object type");
try {
auto& item{handles.at(handle - constant::BaseHandleIndex)};
auto &item{handles.at(handle - constant::BaseHandleIndex)};
if (item != nullptr && item->objectType == objectType)
return std::static_pointer_cast<objectClass>(item);
else if (item == nullptr)
@ -181,7 +181,7 @@ namespace skyline {
* @param address The address to look for
* @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
@ -195,25 +195,25 @@ namespace skyline {
* @param owner The handle of the current mutex owner
* @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
* @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
* @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
* @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

View File

@ -35,7 +35,7 @@ namespace skyline::kernel::type {
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

View File

@ -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-
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.ro.offset, executable.ro.contents.data(), roSize);
std::memcpy(base + patch.size + executable.data.offset, executable.data.contents.data(), dataSize - executable.bssSize);

View File

@ -51,9 +51,9 @@ namespace skyline::loader {
* @brief Information about the placement of an executable in memory
*/
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
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
*/
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;
};
}

View File

@ -11,7 +11,7 @@ namespace skyline::loader {
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)
throw exception("Cannot load a null ExeFS");
@ -23,8 +23,8 @@ namespace skyline::loader {
auto loadInfo{NsoLoader::LoadNso(nsoFile, process, state)};
u64 offset{loadInfo.size};
u8* base{loadInfo.base};
void* entry{loadInfo.entry};
u8 *base{loadInfo.base};
void *entry{loadInfo.entry};
state.logger->Info("Loaded nso 'rtld' at 0x{:X} (.text @ 0x{:X})", base, entry);
@ -44,7 +44,7 @@ namespace skyline::loader {
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"));
return LoadExeFs(nca.exeFs, process, state);
}

View File

@ -23,8 +23,8 @@ namespace skyline::loader {
* @param exefs A filesystem object containing the ExeFS filesystem to load into memory
* @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);
};
}

View File

@ -44,7 +44,7 @@ namespace skyline::loader {
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{};
nroExecutable.text.contents = GetSegment(header.text);

View File

@ -72,6 +72,6 @@ namespace skyline::loader {
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);
};
}

View File

@ -54,7 +54,7 @@ namespace skyline::loader {
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);
auto loadInfo{LoadNso(backing, process, state)};
state.process->memory.InitializeRegions(loadInfo.base, loadInfo.size);

View File

@ -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);
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);
};
}

View File

@ -35,7 +35,7 @@ namespace skyline::loader {
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"));
return NcaLoader::LoadExeFs(programNca->exeFs, process, state);
}

View File

@ -26,6 +26,6 @@ namespace skyline::loader {
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);
};
}

View File

@ -14,7 +14,7 @@ namespace skyline::nce {
private:
const DeviceState &state;
static void SvcHandler(u16 svc, ThreadContext* ctx);
static void SvcHandler(u16 svc, ThreadContext *ctx);
public:
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
* @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);
};
}

View File

@ -30,9 +30,9 @@ namespace skyline::nce {
union {
struct {
u8 sig0 : 5; //!< 5-bit signature (0x0)
u8 sig0 : 5; //!< 5-bit signature (0x0)
u32 value : 16; //!< 16-bit immediate value
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
};
u32 raw{};
};
@ -49,9 +49,9 @@ namespace skyline::nce {
union {
struct {
u8 sig0 : 5; //!< 5-bit signature (0x0)
u8 sig0 : 5; //!< 5-bit signature (0x0)
u32 value : 16; //!< 16-bit immediate value
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
u16 sig1 : 11; //!< 11-bit signature (0x6A1)
};
u32 raw{};
};
@ -78,9 +78,9 @@ namespace skyline::nce {
union {
struct {
u8 destReg : 5; //!< 5-bit destination register
u8 destReg : 5; //!< 5-bit destination register
u32 srcReg : 15; //!< 15-bit source register
u16 sig : 12; //!< 16-bit signature (0xD53)
u16 sig : 12; //!< 16-bit signature (0xD53)
};
u32 raw{};
};
@ -97,9 +97,9 @@ namespace skyline::nce {
union {
struct {
u8 srcReg : 5; //!< 5-bit destination register
u8 srcReg : 5; //!< 5-bit destination register
u32 destReg : 15; //!< 15-bit source register
u16 sig : 12; //!< 16-bit signature (0xD51)
u16 sig : 12; //!< 16-bit signature (0xD51)
};
u32 raw{};
};
@ -133,7 +133,7 @@ namespace skyline::nce {
union {
struct {
i32 offset : 26; //!< 26-bit branch offset
u8 sig : 6; //!< 6-bit signature (0x5)
u8 sig : 6; //!< 6-bit signature (0x5)
};
u32 raw{};
};
@ -167,7 +167,7 @@ namespace skyline::nce {
union {
struct {
i32 offset : 26; //!< 26-bit branch offset
u8 sig : 6; //!< 6-bit signature (0x25)
u8 sig : 6; //!< 6-bit signature (0x25)
};
u32 raw{};
};
@ -219,10 +219,10 @@ namespace skyline::nce {
union {
struct __attribute__((packed)) {
u8 destReg : 5; //!< 5-bit destination register
u16 imm16 : 16; //!< 16-bit immediate value
u8 hw : 2; //!< 2-bit offset
u8 sig : 8; //!< 8-bit signature (0xA5)
u8 sf : 1; //!< 1-bit register type
u16 imm16 : 16; //!< 16-bit immediate value
u8 hw : 2; //!< 2-bit offset
u8 sig : 8; //!< 8-bit signature (0xA5)
u8 sf : 1; //!< 1-bit register type
};
u32 raw{};
};
@ -274,10 +274,10 @@ namespace skyline::nce {
union {
struct __attribute__((packed)) {
u8 destReg : 5; //!< 5-bit destination register
u16 imm16 : 16; //!< 16-bit immediate value
u8 hw : 2; //!< 2-bit offset
u8 sig : 8; //!< 8-bit signature (0xA5)
u8 sf : 1; //!< 1-bit register type
u16 imm16 : 16; //!< 16-bit immediate value
u8 hw : 2; //!< 2-bit offset
u8 sig : 8; //!< 8-bit signature (0xA5)
u8 sf : 1; //!< 1-bit register type
};
u32 raw{};
};
@ -356,11 +356,11 @@ namespace skyline::nce {
union {
struct __attribute__((packed)) {
u8 destReg : 5; //!< 5-bit destination register
u8 sig0 : 5; //!< 5-bit signature (0x1F)
u8 imm : 6; //!< 6-bit immediate value
u8 srcReg : 5; //!< 5-bit source register
u16 sig1 : 10; //!< 10-bit signature (0x150)
u8 sf : 1; //!< 1-bit register type
u8 sig0 : 5; //!< 5-bit signature (0x1F)
u8 imm : 6; //!< 6-bit immediate value
u8 srcReg : 5; //!< 5-bit source register
u16 sig1 : 10; //!< 10-bit signature (0x150)
u8 sf : 1; //!< 1-bit register type
};
u32 raw{};
};
@ -384,12 +384,12 @@ namespace skyline::nce {
union {
struct __attribute__((packed)) {
u8 destReg : 5; //!< 5-bit destination register
u8 srcReg : 5; //!< 5-bit source register
u8 sig0 : 2; //!< 2-bit signature (0x0)
u16 imm : 9; //!< 6-bit immediate value
u16 sig1 : 9; //!< 9-bit signature (0x1CA)
u8 sf : 1; //!< 1-bit register type
u8 sig2 : 1; //!< 1-bit signature (0x1)
u8 srcReg : 5; //!< 5-bit source register
u8 sig0 : 2; //!< 2-bit signature (0x0)
u16 imm : 9; //!< 6-bit immediate value
u16 sig1 : 9; //!< 9-bit signature (0x1CA)
u8 sf : 1; //!< 1-bit register type
u8 sig2 : 1; //!< 1-bit signature (0x1)
};
u32 raw{};
};

View File

@ -29,7 +29,7 @@ namespace skyline::kernel {
else
throw exception("Unsupported ROM extension.");
auto& process{state.process};
auto &process{state.process};
process = std::make_shared<kernel::type::KProcess>(state);
auto entry{state.loader->LoadProcessData(process, state)};
process->InitializeHeap();

View File

@ -32,8 +32,8 @@ namespace skyline::service::audio {
Result IAudioOut::AppendAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
struct Data {
i16* nextBuffer;
i16* sampleBuffer;
i16 *nextBuffer;
i16 *sampleBuffer;
u64 sampleCapacity;
u64 sampleSize;
u64 sampleOffset;

View File

@ -52,19 +52,19 @@ namespace skyline::service::audio::IAudioRenderer {
input += sizeof(UpdateDataHeader);
input += inputHeader.behaviorSize; // Unused
span memoryPoolsIn(reinterpret_cast<MemoryPoolIn*>(input), memoryPools.size());
span memoryPoolsIn(reinterpret_cast<MemoryPoolIn *>(input), memoryPools.size());
input += inputHeader.memoryPoolSize;
for (size_t i{}; i < memoryPools.size(); i++)
memoryPools[i].ProcessInput(memoryPoolsIn[i]);
input += inputHeader.voiceResourceSize;
span voicesIn(reinterpret_cast<VoiceIn*>(input), parameters.voiceCount);
span voicesIn(reinterpret_cast<VoiceIn *>(input), parameters.voiceCount);
input += inputHeader.voiceSize;
for (u32 i{}; i < voicesIn.size(); 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++)
effects[i].ProcessInput(effectsIn[i]);
@ -96,21 +96,21 @@ namespace skyline::service::audio::IAudioRenderer {
auto output{request.outputBuf.at(0).data()};
*reinterpret_cast<UpdateDataHeader*>(output) = outputHeader;
*reinterpret_cast<UpdateDataHeader *>(output) = outputHeader;
output += sizeof(UpdateDataHeader);
for (const auto &memoryPool : memoryPools) {
*reinterpret_cast<MemoryPoolOut*>(output) = memoryPool.output;
*reinterpret_cast<MemoryPoolOut *>(output) = memoryPool.output;
output += sizeof(MemoryPoolOut);
}
for (const auto &voice : voices) {
*reinterpret_cast<VoiceOut*>(output) = voice.output;
*reinterpret_cast<VoiceOut *>(output) = voice.output;
output += sizeof(VoiceOut);
}
for (const auto &effect : effects) {
*reinterpret_cast<EffectOut*>(output) = effect.output;
*reinterpret_cast<EffectOut *>(output) = effect.output;
output += sizeof(EffectOut);
}

View File

@ -20,7 +20,7 @@ namespace skyline::service::audio::IAudioRenderer {
static_assert(sizeof(BiquadFilter) == 0xC);
struct WaveBuffer {
u8* pointer;
u8 *pointer;
u64 size;
u32 firstSampleOffset;
u32 lastSampleOffset;
@ -51,7 +51,7 @@ namespace skyline::service::audio::IAudioRenderer {
u32 appendedWaveBuffersCount;
u32 baseWaveBufferIndex;
u32 _unk1_;
u32* adpcmCoeffs;
u32 *adpcmCoeffs;
u64 adpcmCoeffsSize;
u32 destination;
u32 _pad0_;

View File

@ -38,8 +38,8 @@ namespace skyline::service {
ServiceManager &manager;
template<typename Class, typename BaseClass, typename BaseFunctionType, BaseFunctionType BaseFunction>
static constexpr Result CallBaseFunction(Class* clazz, type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
return (static_cast<BaseClass*>(clazz)->*BaseFunction)(session, request, 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);
}
public:

View File

@ -113,7 +113,7 @@ namespace skyline::service::hosbinder {
u32 _pad0_;
} &data = in.Pop<Data>();
auto& gbpBuffer{in.Pop<GbpBuffer>()};
auto &gbpBuffer{in.Pop<GbpBuffer>()};
std::shared_ptr<nvdrv::device::NvMap::NvMapObject> nvBuffer{};

View File

@ -108,7 +108,7 @@ namespace skyline::service::nvdrv::device {
return NvStatus::Success;
}
u8* mapPointer{data.bufferOffset + mapping->pointer};
u8 *mapPointer{data.bufferOffset + mapping->pointer};
u64 mapSize{data.mappingSize ? data.mappingSize : mapping->size};
if (data.flags.fixed)
@ -183,7 +183,7 @@ namespace skyline::service::nvdrv::device {
auto mapping{nvmap->GetObject(entry.nvmapHandle)};
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};
state.gpu->memoryManager.MapFixed(mapAddress, mapPointer, mapSize);

View File

@ -25,7 +25,7 @@ namespace skyline::service::nvdrv::device {
NvStatus NvHostChannel::SubmitGpfifo(IoctlType type, span<u8> buffer, span<u8> inlineBuffer) {
struct Data {
gpu::gpfifo::GpEntry* entries; // In
gpu::gpfifo::GpEntry *entries; // In
u32 numEntries; // In
union {
struct __attribute__((__packed__)) {

View File

@ -43,7 +43,7 @@ namespace skyline::service::nvdrv::device {
if (handle-- == 0)
throw std::out_of_range("0 is an invalid nvmap handle");
std::shared_lock lock(mapMutex);
auto& object{maps.at(handle)};
auto &object{maps.at(handle)};
if (!object)
throw std::out_of_range("A freed nvmap handle was requested");
return object;

View File

@ -72,9 +72,9 @@ namespace skyline::vfs {
* @param offset The offset where the input should be written
*/
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;
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));
}

View File

@ -31,7 +31,7 @@ namespace skyline::vfs {
NPDM::NPDM(const std::shared_ptr<vfs::Backing> &backing) {
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);
if (!constant::HosPriority.Valid(meta.mainThreadPriority))
throw exception("NPDM Main Thread Priority isn't valid: {}", meta.mainThreadStackSize);