mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-22 12:35:11 +00:00
add ROM export framework, part 1
This commit is contained in:
parent
6663fc274d
commit
07ed76a63b
8 changed files with 123 additions and 9 deletions
|
@ -473,6 +473,7 @@ src/engine/config.cpp
|
|||
src/engine/configEngine.cpp
|
||||
src/engine/dispatchContainer.cpp
|
||||
src/engine/engine.cpp
|
||||
src/engine/export.cpp
|
||||
src/engine/fileOps.cpp
|
||||
src/engine/fileOpsIns.cpp
|
||||
src/engine/filter.cpp
|
||||
|
@ -553,6 +554,7 @@ src/engine/platform/pcmdac.cpp
|
|||
src/engine/platform/dummy.cpp
|
||||
|
||||
src/engine/export/abstract.cpp
|
||||
src/engine/export/amigaValidation.cpp
|
||||
)
|
||||
|
||||
if (USE_SNDFILE)
|
||||
|
|
|
@ -2580,6 +2580,10 @@ int DivEngine::divToFileRate(int drate) {
|
|||
return 4;
|
||||
}
|
||||
|
||||
void DivEngine::testFunction() {
|
||||
logI("it works!");
|
||||
}
|
||||
|
||||
int DivEngine::getEffectiveSampleRate(int rate) {
|
||||
if (rate<1) return 0;
|
||||
switch (song.system[0]) {
|
||||
|
|
|
@ -456,6 +456,8 @@ class DivEngine {
|
|||
void reset();
|
||||
void playSub(bool preserveDrift, int goalRow=0);
|
||||
|
||||
void testFunction();
|
||||
|
||||
bool loadDMF(unsigned char* file, size_t len);
|
||||
bool loadFur(unsigned char* file, size_t len);
|
||||
bool loadMod(unsigned char* file, size_t len);
|
||||
|
@ -496,6 +498,10 @@ class DivEngine {
|
|||
// check whether an asset directory is complete
|
||||
void checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries);
|
||||
|
||||
// add every export method here
|
||||
friend class DivROMExport;
|
||||
friend class DivExportAmigaValidation;
|
||||
|
||||
public:
|
||||
DivSong song;
|
||||
DivOrders* curOrders;
|
||||
|
@ -532,7 +538,7 @@ class DivEngine {
|
|||
SafeWriter* saveFur(bool notPrimary=false);
|
||||
// build a ROM file (TODO).
|
||||
// specify system to build ROM for.
|
||||
std::vector<DivROMExportOutput> buildROM(int sys);
|
||||
std::vector<DivROMExportOutput> buildROM(DivROMExportOptions sys);
|
||||
// dump to VGM.
|
||||
// set trailingTicks to:
|
||||
// - 0 to add one tick of trailing
|
||||
|
|
37
src/engine/export.cpp
Normal file
37
src/engine/export.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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 "engine.h"
|
||||
|
||||
#include "export/amigaValidation.h"
|
||||
|
||||
std::vector<DivROMExportOutput> DivEngine::buildROM(DivROMExportOptions sys) {
|
||||
DivROMExport* exporter=NULL;
|
||||
switch (sys) {
|
||||
case DIV_ROM_AMIGA_VALIDATION:
|
||||
exporter=new DivExportAmigaValidation;
|
||||
break;
|
||||
default:
|
||||
exporter=new DivROMExport;
|
||||
break;
|
||||
}
|
||||
std::vector<DivROMExportOutput> ret=exporter->go(this);
|
||||
delete exporter;
|
||||
return ret;
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
#define _EXPORT_H
|
||||
|
||||
#include "song.h"
|
||||
#include <initializer_list>
|
||||
#include <vector>
|
||||
|
||||
class DivEngine;
|
||||
|
@ -45,6 +46,12 @@ struct DivROMExportOutput {
|
|||
};
|
||||
|
||||
class DivROMExport {
|
||||
public:
|
||||
virtual std::vector<DivROMExportOutput> go(DivEngine* e);
|
||||
virtual ~DivROMExport() {}
|
||||
};
|
||||
|
||||
struct DivROMExportDef {
|
||||
const char* name;
|
||||
const char* author;
|
||||
const char* description;
|
||||
|
@ -52,12 +59,17 @@ class DivROMExport {
|
|||
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) {}
|
||||
DivROMExportDef(const char* n, const char* a, const char* d, std::initializer_list<DivSystem> req, bool multiOut):
|
||||
name(n),
|
||||
author(a),
|
||||
description(d),
|
||||
multiOutput(multiOut) {
|
||||
requisitesLen=0;
|
||||
memset(requisites,0,32*sizeof(DivSystem));
|
||||
for (DivSystem i: req) {
|
||||
requisites[requisitesLen++]=i;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../export.h"
|
||||
#include "../../ta-log.h"
|
||||
|
||||
std::vector<DivROMExportOutput> go(DivEngine* e) {
|
||||
std::vector<DivROMExportOutput> DivROMExport::go(DivEngine* e) {
|
||||
logW("what's this? the null ROM export?");
|
||||
return std::vector<DivROMExportOutput>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* 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 "amigaValidation.h"
|
||||
#include "../engine.h"
|
||||
|
||||
std::vector<DivROMExportOutput> DivExportAmigaValidation::go(DivEngine* e) {
|
||||
e->testFunction();
|
||||
|
||||
return std::vector<DivROMExportOutput>();
|
||||
}
|
|
@ -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"
|
||||
|
||||
class DivExportAmigaValidation: public DivROMExport {
|
||||
public:
|
||||
std::vector<DivROMExportOutput> go(DivEngine* e);
|
||||
~DivExportAmigaValidation() {}
|
||||
};
|
Loading…
Reference in a new issue