@@ -13,37 +13,37 @@
struct TrampolineInfo final
{
// The start of the store operation that failed -- we will patch a JMP here
u8* start;
u8* start = nullptr;

// The start + len = end of the store operation (points to the next instruction)
u32 len;
u32 len = 0;

// The PPC PC for the current load/store block
u32 pc;
u32 pc = 0;

// Saved because we need these to make the ABI call in the trampoline
BitSet32 registersInUse;
BitSet32 registersInUse{};

// The MOV operation
Gen::X64Reg nonAtomicSwapStoreSrc;
Gen::X64Reg nonAtomicSwapStoreSrc{};

// src/dest for load/store
s32 offset;
Gen::X64Reg op_reg;
Gen::OpArg op_arg;
s32 offset = 0;
Gen::X64Reg op_reg{};
Gen::OpArg op_arg{};

// Original SafeLoadXXX/SafeStoreXXX flags
u8 flags;
u8 flags = 0;

// Memory access size (in bytes)
u8 accessSize : 4;
u8 accessSize : 4 = 0;

// true if this is a read op vs a write
bool read : 1;
bool read : 1 = false;

// for read operations, true if needs sign-extension after load
bool signExtend : 1;
bool signExtend : 1 = false;

// Set to true if we added the offset to the address and need to undo it
bool offsetAddedToAddress : 1;
bool offsetAddedToAddress : 1 = false;
};
@@ -347,7 +347,7 @@ class JitArm64 : public JitBase, public Arm64Gen::ARM64CodeBlock, public CommonA
void Force25BitPrecision(Arm64Gen::ARM64Reg output, Arm64Gen::ARM64Reg input);

// <Fastmem fault location, slowmem handler location>
std::map<const u8*, FastmemArea> m_fault_to_handler;
std::map<const u8*, FastmemArea> m_fault_to_handler{};
Arm64GPRCache gpr;
Arm64FPRCache fpr;

@@ -359,11 +359,11 @@ class JitArm64 : public JitBase, public Arm64Gen::ARM64CodeBlock, public CommonA
bool m_in_far_code = false;

// Backed up when we switch to far code.
u8* m_near_code;
u8* m_near_code_end;
bool m_near_code_write_failed;
u8* m_near_code = nullptr;
u8* m_near_code_end = nullptr;
bool m_near_code_write_failed = false;

bool m_enable_blr_optimization;
bool m_enable_blr_optimization = false;
bool m_cleanup_after_stackfault = false;
u8* m_stack_base = nullptr;
u8* m_stack_pointer = nullptr;
@@ -43,7 +43,7 @@ struct ContentFile
std::string m_filename;

// Offset from the start of the file where the first byte of this content chunk is.
u64 m_offset;
u64 m_offset = 0;
};

// Content chunk that loads data from a DirectoryBlobReader.
@@ -54,20 +54,20 @@ struct ContentPartition
DirectoryBlobReader* m_reader;

// Offset from the start of the partition for the first byte represented by this chunk.
u64 m_offset;
u64 m_offset = 0;

// The value passed as partition_data_offset to EncryptPartitionData().
u64 m_partition_data_offset;
u64 m_partition_data_offset = 0;
};

