prepare more stuff

This commit is contained in:
tildearrow 2024-08-13 04:10:03 -05:00
parent 1bdcbf95d3
commit 45eab67fd4
5 changed files with 95 additions and 9 deletions

View file

@ -693,6 +693,7 @@ src/engine/configEngine.cpp
src/engine/dispatchContainer.cpp
src/engine/engine.cpp
src/engine/export.cpp
src/engine/exportDef.cpp
src/engine/fileOpsIns.cpp
src/engine/fileOpsSample.cpp
src/engine/filter.cpp

View file

@ -518,6 +518,7 @@ class DivEngine {
static DivSysDef* sysDefs[DIV_MAX_CHIP_DEFS];
static DivSystem sysFileMapFur[DIV_MAX_CHIP_DEFS];
static DivSystem sysFileMapDMF[DIV_MAX_CHIP_DEFS];
static DivROMExportDef* romExportDefs[DIV_ROM_MAX];
DivCSPlayer* cmdStreamInt;
@ -624,6 +625,7 @@ class DivEngine {
bool deinitAudioBackend(bool dueToSwitchMaster=false);
void registerSystems();
void registerROMExports();
void initSongWithDesc(const char* description, bool inBase64=true, bool oldVol=false);
void exchangeIns(int one, int two);
@ -884,6 +886,9 @@ class DivEngine {
// get sys definition
const DivSysDef* getSystemDef(DivSystem sys);
// get ROM export definition
const DivROMExportDef* getROMExportDef(DivROMExportOptions opt);
// convert sample rate format
int fileToDivRate(int frate);
int divToFileRate(int drate);
@ -1466,6 +1471,7 @@ class DivEngine {
memset(pitchTable,0,4096*sizeof(int));
memset(effectSlotMap,-1,4096*sizeof(short));
memset(sysDefs,0,DIV_MAX_CHIP_DEFS*sizeof(void*));
memset(romExportDefs,0,DIV_ROM_MAX*sizeof(void*));
memset(walked,0,8192);
memset(oscBuf,0,DIV_MAX_OUTPUTS*(sizeof(float*)));
memset(exportChannelMask,1,DIV_MAX_CHANS*sizeof(bool));

View file

@ -29,6 +29,8 @@ class DivEngine;
enum DivROMExportOptions {
DIV_ROM_ABSTRACT=0,
DIV_ROM_AMIGA_VALIDATION,
DIV_ROM_ZSM,
DIV_ROM_TIUNA,
DIV_ROM_MAX
};
@ -67,24 +69,30 @@ class DivROMExport {
virtual ~DivROMExport() {}
};
enum DivROMExportReqPolicy {
// exactly these chips.
DIV_REQPOL_EXACT=0,
// specified chips must be present but any amount of them is acceptable.
DIV_REQPOL_ANY,
// at least one of the specified chips.
DIV_REQPOL_LAX
};
struct DivROMExportDef {
const char* name;
const char* author;
const char* description;
DivSystem requisites[32];
int requisitesLen;
std::vector<DivSystem> requisites;
bool multiOutput;
DivROMExportReqPolicy requisitePolicy;
DivROMExportDef(const char* n, const char* a, const char* d, std::initializer_list<DivSystem> req, bool multiOut):
DivROMExportDef(const char* n, const char* a, const char* d, std::initializer_list<DivSystem> req, bool multiOut, DivROMExportReqPolicy reqPolicy):
name(n),
author(a),
description(d),
multiOutput(multiOut) {
requisitesLen=0;
memset(requisites,0,32*sizeof(DivSystem));
for (DivSystem i: req) {
requisites[requisitesLen++]=i;
}
multiOutput(multiOut),
requisitePolicy(reqPolicy) {
requisites=req;
}
};

60
src/engine/exportDef.cpp Normal file
View file

@ -0,0 +1,60 @@
/**
* Furnace Tracker - multi-system chiptune tracker
* Copyright (C) 2021-2024 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 "engine.h"
DivROMExportDef* DivEngine::romExportDefs[DIV_ROM_MAX];
const DivROMExportDef* DivEngine::getROMExportDef(DivROMExportOptions opt) {
return romExportDefs[opt];
}
void DivEngine::registerROMExports() {
logD("registering ROM exports...");
romExportDefs[DIV_ROM_AMIGA_VALIDATION]=new DivROMExportDef(
"Amiga Validation", "tildearrow",
"a test export for ensuring Amiga emulation is accurate. do not use!",
{DIV_SYSTEM_AMIGA},
true, DIV_REQPOL_EXACT
);
romExportDefs[DIV_ROM_ZSM]=new DivROMExportDef(
"Commander X16 ZSM", "ZeroByteOrg and MooingLemur",
"Commander X16 Zsound Music File.\n"
"for use with Melodius, Calliope and/or ZSMKit:\n"
"- https://github.com/mooinglemur/zsmkit (development)\n"
"- https://github.com/mooinglemur/melodius (player)\n"
"- https://github.com/ZeroByteOrg/calliope (player)\n",
{
DIV_SYSTEM_YM2151, DIV_SYSTEM_VERA
},
true, DIV_REQPOL_LAX
);
romExportDefs[DIV_ROM_TIUNA]=new DivROMExportDef(
"Atari 2600 (TIunA)", "Natt Akuma",
"advanced driver with software tuning support.\n"
"see https://github.com/AYCEdemo/twin-tiuna for code.",
{
DIV_SYSTEM_TIA
},
true, DIV_REQPOL_ANY
);
}

View file

@ -240,7 +240,18 @@ void FurnaceGUI::drawExportVGM(bool onWindow) {
}
void FurnaceGUI::drawExportROM(bool onWindow) {
exitDisabledTimer=1;
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_ROM);
ImGui::CloseCurrentPopup();
}
}
void FurnaceGUI::drawExportZSM(bool onWindow) {