From 52c51c8a45ec1fe32bcd21b35428192e4b7d3f83 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 20 Sep 2017 12:34:53 +0000 Subject: [PATCH] * Made Dink HD work with DFArc. Either you can put DFArc in the Dink HD dir and add "dmods" as the additional dmod directory so it can find mods installed by Dink HD too, or you can keep Dink HD completely separate, and enter the full path/exe to Dink HD's .exe in DFArc config and that works too. It's kind of weird that Dink HD puts its mods in a subdir called "dmods" as compared to the original Dink which useds its root dir. I could change that but.. meh. * Added support for -window and -debug from the command line. Dink HD remembers the last setting already, so -window would only have any effect if it was last used as fullscreen * Added Dan Walma's improved shadow patch git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1497 353e56fe-9613-0410-8469-b96ad8e6f29c --- script/win_installer/readme.txt | 19 +++++-- source/App.cpp | 68 ++++++++++++++++++++++--- source/App.h | 1 + source/dink/dink.cpp | 72 ++++++++++++++++----------- windows_vs2017/winRTDink.vcxproj.user | 40 ++++++++++++++- 5 files changed, 159 insertions(+), 41 deletions(-) diff --git a/script/win_installer/readme.txt b/script/win_installer/readme.txt index 89fd2a1..c1093a7 100644 --- a/script/win_installer/readme.txt +++ b/script/win_installer/readme.txt @@ -25,7 +25,7 @@ mouse to navigate the initial menus to start the game Supported command line options: -game (Example: dink.exe -game c:\dmods\island ) (this also sets -dmodpath automatically to the dmods parent directory) --dmodpath (Example: dink.exe -game c:\dmods ) +-dmodpath or --refdir (Example: dink.exe -game c:\dmods ) ------------- BETA VERSION ----------------- @@ -136,7 +136,18 @@ www.rtsoft.com * Mouse can now be used to select dialog options * Fixed mouse issue with Bugmania in the town where it wasn't sending button down messages * Made escape open the Dink HD menu even when wait_for_button is being used. This may be a problem if any DMODs require ESCAPE to be a button that is used though - - - - Note: Save state format has been changed again, so old save states won't load + +------ Change log for 1.7.6 ---------- + +* Made Dink HD work with DFArc. Either you can put DFArc in the Dink HD dir and add "dmods" as the additional dmod directory so it can find +mods installed by Dink HD too, or you can keep Dink HD completely separate, and enter the full path/exe to Dink HD's .exe in DFArc config and that works too. + +It's kind of weird that Dink HD puts its mods in a subdir called "dmods" as compared to the original Dink which useds its root dir. I could change that but.. meh. + +* Added support for -window and -debug from the command line. Dink HD remembers the last setting already, so -window would only have any effect +if it was last used as fullscreen + +* Added Dan Walma's improved shadow patch + + diff --git a/source/App.cpp b/source/App.cpp index 978088b..ff01645 100644 --- a/source/App.cpp +++ b/source/App.cpp @@ -27,12 +27,13 @@ extern int g_winVideoScreenX; extern int g_winVideoScreenY; extern bool g_bUseBorderlessFullscreenOnWindows; +void AddText(const char *tex, const char *filename); #include "StackWalker/StackUtils.h" extern bool g_bIsFullScreen; #endif - +extern bool g_script_debug_mode; extern Surface g_transitionSurf; #ifdef RT_MOGA_ENABLED @@ -118,6 +119,7 @@ AudioManagerSDL g_audioManager; #include "Gamepad/GamepadProviderDirectX.h" #include "Audio/AudioManagerFMODStudio.h" + AudioManagerFMOD g_audioManager; //if we wanted FMOD sound in windows #endif @@ -180,8 +182,8 @@ App::App() m_bDidPostInit = false; m_bHasDMODSupport = true; //for mobiles - m_version = 1.75f; - m_versionString = "V1.7.5"; + m_version = 1.76f; + m_versionString = "V1.7.6"; m_build = 1; m_bCheatsEnabled = false; @@ -235,6 +237,18 @@ void App::OniCadeDisconnected(GamepadProvider *pProvider) } } +bool App::DoesCommandLineParmExist(string parm) +{ + vector parms = GetBaseApp()->GetCommandLineParms(); + parm = ToLowerCaseString(parm); + + for (int i = 0; i < parms.size(); i++) + { + if (ToLowerCaseString(parms[i]) == parm) return true; + } + return false; +} + bool App::Init() { @@ -242,6 +256,8 @@ bool App::Init() InitUnhandledExceptionFilter(); #endif + + SetDefaultButtonStyle(Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH_RELEASE); SetManualRotationMode(false); @@ -249,7 +265,7 @@ bool App::Init() int scaleToX = 480; int scaleToY = 320; - if (IsTabletSize() || IsDesktop) + if (IsTabletSize() || IsDesktop()) { scaleToX = 1024; scaleToY = 768; @@ -317,6 +333,29 @@ bool App::Init() return false; } + + LogMsg("Initializing Dink HD %s", GetVersionString().c_str()); + + vector parm = GetBaseApp()->GetCommandLineParms(); + + string parms; + for (int i = 0; i < parm.size(); i++) + { + if (i != 0) parms += " "; + parms += parm[i]; + } + + if (!parm.empty()) + { + string text = string("Run with parms: " + string(parms) + "\r\n\r\n"); + +#ifdef WINAPI + OutputDebugString(text.c_str()); +#endif + AddText(text.c_str(), (GetSavePath() + "log.txt").c_str()); + } + + m_adManager.Init(); #ifdef RT_CHARTBOOST_ENABLED @@ -391,6 +430,7 @@ bool App::Init() RemoveFile("temp.dmod"); } + switch (GetPlatformID()) { case PLATFORM_ID_WINDOWS: @@ -529,10 +569,19 @@ if (GetEmulatedPlatformID() == PLATFORM_ID_IOS) int videox = GetApp()->GetVarWithDefault("video_x", uint32(640))->GetUINT32(); int videoy = GetApp()->GetVarWithDefault("video_y", uint32(480))->GetUINT32(); int fullscreen = GetApp()->GetVarWithDefault("fullscreen", uint32(1))->GetUINT32(); - bool borderlessfullscreen = GetApp()->GetVarWithDefault("fullscreen", uint32(0))->GetUINT32(); + + if (DoesCommandLineParmExist("-window") || DoesCommandLineParmExist("-windowed")) + { + fullscreen = false; + GetApp()->GetVar("fullscreen")->Set(uint32(0)); + } + + if (DoesCommandLineParmExist("-debug") ) + { + g_script_debug_mode = true; + } - if (fullscreen && g_bUseBorderlessFullscreenOnWindows) { LogMsg("Setting fullscreen..."); @@ -910,6 +959,13 @@ bool App::OnPreInitVideo() } g_bIsFullScreen = temp.GetVarWithDefault("fullscreen", uint32(1))->GetUINT32(); + + if (DoesCommandLineParmExist("-window") || DoesCommandLineParmExist("-windowed")) + { + g_bIsFullScreen = false; + GetApp()->GetVar("fullscreen")->Set(uint32(0)); + } + g_bUseBorderlessFullscreenOnWindows = temp.GetVarWithDefault("borderless_fullscreen", uint32(0))->GetUINT32() != 0; diff --git a/source/App.h b/source/App.h index a146cd2..9251874 100644 --- a/source/App.h +++ b/source/App.h @@ -100,6 +100,7 @@ private: void SaveAllData(); void OnPreEnterBackground(VariantList *pVList); void OniCadeDisconnected(GamepadProvider *pProvider); + bool DoesCommandLineParmExist(string parm); float m_version; string m_versionString; int m_build; diff --git a/source/dink/dink.cpp b/source/dink/dink.cpp index 637e981..1b93436 100644 --- a/source/dink/dink.cpp +++ b/source/dink/dink.cpp @@ -92,7 +92,7 @@ int32 g_nlist[10]; char in_default[200]; bool g_bInitiateScreenMove; bool g_bTransitionActive; -bool g_script_debug_mode; +bool g_script_debug_mode =false; uint16 decipher_savegame; uint32 g_soundTimer = 0; @@ -16211,7 +16211,7 @@ void SetDefaultVars(bool bFullClear) g_dglos.g_stopEntireGame = 0; g_bInitiateScreenMove = false; g_bTransitionActive = false; - g_script_debug_mode = false; + #ifdef _DEBUG //g_script_debug_mode = true; //script debugging mode. Alt-D toggles this also, plus there is a toggle on the debug menu #endif @@ -16310,52 +16310,66 @@ string GetDMODRootPath(string *pDMODNameOutOrNull) #if defined(WIN32) || defined(PLATFORM_HTML5) string dmodpath = "dmods/"; + string refdir = ""; vector parms = GetBaseApp()->GetCommandLineParms(); - for (int i=0; i < parms.size(); i++) + for (int i = 0; i < parms.size(); i++) { - if (parms[i] == "-dmodpath") + if (parms[i] == "--refdir" || parms[i] == "-dmodpath") { - if (parms.size() > i+1) + if (parms.size() > i + 1) { - dmodpath = ""; - for (int n=i+1; n < parms.size(); n++) - { - dmodpath +=parms[n]; - if (n < parms.size()-1) - { - dmodpath += " "; - } - } - StringReplace("\\", "/", dmodpath); - if (dmodpath[dmodpath.size()-1] != '/') dmodpath += '/'; //need a trailing slash + refdir = parms[i + 1]; i++; - } else + if (refdir[0] == '\"') + { + //special handling for quotes + + refdir = ""; //try again + + for (; i < parms.size(); i++) + { + if (!refdir.empty()) + { + refdir += " "; + } + refdir += parms[i]; + } + + //pull just the part we want out + refdir = SeparateStringSTL(refdir, 1, '\"'); + + } + + StringReplace("\\", "/", refdir); + if (refdir[refdir.size() - 1] != '/') refdir += '/'; //need a trailing slash + + //remove " + StringReplace("\"", "", refdir); + } + else { - LogMsg("-dmodpath used wrong"); + LogMsg("--refdir used wrong"); } } - + } + for (int i = 0; i < parms.size(); i++) + { if (parms[i] == "-game") { if (parms.size() > i + 1) { + dmodpath = parms[i + 1]; i++; - dmodpath = ""; - for (int n = i + 1; n < parms.size(); n++) + if (!refdir.empty()) { - dmodpath += parms[n]; - if (n < parms.size() - 1) - { - dmodpath += " "; - } + dmodpath = refdir + dmodpath; } StringReplace("\\", "/", dmodpath); if (dmodpath[dmodpath.size() - 1] != '/') dmodpath += '/'; //need a trailing slash - - int len = dmodpath.find_last_of("/", dmodpath.length()-2); + int len = dmodpath.find_last_of("/", dmodpath.length() - 2); if (len == string::npos) { //no demod dir? Weird but ok @@ -16367,7 +16381,7 @@ string GetDMODRootPath(string *pDMODNameOutOrNull) { if (pDMODNameOutOrNull) *pDMODNameOutOrNull = dmodpath.substr(len + 1, dmodpath.length()); - dmodpath = dmodpath.substr(0, len+1); + dmodpath = dmodpath.substr(0, len + 1); } } else diff --git a/windows_vs2017/winRTDink.vcxproj.user b/windows_vs2017/winRTDink.vcxproj.user index c16b794..9bdf7a0 100644 --- a/windows_vs2017/winRTDink.vcxproj.user +++ b/windows_vs2017/winRTDink.vcxproj.user @@ -5,8 +5,44 @@ WindowsLocalDebugger - $(ProjectDir) + $(OutDir) + WindowsLocalDebugger + + + + + + + WindowsLocalDebugger + + + + + WindowsLocalDebugger + + + + + WindowsLocalDebugger + + + + + WindowsLocalDebugger + + + + + WindowsLocalDebugger + + + + + WindowsLocalDebugger + + + + WindowsLocalDebugger - -game dmods/bugmania \ No newline at end of file