add a safe mode
disables audio output enables software rendering disables font loading not automatic yet
This commit is contained in:
parent
80c9795773
commit
c420b55a16
|
@ -160,6 +160,9 @@ const char* aboutLine[]={
|
|||
"powered by:",
|
||||
"Dear ImGui by Omar Cornut",
|
||||
"SDL2 by Sam Lantinga",
|
||||
#ifdef HAVE_FREETYPE
|
||||
"FreeType",
|
||||
#endif
|
||||
"zlib by Jean-loup Gailly",
|
||||
"and Mark Adler",
|
||||
"libsndfile by Erik de Castro Lopo",
|
||||
|
|
|
@ -90,6 +90,10 @@ void FurnaceGUI::bindEngine(DivEngine* eng) {
|
|||
wavePreview.setEngine(e);
|
||||
}
|
||||
|
||||
void FurnaceGUI::enableSafeMode() {
|
||||
safeMode=true;
|
||||
}
|
||||
|
||||
const char* FurnaceGUI::noteName(short note, short octave) {
|
||||
if (note==100) {
|
||||
return noteOffLabel;
|
||||
|
@ -1893,7 +1897,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
if (!dirExists(workingDirFont)) workingDirFont=getHomeDir();
|
||||
hasOpened=fileDialog->openLoad(
|
||||
"Select Font",
|
||||
{"compatible files", "*.ttf *.otf *.ttc"},
|
||||
{"compatible files", "*.ttf *.otf *.ttc *.dfont *.pcf *.psf *.fon"},
|
||||
workingDirFont,
|
||||
dpiScale
|
||||
);
|
||||
|
@ -1902,7 +1906,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
if (!dirExists(workingDirFont)) workingDirFont=getHomeDir();
|
||||
hasOpened=fileDialog->openLoad(
|
||||
"Select Font",
|
||||
{"compatible files", "*.ttf *.otf *.ttc"},
|
||||
{"compatible files", "*.ttf *.otf *.ttc *.dfont *.pcf *.psf *.fon"},
|
||||
workingDirFont,
|
||||
dpiScale
|
||||
);
|
||||
|
@ -1911,7 +1915,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
if (!dirExists(workingDirFont)) workingDirFont=getHomeDir();
|
||||
hasOpened=fileDialog->openLoad(
|
||||
"Select Font",
|
||||
{"compatible files", "*.ttf *.otf *.ttc"},
|
||||
{"compatible files", "*.ttf *.otf *.ttc *.dfont *.pcf *.psf *.fon"},
|
||||
workingDirFont,
|
||||
dpiScale
|
||||
);
|
||||
|
@ -3849,7 +3853,7 @@ bool FurnaceGUI::loop() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (firstFrame) {
|
||||
if (firstFrame && !safeMode) {
|
||||
if (!tutorial.introPlayed || settings.alwaysPlayIntro==3 || (settings.alwaysPlayIntro==2 && curFileName.empty())) {
|
||||
unsigned char* introTemp=new unsigned char[intro_fur_len];
|
||||
memcpy(introTemp,intro_fur,intro_fur_len);
|
||||
|
@ -6735,6 +6739,10 @@ bool FurnaceGUI::init() {
|
|||
SDL_SetHint(SDL_HINT_RENDER_DRIVER,settings.renderDriver.c_str());
|
||||
}
|
||||
|
||||
if (safeMode) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER,"software");
|
||||
}
|
||||
|
||||
logD("starting render backend...");
|
||||
if (!rend->init(sdlWin)) {
|
||||
logE("it failed...");
|
||||
|
@ -7122,6 +7130,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
displayEditString(false),
|
||||
mobileEdit(false),
|
||||
killGraphics(false),
|
||||
safeMode(false),
|
||||
midiWakeUp(true),
|
||||
audioEngineChanged(false),
|
||||
settingsChanged(false),
|
||||
|
|
|
@ -1352,6 +1352,7 @@ class FurnaceGUI {
|
|||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
|
||||
bool mobileEdit;
|
||||
bool killGraphics;
|
||||
bool safeMode;
|
||||
bool midiWakeUp;
|
||||
bool audioEngineChanged, settingsChanged, debugFFT;
|
||||
bool willExport[DIV_MAX_CHIPS];
|
||||
|
@ -2457,6 +2458,7 @@ class FurnaceGUI {
|
|||
const char* noteName(short note, short octave);
|
||||
bool decodeNote(const char* what, short& note, short& octave);
|
||||
void bindEngine(DivEngine* eng);
|
||||
void enableSafeMode();
|
||||
void updateScroll(int amount);
|
||||
void addScroll(int amount);
|
||||
void setFileName(String name);
|
||||
|
|
|
@ -260,7 +260,7 @@ void FurnaceGUI::drawOsc() {
|
|||
if (oscWidth>2048) oscWidth=2048;
|
||||
|
||||
ImDrawListFlags prevFlags=dl->Flags;
|
||||
if (!settings.oscAntiAlias) {
|
||||
if (!settings.oscAntiAlias || safeMode) {
|
||||
dl->Flags&=~(ImDrawListFlags_AntiAliasedLines|ImDrawListFlags_AntiAliasedLinesUseTex);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@
|
|||
bool FurnaceGUI::initRender() {
|
||||
if (rend!=NULL) return false;
|
||||
|
||||
if (settings.renderBackend=="OpenGL") {
|
||||
if (safeMode) {
|
||||
renderBackend=GUI_BACKEND_SDL;
|
||||
} else if (settings.renderBackend=="OpenGL") {
|
||||
renderBackend=GUI_BACKEND_GL;
|
||||
} else if (settings.renderBackend=="DirectX 11") {
|
||||
renderBackend=GUI_BACKEND_DX11;
|
||||
|
|
|
@ -4805,6 +4805,16 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
|||
sty.FrameShading=(float)settings.guiColorsShading/100.0f;
|
||||
}
|
||||
|
||||
if (safeMode) {
|
||||
sty.WindowRounding=0.0f;
|
||||
sty.FrameRounding=0.0f;
|
||||
sty.GrabRounding=0.0f;
|
||||
sty.FrameShading=0.0f;
|
||||
sty.AntiAliasedLines=false;
|
||||
sty.AntiAliasedLinesUseTex=false;
|
||||
sty.AntiAliasedFill=false;
|
||||
}
|
||||
|
||||
if (mobileUI) {
|
||||
sty.FramePadding=ImVec2(8.0f,6.0f);
|
||||
}
|
||||
|
@ -4847,7 +4857,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
|||
sysCmd2Grad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
|
||||
}
|
||||
|
||||
if (updateFonts) {
|
||||
if (updateFonts && !safeMode) {
|
||||
// prepare
|
||||
#ifdef HAVE_FREETYPE
|
||||
if (settings.fontBackend==1) {
|
||||
|
@ -5091,6 +5101,15 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
|||
}
|
||||
}
|
||||
|
||||
mainFont->FallbackChar='?';
|
||||
mainFont->EllipsisChar='.';
|
||||
mainFont->EllipsisCharCount=3;
|
||||
} else if (updateFonts) {
|
||||
// safe mode
|
||||
mainFont=ImGui::GetIO().Fonts->AddFontDefault();
|
||||
patFont=mainFont;
|
||||
bigFont=mainFont;
|
||||
headFont=mainFont;
|
||||
|
||||
mainFont->FallbackChar='?';
|
||||
mainFont->EllipsisChar='.';
|
||||
|
@ -5113,6 +5132,10 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
|||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ttf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".otf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ttc",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".dfont",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fon",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".pcf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".psf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
|
||||
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".mod",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fc13",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
|
||||
|
|
22
src/main.cpp
22
src/main.cpp
|
@ -75,6 +75,8 @@ bool displayEngineFailError=false;
|
|||
bool cmdOutBinary=false;
|
||||
bool vgmOutDirect=false;
|
||||
|
||||
bool safeMode=false;
|
||||
|
||||
std::vector<TAParam> params;
|
||||
|
||||
TAParamResult pHelp(String) {
|
||||
|
@ -99,8 +101,10 @@ TAParamResult pAudio(String val) {
|
|||
e.setAudio(DIV_AUDIO_JACK);
|
||||
} else if (val=="sdl") {
|
||||
e.setAudio(DIV_AUDIO_SDL);
|
||||
} else if (val=="portaudio") {
|
||||
e.setAudio(DIV_AUDIO_PORTAUDIO);
|
||||
} else {
|
||||
logE("invalid value for audio engine! valid values are: jack, sdl.");
|
||||
logE("invalid value for audio engine! valid values are: jack, sdl, portaudio.");
|
||||
return TA_PARAM_ERROR;
|
||||
}
|
||||
return TA_PARAM_SUCCESS;
|
||||
|
@ -125,6 +129,11 @@ TAParamResult pConsole(String val) {
|
|||
return TA_PARAM_SUCCESS;
|
||||
}
|
||||
|
||||
TAParamResult pSafeMode(String val) {
|
||||
safeMode=true;
|
||||
return TA_PARAM_SUCCESS;
|
||||
}
|
||||
|
||||
TAParamResult pBinary(String val) {
|
||||
cmdOutBinary=true;
|
||||
return TA_PARAM_SUCCESS;
|
||||
|
@ -171,6 +180,9 @@ TAParamResult pVersion(String) {
|
|||
printf("- RtMidi by Gary P. Scavone (RtMidi license)\n");
|
||||
printf("- backward-cpp by Google (MIT)\n");
|
||||
printf("- Dear ImGui by Omar Cornut (MIT)\n");
|
||||
#ifdef HAVE_FREETYPE
|
||||
printf("- FreeType (GPLv2)\n");
|
||||
#endif
|
||||
printf("- Portable File Dialogs by Sam Hocevar (WTFPL)\n");
|
||||
printf("- Native File Dialog (modified version) by Frogtoss Games (zlib license)\n");
|
||||
printf("- FFTW by Matteo Frigo and Steven G. Johnson (GPLv2)\n");
|
||||
|
@ -326,7 +338,7 @@ bool needsValue(String param) {
|
|||
void initParams() {
|
||||
params.push_back(TAParam("h","help",false,pHelp,"","display this help"));
|
||||
|
||||
params.push_back(TAParam("a","audio",true,pAudio,"jack|sdl","set audio engine (SDL by default)"));
|
||||
params.push_back(TAParam("a","audio",true,pAudio,"jack|sdl|portaudio","set audio engine (SDL by default)"));
|
||||
params.push_back(TAParam("o","output",true,pOutput,"<filename>","output audio to file"));
|
||||
params.push_back(TAParam("O","vgmout",true,pVGMOut,"<filename>","output .vgm data"));
|
||||
params.push_back(TAParam("D","direct",false,pDirect,"","set VGM export direct stream mode"));
|
||||
|
@ -340,6 +352,7 @@ void initParams() {
|
|||
params.push_back(TAParam("l","loops",true,pLoops,"<count>","set number of loops (-1 means loop forever)"));
|
||||
params.push_back(TAParam("s","subsong",true,pSubSong,"<number>","set sub-song"));
|
||||
params.push_back(TAParam("o","outmode",true,pOutMode,"one|persys|perchan","set file output mode"));
|
||||
params.push_back(TAParam("S","safemode",false,pSafeMode,"","enable safe mode (software rendering and no audio)"));
|
||||
|
||||
params.push_back(TAParam("B","benchmark",true,pBenchmark,"render|seek","run performance test"));
|
||||
|
||||
|
@ -496,6 +509,10 @@ int main(int argc, char** argv) {
|
|||
|
||||
e.preInit();
|
||||
|
||||
if (safeMode) {
|
||||
e.setAudio(DIV_AUDIO_DUMMY);
|
||||
}
|
||||
|
||||
if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",false)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
|
||||
logI("loading module...");
|
||||
FILE* f=ps_fopen(fileName.c_str(),"rb");
|
||||
|
@ -654,6 +671,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
if (safeMode) g.enableSafeMode();
|
||||
g.bindEngine(&e);
|
||||
if (!g.init()) {
|
||||
reportError(g.getLastError());
|
||||
|
|
Loading…
Reference in a new issue