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