DO NOT USE - THIS FAILS - WORK IN PROGRESS

This commit is contained in:
tildearrow 2022-05-14 18:19:07 -05:00
parent 06ec22d6a5
commit 14053f70cb
5 changed files with 73 additions and 36 deletions

View File

@ -354,6 +354,7 @@ src/engine/platform/c64.cpp
src/engine/platform/arcade.cpp
src/engine/platform/tx81z.cpp
src/engine/platform/ym2203.cpp
src/engine/platform/ym2203ext.cpp
src/engine/platform/ym2608.cpp
src/engine/platform/ym2610.cpp
src/engine/platform/ym2610ext.cpp

View File

@ -17,20 +17,20 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "ym2610bext.h"
#include "ym2203ext.h"
#include "../engine.h"
#include <math.h>
#include "ym2610shared.h"
#include "fmshared_OPN.h"
int DivPlatformYM2610BExt::dispatch(DivCommand c) {
int DivPlatformYM2203Ext::dispatch(DivCommand c) {
if (c.chan<2) {
return DivPlatformYM2610B::dispatch(c);
return DivPlatformYM2203::dispatch(c);
}
if (c.chan>5) {
c.chan-=3;
return DivPlatformYM2610B::dispatch(c);
return DivPlatformYM2203::dispatch(c);
}
int ch=c.chan-2;
int ordch=orderedOps[ch];
@ -384,7 +384,7 @@ static int opChanOffsH[4]={
0xad, 0xae, 0xac, 0xa6
};
void DivPlatformYM2610BExt::tick(bool sysTick) {
void DivPlatformYM2203Ext::tick(bool sysTick) {
if (extMode) {
bool writeSomething=false;
unsigned char writeMask=2;
@ -401,7 +401,7 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
}
}
DivPlatformYM2610B::tick(sysTick);
DivPlatformYM2203::tick(sysTick);
bool writeNoteOn=false;
unsigned char writeMask=2;
@ -438,13 +438,13 @@ void DivPlatformYM2610BExt::tick(bool sysTick) {
}
}
void DivPlatformYM2610BExt::muteChannel(int ch, bool mute) {
void DivPlatformYM2203Ext::muteChannel(int ch, bool mute) {
if (ch<2) {
DivPlatformYM2610B::muteChannel(ch,mute);
DivPlatformYM2203::muteChannel(ch,mute);
return;
}
if (ch>5) {
DivPlatformYM2610B::muteChannel(ch-3,mute);
DivPlatformYM2203::muteChannel(ch-3,mute);
return;
}
isOpMuted[ch-2]=mute;
@ -462,7 +462,7 @@ void DivPlatformYM2610BExt::muteChannel(int ch, bool mute) {
}
}
void DivPlatformYM2610BExt::forceIns() {
void DivPlatformYM2203Ext::forceIns() {
for (int i=0; i<6; i++) {
for (int j=0; j<4; j++) {
unsigned short baseAddr=chanOffs[i]|opOffs[j];
@ -494,7 +494,6 @@ void DivPlatformYM2610BExt::forceIns() {
rWrite(baseAddr+ADDR_SSG,op.ssgEnv&15);
}
rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3));
rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
if (chan[i].active) {
chan[i].keyOn=true;
chan[i].freqChanged=true;
@ -518,23 +517,23 @@ void DivPlatformYM2610BExt::forceIns() {
}
}
void* DivPlatformYM2610BExt::getChanState(int ch) {
void* DivPlatformYM2203Ext::getChanState(int ch) {
if (ch>=6) return &chan[ch-3];
if (ch>=2) return &opChan[ch-2];
return &chan[ch];
}
DivDispatchOscBuffer* DivPlatformYM2610BExt::getOscBuffer(int ch) {
DivDispatchOscBuffer* DivPlatformYM2203Ext::getOscBuffer(int ch) {
if (ch>=6) return oscBuf[ch-3];
if (ch<3) return oscBuf[ch];
return NULL;
}
void DivPlatformYM2610BExt::reset() {
DivPlatformYM2610B::reset();
void DivPlatformYM2203Ext::reset() {
DivPlatformYM2203::reset();
for (int i=0; i<4; i++) {
opChan[i]=DivPlatformYM2610BExt::OpChannel();
opChan[i]=DivPlatformYM2203Ext::OpChannel();
opChan[i].vol=127;
}
@ -543,12 +542,12 @@ void DivPlatformYM2610BExt::reset() {
extMode=true;
}
bool DivPlatformYM2610BExt::keyOffAffectsArp(int ch) {
bool DivPlatformYM2203Ext::keyOffAffectsArp(int ch) {
return (ch>8);
}
void DivPlatformYM2610BExt::notifyInsChange(int ins) {
DivPlatformYM2610B::notifyInsChange(ins);
void DivPlatformYM2203Ext::notifyInsChange(int ins) {
DivPlatformYM2203::notifyInsChange(ins);
for (int i=0; i<4; i++) {
if (opChan[i].ins==ins) {
opChan[i].insChanged=true;
@ -556,8 +555,8 @@ void DivPlatformYM2610BExt::notifyInsChange(int ins) {
}
}
int DivPlatformYM2610BExt::init(DivEngine* parent, int channels, int sugRate, unsigned int flags) {
DivPlatformYM2610B::init(parent,channels,sugRate,flags);
int DivPlatformYM2203Ext::init(DivEngine* parent, int channels, int sugRate, unsigned int flags) {
DivPlatformYM2203::init(parent,channels,sugRate,flags);
for (int i=0; i<4; i++) {
isOpMuted[i]=false;
}
@ -566,9 +565,9 @@ int DivPlatformYM2610BExt::init(DivEngine* parent, int channels, int sugRate, un
return 19;
}
void DivPlatformYM2610BExt::quit() {
DivPlatformYM2610B::quit();
void DivPlatformYM2203Ext::quit() {
DivPlatformYM2203::quit();
}
DivPlatformYM2610BExt::~DivPlatformYM2610BExt() {
DivPlatformYM2203Ext::~DivPlatformYM2203Ext() {
}

View File

@ -19,9 +19,9 @@
#include "../dispatch.h"
#include "ym2610b.h"
#include "ym2203.h"
class DivPlatformYM2610BExt: public DivPlatformYM2610B {
class DivPlatformYM2203Ext: public DivPlatformYM2203 {
struct OpChannel {
DivMacroInt std;
unsigned char freqH, freqL;
@ -47,5 +47,5 @@ class DivPlatformYM2610BExt: public DivPlatformYM2610B {
void notifyInsChange(int ins);
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
void quit();
~DivPlatformYM2610BExt();
~DivPlatformYM2203Ext();
};

View File

@ -19,6 +19,8 @@
#include "song.h"
DivOrders emptyOrders;
void DivSong::clearSongData() {
for (int i=0; i<DIV_MAX_CHANS; i++) {
pat[i].wipePatterns();

View File

@ -110,6 +110,31 @@ enum DivSystem {
DIV_SYSTEM_DUMMY
};
extern DivOrders emptyOrders;
struct DivSubSong {
String name, notes;
unsigned char hilightA, hilightB;
unsigned char timeBase, speed1, speed2, arpLen;
bool pal;
bool customTempo;
float hz;
int patLen, ordersLen;
DivOrders orders;
DivChannelData pat[DIV_MAX_CHANS];
bool chanShow[DIV_MAX_CHANS];
unsigned char chanCollapse[DIV_MAX_CHANS];
DivSubSong() {
for (int i=0; i<DIV_MAX_CHANS; i++) {
chanShow[i]=true;
chanCollapse[i]=0;
}
}
};
struct DivSong {
// version number used for saving the song.
// Furnace will save using the latest possible version,
@ -156,14 +181,21 @@ struct DivSong {
// - introduces Genesis system
// - introduces system number
// - patterns now stored in current known format
// - 8: ???
// - only used in the Medivo YMU cover
// - 7: ???
// - only present in a later version of First.dmf
// - pattern format changes: empty field is 0xFF instead of 0x80
// - instrument now stored in pattern
// - 5: BETA 3
// - adds arpeggio tick
// - 4: BETA 2
// - possibly adds instrument number (stored in channel)?
// - cannot confirm as I don't have any version 4 modules
// - 3: BETA 1
// - possibly the first version that could save
// - basic format, no system number, 16 instruments, one speed, YMU759-only
// - patterns were stored in a different format (chars instead of shorts)
// - patterns were stored in a different format (chars instead of shorts) and no instrument
// - if somebody manages to find a version 2 or even 1 module, please tell me as it will be worth more than a luxury vehicle
unsigned short version;
bool isDMF;
@ -345,14 +377,16 @@ struct DivSong {
bool snDutyReset;
bool pitchMacroIsLinear;
DivOrders orders;
DivOrders* orders;
std::vector<DivInstrument*> ins;
DivChannelData pat[DIV_MAX_CHANS];
DivChannelData* pat;
std::vector<DivWavetable*> wave;
std::vector<DivSample*> sample;
bool chanShow[DIV_MAX_CHANS];
unsigned char chanCollapse[DIV_MAX_CHANS];
std::vector<DivSubSong> subsongs;
bool* chanShow;
unsigned char* chanCollapse;
DivInstrument nullIns, nullInsOPLL, nullInsOPL, nullInsQSound;
DivWavetable nullWave;
@ -457,10 +491,11 @@ struct DivSong {
systemPan[i]=0;
systemFlags[i]=0;
}
for (int i=0; i<DIV_MAX_CHANS; i++) {
chanShow[i]=true;
chanCollapse[i]=0;
}
subsongs.push_back(DivSubSong());
chanShow=subsongs[0].chanShow;
chanCollapse=subsongs[0].chanCollapse;
orders=&subsongs[0].orders;
pat=subsongs[0].pat;
system[0]=DIV_SYSTEM_YM2612;
system[1]=DIV_SYSTEM_SMS;