Merge branch 'master' into feature/esfm

This commit is contained in:
Kagamiin~ 2023-10-17 15:53:21 -03:00
commit 8ae86f79a8
860 changed files with 517374 additions and 103 deletions

View file

@ -3112,7 +3112,7 @@ void DivEngine::noteOff(int chan) {
BUSY_END;
}
void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
bool DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
bool isViable[DIV_MAX_CHANS];
bool canPlayAnyway=false;
bool notInViableChannel=false;
@ -3148,7 +3148,7 @@ void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
}
}
if (!canPlayAnyway) return;
if (!canPlayAnyway) return false;
// 2. find a free channel
do {
@ -3156,7 +3156,7 @@ void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
chan[finalChan].midiNote=note;
chan[finalChan].midiAge=midiAgeCounter++;
pendingNotes.push_back(DivNoteEvent(finalChan,ins,note,vol,true));
return;
return true;
}
if (++finalChan>=chans) {
finalChan=0;
@ -3177,6 +3177,7 @@ void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
chan[candidate].midiNote=note;
chan[candidate].midiAge=midiAgeCounter++;
pendingNotes.push_back(DivNoteEvent(candidate,ins,note,vol,true));
return true;
}
void DivEngine::autoNoteOff(int ch, int note, int vol) {
@ -3639,7 +3640,8 @@ bool DivEngine::deinitAudioBackend(bool dueToSwitchMaster) {
return true;
}
void DivEngine::preInit() {
bool DivEngine::preInit(bool noSafeMode) {
bool wantSafe=false;
// register systems
if (!systemsRegistered) registerSystems();
@ -3647,6 +3649,13 @@ void DivEngine::preInit() {
initConfDir();
logD("config path: %s",configPath.c_str());
if (!noSafeMode) {
String safeModePath=configPath+DIR_SEPARATOR_STR+"safemode";
if (touchFile(safeModePath.c_str())==-EEXIST) {
wantSafe=true;
}
}
String logPath=configPath+DIR_SEPARATOR_STR+"furnace.log";
startLogFile(logPath.c_str());
@ -3660,6 +3669,17 @@ void DivEngine::preInit() {
SDL_SetHint("SDL_HINT_AUDIODRIVER",audioDriver.c_str());
}
#endif
if (wantSafe) {
logW("requesting safe mode.");
}
return wantSafe;
}
void DivEngine::everythingOK() {
String safeModePath=configPath+DIR_SEPARATOR_STR+"safemode";
deleteFile(safeModePath.c_str());
}
bool DivEngine::init() {

View file

@ -985,7 +985,8 @@ class DivEngine {
// stop note
void noteOff(int chan);
void autoNoteOn(int chan, int ins, int note, int vol=-1);
// returns whether it could
bool autoNoteOn(int chan, int ins, int note, int vol=-1);
void autoNoteOff(int chan, int note, int vol=-1);
void autoNoteOffAll();
@ -1195,12 +1196,15 @@ class DivEngine {
// quit dispatch
void quitDispatch();
// pre-initialize the engine.
void preInit();
// pre-initialize the engine. returns whether Furnace should run in safe mode.
bool preInit(bool noSafeMode=true);
// initialize the engine.
bool init();
// confirm that the engine is running (delete safe mode file).
void everythingOK();
// terminate the engine.
bool quit();

View file

@ -674,7 +674,7 @@ void DivEngine::registerSystems() {
sysDefs[DIV_SYSTEM_PCE]=new DivSysDef(
"PC Engine/TurboGrafx-16", NULL, 0x05, 0x05, 6, false, true, 0x161, false, 1U<<DIV_SAMPLE_DEPTH_8BIT,
"an '80's game console with a wavetable sound chip, popular in Japan.",
"an '80s game console with a wavetable sound chip, popular in Japan.",
{"Channel 1", "Channel 2", "Channel 3", "Channel 4", "Channel 5", "Channel 6"},
{"CH1", "CH2", "CH3", "CH4", "CH5", "CH6"},
{DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE},
@ -691,7 +691,7 @@ void DivEngine::registerSystems() {
sysDefs[DIV_SYSTEM_NES]=new DivSysDef(
"NES (Ricoh 2A03)", NULL, 0x06, 0x06, 5, false, true, 0x161, false, (1U<<DIV_SAMPLE_DEPTH_1BIT_DPCM)|(1U<<DIV_SAMPLE_DEPTH_8BIT),
"also known as Famicom in Japan, it's the most well-known game console of the '80's.",
"also known as Famicom in Japan, it's the most well-known game console of the '80s.",
{"Pulse 1", "Pulse 2", "Triangle", "Noise", "DPCM"},
{"S1", "S2", "TR", "NO", "DMC"},
{DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_WAVE, DIV_CH_NOISE, DIV_CH_PCM},
@ -792,7 +792,7 @@ void DivEngine::registerSystems() {
sysDefs[DIV_SYSTEM_AMIGA]=new DivSysDef(
"Amiga", NULL, 0x81, 0, 4, false, true, 0, false, 1U<<DIV_SAMPLE_DEPTH_8BIT,
"a computer from the '80's with full sampling capabilities, giving it a sound ahead of its time.",
"a computer from the '80s with full sampling capabilities, giving it a sound ahead of its time.",
{"Channel 1", "Channel 2", "Channel 3", "Channel 4"},
{"CH1", "CH2", "CH3", "CH4"},
{DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM},