Fix uninitialized warning and remove header pollution (#803)
Some checks failed
Hydra Core Build / Windows (push) Has been cancelled
Android Build / x64 (release) (push) Has been cancelled
Android Build / arm64 (release) (push) Has been cancelled
HTTP Server Build / build (push) Has been cancelled
Hydra Core Build / MacOS (push) Has been cancelled
Hydra Core Build / Linux (push) Has been cancelled
Hydra Core Build / Android-x64 (push) Has been cancelled
Hydra Core Build / ARM-Libretro (push) Has been cancelled
Hydra Core Build / ARM-Libretro-Android (push) Has been cancelled
Linux AppImage Build / build (push) Has been cancelled
Linux Build / build (push) Has been cancelled
iOS Simulator Build / build (push) Has been cancelled
MacOS Build / MacOS-arm64 (push) Has been cancelled
MacOS Build / MacOS-x86_64 (push) Has been cancelled
Qt Build / Windows (push) Has been cancelled
Qt Build / MacOS-arm64 (push) Has been cancelled
Qt Build / MacOS-x86_64 (push) Has been cancelled
Qt Build / Linux (push) Has been cancelled
Hardware Test Build / build (push) Has been cancelled
Windows Build / build (push) Has been cancelled
MacOS Build / MacOS-Universal (push) Has been cancelled
Qt Build / MacOS-Universal (push) Has been cancelled

* Fix uninitialized warning and remove header pollution

* Nits

* IWYU

* More IWYU
This commit is contained in:
wheremyfoodat 2025-08-07 23:12:45 +03:00 committed by GitHub
commit bd81c72608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 66 additions and 94 deletions

View file

@ -16,9 +16,9 @@ namespace Audio::Interpolation {
using StereoFrame16 = Audio::DSPMixer::StereoFrame<s16>;
struct State {
// Two historical samples.
std::array<s16, 2> xn1 = {}; //< x[n-1]
std::array<s16, 2> xn2 = {}; //< x[n-2]
// Two history samples.
std::array<s16, 2> xn1 = {}; // x[n-1]
std::array<s16, 2> xn2 = {}; // x[n-2]
// Current fractional position.
u64 fposition = 0;
};

View file

@ -1,71 +1,51 @@
#pragma once
#include "dynarmic/interface/A32/a32.h"
#include "dynarmic/interface/A32/config.h"
#include "dynarmic/interface/A32/coprocessor.h"
#include "helpers.hpp"
#include "memory.hpp"
class CP15 final : public Dynarmic::A32::Coprocessor {
using Callback = Dynarmic::A32::Coprocessor::Callback;
using CoprocReg = Dynarmic::A32::CoprocReg;
using CallbackOrAccessOneWord = Dynarmic::A32::Coprocessor::CallbackOrAccessOneWord;
using CallbackOrAccessTwoWords = Dynarmic::A32::Coprocessor::CallbackOrAccessTwoWords;
using Callback = Dynarmic::A32::Coprocessor::Callback;
using CoprocReg = Dynarmic::A32::CoprocReg;
using CallbackOrAccessOneWord = Dynarmic::A32::Coprocessor::CallbackOrAccessOneWord;
using CallbackOrAccessTwoWords = Dynarmic::A32::Coprocessor::CallbackOrAccessTwoWords;
u32 threadStoragePointer; // Pointer to thread-local storage
u32 dummy; // MCR writes here for registers whose values are ignored
u32 threadStoragePointer; // Pointer to thread-local storage
u32 dummy; // MCR writes here for registers whose values are ignored
std::optional<Callback> CompileInternalOperation(bool two, unsigned opc1,
CoprocReg CRd, CoprocReg CRn,
CoprocReg CRm, unsigned opc2) override {
return std::nullopt;
}
std::optional<Callback> CompileInternalOperation(bool two, unsigned opc1, CoprocReg CRd, CoprocReg CRn, CoprocReg CRm, unsigned opc2) override {
return std::nullopt;
}
CallbackOrAccessOneWord CompileSendOneWord(bool two, unsigned opc1, CoprocReg CRn,
CoprocReg CRm, unsigned opc2) override {
if (!two && opc1 == 0 && CRn == CoprocReg::C7 && CRm == CoprocReg::C10 && opc2 == 4) {
return &dummy; // Normally inserts a "Data Synchronization Barrier"
}
CallbackOrAccessOneWord CompileSendOneWord(bool two, unsigned opc1, CoprocReg CRn, CoprocReg CRm, unsigned opc2) override {
if (!two && opc1 == 0 && CRn == CoprocReg::C7 && CRm == CoprocReg::C10 && opc2 == 4) {
return &dummy; // Normally inserts a "Data Synchronization Barrier"
}
if (!two && opc1 == 0 && CRn == CoprocReg::C7 && CRm == CoprocReg::C10 && opc2 == 5) {
return &dummy; // Normally inserts a "Data Memory Barrier"
}
Helpers::panic("CP15: CompileSendOneWord\nopc1: %d CRn: %d CRm: %d opc2: %d\n", opc1, (int)CRn, (int)CRm, opc2);
}
if (!two && opc1 == 0 && CRn == CoprocReg::C7 && CRm == CoprocReg::C10 && opc2 == 5) {
return &dummy; // Normally inserts a "Data Memory Barrier"
}
Helpers::panic("CP15: CompileSendOneWord\nopc1: %d CRn: %d CRm: %d opc2: %d\n", opc1, (int)CRn, (int)CRm, opc2);
}
CallbackOrAccessTwoWords CompileSendTwoWords(bool two, unsigned opc, CoprocReg CRm) override {
return std::monostate{};
}
CallbackOrAccessOneWord CompileGetOneWord(bool two, unsigned opc1, CoprocReg CRn, CoprocReg CRm, unsigned opc2) override {
// Stores a pointer to thread-local storage, accessed via mrc p15, 0, rd, c13, c0, 3
if (!two && CRn == CoprocReg::C13 && opc1 == 0 && CRm == CoprocReg::C0 && opc2 == 3) {
return &threadStoragePointer;
}
CallbackOrAccessOneWord CompileGetOneWord(bool two, unsigned opc1, CoprocReg CRn,
CoprocReg CRm, unsigned opc2) override {
// Stores a pointer to thread-local storage, accessed via mrc p15, 0, rd, c13, c0, 3
if (!two && CRn == CoprocReg::C13 && opc1 == 0 && CRm == CoprocReg::C0 && opc2 == 3) {
return &threadStoragePointer;
}
Helpers::panic("CP15: CompileGetOneWord\nopc1: %d CRn: %d CRm: %d opc2: %d\n", opc1, (int)CRn, (int)CRm, opc2);
}
Helpers::panic("CP15: CompileGetOneWord\nopc1: %d CRn: %d CRm: %d opc2: %d\n", opc1, (int)CRn, (int)CRm, opc2);
}
CallbackOrAccessTwoWords CompileSendTwoWords(bool two, unsigned opc, CoprocReg CRm) override { return std::monostate{}; }
CallbackOrAccessTwoWords CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) override { return std::monostate{}; }
CallbackOrAccessTwoWords CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) override {
return std::monostate{};
}
std::optional<Callback> CompileLoadWords(bool two, bool long_transfer, CoprocReg CRd, std::optional<u8> option) override { return std::nullopt; }
std::optional<Callback> CompileStoreWords(bool two, bool long_transfer, CoprocReg CRd, std::optional<u8> option) override { return std::nullopt; }
std::optional<Callback> CompileLoadWords(bool two, bool long_transfer, CoprocReg CRd,
std::optional<u8> option) override {
return std::nullopt;
}
public:
void setTLSBase(u32 value) { threadStoragePointer = value; }
std::optional<Callback> CompileStoreWords(bool two, bool long_transfer, CoprocReg CRd,
std::optional<u8> option) override {
return std::nullopt;
}
public:
void setTLSBase(u32 value) {
threadStoragePointer = value;
}
// Currently does nothing but may be needed in the future
void reset() {}
// Currently does nothing but may be needed in the future
void reset() {}
};