// Content chunk that loads data from a Volume.
struct ContentVolume
{
// Offset from the start of the volume for the first byte represented by this chunk.
u64 m_offset;
u64 m_offset = 0;

// The volume to read data from.
const Volume* m_volume;
const Volume* m_volume = nullptr;

// The partition passed to the Volume's Read() method.
Partition m_partition;
@@ -77,7 +77,7 @@ struct ContentVolume
// Useful for padding between chunks within a file.
struct ContentFixedByte
{
u8 m_byte;
u8 m_byte = 0;
};

// Content chunk representing an arbitrary byte sequence that's stored within the struct itself.
@@ -96,15 +96,15 @@ using ContentSource = std::variant<ContentFile, // File

struct BuilderContentSource
{
u64 m_offset;
u64 m_size;
u64 m_offset = 0;
u64 m_size = 0;
ContentSource m_source;
};

struct FSTBuilderNode
{
std::string m_filename;
u64 m_size;
u64 m_size = 0;
std::variant<std::vector<BuilderContentSource>, std::vector<FSTBuilderNode>> m_content;
void* m_user_data = nullptr;

@@ -54,7 +54,7 @@ struct Option

// The currently selected patch choice in the m_choices vector.
// Note that this index is 1-based; 0 means no choice is selected and this Option is disabled.
u32 m_selected_choice;
u32 m_selected_choice = 0;
};

// A single page of options presented to the user in the Riivolution GUI.
@@ -177,7 +177,7 @@ struct Patch
struct Disc
{
// Riivolution version. Only '1' exists at time of writing.
int m_version;
int m_version = 0;

// Info about which game and revision these patches are for.
GameFilter m_game_filter;
@@ -209,7 +209,7 @@ struct ConfigOption
std::string m_id;

// The selected Choice index.
u32 m_default;
u32 m_default = 0;
};

struct Config
@@ -15,10 +15,10 @@ class QTableWidget;

struct Diff
{
u32 addr;
u32 addr = 0;
std::string symbol;
u32 hits;
u32 total_hits;
u32 hits = 0;
u32 total_hits = 0;

bool operator<(const std::string& val) const { return symbol < val; }
};
@@ -153,10 +153,10 @@ class Device final : public Core::Device
const std::string m_server_address;
const u16 m_server_port;

s16 m_touch_x_min;
s16 m_touch_y_min;
s16 m_touch_x_max;
s16 m_touch_y_max;
s16 m_touch_x_min = 0;
s16 m_touch_y_min = 0;
s16 m_touch_x_max = 0;
s16 m_touch_y_max = 0;

const u32 m_client_uid;
};
@@ -192,7 +192,7 @@ struct Server

std::string m_description;
std::string m_address;
u16 m_port;
u16 m_port = 0;
std::array<Proto::MessageType::PortInfo, Proto::PORT_COUNT> m_port_info{};
sf::UdpSocket m_socket;
SteadyClock::time_point m_disconnect_time = SteadyClock::now();
@@ -213,9 +213,9 @@ class InputBackend final : public ciface::InputBackend
void StartHotplugThread();
void StopHotplugThread();

bool m_servers_enabled;
bool m_servers_enabled = false;
std::vector<Server> m_servers;
u32 m_client_uid;
u32 m_client_uid = 0;
SteadyClock::time_point m_next_listports_time;
std::thread m_hotplug_thread;
Common::Flag m_hotplug_thread_running;
@@ -21,9 +21,9 @@ class HostDisassembler
struct DisassembleResult
{
std::string text;
u32 entry_address;
u32 instruction_count;
u32 code_size;
u32 entry_address = 0;
u32 instruction_count = 0;
u32 code_size = 0;
};

std::unique_ptr<HostDisassembler> GetNewDisassembler(const std::string& arch);
@@ -122,9 +122,9 @@ class Tev
static constexpr s16 V7_8 = 223;
static constexpr s16 V1 = 255;

u8 AlphaBump;
u8 IndirectTex[4][4];
TextureCoordinateType TexCoord;
u8 AlphaBump = 0;
u8 IndirectTex[4][4]{};
TextureCoordinateType TexCoord{};

