mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-01 02:22:39 +00:00
Merge branch 'master' of https://github.com/tildearrow/furnace into SID3
This commit is contained in:
commit
b6ecd79ffa
25 changed files with 701 additions and 434 deletions
|
@ -695,6 +695,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
|
||||
|
@ -712,7 +713,6 @@ src/engine/wavOps.cpp
|
|||
src/engine/vgmOps.cpp
|
||||
src/engine/zsmOps.cpp
|
||||
src/engine/zsm.cpp
|
||||
src/engine/tiunaOps.cpp
|
||||
|
||||
src/engine/platform/abstract.cpp
|
||||
src/engine/platform/genesis.cpp
|
||||
|
@ -791,6 +791,7 @@ src/engine/platform/dummy.cpp
|
|||
|
||||
src/engine/export/abstract.cpp
|
||||
src/engine/export/amigaValidation.cpp
|
||||
src/engine/export/tiuna.cpp
|
||||
|
||||
src/engine/effect/abstract.cpp
|
||||
src/engine/effect/dummy.cpp
|
||||
|
|
BIN
demos/multichip/TheOnlyWayIsForward.fur
Normal file
BIN
demos/multichip/TheOnlyWayIsForward.fur
Normal file
Binary file not shown.
BIN
demos/nes/Byte-Sized Bop.fur
Normal file
BIN
demos/nes/Byte-Sized Bop.fur
Normal file
Binary file not shown.
|
@ -3589,6 +3589,12 @@ void DivEngine::synchronized(const std::function<void()>& what) {
|
|||
BUSY_END;
|
||||
}
|
||||
|
||||
void DivEngine::synchronizedSoft(const std::function<void()>& what) {
|
||||
BUSY_BEGIN_SOFT;
|
||||
what();
|
||||
BUSY_END;
|
||||
}
|
||||
|
||||
void DivEngine::lockSave(const std::function<void()>& what) {
|
||||
saveLock.lock();
|
||||
what();
|
||||
|
@ -3916,6 +3922,9 @@ bool DivEngine::preInit(bool noSafeMode) {
|
|||
// register systems
|
||||
if (!systemsRegistered) registerSystems();
|
||||
|
||||
// register ROM exports
|
||||
if (!romExportsRegistered) registerROMExports();
|
||||
|
||||
// TODO: re-enable with a better approach
|
||||
// see issue #1581
|
||||
/*
|
||||
|
|
|
@ -465,6 +465,7 @@ class DivEngine {
|
|||
bool midiIsDirectProgram;
|
||||
bool lowLatency;
|
||||
bool systemsRegistered;
|
||||
bool romExportsRegistered;
|
||||
bool hasLoadedSomething;
|
||||
bool midiOutClock;
|
||||
bool midiOutTime;
|
||||
|
@ -518,6 +519,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 +626,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);
|
||||
|
@ -654,6 +657,7 @@ class DivEngine {
|
|||
// add every export method here
|
||||
friend class DivROMExport;
|
||||
friend class DivExportAmigaValidation;
|
||||
friend class DivExportTiuna;
|
||||
|
||||
public:
|
||||
DivSong song;
|
||||
|
@ -884,6 +888,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);
|
||||
|
@ -1293,6 +1300,9 @@ class DivEngine {
|
|||
// perform secure/sync operation
|
||||
void synchronized(const std::function<void()>& what);
|
||||
|
||||
// perform secure/sync operation (soft)
|
||||
void synchronizedSoft(const std::function<void()>& what);
|
||||
|
||||
// perform secure/sync song operation
|
||||
void lockSave(const std::function<void()>& what);
|
||||
|
||||
|
@ -1360,6 +1370,7 @@ class DivEngine {
|
|||
midiIsDirectProgram(false),
|
||||
lowLatency(false),
|
||||
systemsRegistered(false),
|
||||
romExportsRegistered(false),
|
||||
hasLoadedSomething(false),
|
||||
midiOutClock(false),
|
||||
midiOutTime(false),
|
||||
|
@ -1466,6 +1477,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));
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "engine.h"
|
||||
|
||||
#include "export/amigaValidation.h"
|
||||
#include "export/tiuna.h"
|
||||
|
||||
DivROMExport* DivEngine::buildROM(DivROMExportOptions sys) {
|
||||
DivROMExport* exporter=NULL;
|
||||
|
@ -27,6 +28,9 @@ DivROMExport* DivEngine::buildROM(DivROMExportOptions sys) {
|
|||
case DIV_ROM_AMIGA_VALIDATION:
|
||||
exporter=new DivExportAmigaValidation;
|
||||
break;
|
||||
case DIV_ROM_TIUNA:
|
||||
exporter=new DivExportTiuna;
|
||||
break;
|
||||
default:
|
||||
exporter=new DivROMExport;
|
||||
break;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
@ -52,39 +54,54 @@ struct DivROMExportProgress {
|
|||
|
||||
class DivROMExport {
|
||||
protected:
|
||||
std::vector<String> exportLog;
|
||||
DivConfig conf;
|
||||
std::vector<DivROMExportOutput> output;
|
||||
std::mutex logLock;
|
||||
void logAppend(String what);
|
||||
public:
|
||||
std::vector<String> exportLog;
|
||||
std::mutex logLock;
|
||||
|
||||
void setConf(DivConfig& c);
|
||||
virtual bool go(DivEngine* eng);
|
||||
virtual void abort();
|
||||
virtual void wait();
|
||||
std::vector<DivROMExportOutput>& getResult();
|
||||
virtual bool hasFailed();
|
||||
virtual bool isRunning();
|
||||
virtual DivROMExportProgress getProgress();
|
||||
virtual DivROMExportProgress getProgress(int index=0);
|
||||
virtual ~DivROMExport() {}
|
||||
};
|
||||
|
||||
#define logAppendf(...) logAppend(fmt::sprintf(__VA_ARGS__))
|
||||
|
||||
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;
|
||||
const char* fileType;
|
||||
const char* fileExt;
|
||||
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, const char* ft, const char* fe, 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;
|
||||
}
|
||||
fileType(ft),
|
||||
fileExt(fe),
|
||||
multiOutput(multiOut),
|
||||
requisitePolicy(reqPolicy) {
|
||||
requisites=req;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -36,9 +36,9 @@ bool DivROMExport::hasFailed() {
|
|||
return true;
|
||||
}
|
||||
|
||||
DivROMExportProgress DivROMExport::getProgress() {
|
||||
DivROMExportProgress DivROMExport::getProgress(int index) {
|
||||
DivROMExportProgress ret;
|
||||
ret.name="Test";
|
||||
ret.name="";
|
||||
ret.amount=0.0f;
|
||||
return ret;
|
||||
}
|
||||
|
@ -55,3 +55,7 @@ void DivROMExport::wait() {
|
|||
bool DivROMExport::isRunning() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DivROMExport::setConf(DivConfig& c) {
|
||||
conf=c;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ void DivExportAmigaValidation::run() {
|
|||
bool done=false;
|
||||
|
||||
// sample.bin
|
||||
logAppend("writing samples...");
|
||||
SafeWriter* sample=new SafeWriter;
|
||||
sample->init();
|
||||
for (int i=0; i<256; i++) {
|
||||
|
@ -79,6 +80,7 @@ void DivExportAmigaValidation::run() {
|
|||
if (sample->tell()&1) sample->writeC(0);
|
||||
|
||||
// seq.bin
|
||||
logAppend("making sequence...");
|
||||
SafeWriter* seq=new SafeWriter;
|
||||
seq->init();
|
||||
|
||||
|
@ -239,6 +241,7 @@ void DivExportAmigaValidation::run() {
|
|||
EXTERN_BUSY_END;
|
||||
|
||||
// wave.bin
|
||||
logAppend("writing wavetables...");
|
||||
SafeWriter* wave=new SafeWriter;
|
||||
wave->init();
|
||||
for (WaveEntry& i: waves) {
|
||||
|
@ -246,6 +249,7 @@ void DivExportAmigaValidation::run() {
|
|||
}
|
||||
|
||||
// sbook.bin
|
||||
logAppend("writing sample book...");
|
||||
SafeWriter* sbook=new SafeWriter;
|
||||
sbook->init();
|
||||
for (SampleBookEntry& i: sampleBook) {
|
||||
|
@ -255,6 +259,7 @@ void DivExportAmigaValidation::run() {
|
|||
}
|
||||
|
||||
// wbook.bin
|
||||
logAppend("writing wavetable book...");
|
||||
SafeWriter* wbook=new SafeWriter;
|
||||
wbook->init();
|
||||
for (WaveEntry& i: waves) {
|
||||
|
@ -272,6 +277,8 @@ void DivExportAmigaValidation::run() {
|
|||
output.push_back(DivROMExportOutput("wave.bin",wave));
|
||||
output.push_back(DivROMExportOutput("seq.bin",seq));
|
||||
|
||||
logAppend("finished!");
|
||||
|
||||
running=false;
|
||||
}
|
||||
|
||||
|
@ -296,3 +303,7 @@ void DivExportAmigaValidation::abort() {
|
|||
bool DivExportAmigaValidation::isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
bool DivExportAmigaValidation::hasFailed() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class DivExportAmigaValidation: public DivROMExport {
|
|||
public:
|
||||
bool go(DivEngine* e);
|
||||
bool isRunning();
|
||||
bool hasFailed();
|
||||
void abort();
|
||||
void wait();
|
||||
~DivExportAmigaValidation() {}
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "tiuna.h"
|
||||
#include "../engine.h"
|
||||
#include "../ta-log.h"
|
||||
#include <fmt/printf.h>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include "engine.h"
|
||||
#include "../fileutils.h"
|
||||
#include "../ta-log.h"
|
||||
|
||||
struct TiunaNew {
|
||||
short pitch;
|
||||
|
@ -180,48 +181,66 @@ static void writeCmd(std::vector<TiunaBytes>& cmds, TiunaCmd& cmd, unsigned char
|
|||
}
|
||||
}
|
||||
|
||||
SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel, int firstBankSize, int otherBankSize) {
|
||||
stop();
|
||||
repeatPattern=false;
|
||||
shallStop=false;
|
||||
setOrder(0);
|
||||
BUSY_BEGIN_SOFT;
|
||||
void DivExportTiuna::run() {
|
||||
int loopOrder, loopOrderRow, loopEnd;
|
||||
int tick=0;
|
||||
SafeWriter* w;
|
||||
std::map<int,TiunaCmd> allCmds[2];
|
||||
|
||||
// config
|
||||
String baseLabel=conf.getString("baseLabel","song");
|
||||
int firstBankSize=conf.getInt("firstBankSize",3072);
|
||||
int otherBankSize=conf.getInt("otherBankSize",4096-48);
|
||||
int tiaIdx=conf.getInt("sysToExport",-1);
|
||||
|
||||
e->stop();
|
||||
e->repeatPattern=false;
|
||||
e->shallStop=false;
|
||||
e->setOrder(0);
|
||||
e->synchronizedSoft([&]() {
|
||||
// determine loop point
|
||||
// bool stopped=false;
|
||||
int loopOrder=0;
|
||||
int loopOrderRow=0;
|
||||
int loopEnd=0;
|
||||
walkSong(loopOrder,loopOrderRow,loopEnd);
|
||||
logI("loop point: %d %d",loopOrder,loopOrderRow);
|
||||
loopOrder=0;
|
||||
loopOrderRow=0;
|
||||
loopEnd=0;
|
||||
e->walkSong(loopOrder,loopOrderRow,loopEnd);
|
||||
logAppendf("loop point: %d %d",loopOrder,loopOrderRow);
|
||||
|
||||
SafeWriter* w=new SafeWriter;
|
||||
w=new SafeWriter;
|
||||
w->init();
|
||||
|
||||
int tiaIdx=-1;
|
||||
|
||||
for (int i=0; i<song.systemLen; i++) {
|
||||
if (sysToExport!=NULL && !sysToExport[i]) continue;
|
||||
if (song.system[i]==DIV_SYSTEM_TIA) {
|
||||
if (tiaIdx<0 || tiaIdx>=e->song.systemLen) {
|
||||
tiaIdx=-1;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
if (e->song.system[i]==DIV_SYSTEM_TIA) {
|
||||
tiaIdx=i;
|
||||
disCont[i].dispatch->toggleRegisterDump(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tiaIdx<0) {
|
||||
lastError="selected TIA system not found";
|
||||
return NULL;
|
||||
logAppend("ERROR: selected TIA system not found");
|
||||
failed=true;
|
||||
running=false;
|
||||
return;
|
||||
}
|
||||
} else if (e->song.system[tiaIdx]!=DIV_SYSTEM_TIA) {
|
||||
logAppend("ERROR: selected chip is not a TIA!");
|
||||
failed=true;
|
||||
running=false;
|
||||
return;
|
||||
}
|
||||
|
||||
e->disCont[tiaIdx].dispatch->toggleRegisterDump(true);
|
||||
|
||||
// write patterns
|
||||
// bool writeLoop=false;
|
||||
logAppend("recording sequence...");
|
||||
bool done=false;
|
||||
playSub(false);
|
||||
e->playSub(false);
|
||||
|
||||
int tick=0;
|
||||
// int loopTick=-1;
|
||||
TiunaLast last[2];
|
||||
TiunaNew news[2];
|
||||
std::map<int,TiunaCmd> allCmds[2];
|
||||
while (!done) {
|
||||
// TODO implement loop
|
||||
// if (loopTick<0 && loopOrder==curOrder && loopOrderRow==curRow
|
||||
|
@ -237,7 +256,7 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
// last[i].vol=-1;
|
||||
// }
|
||||
// }
|
||||
if (nextTick(false,true) || !playing) {
|
||||
if (e->nextTick(false,true) || !e->playing) {
|
||||
// stopped=!playing;
|
||||
done=true;
|
||||
break;
|
||||
|
@ -246,7 +265,7 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
news[i]=TiunaNew();
|
||||
}
|
||||
// get register dumps
|
||||
std::vector<DivRegWrite>& writes=disCont[tiaIdx].dispatch->getRegisterWrites();
|
||||
std::vector<DivRegWrite>& writes=e->disCont[tiaIdx].dispatch->getRegisterWrites();
|
||||
for (const DivRegWrite& i: writes) {
|
||||
switch (i.addr) {
|
||||
case 0xfffe0000:
|
||||
|
@ -299,21 +318,24 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
}
|
||||
if (hasCmd) allCmds[i][tick]=cmds;
|
||||
}
|
||||
cmdStream.clear();
|
||||
e->cmdStream.clear();
|
||||
tick++;
|
||||
}
|
||||
for (int i=0; i<song.systemLen; i++) {
|
||||
disCont[i].dispatch->getRegisterWrites().clear();
|
||||
disCont[i].dispatch->toggleRegisterDump(false);
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
e->disCont[i].dispatch->getRegisterWrites().clear();
|
||||
e->disCont[i].dispatch->toggleRegisterDump(false);
|
||||
}
|
||||
|
||||
remainingLoops=-1;
|
||||
playing=false;
|
||||
freelance=false;
|
||||
extValuePresent=false;
|
||||
BUSY_END;
|
||||
e->remainingLoops=-1;
|
||||
e->playing=false;
|
||||
e->freelance=false;
|
||||
e->extValuePresent=false;
|
||||
});
|
||||
|
||||
if (failed) return;
|
||||
|
||||
// render commands
|
||||
logAppend("rendering commands...");
|
||||
std::vector<TiunaBytes> renderedCmds;
|
||||
w->writeText(fmt::format(
|
||||
"; Generated by Furnace " DIV_VERSION "\n"
|
||||
|
@ -321,7 +343,7 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
"; Author: {}\n"
|
||||
"; Album: {}\n"
|
||||
"; Subsong #{}: {}\n\n",
|
||||
song.name,song.author,song.category,curSubSongIndex+1,curSubSong->name
|
||||
e->song.name,e->song.author,e->song.category,e->curSubSongIndex+1,e->curSubSong->name
|
||||
));
|
||||
for (int i=0; i<2; i++) {
|
||||
TiunaCmd lastCmd;
|
||||
|
@ -349,15 +371,30 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
int cmdSize=renderedCmds.size();
|
||||
bool* processed=new bool[cmdSize];
|
||||
memset(processed,0,cmdSize*sizeof(bool));
|
||||
logI("max cmId: %d",(MAX(firstBankSize/1024,1))*256);
|
||||
while (firstBankSize>768 && cmId<(MAX(firstBankSize/1024,1))*256) {
|
||||
logI("start CM %04x...",cmId);
|
||||
logAppend("compressing! this may take a while.");
|
||||
int maxCmId=(MAX(firstBankSize/1024,1))*256;
|
||||
int lastMaxPMVal=100000;
|
||||
logAppendf("max cmId: %d",maxCmId);
|
||||
logAppendf("commands: %d",cmdSize);
|
||||
while (firstBankSize>768 && cmId<maxCmId) {
|
||||
if (mustAbort) {
|
||||
logAppend("aborted!");
|
||||
failed=true;
|
||||
running=false;
|
||||
delete[] processed;
|
||||
return;
|
||||
}
|
||||
|
||||
float theOtherSide=pow(1.0/float(MAX(1,lastMaxPMVal)),0.2)*0.98;
|
||||
progress[0].amount=theOtherSide+(1.0-theOtherSide)*((float)cmId/(float)maxCmId);
|
||||
|
||||
logAppendf("start CM %04x...",cmId);
|
||||
std::map<int,TiunaMatches> potentialMatches;
|
||||
logD("scan %d size...",cmdSize-1);
|
||||
for (int i=0; i<cmdSize-1;) {
|
||||
// continue and skip if it's part of previous confirmed matches
|
||||
while (i<cmdSize-1 && processed[i]) i++;
|
||||
if (i>=cmdSize-1) break;
|
||||
progress[1].amount=(float)i/(float)(cmdSize-1);
|
||||
std::vector<TiunaMatch> match;
|
||||
int ch=renderedCmds[i].ch;
|
||||
for (int j=i+1; j<cmdSize;) {
|
||||
|
@ -427,12 +464,11 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
i++;
|
||||
}
|
||||
if (potentialMatches.empty()) {
|
||||
logV("potentialMatches is empty");
|
||||
logAppend("potentialMatches is empty");
|
||||
break;
|
||||
}
|
||||
int maxPMIdx=0;
|
||||
int maxPMVal=0;
|
||||
logV("looking through potentialMatches...");
|
||||
for (const auto& i: potentialMatches) {
|
||||
if (i.second.bytesSaved>maxPMVal) {
|
||||
maxPMVal=i.second.bytesSaved;
|
||||
|
@ -440,16 +476,19 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
}
|
||||
}
|
||||
int maxPMLen=potentialMatches[maxPMIdx].length;
|
||||
logV("the other step...");
|
||||
for (const int i: potentialMatches[maxPMIdx].pos) {
|
||||
confirmedMatches.push_back({i,i+maxPMLen,0,cmId});
|
||||
memset(processed+i,1,maxPMLen);
|
||||
//std::fill(processed.begin()+i,processed.begin()+(i+maxPMLen),true);
|
||||
}
|
||||
callTicks.push_back(potentialMatches[maxPMIdx].ticks);
|
||||
logI("CM %04x added: pos=%d,len=%d,matches=%d,saved=%d",cmId,maxPMIdx,maxPMLen,potentialMatches[maxPMIdx].pos.size(),maxPMVal);
|
||||
logAppendf("CM %04x added: pos=%d,len=%d,matches=%d,saved=%d",cmId,maxPMIdx,maxPMLen,potentialMatches[maxPMIdx].pos.size(),maxPMVal);
|
||||
lastMaxPMVal=maxPMVal;
|
||||
cmId++;
|
||||
}
|
||||
progress[0].amount=1.0f;
|
||||
progress[1].amount=1.0f;
|
||||
logAppend("generating data...");
|
||||
delete[] processed;
|
||||
std::sort(confirmedMatches.begin(),confirmedMatches.end(),[](const TiunaMatch& l, const TiunaMatch& r){
|
||||
return l.pos<r.pos;
|
||||
|
@ -460,8 +499,10 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
// overlap check
|
||||
for (int i=1; i<(int)confirmedMatches.size(); i++) {
|
||||
if (confirmedMatches[i-1].endPos<=confirmedMatches[i].pos) continue;
|
||||
lastError="impossible overlap found in matches list, please report";
|
||||
return NULL;
|
||||
logAppend("ERROR: impossible overlap found in matches list, please report");
|
||||
failed=true;
|
||||
running=false;
|
||||
return;
|
||||
}
|
||||
SafeWriter dbg;
|
||||
dbg.init();
|
||||
|
@ -510,8 +551,10 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
}
|
||||
w->writeC('\n');
|
||||
if (totalSize>firstBankSize) {
|
||||
lastError="first bank is not large enough to contain call table";
|
||||
return NULL;
|
||||
logAppend("ERROR: first bank is not large enough to contain call table");
|
||||
failed=true;
|
||||
running=false;
|
||||
return;
|
||||
}
|
||||
|
||||
int curBank=0;
|
||||
|
@ -572,13 +615,50 @@ SafeWriter* DivEngine::saveTiuna(const bool* sysToExport, const char* baseLabel,
|
|||
}
|
||||
w->writeText(" .text x\"e0\"\n .endsection\n");
|
||||
totalSize++;
|
||||
logI("total size: %d bytes (%d banks)",totalSize,curBank+1);
|
||||
logAppendf("total size: %d bytes (%d banks)",totalSize,curBank+1);
|
||||
|
||||
//FILE* f=ps_fopen("confirmedMatches.txt","wb");
|
||||
//if (f!=NULL) {
|
||||
// fwrite(dbg.getFinalBuf(),1,dbg.size(),f);
|
||||
// fclose(f);
|
||||
//}
|
||||
output.push_back(DivROMExportOutput("export.asm",w));
|
||||
|
||||
return w;
|
||||
logAppend("finished!");
|
||||
|
||||
running=false;
|
||||
}
|
||||
|
||||
bool DivExportTiuna::go(DivEngine* eng) {
|
||||
progress[0].name="Compression";
|
||||
progress[0].amount=0.0f;
|
||||
progress[1].name="Confirmed Matches";
|
||||
progress[1].amount=0.0f;
|
||||
|
||||
e=eng;
|
||||
running=true;
|
||||
failed=false;
|
||||
mustAbort=false;
|
||||
exportThread=new std::thread(&DivExportTiuna::run,this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DivExportTiuna::wait() {
|
||||
if (exportThread!=NULL) {
|
||||
exportThread->join();
|
||||
delete exportThread;
|
||||
}
|
||||
}
|
||||
|
||||
void DivExportTiuna::abort() {
|
||||
mustAbort=true;
|
||||
wait();
|
||||
}
|
||||
|
||||
bool DivExportTiuna::isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
bool DivExportTiuna::hasFailed() {
|
||||
return failed;
|
||||
}
|
||||
|
||||
DivROMExportProgress DivExportTiuna::getProgress(int index) {
|
||||
if (index<0 || index>2) return progress[2];
|
||||
return progress[index];
|
||||
}
|
38
src/engine/export/tiuna.h
Normal file
38
src/engine/export/tiuna.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* 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 "../export.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
class DivExportTiuna: public DivROMExport {
|
||||
DivEngine* e;
|
||||
std::thread* exportThread;
|
||||
DivROMExportProgress progress[3];
|
||||
bool running, failed, mustAbort;
|
||||
void run();
|
||||
public:
|
||||
bool go(DivEngine* e);
|
||||
bool isRunning();
|
||||
bool hasFailed();
|
||||
void abort();
|
||||
void wait();
|
||||
DivROMExportProgress getProgress(int index=0);
|
||||
~DivExportTiuna() {}
|
||||
};
|
63
src/engine/exportDef.cpp
Normal file
63
src/engine/exportDef.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* 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!",
|
||||
NULL, NULL,
|
||||
{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",
|
||||
"ZSM file", ".zsm",
|
||||
{
|
||||
DIV_SYSTEM_YM2151, DIV_SYSTEM_VERA
|
||||
},
|
||||
false, 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.",
|
||||
"assembly files", ".asm",
|
||||
{
|
||||
DIV_SYSTEM_TIA
|
||||
},
|
||||
false, DIV_REQPOL_ANY
|
||||
);
|
||||
}
|
|
@ -2094,6 +2094,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len, int variantID) {
|
|||
ds.systemFlags[i].set("oldPitch",true);
|
||||
}
|
||||
}
|
||||
} else if (ds.version<217) {
|
||||
for (int i=0; i<ds.systemLen; i++) {
|
||||
if (ds.system[i]==DIV_SYSTEM_VERA) {
|
||||
ds.systemFlags[i].set("chipType",1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (active) quitDispatch();
|
||||
|
|
|
@ -39,14 +39,25 @@ const char** DivPlatformMSM6295::getRegisterSheet() {
|
|||
}
|
||||
|
||||
u8 DivPlatformMSM6295::read_byte(u32 address) {
|
||||
if (adpcmMem==NULL || address>=getSampleMemCapacity(0)) {
|
||||
if (adpcmMem==NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (isBanked) {
|
||||
if (address<0x400) {
|
||||
return adpcmMem[(bank[(address>>8)&0x3]<<16)|(address&0x3ff)];
|
||||
unsigned int bankedAddress=(bank[(address>>8)&0x3]<<16)|(address&0x3ff);
|
||||
if (bankedAddress>=getSampleMemCapacity(0)) {
|
||||
return 0;
|
||||
}
|
||||
return adpcmMem[(bank[(address>>16)&0x3]<<16)|(address&0xffff)];
|
||||
return adpcmMem[bankedAddress&0xffffff];
|
||||
}
|
||||
unsigned int bankedAddress=(bank[(address>>16)&0x3]<<16)|(address&0xffff);
|
||||
if (bankedAddress>=getSampleMemCapacity(0)) {
|
||||
return 0;
|
||||
}
|
||||
return adpcmMem[bankedAddress&0xffffff];
|
||||
}
|
||||
if (address>=getSampleMemCapacity(0)) {
|
||||
return 0;
|
||||
}
|
||||
return adpcmMem[address&0x3ffff];
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// Chip revisions
|
||||
// 0: V 0.3.0
|
||||
// 1: V 47.0.0 (9-bit volume, phase reset on mute)
|
||||
// 2: V 47.0.2 (Pulse Width XOR on Saw and Triangle)
|
||||
|
||||
#include "vera_psg.h"
|
||||
|
||||
|
@ -88,8 +89,8 @@ render(struct VERA_PSG* psg, int16_t *left, int16_t *right)
|
|||
uint8_t v = 0;
|
||||
switch (ch->waveform) {
|
||||
case WF_PULSE: v = (ch->phase >> 10) > ch->pw ? 0 : 63; break;
|
||||
case WF_SAWTOOTH: v = ch->phase >> 11; break;
|
||||
case WF_TRIANGLE: v = (ch->phase & 0x10000) ? (~(ch->phase >> 10) & 0x3F) : ((ch->phase >> 10) & 0x3F); break;
|
||||
case WF_SAWTOOTH: v = (ch->phase >> 11) ^ (psg->chipType < 2 ? 0 : (ch->pw ^ 0x3f) & 0x3f); break;
|
||||
case WF_TRIANGLE: v = ((ch->phase & 0x10000) ? (~(ch->phase >> 10) & 0x3F) : ((ch->phase >> 10) & 0x3F)) ^ (psg->chipType < 2 ? 0 : (ch->pw ^ 0x3f) & 0x3f); break;
|
||||
case WF_NOISE: v = ch->noiseval; break;
|
||||
}
|
||||
int8_t sv = (v ^ 0x20);
|
||||
|
|
|
@ -532,7 +532,7 @@ void DivPlatformVERA::poke(std::vector<DivRegWrite>& wlist) {
|
|||
}
|
||||
|
||||
void DivPlatformVERA::setFlags(const DivConfig& flags) {
|
||||
psg->chipType=flags.getInt("chipType",1);
|
||||
psg->chipType=flags.getInt("chipType",2);
|
||||
chipClock=25000000;
|
||||
CHECK_CUSTOM_CLOCK;
|
||||
rate=chipClock/512;
|
||||
|
|
|
@ -133,14 +133,6 @@ void DivZSM::writePSG(unsigned char a, unsigned char v) {
|
|||
} else if (a>=64) {
|
||||
return writePCM(a-64,v);
|
||||
}
|
||||
if (optimize) {
|
||||
if ((a&3)==3 && v>64) {
|
||||
// Pulse width on non-pulse waves is nonsense and wasteful
|
||||
// No need to preserve state here because the next write that
|
||||
// selects pulse will also set the pulse width in this register
|
||||
v&=0xc0;
|
||||
}
|
||||
}
|
||||
if (psgState[psg_PREV][a]==v) {
|
||||
if (psgState[psg_NEW][a]!=v) {
|
||||
// NEW value is being reset to the same as PREV value
|
||||
|
|
|
@ -180,6 +180,7 @@ const char* aboutLine[]={
|
|||
"Slightly Large NC",
|
||||
"smaybius",
|
||||
"SnugglyBun",
|
||||
"Someone64",
|
||||
"Spinning Square Waves",
|
||||
"src3453",
|
||||
"SuperJet Spade",
|
||||
|
|
|
@ -239,6 +239,105 @@ void FurnaceGUI::drawExportVGM(bool onWindow) {
|
|||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::drawExportROM(bool onWindow) {
|
||||
exitDisabledTimer=1;
|
||||
|
||||
const DivROMExportDef* def=e->getROMExportDef(romTarget);
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
if (ImGui::BeginCombo("##ROMTarget",def==NULL?"<select one>":def->name)) {
|
||||
for (int i=0; i<DIV_ROM_MAX; i++) {
|
||||
const DivROMExportDef* newDef=e->getROMExportDef((DivROMExportOptions)i);
|
||||
if (newDef!=NULL) {
|
||||
if (ImGui::Selectable(newDef->name)) {
|
||||
romTarget=(DivROMExportOptions)i;
|
||||
romMultiFile=newDef->multiOutput;
|
||||
romConfig=DivConfig();
|
||||
if (newDef->fileExt==NULL) {
|
||||
romFilterName="";
|
||||
romFilterExt="";
|
||||
} else {
|
||||
romFilterName=newDef->fileType;
|
||||
romFilterExt=newDef->fileExt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (def!=NULL) {
|
||||
ImGui::Text("by %s",def->author);
|
||||
|
||||
ImGui::TextWrapped("%s",def->description);
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
bool altered=false;
|
||||
|
||||
switch (romTarget) {
|
||||
case DIV_ROM_TIUNA: {
|
||||
String asmBaseLabel=romConfig.getString("baseLabel","song");
|
||||
int firstBankSize=romConfig.getInt("firstBankSize",3072);
|
||||
int otherBankSize=romConfig.getInt("otherBankSize",4096-48);
|
||||
int sysToExport=romConfig.getInt("sysToExport",-1);
|
||||
|
||||
// TODO; validate label
|
||||
if (ImGui::InputText(_("base song label name"),&asmBaseLabel)) {
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::InputInt(_("max size in first bank"),&firstBankSize,1,100)) {
|
||||
if (firstBankSize<0) firstBankSize=0;
|
||||
if (firstBankSize>4096) firstBankSize=4096;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::InputInt(_("max size in other banks"),&otherBankSize,1,100)) {
|
||||
if (otherBankSize<16) otherBankSize=16;
|
||||
if (otherBankSize>4096) otherBankSize=4096;
|
||||
altered=true;
|
||||
}
|
||||
|
||||
ImGui::Text(_("chip to export:"));
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
DivSystem sys=e->song.system[i];
|
||||
bool isTIA=(sys==DIV_SYSTEM_TIA);
|
||||
ImGui::BeginDisabled(!isTIA);
|
||||
if (ImGui::RadioButton(fmt::sprintf("%d. %s##_SYSV%d",i+1,getSystemName(e->song.system[i]),i).c_str(),sysToExport==i)) {
|
||||
sysToExport=i;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
if (altered) {
|
||||
romConfig.set("baseLabel",asmBaseLabel);
|
||||
romConfig.set("firstBankSize",firstBankSize);
|
||||
romConfig.set("otherBankSize",otherBankSize);
|
||||
romConfig.set("sysToExport",sysToExport);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DIV_ROM_ABSTRACT:
|
||||
ImGui::TextWrapped("%s",_("select a target from the menu at the top of this dialog."));
|
||||
break;
|
||||
default:
|
||||
ImGui::TextWrapped("%s",_("this export method doesn't offer any options."));
|
||||
break;
|
||||
}
|
||||
/*
|
||||
*/
|
||||
|
||||
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) {
|
||||
exitDisabledTimer=1;
|
||||
|
||||
|
@ -261,103 +360,6 @@ void FurnaceGUI::drawExportZSM(bool onWindow) {
|
|||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::drawExportTiuna(bool onWindow) {
|
||||
exitDisabledTimer=1;
|
||||
|
||||
ImGui::Text(_("for 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;
|
||||
|
||||
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::AlignTextToFramePadding();
|
||||
ImGui::Text(_("Directory"));
|
||||
ImGui::SameLine();
|
||||
ImGui::InputText("##AVDPath",&workingDirROMExport);
|
||||
if (onWindow) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button(_("Cancel"),ImVec2(200.0f*dpiScale,0))) ImGui::CloseCurrentPopup();
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (ImGui::Button(_("Bake Data"),ImVec2(200.0f*dpiScale,0))) {
|
||||
DivROMExport* ex=e->buildROM(DIV_ROM_AMIGA_VALIDATION);
|
||||
if (ex->go(e)) {
|
||||
ex->wait();
|
||||
if (ex->hasFailed()) {
|
||||
showError("error!");
|
||||
} else {
|
||||
if (workingDirROMExport.size()>0) {
|
||||
if (workingDirROMExport[workingDirROMExport.size()-1]!=DIR_SEPARATOR) workingDirROMExport+=DIR_SEPARATOR_STR;
|
||||
}
|
||||
for (DivROMExportOutput& i: ex->getResult()) {
|
||||
String path=workingDirROMExport+i.name;
|
||||
FILE* outFile=ps_fopen(path.c_str(),"wb");
|
||||
if (outFile!=NULL) {
|
||||
fwrite(i.data->getFinalBuf(),1,i.data->size(),outFile);
|
||||
fclose(outFile);
|
||||
}
|
||||
i.data->finish();
|
||||
delete i.data;
|
||||
}
|
||||
showError(fmt::sprintf(_("Done! Baked %d files."),(int)ex->getResult().size()));
|
||||
}
|
||||
} else {
|
||||
showError("error!");
|
||||
}
|
||||
delete ex;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
void FurnaceGUI::drawExportText(bool onWindow) {
|
||||
exitDisabledTimer=1;
|
||||
|
||||
|
@ -434,6 +436,10 @@ void FurnaceGUI::drawExport() {
|
|||
drawExportVGM(true);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
if (ImGui::BeginTabItem(_("ROM"))) {
|
||||
drawExportROM(true);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
int numZSMCompat=0;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
|
||||
|
@ -444,29 +450,6 @@ 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++;
|
||||
}
|
||||
if (numAmiga && settings.iCannotWait) {
|
||||
if (ImGui::BeginTabItem(_("Amiga Validation"))) {
|
||||
drawExportAmigaVal(true);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginTabItem(_("Text"))) {
|
||||
drawExportText(true);
|
||||
ImGui::EndTabItem();
|
||||
|
@ -488,15 +471,12 @@ void FurnaceGUI::drawExport() {
|
|||
case GUI_EXPORT_VGM:
|
||||
drawExportVGM(true);
|
||||
break;
|
||||
case GUI_EXPORT_ROM:
|
||||
drawExportROM(true);
|
||||
break;
|
||||
case GUI_EXPORT_ZSM:
|
||||
drawExportZSM(true);
|
||||
break;
|
||||
case GUI_EXPORT_TIUNA:
|
||||
drawExportTiuna(true);
|
||||
break;
|
||||
case GUI_EXPORT_AMIGA_VAL:
|
||||
drawExportAmigaVal(true);
|
||||
break;
|
||||
case GUI_EXPORT_TEXT:
|
||||
drawExportText(true);
|
||||
break;
|
||||
|
|
222
src/gui/gui.cpp
222
src/gui/gui.cpp
|
@ -1950,15 +1950,6 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
(settings.autoFillSave)?shortName:""
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_TIUNA:
|
||||
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
"Export TIunA",
|
||||
{"assembly files", "*.asm"},
|
||||
workingDirROMExport,
|
||||
dpiScale
|
||||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_TEXT:
|
||||
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||
hasOpened=fileDialog->openSave(
|
||||
|
@ -1980,7 +1971,22 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
);
|
||||
break;
|
||||
case GUI_FILE_EXPORT_ROM:
|
||||
showError(_("Coming soon!"));
|
||||
if (!dirExists(workingDirROMExport)) workingDirROMExport=getHomeDir();
|
||||
if (romMultiFile) {
|
||||
hasOpened=fileDialog->openSelectDir(
|
||||
_("Export ROM"),
|
||||
workingDirROMExport,
|
||||
dpiScale
|
||||
);
|
||||
} else {
|
||||
hasOpened=fileDialog->openSave(
|
||||
_("Export ROM"),
|
||||
{romFilterName, "*"+romFilterExt},
|
||||
workingDirROMExport,
|
||||
dpiScale,
|
||||
(settings.autoFillSave)?shortName:""
|
||||
);
|
||||
}
|
||||
break;
|
||||
case GUI_FILE_LOAD_MAIN_FONT:
|
||||
if (!dirExists(workingDirFont)) workingDirFont=getHomeDir();
|
||||
|
@ -4295,6 +4301,10 @@ bool FurnaceGUI::loop() {
|
|||
drawExportVGM();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu(_("export ROM..."))) {
|
||||
drawExportROM();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
int numZSMCompat=0;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
|
||||
|
@ -4305,29 +4315,6 @@ bool FurnaceGUI::loop() {
|
|||
ImGui::EndMenu();
|
||||
}
|
||||
}
|
||||
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::BeginMenu(_("export TIunA..."))) {
|
||||
drawExportTiuna();
|
||||
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..."))) {
|
||||
drawExportAmigaVal();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginMenu(_("export text..."))) {
|
||||
drawExportText();
|
||||
ImGui::EndMenu();
|
||||
|
@ -4349,6 +4336,10 @@ bool FurnaceGUI::loop() {
|
|||
curExportType=GUI_EXPORT_VGM;
|
||||
displayExport=true;
|
||||
}
|
||||
if (ImGui::MenuItem(_("export ROM..."))) {
|
||||
curExportType=GUI_EXPORT_ROM;
|
||||
displayExport=true;
|
||||
}
|
||||
int numZSMCompat=0;
|
||||
for (int i=0; i<e->song.systemLen; i++) {
|
||||
if ((e->song.system[i]==DIV_SYSTEM_VERA) || (e->song.system[i]==DIV_SYSTEM_YM2151)) numZSMCompat++;
|
||||
|
@ -4359,29 +4350,6 @@ bool FurnaceGUI::loop() {
|
|||
displayExport=true;
|
||||
}
|
||||
}
|
||||
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::MenuItem(_("export TIunA..."))) {
|
||||
curExportType=GUI_EXPORT_TIUNA;
|
||||
displayExport=true;
|
||||
}
|
||||
}
|
||||
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::MenuItem(_("export Amiga validation data..."))) {
|
||||
curExportType=GUI_EXPORT_AMIGA_VAL;
|
||||
displayExport=true;
|
||||
}
|
||||
}
|
||||
if (ImGui::MenuItem(_("export text..."))) {
|
||||
curExportType=GUI_EXPORT_TEXT;
|
||||
displayExport=true;
|
||||
|
@ -4965,7 +4933,6 @@ bool FurnaceGUI::loop() {
|
|||
workingDirZSMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||
break;
|
||||
case GUI_FILE_EXPORT_ROM:
|
||||
case GUI_FILE_EXPORT_TIUNA:
|
||||
case GUI_FILE_EXPORT_TEXT:
|
||||
case GUI_FILE_EXPORT_CMDSTREAM:
|
||||
workingDirROMExport=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||
|
@ -5061,6 +5028,9 @@ bool FurnaceGUI::loop() {
|
|||
if (curFileDialog==GUI_FILE_EXPORT_VGM) {
|
||||
checkExtension(".vgm");
|
||||
}
|
||||
if (curFileDialog==GUI_FILE_EXPORT_ROM) {
|
||||
checkExtension(romFilterExt.c_str());
|
||||
}
|
||||
if (curFileDialog==GUI_FILE_EXPORT_ZSM) {
|
||||
checkExtension(".zsm");
|
||||
}
|
||||
|
@ -5521,29 +5491,20 @@ 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!"));
|
||||
romExportPath=copyOfName;
|
||||
pendingExport=e->buildROM(romTarget);
|
||||
if (pendingExport==NULL) {
|
||||
showError("could not create exporter! you may want to report this issue...");
|
||||
} else {
|
||||
pendingExport->setConf(romConfig);
|
||||
if (pendingExport->go(e)) {
|
||||
displayExportingROM=true;
|
||||
romExportSave=true;
|
||||
} else {
|
||||
showError("could not begin exporting process! TODO: elaborate");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GUI_FILE_EXPORT_TEXT: {
|
||||
SafeWriter* w=e->saveText(false);
|
||||
|
@ -5710,6 +5671,11 @@ bool FurnaceGUI::loop() {
|
|||
ImGui::OpenPopup(_("Rendering..."));
|
||||
}
|
||||
|
||||
if (displayExportingROM) {
|
||||
displayExportingROM=false;
|
||||
ImGui::OpenPopup(_("ROM Export Progress"));
|
||||
}
|
||||
|
||||
if (displayNew) {
|
||||
newSongQuery="";
|
||||
newSongFirstFrame=true;
|
||||
|
@ -5775,6 +5741,94 @@ bool FurnaceGUI::loop() {
|
|||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImVec2 romExportMinSize=mobileUI?ImVec2(canvasW-(portrait?0:(60.0*dpiScale)),canvasH-60.0*dpiScale):ImVec2(400.0f*dpiScale,200.0f*dpiScale);
|
||||
ImVec2 romExportMaxSize=ImVec2(canvasW-((mobileUI && !portrait)?(60.0*dpiScale):0),canvasH-(mobileUI?(60.0*dpiScale):0));
|
||||
|
||||
centerNextWindow(_("ROM Export Progress"),canvasW,canvasH);
|
||||
ImGui::SetNextWindowSizeConstraints(romExportMinSize,romExportMaxSize);
|
||||
if (ImGui::BeginPopupModal(_("ROM Export Progress"),NULL)) {
|
||||
if (pendingExport==NULL) {
|
||||
ImGui::TextWrapped("%s",_("...ooooor you could try asking me a new ROM export?"));
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
if (ImGui::Button(_("Erm what the sigma???"),ImVec2(ImGui::GetContentRegionAvail().x,0.0f))) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
} else {
|
||||
int progIndex=0;
|
||||
while (true) {
|
||||
DivROMExportProgress p=pendingExport->getProgress(progIndex);
|
||||
if (p.name.empty()) break;
|
||||
ImGui::Text("%s: %d%%",p.name.c_str(),(int)round(p.amount*100.0f));
|
||||
ImGui::ProgressBar(p.amount,ImVec2(-FLT_MIN,0));
|
||||
progIndex++;
|
||||
}
|
||||
ImVec2 romLogSize=ImGui::GetContentRegionAvail();
|
||||
romLogSize.y-=ImGui::GetFrameHeightWithSpacing();
|
||||
if (romLogSize.y<60.0f*dpiScale) romLogSize.y=60.0f*dpiScale;
|
||||
if (ImGui::BeginChild("Export Log",romLogSize,true)) {
|
||||
pendingExport->logLock.lock();
|
||||
ImGui::PushFont(patFont);
|
||||
for (String& i: pendingExport->exportLog) {
|
||||
ImGui::TextWrapped("%s",i.c_str());
|
||||
}
|
||||
if (romExportSave) {
|
||||
ImGui::SetScrollY(ImGui::GetScrollMaxY());
|
||||
}
|
||||
ImGui::PopFont();
|
||||
pendingExport->logLock.unlock();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
if (pendingExport->isRunning()) {
|
||||
WAKE_UP;
|
||||
if (ImGui::Button(_("Abort"),ImVec2(ImGui::GetContentRegionAvail().x,0.0f))) {
|
||||
pendingExport->abort();
|
||||
delete pendingExport;
|
||||
pendingExport=NULL;
|
||||
romExportSave=false;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
} else {
|
||||
if (romExportSave) {
|
||||
pendingExport->wait();
|
||||
if (!pendingExport->hasFailed()) {
|
||||
// save files here (romExportPath)
|
||||
for (DivROMExportOutput& i: pendingExport->getResult()) {
|
||||
String path=romExportPath;
|
||||
if (romMultiFile) {
|
||||
path+=DIR_SEPARATOR_STR;
|
||||
path+=i.name;
|
||||
}
|
||||
FILE* outFile=ps_fopen(path.c_str(),"wb");
|
||||
if (outFile!=NULL) {
|
||||
fwrite(i.data->getFinalBuf(),1,i.data->size(),outFile);
|
||||
fclose(outFile);
|
||||
} else {
|
||||
// TODO: handle failure here
|
||||
}
|
||||
i.data->finish();
|
||||
delete i.data;
|
||||
}
|
||||
}
|
||||
romExportSave=false;
|
||||
}
|
||||
if (pendingExport!=NULL) {
|
||||
if (pendingExport->hasFailed()) {
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::TextUnformatted(_("Error!"));
|
||||
ImGui::SameLine();
|
||||
}
|
||||
}
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
if (ImGui::Button(_("OK"),ImVec2(ImGui::GetContentRegionAvail().x,0.0f))) {
|
||||
delete pendingExport;
|
||||
pendingExport=NULL;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
drawTutorial();
|
||||
|
||||
ImVec2 newSongMinSize=mobileUI?ImVec2(canvasW-(portrait?0:(60.0*dpiScale)),canvasH-60.0*dpiScale):ImVec2(400.0f*dpiScale,200.0f*dpiScale);
|
||||
|
@ -7865,6 +7919,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
snesFilterHex(false),
|
||||
modTableHex(false),
|
||||
displayEditString(false),
|
||||
displayExportingROM(false),
|
||||
changeCoarse(false),
|
||||
mobileEdit(false),
|
||||
killGraphics(false),
|
||||
|
@ -7878,9 +7933,6 @@ FurnaceGUI::FurnaceGUI():
|
|||
vgmExportTrailingTicks(-1),
|
||||
drawHalt(10),
|
||||
zsmExportTickRate(60),
|
||||
asmBaseLabel(""),
|
||||
tiunaFirstBankSize(3072),
|
||||
tiunaOtherBankSize(4096-48),
|
||||
macroPointSize(16),
|
||||
waveEditStyle(0),
|
||||
displayInsTypeListMakeInsSample(-1),
|
||||
|
@ -8341,7 +8393,11 @@ FurnaceGUI::FurnaceGUI():
|
|||
curTutorial(-1),
|
||||
curTutorialStep(0),
|
||||
dmfExportVersion(0),
|
||||
curExportType(GUI_EXPORT_NONE) {
|
||||
curExportType(GUI_EXPORT_NONE),
|
||||
romTarget(DIV_ROM_ABSTRACT),
|
||||
romMultiFile(false),
|
||||
romExportSave(false),
|
||||
pendingExport(NULL) {
|
||||
// value keys
|
||||
valueKeys[SDLK_0]=0;
|
||||
valueKeys[SDLK_1]=1;
|
||||
|
|
|
@ -600,7 +600,6 @@ 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,
|
||||
|
@ -652,10 +651,9 @@ enum FurnaceGUIExportTypes {
|
|||
|
||||
GUI_EXPORT_AUDIO=0,
|
||||
GUI_EXPORT_VGM,
|
||||
GUI_EXPORT_ROM,
|
||||
GUI_EXPORT_ZSM,
|
||||
GUI_EXPORT_TIUNA,
|
||||
GUI_EXPORT_CMD_STREAM,
|
||||
GUI_EXPORT_AMIGA_VAL,
|
||||
GUI_EXPORT_TEXT,
|
||||
GUI_EXPORT_DMF
|
||||
};
|
||||
|
@ -1621,6 +1619,7 @@ class FurnaceGUI {
|
|||
bool displayNew, displayExport, displayPalette, fullScreen, preserveChanPos, sysDupCloneChannels, sysDupEnd, noteInputPoly, notifyWaveChange;
|
||||
bool wantScrollListIns, wantScrollListWave, wantScrollListSample;
|
||||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
|
||||
bool displayExportingROM;
|
||||
bool changeCoarse;
|
||||
bool mobileEdit;
|
||||
bool killGraphics;
|
||||
|
@ -1634,9 +1633,6 @@ class FurnaceGUI {
|
|||
int cvHiScore;
|
||||
int drawHalt;
|
||||
int zsmExportTickRate;
|
||||
String asmBaseLabel;
|
||||
int tiunaFirstBankSize;
|
||||
int tiunaOtherBankSize;
|
||||
int macroPointSize;
|
||||
int waveEditStyle;
|
||||
int displayInsTypeListMakeInsSample;
|
||||
|
@ -2680,6 +2676,15 @@ class FurnaceGUI {
|
|||
int dmfExportVersion;
|
||||
FurnaceGUIExportTypes curExportType;
|
||||
|
||||
// ROM export specific
|
||||
DivROMExportOptions romTarget;
|
||||
DivConfig romConfig;
|
||||
bool romMultiFile;
|
||||
bool romExportSave;
|
||||
String romFilterName, romFilterExt;
|
||||
String romExportPath;
|
||||
DivROMExport* pendingExport;
|
||||
|
||||
// user presets window
|
||||
std::vector<int> selectedUserPreset;
|
||||
|
||||
|
@ -2687,9 +2692,8 @@ class FurnaceGUI {
|
|||
|
||||
void drawExportAudio(bool onWindow=false);
|
||||
void drawExportVGM(bool onWindow=false);
|
||||
void drawExportROM(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);
|
||||
void drawExportDMF(bool onWindow=false);
|
||||
|
|
|
@ -2482,7 +2482,7 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
break;
|
||||
}
|
||||
case DIV_SYSTEM_VERA: {
|
||||
int chipType=flags.getInt("chipType",1);
|
||||
int chipType=flags.getInt("chipType",2);
|
||||
|
||||
ImGui::Text(_("Chip revision:"));
|
||||
ImGui::Indent();
|
||||
|
@ -2494,6 +2494,10 @@ bool FurnaceGUI::drawSysConf(int chan, int sysPos, DivSystem type, DivConfig& fl
|
|||
chipType=1;
|
||||
altered=true;
|
||||
}
|
||||
if (ImGui::RadioButton(_("V 47.0.2 (Tri/Saw PW XOR)"),chipType==2)) {
|
||||
chipType=2;
|
||||
altered=true;
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
if (altered) {
|
||||
|
|
40
src/main.cpp
40
src/main.cpp
|
@ -87,7 +87,6 @@ String outName;
|
|||
String vgmOutName;
|
||||
String zsmOutName;
|
||||
String cmdOutName;
|
||||
String tiunaOutName;
|
||||
int benchMode=0;
|
||||
int subsong=-1;
|
||||
DivAudioExportOptions exportOptions;
|
||||
|
@ -112,9 +111,6 @@ bool infoMode=false;
|
|||
|
||||
bool noReportError=false;
|
||||
|
||||
int tiunaFirstBankSize=3072;
|
||||
int tiunaOtherBankSize=4096-48;
|
||||
|
||||
std::vector<TAParam> params;
|
||||
|
||||
#ifdef HAVE_LOCALE
|
||||
|
@ -447,12 +443,6 @@ TAParamResult pCmdOut(String val) {
|
|||
return TA_PARAM_SUCCESS;
|
||||
}
|
||||
|
||||
TAParamResult pTiunaOut(String val) {
|
||||
tiunaOutName=val;
|
||||
e.setAudio(DIV_AUDIO_DUMMY);
|
||||
return TA_PARAM_SUCCESS;
|
||||
}
|
||||
|
||||
bool needsValue(String param) {
|
||||
for (size_t i=0; i<params.size(); i++) {
|
||||
if (params[i].name==param) {
|
||||
|
@ -471,7 +461,6 @@ void initParams() {
|
|||
params.push_back(TAParam("D","direct",false,pDirect,"","set VGM export direct stream mode"));
|
||||
params.push_back(TAParam("Z","zsmout",true,pZSMOut,"<filename>","output .zsm data for Commander X16 Zsound"));
|
||||
params.push_back(TAParam("C","cmdout",true,pCmdOut,"<filename>","output command stream"));
|
||||
params.push_back(TAParam("T","tiunaout",true,pTiunaOut,"<filename>","output .asm data with TIunA sound data (TIA only)"));
|
||||
params.push_back(TAParam("L","loglevel",true,pLogLevel,"debug|info|warning|error","set the log level (info by default)"));
|
||||
params.push_back(TAParam("v","view",true,pView,"pattern|commands|nothing","set visualization (nothing by default)"));
|
||||
params.push_back(TAParam("i","info",false,pInfo,"","get info about a song"));
|
||||
|
@ -575,7 +564,6 @@ int main(int argc, char** argv) {
|
|||
vgmOutName="";
|
||||
zsmOutName="";
|
||||
cmdOutName="";
|
||||
tiunaOutName="";
|
||||
|
||||
// load config for locale
|
||||
e.prePreInit();
|
||||
|
@ -743,14 +731,14 @@ int main(int argc, char** argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (fileName.empty() && (benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="" || tiunaOutName!="")) {
|
||||
if (fileName.empty() && (benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="")) {
|
||||
logE("provide a file!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
if (e.preInit(consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="" || tiunaOutName!="")) {
|
||||
if (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="" || tiunaOutName!="") {
|
||||
if (e.preInit(consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="")) {
|
||||
if (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="") {
|
||||
logW("engine wants safe mode, but Furnace GUI is not going to start.");
|
||||
} else {
|
||||
safeMode=true;
|
||||
|
@ -762,7 +750,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (safeMode && (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="" || tiunaOutName!="")) {
|
||||
if (safeMode && (consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="")) {
|
||||
logE("you can't use safe mode and console/export mode together.");
|
||||
return 1;
|
||||
}
|
||||
|
@ -771,7 +759,7 @@ int main(int argc, char** argv) {
|
|||
e.setAudio(DIV_AUDIO_DUMMY);
|
||||
}
|
||||
|
||||
if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",TUT_INTRO_PLAYED)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="" || tiunaOutName!="")) {
|
||||
if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",TUT_INTRO_PLAYED)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || infoMode || outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="")) {
|
||||
logI("loading module...");
|
||||
FILE* f=ps_fopen(fileName.c_str(),"rb");
|
||||
if (f==NULL) {
|
||||
|
@ -863,7 +851,7 @@ int main(int argc, char** argv) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="" || tiunaOutName!="") {
|
||||
if (outName!="" || vgmOutName!="" || zsmOutName!="" || cmdOutName!="") {
|
||||
if (cmdOutName!="") {
|
||||
SafeWriter* w=e.saveCommand();
|
||||
if (w!=NULL) {
|
||||
|
@ -913,22 +901,6 @@ int main(int argc, char** argv) {
|
|||
reportError(fmt::sprintf(_("could not write ZSM! (%s)"),e.getLastError()));
|
||||
}
|
||||
}
|
||||
if (tiunaOutName!="") {
|
||||
SafeWriter* w=e.saveTiuna(NULL,"asmBaseLabel",tiunaFirstBankSize,tiunaOtherBankSize);
|
||||
if (w!=NULL) {
|
||||
FILE* f=ps_fopen(tiunaOutName.c_str(),"wb");
|
||||
if (f!=NULL) {
|
||||
fwrite(w->getFinalBuf(),1,w->size(),f);
|
||||
fclose(f);
|
||||
} else {
|
||||
reportError(fmt::sprintf(_("could not open file! (%s)"),e.getLastError()));
|
||||
}
|
||||
w->finish();
|
||||
delete w;
|
||||
} else {
|
||||
reportError(fmt::sprintf("could not write TIunA! (%s)",e.getLastError()));
|
||||
}
|
||||
}
|
||||
if (outName!="") {
|
||||
e.setConsoleMode(true);
|
||||
e.saveAudio(outName.c_str(),exportOptions);
|
||||
|
|
Loading…
Reference in a new issue