Merge branch 'master' into firpbch2_mode

This commit is contained in:
Charles J. Cliffe 2018-02-20 00:17:37 -05:00
commit b193456ccb
2 changed files with 25 additions and 16 deletions

View File

@ -106,7 +106,7 @@ bool AudioFileWAV::closeFile()
// Fix the data chunk header to contain the data size // Fix the data chunk header to contain the data size
outputFileStream.seekp(dataChunkPos + 4); outputFileStream.seekp(dataChunkPos + 4);
write_word(outputFileStream, file_length - dataChunkPos + 8); write_word(outputFileStream, file_length - (dataChunkPos + 8), 4);
// Fix the file header to contain the proper RIFF chunk size, which is (file size - 8) bytes // Fix the file header to contain the proper RIFF chunk size, which is (file size - 8) bytes
outputFileStream.seekp(0 + 4); outputFileStream.seekp(0 + 4);

View File

@ -15,7 +15,7 @@
#endif #endif
#ifndef RES_FOLDER #ifndef RES_FOLDER
#define RES_FOLDER "" #define RES_FOLDER L""
#endif #endif
#define GC_DRAW_COUNT_PERIOD 50 #define GC_DRAW_COUNT_PERIOD 50
@ -217,19 +217,28 @@ void GLFont::loadFontOnce() {
wxString resourceFolder = RES_FOLDER; wxString resourceFolder = RES_FOLDER;
#endif #endif
//full font file path wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
//1) First try : RES_FOLDER/fonts/*
wxFileName fontDefFileName = wxFileName(resourceFolder + L"/" + fontDefFileSource); wxFileName fontDefFileName = wxFileName(resourceFolder + L"/" + fontDefFileSource);
if (!fontDefFileName.Exists()) { bool fontFilePathFound = fontDefFileName.Exists();
wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
//Full Path where the fonts are, including file name // 2) Second try: [Cubic exe path]/RES_FOLDER/fonts/*
fontDefFileName = wxFileName(exePath.GetPath() + L"/"+ fontDefFileSource); if (!fontFilePathFound) {
if (!fontDefFileName.FileExists()) { fontDefFileName = wxFileName(exePath.GetPath() + L"/" + RES_FOLDER + L"/" + fontDefFileSource);
std::cout << "Font file " << fontDefFileName.GetFullPath() << " does not exist?" << std::endl; fontFilePathFound = fontDefFileName.Exists();
return; }
}
// 3) Third try: [Cubic exe path]/fonts/*
if (!fontFilePathFound) {
fontDefFileName = wxFileName(exePath.GetPath() + L"/" + fontDefFileSource);
fontFilePathFound = fontDefFileName.Exists();
}
if (fontFilePathFound) {
if (!fontDefFileName.IsFileReadable()) { if (!fontDefFileName.IsFileReadable()) {
std::cout << "Font file " << fontDefFileName.GetFullPath() << " is not readable?" << std::endl; std::cout << "Font file " << fontDefFileName.GetFullPath() << " is not readable?" << std::endl;
@ -238,8 +247,8 @@ void GLFont::loadFontOnce() {
} }
else { else {
if (!fontDefFileName.IsFileReadable()) { if (!fontDefFileName.FileExists()) {
std::cout << "Font file " << fontDefFileName.GetFullPath() << " is not readable?" << std::endl; std::cout << "Font file " << fontDefFileName.GetFullPath() << " does not exist?" << std::endl;
return; return;
} }
} }