prepare to add ROM export framework

This commit is contained in:
tildearrow 2023-03-13 04:20:54 -05:00
parent ad960697dc
commit 6663fc274d
9 changed files with 132 additions and 15 deletions

View File

@ -488,6 +488,7 @@ src/engine/waveSynth.cpp
src/engine/vgmOps.cpp
src/engine/zsmOps.cpp
src/engine/zsm.cpp
src/engine/platform/abstract.cpp
src/engine/platform/genesis.cpp
src/engine/platform/genesisext.cpp
@ -550,6 +551,8 @@ src/engine/platform/sm8521.cpp
src/engine/platform/pv1000.cpp
src/engine/platform/pcmdac.cpp
src/engine/platform/dummy.cpp
src/engine/export/abstract.cpp
)
if (USE_SNDFILE)

View File

@ -9,12 +9,12 @@ do not assume this is the actual ROM export! it is nothing more than a register
enable the setting in Furnace to unlock the export option by adding this to furnace.cfg:
```
iCannotWait=true
iCannotWait=1
```
go to file > export Amiga validation data...
put sample.bin and seq.bin in this directory.
put sample.bin, seq.bin and wave.bin in this directory.
compile with vasm:

View File

@ -23,6 +23,7 @@
#include "instrument.h"
#include "song.h"
#include "dispatch.h"
#include "export.h"
#include "dataErrors.h"
#include "safeWriter.h"
#include "../audio/taAudio.h"
@ -531,7 +532,7 @@ class DivEngine {
SafeWriter* saveFur(bool notPrimary=false);
// build a ROM file (TODO).
// specify system to build ROM for.
SafeWriter* buildROM(int sys);
std::vector<DivROMExportOutput> buildROM(int sys);
// dump to VGM.
// set trailingTicks to:
// - 0 to add one tick of trailing

63
src/engine/export.h Normal file
View File

@ -0,0 +1,63 @@
/**
* Furnace Tracker - multi-system chiptune tracker
* Copyright (C) 2021-2023 tildearrow and contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _EXPORT_H
#define _EXPORT_H
#include "song.h"
#include <vector>
class DivEngine;
enum DivROMExportOptions {
DIV_ROM_ABSTRACT=0,
DIV_ROM_AMIGA_VALIDATION,
DIV_ROM_MAX
};
struct DivROMExportOutput {
String name;
SafeWriter* data;
DivROMExportOutput(String n, SafeWriter* d):
name(n),
data(d) {}
DivROMExportOutput():
name(""),
data(NULL) {}
};
class DivROMExport {
const char* name;
const char* author;
const char* description;
DivSystem requisites[32];
int requisitesLen;
bool multiOutput;
public:
virtual std::vector<DivROMExportOutput> go(DivEngine* e);
DivROMExport(const char* n, const char* auth, const char* desc):
name(n),
author(auth),
description(desc) {}
};
#endif

View File

@ -0,0 +1,26 @@
/**
* Furnace Tracker - multi-system chiptune tracker
* Copyright (C) 2021-2023 tildearrow and contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "../export.h"
#include "../../ta-log.h"
std::vector<DivROMExportOutput> go(DivEngine* e) {
logW("what's this? the null ROM export?");
return std::vector<DivROMExportOutput>();
}

View File

View File

View File

@ -213,6 +213,10 @@ void DivPlatformAmiga::rWrite(unsigned short addr, unsigned short val) {
//logV("%.3x = %.4x",addr,val);
regPool[addr>>1]=val;
if (!skipRegisterWrites && dumpWrites) {
addWrite(addr,val);
}
switch (addr&0x1fe) {
case 0x96: { // DMACON
if (val&32768) {

View File

@ -3668,18 +3668,38 @@ bool FurnaceGUI::loop() {
}
if (numZSMCompat > 0) {
if (ImGui::BeginMenu("export ZSM...")) {
ImGui::Text("Commander X16 Zsound Music File");
if (ImGui::InputInt("Tick Rate (Hz)",&zsmExportTickRate,1,2)) {
if (zsmExportTickRate<1) zsmExportTickRate=1;
if (zsmExportTickRate>44100) zsmExportTickRate=44100;
}
ImGui::Checkbox("loop",&zsmExportLoop);
ImGui::SameLine();
if (ImGui::Button("Begin Export")) {
openFileDialog(GUI_FILE_EXPORT_ZSM);
ImGui::CloseCurrentPopup();
}
ImGui::EndMenu();
ImGui::Text("Commander X16 Zsound Music File");
if (ImGui::InputInt("Tick Rate (Hz)",&zsmExportTickRate,1,2)) {
if (zsmExportTickRate<1) zsmExportTickRate=1;
if (zsmExportTickRate>44100) zsmExportTickRate=44100;
}
ImGui::Checkbox("loop",&zsmExportLoop);
ImGui::SameLine();
if (ImGui::Button("Begin Export")) {
openFileDialog(GUI_FILE_EXPORT_ZSM);
ImGui::CloseCurrentPopup();
}
ImGui::EndMenu();
}
}
int numAmiga=0;
for (int i=0; i<e->song.systemLen; i++) {
if (e->song.system[i]==DIV_SYSTEM_AMIGA) numAmiga++;
}
if (numAmiga && settings.iCannotWait) {
if (ImGui::BeginMenu("export Amiga validation data...")) {
ImGui::Text(
"this is NOT ROM export! only use for making sure the\n"
"Furnace Amiga emulator is working properly by\n"
"comparing it with real Amiga output."
);
ImGui::Text("Directory");
ImGui::SameLine();
ImGui::InputText("##AVDPath",&workingDirROMExport);
if (ImGui::Button("Bake Data")) {
ImGui::CloseCurrentPopup();
}
ImGui::EndMenu();
}
}
if (ImGui::BeginMenu("export command stream...")) {