const Common::EnumMap<TevColorRef, TevColorArg::Zero> m_ColorInputLUT{
TevColorRef::Color(Reg[TevOutput::Prev]), // prev.rgb
@@ -213,13 +213,13 @@ class Tev
void Indirect(unsigned int stageNum, s32 s, s32 t);

public:
s32 Position[3];
u8 Color[2][4]; // must be RGBA for correct swap table ordering
TextureCoordinateType Uv[8];
s32 IndirectLod[4];
bool IndirectLinear[4];
s32 TextureLod[16];
bool TextureLinear[16];
s32 Position[3]{};
u8 Color[2][4]{}; // must be RGBA for correct swap table ordering
TextureCoordinateType Uv[8]{};
s32 IndirectLod[4]{};
bool IndirectLinear[4]{};
s32 TextureLod[16]{};
bool TextureLinear[16]{};

enum
{
@@ -40,16 +40,16 @@ enum class AbstractPipelineUsage

struct AbstractPipelineConfig
{
const NativeVertexFormat* vertex_format;
const AbstractShader* vertex_shader;
const AbstractShader* geometry_shader;
const AbstractShader* pixel_shader;
const NativeVertexFormat* vertex_format = nullptr;
const AbstractShader* vertex_shader = nullptr;
const AbstractShader* geometry_shader = nullptr;
const AbstractShader* pixel_shader = nullptr;
RasterizationState rasterization_state;
DepthState depth_state;
BlendingState blending_state;
FramebufferState framebuffer_state;

AbstractPipelineUsage usage;
AbstractPipelineUsage usage = AbstractPipelineUsage::GX;

bool operator==(const AbstractPipelineConfig& rhs) const
{
@@ -29,10 +29,10 @@ class CPUCull
{
void operator()(T* ptr);
};
std::unique_ptr<TransformedVertex[], BufferDeleter<TransformedVertex>> m_transform_buffer;
std::unique_ptr<TransformedVertex[], BufferDeleter<TransformedVertex>> m_transform_buffer{};
u32 m_transform_buffer_size = 0;
std::array<std::array<TransformFunction, 2>, 2> m_transform_table;
std::array<std::array<TransformFunction, 2>, 2> m_transform_table{};
Common::EnumMap<Common::EnumMap<CullFunction, CullMode::All>,
OpcodeDecoder::Primitive::GX_DRAW_TRIANGLE_FAN>
m_cull_table;
m_cull_table{};
};
@@ -59,17 +59,14 @@ class OnScreenUI
void SetMousePress(u32 button_mask);

private:
// Destroys all ImGui GPU resources, must do before shutdown.
void ShutdownImGui();

void DrawDebugText();

// ImGui resources.
std::unique_ptr<NativeVertexFormat> m_imgui_vertex_format;
std::vector<std::unique_ptr<AbstractTexture>> m_imgui_textures;
std::unique_ptr<AbstractPipeline> m_imgui_pipeline;
std::mutex m_imgui_mutex;
u64 m_imgui_last_frame_time;
u64 m_imgui_last_frame_time = 0;

u32 m_backbuffer_width = 1;
u32 m_backbuffer_height = 1;
@@ -54,9 +54,9 @@ class PerformanceMetrics
mutable std::shared_mutex m_time_lock;

u8 m_time_index = 0;
std::array<TimePoint, 256> m_real_times;
std::array<TimePoint, 256> m_cpu_times;
DT m_time_sleeping;
std::array<TimePoint, 256> m_real_times{};
std::array<TimePoint, 256> m_cpu_times{};
DT m_time_sleeping{};
};

extern PerformanceMetrics g_perf_metrics;
@@ -53,7 +53,7 @@ union RasterizationState
BitField<0, 2, CullMode> cullmode;
BitField<3, 2, PrimitiveType> primitive;

u32 hex;
u32 hex = 0;
};

union FramebufferState
@@ -80,7 +80,7 @@ union FramebufferState
BitField<16, 8, u32> samples;
BitField<24, 1, u32> per_sample_shading;

u32 hex;
u32 hex = 0;
};

union DepthState
@@ -109,7 +109,7 @@ union DepthState
BitField<1, 1, u32> updateenable;
BitField<2, 3, CompareMode> func;

u32 hex;
u32 hex = 0;
};

union BlendingState
@@ -155,7 +155,7 @@ union BlendingState

bool RequiresDualSrc() const;

u32 hex;
u32 hex = 0;
};

struct SamplerState
@@ -200,14 +200,14 @@ struct SamplerState
BitField<8, 16, s32> lod_bias; // multiplied by 256, higher precision than normal
BitField<24, 1, bool, u32> lod_clamp; // TODO: This isn't currently implemented
BitField<25, 1, bool, u32> anisotropic_filtering; // TODO: This doesn't use the BP one yet
u32 hex;
u32 hex = 0;
};
union TM1
{
// Min is guaranteed to be less than or equal to max
BitField<0, 8, u32> min_lod; // multiplied by 16
BitField<8, 8, u32> max_lod; // multiplied by 16
u32 hex;
u32 hex = 0;
};

