mirror of
https://github.com/citra-mirror/citra.git
synced 2024-08-20 02:13:23 +02:00
Port various minor changes from yuzu PRs (#4725)
* common/thread: Remove unused functions Many of these functions are carried over from Dolphin (where they aren't used anymore). Given these have no use (and we really shouldn't be screwing around with OS-specific thread scheduler handling from the emulator, these can be removed. The function for setting the thread name is left, however, since it can have debugging utility usages. * input_common/sdl: Use a type alias to shorten declaration of GetPollers Just makes the definitions a little bit more tidy. * input_common/sdl: Correct return values within implementations of GetPollers() In both cases, we weren't actually returning anything, which is undefined behavior. * yuzu/debugger/graphics_surface: Fill in missing surface format listings Fills in the missing surface types that were marked as unknown. The order corresponds with the TextureFormat enum within video_core/texture.h. We also don't need to all of these strings as translatable (only the first string, as it's an English word). * yuzu/debugger/graphics_surface: Clean up connection overload deduction We can utilize qOverload with the signal connections to make the function deducing a little less ugly. * yuzu/debugger/graphics_surface: Tidy up SaveSurface - Use QStringLiteral where applicable. - Use const where applicable - Remove unnecessary precondition check (we already assert the pixbuf being non null) * yuzu/debugger/graphics_surface: Display error messages for file I/O errors * core: Add missing override specifiers where applicable Applies the override specifier where applicable. In the case of destructors that are defaulted in their definition, they can simply be removed. This also removes the unnecessary inclusions being done in audin_u and audrec_u, given their close proximity. * kernel/thread: Make parameter of GetWaitObjectIndex() const qualified The pointed to member is never actually modified, so it can be made const. * kernel/thread: Avoid sign conversion within GetCommandBufferAddress() Previously this was performing a u64 + int sign conversion. When dealing with addresses, we should generally be keeping the arithmetic in the same signedness type. This also gets rid of the static lifetime of the constant, as there's no need to make a trivial type like this potentially live for the entire duration of the program. * kernel/codeset: Make CodeSet's memory data member a regular std::vector The use of a shared_ptr is an implementation detail of the VMManager itself when mapping memory. Because of that, we shouldn't require all users of the CodeSet to have to allocate the shared_ptr ahead of time. It's intended that CodeSet simply pass in the required direct data, and that the memory manager takes care of it from that point on. This means we just do the shared pointer allocation in a single place, when loading modules, as opposed to in each loader. * kernel/wait_object: Make ShouldWait() take thread members by pointer-to-const Given this is intended as a querying function, it doesn't make sense to allow the implementer to modify the state of the given thread.
This commit is contained in:
parent
e0a0bca13a
commit
623b0621ab
@ -7,6 +7,7 @@
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
@ -81,28 +82,31 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext>
|
||||
surface_picker_y_control = new QSpinBox;
|
||||
surface_picker_y_control->setRange(0, max_dimension - 1);
|
||||
|
||||
surface_format_control = new QComboBox;
|
||||
|
||||
// Color formats sorted by Pica texture format index
|
||||
surface_format_control->addItem("RGBA8");
|
||||
surface_format_control->addItem("RGB8");
|
||||
surface_format_control->addItem("RGB5A1");
|
||||
surface_format_control->addItem("RGB565");
|
||||
surface_format_control->addItem("RGBA4");
|
||||
surface_format_control->addItem("IA8");
|
||||
surface_format_control->addItem("RG8");
|
||||
surface_format_control->addItem("I8");
|
||||
surface_format_control->addItem("A8");
|
||||
surface_format_control->addItem("IA4");
|
||||
surface_format_control->addItem("I4");
|
||||
surface_format_control->addItem("A4");
|
||||
surface_format_control->addItem("ETC1");
|
||||
surface_format_control->addItem("ETC1A4");
|
||||
surface_format_control->addItem("D16");
|
||||
surface_format_control->addItem("D24");
|
||||
surface_format_control->addItem("D24X8");
|
||||
surface_format_control->addItem("X24S8");
|
||||
surface_format_control->addItem(tr("Unknown"));
|
||||
const QStringList surface_formats{
|
||||
QStringLiteral("RGBA8"),
|
||||
QStringLiteral("RGB8"),
|
||||
QStringLiteral("RGB5A1"),
|
||||
QStringLiteral("RGB565"),
|
||||
QStringLiteral("RGBA4"),
|
||||
QStringLiteral("IA8"),
|
||||
QStringLiteral("RG8"),
|
||||
QStringLiteral("I8"),
|
||||
QStringLiteral("A8"),
|
||||
QStringLiteral("IA4"),
|
||||
QStringLiteral("I4"),
|
||||
QStringLiteral("A4"),
|
||||
QStringLiteral("ETC1"),
|
||||
QStringLiteral("ETC1A4"),
|
||||
QStringLiteral("D16"),
|
||||
QStringLiteral("D24"),
|
||||
QStringLiteral("D24X8"),
|
||||
QStringLiteral("X24S8"),
|
||||
tr("Unknown"),
|
||||
};
|
||||
|
||||
surface_format_control = new QComboBox;
|
||||
surface_format_control->addItems(surface_formats);
|
||||
|
||||
surface_info_label = new QLabel();
|
||||
surface_info_label->setWordWrap(true);
|
||||
@ -121,22 +125,20 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext>
|
||||
|
||||
// Connections
|
||||
connect(this, &GraphicsSurfaceWidget::Update, this, &GraphicsSurfaceWidget::OnUpdate);
|
||||
connect(surface_source_list,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(surface_source_list, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&GraphicsSurfaceWidget::OnSurfaceSourceChanged);
|
||||
connect(surface_address_control, &CSpinBox::ValueChanged, this,
|
||||
&GraphicsSurfaceWidget::OnSurfaceAddressChanged);
|
||||
connect(surface_width_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, &GraphicsSurfaceWidget::OnSurfaceWidthChanged);
|
||||
connect(surface_height_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, &GraphicsSurfaceWidget::OnSurfaceHeightChanged);
|
||||
connect(surface_format_control,
|
||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
connect(surface_width_control, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&GraphicsSurfaceWidget::OnSurfaceWidthChanged);
|
||||
connect(surface_height_control, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&GraphicsSurfaceWidget::OnSurfaceHeightChanged);
|
||||
connect(surface_format_control, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&GraphicsSurfaceWidget::OnSurfaceFormatChanged);
|
||||
connect(surface_picker_x_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, &GraphicsSurfaceWidget::OnSurfacePickerXChanged);
|
||||
connect(surface_picker_y_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, &GraphicsSurfaceWidget::OnSurfacePickerYChanged);
|
||||
connect(surface_picker_x_control, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&GraphicsSurfaceWidget::OnSurfacePickerXChanged);
|
||||
connect(surface_picker_y_control, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&GraphicsSurfaceWidget::OnSurfacePickerYChanged);
|
||||
connect(save_surface, &QPushButton::clicked, this, &GraphicsSurfaceWidget::SaveSurface);
|
||||
|
||||
auto main_widget = new QWidget;
|
||||
@ -657,37 +659,53 @@ void GraphicsSurfaceWidget::OnUpdate() {
|
||||
}
|
||||
|
||||
void GraphicsSurfaceWidget::SaveSurface() {
|
||||
QString png_filter = tr("Portable Network Graphic (*.png)");
|
||||
QString bin_filter = tr("Binary data (*.bin)");
|
||||
const QString png_filter = tr("Portable Network Graphic (*.png)");
|
||||
const QString bin_filter = tr("Binary data (*.bin)");
|
||||
|
||||
QString selectedFilter;
|
||||
QString filename = QFileDialog::getSaveFileName(
|
||||
QString selected_filter;
|
||||
const QString filename = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Surface"),
|
||||
QString("texture-0x%1.png").arg(QString::number(surface_address, 16)),
|
||||
QString("%1;;%2").arg(png_filter, bin_filter), &selectedFilter);
|
||||
QStringLiteral("texture-0x%1.png").arg(QString::number(surface_address, 16)),
|
||||
QStringLiteral("%1;;%2").arg(png_filter, bin_filter), &selected_filter);
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
// If the user canceled the dialog, don't save anything.
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedFilter == png_filter) {
|
||||
const QPixmap* pixmap = surface_picture_label->pixmap();
|
||||
if (selected_filter == png_filter) {
|
||||
const QPixmap* const pixmap = surface_picture_label->pixmap();
|
||||
ASSERT_MSG(pixmap != nullptr, "No pixmap set");
|
||||
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
if (pixmap)
|
||||
pixmap->save(&file, "PNG");
|
||||
} else if (selectedFilter == bin_filter) {
|
||||
const u8* buffer = Core::System::GetInstance().Memory().GetPhysicalPointer(surface_address);
|
||||
QFile file{filename};
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to open file '%1'").arg(filename));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pixmap->save(&file, "PNG")) {
|
||||
QMessageBox::warning(this, tr("Error"),
|
||||
tr("Failed to save surface data to file '%1'").arg(filename));
|
||||
}
|
||||
} else if (selected_filter == bin_filter) {
|
||||
const u8* const buffer =
|
||||
Core::System::GetInstance().Memory().GetPhysicalPointer(surface_address);
|
||||
ASSERT_MSG(buffer != nullptr, "Memory not accessible");
|
||||
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
int size = surface_width * surface_height * NibblesPerPixel(surface_format) / 2;
|
||||
QByteArray data(reinterpret_cast<const char*>(buffer), size);
|
||||
file.write(data);
|
||||
QFile file{filename};
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to open file '%1'").arg(filename));
|
||||
return;
|
||||
}
|
||||
|
||||
const int size = surface_width * surface_height * NibblesPerPixel(surface_format) / 2;
|
||||
const QByteArray data(reinterpret_cast<const char*>(buffer), size);
|
||||
if (file.write(data) != data.size()) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Error"),
|
||||
tr("Failed to completely write surface data to file. The saved data will "
|
||||
"likely be corrupt."));
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE_MSG("Unhandled filter selected");
|
||||
}
|
||||
|
@ -27,18 +27,6 @@ namespace Common {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) {
|
||||
SetThreadAffinityMask(thread, mask);
|
||||
}
|
||||
|
||||
void SetCurrentThreadAffinity(u32 mask) {
|
||||
SetThreadAffinityMask(GetCurrentThread(), mask);
|
||||
}
|
||||
|
||||
void SwitchCurrentThread() {
|
||||
SwitchToThread();
|
||||
}
|
||||
|
||||
// Sets the debugger-visible name of the current thread.
|
||||
// Uses undocumented (actually, it is now documented) trick.
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp
|
||||
@ -70,31 +58,6 @@ void SetCurrentThreadName(const char* name) {
|
||||
|
||||
#else // !MSVC_VER, so must be POSIX threads
|
||||
|
||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask) {
|
||||
#ifdef __APPLE__
|
||||
thread_policy_set(pthread_mach_thread_np(thread), THREAD_AFFINITY_POLICY, (integer_t*)&mask, 1);
|
||||
#elif (defined __linux__ || defined __FreeBSD__) && !(defined ANDROID)
|
||||
cpu_set_t cpu_set;
|
||||
CPU_ZERO(&cpu_set);
|
||||
|
||||
for (int i = 0; i != sizeof(mask) * 8; ++i)
|
||||
if ((mask >> i) & 1)
|
||||
CPU_SET(i, &cpu_set);
|
||||
|
||||
pthread_setaffinity_np(thread, sizeof(cpu_set), &cpu_set);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetCurrentThreadAffinity(u32 mask) {
|
||||
SetThreadAffinity(pthread_self(), mask);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
void SwitchCurrentThread() {
|
||||
usleep(1000 * 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
// MinGW with the POSIX threading model does not support pthread_setname_np
|
||||
#if !defined(_WIN32) || defined(_MSC_VER)
|
||||
void SetCurrentThreadName(const char* name) {
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <cstddef>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
@ -92,9 +91,6 @@ private:
|
||||
std::size_t generation = 0; // Incremented once each time the barrier is used
|
||||
};
|
||||
|
||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask);
|
||||
void SetCurrentThreadAffinity(u32 mask);
|
||||
void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms
|
||||
void SetCurrentThreadName(const char* name);
|
||||
|
||||
} // namespace Common
|
||||
|
@ -25,7 +25,7 @@ class DynarmicUserCallbacks;
|
||||
class ARM_Dynarmic final : public ARM_Interface {
|
||||
public:
|
||||
ARM_Dynarmic(Core::System* system, Memory::MemorySystem& memory, PrivilegeMode initial_mode);
|
||||
~ARM_Dynarmic();
|
||||
~ARM_Dynarmic() override;
|
||||
|
||||
void Run() override;
|
||||
void Step() override;
|
||||
|
@ -22,7 +22,7 @@ class ARM_DynCom final : public ARM_Interface {
|
||||
public:
|
||||
explicit ARM_DynCom(Core::System* system, Memory::MemorySystem& memory,
|
||||
PrivilegeMode initial_mode);
|
||||
~ARM_DynCom();
|
||||
~ARM_DynCom() override;
|
||||
|
||||
void Run() override;
|
||||
void Step() override;
|
||||
|
@ -25,7 +25,7 @@ std::shared_ptr<Event> KernelSystem::CreateEvent(ResetType reset_type, std::stri
|
||||
return evt;
|
||||
}
|
||||
|
||||
bool Event::ShouldWait(Thread* thread) const {
|
||||
bool Event::ShouldWait(const Thread* thread) const {
|
||||
return !signaled;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
return reset_type;
|
||||
}
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
bool ShouldWait(const Thread* thread) const override;
|
||||
void Acquire(Thread* thread) override;
|
||||
|
||||
void WakeupAllWaitingThreads() override;
|
||||
|
@ -41,7 +41,7 @@ std::shared_ptr<Mutex> KernelSystem::CreateMutex(bool initial_locked, std::strin
|
||||
return mutex;
|
||||
}
|
||||
|
||||
bool Mutex::ShouldWait(Thread* thread) const {
|
||||
bool Mutex::ShouldWait(const Thread* thread) const {
|
||||
return lock_count > 0 && thread != holding_thread.get();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
*/
|
||||
void UpdatePriority();
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
bool ShouldWait(const Thread* thread) const override;
|
||||
void Acquire(Thread* thread) override;
|
||||
|
||||
void AddWaitingThread(std::shared_ptr<Thread> thread) override;
|
||||
|
@ -120,7 +120,7 @@ void Process::Run(s32 main_thread_priority, u32 stack_size) {
|
||||
auto MapSegment = [&](CodeSet::Segment& segment, VMAPermission permissions,
|
||||
MemoryState memory_state) {
|
||||
HeapAllocate(segment.addr, segment.size, permissions, memory_state, true);
|
||||
kernel.memory.WriteBlock(*this, segment.addr, codeset->memory->data() + segment.offset,
|
||||
kernel.memory.WriteBlock(*this, segment.addr, codeset->memory.data() + segment.offset,
|
||||
segment.size);
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
return segments[2];
|
||||
}
|
||||
|
||||
std::shared_ptr<std::vector<u8>> memory;
|
||||
std::vector<u8> memory;
|
||||
|
||||
std::array<Segment, 3> segments;
|
||||
VAddr entrypoint;
|
||||
|
@ -31,7 +31,7 @@ ResultVal<std::shared_ptr<Semaphore>> KernelSystem::CreateSemaphore(s32 initial_
|
||||
return MakeResult<std::shared_ptr<Semaphore>>(std::move(semaphore));
|
||||
}
|
||||
|
||||
bool Semaphore::ShouldWait(Thread* thread) const {
|
||||
bool Semaphore::ShouldWait(const Thread* thread) const {
|
||||
return available_count <= 0;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
s32 available_count; ///< Number of free slots left in the semaphore
|
||||
std::string name; ///< Name of semaphore (optional)
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
bool ShouldWait(const Thread* thread) const override;
|
||||
void Acquire(Thread* thread) override;
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ ResultVal<std::shared_ptr<ServerSession>> ServerPort::Accept() {
|
||||
return MakeResult(std::move(session));
|
||||
}
|
||||
|
||||
bool ServerPort::ShouldWait(Thread* thread) const {
|
||||
bool ServerPort::ShouldWait(const Thread* thread) const {
|
||||
// If there are no pending sessions, we wait until a new one is added.
|
||||
return pending_sessions.size() == 0;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
/// ServerSessions created from this port inherit a reference to this handler.
|
||||
std::shared_ptr<SessionRequestHandler> hle_handler;
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
bool ShouldWait(const Thread* thread) const override;
|
||||
void Acquire(Thread* thread) override;
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,7 @@ ResultVal<std::shared_ptr<ServerSession>> ServerSession::Create(KernelSystem& ke
|
||||
return MakeResult(std::move(server_session));
|
||||
}
|
||||
|
||||
bool ServerSession::ShouldWait(Thread* thread) const {
|
||||
bool ServerSession::ShouldWait(const Thread* thread) const {
|
||||
// Closed sessions should never wait, an error will be returned from svcReplyAndReceive.
|
||||
if (parent->client == nullptr)
|
||||
return false;
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
*/
|
||||
ResultCode HandleSyncRequest(std::shared_ptr<Thread> thread);
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
bool ShouldWait(const Thread* thread) const override;
|
||||
|
||||
void Acquire(Thread* thread) override;
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
bool Thread::ShouldWait(Thread* thread) const {
|
||||
bool Thread::ShouldWait(const Thread* thread) const {
|
||||
return status != ThreadStatus::Dead;
|
||||
}
|
||||
|
||||
@ -450,17 +450,17 @@ void Thread::SetWaitSynchronizationOutput(s32 output) {
|
||||
context->SetCpuRegister(1, output);
|
||||
}
|
||||
|
||||
s32 Thread::GetWaitObjectIndex(WaitObject* object) const {
|
||||
s32 Thread::GetWaitObjectIndex(const WaitObject* object) const {
|
||||
ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything");
|
||||
auto match = std::find_if(wait_objects.rbegin(), wait_objects.rend(),
|
||||
[object](const auto& p) { return p.get() == object; });
|
||||
const auto match = std::find_if(wait_objects.rbegin(), wait_objects.rend(),
|
||||
[object](const auto& p) { return p.get() == object; });
|
||||
return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1);
|
||||
}
|
||||
|
||||
VAddr Thread::GetCommandBufferAddress() const {
|
||||
// Offset from the start of TLS at which the IPC command buffer begins.
|
||||
static constexpr int CommandHeaderOffset = 0x80;
|
||||
return GetTLSAddress() + CommandHeaderOffset;
|
||||
constexpr u32 command_header_offset = 0x80;
|
||||
return GetTLSAddress() + command_header_offset;
|
||||
}
|
||||
|
||||
ThreadManager::ThreadManager(Kernel::KernelSystem& kernel) : kernel(kernel) {
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
return HANDLE_TYPE;
|
||||
}
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
bool ShouldWait(const Thread* thread) const override;
|
||||
void Acquire(Thread* thread) override;
|
||||
|
||||
/**
|
||||
@ -234,7 +234,7 @@ public:
|
||||
* object in the list.
|
||||
* @param object Object to query the index of.
|
||||
*/
|
||||
s32 GetWaitObjectIndex(WaitObject* object) const;
|
||||
s32 GetWaitObjectIndex(const WaitObject* object) const;
|
||||
|
||||
/**
|
||||
* Stops a thread, invalidating it from further use
|
||||
|
@ -35,7 +35,7 @@ std::shared_ptr<Timer> KernelSystem::CreateTimer(ResetType reset_type, std::stri
|
||||
return timer;
|
||||
}
|
||||
|
||||
bool Timer::ShouldWait(Thread* thread) const {
|
||||
bool Timer::ShouldWait(const Thread* thread) const {
|
||||
return !signaled;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
return interval_delay;
|
||||
}
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
bool ShouldWait(const Thread* thread) const override;
|
||||
void Acquire(Thread* thread) override;
|
||||
|
||||
void WakeupAllWaitingThreads() override;
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
* @param thread The thread about which we're deciding.
|
||||
* @return True if the current thread should wait due to this object being unavailable
|
||||
*/
|
||||
virtual bool ShouldWait(Thread* thread) const = 0;
|
||||
virtual bool ShouldWait(const Thread* thread) const = 0;
|
||||
|
||||
/// Acquire/lock the object for the specified thread if it is available
|
||||
virtual void Acquire(Thread* thread) = 0;
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
Kernel::HLERequestContext& ctx);
|
||||
|
||||
ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker);
|
||||
~ServiceFrameworkBase();
|
||||
~ServiceFrameworkBase() override;
|
||||
|
||||
void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
|
||||
void ReportUnimplementedFunction(u32* cmd_buf, const FunctionInfoBase* info);
|
||||
|
@ -231,7 +231,7 @@ static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr,
|
||||
code_set->DataSegment().size = loadinfo.seg_sizes[2];
|
||||
|
||||
code_set->entrypoint = code_set->CodeSegment().addr;
|
||||
code_set->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
||||
code_set->memory = std::move(program_image);
|
||||
|
||||
LOG_DEBUG(Loader, "code size: {:#X}", loadinfo.seg_sizes[0]);
|
||||
LOG_DEBUG(Loader, "rodata size: {:#X}", loadinfo.seg_sizes[1]);
|
||||
|
@ -342,7 +342,7 @@ std::shared_ptr<CodeSet> ElfReader::LoadInto(u32 vaddr) {
|
||||
}
|
||||
|
||||
codeset->entrypoint = base_addr + header->e_entry;
|
||||
codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
|
||||
codeset->memory = std::move(program_image);
|
||||
|
||||
LOG_DEBUG(Loader, "Done loading.");
|
||||
|
||||
|
@ -101,7 +101,7 @@ ResultStatus AppLoader_NCCH::LoadExec(std::shared_ptr<Kernel::Process>& process)
|
||||
bss_page_size;
|
||||
|
||||
codeset->entrypoint = codeset->CodeSegment().addr;
|
||||
codeset->memory = std::make_shared<std::vector<u8>>(std::move(code));
|
||||
codeset->memory = std::move(code);
|
||||
|
||||
process = Core::System::GetInstance().Kernel().CreateProcess(std::move(codeset));
|
||||
|
||||
|
@ -85,7 +85,7 @@ std::vector<std::unique_ptr<DevicePoller>> GetPollers(DeviceType type) {
|
||||
std::vector<std::unique_ptr<DevicePoller>> pollers;
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
sdl->GetPollers(type, pollers);
|
||||
pollers = sdl->GetPollers(type);
|
||||
#endif
|
||||
|
||||
return pollers;
|
||||
|
@ -24,19 +24,19 @@ namespace InputCommon::SDL {
|
||||
|
||||
class State {
|
||||
public:
|
||||
/// Unresisters SDL device factories and shut them down.
|
||||
using Pollers = std::vector<std::unique_ptr<Polling::DevicePoller>>;
|
||||
|
||||
/// Unregisters SDL device factories and shut them down.
|
||||
virtual ~State() = default;
|
||||
|
||||
virtual void GetPollers(
|
||||
InputCommon::Polling::DeviceType type,
|
||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>>& pollers) = 0;
|
||||
virtual Pollers GetPollers(Polling::DeviceType type) = 0;
|
||||
};
|
||||
|
||||
class NullState : public State {
|
||||
public:
|
||||
void GetPollers(
|
||||
InputCommon::Polling::DeviceType type,
|
||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>>& pollers) override {}
|
||||
Pollers GetPollers(Polling::DeviceType type) override {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<State> Init();
|
||||
|
@ -652,9 +652,9 @@ private:
|
||||
};
|
||||
} // namespace Polling
|
||||
|
||||
void SDLState::GetPollers(
|
||||
InputCommon::Polling::DeviceType type,
|
||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>>& pollers) {
|
||||
SDLState::Pollers SDLState::GetPollers(InputCommon::Polling::DeviceType type) {
|
||||
Pollers pollers;
|
||||
|
||||
switch (type) {
|
||||
case InputCommon::Polling::DeviceType::Analog:
|
||||
pollers.emplace_back(std::make_unique<Polling::SDLAnalogPoller>(*this));
|
||||
@ -663,6 +663,8 @@ void SDLState::GetPollers(
|
||||
pollers.emplace_back(std::make_unique<Polling::SDLButtonPoller>(*this));
|
||||
break;
|
||||
}
|
||||
|
||||
return pollers;
|
||||
}
|
||||
|
||||
} // namespace SDL
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
/// Initializes and registers SDL device factories
|
||||
SDLState();
|
||||
|
||||
/// Unresisters SDL device factories and shut them down.
|
||||
/// Unregisters SDL device factories and shut them down.
|
||||
~SDLState() override;
|
||||
|
||||
/// Handle SDL_Events for joysticks from SDL_PollEvent
|
||||
@ -35,9 +35,7 @@ public:
|
||||
std::shared_ptr<SDLJoystick> GetSDLJoystickByGUID(const std::string& guid, int port);
|
||||
|
||||
/// Get all DevicePoller that use the SDL backend for a specific device type
|
||||
void GetPollers(
|
||||
InputCommon::Polling::DeviceType type,
|
||||
std::vector<std::unique_ptr<InputCommon::Polling::DevicePoller>>& pollers) override;
|
||||
Pollers GetPollers(Polling::DeviceType type) override;
|
||||
|
||||
/// Used by the Pollers during config
|
||||
std::atomic<bool> polling = false;
|
||||
|
Loading…
Reference in New Issue
Block a user