Compile fixes for GCC

This commit is contained in:
Connor McLaughlin
2019-10-22 23:07:51 +10:00
parent dc7b72b156
commit a76ec6fc19
19 changed files with 47 additions and 52 deletions

View File

@ -229,4 +229,4 @@ private:
String m_tty_line_buffer;
};
#include "bus.inl"
#include "bus.inl"

View File

@ -48,8 +48,8 @@ void CDROM::SoftReset()
m_location_pending = false;
m_filter_file_number = 0;
m_filter_channel_number = 0;
m_last_sector_header = {};
m_last_sector_subheader = {};
std::memset(&m_last_sector_header, 0, sizeof(m_last_sector_header));
std::memset(&m_last_sector_subheader, 0, sizeof(m_last_sector_subheader));
m_next_cd_audio_volume_matrix[0][0] = 0x80;
m_next_cd_audio_volume_matrix[0][1] = 0x00;
@ -95,8 +95,8 @@ bool CDROM::DoState(StateWrapper& sw)
sw.Do(&m_location_pending);
sw.Do(&m_filter_file_number);
sw.Do(&m_filter_channel_number);
sw.DoPOD(&m_last_sector_header);
sw.DoPOD(&m_last_sector_subheader);
sw.DoBytes(&m_last_sector_header, sizeof(m_last_sector_header));
sw.DoBytes(&m_last_sector_subheader, sizeof(m_last_sector_subheader));
sw.Do(&m_cd_audio_volume_matrix);
sw.Do(&m_next_cd_audio_volume_matrix);
sw.Do(&m_xa_last_samples);

View File

@ -539,7 +539,7 @@ void Core::Execute()
m_downcount -= 1;
// now executing the instruction we previously fetched
m_current_instruction = m_next_instruction;
m_current_instruction.bits = m_next_instruction.bits;
m_current_instruction_pc = m_regs.pc;
m_current_instruction_in_branch_delay_slot = m_next_instruction_is_branch_delay_slot;
m_current_instruction_was_branch_taken = m_branch_was_taken;
@ -1295,4 +1295,4 @@ void Core::ExecuteCop2Instruction()
}
}
} // namespace CPU
} // namespace CPU

View File

@ -31,7 +31,7 @@ bool DMA::Initialize(System* system, Bus* bus, InterruptController* interrupt_co
void DMA::Reset()
{
m_transfer_in_progress = false;
m_state = {};
std::memset(&m_state, 0, sizeof(m_state));
m_DPCR.bits = 0x07654321;
m_DICR.bits = 0;
}

View File

@ -6,9 +6,12 @@
#include "stb_image_write.h"
#include "system.h"
#include "timers.h"
#include <cmath>
#include <imgui.h>
Log_SetChannel(GPU);
const GPU::GP0CommandHandlerTable GPU::s_GP0_command_handler_table = GPU::GenerateGP0CommandHandlerTable();
GPU::GPU() = default;
GPU::~GPU() = default;
@ -32,7 +35,7 @@ void GPU::SoftReset()
m_GPUSTAT.bits = 0x14802000;
m_drawing_area = {};
m_drawing_offset = {};
m_crtc_state = {};
std::memset(&m_crtc_state, 0, sizeof(m_crtc_state));
m_crtc_state.regs.display_address_start = 0;
m_crtc_state.regs.horizontal_display_range = 0xC60260;
m_crtc_state.regs.vertical_display_range = 0x3FC10;
@ -493,7 +496,7 @@ void GPU::WriteGP0(u32 value)
const u32 command = m_GP0_buffer[0] >> 24;
if ((this->*s_GP0_command_handler_table[command])(command_ptr, static_cast<u32>(m_GP0_buffer.size())))
{
DebugAssert((command_ptr - m_GP0_buffer.data()) == m_GP0_buffer.size());
DebugAssert(static_cast<size_t>(command_ptr - m_GP0_buffer.data()) == m_GP0_buffer.size());
m_GP0_buffer.clear();
}
@ -830,4 +833,4 @@ void GPU::DrawDebugStateWindow()
ImGui::Text("Interrupt Request: %s", m_GPUSTAT.interrupt_request ? "Yes" : "No");
ImGui::Text("DMA Request: %s", m_GPUSTAT.dma_data_request ? "Yes" : "No");
}
}
}

View File

@ -4,6 +4,7 @@
#include "types.h"
#include <array>
#include <deque>
#include <memory>
#include <vector>
class StateWrapper;
@ -355,7 +356,7 @@ protected:
private:
using GP0CommandHandler = bool (GPU::*)(const u32*&, u32);
using GP0CommandHandlerTable = std::array<GP0CommandHandler, 256>;
static constexpr GP0CommandHandlerTable GenerateGP0CommandHandlerTable();
static GP0CommandHandlerTable GenerateGP0CommandHandlerTable();
// Rendering commands, returns false if not enough data is provided
bool HandleUnknownGP0Command(const u32*& command_ptr, u32 command_size);

View File