TM0 tm0;
@@ -10,22 +10,22 @@

struct Statistics
{
int num_pixel_shaders_created;
int num_pixel_shaders_alive;
int num_vertex_shaders_created;
int num_vertex_shaders_alive;
int num_pixel_shaders_created = 0;
int num_pixel_shaders_alive = 0;
int num_vertex_shaders_created = 0;
int num_vertex_shaders_alive = 0;

int num_textures_created;
int num_textures_uploaded;
int num_textures_alive;
int num_textures_created = 0;
int num_textures_uploaded = 0;
int num_textures_alive = 0;

int num_vertex_loaders;
int num_vertex_loaders = 0;

std::array<float, 6> proj;
std::array<float, 16> gproj;
std::array<float, 16> g2proj;
std::array<float, 6> proj{};
std::array<float, 16> gproj{};
std::array<float, 16> g2proj{};

std::vector<BPFunctions::ScissorResult> scissors;
std::vector<BPFunctions::ScissorResult> scissors{};
size_t current_scissor = 0; // 0 => all, otherwise index + 1
int scissor_scale = 10;
int scissor_expected_count = 0;
@@ -37,44 +37,44 @@ struct Statistics

struct ThisFrame
{
int num_bp_loads;
int num_cp_loads;
int num_xf_loads;

int num_bp_loads_in_dl;
int num_cp_loads_in_dl;
int num_xf_loads_in_dl;

int num_prims;
int num_dl_prims;
int num_shader_changes;

int num_primitive_joins;
int num_draw_calls;

int num_dlists_called;

int bytes_vertex_streamed;
int bytes_index_streamed;
int bytes_uniform_streamed;

int num_triangles_clipped;
int num_triangles_in;
int num_triangles_rejected;
int num_triangles_culled;
int num_drawn_objects;
int rasterized_pixels;
int num_triangles_drawn;
int num_vertices_loaded;
int tev_pixels_in;
int tev_pixels_out;

int num_efb_peeks;
int num_efb_pokes;

int num_draw_done;
int num_token;
int num_token_int;
int num_bp_loads = 0;
int num_cp_loads = 0;
int num_xf_loads = 0;

int num_bp_loads_in_dl = 0;
int num_cp_loads_in_dl = 0;
int num_xf_loads_in_dl = 0;

int num_prims = 0;
int num_dl_prims = 0;
int num_shader_changes = 0;

int num_primitive_joins = 0;
int num_draw_calls = 0;

int num_dlists_called = 0;

int bytes_vertex_streamed = 0;
int bytes_index_streamed = 0;
int bytes_uniform_streamed = 0;

int num_triangles_clipped = 0;
int num_triangles_in = 0;
int num_triangles_rejected = 0;
int num_triangles_culled = 0;
int num_drawn_objects = 0;
int rasterized_pixels = 0;
int num_triangles_drawn = 0;
int num_vertices_loaded = 0;
int tev_pixels_in = 0;
int tev_pixels_out = 0;

int num_efb_peeks = 0;
int num_efb_pokes = 0;

int num_draw_done = 0;
int num_token = 0;
int num_token_int = 0;
};
ThisFrame this_frame;
void ResetFrame();
@@ -28,21 +28,21 @@ struct PresentInfo
};

// The number of (unique) frames since the emulated console booted
u64 frame_count;
u64 frame_count = 0;

// The number of presents since the video backend was initialized.
// never goes backwards.
u64 present_count;
u64 present_count = 0;

// The frame is identical to the previous frame
PresentReason reason;
PresentReason reason = PresentReason::Immediate;

// The exact emulated time of the when real hardware would have presented this frame
// FIXME: Immediate should predict the timestamp of this present
u64 emulated_timestamp;
u64 emulated_timestamp = 0;

// TODO:
// u64 intended_present_time;
// u64 intended_present_time = 0;

// AfterPresent only: The actual time the frame was presented
u64 actual_present_time = 0;