Compare commits
1 Commits
__refs_pul
...
__refs_pul
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b27aa2ccca |
@@ -40,7 +40,7 @@ def parse_imports(file_name):
|
||||
|
||||
def parse_imports_recursive(file_name, path_list=[]):
|
||||
q = queue.Queue() # create a FIFO queue
|
||||
# file_name can be a string or a list for the convenience
|
||||
# file_name can be a string or a list for the convience
|
||||
if isinstance(file_name, str):
|
||||
q.put(file_name)
|
||||
elif isinstance(file_name, list):
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
; SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
; SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
[codespell]
|
||||
skip = ./.git,./build,./dist,./Doxyfile,./externals,./LICENSES
|
||||
ignore-words-list = aci,allright,ba,deques,froms,hda,inout,lod,masia,nam,nax,nd,pullrequests,pullrequest,te,transfered,unstall,uscaled,zink
|
||||
17
.github/workflows/codespell.yml
vendored
17
.github/workflows/codespell.yml
vendored
@@ -1,17 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# GitHub Action to automate the identification of common misspellings in text files.
|
||||
# https://github.com/codespell-project/actions-codespell
|
||||
# https://github.com/codespell-project/codespell
|
||||
name: codespell
|
||||
on: pull_request
|
||||
permissions: {}
|
||||
jobs:
|
||||
codespell:
|
||||
name: Check for spelling errors
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: codespell-project/actions-codespell@master
|
||||
@@ -344,12 +344,12 @@ if(ENABLE_QT)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(QT_DEP_GLU QUIET glu>=9.0.0)
|
||||
if (NOT QT_DEP_GLU_FOUND)
|
||||
message(FATAL_ERROR "Qt bundled package dependency `glu` not found. \
|
||||
message(FATAL_ERROR "Qt bundled pacakge dependency `glu` not found. \
|
||||
Perhaps `libglu1-mesa-dev` needs to be installed?")
|
||||
endif()
|
||||
pkg_check_modules(QT_DEP_MESA QUIET dri>=20.0.8)
|
||||
if (NOT QT_DEP_MESA_FOUND)
|
||||
message(FATAL_ERROR "Qt bundled package dependency `dri` not found. \
|
||||
message(FATAL_ERROR "Qt bundled pacakge dependency `dri` not found. \
|
||||
Perhaps `mesa-common-dev` needs to be installed?")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# FFmpeg_LIBRARIES: aggregate all the paths to the libraries
|
||||
# FFmpeg_FOUND: True if all components have been found
|
||||
#
|
||||
# This module defines the following targets, which are preferred over variables:
|
||||
# This module defines the following targets, which are prefered over variables:
|
||||
#
|
||||
# FFmpeg::<component>: Target to use <component> directly, with include path,
|
||||
# library and dependencies set up. If you are using a static build, you are
|
||||
|
||||
@@ -83,7 +83,7 @@ if (MSVC)
|
||||
)
|
||||
|
||||
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
|
||||
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format
|
||||
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cachable format
|
||||
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
|
||||
add_compile_options(/Z7)
|
||||
else()
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
/**
|
||||
* Get a list of audio out device names.
|
||||
*
|
||||
* @param names - Output container to write names to.
|
||||
* @oaram names - Output container to write names to.
|
||||
* @return Number of names written.
|
||||
*/
|
||||
u32 GetAudioOutDeviceNames(
|
||||
|
||||
@@ -16,7 +16,7 @@ struct AudioBuffer {
|
||||
s64 played_timestamp;
|
||||
/// Game memory address for these samples.
|
||||
VAddr samples;
|
||||
/// Unique identifier for this buffer.
|
||||
/// Unqiue identifier for this buffer.
|
||||
u64 tag;
|
||||
/// Size of the samples buffer.
|
||||
u64 size;
|
||||
|
||||
@@ -135,7 +135,7 @@ void AudioRenderer::ThreadFunc() {
|
||||
static constexpr char name[]{"AudioRenderer"};
|
||||
MicroProfileOnThreadCreate(name);
|
||||
Common::SetCurrentThreadName(name);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
if (mailbox->ADSPWaitMessage() != RenderMessage::AudioRenderer_InitializeOK) {
|
||||
LOG_ERROR(Service_Audio,
|
||||
"ADSP Audio Renderer -- Failed to receive initialize message from host!");
|
||||
@@ -165,7 +165,7 @@ void AudioRenderer::ThreadFunc() {
|
||||
// Check this buffer is valid, as it may not be used.
|
||||
if (command_buffer.buffer != 0) {
|
||||
// If there are no remaining commands (from the previous list),
|
||||
// this is a new command list, initialize it.
|
||||
// this is a new command list, initalize it.
|
||||
if (command_buffer.remaining_command_count == 0) {
|
||||
command_list_processor.Initialize(system, command_buffer.buffer,
|
||||
command_buffer.size, streams[index]);
|
||||
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
/**
|
||||
* Check if a variadic command buffer is supported.
|
||||
* As of Rev 5 with the added optional performance metric logging, the command
|
||||
* buffer can be a variable size, so take that into account for calculating its size.
|
||||
* buffer can be a variable size, so take that into account for calcualting its size.
|
||||
*
|
||||
* @return True if supported, otherwise false.
|
||||
*/
|
||||
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
/**
|
||||
* Get this effect's parameter data.
|
||||
*
|
||||
* @return Pointer to the parameter, must be cast to the correct type.
|
||||
* @return Pointer to the parametter, must be cast to the correct type.
|
||||
*/
|
||||
u8* GetParameter() {
|
||||
return parameter.data();
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
/**
|
||||
* Get this effect's parameter data.
|
||||
*
|
||||
* @return Pointer to the parameter, must be cast to the correct type.
|
||||
* @return Pointer to the parametter, must be cast to the correct type.
|
||||
*/
|
||||
u8* GetStateBuffer() {
|
||||
return state.data();
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
*/
|
||||
enum class State {
|
||||
Invalid,
|
||||
Acquired,
|
||||
Aquired,
|
||||
RequestDetach,
|
||||
Detached,
|
||||
RequestAttach,
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
* Splitter sort, traverse the splitter node graph and sort the sorted mixes from results.
|
||||
*
|
||||
* @param splitter_context - Splitter context for the sort.
|
||||
* @return True if the sort was successful, otherwise false.
|
||||
* @return True if the sort was successful, othewise false.
|
||||
*/
|
||||
bool TSortInfo(const SplitterContext& splitter_context);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ struct PerformanceDetailVersion1 {
|
||||
/* 0x0D */ PerformanceEntryType entry_type;
|
||||
};
|
||||
static_assert(sizeof(PerformanceDetailVersion1) == 0x10,
|
||||
"PerformanceDetailVersion1 has the wrong size!");
|
||||
"PerformanceDetailVersion1 has the worng size!");
|
||||
|
||||
struct PerformanceDetailVersion2 {
|
||||
/* 0x00 */ u32 node_id;
|
||||
@@ -45,6 +45,6 @@ struct PerformanceDetailVersion2 {
|
||||
/* 0x14 */ char unk14[0x4];
|
||||
};
|
||||
static_assert(sizeof(PerformanceDetailVersion2) == 0x18,
|
||||
"PerformanceDetailVersion2 has the wrong size!");
|
||||
"PerformanceDetailVersion2 has the worng size!");
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
||||
|
||||
@@ -22,7 +22,7 @@ struct PerformanceEntryVersion1 {
|
||||
/* 0x0C */ PerformanceEntryType entry_type;
|
||||
};
|
||||
static_assert(sizeof(PerformanceEntryVersion1) == 0x10,
|
||||
"PerformanceEntryVersion1 has the wrong size!");
|
||||
"PerformanceEntryVersion1 has the worng size!");
|
||||
|
||||
struct PerformanceEntryVersion2 {
|
||||
/* 0x00 */ u32 node_id;
|
||||
@@ -32,6 +32,6 @@ struct PerformanceEntryVersion2 {
|
||||
/* 0x0D */ char unk0D[0xB];
|
||||
};
|
||||
static_assert(sizeof(PerformanceEntryVersion2) == 0x18,
|
||||
"PerformanceEntryVersion2 has the wrong size!");
|
||||
"PerformanceEntryVersion2 has the worng size!");
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
||||
|
||||
@@ -16,7 +16,7 @@ struct PerformanceFrameHeaderVersion1 {
|
||||
/* 0x14 */ u32 frame_index;
|
||||
};
|
||||
static_assert(sizeof(PerformanceFrameHeaderVersion1) == 0x18,
|
||||
"PerformanceFrameHeaderVersion1 has the wrong size!");
|
||||
"PerformanceFrameHeaderVersion1 has the worng size!");
|
||||
|
||||
struct PerformanceFrameHeaderVersion2 {
|
||||
/* 0x00 */ u32 magic; // "PERF"
|
||||
@@ -31,6 +31,6 @@ struct PerformanceFrameHeaderVersion2 {
|
||||
/* 0x25 */ char unk25[0xB];
|
||||
};
|
||||
static_assert(sizeof(PerformanceFrameHeaderVersion2) == 0x30,
|
||||
"PerformanceFrameHeaderVersion2 has the wrong size!");
|
||||
"PerformanceFrameHeaderVersion2 has the worng size!");
|
||||
|
||||
} // namespace AudioCore::AudioRenderer
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
/**
|
||||
* Get the total number of splitter destinations.
|
||||
*
|
||||
* @return Number of destinations.
|
||||
* @return Number of destiantions.
|
||||
*/
|
||||
u32 GetDataCount() const;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
/**
|
||||
* Update this destination.
|
||||
*
|
||||
* @param params - Input parameters to update the destination.
|
||||
* @param params - Inpout parameters to update the destination.
|
||||
*/
|
||||
void Update(const InParameter& params);
|
||||
|
||||
@@ -126,9 +126,9 @@ private:
|
||||
std::array<f32, MaxMixBuffers> prev_mix_volumes{0.0f};
|
||||
/// Next destination in the mix chain
|
||||
SplitterDestinationData* next{};
|
||||
/// Is this destination in use?
|
||||
/// Is this destiantion in use?
|
||||
bool in_use{};
|
||||
/// Does this destination need its volumes updated?
|
||||
/// Does this destiantion need its volumes updated?
|
||||
bool need_update{};
|
||||
};
|
||||
|
||||
|
||||
@@ -49,14 +49,14 @@ public:
|
||||
/**
|
||||
* Get the number of destinations in this splitter.
|
||||
*
|
||||
* @return The number of destinations.
|
||||
* @return The number of destiantions.
|
||||
*/
|
||||
u32 GetDestinationCount() const;
|
||||
|
||||
/**
|
||||
* Set the number of destinations in this splitter.
|
||||
*
|
||||
* @param count - The new number of destinations.
|
||||
* @param count - The new number of destiantions.
|
||||
*/
|
||||
void SetDestinationCount(u32 count);
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
ExecutionMode GetExecutionMode() const;
|
||||
|
||||
/**
|
||||
* Get the rendering device for this system.
|
||||
* Get the rendering deivce for this system.
|
||||
* This is unused.
|
||||
*
|
||||
* @return Rendering device for this system.
|
||||
@@ -241,7 +241,7 @@ private:
|
||||
std::span<u8> command_workbuffer{};
|
||||
/// Size of command workbuffer
|
||||
u64 command_workbuffer_size{};
|
||||
/// Number of commands in the workbuffer
|
||||
/// Numebr of commands in the workbuffer
|
||||
u64 command_buffer_size{};
|
||||
/// Manager for upsamplers
|
||||
UpsamplerManager* upsampler_manager{};
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
/**
|
||||
* Initialize the system manager, called when any system is registered.
|
||||
*
|
||||
* @return True if successfully initialized, otherwise false.
|
||||
* @return True if sucessfully initialized, otherwise false.
|
||||
*/
|
||||
bool InitializeUnsafe();
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
* The manager does not own the system, so do not free it without calling Remove.
|
||||
*
|
||||
* @param system - The system to add.
|
||||
* @return True if successfully added, otherwise false.
|
||||
* @return True if succesfully added, otherwise false.
|
||||
*/
|
||||
bool Add(System& system);
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
* Remove an audio render system from the manager.
|
||||
*
|
||||
* @param system - The system to remove.
|
||||
* @return True if successfully removed, otherwise false.
|
||||
* @return True if succesfully removed, otherwise false.
|
||||
*/
|
||||
bool Remove(System& system);
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
void Initialize();
|
||||
|
||||
/**
|
||||
* Does this voice need an update?
|
||||
* Does this voice ned an update?
|
||||
*
|
||||
* @param params - Input parameters to check matching.
|
||||
*
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
*
|
||||
* @param error_info - Output array of errors.
|
||||
* @param wave_buffer - The wavebuffer to be updated.
|
||||
* @param wave_buffer_internal - Input parameters to be used for the update.
|
||||
* @param wave_buffer_internal - Input parametters to be used for the update.
|
||||
* @param sample_format - Sample format of the wavebuffer.
|
||||
* @param valid - Is this wavebuffer valid?
|
||||
* @param pool_mapper - Used to map the wavebuffers.
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
* @param description The room description
|
||||
* @param port The port of the room
|
||||
* @param net_version The version of the libNetwork that gets used
|
||||
* @param has_password True if the room is password protected
|
||||
* @param has_password True if the room is passowrd protected
|
||||
* @param preferred_game The preferred game of the room
|
||||
* @param preferred_game_id The title id of the preferred game
|
||||
*/
|
||||
|
||||
@@ -90,7 +90,7 @@ Fiber::~Fiber() {
|
||||
}
|
||||
|
||||
void Fiber::Exit() {
|
||||
ASSERT_MSG(impl->is_thread_fiber, "Exiting non main thread fiber");
|
||||
ASSERT_MSG(impl->is_thread_fiber, "Exitting non main thread fiber");
|
||||
if (!impl->is_thread_fiber) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class FixedPoint;
|
||||
namespace detail {
|
||||
|
||||
// helper templates to make magic with types :)
|
||||
// these allow us to determine reasonable types from
|
||||
// these allow us to determine resonable types from
|
||||
// a desired size, they also let us infer the next largest type
|
||||
// from a type which is nice for the division op
|
||||
template <size_t T>
|
||||
|
||||
@@ -322,7 +322,7 @@ private:
|
||||
}
|
||||
|
||||
/// Return true when a given memory region is a "nieche" and the placeholders don't have to be
|
||||
/// split.
|
||||
/// splitted.
|
||||
bool IsNiechePlaceholder(size_t virtual_offset, size_t length) const {
|
||||
const auto it = placeholders.upper_bound({virtual_offset, virtual_offset + length});
|
||||
if (it != placeholders.end() && it->lower() == virtual_offset + length) {
|
||||
@@ -484,7 +484,7 @@ class HostMemory::Impl {
|
||||
public:
|
||||
explicit Impl(size_t /*backing_size */, size_t /* virtual_size */) {
|
||||
// This is just a place holder.
|
||||
// Please implement fastmem in a proper way on your platform.
|
||||
// Please implement fastmem in a propper way on your platform.
|
||||
throw std::bad_alloc{};
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace Common::Input {
|
||||
|
||||
// Type of data that is expected to receive or send
|
||||
// Type of data that is expected to recieve or send
|
||||
enum class InputType {
|
||||
None,
|
||||
Battery,
|
||||
@@ -103,7 +103,7 @@ enum class VibrationAmplificationType {
|
||||
struct AnalogProperties {
|
||||
// Anything below this value will be detected as zero
|
||||
float deadzone{};
|
||||
// Anything above this values will be detected as one
|
||||
// Anyting above this values will be detected as one
|
||||
float range{1.0f};
|
||||
// Minimum value to be detected as active
|
||||
float threshold{0.5f};
|
||||
@@ -209,7 +209,7 @@ struct LedStatus {
|
||||
bool led_4{};
|
||||
};
|
||||
|
||||
// Raw data from camera
|
||||
// Raw data fom camera
|
||||
struct CameraStatus {
|
||||
CameraFormat format{CameraFormat::None};
|
||||
std::vector<u8> data{};
|
||||
@@ -428,7 +428,7 @@ inline void UnregisterOutputFactory(const std::string& name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an input device from given parameters.
|
||||
* Create an input device from given paramters.
|
||||
* @tparam InputDeviceType the type of input devices to create
|
||||
* @param params a serialized ParamPackage string that contains all parameters for creating the
|
||||
* device
|
||||
|
||||
@@ -23,19 +23,6 @@ static s64 WindowsQueryPerformanceCounter() {
|
||||
QueryPerformanceCounter(&counter);
|
||||
return counter.QuadPart;
|
||||
}
|
||||
|
||||
static s64 GetSystemTimeNS() {
|
||||
// GetSystemTimePreciseAsFileTime returns the file time in 100ns units.
|
||||
static constexpr s64 Multiplier = 100;
|
||||
// Convert Windows epoch to Unix epoch.
|
||||
static constexpr s64 WindowsEpochToUnixEpochNS = 0x19DB1DED53E8000LL;
|
||||
|
||||
FILETIME filetime;
|
||||
GetSystemTimePreciseAsFileTime(&filetime);
|
||||
return Multiplier * ((static_cast<s64>(filetime.dwHighDateTime) << 32) +
|
||||
static_cast<s64>(filetime.dwLowDateTime)) -
|
||||
WindowsEpochToUnixEpochNS;
|
||||
}
|
||||
#endif
|
||||
|
||||
SteadyClock::time_point SteadyClock::Now() noexcept {
|
||||
@@ -66,16 +53,4 @@ SteadyClock::time_point SteadyClock::Now() noexcept {
|
||||
#endif
|
||||
}
|
||||
|
||||
RealTimeClock::time_point RealTimeClock::Now() noexcept {
|
||||
#if defined(_WIN32)
|
||||
return time_point{duration{GetSystemTimeNS()}};
|
||||
#elif defined(__APPLE__)
|
||||
return time_point{duration{clock_gettime_nsec_np(CLOCK_REALTIME)}};
|
||||
#else
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
return time_point{std::chrono::seconds{ts.tv_sec} + std::chrono::nanoseconds{ts.tv_nsec}};
|
||||
#endif
|
||||
}
|
||||
|
||||
}; // namespace Common
|
||||
|
||||
@@ -20,15 +20,4 @@ struct SteadyClock {
|
||||
[[nodiscard]] static time_point Now() noexcept;
|
||||
};
|
||||
|
||||
struct RealTimeClock {
|
||||
using rep = s64;
|
||||
using period = std::nano;
|
||||
using duration = std::chrono::nanoseconds;
|
||||
using time_point = std::chrono::time_point<RealTimeClock>;
|
||||
|
||||
static constexpr bool is_steady = false;
|
||||
|
||||
[[nodiscard]] static time_point Now() noexcept;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
value = swap(swap() - 1);
|
||||
return old;
|
||||
}
|
||||
// Comparison
|
||||
// Comparaison
|
||||
// v == i
|
||||
bool operator==(const swapped_t& i) const {
|
||||
return swap() == i.swap();
|
||||
@@ -368,7 +368,7 @@ public:
|
||||
// Member
|
||||
/** todo **/
|
||||
|
||||
// Arithmetic
|
||||
// Arithmetics
|
||||
template <typename S, typename T2, typename F2>
|
||||
friend S operator+(const S& p, const swapped_t v);
|
||||
|
||||
@@ -384,7 +384,7 @@ public:
|
||||
template <typename S, typename T2, typename F2>
|
||||
friend S operator%(const S& p, const swapped_t v);
|
||||
|
||||
// Arithmetic + assignments
|
||||
// Arithmetics + assignments
|
||||
template <typename S, typename T2, typename F2>
|
||||
friend S operator+=(const S& p, const swapped_t v);
|
||||
|
||||
@@ -415,7 +415,7 @@ public:
|
||||
friend bool operator==(const S& p, const swapped_t v);
|
||||
};
|
||||
|
||||
// Arithmetic
|
||||
// Arithmetics
|
||||
template <typename S, typename T, typename F>
|
||||
S operator+(const S& i, const swap_struct_t<T, F> v) {
|
||||
return i + v.swap();
|
||||
@@ -441,7 +441,7 @@ S operator%(const S& i, const swap_struct_t<T, F> v) {
|
||||
return i % v.swap();
|
||||
}
|
||||
|
||||
// Arithmetic + assignments
|
||||
// Arithmetics + assignments
|
||||
template <typename S, typename T, typename F>
|
||||
S& operator+=(S& i, const swap_struct_t<T, F> v) {
|
||||
i += v.swap();
|
||||
@@ -465,7 +465,7 @@ S operator&(const swap_struct_t<T, F> v, const S& i) {
|
||||
return static_cast<S>(v.swap() & i);
|
||||
}
|
||||
|
||||
// Comparison
|
||||
// Comparaison
|
||||
template <typename S, typename T, typename F>
|
||||
bool operator<(const S& p, const swap_struct_t<T, F> v) {
|
||||
return p < v.swap();
|
||||
|
||||
@@ -53,11 +53,11 @@ u64 EstimateRDTSCFrequency() {
|
||||
FencedRDTSC();
|
||||
|
||||
// Get the current time.
|
||||
const auto start_time = Common::RealTimeClock::Now();
|
||||
const auto start_time = Common::SteadyClock::Now();
|
||||
const u64 tsc_start = FencedRDTSC();
|
||||
// Wait for 250 milliseconds.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{250});
|
||||
const auto end_time = Common::RealTimeClock::Now();
|
||||
const auto end_time = Common::SteadyClock::Now();
|
||||
const u64 tsc_end = FencedRDTSC();
|
||||
// Calculate differences.
|
||||
const u64 timer_diff = static_cast<u64>(
|
||||
@@ -72,29 +72,13 @@ NativeClock::NativeClock(u64 emulated_cpu_frequency_, u64 emulated_clock_frequen
|
||||
u64 rtsc_frequency_)
|
||||
: WallClock(emulated_cpu_frequency_, emulated_clock_frequency_, true), rtsc_frequency{
|
||||
rtsc_frequency_} {
|
||||
// Thread to re-adjust the RDTSC frequency after 10 seconds has elapsed.
|
||||
time_sync_thread = std::jthread{[this](std::stop_token token) {
|
||||
// Get the current time.
|
||||
const auto start_time = Common::RealTimeClock::Now();
|
||||
const u64 tsc_start = FencedRDTSC();
|
||||
// Wait for 10 seconds.
|
||||
if (!Common::StoppableTimedWait(token, std::chrono::seconds{10})) {
|
||||
return;
|
||||
}
|
||||
const auto end_time = Common::RealTimeClock::Now();
|
||||
const u64 tsc_end = FencedRDTSC();
|
||||
// Calculate differences.
|
||||
const u64 timer_diff = static_cast<u64>(
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time).count());
|
||||
const u64 tsc_diff = tsc_end - tsc_start;
|
||||
const u64 tsc_freq = MultiplyAndDivide64(tsc_diff, 1000000000ULL, timer_diff);
|
||||
rtsc_frequency = tsc_freq;
|
||||
CalculateAndSetFactors();
|
||||
}};
|
||||
|
||||
time_point.inner.last_measure = FencedRDTSC();
|
||||
time_point.inner.accumulated_ticks = 0U;
|
||||
CalculateAndSetFactors();
|
||||
ns_rtsc_factor = GetFixedPoint64Factor(NS_RATIO, rtsc_frequency);
|
||||
us_rtsc_factor = GetFixedPoint64Factor(US_RATIO, rtsc_frequency);
|
||||
ms_rtsc_factor = GetFixedPoint64Factor(MS_RATIO, rtsc_frequency);
|
||||
clock_rtsc_factor = GetFixedPoint64Factor(emulated_clock_frequency, rtsc_frequency);
|
||||
cpu_rtsc_factor = GetFixedPoint64Factor(emulated_cpu_frequency, rtsc_frequency);
|
||||
}
|
||||
|
||||
u64 NativeClock::GetRTSC() {
|
||||
@@ -154,14 +138,6 @@ u64 NativeClock::GetCPUCycles() {
|
||||
return MultiplyHigh(rtsc_value, cpu_rtsc_factor);
|
||||
}
|
||||
|
||||
void NativeClock::CalculateAndSetFactors() {
|
||||
ns_rtsc_factor = GetFixedPoint64Factor(NS_RATIO, rtsc_frequency);
|
||||
us_rtsc_factor = GetFixedPoint64Factor(US_RATIO, rtsc_frequency);
|
||||
ms_rtsc_factor = GetFixedPoint64Factor(MS_RATIO, rtsc_frequency);
|
||||
clock_rtsc_factor = GetFixedPoint64Factor(emulated_clock_frequency, rtsc_frequency);
|
||||
cpu_rtsc_factor = GetFixedPoint64Factor(emulated_cpu_frequency, rtsc_frequency);
|
||||
}
|
||||
|
||||
} // namespace X64
|
||||
|
||||
} // namespace Common
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/polyfill_thread.h"
|
||||
#include "common/wall_clock.h"
|
||||
|
||||
namespace Common {
|
||||
@@ -29,8 +28,6 @@ public:
|
||||
private:
|
||||
u64 GetRTSC();
|
||||
|
||||
void CalculateAndSetFactors();
|
||||
|
||||
union alignas(16) TimePoint {
|
||||
TimePoint() : pack{} {}
|
||||
u128 pack{};
|
||||
@@ -50,8 +47,6 @@ private:
|
||||
u64 ms_rtsc_factor{};
|
||||
|
||||
u64 rtsc_frequency;
|
||||
|
||||
std::jthread time_sync_thread;
|
||||
};
|
||||
} // namespace X64
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ struct System::Impl {
|
||||
void ShutdownMainProcess() {
|
||||
SetShuttingDown(true);
|
||||
|
||||
// Log last frame performance stats if game was loaded
|
||||
// Log last frame performance stats if game was loded
|
||||
if (perf_stats) {
|
||||
const auto perf_results = GetAndResetPerfStats();
|
||||
constexpr auto performance = Common::Telemetry::FieldType::Performance;
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
|
||||
/**
|
||||
* Initializes the system
|
||||
* This function will initialize core functionality used for system emulation
|
||||
* This function will initialize core functionaility used for system emulation
|
||||
*/
|
||||
void Initialize();
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void CoreTiming::ThreadEntry(CoreTiming& instance) {
|
||||
static constexpr char name[] = "HostTiming";
|
||||
MicroProfileOnThreadCreate(name);
|
||||
Common::SetCurrentThreadName(name);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
instance.on_thread_init();
|
||||
instance.ThreadLoop();
|
||||
MicroProfileOnThreadExit();
|
||||
|
||||
@@ -150,7 +150,7 @@ private:
|
||||
// The queue is a min-heap using std::make_heap/push_heap/pop_heap.
|
||||
// We don't use std::priority_queue because we need to be able to serialize, unserialize and
|
||||
// erase arbitrary events (RemoveEvent()) regardless of the queue order. These aren't
|
||||
// accommodated by the standard adaptor class.
|
||||
// accomodated by the standard adaptor class.
|
||||
std::vector<Event> event_queue;
|
||||
u64 event_fifo_id = 0;
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ void CpuManager::RunThread(std::stop_token token, std::size_t core) {
|
||||
}
|
||||
MicroProfileOnThreadCreate(name.c_str());
|
||||
Common::SetCurrentThreadName(name.c_str());
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
|
||||
auto& data = core_data[core];
|
||||
data.host_context = Common::Fiber::ThreadToFiber();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Core::Crypto {
|
||||
|
||||
// Sits on top of a VirtualFile and provides CTR-mode AES description.
|
||||
// Sits on top of a VirtualFile and provides CTR-mode AES decription.
|
||||
class CTREncryptionLayer : public EncryptionLayer {
|
||||
public:
|
||||
using IVData = std::array<u8, 16>;
|
||||
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
|
||||
static bool KeyFileExists(bool title);
|
||||
|
||||
// Call before using the sd seed to attempt to derive it if it doesn't exist. Needs system
|
||||
// Call before using the sd seed to attempt to derive it if it dosen't exist. Needs system
|
||||
// save 8*43 and the private file to exist.
|
||||
void DeriveSDSeedLazy();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Core::Crypto {
|
||||
|
||||
// Sits on top of a VirtualFile and provides XTS-mode AES description.
|
||||
// Sits on top of a VirtualFile and provides XTS-mode AES decription.
|
||||
class XTSEncryptionLayer : public EncryptionLayer {
|
||||
public:
|
||||
XTSEncryptionLayer(FileSys::VirtualFile base, Key256 key);
|
||||
|
||||
@@ -93,7 +93,7 @@ inline bool IsDirectoryLogoPartition(const VirtualDir& pfs) {
|
||||
pfs->GetFile("StartupMovie.gif") != nullptr;
|
||||
}
|
||||
|
||||
// An implementation of VfsDirectory that represents a Nintendo Content Archive (NCA) container.
|
||||
// An implementation of VfsDirectory that represents a Nintendo Content Archive (NCA) conatiner.
|
||||
// After construction, use GetStatus to determine if the file is valid and ready to be used.
|
||||
class NCA : public ReadOnlyVfsDirectory {
|
||||
public:
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
InstallResult InstallEntry(const NSP& nsp, bool overwrite_if_exists = false,
|
||||
const VfsCopyFunction& copy = &VfsRawCopy);
|
||||
|
||||
// Due to the fact that we must use Meta-type NCAs to determine the existence of files, this
|
||||
// Due to the fact that we must use Meta-type NCAs to determine the existance of files, this
|
||||
// poses quite a challenge. Instead of creating a new meta NCA for this file, yuzu will create a
|
||||
// dir inside the NAND called 'yuzu_meta' and store the raw CNMT there.
|
||||
// TODO(DarkLordZach): Author real meta-type NCAs and install those.
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
// Return whether or not the user has write permission on this filesystem.
|
||||
virtual bool IsWritable() const;
|
||||
|
||||
// Determine if the entry at path is non-existent, a file, or a directory.
|
||||
// Determine if the entry at path is non-existant, a file, or a directory.
|
||||
virtual VfsEntryType GetEntryType(std::string_view path) const;
|
||||
|
||||
// Opens the file with path relative to root. If it doesn't exist, returns nullptr.
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
// Moves the file from old_path to new_path, returning the moved file on success and nullptr on
|
||||
// failure.
|
||||
virtual VirtualFile MoveFile(std::string_view old_path, std::string_view new_path);
|
||||
// Deletes the file with path relative to root, returning true on success.
|
||||
// Deletes the file with path relative to root, returing true on success.
|
||||
virtual bool DeleteFile(std::string_view path);
|
||||
|
||||
// Opens the directory with path relative to root. If it doesn't exist, returns nullptr.
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
// Moves the directory from old_path to new_path, returning the moved directory on success and
|
||||
// nullptr on failure.
|
||||
virtual VirtualDir MoveDirectory(std::string_view old_path, std::string_view new_path);
|
||||
// Deletes the directory with path relative to root, returning true on success.
|
||||
// Deletes the directory with path relative to root, returing true on success.
|
||||
virtual bool DeleteDirectory(std::string_view path);
|
||||
|
||||
protected:
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
return Read(reinterpret_cast<u8*>(data), sizeof(T), offset);
|
||||
}
|
||||
|
||||
// Writes exactly one byte to offset in file and returns whether or not the byte was written
|
||||
// Writes exactly one byte to offset in file and retuns whether or not the byte was written
|
||||
// successfully.
|
||||
virtual bool WriteByte(u8 data, std::size_t offset = 0);
|
||||
// Writes a vector of bytes to offset in file and returns the number of bytes successfully
|
||||
@@ -191,13 +191,13 @@ public:
|
||||
VfsDirectory() = default;
|
||||
virtual ~VfsDirectory();
|
||||
|
||||
// Retrieves the file located at path as if the current directory was root. Returns nullptr if
|
||||
// Retrives the file located at path as if the current directory was root. Returns nullptr if
|
||||
// not found.
|
||||
virtual VirtualFile GetFileRelative(std::string_view path) const;
|
||||
// Calls GetFileRelative(path) on the root of the current directory.
|
||||
virtual VirtualFile GetFileAbsolute(std::string_view path) const;
|
||||
|
||||
// Retrieves the directory located at path as if the current directory was root. Returns nullptr
|
||||
// Retrives the directory located at path as if the current directory was root. Returns nullptr
|
||||
// if not found.
|
||||
virtual VirtualDir GetDirectoryRelative(std::string_view path) const;
|
||||
// Calls GetDirectoryRelative(path) on the root of the current directory.
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
|
||||
// Returns a vector containing all of the files in this directory.
|
||||
virtual std::vector<VirtualFile> GetFiles() const = 0;
|
||||
// Returns the file with filename matching name. Returns nullptr if directory doesn't have a
|
||||
// Returns the file with filename matching name. Returns nullptr if directory dosen't have a
|
||||
// file with name.
|
||||
virtual VirtualFile GetFile(std::string_view name) const;
|
||||
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
|
||||
// Returns a vector containing all of the subdirectories in this directory.
|
||||
virtual std::vector<VirtualDir> GetSubdirectories() const = 0;
|
||||
// Returns the directory with name matching name. Returns nullptr if directory doesn't have a
|
||||
// Returns the directory with name matching name. Returns nullptr if directory dosen't have a
|
||||
// directory with name.
|
||||
virtual VirtualDir GetSubdirectory(std::string_view name) const;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ private:
|
||||
boost::container::flat_map<std::string, std::weak_ptr<Common::FS::IOFile>> cache;
|
||||
};
|
||||
|
||||
// An implementation of VfsFile that represents a file on the user's computer.
|
||||
// An implmentation of VfsFile that represents a file on the user's computer.
|
||||
class RealVfsFile : public VfsFile {
|
||||
friend class RealVfsDirectory;
|
||||
friend class RealVfsFilesystem;
|
||||
|
||||
@@ -205,7 +205,7 @@ protected:
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a screen position into the equivalent touchscreen position.
|
||||
* Converts a screen postion into the equivalent touchscreen position.
|
||||
*/
|
||||
std::pair<f32, f32> MapToTouchScreen(u32 framebuffer_x, u32 framebuffer_y) const;
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ struct ControllerStatus {
|
||||
RingAnalogValue ring_analog_value{};
|
||||
NfcValues nfc_values{};
|
||||
|
||||
// Data for HID services
|
||||
// Data for HID serices
|
||||
HomeButtonState home_button_state{};
|
||||
CaptureButtonState capture_button_state{};
|
||||
NpadButtonState npad_button_state{};
|
||||
@@ -357,7 +357,7 @@ public:
|
||||
|
||||
/**
|
||||
* Sends a small vibration to the output device
|
||||
* @return true if SetVibration was successful
|
||||
* @return true if SetVibration was successfull
|
||||
*/
|
||||
bool IsVibrationEnabled(std::size_t device_index);
|
||||
|
||||
@@ -373,7 +373,7 @@ public:
|
||||
/**
|
||||
* Sets the desired camera format to be polled from a controller
|
||||
* @param camera_format size of each frame
|
||||
* @return true if SetCameraFormat was successful
|
||||
* @return true if SetCameraFormat was successfull
|
||||
*/
|
||||
bool SetCameraFormat(Core::IrSensor::ImageTransferProcessorFormat camera_format);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ struct DeviceStatus {
|
||||
MouseWheelValues mouse_wheel_values{};
|
||||
MouseStickValue mouse_stick_value{};
|
||||
|
||||
// Data for HID services
|
||||
// Data for HID serices
|
||||
KeyboardKey keyboard_state{};
|
||||
KeyboardModifier keyboard_moddifier_state{};
|
||||
MouseButton mouse_button_state{};
|
||||
@@ -75,7 +75,7 @@ struct InterfaceUpdateCallback {
|
||||
class EmulatedDevices {
|
||||
public:
|
||||
/**
|
||||
* Contains all input data related to external devices that aren't necessarily a controller
|
||||
* Contains all input data related to external devices that aren't necesarily a controller
|
||||
* This includes devices such as the keyboard or mouse
|
||||
*/
|
||||
explicit EmulatedDevices();
|
||||
|
||||
@@ -328,7 +328,7 @@ void SanitizeAnalog(Common::Input::AnalogStatus& analog, bool clamp_value) {
|
||||
// Apply center offset
|
||||
raw_value -= properties.offset;
|
||||
|
||||
// Set initial values to be formatted
|
||||
// Set initial values to be formated
|
||||
value = raw_value;
|
||||
|
||||
// Calculate vector size
|
||||
@@ -398,7 +398,7 @@ void SanitizeStick(Common::Input::AnalogStatus& analog_x, Common::Input::AnalogS
|
||||
raw_x = properties_x.inverted ? -raw_x : raw_x;
|
||||
raw_y = properties_y.inverted ? -raw_y : raw_y;
|
||||
|
||||
// Set initial values to be formatted
|
||||
// Set initial values to be formated
|
||||
x = raw_x;
|
||||
y = raw_y;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
// Gyroscope vector measurement in radians/s.
|
||||
Common::Vec3f gyro;
|
||||
|
||||
// Vector to be subtracted from gyro measurements
|
||||
// Vector to be substracted from gyro measurements
|
||||
Common::Vec3f gyro_bias;
|
||||
|
||||
// Minimum gyro amplitude to detect if the device is moving
|
||||
|
||||
@@ -237,11 +237,10 @@ Result KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 val
|
||||
Result KAddressArbiter::WaitIfLessThan(VAddr addr, s32 value, bool decrement, s64 timeout) {
|
||||
// Prepare to wait.
|
||||
KThread* cur_thread = GetCurrentThreadPointer(kernel);
|
||||
KHardwareTimer* timer{};
|
||||
ThreadQueueImplForKAddressArbiter wait_queue(kernel, std::addressof(thread_tree));
|
||||
|
||||
{
|
||||
KScopedSchedulerLockAndSleep slp{kernel, std::addressof(timer), cur_thread, timeout};
|
||||
KScopedSchedulerLockAndSleep slp{kernel, cur_thread, timeout};
|
||||
|
||||
// Check that the thread isn't terminating.
|
||||
if (cur_thread->IsTerminationRequested()) {
|
||||
@@ -280,7 +279,6 @@ Result KAddressArbiter::WaitIfLessThan(VAddr addr, s32 value, bool decrement, s6
|
||||
thread_tree.insert(*cur_thread);
|
||||
|
||||
// Wait for the thread to finish.
|
||||
wait_queue.SetHardwareTimer(timer);
|
||||
cur_thread->BeginWait(std::addressof(wait_queue));
|
||||
cur_thread->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Arbitration);
|
||||
}
|
||||
@@ -292,11 +290,10 @@ Result KAddressArbiter::WaitIfLessThan(VAddr addr, s32 value, bool decrement, s6
|
||||
Result KAddressArbiter::WaitIfEqual(VAddr addr, s32 value, s64 timeout) {
|
||||
// Prepare to wait.
|
||||
KThread* cur_thread = GetCurrentThreadPointer(kernel);
|
||||
KHardwareTimer* timer{};
|
||||
ThreadQueueImplForKAddressArbiter wait_queue(kernel, std::addressof(thread_tree));
|
||||
|
||||
{
|
||||
KScopedSchedulerLockAndSleep slp{kernel, std::addressof(timer), cur_thread, timeout};
|
||||
KScopedSchedulerLockAndSleep slp{kernel, cur_thread, timeout};
|
||||
|
||||
// Check that the thread isn't terminating.
|
||||
if (cur_thread->IsTerminationRequested()) {
|
||||
@@ -328,7 +325,6 @@ Result KAddressArbiter::WaitIfEqual(VAddr addr, s32 value, s64 timeout) {
|
||||
thread_tree.insert(*cur_thread);
|
||||
|
||||
// Wait for the thread to finish.
|
||||
wait_queue.SetHardwareTimer(timer);
|
||||
cur_thread->BeginWait(std::addressof(wait_queue));
|
||||
cur_thread->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Arbitration);
|
||||
}
|
||||
|
||||
@@ -266,12 +266,11 @@ void KConditionVariable::Signal(u64 cv_key, s32 count) {
|
||||
Result KConditionVariable::Wait(VAddr addr, u64 key, u32 value, s64 timeout) {
|
||||
// Prepare to wait.
|
||||
KThread* cur_thread = GetCurrentThreadPointer(kernel);
|
||||
KHardwareTimer* timer{};
|
||||
ThreadQueueImplForKConditionVariableWaitConditionVariable wait_queue(
|
||||
kernel, std::addressof(thread_tree));
|
||||
|
||||
{
|
||||
KScopedSchedulerLockAndSleep slp(kernel, std::addressof(timer), cur_thread, timeout);
|
||||
KScopedSchedulerLockAndSleep slp(kernel, cur_thread, timeout);
|
||||
|
||||
// Check that the thread isn't terminating.
|
||||
if (cur_thread->IsTerminationRequested()) {
|
||||
@@ -321,7 +320,6 @@ Result KConditionVariable::Wait(VAddr addr, u64 key, u32 value, s64 timeout) {
|
||||
thread_tree.insert(*cur_thread);
|
||||
|
||||
// Begin waiting.
|
||||
wait_queue.SetHardwareTimer(timer);
|
||||
cur_thread->BeginWait(std::addressof(wait_queue));
|
||||
cur_thread->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::ConditionVar);
|
||||
cur_thread->SetMutexWaitAddressForDebugging(addr);
|
||||
|
||||
@@ -40,14 +40,13 @@ private:
|
||||
void KLightConditionVariable::Wait(KLightLock* lock, s64 timeout, bool allow_terminating_thread) {
|
||||
// Create thread queue.
|
||||
KThread* owner = GetCurrentThreadPointer(kernel);
|
||||
KHardwareTimer* timer{};
|
||||
|
||||
ThreadQueueImplForKLightConditionVariable wait_queue(kernel, std::addressof(wait_list),
|
||||
allow_terminating_thread);
|
||||
|
||||
// Sleep the thread.
|
||||
{
|
||||
KScopedSchedulerLockAndSleep lk(kernel, std::addressof(timer), owner, timeout);
|
||||
KScopedSchedulerLockAndSleep lk(kernel, owner, timeout);
|
||||
|
||||
if (!allow_terminating_thread && owner->IsTerminationRequested()) {
|
||||
lk.CancelSleep();
|
||||
@@ -60,7 +59,6 @@ void KLightConditionVariable::Wait(KLightLock* lock, s64 timeout, bool allow_ter
|
||||
wait_list.push_back(*owner);
|
||||
|
||||
// Begin waiting.
|
||||
wait_queue.SetHardwareTimer(timer);
|
||||
owner->BeginWait(std::addressof(wait_queue));
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std:
|
||||
code_size + system_resource_size);
|
||||
R_RETURN(ResultLimitReached);
|
||||
}
|
||||
// Initialize process address space
|
||||
// Initialize proces address space
|
||||
if (const Result result{page_table.InitializeForProcess(
|
||||
metadata.GetAddressSpaceType(), false, false, false, KMemoryManager::Pool::Application,
|
||||
0x8000000, code_size, &kernel.GetAppSystemResource(), resource_limit)};
|
||||
|
||||
@@ -235,7 +235,7 @@ public:
|
||||
total_process_running_time_ticks += ticks;
|
||||
}
|
||||
|
||||
/// Gets the process schedule count, used for thread yielding
|
||||
/// Gets the process schedule count, used for thread yelding
|
||||
s64 GetScheduledCount() const {
|
||||
return schedule_count;
|
||||
}
|
||||
|
||||
@@ -13,22 +13,16 @@ namespace Kernel {
|
||||
|
||||
class [[nodiscard]] KScopedSchedulerLockAndSleep {
|
||||
public:
|
||||
explicit KScopedSchedulerLockAndSleep(KernelCore& kernel_, KHardwareTimer** out_timer,
|
||||
KThread* t, s64 timeout)
|
||||
: kernel(kernel_), timeout_tick(timeout), thread(t), timer() {
|
||||
explicit KScopedSchedulerLockAndSleep(KernelCore& kernel_, KThread* t, s64 timeout)
|
||||
: kernel(kernel_), thread(t), timeout_tick(timeout) {
|
||||
// Lock the scheduler.
|
||||
kernel.GlobalSchedulerContext().scheduler_lock.Lock();
|
||||
|
||||
// Set our timer only if the time is positive.
|
||||
timer = (timeout_tick > 0) ? std::addressof(kernel.HardwareTimer()) : nullptr;
|
||||
|
||||
*out_timer = timer;
|
||||
}
|
||||
|
||||
~KScopedSchedulerLockAndSleep() {
|
||||
// Register the sleep.
|
||||
if (timeout_tick > 0) {
|
||||
timer->RegisterTask(thread, timeout_tick);
|
||||
kernel.HardwareTimer().RegisterTask(thread, timeout_tick);
|
||||
}
|
||||
|
||||
// Unlock the scheduler.
|
||||
@@ -41,9 +35,8 @@ public:
|
||||
|
||||
private:
|
||||
KernelCore& kernel;
|
||||
s64 timeout_tick{};
|
||||
KThread* thread{};
|
||||
KHardwareTimer* timer{};
|
||||
s64 timeout_tick{};
|
||||
};
|
||||
|
||||
} // namespace Kernel
|
||||
|
||||
@@ -79,13 +79,12 @@ Result KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index,
|
||||
|
||||
// Prepare for wait.
|
||||
KThread* thread = GetCurrentThreadPointer(kernel_ctx);
|
||||
KHardwareTimer* timer{};
|
||||
ThreadQueueImplForKSynchronizationObjectWait wait_queue(kernel_ctx, objects,
|
||||
thread_nodes.data(), num_objects);
|
||||
|
||||
{
|
||||
// Setup the scheduling lock and sleep.
|
||||
KScopedSchedulerLockAndSleep slp(kernel_ctx, std::addressof(timer), thread, timeout);
|
||||
KScopedSchedulerLockAndSleep slp(kernel_ctx, thread, timeout);
|
||||
|
||||
// Check if the thread should terminate.
|
||||
if (thread->IsTerminationRequested()) {
|
||||
@@ -132,7 +131,6 @@ Result KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index,
|
||||
thread->SetSyncedIndex(-1);
|
||||
|
||||
// Wait for an object to be signaled.
|
||||
wait_queue.SetHardwareTimer(timer);
|
||||
thread->BeginWait(std::addressof(wait_queue));
|
||||
thread->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Synchronization);
|
||||
}
|
||||
|
||||
@@ -1290,10 +1290,9 @@ Result KThread::Sleep(s64 timeout) {
|
||||
ASSERT(timeout > 0);
|
||||
|
||||
ThreadQueueImplForKThreadSleep wait_queue_(kernel);
|
||||
KHardwareTimer* timer{};
|
||||
{
|
||||
// Setup the scheduling lock and sleep.
|
||||
KScopedSchedulerLockAndSleep slp(kernel, std::addressof(timer), this, timeout);
|
||||
KScopedSchedulerLockAndSleep slp(kernel, this, timeout);
|
||||
|
||||
// Check if the thread should terminate.
|
||||
if (this->IsTerminationRequested()) {
|
||||
@@ -1302,7 +1301,6 @@ Result KThread::Sleep(s64 timeout) {
|
||||
}
|
||||
|
||||
// Wait for the sleep to end.
|
||||
wait_queue_.SetHardwareTimer(timer);
|
||||
this->BeginWait(std::addressof(wait_queue_));
|
||||
SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Sleep);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,7 @@ void KThreadQueue::EndWait(KThread* waiting_thread, Result wait_result) {
|
||||
waiting_thread->ClearWaitQueue();
|
||||
|
||||
// Cancel the thread task.
|
||||
if (m_hardware_timer != nullptr) {
|
||||
m_hardware_timer->CancelTask(waiting_thread);
|
||||
}
|
||||
kernel.HardwareTimer().CancelTask(waiting_thread);
|
||||
}
|
||||
|
||||
void KThreadQueue::CancelWait(KThread* waiting_thread, Result wait_result, bool cancel_timer_task) {
|
||||
@@ -38,8 +36,8 @@ void KThreadQueue::CancelWait(KThread* waiting_thread, Result wait_result, bool
|
||||
waiting_thread->ClearWaitQueue();
|
||||
|
||||
// Cancel the thread task.
|
||||
if (cancel_timer_task && m_hardware_timer != nullptr) {
|
||||
m_hardware_timer->CancelTask(waiting_thread);
|
||||
if (cancel_timer_task) {
|
||||
kernel.HardwareTimer().CancelTask(waiting_thread);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,17 +8,11 @@
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class KHardwareTimer;
|
||||
|
||||
class KThreadQueue {
|
||||
public:
|
||||
explicit KThreadQueue(KernelCore& kernel_) : kernel{kernel_}, m_hardware_timer{} {}
|
||||
explicit KThreadQueue(KernelCore& kernel_) : kernel{kernel_} {}
|
||||
virtual ~KThreadQueue() = default;
|
||||
|
||||
void SetHardwareTimer(KHardwareTimer* timer) {
|
||||
m_hardware_timer = timer;
|
||||
}
|
||||
|
||||
virtual void NotifyAvailable(KThread* waiting_thread, KSynchronizationObject* signaled_object,
|
||||
Result wait_result);
|
||||
virtual void EndWait(KThread* waiting_thread, Result wait_result);
|
||||
@@ -26,7 +20,7 @@ public:
|
||||
|
||||
private:
|
||||
KernelCore& kernel;
|
||||
KHardwareTimer* m_hardware_timer{};
|
||||
KThread::WaiterList wait_list{};
|
||||
};
|
||||
|
||||
class KThreadQueueWithoutEndWait : public KThreadQueue {
|
||||
|
||||
@@ -85,7 +85,7 @@ Result CreateEvent(Core::System& system, Handle* out_write, Handle* out_read) {
|
||||
// Add the event to the handle table.
|
||||
R_TRY(handle_table.Add(out_write, event));
|
||||
|
||||
// Ensure that we maintain a clean handle state on exit.
|
||||
// Ensure that we maintaing a clean handle state on exit.
|
||||
auto handle_guard = SCOPE_GUARD({ handle_table.Remove(*out_write); });
|
||||
|
||||
// Add the readable event to the handle table.
|
||||
|
||||
@@ -81,7 +81,7 @@ Result CreateSession(Core::System& system, Handle* out_server, Handle* out_clien
|
||||
const auto result = handle_table.Add(out_client, &session->GetClientSession());
|
||||
|
||||
if (!R_SUCCEEDED(result)) {
|
||||
// Ensure that we maintain a clean handle state on exit.
|
||||
// Ensure that we maintaing a clean handle state on exit.
|
||||
handle_table.Remove(*out_server);
|
||||
}
|
||||
|
||||
|
||||
@@ -789,7 +789,7 @@ Result Module::Interface::InitializeApplicationInfoBase() {
|
||||
}
|
||||
|
||||
LOG_WARNING(Service_ACC, "ApplicationInfo init required");
|
||||
// TODO(ogniK): Actual initialization here
|
||||
// TODO(ogniK): Actual initalization here
|
||||
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ void ProfileManager::StoreOpenedUsers() {
|
||||
});
|
||||
}
|
||||
|
||||
/// Return the users profile base and the unknown arbitrary data.
|
||||
/// Return the users profile base and the unknown arbitary data.
|
||||
bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile,
|
||||
UserData& data) const {
|
||||
if (GetProfileBase(index, profile)) {
|
||||
@@ -297,13 +297,13 @@ bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, Pro
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Return the users profile base and the unknown arbitrary data.
|
||||
/// Return the users profile base and the unknown arbitary data.
|
||||
bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, UserData& data) const {
|
||||
const auto idx = GetUserIndex(uuid);
|
||||
return GetProfileBaseAndData(idx, profile, data);
|
||||
}
|
||||
|
||||
/// Return the users profile base and the unknown arbitrary data.
|
||||
/// Return the users profile base and the unknown arbitary data.
|
||||
bool ProfileManager::GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile,
|
||||
UserData& data) const {
|
||||
return GetProfileBaseAndData(user.user_uuid, profile, data);
|
||||
|
||||
@@ -119,7 +119,7 @@ void Cabinet::DisplayCompleted(bool apply_changes, std::string_view amiibo_name)
|
||||
case Service::NFP::CabinetMode::StartNicknameAndOwnerSettings: {
|
||||
Service::NFP::AmiiboName name{};
|
||||
std::memcpy(name.data(), amiibo_name.data(), std::min(amiibo_name.size(), name.size() - 1));
|
||||
nfp_device->SetRegisterInfoPrivate(name);
|
||||
nfp_device->SetNicknameAndOwner(name);
|
||||
break;
|
||||
}
|
||||
case Service::NFP::CabinetMode::StartGameDataEraser:
|
||||
@@ -129,7 +129,7 @@ void Cabinet::DisplayCompleted(bool apply_changes, std::string_view amiibo_name)
|
||||
nfp_device->RestoreAmiibo();
|
||||
break;
|
||||
case Service::NFP::CabinetMode::StartFormatter:
|
||||
nfp_device->Format();
|
||||
nfp_device->DeleteAllData();
|
||||
break;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unknown CabinetMode={}", applet_input_common.applet_mode);
|
||||
|
||||
@@ -55,7 +55,7 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
static_cast<f32>(shared_memory->gesture_lifo.timestamp - last_update_timestamp) /
|
||||
(1000 * 1000 * 1000);
|
||||
|
||||
// Only update if necessary
|
||||
// Only update if necesary
|
||||
if (!ShouldUpdateGesture(gesture, time_difference)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void Controller_Stubbed::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
}
|
||||
|
||||
CommonHeader header{};
|
||||
header.timestamp = core_timing.GetGlobalTimeNs().count();
|
||||
header.timestamp = core_timing.GetCPUTicks();
|
||||
header.total_entry_count = 17;
|
||||
header.entry_count = 0;
|
||||
header.last_entry_index = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@ void Controller_Touchscreen::OnInit() {}
|
||||
void Controller_Touchscreen::OnRelease() {}
|
||||
|
||||
void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
shared_memory->touch_screen_lifo.timestamp = core_timing.GetGlobalTimeNs().count();
|
||||
shared_memory->touch_screen_lifo.timestamp = core_timing.GetCPUTicks();
|
||||
|
||||
if (!IsControllerActivated()) {
|
||||
shared_memory->touch_screen_lifo.buffer_count = 0;
|
||||
@@ -85,7 +85,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
|
||||
const auto active_fingers_count =
|
||||
static_cast<std::size_t>(std::distance(active_fingers.begin(), end_iter));
|
||||
|
||||
const u64 timestamp = static_cast<u64>(core_timing.GetGlobalTimeNs().count());
|
||||
const u64 tick = core_timing.GetCPUTicks();
|
||||
const auto& last_entry = shared_memory->touch_screen_lifo.ReadCurrentEntry().state;
|
||||
|
||||
next_state.sampling_number = last_entry.sampling_number + 1;
|
||||
@@ -102,8 +102,8 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
|
||||
touch_entry.diameter_x = Settings::values.touchscreen.diameter_x;
|
||||
touch_entry.diameter_y = Settings::values.touchscreen.diameter_y;
|
||||
touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle;
|
||||
touch_entry.delta_time = timestamp - active_fingers[id].last_touch;
|
||||
fingers[active_fingers[id].id].last_touch = timestamp;
|
||||
touch_entry.delta_time = tick - active_fingers[id].last_touch;
|
||||
fingers[active_fingers[id].id].last_touch = tick;
|
||||
touch_entry.finger = active_fingers[id].id;
|
||||
touch_entry.attribute.raw = active_fingers[id].attribute.raw;
|
||||
} else {
|
||||
|
||||
@@ -690,7 +690,7 @@ void Hid::ResetSixAxisSensorFusionParameters(HLERequestContext& ctx) {
|
||||
|
||||
const auto parameters{rp.PopRaw<Parameters>()};
|
||||
|
||||
// Since these parameters are unknown just use what HW outputs
|
||||
// Since these parameters are unknow just use what HW outputs
|
||||
const Core::HID::SixAxisSensorFusionParameters fusion_parameters{
|
||||
.parameter1 = 0.03f,
|
||||
.parameter2 = 0.4f,
|
||||
|
||||
@@ -51,7 +51,7 @@ void ImageTransferProcessor::OnControllerUpdate(Core::HID::ControllerTriggerType
|
||||
|
||||
const auto camera_data = npad_device->GetCamera();
|
||||
|
||||
// This indicates how much ambient light is present
|
||||
// This indicates how much ambient light is precent
|
||||
processor_state.ambient_noise_level = Core::IrSensor::CameraAmbientNoiseLevel::Low;
|
||||
processor_state.sampling_number = camera_data.sample;
|
||||
|
||||
|
||||
@@ -80,16 +80,13 @@ NTAG215File NfcDataToEncodedData(const EncryptedNTAG215File& nfc_data) {
|
||||
encoded_data.hmac_data = nfc_data.user_memory.hmac_data;
|
||||
encoded_data.constant_value = nfc_data.user_memory.constant_value;
|
||||
encoded_data.write_counter = nfc_data.user_memory.write_counter;
|
||||
encoded_data.amiibo_version = nfc_data.user_memory.amiibo_version;
|
||||
encoded_data.settings = nfc_data.user_memory.settings;
|
||||
encoded_data.owner_mii = nfc_data.user_memory.owner_mii;
|
||||
encoded_data.application_id = nfc_data.user_memory.application_id;
|
||||
encoded_data.application_write_counter = nfc_data.user_memory.application_write_counter;
|
||||
encoded_data.title_id = nfc_data.user_memory.title_id;
|
||||
encoded_data.applicaton_write_counter = nfc_data.user_memory.applicaton_write_counter;
|
||||
encoded_data.application_area_id = nfc_data.user_memory.application_area_id;
|
||||
encoded_data.application_id_byte = nfc_data.user_memory.application_id_byte;
|
||||
encoded_data.unknown = nfc_data.user_memory.unknown;
|
||||
encoded_data.unknown2 = nfc_data.user_memory.unknown2;
|
||||
encoded_data.application_area_crc = nfc_data.user_memory.application_area_crc;
|
||||
encoded_data.application_area = nfc_data.user_memory.application_area;
|
||||
encoded_data.hmac_tag = nfc_data.user_memory.hmac_tag;
|
||||
encoded_data.lock_bytes = nfc_data.uuid.lock_bytes;
|
||||
@@ -114,16 +111,13 @@ EncryptedNTAG215File EncodedDataToNfcData(const NTAG215File& encoded_data) {
|
||||
nfc_data.user_memory.hmac_data = encoded_data.hmac_data;
|
||||
nfc_data.user_memory.constant_value = encoded_data.constant_value;
|
||||
nfc_data.user_memory.write_counter = encoded_data.write_counter;
|
||||
nfc_data.user_memory.amiibo_version = encoded_data.amiibo_version;
|
||||
nfc_data.user_memory.settings = encoded_data.settings;
|
||||
nfc_data.user_memory.owner_mii = encoded_data.owner_mii;
|
||||
nfc_data.user_memory.application_id = encoded_data.application_id;
|
||||
nfc_data.user_memory.application_write_counter = encoded_data.application_write_counter;
|
||||
nfc_data.user_memory.title_id = encoded_data.title_id;
|
||||
nfc_data.user_memory.applicaton_write_counter = encoded_data.applicaton_write_counter;
|
||||
nfc_data.user_memory.application_area_id = encoded_data.application_area_id;
|
||||
nfc_data.user_memory.application_id_byte = encoded_data.application_id_byte;
|
||||
nfc_data.user_memory.unknown = encoded_data.unknown;
|
||||
nfc_data.user_memory.unknown2 = encoded_data.unknown2;
|
||||
nfc_data.user_memory.application_area_crc = encoded_data.application_area_crc;
|
||||
nfc_data.user_memory.application_area = encoded_data.application_area;
|
||||
nfc_data.user_memory.hmac_tag = encoded_data.hmac_tag;
|
||||
nfc_data.user_memory.model_info = encoded_data.model_info;
|
||||
@@ -137,7 +131,7 @@ EncryptedNTAG215File EncodedDataToNfcData(const NTAG215File& encoded_data) {
|
||||
}
|
||||
|
||||
u32 GetTagPassword(const TagUuid& uuid) {
|
||||
// Verify that the generated password is correct
|
||||
// Verifiy that the generated password is correct
|
||||
u32 password = 0xAA ^ (uuid.uid[1] ^ uuid.uid[3]);
|
||||
password &= (0x55 ^ (uuid.uid[2] ^ uuid.uid[4])) << 8;
|
||||
password &= (0xAA ^ (uuid.uid[3] ^ uuid.uid[5])) << 16;
|
||||
|
||||
@@ -94,7 +94,7 @@ bool LoadKeys(InternalKey& locked_secret, InternalKey& unfixed_info);
|
||||
/// Returns true if key_retail.bin exist
|
||||
bool IsKeyAvailable();
|
||||
|
||||
/// Decodes encrypted amiibo data returns true if output is valid
|
||||
/// Decodes encripted amiibo data returns true if output is valid
|
||||
bool DecodeAmiibo(const EncryptedNTAG215File& encrypted_tag_data, NTAG215File& tag_data);
|
||||
|
||||
/// Encodes plain amiibo data returns true if output is valid
|
||||
|
||||
@@ -174,8 +174,8 @@ Result NfpDevice::StopDetection() {
|
||||
|
||||
if (device_state == DeviceState::TagFound || device_state == DeviceState::TagMounted) {
|
||||
CloseAmiibo();
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
if (device_state == DeviceState::SearchingForTag || device_state == DeviceState::TagRemoved) {
|
||||
device_state = DeviceState::Initialized;
|
||||
return ResultSuccess;
|
||||
@@ -204,7 +204,9 @@ Result NfpDevice::Flush() {
|
||||
const auto& current_date = GetAmiiboDate(current_posix_time);
|
||||
if (settings.write_date.raw_date != current_date.raw_date) {
|
||||
settings.write_date = current_date;
|
||||
UpdateSettingsCrc();
|
||||
settings.crc_counter++;
|
||||
// TODO: Find how to calculate the crc check
|
||||
// settings.crc = CalculateCRC(settings);
|
||||
}
|
||||
|
||||
tag_data.write_counter++;
|
||||
@@ -316,7 +318,7 @@ Result NfpDevice::GetCommonInfo(CommonInfo& common_info) const {
|
||||
common_info = {
|
||||
.last_write_date = settings.write_date.GetWriteDate(),
|
||||
.write_counter = tag_data.write_counter,
|
||||
.version = tag_data.amiibo_version,
|
||||
.version = 0,
|
||||
.application_area_size = sizeof(ApplicationArea),
|
||||
};
|
||||
return ResultSuccess;
|
||||
@@ -368,95 +370,13 @@ Result NfpDevice::GetRegisterInfo(RegisterInfo& register_info) const {
|
||||
.mii_char_info = manager.ConvertV3ToCharInfo(tag_data.owner_mii),
|
||||
.creation_date = settings.init_date.GetWriteDate(),
|
||||
.amiibo_name = GetAmiiboName(settings),
|
||||
.font_region = settings.settings.font_region,
|
||||
.font_region = {},
|
||||
};
|
||||
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result NfpDevice::GetAdminInfo(AdminInfo& admin_info) const {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
if (device_state == DeviceState::TagRemoved) {
|
||||
return TagRemoved;
|
||||
}
|
||||
return WrongDeviceState;
|
||||
}
|
||||
|
||||
if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) {
|
||||
LOG_ERROR(Service_NFC, "Amiibo is read only", device_state);
|
||||
return WrongDeviceState;
|
||||
}
|
||||
|
||||
u8 flags = static_cast<u8>(tag_data.settings.settings.raw >> 0x4);
|
||||
if (tag_data.settings.settings.amiibo_initialized == 0) {
|
||||
flags = flags & 0xfe;
|
||||
}
|
||||
|
||||
u64 application_id = 0;
|
||||
u32 application_area_id = 0;
|
||||
AppAreaVersion app_area_version = AppAreaVersion::NotSet;
|
||||
if (tag_data.settings.settings.appdata_initialized != 0) {
|
||||
application_id = tag_data.application_id;
|
||||
app_area_version =
|
||||
static_cast<AppAreaVersion>(application_id >> application_id_version_offset & 0xf);
|
||||
|
||||
// Restore application id to original value
|
||||
if (application_id >> 0x38 != 0) {
|
||||
const u8 application_byte = tag_data.application_id_byte & 0xf;
|
||||
application_id = RemoveVersionByte(application_id) |
|
||||
(static_cast<u64>(application_byte) << application_id_version_offset);
|
||||
}
|
||||
|
||||
application_area_id = tag_data.application_area_id;
|
||||
}
|
||||
|
||||
// TODO: Validate this data
|
||||
admin_info = {
|
||||
.application_id = application_id,
|
||||
.application_area_id = application_area_id,
|
||||
.crc_change_counter = tag_data.settings.crc_counter,
|
||||
.flags = flags,
|
||||
.tag_type = PackedTagType::Type2,
|
||||
.app_area_version = app_area_version,
|
||||
};
|
||||
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result NfpDevice::DeleteRegisterInfo() {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFC, "Wrong device state {}", device_state);
|
||||
if (device_state == DeviceState::TagRemoved) {
|
||||
return TagRemoved;
|
||||
}
|
||||
return WrongDeviceState;
|
||||
}
|
||||
|
||||
if (mount_target == MountTarget::None || mount_target == MountTarget::Rom) {
|
||||
LOG_ERROR(Service_NFC, "Amiibo is read only", device_state);
|
||||
return WrongDeviceState;
|
||||
}
|
||||
|
||||
if (tag_data.settings.settings.amiibo_initialized == 0) {
|
||||
return RegistrationIsNotInitialized;
|
||||
}
|
||||
|
||||
Common::TinyMT rng{};
|
||||
rng.GenerateRandomBytes(&tag_data.owner_mii, sizeof(tag_data.owner_mii));
|
||||
rng.GenerateRandomBytes(&tag_data.settings.amiibo_name, sizeof(tag_data.settings.amiibo_name));
|
||||
rng.GenerateRandomBytes(&tag_data.unknown, sizeof(u8));
|
||||
rng.GenerateRandomBytes(&tag_data.unknown2[0], sizeof(u32));
|
||||
rng.GenerateRandomBytes(&tag_data.unknown2[1], sizeof(u32));
|
||||
rng.GenerateRandomBytes(&tag_data.application_area_crc, sizeof(u32));
|
||||
rng.GenerateRandomBytes(&tag_data.settings.init_date, sizeof(u32));
|
||||
tag_data.settings.settings.font_region.Assign(0);
|
||||
tag_data.settings.settings.amiibo_initialized.Assign(0);
|
||||
|
||||
return Flush();
|
||||
}
|
||||
|
||||
Result NfpDevice::SetRegisterInfoPrivate(const AmiiboName& amiibo_name) {
|
||||
Result NfpDevice::SetNicknameAndOwner(const AmiiboName& amiibo_name) {
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
|
||||
if (device_state == DeviceState::TagRemoved) {
|
||||
@@ -473,23 +393,16 @@ Result NfpDevice::SetRegisterInfoPrivate(const AmiiboName& amiibo_name) {
|
||||
Service::Mii::MiiManager manager;
|
||||
auto& settings = tag_data.settings;
|
||||
|
||||
if (tag_data.settings.settings.amiibo_initialized == 0) {
|
||||
settings.init_date = GetAmiiboDate(current_posix_time);
|
||||
settings.write_date.raw_date = 0;
|
||||
}
|
||||
settings.init_date = GetAmiiboDate(current_posix_time);
|
||||
settings.write_date = GetAmiiboDate(current_posix_time);
|
||||
settings.crc_counter++;
|
||||
// TODO: Find how to calculate the crc check
|
||||
// settings.crc = CalculateCRC(settings);
|
||||
|
||||
SetAmiiboName(settings, amiibo_name);
|
||||
tag_data.owner_mii = manager.ConvertCharInfoToV3(manager.BuildDefault(0));
|
||||
tag_data.unknown = 0;
|
||||
tag_data.unknown2[6] = 0;
|
||||
settings.country_code_id = 0;
|
||||
settings.settings.font_region.Assign(0);
|
||||
settings.settings.amiibo_initialized.Assign(1);
|
||||
|
||||
// TODO: this is a mix of tag.file input
|
||||
std::array<u8, 0x7e> unknown_input{};
|
||||
tag_data.application_area_crc = CalculateCrc(unknown_input);
|
||||
|
||||
return Flush();
|
||||
}
|
||||
|
||||
@@ -512,18 +425,24 @@ Result NfpDevice::RestoreAmiibo() {
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
Result NfpDevice::Format() {
|
||||
auto result1 = DeleteApplicationArea();
|
||||
auto result2 = DeleteRegisterInfo();
|
||||
|
||||
if (result1.IsError()) {
|
||||
return result1;
|
||||
Result NfpDevice::DeleteAllData() {
|
||||
const auto result = DeleteApplicationArea();
|
||||
if (result.IsError()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result2.IsError()) {
|
||||
return result2;
|
||||
if (device_state != DeviceState::TagMounted) {
|
||||
LOG_ERROR(Service_NFP, "Wrong device state {}", device_state);
|
||||
if (device_state == DeviceState::TagRemoved) {
|
||||
return TagRemoved;
|
||||
}
|
||||
return WrongDeviceState;
|
||||
}
|
||||
|
||||
Common::TinyMT rng{};
|
||||
rng.GenerateRandomBytes(&tag_data.owner_mii, sizeof(tag_data.owner_mii));
|
||||
tag_data.settings.settings.amiibo_initialized.Assign(0);
|
||||
|
||||
return Flush();
|
||||
}
|
||||
|
||||
@@ -650,10 +569,7 @@ Result NfpDevice::SetApplicationArea(std::span<const u8> data) {
|
||||
rng.GenerateRandomBytes(tag_data.application_area.data() + data.size(),
|
||||
sizeof(ApplicationArea) - data.size());
|
||||
|
||||
if (tag_data.application_write_counter != counter_limit) {
|
||||
tag_data.application_write_counter++;
|
||||
}
|
||||
|
||||
tag_data.applicaton_write_counter++;
|
||||
is_data_moddified = true;
|
||||
|
||||
return ResultSuccess;
|
||||
@@ -701,25 +617,14 @@ Result NfpDevice::RecreateApplicationArea(u32 access_id, std::span<const u8> dat
|
||||
rng.GenerateRandomBytes(tag_data.application_area.data() + data.size(),
|
||||
sizeof(ApplicationArea) - data.size());
|
||||
|
||||
if (tag_data.application_write_counter != counter_limit) {
|
||||
tag_data.application_write_counter++;
|
||||
}
|
||||
|
||||
const u64 application_id = system.GetApplicationProcessProgramID();
|
||||
|
||||
tag_data.application_id_byte =
|
||||
static_cast<u8>(application_id >> application_id_version_offset & 0xf);
|
||||
tag_data.application_id =
|
||||
RemoveVersionByte(application_id) |
|
||||
(static_cast<u64>(AppAreaVersion::NintendoSwitch) << application_id_version_offset);
|
||||
// TODO: Investigate why the title id needs to be moddified
|
||||
tag_data.title_id = system.GetApplicationProcessProgramID();
|
||||
tag_data.title_id = tag_data.title_id | 0x30000000ULL;
|
||||
tag_data.settings.settings.appdata_initialized.Assign(1);
|
||||
tag_data.application_area_id = access_id;
|
||||
tag_data.applicaton_write_counter++;
|
||||
tag_data.unknown = {};
|
||||
|
||||
// TODO: this is a mix of tag_data input
|
||||
std::array<u8, 0x7e> unknown_input{};
|
||||
tag_data.application_area_crc = CalculateCrc(unknown_input);
|
||||
|
||||
return Flush();
|
||||
}
|
||||
|
||||
@@ -737,20 +642,12 @@ Result NfpDevice::DeleteApplicationArea() {
|
||||
return WrongDeviceState;
|
||||
}
|
||||
|
||||
if (tag_data.settings.settings.appdata_initialized == 0) {
|
||||
return ApplicationAreaIsNotInitialized;
|
||||
}
|
||||
|
||||
if (tag_data.application_write_counter != counter_limit) {
|
||||
tag_data.application_write_counter++;
|
||||
}
|
||||
|
||||
Common::TinyMT rng{};
|
||||
rng.GenerateRandomBytes(tag_data.application_area.data(), sizeof(ApplicationArea));
|
||||
rng.GenerateRandomBytes(&tag_data.application_id, sizeof(u64));
|
||||
rng.GenerateRandomBytes(&tag_data.title_id, sizeof(u64));
|
||||
rng.GenerateRandomBytes(&tag_data.application_area_id, sizeof(u32));
|
||||
rng.GenerateRandomBytes(&tag_data.application_id_byte, sizeof(u8));
|
||||
tag_data.settings.settings.appdata_initialized.Assign(0);
|
||||
tag_data.applicaton_write_counter++;
|
||||
tag_data.unknown = {};
|
||||
|
||||
return Flush();
|
||||
@@ -822,45 +719,4 @@ AmiiboDate NfpDevice::GetAmiiboDate(s64 posix_time) const {
|
||||
return amiibo_date;
|
||||
}
|
||||
|
||||
u64 NfpDevice::RemoveVersionByte(u64 application_id) const {
|
||||
return application_id & ~(0xfULL << application_id_version_offset);
|
||||
}
|
||||
|
||||
void NfpDevice::UpdateSettingsCrc() {
|
||||
auto& settings = tag_data.settings;
|
||||
|
||||
if (settings.crc_counter != counter_limit) {
|
||||
settings.crc_counter++;
|
||||
}
|
||||
|
||||
// TODO: this reads data from a global, find what it is
|
||||
std::array<u8, 8> unknown_input{};
|
||||
settings.crc = CalculateCrc(unknown_input);
|
||||
}
|
||||
|
||||
u32 NfpDevice::CalculateCrc(std::span<const u8> data) {
|
||||
constexpr u32 magic = 0xedb88320;
|
||||
u32 crc = 0xffffffff;
|
||||
|
||||
if (data.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (u8 input : data) {
|
||||
u32 temp = (crc ^ input) >> 1;
|
||||
if (((crc ^ input) & 1) != 0) {
|
||||
temp = temp ^ magic;
|
||||
}
|
||||
|
||||
for (std::size_t step = 0; step < 7; ++step) {
|
||||
crc = temp >> 1;
|
||||
if ((temp & 1) != 0) {
|
||||
crc = temp >> 1 ^ magic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
} // namespace Service::NFP
|
||||
|
||||
@@ -47,12 +47,10 @@ public:
|
||||
Result GetCommonInfo(CommonInfo& common_info) const;
|
||||
Result GetModelInfo(ModelInfo& model_info) const;
|
||||
Result GetRegisterInfo(RegisterInfo& register_info) const;
|
||||
Result GetAdminInfo(AdminInfo& admin_info) const;
|
||||
|
||||
Result DeleteRegisterInfo();
|
||||
Result SetRegisterInfoPrivate(const AmiiboName& amiibo_name);
|
||||
Result SetNicknameAndOwner(const AmiiboName& amiibo_name);
|
||||
Result RestoreAmiibo();
|
||||
Result Format();
|
||||
Result DeleteAllData();
|
||||
|
||||
Result OpenApplicationArea(u32 access_id);
|
||||
Result GetApplicationAreaId(u32& application_area_id) const;
|
||||
@@ -78,9 +76,6 @@ private:
|
||||
AmiiboName GetAmiiboName(const AmiiboSettings& settings) const;
|
||||
void SetAmiiboName(AmiiboSettings& settings, const AmiiboName& amiibo_name);
|
||||
AmiiboDate GetAmiiboDate(s64 posix_time) const;
|
||||
u64 RemoveVersionByte(u64 application_id) const;
|
||||
void UpdateSettingsCrc();
|
||||
u32 CalculateCrc(std::span<const u8>);
|
||||
|
||||
bool is_controller_set{};
|
||||
int callback_key;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
namespace Service::NFP {
|
||||
static constexpr std::size_t amiibo_name_length = 0xA;
|
||||
static constexpr std::size_t application_id_version_offset = 0x1c;
|
||||
static constexpr std::size_t counter_limit = 0xffff;
|
||||
|
||||
enum class ServiceType : u32 {
|
||||
User,
|
||||
@@ -101,14 +99,6 @@ enum class TagProtocol : u32 {
|
||||
All = 0xFFFFFFFFU,
|
||||
};
|
||||
|
||||
enum class AppAreaVersion : u8 {
|
||||
Nintendo3DS = 0,
|
||||
NintendoWiiU = 1,
|
||||
Nintendo3DSv2 = 2,
|
||||
NintendoSwitch = 3,
|
||||
NotSet = 0xFF,
|
||||
};
|
||||
|
||||
enum class CabinetMode : u8 {
|
||||
StartNicknameAndOwnerSettings,
|
||||
StartGameDataEraser,
|
||||
@@ -207,7 +197,6 @@ struct Settings {
|
||||
union {
|
||||
u8 raw{};
|
||||
|
||||
BitField<0, 4, u8> font_region;
|
||||
BitField<4, 1, u8> amiibo_initialized;
|
||||
BitField<5, 1, u8> appdata_initialized;
|
||||
};
|
||||
@@ -247,20 +236,18 @@ static_assert(sizeof(NTAG215Password) == 0x8, "NTAG215Password is an invalid siz
|
||||
struct EncryptedAmiiboFile {
|
||||
u8 constant_value; // Must be A5
|
||||
u16_be write_counter; // Number of times the amiibo has been written?
|
||||
u8 amiibo_version; // Amiibo file version
|
||||
INSERT_PADDING_BYTES(0x1); // Unknown 1
|
||||
AmiiboSettings settings; // Encrypted amiibo settings
|
||||
HashData hmac_tag; // Hash
|
||||
AmiiboModelInfo model_info; // Encrypted amiibo model info
|
||||
HashData keygen_salt; // Salt
|
||||
HashData hmac_data; // Hash
|
||||
Service::Mii::Ver3StoreData owner_mii; // Encrypted Mii data
|
||||
u64_be application_id; // Encrypted Game id
|
||||
u16_be application_write_counter; // Encrypted Counter
|
||||
u64_be title_id; // Encrypted Game id
|
||||
u16_be applicaton_write_counter; // Encrypted Counter
|
||||
u32_be application_area_id; // Encrypted Game id
|
||||
u8 application_id_byte;
|
||||
u8 unknown;
|
||||
std::array<u32, 0x7> unknown2;
|
||||
u32_be application_area_crc;
|
||||
std::array<u8, 0x2> unknown;
|
||||
std::array<u32, 0x8> unknown2;
|
||||
ApplicationArea application_area; // Encrypted Game data
|
||||
};
|
||||
static_assert(sizeof(EncryptedAmiiboFile) == 0x1F8, "AmiiboFile is an invalid size");
|
||||
@@ -272,16 +259,14 @@ struct NTAG215File {
|
||||
HashData hmac_data; // Hash
|
||||
u8 constant_value; // Must be A5
|
||||
u16_be write_counter; // Number of times the amiibo has been written?
|
||||
u8 amiibo_version; // Amiibo file version
|
||||
INSERT_PADDING_BYTES(0x1); // Unknown 1
|
||||
AmiiboSettings settings;
|
||||
Service::Mii::Ver3StoreData owner_mii; // Mii data
|
||||
u64_be application_id; // Game id
|
||||
u16_be application_write_counter; // Counter
|
||||
Service::Mii::Ver3StoreData owner_mii; // Encrypted Mii data
|
||||
u64_be title_id;
|
||||
u16_be applicaton_write_counter; // Encrypted Counter
|
||||
u32_be application_area_id;
|
||||
u8 application_id_byte;
|
||||
u8 unknown;
|
||||
std::array<u32, 0x7> unknown2;
|
||||
u32_be application_area_crc;
|
||||
std::array<u8, 0x2> unknown;
|
||||
std::array<u32, 0x8> unknown2;
|
||||
ApplicationArea application_area; // Encrypted Game data
|
||||
HashData hmac_tag; // Hash
|
||||
UniqueSerialNumber uid; // Unique serial number
|
||||
@@ -351,18 +336,6 @@ struct RegisterInfo {
|
||||
};
|
||||
static_assert(sizeof(RegisterInfo) == 0x100, "RegisterInfo is an invalid size");
|
||||
|
||||
struct AdminInfo {
|
||||
u64 application_id;
|
||||
u32 application_area_id;
|
||||
u16 crc_change_counter;
|
||||
u8 flags;
|
||||
PackedTagType tag_type;
|
||||
AppAreaVersion app_area_version;
|
||||
INSERT_PADDING_BYTES(0x7);
|
||||
INSERT_PADDING_BYTES(0x28);
|
||||
};
|
||||
static_assert(sizeof(AdminInfo) == 0x40, "AdminInfo is an invalid size");
|
||||
|
||||
struct SectorKey {
|
||||
MifareCmd command;
|
||||
u8 unknown; // Usually 1
|
||||
|
||||
@@ -119,7 +119,7 @@ struct IPlatformServiceManager::Impl {
|
||||
break;
|
||||
}
|
||||
|
||||
// Derive key within inverse xor
|
||||
// Derive key withing inverse xor
|
||||
const u32 KEY = GetU32Swapped(input.data() + cur_offset) ^ EXPECTED_MAGIC;
|
||||
const u32 SIZE = GetU32Swapped(input.data() + cur_offset + 4) ^ KEY;
|
||||
shared_font_regions.push_back(FontRegion{cur_offset + 8, SIZE});
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
std::vector<u8>& output, std::vector<u8>& inline_output) = 0;
|
||||
|
||||
/**
|
||||
* Called once a device is opened
|
||||
* Called once a device is openned
|
||||
* @param fd The device fd
|
||||
*/
|
||||
virtual void OnOpen(DeviceFD fd) = 0;
|
||||
|
||||
@@ -264,7 +264,7 @@ NvResult nvmap::IocFree(std::span<const u8> input, std::vector<u8>& output) {
|
||||
params.flags.raw = 0;
|
||||
params.flags.map_uncached.Assign(freeInfo->was_uncached);
|
||||
} else {
|
||||
// This is possible when there's internal dups or other duplicates.
|
||||
// This is possible when there's internel dups or other duplicates.
|
||||
}
|
||||
|
||||
std::memcpy(output.data(), ¶ms, sizeof(params));
|
||||
|
||||
@@ -572,7 +572,7 @@ std::pair<s32, Errno> Socket::SendTo(u32 flags, std::span<const u8> message,
|
||||
ASSERT(flags == 0);
|
||||
|
||||
const sockaddr* to = nullptr;
|
||||
const int to_len = addr ? sizeof(sockaddr) : 0;
|
||||
const int tolen = addr ? sizeof(sockaddr) : 0;
|
||||
sockaddr host_addr_in;
|
||||
|
||||
if (addr) {
|
||||
@@ -581,7 +581,7 @@ std::pair<s32, Errno> Socket::SendTo(u32 flags, std::span<const u8> message,
|
||||
}
|
||||
|
||||
const auto result = sendto(fd, reinterpret_cast<const char*>(message.data()),
|
||||
static_cast<int>(message.size()), 0, to, to_len);
|
||||
static_cast<int>(message.size()), 0, to, tolen);
|
||||
if (result != SOCKET_ERROR) {
|
||||
return {static_cast<s32>(result), Errno::SUCCESS};
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ double PerfStats::GetLastFrameTimeScale() const {
|
||||
}
|
||||
|
||||
void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) {
|
||||
if (Settings::values.use_multi_core.GetValue() ||
|
||||
!Settings::values.use_speed_limit.GetValue()) {
|
||||
if (!Settings::values.use_speed_limit.GetValue() ||
|
||||
Settings::values.use_multi_core.GetValue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ bool GCAdapter::IsVibrationEnabled([[maybe_unused]] const PadIdentifier& identif
|
||||
|
||||
void GCAdapter::UpdateVibrations() {
|
||||
// Use 8 states to keep the switching between on/off fast enough for
|
||||
// a human to feel different vibration strength
|
||||
// a human to feel different vibration strenght
|
||||
// More states == more rumble strengths == slower update time
|
||||
constexpr u8 vibration_states = 8;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
/// Registers controllers, clears all data and starts the scan thread
|
||||
void Setup();
|
||||
|
||||
/// Actively searches for new devices
|
||||
/// Actively searchs for new devices
|
||||
void ScanThread(std::stop_token stop_token);
|
||||
|
||||
/// Returns true if device is valid and not registered
|
||||
|
||||
@@ -24,7 +24,7 @@ constexpr PadIdentifier keyboard_modifier_identifier = {
|
||||
};
|
||||
|
||||
Keyboard::Keyboard(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
|
||||
// Keyboard is broken into 3 different sets:
|
||||
// Keyboard is broken into 3 diferent sets:
|
||||
// key: Unfiltered intended for controllers.
|
||||
// keyboard_key: Allows only Settings::NativeKeyboard::Keys intended for keyboard emulation.
|
||||
// keyboard_modifier: Allows only Settings::NativeKeyboard::Modifiers intended for keyboard
|
||||
|
||||
@@ -142,7 +142,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make slow movements at least 3 units on length
|
||||
// Make slow movements at least 3 units on lenght
|
||||
if (move_distance < 3.0f) {
|
||||
// Normalize value
|
||||
mouse_change /= move_distance;
|
||||
@@ -154,7 +154,7 @@ void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||
|
||||
const auto last_move_distance = last_mouse_change.Length();
|
||||
|
||||
// Make fast movements clamp to 8 units on length
|
||||
// Make fast movements clamp to 8 units on lenght
|
||||
if (last_move_distance > 8.0f) {
|
||||
// Normalize value
|
||||
last_mouse_change /= last_move_distance;
|
||||
|
||||
@@ -748,7 +748,7 @@ ButtonMapping SDLDriver::GetButtonMappingForDevice(const Common::ParamPackage& p
|
||||
|
||||
// This list is missing ZL/ZR since those are not considered buttons in SDL GameController.
|
||||
// We will add those afterwards
|
||||
// This list also excludes Screenshot since there's not really a mapping for that
|
||||
// This list also excludes Screenshot since theres not really a mapping for that
|
||||
ButtonBindings switch_to_sdl_button;
|
||||
|
||||
if (SDL_GameControllerGetType(controller) == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO) {
|
||||
@@ -1007,7 +1007,7 @@ MotionMapping SDLDriver::GetMotionMappingForDevice(const Common::ParamPackage& p
|
||||
|
||||
Common::Input::ButtonNames SDLDriver::GetUIName(const Common::ParamPackage& params) const {
|
||||
if (params.Has("button")) {
|
||||
// TODO(German77): Find how to substitute the values for real button names
|
||||
// TODO(German77): Find how to substitue the values for real button names
|
||||
return Common::Input::ButtonNames::Value;
|
||||
}
|
||||
if (params.Has("hat")) {
|
||||
|
||||
@@ -57,7 +57,7 @@ Common::Input::NfcState VirtualAmiibo::WriteNfcData(
|
||||
}
|
||||
|
||||
if (!nfc_file.Write(data)) {
|
||||
LOG_ERROR(Service_NFP, "Error writing to file");
|
||||
LOG_ERROR(Service_NFP, "Error writting to file");
|
||||
return Common::Input::NfcState::WriteFailed;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ void JoyconDriver::InputThread(std::stop_token stop_token) {
|
||||
void JoyconDriver::OnNewData(std::span<u8> buffer) {
|
||||
const auto report_mode = static_cast<ReportMode>(buffer[0]);
|
||||
|
||||
// Packages can be a little bit inconsistent. Average the delta time to provide a smoother
|
||||
// motion experience
|
||||
// Packages can be a litte bit inconsistent. Average the delta time to provide a smoother motion
|
||||
// experience
|
||||
switch (report_mode) {
|
||||
case ReportMode::STANDARD_FULL_60HZ:
|
||||
case ReportMode::NFC_IR_MODE_60HZ:
|
||||
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
/// Main thread, actively request new data from the handle
|
||||
void InputThread(std::stop_token stop_token);
|
||||
|
||||
/// Called every time a valid package arrives
|
||||
/// Called everytime a valid package arrives
|
||||
void OnNewData(std::span<u8> buffer);
|
||||
|
||||
/// Updates device configuration to enable or disable features
|
||||
@@ -110,7 +110,7 @@ private:
|
||||
bool amiibo_detected{};
|
||||
bool is_ring_disabled_by_irs{};
|
||||
|
||||
// Hardware configuration
|
||||
// Harware configuration
|
||||
u8 leds{};
|
||||
ReportMode mode{};
|
||||
bool passive_enabled{}; // Low power mode, Ideal for multiple controllers at the same time
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for incoming data of the joycon device that matches the subcommand
|
||||
* Waits for incoming data of the joycon device that matchs the subcommand
|
||||
* @param sub_command type of data to be returned
|
||||
* @returns a buffer containing the response
|
||||
*/
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
DriverResult EnableMCU(bool enable);
|
||||
|
||||
/**
|
||||
* Configures the MCU to the corresponding mode
|
||||
* Configures the MCU to the correspoinding mode
|
||||
* @param MCUConfig configuration
|
||||
*/
|
||||
DriverResult ConfigureMCU(const MCUConfig& config);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Response {
|
||||
/**
|
||||
* Returns Type if the packet is valid, else none
|
||||
*
|
||||
* Note: Modifies the buffer to zero out the crc (since that's the easiest way to check without
|
||||
* Note: Modifies the buffer to zero out the crc (since thats the easiest way to check without
|
||||
* copying the buffer)
|
||||
*/
|
||||
std::optional<Type> Validate(u8* data, std::size_t size) {
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
/// Retrieves the motion mappings for the given device.
|
||||
[[nodiscard]] MotionMapping GetMotionMappingForDevice(const Common::ParamPackage& device) const;
|
||||
|
||||
/// Returns an enum containing the name to be displayed from the input engine.
|
||||
/// Returns an enum contaning the name to be displayed from the input engine.
|
||||
[[nodiscard]] Common::Input::ButtonNames GetButtonName(
|
||||
const Common::ParamPackage& params) const;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Network {
|
||||
|
||||
/// A class that serializes data for network transfer. It also handles endianness
|
||||
/// A class that serializes data for network transfer. It also handles endianess
|
||||
class Packet {
|
||||
public:
|
||||
Packet() = default;
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
std::atomic<State> state{State::Closed}; ///< Current state of the room.
|
||||
RoomInformation room_information; ///< Information about this room.
|
||||
|
||||
std::string verify_uid; ///< A GUID which may be used for verification.
|
||||
std::string verify_uid; ///< A GUID which may be used for verfication.
|
||||
mutable std::mutex verify_uid_mutex; ///< Mutex for verify_uid
|
||||
|
||||
std::string password; ///< The password required to connect to this room.
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
Idle, ///< Default state (i.e. not connected)
|
||||
Joining, ///< The client is attempting to join a room.
|
||||
Joined, ///< The client is connected to the room and is ready to send/receive packets.
|
||||
Moderator, ///< The client is connected to the room and is granted mod permissions.
|
||||
Moderator, ///< The client is connnected to the room and is granted mod permissions.
|
||||
};
|
||||
|
||||
enum class Error : u8 {
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
|
||||
/**
|
||||
* Binds a function to an event that will be triggered every time the State of the member
|
||||
* changed. The function will be called every time the event is triggered. The callback function
|
||||
* changed. The function wil be called every time the event is triggered. The callback function
|
||||
* must not bind or unbind a function. Doing so will cause a deadlock
|
||||
* @param callback The function to call
|
||||
* @return A handle used for removing the function from the registered list
|
||||
@@ -210,8 +210,8 @@ public:
|
||||
|
||||
/**
|
||||
* Binds a function to an event that will be triggered every time an error happened. The
|
||||
* function will be called every time the event is triggered. The callback function must not
|
||||
* bind or unbind a function. Doing so will cause a deadlock
|
||||
* function wil be called every time the event is triggered. The callback function must not bind
|
||||
* or unbind a function. Doing so will cause a deadlock
|
||||
* @param callback The function to call
|
||||
* @return A handle used for removing the function from the registered list
|
||||
*/
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
|
||||
/**
|
||||
* Binds a function to an event that will be triggered every time a ProxyPacket is received.
|
||||
* The function will be called every time the event is triggered.
|
||||
* The function wil be called everytime the event is triggered.
|
||||
* The callback function must not bind or unbind a function. Doing so will cause a deadlock
|
||||
* @param callback The function to call
|
||||
* @return A handle used for removing the function from the registered list
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
|
||||
/**
|
||||
* Binds a function to an event that will be triggered every time an LDNPacket is received.
|
||||
* The function will be called every time the event is triggered.
|
||||
* The function wil be called everytime the event is triggered.
|
||||
* The callback function must not bind or unbind a function. Doing so will cause a deadlock
|
||||
* @param callback The function to call
|
||||
* @return A handle used for removing the function from the registered list
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
|
||||
/**
|
||||
* Binds a function to an event that will be triggered every time the RoomInformation changes.
|
||||
* The function will be called every time the event is triggered.
|
||||
* The function wil be called every time the event is triggered.
|
||||
* The callback function must not bind or unbind a function. Doing so will cause a deadlock
|
||||
* @param callback The function to call
|
||||
* @return A handle used for removing the function from the registered list
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
|
||||
/**
|
||||
* Binds a function to an event that will be triggered every time a ChatMessage is received.
|
||||
* The function will be called every time the event is triggered.
|
||||
* The function wil be called every time the event is triggered.
|
||||
* The callback function must not bind or unbind a function. Doing so will cause a deadlock
|
||||
* @param callback The function to call
|
||||
* @return A handle used for removing the function from the registered list
|
||||
|
||||
@@ -398,162 +398,162 @@ void EmitStorageAtomicMaxF32x2(EmitContext& ctx, IR::Inst& inst, const IR::Value
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicIAdd32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicSMin32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicUMin32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicSMax32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicUMax32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicInc32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicDec32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicAnd32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicOr32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicXor32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicExchange32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicIAdd64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicSMin64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicUMin64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicSMax64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicUMax64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicInc64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicDec64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicAnd64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicOr64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicXor64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicExchange64(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicIAdd32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicSMin32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicUMin32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicSMax32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicUMax32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicInc32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicDec32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicAnd32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicOr32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicXor32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicExchange32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicAddF32(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicAddF16x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicAddF32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicMinF16x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicMinF32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicMaxF16x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
|
||||
void EmitGlobalAtomicMaxF32x2(EmitContext&) {
|
||||
throw NotImplementedException("GLSL Instruction");
|
||||
throw NotImplementedException("GLSL Instrucion");
|
||||
}
|
||||
} // namespace Shader::Backend::GLSL
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void Add(const char* format_str, IR::Inst& inst, Args&&... args) {
|
||||
const auto var_def{var_alloc.AddDefine(inst, type)};
|
||||
if (var_def.empty()) {
|
||||
// skip assignment.
|
||||
// skip assigment.
|
||||
code += fmt::format(fmt::runtime(format_str + 3), std::forward<Args>(args)...);
|
||||
} else {
|
||||
code += fmt::format(fmt::runtime(format_str), var_def, std::forward<Args>(args)...);
|
||||
|
||||
@@ -52,7 +52,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") {
|
||||
|
||||
REQUIRE(buf.Size() == 1U);
|
||||
|
||||
// Pushing more values than space available should partially succeed.
|
||||
// Pushing more values than space available should partially suceed.
|
||||
{
|
||||
std::vector<char> to_push(6);
|
||||
std::iota(to_push.begin(), to_push.end(), 88);
|
||||
|
||||
@@ -191,7 +191,7 @@ TEST_CASE("ScratchBuffer: Span Writes", "[common]") {
|
||||
|
||||
for (size_t i = 0; i < buf_span.size(); ++i) {
|
||||
const auto new_value = static_cast<u8>(i + 1U);
|
||||
// Writes to a span of the scratch buffer will propagate to the buffer itself
|
||||
// Writes to a span of the scratch buffer will propogate to the buffer itself
|
||||
buf_span[i] = new_value;
|
||||
REQUIRE(buf[i] == new_value);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
template <class P>
|
||||
class ChannelSetupCaches {
|
||||
public:
|
||||
/// Operations for setting the channel of execution.
|
||||
/// Operations for seting the channel of execution.
|
||||
virtual ~ChannelSetupCaches();
|
||||
|
||||
/// Create channel state.
|
||||
|
||||
@@ -193,7 +193,7 @@ bool SoftwareBlitEngine::Blit(Fermi2D::Surface& src, Fermi2D::Surface& dst,
|
||||
output_converter->ConvertFrom(impl->intermediate_dst, impl->dst_buffer);
|
||||
};
|
||||
|
||||
// Do actual Blit
|
||||
// Do actuall Blit
|
||||
|
||||
impl->dst_buffer.resize(dst_copy_size);
|
||||
if (src.linear == Fermi2D::MemoryLayout::BlockLinear) {
|
||||
|
||||
@@ -25,7 +25,7 @@ static void RunThread(std::stop_token stop_token, Core::System& system,
|
||||
SCOPE_EXIT({ MicroProfileOnThreadExit(); });
|
||||
|
||||
Common::SetCurrentThreadName(name.c_str());
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::High);
|
||||
system.RegisterHostThread();
|
||||
|
||||
auto current_context = context.Acquire();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user