Merge branch 'master' into more-dsp

This commit is contained in:
wheremyfoodat 2024-11-20 02:40:20 +02:00
commit 33f45cf1f5
13 changed files with 83 additions and 42 deletions

View file

@ -27,8 +27,8 @@ void MiniAudioDevice::init(Samples& samples, bool safe) {
// TODO: Make backend selectable here
found = true;
//count = 1;
//backends[0] = backend;
// count = 1;
// backends[0] = backend;
}
if (!found) {
@ -81,8 +81,8 @@ void MiniAudioDevice::init(Samples& samples, bool safe) {
deviceConfig.playback.format = ma_format_s16;
deviceConfig.playback.channels = channelCount;
deviceConfig.sampleRate = sampleRate;
//deviceConfig.periodSizeInFrames = 64;
//deviceConfig.periods = 16;
// deviceConfig.periodSizeInFrames = 64;
// deviceConfig.periods = 16;
deviceConfig.pUserData = this;
deviceConfig.aaudio.usage = ma_aaudio_usage_game;
deviceConfig.wasapi.noAutoConvertSRC = true;
@ -130,7 +130,7 @@ void MiniAudioDevice::start() {
void MiniAudioDevice::stop() {
if (!initialized) {
Helpers::warn("MiniAudio device not initialized, can't start");
Helpers::warn("MiniAudio device not initialized, can't stop");
return;
}
@ -139,6 +139,17 @@ void MiniAudioDevice::stop() {
if (ma_device_stop(&device) != MA_SUCCESS) {
Helpers::warn("Failed to stop audio device");
}
}
}
}
void MiniAudioDevice::close() {
stop();
if (initialized) {
initialized = false;
ma_device_uninit(&device);
ma_context_uninit(&context);
}
}

View file

@ -2,7 +2,10 @@
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include "helpers.hpp"
@ -15,6 +18,19 @@ namespace Crypto {
return;
}
auto splitString = [](const std::string& s, const char c) -> std::vector<std::string> {
std::istringstream tmp(s);
std::vector<std::string> result(1);
while (std::getline(tmp, *result.rbegin(), c)) {
result.emplace_back();
}
// Remove temporary slot
result.pop_back();
return result;
};
while (!file.eof()) {
std::string line;
std::getline(file, line);
@ -24,7 +40,7 @@ namespace Crypto {
continue;
}
const auto parts = Helpers::split(line, '=');
const auto parts = splitString(line, '=');
if (parts.size() != 2) {
Helpers::warn("Keys: Failed to parse %s", line.c_str());
continue;

View file

@ -50,6 +50,7 @@ Emulator::Emulator()
Emulator::~Emulator() {
config.save();
lua.close();
audioDevice.close();
#ifdef PANDA3DS_ENABLE_DISCORD_RPC
discordRpc.stop();
@ -249,7 +250,7 @@ bool Emulator::loadROM(const std::filesystem::path& path) {
success = loadELF(path);
else if (extension == ".3ds" || extension == ".cci")
success = loadNCSD(path, ROMType::NCSD);
else if (extension == ".cxi" || extension == ".app")
else if (extension == ".cxi" || extension == ".app" || extension == ".ncch")
success = loadNCSD(path, ROMType::CXI);
else if (extension == ".3dsx")
success = load3DSX(path);
@ -442,4 +443,4 @@ void Emulator::loadRenderdoc() {
std::string capturePath = (std::filesystem::current_path() / "RenderdocCaptures").generic_string();
Renderdoc::loadRenderdoc();
Renderdoc::setOutputDir(capturePath, "");
}
}

View file

@ -189,7 +189,7 @@ void MainWindow::swapEmuBuffer() {
void MainWindow::selectROM() {
auto path = QFileDialog::getOpenFileName(
this, tr("Select 3DS ROM to load"), QString::fromStdU16String(emu->getConfig().defaultRomPath.u16string()),
tr("Nintendo 3DS ROMs (*.3ds *.cci *.cxi *.app *.3dsx *.elf *.axf)")
tr("Nintendo 3DS ROMs (*.3ds *.cci *.cxi *.app *.ncch *.3dsx *.elf *.axf)")
);
if (!path.isEmpty()) {