mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #7770 from ShFil119/loop
Use range loop (if possible)
This commit is contained in:
commit
5c2b6d0626
@ -145,9 +145,9 @@ bool DSPCore_Init(const DSPInitOptions& opts)
|
||||
|
||||
memset(&g_dsp.r, 0, sizeof(g_dsp.r));
|
||||
|
||||
std::fill(std::begin(g_dsp.reg_stack_ptr), std::end(g_dsp.reg_stack_ptr), 0);
|
||||
std::fill(std::begin(g_dsp.reg_stack_ptrs), std::end(g_dsp.reg_stack_ptrs), 0);
|
||||
|
||||
for (auto& stack : g_dsp.reg_stack)
|
||||
for (auto& stack : g_dsp.reg_stacks)
|
||||
std::fill(std::begin(stack), std::end(stack), 0);
|
||||
|
||||
// Fill IRAM with HALT opcodes.
|
||||
|
@ -275,7 +275,7 @@ struct SDSP
|
||||
// Bits are defined in a struct in DSP.cpp.
|
||||
u16 cr;
|
||||
|
||||
u8 reg_stack_ptr[4];
|
||||
u8 reg_stack_ptrs[4];
|
||||
u8 exceptions; // pending exceptions
|
||||
volatile bool external_interrupt_waiting;
|
||||
bool reset_dspjit_codespace;
|
||||
@ -286,7 +286,7 @@ struct SDSP
|
||||
// The real DSP has different depths for the different stacks, but it would
|
||||
// be strange if any ucode relied on stack overflows since on the DSP, when
|
||||
// the stack overflows, you're screwed.
|
||||
u16 reg_stack[4][DSP_STACK_DEPTH];
|
||||
u16 reg_stacks[4][DSP_STACK_DEPTH];
|
||||
|
||||
// For debugging.
|
||||
u32 iram_crc;
|
||||
|
@ -15,16 +15,16 @@ namespace DSP
|
||||
{
|
||||
static void dsp_reg_stack_push(size_t stack_reg)
|
||||
{
|
||||
g_dsp.reg_stack_ptr[stack_reg]++;
|
||||
g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK;
|
||||
g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]] = g_dsp.r.st[stack_reg];
|
||||
g_dsp.reg_stack_ptrs[stack_reg]++;
|
||||
g_dsp.reg_stack_ptrs[stack_reg] &= DSP_STACK_MASK;
|
||||
g_dsp.reg_stacks[stack_reg][g_dsp.reg_stack_ptrs[stack_reg]] = g_dsp.r.st[stack_reg];
|
||||
}
|
||||
|
||||
static void dsp_reg_stack_pop(size_t stack_reg)
|
||||
{
|
||||
g_dsp.r.st[stack_reg] = g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]];
|
||||
g_dsp.reg_stack_ptr[stack_reg]--;
|
||||
g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK;
|
||||
g_dsp.r.st[stack_reg] = g_dsp.reg_stacks[stack_reg][g_dsp.reg_stack_ptrs[stack_reg]];
|
||||
g_dsp.reg_stack_ptrs[stack_reg]--;
|
||||
g_dsp.reg_stack_ptrs[stack_reg] &= DSP_STACK_MASK;
|
||||
}
|
||||
|
||||
void dsp_reg_store_stack(StackRegister stack_reg, u16 val)
|
||||
|
@ -478,9 +478,9 @@ Gen::OpArg DSPEmitter::M_SDSP_r_st(size_t index)
|
||||
return MDisp(R15, static_cast<int>(offsetof(SDSP, r.st[index])));
|
||||
}
|
||||
|
||||
Gen::OpArg DSPEmitter::M_SDSP_reg_stack_ptr(size_t index)
|
||||
Gen::OpArg DSPEmitter::M_SDSP_reg_stack_ptrs(size_t index)
|
||||
{
|
||||
return MDisp(R15, static_cast<int>(offsetof(SDSP, reg_stack_ptr[index])));
|
||||
return MDisp(R15, static_cast<int>(offsetof(SDSP, reg_stack_ptrs[index])));
|
||||
}
|
||||
|
||||
} // namespace DSP::JIT::x64
|
||||
|
@ -283,7 +283,7 @@ private:
|
||||
Gen::OpArg M_SDSP_cr();
|
||||
Gen::OpArg M_SDSP_external_interrupt_waiting();
|
||||
Gen::OpArg M_SDSP_r_st(size_t index);
|
||||
Gen::OpArg M_SDSP_reg_stack_ptr(size_t index);
|
||||
Gen::OpArg M_SDSP_reg_stack_ptrs(size_t index);
|
||||
|
||||
// Ext command helpers
|
||||
void popExtValueToReg();
|
||||
|
@ -13,53 +13,53 @@ using namespace Gen;
|
||||
namespace DSP::JIT::x64
|
||||
{
|
||||
// clobbers:
|
||||
// EAX = (s8)g_dsp.reg_stack_ptr[reg_index]
|
||||
// EAX = (s8)g_dsp.reg_stack_ptrs[reg_index]
|
||||
// expects:
|
||||
void DSPEmitter::dsp_reg_stack_push(StackRegister stack_reg)
|
||||
{
|
||||
const auto reg_index = static_cast<size_t>(stack_reg);
|
||||
|
||||
// g_dsp.reg_stack_ptr[reg_index]++;
|
||||
// g_dsp.reg_stack_ptr[reg_index] &= DSP_STACK_MASK;
|
||||
MOV(8, R(AL), M_SDSP_reg_stack_ptr(reg_index));
|
||||
// g_dsp.reg_stack_ptrs[reg_index]++;
|
||||
// g_dsp.reg_stack_ptrs[reg_index] &= DSP_STACK_MASK;
|
||||
MOV(8, R(AL), M_SDSP_reg_stack_ptrs(reg_index));
|
||||
ADD(8, R(AL), Imm8(1));
|
||||
AND(8, R(AL), Imm8(DSP_STACK_MASK));
|
||||
MOV(8, M_SDSP_reg_stack_ptr(reg_index), R(AL));
|
||||
MOV(8, M_SDSP_reg_stack_ptrs(reg_index), R(AL));
|
||||
|
||||
X64Reg tmp1 = m_gpr.GetFreeXReg();
|
||||
X64Reg tmp2 = m_gpr.GetFreeXReg();
|
||||
// g_dsp.reg_stack[reg_index][g_dsp.reg_stack_ptr[reg_index]] = g_dsp.r[DSP_REG_ST0 + reg_index];
|
||||
// g_dsp.reg_stack[reg_index][g_dsp.reg_stack_ptrs[reg_index]] = g_dsp.r[DSP_REG_ST0 + reg_index];
|
||||
MOV(16, R(tmp1), M_SDSP_r_st(reg_index));
|
||||
MOVZX(64, 8, RAX, R(AL));
|
||||
MOV(64, R(tmp2), ImmPtr(g_dsp.reg_stack[reg_index]));
|
||||
MOV(64, R(tmp2), ImmPtr(g_dsp.reg_stacks[reg_index]));
|
||||
MOV(16, MComplex(tmp2, EAX, SCALE_2, 0), R(tmp1));
|
||||
m_gpr.PutXReg(tmp1);
|
||||
m_gpr.PutXReg(tmp2);
|
||||
}
|
||||
|
||||
// clobbers:
|
||||
// EAX = (s8)g_dsp.reg_stack_ptr[reg_index]
|
||||
// EAX = (s8)g_dsp.reg_stack_ptrs[reg_index]
|
||||
// expects:
|
||||
void DSPEmitter::dsp_reg_stack_pop(StackRegister stack_reg)
|
||||
{
|
||||
const auto reg_index = static_cast<size_t>(stack_reg);
|
||||
|
||||
// g_dsp.r[DSP_REG_ST0 + reg_index] = g_dsp.reg_stack[reg_index][g_dsp.reg_stack_ptr[reg_index]];
|
||||
MOV(8, R(AL), M_SDSP_reg_stack_ptr(reg_index));
|
||||
// g_dsp.r[DSP_REG_ST0 + reg_index] = g_dsp.reg_stack[reg_index][g_dsp.reg_stack_ptrs[reg_index]];
|
||||
MOV(8, R(AL), M_SDSP_reg_stack_ptrs(reg_index));
|
||||
X64Reg tmp1 = m_gpr.GetFreeXReg();
|
||||
X64Reg tmp2 = m_gpr.GetFreeXReg();
|
||||
MOVZX(64, 8, RAX, R(AL));
|
||||
MOV(64, R(tmp2), ImmPtr(g_dsp.reg_stack[reg_index]));
|
||||
MOV(64, R(tmp2), ImmPtr(g_dsp.reg_stacks[reg_index]));
|
||||
MOV(16, R(tmp1), MComplex(tmp2, EAX, SCALE_2, 0));
|
||||
MOV(16, M_SDSP_r_st(reg_index), R(tmp1));
|
||||
m_gpr.PutXReg(tmp1);
|
||||
m_gpr.PutXReg(tmp2);
|
||||
|
||||
// g_dsp.reg_stack_ptr[reg_index]--;
|
||||
// g_dsp.reg_stack_ptr[reg_index] &= DSP_STACK_MASK;
|
||||
// g_dsp.reg_stack_ptrs[reg_index]--;
|
||||
// g_dsp.reg_stack_ptrs[reg_index] &= DSP_STACK_MASK;
|
||||
SUB(8, R(AL), Imm8(1));
|
||||
AND(8, R(AL), Imm8(DSP_STACK_MASK));
|
||||
MOV(8, M_SDSP_reg_stack_ptr(reg_index), R(AL));
|
||||
MOV(8, M_SDSP_reg_stack_ptrs(reg_index), R(AL));
|
||||
}
|
||||
|
||||
void DSPEmitter::dsp_reg_store_stack(StackRegister stack_reg, Gen::X64Reg host_sreg)
|
||||
|
@ -1212,8 +1212,8 @@ void ZeldaAudioRenderer::AddVoice(u16 voice_id)
|
||||
volume_deltas[i] = ((u16)quadrant_volumes[i] * delta) >> shift_factor;
|
||||
|
||||
// Apply master volume to each quadrant.
|
||||
for (size_t i = 0; i < 4; ++i)
|
||||
quadrant_volumes[i] = (quadrant_volumes[i] * vpb.dolby_volume_current) >> shift_factor;
|
||||
for (s16& quadrant_volume : quadrant_volumes)
|
||||
quadrant_volume = (quadrant_volume * vpb.dolby_volume_current) >> shift_factor;
|
||||
|
||||
// Compute reverb volume and ramp deltas.
|
||||
s16 reverb_volumes[4], reverb_volume_deltas[4];
|
||||
@ -1400,9 +1400,9 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb)
|
||||
u32 mask = (1 << shift) - 1;
|
||||
|
||||
u32 pos = vpb->current_pos_frac << shift;
|
||||
for (size_t i = 0; i < buffer->size(); ++i)
|
||||
for (s16& sample : *buffer)
|
||||
{
|
||||
(*buffer)[i] = ((pos >> 16) & mask) ? 0xC000 : 0x4000;
|
||||
sample = ((pos >> 16) & mask) ? 0xC000 : 0x4000;
|
||||
pos += vpb->resampling_ratio;
|
||||
}
|
||||
vpb->current_pos_frac = (pos >> shift) & 0xFFFF;
|
||||
@ -1412,9 +1412,9 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb)
|
||||
case VPB::SRC_SAW_WAVE:
|
||||
{
|
||||
u32 pos = vpb->current_pos_frac;
|
||||
for (size_t i = 0; i < buffer->size(); ++i)
|
||||
for (s16& sample : *buffer)
|
||||
{
|
||||
(*buffer)[i] = pos & 0xFFFF;
|
||||
sample = pos & 0xFFFF;
|
||||
pos += (vpb->resampling_ratio) >> 1;
|
||||
}
|
||||
vpb->current_pos_frac = pos & 0xFFFF;
|
||||
@ -1758,10 +1758,9 @@ void ZeldaAudioRenderer::DecodeAFC(VPB* vpb, s16* dst, size_t block_count)
|
||||
}
|
||||
|
||||
s32 yn1 = *vpb->AFCYN1(), yn2 = *vpb->AFCYN2();
|
||||
for (size_t i = 0; i < 16; ++i)
|
||||
for (s16 nibble : nibbles)
|
||||
{
|
||||
s32 sample =
|
||||
delta * nibbles[i] + yn1 * m_afc_coeffs[idx * 2] + yn2 * m_afc_coeffs[idx * 2 + 1];
|
||||
s32 sample = delta * nibble + yn1 * m_afc_coeffs[idx * 2] + yn2 * m_afc_coeffs[idx * 2 + 1];
|
||||
sample >>= 11;
|
||||
sample = std::clamp(sample, -0x8000, 0x7fff);
|
||||
*dst++ = (s16)sample;
|
||||
|
@ -61,13 +61,13 @@ void DSPLLE::DoState(PointerWrap& p)
|
||||
p.Do(g_dsp.err_pc);
|
||||
#endif
|
||||
p.Do(g_dsp.cr);
|
||||
p.Do(g_dsp.reg_stack_ptr);
|
||||
p.Do(g_dsp.reg_stack_ptrs);
|
||||
p.Do(g_dsp.exceptions);
|
||||
p.Do(g_dsp.external_interrupt_waiting);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (auto& stack : g_dsp.reg_stacks)
|
||||
{
|
||||
p.Do(g_dsp.reg_stack[i]);
|
||||
p.Do(stack);
|
||||
}
|
||||
|
||||
p.Do(g_dsp.step_counter);
|
||||
|
@ -593,14 +593,14 @@ void GCMemcardDirectory::FlushToFile()
|
||||
std::unique_lock<std::mutex> l(m_write_mutex);
|
||||
int errors = 0;
|
||||
Memcard::DEntry invalid;
|
||||
for (u16 i = 0; i < m_saves.size(); ++i)
|
||||
for (Memcard::GCIFile& save : m_saves)
|
||||
{
|
||||
if (m_saves[i].m_dirty)
|
||||
if (save.m_dirty)
|
||||
{
|
||||
if (m_saves[i].m_gci_header.m_gamecode != Memcard::DEntry::UNINITIALIZED_GAMECODE)
|
||||
if (save.m_gci_header.m_gamecode != Memcard::DEntry::UNINITIALIZED_GAMECODE)
|
||||
{
|
||||
m_saves[i].m_dirty = false;
|
||||
if (m_saves[i].m_save_data.empty())
|
||||
save.m_dirty = false;
|
||||
if (save.m_save_data.empty())
|
||||
{
|
||||
// The save's header has been changed but the actual save blocks haven't been read/written
|
||||
// to
|
||||
@ -609,9 +609,9 @@ void GCMemcardDirectory::FlushToFile()
|
||||
"GCI header modified without corresponding save data changes");
|
||||
continue;
|
||||
}
|
||||
if (m_saves[i].m_filename.empty())
|
||||
if (save.m_filename.empty())
|
||||
{
|
||||
std::string default_save_name = m_save_directory + m_saves[i].m_gci_header.GCI_FileName();
|
||||
std::string default_save_name = m_save_directory + save.m_gci_header.GCI_FileName();
|
||||
|
||||
// Check to see if another file is using the same name
|
||||
// This seems unlikely except in the case of file corruption
|
||||
@ -623,41 +623,38 @@ void GCMemcardDirectory::FlushToFile()
|
||||
if (File::Exists(default_save_name))
|
||||
PanicAlertT("Failed to find new filename.\n%s\n will be overwritten",
|
||||
default_save_name.c_str());
|
||||
m_saves[i].m_filename = default_save_name;
|
||||
save.m_filename = default_save_name;
|
||||
}
|
||||
File::IOFile gci(m_saves[i].m_filename, "wb");
|
||||
File::IOFile gci(save.m_filename, "wb");
|
||||
if (gci)
|
||||
{
|
||||
gci.WriteBytes(&m_saves[i].m_gci_header, Memcard::DENTRY_SIZE);
|
||||
gci.WriteBytes(m_saves[i].m_save_data.data(),
|
||||
Memcard::BLOCK_SIZE * m_saves[i].m_save_data.size());
|
||||
gci.WriteBytes(&save.m_gci_header, Memcard::DENTRY_SIZE);
|
||||
gci.WriteBytes(save.m_save_data.data(), Memcard::BLOCK_SIZE * save.m_save_data.size());
|
||||
|
||||
if (gci.IsGood())
|
||||
{
|
||||
Core::DisplayMessage(fmt::format("Wrote save contents to {}", m_saves[i].m_filename),
|
||||
4000);
|
||||
Core::DisplayMessage(fmt::format("Wrote save contents to {}", save.m_filename), 4000);
|
||||
}
|
||||
else
|
||||
{
|
||||
++errors;
|
||||
Core::DisplayMessage(
|
||||
fmt::format("Failed to write save contents to {}", m_saves[i].m_filename), 4000);
|
||||
ERROR_LOG(EXPANSIONINTERFACE, "Failed to save data to %s",
|
||||
m_saves[i].m_filename.c_str());
|
||||
fmt::format("Failed to write save contents to {}", save.m_filename), 4000);
|
||||
ERROR_LOG(EXPANSIONINTERFACE, "Failed to save data to %s", save.m_filename.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_saves[i].m_filename.length() != 0)
|
||||
else if (save.m_filename.length() != 0)
|
||||
{
|
||||
m_saves[i].m_dirty = false;
|
||||
std::string& old_name = m_saves[i].m_filename;
|
||||
save.m_dirty = false;
|
||||
std::string& old_name = save.m_filename;
|
||||
std::string deleted_name = old_name + ".deleted";
|
||||
if (File::Exists(deleted_name))
|
||||
File::Delete(deleted_name);
|
||||
File::Rename(old_name, deleted_name);
|
||||
m_saves[i].m_filename.clear();
|
||||
m_saves[i].m_save_data.clear();
|
||||
m_saves[i].m_used_blocks.clear();
|
||||
save.m_filename.clear();
|
||||
save.m_save_data.clear();
|
||||
save.m_used_blocks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -666,12 +663,11 @@ void GCMemcardDirectory::FlushToFile()
|
||||
// simultaneously
|
||||
// this ensures that the save data for all of the current games gci files are stored in the
|
||||
// savestate
|
||||
const u32 gamecode = Common::swap32(m_saves[i].m_gci_header.m_gamecode.data());
|
||||
if (gamecode != m_game_id && gamecode != 0xFFFFFFFF && !m_saves[i].m_save_data.empty())
|
||||
const u32 gamecode = Common::swap32(save.m_gci_header.m_gamecode.data());
|
||||
if (gamecode != m_game_id && gamecode != 0xFFFFFFFF && !save.m_save_data.empty())
|
||||
{
|
||||
INFO_LOG(EXPANSIONINTERFACE, "Flushing savedata to disk for %s",
|
||||
m_saves[i].m_filename.c_str());
|
||||
m_saves[i].m_save_data.clear();
|
||||
INFO_LOG(EXPANSIONINTERFACE, "Flushing savedata to disk for %s", save.m_filename.c_str());
|
||||
save.m_save_data.clear();
|
||||
}
|
||||
}
|
||||
#if _WRITE_MC_HEADER
|
||||
@ -696,9 +692,9 @@ void GCMemcardDirectory::DoState(PointerWrap& p)
|
||||
int num_saves = (int)m_saves.size();
|
||||
p.Do(num_saves);
|
||||
m_saves.resize(num_saves);
|
||||
for (auto itr = m_saves.begin(); itr != m_saves.end(); ++itr)
|
||||
for (Memcard::GCIFile& save : m_saves)
|
||||
{
|
||||
itr->DoState(p);
|
||||
save.DoState(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,9 +784,9 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||
{
|
||||
const size_t sram_settings_len = sizeof(g_SRAM) - offsetof(Sram, settings);
|
||||
u8 sram[sram_settings_len];
|
||||
for (size_t i = 0; i < sram_settings_len; ++i)
|
||||
for (u8& cell : sram)
|
||||
{
|
||||
packet >> sram[i];
|
||||
packet >> cell;
|
||||
}
|
||||
|
||||
{
|
||||
@ -942,8 +942,8 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||
packet >> header.banner_size;
|
||||
packet >> header.permissions;
|
||||
packet >> header.unk1;
|
||||
for (size_t i = 0; i < header.md5.size(); i++)
|
||||
packet >> header.md5[i];
|
||||
for (u8& byte : header.md5)
|
||||
packet >> byte;
|
||||
packet >> header.unk2;
|
||||
for (size_t i = 0; i < header.banner_size; i++)
|
||||
packet >> header.banner[i];
|
||||
@ -958,11 +958,11 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||
packet >> bk_header.unk1;
|
||||
packet >> bk_header.unk2;
|
||||
packet >> bk_header.total_size;
|
||||
for (size_t i = 0; i < bk_header.unk3.size(); i++)
|
||||
packet >> bk_header.unk3[i];
|
||||
for (u8& byte : bk_header.unk3)
|
||||
packet >> byte;
|
||||
packet >> bk_header.tid;
|
||||
for (size_t i = 0; i < bk_header.mac_address.size(); i++)
|
||||
packet >> bk_header.mac_address[i];
|
||||
for (u8& byte : bk_header.mac_address)
|
||||
packet >> byte;
|
||||
|
||||
// Files
|
||||
std::vector<WiiSave::Storage::SaveFile> files;
|
||||
|
@ -787,8 +787,8 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
|
||||
u8 size;
|
||||
packet >> map >> size;
|
||||
std::vector<u8> data(size);
|
||||
for (size_t i = 0; i < data.size(); ++i)
|
||||
packet >> data[i];
|
||||
for (u8& byte : data)
|
||||
packet >> byte;
|
||||
|
||||
// If the data is not from the correct player,
|
||||
// then disconnect them.
|
||||
@ -1568,8 +1568,8 @@ bool NetPlayServer::SyncSaveData()
|
||||
// Header
|
||||
pac << sf::Uint64{header->tid};
|
||||
pac << header->banner_size << header->permissions << header->unk1;
|
||||
for (size_t i = 0; i < header->md5.size(); i++)
|
||||
pac << header->md5[i];
|
||||
for (u8 byte : header->md5)
|
||||
pac << byte;
|
||||
pac << header->unk2;
|
||||
for (size_t i = 0; i < header->banner_size; i++)
|
||||
pac << header->banner[i];
|
||||
@ -1578,11 +1578,11 @@ bool NetPlayServer::SyncSaveData()
|
||||
pac << bk_header->size << bk_header->magic << bk_header->ngid << bk_header->number_of_files
|
||||
<< bk_header->size_of_files << bk_header->unk1 << bk_header->unk2
|
||||
<< bk_header->total_size;
|
||||
for (size_t i = 0; i < bk_header->unk3.size(); i++)
|
||||
pac << bk_header->unk3[i];
|
||||
for (u8 byte : bk_header->unk3)
|
||||
pac << byte;
|
||||
pac << sf::Uint64{bk_header->tid};
|
||||
for (size_t i = 0; i < bk_header->mac_address.size(); i++)
|
||||
pac << bk_header->mac_address[i];
|
||||
for (u8 byte : bk_header->mac_address)
|
||||
pac << byte;
|
||||
|
||||
// Files
|
||||
for (const WiiSave::Storage::SaveFile& file : *files)
|
||||
|
@ -331,6 +331,7 @@ void RenderWidget::SetImGuiKeyMap()
|
||||
{ImGuiKey_Z, Qt::Key_Z},
|
||||
}};
|
||||
auto lock = g_renderer->GetImGuiLock();
|
||||
for (auto entry : key_map)
|
||||
ImGui::GetIO().KeyMap[entry[0]] = entry[1] & 0x1FF;
|
||||
|
||||
for (auto [imgui_key, qt_key] : key_map)
|
||||
ImGui::GetIO().KeyMap[imgui_key] = (qt_key & 0x1FF);
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ enum
|
||||
// Current adapter status: detected/not detected/in error (holds the error code)
|
||||
static std::atomic<int> s_status = NO_ADAPTER_DETECTED;
|
||||
static libusb_device_handle* s_handle = nullptr;
|
||||
static u8 s_controller_type[SerialInterface::MAX_SI_CHANNELS] = {
|
||||
static std::array<u8, SerialInterface::MAX_SI_CHANNELS> s_controller_type = {
|
||||
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE,
|
||||
ControllerTypes::CONTROLLER_NONE, ControllerTypes::CONTROLLER_NONE};
|
||||
static u8 s_controller_rumble[4];
|
||||
static std::array<u8, SerialInterface::MAX_SI_CHANNELS> s_controller_rumble{};
|
||||
|
||||
static std::mutex s_mutex;
|
||||
static u8 s_controller_payload[37];
|
||||
@ -236,11 +236,8 @@ static void Setup()
|
||||
if (s_status < 0)
|
||||
s_status = NO_ADAPTER_DETECTED;
|
||||
|
||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++)
|
||||
{
|
||||
s_controller_type[i] = ControllerTypes::CONTROLLER_NONE;
|
||||
s_controller_rumble[i] = 0;
|
||||
}
|
||||
s_controller_type.fill(ControllerTypes::CONTROLLER_NONE);
|
||||
s_controller_rumble.fill(0);
|
||||
|
||||
s_libusb_context.GetDeviceList([](libusb_device* device) {
|
||||
if (CheckDeviceAccess(device))
|
||||
@ -395,8 +392,7 @@ static void Reset()
|
||||
s_adapter_output_thread.join();
|
||||
}
|
||||
|
||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; i++)
|
||||
s_controller_type[i] = ControllerTypes::CONTROLLER_NONE;
|
||||
s_controller_type.fill(ControllerTypes::CONTROLLER_NONE);
|
||||
|
||||
s_status = NO_ADAPTER_DETECTED;
|
||||
|
||||
|
@ -45,9 +45,9 @@ void Init()
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
for (int i = 0; i < NUM_OBJECT_BUFFERS; i++)
|
||||
for (auto& slot : ObjectBuffer)
|
||||
{
|
||||
delete[] ObjectBuffer[i];
|
||||
delete[] slot;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,8 @@ Renderer::Renderer(std::unique_ptr<SwapChain> swap_chain, float backbuffer_scale
|
||||
m_swap_chain(std::move(swap_chain))
|
||||
{
|
||||
UpdateActiveConfig();
|
||||
for (size_t i = 0; i < m_sampler_states.size(); i++)
|
||||
m_sampler_states[i].hex = RenderState::GetPointSamplerState().hex;
|
||||
for (SamplerState& m_sampler_state : m_sampler_states)
|
||||
m_sampler_state.hex = RenderState::GetPointSamplerState().hex;
|
||||
}
|
||||
|
||||
Renderer::~Renderer() = default;
|
||||
|
Loading…
Reference in New Issue
Block a user