dev213 - Merge pull request #1954 from akumanatt/snesveratia

SNES, VERA and TIA additions
This commit is contained in:
tildearrow 2024-06-23 03:52:48 -05:00 committed by GitHub
commit 54e9a31971
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 884 additions and 37 deletions

View file

@ -931,6 +931,7 @@ void FurnaceGUI::doAction(int what) {
sample->loop=prevSample->loop;
sample->loopMode=prevSample->loopMode;
sample->brrEmphasis=prevSample->brrEmphasis;
sample->brrNoFilter=prevSample->brrNoFilter;
sample->dither=prevSample->dither;
sample->depth=prevSample->depth;
if (sample->init(prevSample->samples)) {

View file

@ -249,6 +249,56 @@ void FurnaceGUI::drawExportZSM(bool onWindow) {
}
}
void FurnaceGUI::drawExportTiuna(bool onWindow) {
exitDisabledTimer=1;
ImGui::Text("this is NOT ROM export! (for now)\nfor use with TIunA driver, outputs asm source.");
ImGui::InputText("base song label name", &asmBaseLabel); //TODO validate label
if (ImGui::InputInt("max size in first bank",&tiunaFirstBankSize,1,100)) {
if (tiunaFirstBankSize<0) tiunaFirstBankSize=0;
if (tiunaFirstBankSize>4096) tiunaFirstBankSize=4096;
}
if (ImGui::InputInt("max size in other banks",&tiunaOtherBankSize,1,100)) {
if (tiunaOtherBankSize<16) tiunaOtherBankSize=16;
if (tiunaOtherBankSize>4096) tiunaOtherBankSize=4096;
}
ImGui::Text("chips to export:");
int selected=0;
for (int i=0; i<e->song.systemLen; i++) {
DivSystem sys=e->song.system[i];
bool isTIA=sys==DIV_SYSTEM_TIA;
ImGui::BeginDisabled((!isTIA) || (selected>=1));
ImGui::Checkbox(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),&willExport[i]);
ImGui::EndDisabled();
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) {
if (!isTIA) {
ImGui::SetTooltip("this chip is not supported by the file format!");
} else if (selected>=1) {
ImGui::SetTooltip("only one Atari TIA is supported!");
}
}
if (isTIA && willExport[i]) selected++;
}
if (selected>0) {
if (onWindow) {
ImGui::Separator();
if (ImGui::Button("Cancel",ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup();
ImGui::SameLine();
}
if (ImGui::Button("Export",ImVec2(200.0f*dpiScale,0))) {
openFileDialog(GUI_FILE_EXPORT_TIUNA);
ImGui::CloseCurrentPopup();
}
} else {
ImGui::Text("nothing to export");
if (onWindow) {
ImGui::Separator();
if (ImGui::Button("Cancel",ImVec2(400.0f*dpiScale,0))) ImGui::CloseCurrentPopup();
}
}
}
void FurnaceGUI::drawExportAmigaVal(bool onWindow) {
exitDisabledTimer=1;
@ -372,6 +422,19 @@ void FurnaceGUI::drawExport() {
ImGui::EndTabItem();
}
}
bool hasTiunaCompat=false;
for (int i=0; i<e->song.systemLen; i++) {
if (e->song.system[i]==DIV_SYSTEM_TIA) {
hasTiunaCompat=true;
break;
}
}
if (hasTiunaCompat) {
if (ImGui::BeginTabItem("TIunA")) {
drawExportTiuna(true);
ImGui::EndTabItem();
}
}
int numAmiga=0;
for (int i=0; i<e->song.systemLen; i++) {
if (e->song.system[i]==DIV_SYSTEM_AMIGA) numAmiga++;
@ -406,6 +469,9 @@ void FurnaceGUI::drawExport() {
case GUI_EXPORT_ZSM:
drawExportZSM(true);
break;
case GUI_EXPORT_TIUNA:
drawExportTiuna(true);
break;
case GUI_EXPORT_AMIGA_VAL:
drawExportAmigaVal(true);
break;

View file

@ -1926,6 +1926,15 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
(settings.autoFillSave)?shortName:""
);
break;
case GUI_FILE_EXPORT_TIUNA:
if (!dirExists(workingDirTiunaExport)) workingDirTiunaExport=getHomeDir();
hasOpened=fileDialog->openSave(
"Export TIunA",
{"assembly files", "*.asm"},
workingDirTiunaExport,
dpiScale
);
break;
case GUI_FILE_EXPORT_TEXT:
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
hasOpened=fileDialog->openSave(
@ -4894,6 +4903,9 @@ bool FurnaceGUI::loop() {
case GUI_FILE_EXPORT_ZSM:
workingDirZSMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
case GUI_FILE_EXPORT_TIUNA:
workingDirTiunaExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
break;
case GUI_FILE_EXPORT_ROM:
case GUI_FILE_EXPORT_TEXT:
case GUI_FILE_EXPORT_CMDSTREAM:
@ -5375,6 +5387,27 @@ bool FurnaceGUI::loop() {
}
break;
}
case GUI_FILE_EXPORT_TIUNA: {
SafeWriter* w=e->saveTiuna(willExport,asmBaseLabel.c_str(),tiunaFirstBankSize,tiunaOtherBankSize);
if (w!=NULL) {
FILE* f=ps_fopen(copyOfName.c_str(),"wb");
if (f!=NULL) {
fwrite(w->getFinalBuf(),1,w->size(),f);
fclose(f);
pushRecentSys(copyOfName.c_str());
} else {
showError("could not open file!");
}
w->finish();
delete w;
if (!e->getWarnings().empty()) {
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
}
} else {
showError(fmt::sprintf("Could not write TIunA! (%s)",e->getLastError()));
}
break;
}
case GUI_FILE_EXPORT_ROM:
showError(_("Coming soon!"));
break;
@ -7271,6 +7304,7 @@ void FurnaceGUI::syncState() {
workingDirAudioExport=e->getConfString("lastDirAudioExport",workingDir);
workingDirVGMExport=e->getConfString("lastDirVGMExport",workingDir);
workingDirZSMExport=e->getConfString("lastDirZSMExport",workingDir);
workingDirTiunaExport=e->getConfString("lastDirTiunaExport",workingDir);
workingDirROMExport=e->getConfString("lastDirROMExport",workingDir);
workingDirFont=e->getConfString("lastDirFont",workingDir);
workingDirColors=e->getConfString("lastDirColors",workingDir);
@ -7430,6 +7464,7 @@ void FurnaceGUI::commitState(DivConfig& conf) {
conf.set("lastDirAudioExport",workingDirAudioExport);
conf.set("lastDirVGMExport",workingDirVGMExport);
conf.set("lastDirZSMExport",workingDirZSMExport);
conf.set("lastDirTiunaExport",workingDirTiunaExport);
conf.set("lastDirROMExport",workingDirROMExport);
conf.set("lastDirFont",workingDirFont);
conf.set("lastDirColors",workingDirColors);
@ -7689,6 +7724,9 @@ FurnaceGUI::FurnaceGUI():
vgmExportTrailingTicks(-1),
drawHalt(10),
zsmExportTickRate(60),
asmBaseLabel(""),
tiunaFirstBankSize(3072),
tiunaOtherBankSize(4096-48),
macroPointSize(16),
waveEditStyle(0),
displayInsTypeListMakeInsSample(-1),

View file

@ -591,6 +591,7 @@ enum FurnaceGUIFileDialogs {
GUI_FILE_EXPORT_AUDIO_PER_CHANNEL,
GUI_FILE_EXPORT_VGM,
GUI_FILE_EXPORT_ZSM,
GUI_FILE_EXPORT_TIUNA,
GUI_FILE_EXPORT_CMDSTREAM,
GUI_FILE_EXPORT_TEXT,
GUI_FILE_EXPORT_ROM,
@ -643,6 +644,7 @@ enum FurnaceGUIExportTypes {
GUI_EXPORT_AUDIO=0,
GUI_EXPORT_VGM,
GUI_EXPORT_ZSM,
GUI_EXPORT_TIUNA,
GUI_EXPORT_CMD_STREAM,
GUI_EXPORT_AMIGA_VAL,
GUI_EXPORT_TEXT,
@ -1581,7 +1583,8 @@ class FurnaceGUI {
String workingDir, fileName, clipboard, warnString, errorString, lastError, curFileName, nextFile, sysSearchQuery, newSongQuery, paletteQuery;
String workingDirSong, workingDirIns, workingDirWave, workingDirSample, workingDirAudioExport;
String workingDirVGMExport, workingDirZSMExport, workingDirROMExport, workingDirFont, workingDirColors, workingDirKeybinds;
String workingDirVGMExport, workingDirZSMExport, workingDirTiunaExport, workingDirROMExport;
String workingDirFont, workingDirColors, workingDirKeybinds;
String workingDirLayout, workingDirROM, workingDirTest;
String workingDirConfig;
String mmlString[32];
@ -1618,6 +1621,9 @@ class FurnaceGUI {
int cvHiScore;
int drawHalt;
int zsmExportTickRate;
String asmBaseLabel;
int tiunaFirstBankSize;
int tiunaOtherBankSize;
int macroPointSize;
int waveEditStyle;
int displayInsTypeListMakeInsSample;
@ -2669,6 +2675,7 @@ class FurnaceGUI {
void drawExportAudio(bool onWindow=false);
void drawExportVGM(bool onWindow=false);
void drawExportZSM(bool onWindow=false);
void drawExportTiuna(bool onWindow=false);
void drawExportAmigaVal(bool onWindow=false);
void drawExportText(bool onWindow=false);
void drawExportCommand(bool onWindow=false);

View file

@ -254,12 +254,23 @@ void FurnaceGUI::initSystemPresets() {
CH(DIV_SYSTEM_TIA, 1.0f, 0, "")
}
);
SUB_ENTRY(
"Atari 2600/7800 (with software pitch driver)", {
CH(DIV_SYSTEM_TIA, 1.0f, 0, "softwarePitch=1")
}
);
ENTRY(
"Atari 7800 + Ballblazer/Commando", {
CH(DIV_SYSTEM_TIA, 1.0f, 0, ""),
CH(DIV_SYSTEM_POKEY, 1.0f, 0, "")
}
);
SUB_ENTRY(
"Atari 7800 (with software pitch driver) + Ballblazer/Commando", {
CH(DIV_SYSTEM_TIA, 1.0f, 0, "softwarePitch=1"),
CH(DIV_SYSTEM_POKEY, 1.0f, 0, "")
}
);
ENTRY(
"Atari Lynx", {
CH(DIV_SYSTEM_LYNX, 1.0f, 0, "")
@ -2978,6 +2989,11 @@ void FurnaceGUI::initSystemPresets() {
CH(DIV_SYSTEM_TIA, 1.0f, 0, "")
}
);
SUB_ENTRY(
"Atari TIA (with software pitch driver)", {
CH(DIV_SYSTEM_TIA, 1.0f, 0, "softwarePitch=1")
}
);
ENTRY(
"NES (Ricoh 2A03)", {
CH(DIV_SYSTEM_NES, 1.0f, 0, "")

View file

@ -541,6 +541,19 @@ void FurnaceGUI::drawSampleEdit() {
}
}
}
if (sample->depth!=DIV_SAMPLE_DEPTH_BRR && isThereSNES) {
bool bf=sample->brrNoFilter;
if (ImGui::Checkbox(_("no BRR filters"),&bf)) {
sample->prepareUndo(true);
sample->brrNoFilter=bf;
e->renderSamplesP(curSample);
updateSampleTex=true;
MARK_MODIFIED;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(_("enable this option to not use BRR blocks with filters\nand allow sample offset commands to be used safely."));
}
}
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && e->getSampleFormatMask()&(1L<<DIV_SAMPLE_DEPTH_8BIT)) {
bool di=sample->dither;
if (ImGui::Checkbox(_("8-bit dither"),&di)) {

View file

@ -1061,6 +1061,18 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
case DIV_SYSTEM_TIA: {
bool clockSel=flags.getInt("clockSel",0);
int mixingType=flags.getInt("mixingType",0);
bool softwarePitch=flags.getBool("softwarePitch",false);
bool oldPitch=flags.getBool("oldPitch",false);
ImGui::BeginDisabled(oldPitch);
if (ImGui::Checkbox(_("Software pitch driver"),&softwarePitch)) {
altered=true;
}
ImGui::EndDisabled();
if (ImGui::Checkbox(_("Old pitch table (compatibility)"),&oldPitch)) {
if (oldPitch) softwarePitch=false;
altered=true;
}
ImGui::Text(_("Mixing mode:"));
ImGui::Indent();
@ -1086,6 +1098,8 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
e->lockSave([&]() {
flags.set("clockSel",(int)clockSel);
flags.set("mixingType",mixingType);
flags.set("softwarePitch",softwarePitch);
flags.set("oldPitch",oldPitch);
});
}
break;
@ -2436,12 +2450,33 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
}
break;
}
case DIV_SYSTEM_VERA: {
int chipType=flags.getInt("chipType",1);
ImGui::Text(_("Chip revision:"));
ImGui::Indent();
if (ImGui::RadioButton(_("V 0.3.1"),chipType==0)) {
chipType=0;
altered=true;
}
if (ImGui::RadioButton(_("V 47.0.0 (9-bit volume)"),chipType==1)) {
chipType=1;
altered=true;
}
ImGui::Unindent();
if (altered) {
e->lockSave([&]() {
flags.set("chipType",chipType);
});
}
break;
}
case DIV_SYSTEM_SWAN:
case DIV_SYSTEM_BUBSYS_WSG:
case DIV_SYSTEM_PET:
case DIV_SYSTEM_GA20:
case DIV_SYSTEM_PV1000:
case DIV_SYSTEM_VERA:
case DIV_SYSTEM_C219:
case DIV_SYSTEM_BIFURCATOR:
case DIV_SYSTEM_POWERNOISE: