mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-18 09:10:05 +00:00
Minor cleanup
This commit is contained in:
parent
3d1180ee21
commit
232b52a27d
@ -1,4 +1,3 @@
|
|||||||
#pragma optimize("", off)
|
|
||||||
// Copyright 2017 Citra Emulator Project
|
// Copyright 2017 Citra Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
@ -15,11 +14,7 @@
|
|||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
|
|
||||||
DspInterface::DspInterface() = default;
|
DspInterface::DspInterface() = default;
|
||||||
DspInterface::~DspInterface() {
|
DspInterface::~DspInterface() = default;
|
||||||
LOG_WARNING(Audio_DSP, "c1");
|
|
||||||
sink.reset();
|
|
||||||
LOG_WARNING(Audio_DSP, "c2");
|
|
||||||
}
|
|
||||||
|
|
||||||
void DspInterface::SetSink(const std::string& sink_id, const std::string& audio_device) {
|
void DspInterface::SetSink(const std::string& sink_id, const std::string& audio_device) {
|
||||||
sink = CreateSinkFromID(Settings::values.sink_id, Settings::values.audio_device_id);
|
sink = CreateSinkFromID(Settings::values.sink_id, Settings::values.audio_device_id);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#pragma optimize("", off)
|
|
||||||
// Copyright 2017 Citra Emulator Project
|
// Copyright 2017 Citra Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
@ -149,11 +148,8 @@ DspHle::Impl::Impl(DspHle& parent_, Memory::MemorySystem& memory) : parent(paren
|
|||||||
}
|
}
|
||||||
|
|
||||||
DspHle::Impl::~Impl() {
|
DspHle::Impl::~Impl() {
|
||||||
LOG_WARNING(Audio_DSP, "b1");
|
|
||||||
Core::Timing& timing = Core::System::GetInstance().CoreTiming();
|
Core::Timing& timing = Core::System::GetInstance().CoreTiming();
|
||||||
LOG_WARNING(Audio_DSP, "b2");
|
|
||||||
timing.UnscheduleEvent(tick_event, 0);
|
timing.UnscheduleEvent(tick_event, 0);
|
||||||
LOG_WARNING(Audio_DSP, "b3");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DspState DspHle::Impl::GetDspState() const {
|
DspState DspHle::Impl::GetDspState() const {
|
||||||
@ -452,12 +448,7 @@ void DspHle::Impl::AudioTickCallback(s64 cycles_late) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DspHle::DspHle(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>(*this, memory)) {}
|
DspHle::DspHle(Memory::MemorySystem& memory) : impl(std::make_unique<Impl>(*this, memory)) {}
|
||||||
DspHle::~DspHle() {
|
DspHle::~DspHle() = default;
|
||||||
|
|
||||||
LOG_WARNING(Audio_DSP, "a1");
|
|
||||||
impl.reset();
|
|
||||||
LOG_WARNING(Audio_DSP, "a2");
|
|
||||||
}
|
|
||||||
|
|
||||||
u16 DspHle::RecvData(u32 register_number) {
|
u16 DspHle::RecvData(u32 register_number) {
|
||||||
return impl->RecvData(register_number);
|
return impl->RecvData(register_number);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#pragma optimize("", off)
|
|
||||||
// Copyright 2014 Citra Emulator Project
|
// Copyright 2014 Citra Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
@ -313,7 +312,7 @@ void System::Reschedule() {
|
|||||||
System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mode, u8 n3ds_mode) {
|
System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mode, u8 n3ds_mode) {
|
||||||
LOG_DEBUG(HW_Memory, "initialized OK");
|
LOG_DEBUG(HW_Memory, "initialized OK");
|
||||||
|
|
||||||
std::size_t num_cores = 2;
|
u32 num_cores = 2;
|
||||||
if (Settings::values.is_new_3ds) {
|
if (Settings::values.is_new_3ds) {
|
||||||
num_cores = 4;
|
num_cores = 4;
|
||||||
}
|
}
|
||||||
@ -327,19 +326,19 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
|
|||||||
|
|
||||||
if (Settings::values.use_cpu_jit) {
|
if (Settings::values.use_cpu_jit) {
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#ifdef ARCHITECTURE_x86_64
|
||||||
for (std::size_t i = 0; i < num_cores; ++i) {
|
for (u32 i = 0; i < num_cores; ++i) {
|
||||||
cpu_cores.push_back(
|
cpu_cores.push_back(
|
||||||
std::make_shared<ARM_Dynarmic>(this, *memory, USER32MODE, i, timing->GetTimer(i)));
|
std::make_shared<ARM_Dynarmic>(this, *memory, USER32MODE, i, timing->GetTimer(i)));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for (std::size_t i = 0; i < num_cores; ++i) {
|
for (u32 i = 0; i < num_cores; ++i) {
|
||||||
cpu_cores.push_back(
|
cpu_cores.push_back(
|
||||||
std::make_shared<ARM_DynCom>(this, *memory, USER32MODE, i, timing->GetTimer(i)));
|
std::make_shared<ARM_DynCom>(this, *memory, USER32MODE, i, timing->GetTimer(i)));
|
||||||
}
|
}
|
||||||
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
|
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
for (std::size_t i = 0; i < num_cores; ++i) {
|
for (u32 i = 0; i < num_cores; ++i) {
|
||||||
cpu_cores.push_back(
|
cpu_cores.push_back(
|
||||||
std::make_shared<ARM_DynCom>(this, *memory, USER32MODE, i, timing->GetTimer(i)));
|
std::make_shared<ARM_DynCom>(this, *memory, USER32MODE, i, timing->GetTimer(i)));
|
||||||
}
|
}
|
||||||
@ -541,26 +540,36 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
|
|||||||
bool should_flush = !Archive::is_loading::value;
|
bool should_flush = !Archive::is_loading::value;
|
||||||
Memory::RasterizerClearAll(should_flush);
|
Memory::RasterizerClearAll(should_flush);
|
||||||
ar&* timing.get();
|
ar&* timing.get();
|
||||||
for (int i = 0; i < num_cores; i++) {
|
for (u32 i = 0; i < num_cores; i++) {
|
||||||
ar&* cpu_cores[i].get();
|
ar&* cpu_cores[i].get();
|
||||||
}
|
}
|
||||||
ar&* service_manager.get();
|
ar&* service_manager.get();
|
||||||
ar& GPU::g_regs;
|
ar& GPU::g_regs;
|
||||||
ar& LCD::g_regs;
|
ar& LCD::g_regs;
|
||||||
if (!dynamic_cast<AudioCore::DspHle*>(dsp_core.get())) {
|
|
||||||
throw std::runtime_error("Only HLE audio supported");
|
// NOTE: DSP doesn't like being destroyed and recreated. So instead we do an inline
|
||||||
|
// serialization; this means that the DSP Settings need to match for loading to work.
|
||||||
|
bool dsp_type = Settings::values.enable_dsp_lle;
|
||||||
|
ar& dsp_type;
|
||||||
|
if (dsp_type != Settings::values.enable_dsp_lle) {
|
||||||
|
throw std::runtime_error(
|
||||||
|
"Incorrect DSP type - please change this in Settings before loading");
|
||||||
}
|
}
|
||||||
ar&* dynamic_cast<AudioCore::DspHle*>(dsp_core.get());
|
auto dsp_hle = dynamic_cast<AudioCore::DspHle*>(dsp_core.get());
|
||||||
|
if (dsp_hle) {
|
||||||
|
ar&* dsp_hle;
|
||||||
|
}
|
||||||
|
auto dsp_lle = dynamic_cast<AudioCore::DspLle*>(dsp_core.get());
|
||||||
|
if (dsp_lle) {
|
||||||
|
ar&* dsp_lle;
|
||||||
|
}
|
||||||
|
|
||||||
ar&* memory.get();
|
ar&* memory.get();
|
||||||
ar&* kernel.get();
|
ar&* kernel.get();
|
||||||
|
|
||||||
// This needs to be set from somewhere - might as well be here!
|
// This needs to be set from somewhere - might as well be here!
|
||||||
if (Archive::is_loading::value) {
|
if (Archive::is_loading::value) {
|
||||||
Service::GSP::SetGlobalModule(*this);
|
Service::GSP::SetGlobalModule(*this);
|
||||||
|
|
||||||
memory->SetDSP(*dsp_core);
|
|
||||||
// dsp_core->SetSink(Settings::values.sink_id, Settings::values.audio_device_id);
|
|
||||||
dsp_core->EnableStretching(Settings::values.enable_audio_stretching);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ std::size_t GetNameSize(const std::string& name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LayeredFS::PrepareBuildDirectory(Directory& current) {
|
void LayeredFS::PrepareBuildDirectory(Directory& current) {
|
||||||
directory_metadata_offset_map.emplace(¤t, current_directory_offset);
|
directory_metadata_offset_map.emplace(¤t, static_cast<u32>(current_directory_offset));
|
||||||
directory_list.emplace_back(¤t);
|
directory_list.emplace_back(¤t);
|
||||||
current_directory_offset += sizeof(DirectoryMetadata) + GetNameSize(current.name);
|
current_directory_offset += sizeof(DirectoryMetadata) + GetNameSize(current.name);
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ void LayeredFS::PrepareBuildFile(File& current) {
|
|||||||
if (current.relocation.type == 3) { // Deleted files are not counted
|
if (current.relocation.type == 3) { // Deleted files are not counted
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
file_metadata_offset_map.emplace(¤t, current_file_offset);
|
file_metadata_offset_map.emplace(¤t, static_cast<u32>(current_file_offset));
|
||||||
file_list.emplace_back(¤t);
|
file_list.emplace_back(¤t);
|
||||||
current_file_offset += sizeof(FileMetadata) + GetNameSize(current.name);
|
current_file_offset += sizeof(FileMetadata) + GetNameSize(current.name);
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ void LayeredFS::BuildDirectories() {
|
|||||||
|
|
||||||
// Write metadata and name
|
// Write metadata and name
|
||||||
std::u16string u16name = Common::UTF8ToUTF16(directory->name);
|
std::u16string u16name = Common::UTF8ToUTF16(directory->name);
|
||||||
metadata.name_length = u16name.size() * 2;
|
metadata.name_length = static_cast<u32_le>(u16name.size() * 2);
|
||||||
|
|
||||||
std::memcpy(directory_metadata_table.data() + written, &metadata, sizeof(metadata));
|
std::memcpy(directory_metadata_table.data() + written, &metadata, sizeof(metadata));
|
||||||
written += sizeof(metadata);
|
written += sizeof(metadata);
|
||||||
@ -418,7 +418,7 @@ void LayeredFS::BuildFiles() {
|
|||||||
|
|
||||||
// Write metadata and name
|
// Write metadata and name
|
||||||
std::u16string u16name = Common::UTF8ToUTF16(file->name);
|
std::u16string u16name = Common::UTF8ToUTF16(file->name);
|
||||||
metadata.name_length = u16name.size() * 2;
|
metadata.name_length = static_cast<u32_le>(u16name.size() * 2);
|
||||||
|
|
||||||
std::memcpy(file_metadata_table.data() + written, &metadata, sizeof(metadata));
|
std::memcpy(file_metadata_table.data() + written, &metadata, sizeof(metadata));
|
||||||
written += sizeof(metadata);
|
written += sizeof(metadata);
|
||||||
|
Loading…
Reference in New Issue
Block a user