View file

@ -24,12 +24,6 @@
#include "http_server.hpp"
#endif
#ifdef PANDA3DS_FRONTEND_QT
#include "gl/context.h"
#endif
struct SDL_Window;
enum class ROMType {
None,
ELF,

View file

@ -3,10 +3,8 @@
#include <cstdarg>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
#include <memory>
#include <string>
#include "termcolor.hpp"
@ -37,7 +35,7 @@ namespace Helpers {
return {};
}
const auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, fmt.c_str(), args ...);
std::snprintf(buf.get(), size, fmt.c_str(), args...);
return std::string(buf.get(), buf.get() + size - 1);
}
@ -50,7 +48,7 @@ namespace Helpers {
exit(1);
}
#ifdef PANDA3DS_LIMITED_PANICS
template <class... Args>
static void panicDev(const char* fmt, Args&&... args) {}

View file

@ -1,7 +1,5 @@
#pragma once
#include <array>
#include <cassert>
#include <limits>
#include <span>
#include <string>
#include <vector>
@ -26,8 +24,10 @@ class Kernel {
CPU& cpu;
Memory& mem;
public:
KFcram fcramManager;
private:
// The handle number for the next kernel object to be created
u32 handleCounter;
// A list of our OS threads, the max number of which depends on the resource limit (hardcoded 32 per process on retail it seems).
@ -250,7 +250,6 @@ class Kernel {
}
ServiceManager& getServiceManager() { return serviceManager; }
KFcram& getFcramManager() { return fcramManager; }
Scheduler& getScheduler();
void sendGPUInterrupt(GPUInterrupt type) { serviceManager.sendGPUInterrupt(type); }

View file

@ -1,11 +1,10 @@
#pragma once
#include <array>
#include <cstring>
#include <vector>
#include "fs/archive_base.hpp"
#include "handles.hpp"
#include "helpers.hpp"
#include "result/result.hpp"
enum class KernelObjectType : u8 {
AddressArbiter,

View file

@ -6,6 +6,7 @@
class ElidedLabel : public QLabel {
Q_OBJECT
public:
explicit ElidedLabel(Qt::TextElideMode elideMode = Qt::ElideLeft, QWidget* parent = nullptr);
explicit ElidedLabel(QString text, Qt::TextElideMode elideMode = Qt::ElideLeft, QWidget* parent = nullptr);

View file

@ -9,10 +9,6 @@
#include "PICA/regs.hpp"
#include "helpers.hpp"
#ifdef PANDA3DS_FRONTEND_QT
#include "gl/context.h"
#endif
enum class RendererType : s8 {
// Todo: Auto = -1,
Null = 0,
@ -23,7 +19,6 @@ enum class RendererType : s8 {
};
struct EmulatorConfig;
struct SDL_Window;
class GPU;
class ShaderUnit;

View file

@ -2,6 +2,8 @@
#include <Metal/Metal.hpp>
#include "helpers.hpp"
namespace Metal {
struct RenderState {
MTL::RenderPipelineState* renderPipelineState = nullptr;

View file

@ -2,6 +2,7 @@
#include <map>
#include "helpers.hpp"
#include "pica_to_mtl.hpp"
using namespace PICA;
@ -17,7 +18,6 @@ namespace Metal {
class DepthStencilCache {
public:
DepthStencilCache() = default;
~DepthStencilCache() { reset(); }
void set(MTL::Device* dev) { device = dev; }

View file

@ -2,6 +2,7 @@
#include <map>
#include "helpers.hpp"
#include "objc_helper.hpp"
#include "pica_to_mtl.hpp"

View file

@ -2,19 +2,22 @@
#include <Metal/Metal.hpp>
#include "helpers.hpp"
namespace Metal {
class LutTexture {
public:
LutTexture(MTL::Device* device, MTL::TextureType type, MTL::PixelFormat pixelFormat, u32 width, u32 height, const char* name);
~LutTexture();
u32 getNextIndex();
class LutTexture {
public:
LutTexture(MTL::Device* device, MTL::TextureType type, MTL::PixelFormat pixelFormat, u32 width, u32 height, const char* name);
~LutTexture();
u32 getNextIndex();
MTL::Texture* getTexture() { return texture; }
u32 getCurrentIndex() { return currentIndex; }
private:
MTL::Texture* texture;
u32 currentIndex = 0;
};
MTL::Texture* getTexture() { return texture; }
u32 getCurrentIndex() { return currentIndex; }
} // namespace Metal
private:
MTL::Texture* texture;
u32 currentIndex = 0;
};
} // namespace Metal

View file

@ -5,7 +5,6 @@
#include "helpers.hpp"
#include "pica_to_mtl.hpp"
using namespace PICA;
namespace Metal {

View file

@ -3,6 +3,7 @@
#include <Metal/Metal.hpp>
#include "PICA/regs.hpp"
#include "helpers.hpp"
// TODO: remove dependency on OpenGL
#include "opengl.hpp"

View file

@ -9,6 +9,7 @@
#include "vk_sampler_cache.hpp"
class GPU;
struct SDL_Window;
class RendererVK final : public Renderer {
SDL_Window* targetWindow;

View file

@ -4,7 +4,6 @@
#include <limits>
#include "helpers.hpp"
#include "logger.hpp"
struct Scheduler {
enum class EventType {

View file

@ -20,8 +20,8 @@ __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 1;
Emulator::Emulator()
: config(getConfigPath()), kernel(cpu, memory, gpu, config, lua), cpu(memory, kernel, *this), gpu(memory, config),
memory(kernel.getFcramManager(), config), cheats(memory, kernel.getServiceManager().getHID()), audioDevice(config.audioDeviceConfig),
lua(*this), running(false)
memory(kernel.fcramManager, config), cheats(memory, kernel.getServiceManager().getHID()), audioDevice(config.audioDeviceConfig), lua(*this),
running(false)
#ifdef PANDA3DS_ENABLE_HTTP_SERVER
,
httpServer(this)