Merge branch 'master' of https://github.com/tildearrow/furnace into x1_010_bank

This commit is contained in:
cam900 2023-03-12 20:59:50 +09:00
commit b1070f531a
6 changed files with 88 additions and 4 deletions

View file

@ -132,8 +132,11 @@ namespace IGFD
#define resetButtonString ICON_FA_REPEAT
#endif // resetButtonString
#ifndef drivesButtonString
#define drivesButtonString "Drives"
#define drivesButtonString ICON_FA_HDD_O
#endif // drivesButtonString
#ifndef parentDirString
#define parentDirString ICON_FA_CHEVRON_UP
#endif // parentDirString
#ifndef editPathButtonString
#define editPathButtonString ICON_FA_PENCIL
#endif // editPathButtonString
@ -167,6 +170,9 @@ namespace IGFD
#ifndef buttonResetPathString
#define buttonResetPathString "Reset to current directory"
#endif // buttonResetPathString
#ifndef buttonParentDirString
#define buttonParentDirString "Go to parent directory"
#endif
#ifndef buttonCreateDirString
#define buttonCreateDirString "Create Directory"
#endif // buttonCreateDirString
@ -602,6 +608,10 @@ namespace IGFD
res.ext = pfn.substr(lastPoint + 1);
IGFD::Utils::ReplaceString(res.name, "." + res.ext, "");
}
if (res.path.empty()) {
res.path=separator;
}
if (!res.isOk)
{
@ -1191,7 +1201,7 @@ namespace IGFD
if (puDLGDirectoryMode) // directory mode
SetDefaultFileName(".");
else
SetDefaultFileName(puDLGDefaultFileName);
SetDefaultFileName("");
ScanDir(vFileDialogInternal, GetCurrentPath());
}
@ -1475,7 +1485,7 @@ namespace IGFD
infos->fileNameExt_optimized = prOptimizeFilenameForSearchOperations(infos->fileNameExt);
infos->fileType = vFileType;
if (infos->fileNameExt.empty() || (infos->fileNameExt == "." && !vFileDialogInternal.puFilterManager.puDLGFilters.empty())) return; // filename empty or filename is the current dir '.' //-V807
if (infos->fileNameExt.empty() || ((infos->fileNameExt == "." || infos->fileNameExt == "..") && !vFileDialogInternal.puFilterManager.puDLGFilters.empty())) return; // filename empty or filename is the current dir '.' //-V807
if (infos->fileNameExt != ".." && (vFileDialogInternal.puDLGflags & ImGuiFileDialogFlags_DontShowHiddenFiles) && infos->fileNameExt[0] == '.') // dont show hidden files
if (!vFileDialogInternal.puFilterManager.puDLGFilters.empty() || (vFileDialogInternal.puFilterManager.puDLGFilters.empty() && infos->fileNameExt != ".")) // except "." if in directory mode //-V728
return;
@ -2217,6 +2227,16 @@ namespace IGFD
if (ImGui::IsItemHovered())
ImGui::SetTooltip(buttonResetPathString);
ImGui::SameLine();
if (IMGUI_BUTTON(parentDirString))
{
if (SetPathOnParentDirectoryIfAny()) {
OpenCurrentPath(vFileDialogInternal);
}
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip(buttonParentDirString);
#ifdef WIN32
ImGui::SameLine();
@ -3401,7 +3421,7 @@ namespace IGFD
if (ps.isOk)
{
prFileDialogInternal.puFileManager.puDLGpath = ps.path;
prFileDialogInternal.puFileManager.SetDefaultFileName(vFilePathName);
prFileDialogInternal.puFileManager.SetDefaultFileName("");
prFileDialogInternal.puFilterManager.puDLGdefaultExt = "." + ps.ext;
}
else

View file

@ -1567,6 +1567,49 @@ void DivEngine::changeSong(size_t songIndex) {
prevRow=0;
}
void DivEngine::checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries) {
bool* inAssetDir=new bool[entries];
memset(inAssetDir,0,entries*sizeof(bool));
for (DivAssetDir& i: dir) {
for (size_t j=0; j<i.entries.size(); j++) {
// erase invalid entry
if (i.entries[j]<0 || i.entries[j]>=(int)entries) {
i.entries.erase(i.entries.begin()+j);
j--;
continue;
}
// mark entry as present
inAssetDir[j]=true;
}
}
// get unsorted directory
DivAssetDir* unsortedDir=NULL;
for (DivAssetDir& i: dir) {
if (i.name=="Unsorted") {
unsortedDir=&i;
break;
}
}
// create unsorted directory if it doesn't exist
if (unsortedDir==NULL) {
dir.push_back(DivAssetDir("Unsorted"));
unsortedDir=&(*dir.rbegin());
}
// add missing items to unsorted directory
for (size_t i=0; i<entries; i++) {
if (!inAssetDir[i]) {
unsortedDir->entries.push_back(i);
}
}
delete[] inAssetDir;
}
void DivEngine::swapChannelsP(int src, int dest) {
if (src<0 || src>=chans) return;
if (dest<0 || dest>=chans) return;

View file

@ -490,6 +490,9 @@ class DivEngine {
// change song (UNSAFE)
void changeSong(size_t songIndex);
// check whether an asset directory is complete
void checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries);
public:
DivSong song;
DivOrders* curOrders;

View file

@ -2935,6 +2935,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
size_t pos=reader.tell();
logD("reading sample data...");
for (int i=0; i<insCount; i++) {
logV("- %d: %d %d %d",i,pos,ds.sample[i]->samples,sampLens[i]);
if (!reader.seek(pos,SEEK_SET)) {
logD("%d: couldn't seek to %d",i,pos);
throw EndOfFileException(&reader,reader.tell());
@ -2944,6 +2945,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
}
// convert effects
logD("converting module...");
for (int ch=0; ch<=chCount; ch++) {
unsigned char fxCols=1;
for (int pat=0; pat<=patMax; pat++) {

View file

@ -411,6 +411,7 @@ void DivPlatformAmiga::tick(bool sysTick) {
if (chan[i].keyOn) {
rWrite(0x96,1<<i);
if (chan[i].useWave) {
rWrite(0x9a,(128<<i));
chWrite(i,0,0);
chWrite(i,2,i<<8);
chWrite(i,4,chan[i].audLen);
@ -500,6 +501,7 @@ int DivPlatformAmiga::dispatch(DivCommand c) {
case DIV_CMD_NOTE_ON: {
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
if (ins->amiga.useWave) {
if (!chan[c.chan].useWave) chan[c.chan].updateWave=true;
chan[c.chan].useWave=true;
chan[c.chan].audLen=(ins->amiga.waveLen+1)>>1;
if (chan[c.chan].insChanged) {

View file

@ -181,6 +181,16 @@ struct DivSubSong {
}
};
struct DivAssetDir {
String name;
std::vector<int> entries;
DivAssetDir():
name("New Directory") {}
DivAssetDir(String n):
name(n) {}
};
struct DivSong {
// version number used for saving the song.
// Furnace will save using the latest possible version,
@ -351,6 +361,10 @@ struct DivSong {
std::vector<unsigned int> patchbay;
std::vector<DivGroovePattern> grooves;
std::vector<DivAssetDir> insDir;
std::vector<DivAssetDir> waveDir;
std::vector<DivAssetDir> sampleDir;
DivInstrument nullIns, nullInsOPLL, nullInsOPL, nullInsOPLDrums, nullInsQSound;
DivWavetable nullWave;
DivSample nullSample;