furnace/src/engine/export.h

109 lines
2.7 KiB
C
Raw Normal View History

2023-03-13 05:20:54 -04:00
/**
* Furnace Tracker - multi-system chiptune tracker
2024-01-16 21:26:57 -05:00
* Copyright (C) 2021-2024 tildearrow and contributors
2023-03-13 05:20:54 -04:00
*
* 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"
2023-03-13 15:17:05 -04:00
#include <initializer_list>
2023-09-20 01:24:55 -04:00
#include "../pch.h"
2023-03-13 05:20:54 -04:00
class DivEngine;
enum DivROMExportOptions {
DIV_ROM_ABSTRACT=0,
DIV_ROM_AMIGA_VALIDATION,
2024-08-13 05:10:03 -04:00
DIV_ROM_ZSM,
DIV_ROM_TIUNA,
2023-03-13 05:20:54 -04:00
DIV_ROM_MAX
};
struct DivROMExportOutput {
String name;
SafeWriter* data;
DivROMExportOutput(String n, SafeWriter* d):
name(n),
data(d) {}
DivROMExportOutput():
name(""),
data(NULL) {}
};
struct DivROMExportProgress {
String name;
float amount;
};
2023-03-13 05:20:54 -04:00
class DivROMExport {
protected:
2024-08-13 15:34:06 -04:00
DivConfig conf;
std::vector<DivROMExportOutput> output;
void logAppend(String what);
2023-03-13 15:17:05 -04:00
public:
2024-08-13 15:34:06 -04:00
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();
2024-08-10 20:38:50 -04:00
virtual bool isRunning();
2024-08-13 15:34:06 -04:00
virtual DivROMExportProgress getProgress(int index=0);
2023-03-13 15:17:05 -04:00
virtual ~DivROMExport() {}
};
#define logAppendf(...) logAppend(fmt::sprintf(__VA_ARGS__))
2024-08-13 05:10:03 -04:00
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
};
2023-03-13 15:17:05 -04:00
struct DivROMExportDef {
2023-03-13 05:20:54 -04:00
const char* name;
const char* author;
const char* description;
const char* fileType;
const char* fileExt;
2024-08-13 05:10:03 -04:00
std::vector<DivSystem> requisites;
2023-03-13 05:20:54 -04:00
bool multiOutput;
2024-08-13 05:10:03 -04:00
DivROMExportReqPolicy requisitePolicy;
2023-03-13 05:20:54 -04:00
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):
2023-03-13 15:17:05 -04:00
name(n),
author(a),
description(d),
fileType(ft),
fileExt(fe),
2024-08-13 05:10:03 -04:00
multiOutput(multiOut),
requisitePolicy(reqPolicy) {
requisites=req;
2023-03-13 15:17:05 -04:00
}
2023-03-13 05:20:54 -04:00
};
#endif