Add GBA MinMod driver support

This commit is contained in:
Natt Akuma 2024-03-16 14:59:02 +07:00
parent 0b1d2e24d7
commit 2b9dd1caff
17 changed files with 996 additions and 26 deletions

View file

@ -18,6 +18,7 @@
*/
#include "../engine/chipUtils.h"
#include "../engine/platform/gbaminmod.h"
#include "gui.h"
#include "misc/cpp/imgui_stdlib.h"
#include <imgui.h>
@ -363,7 +364,8 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("note: not supported by the VGM format!\nallows wave channel to have double length and 75%% volume");
}
if (CWSliderInt("DAC bit depth (reduces output rate)",&dacDepth,6,9)) {
ImGui::Text("DAC bit depth (reduces output rate):");
if (CWSliderInt("##DACDepth",&dacDepth,6,9)) {
if (dacDepth<6) dacDepth=6;
if (dacDepth>9) dacDepth=9;
altered=true;
@ -431,6 +433,60 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
}
break;
}
case DIV_SYSTEM_GBA_MINMOD: {
supportsCustomRate=false;
int volScale=flags.getInt("volScale",4096);
int mixBufs=flags.getInt("mixBufs",15);
int dacDepth=flags.getInt("dacDepth",9);
int channels=flags.getInt("channels",16);
int sampRate=flags.getInt("sampRate",21845);
ImGui::Text("Volume scale:");
if (CWSliderInt("##VolScale",&volScale,0,32768)) {
if (volScale<0) volScale=0;
if (volScale>32768) volScale=32768;
altered=true;
} rightClickable
ImGui::Text("Mix buffers (allows longer echo delay):");
if (CWSliderInt("##MixBufs",&mixBufs,2,15)) {
if (mixBufs<2) mixBufs=2;
if (mixBufs>16) mixBufs=16;
altered=true;
} rightClickable
ImGui::Text("DAC bit depth (reduces output rate):");
if (CWSliderInt("##DACDepth",&dacDepth,6,9)) {
if (dacDepth<6) dacDepth=6;
if (dacDepth>9) dacDepth=9;
altered=true;
} rightClickable
ImGui::Text("Channel limit:");
if (CWSliderInt("##Channels",&channels,1,16)) {
if (channels<1) channels=1;
if (channels>16) channels=16;
altered=true;
} rightClickable
ImGui::Text("Sample rate:");
if (CWSliderInt("##SampRate",&sampRate,256,65536)) {
if (sampRate<1) sampRate=21845;
if (sampRate>65536) sampRate=65536;
altered=true;
} rightClickable
DivPlatformGBAMinMod* dispatch=(DivPlatformGBAMinMod*)e->getDispatch(chan);
float maxCPU=dispatch->maxCPU*100;
ImGui::Text("Actual sample rate: %d Hz", dispatch->chipClock);
FurnaceGUI::pushWarningColor(maxCPU>90);
ImGui::Text("Max mixer CPU usage: %.0f%%", maxCPU);
FurnaceGUI::popWarningColor();
if (altered) {
e->lockSave([&]() {
flags.set("volScale",volScale);
flags.set("mixBufs",mixBufs);
flags.set("dacDepth",dacDepth);
flags.set("channels",channels);
flags.set("sampRate",sampRate);
});
}
break;
}
case DIV_SYSTEM_OPLL:
case DIV_SYSTEM_OPLL_DRUMS:
case DIV_SYSTEM_VRC7: {