@ -12,7 +12,7 @@ static constexpr u32 ReplaceZero(u32 value, u32 value_for_zero)
return value == 0 ? value_for_zero : value;
}
constexpr GPU::GP0CommandHandlerTable GPU::GenerateGP0CommandHandlerTable()
GPU::GP0CommandHandlerTable GPU::GenerateGP0CommandHandlerTable()
{
GP0CommandHandlerTable table = {};
for (u32 i = 0; i < static_cast<u32>(table.size()); i++)
@ -45,8 +45,6 @@ constexpr GPU::GP0CommandHandlerTable GPU::GenerateGP0CommandHandlerTable()
return table;
}
constexpr GPU::GP0CommandHandlerTable GPU::s_GP0_command_handler_table = GPU::GenerateGP0CommandHandlerTable();
bool GPU::HandleUnknownGP0Command(const u32*& command_ptr, u32 command_size)
{
const u32 command = *(command_ptr++) >> 24;
@ -85,7 +83,7 @@ bool GPU::HandleSetDrawModeCommand(const u32*& command_ptr, u32 command_size)
// 0..10 bits match GPUSTAT
const u32 MASK = ((1 << 11) - 1);
m_GPUSTAT.bits = (m_GPUSTAT.bits & ~MASK) | param & MASK;
m_GPUSTAT.bits = (m_GPUSTAT.bits & ~MASK) | (param & MASK);
m_GPUSTAT.texture_disable = (param & (1 << 11)) != 0;
m_render_state.texture_x_flip = (param & (1 << 12)) != 0;
m_render_state.texture_y_flip = (param & (1 << 13)) != 0;
@ -337,7 +335,7 @@ bool GPU::HandleCopyRectangleVRAMToCPUCommand(const u32*& command_ptr, u32 comma
if (m_debug_options.dump_vram_to_cpu_copies)
{
DumpVRAMToFile(SmallString::FromFormat("vram_to_cpu_copy_%u.png", s_cpu_to_vram_dump_id++), width, height,
DumpVRAMToFile(SmallString::FromFormat("vram_to_cpu_copy_%u.png", s_vram_to_cpu_dump_id++), width, height,
sizeof(u16) * width, temp.data(), true);
}

View File

@ -78,7 +78,6 @@ void GPU_HW::LoadVertices(RenderCommand rc, u32 num_vertices, const u32* command
m_batch.vertices.push_back(m_batch.vertices.back());
u32 buffer_pos = 1;
const bool textured = rc.texture_enable;
const u32 color = rc.color_for_first_vertex;
const VertexPosition vp{command_ptr[buffer_pos++]};
const s32 pos_left = vp.x;
@ -520,9 +519,9 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices, const u32
const u32 max_added_vertices = num_vertices + 2;
const bool buffer_overflow = (m_batch.vertices.size() + max_added_vertices) >= MAX_BATCH_VERTEX_COUNT;
const bool rc_changed =
m_batch.render_command_bits != rc.bits && m_batch.transparency_enable != rc_transparency_enable ||
m_batch.render_command_bits != rc.bits && (m_batch.transparency_enable != rc_transparency_enable ||
m_batch.texture_enable != rc_texture_enable || m_batch.texture_blending_enable != rc_texture_blend_enable ||
m_batch.primitive != rc_primitive;
m_batch.primitive != rc_primitive);
const bool restart_line_strip = (rc_primitive == HWRenderBatch::Primitive::LineStrip);
const bool needs_flush =
!IsFlushed() && (m_render_state.IsTextureColorModeChanged() || m_render_state.IsTransparencyModeChanged() ||

View File

@ -515,7 +515,6 @@ void GPU_HW_OpenGL::ReadVRAM(u32 x, u32 y, u32 width, u32 height, void* buffer)
// downscaling to 1xIR.
if (m_resolution_scale > 1)
{
const u32 texture_width = m_vram_texture->GetWidth();
const u32 texture_height = m_vram_texture->GetHeight();
const u32 scaled_x = x * m_resolution_scale;
const u32 scaled_y = y * m_resolution_scale;

View File

@ -50,12 +50,13 @@ void Core::Initialize() {}
void Core::Reset()
{
m_regs = {};
std::memset(&m_regs, 0, sizeof(m_regs));
}
bool Core::DoState(StateWrapper& sw)
{
sw.DoPOD(&m_regs);
sw.DoArray(m_regs.dr32, NUM_DATA_REGS);
sw.DoArray(m_regs.cr32, NUM_CONTROL_REGS);
return !sw.HasError();
}
@ -1045,4 +1046,4 @@ void Core::Execute_GPF(Instruction inst)
m_regs.FLAG.UpdateError();
}
} // namespace GTE
} // namespace GTE

View File

@ -134,7 +134,7 @@ void MDEC::DMAWrite(const u32* words, u32 word_count)
void MDEC::SoftReset()
{
m_status = {};
m_status.bits = 0;
m_enable_dma_in = false;
m_enable_dma_out = false;
m_data_in_fifo.Clear();
@ -766,4 +766,4 @@ void MDEC::DrawDebugWindow()
}
ImGui::End();
}
}

View File

@ -205,7 +205,7 @@ void SPU::WriteRegister(u32 offset, u16 value)
{
Log_DebugPrintf("SPU control register <- 0x%04X", ZeroExtend32(value));
m_SPUCNT.bits = value;
m_SPUSTAT.mode = m_SPUCNT.mode;
m_SPUSTAT.mode = m_SPUCNT.mode.GetValue();
m_SPUSTAT.dma_read_write_request = m_SPUCNT.ram_transfer_mode >= RAMTransferMode::DMAWrite;
if (!m_SPUCNT.irq9_enable)

View File

@ -361,7 +361,7 @@ void Timers::DrawDebugWindow()
ImGui::NextColumn();
ImGui::Text("%s%s", clock_source_names[i][cs.mode.clock_source], cs.external_counting_enabled ? " (External)" : "");
ImGui::NextColumn();
ImGui::Text("%s", cs.mode.reached_target ? "Target " : "", cs.mode.reached_overflow ? "Overflow" : "");
ImGui::Text("%s%s", cs.mode.reached_target ? "Target " : "", cs.mode.reached_overflow ? "Overflow" : "");
ImGui::NextColumn();
ImGui::PopStyleColor();
}