Commit 2d36ad7b authored by Gargaj's avatar Gargaj
Browse files

add post-exit-command option (fixes #34)

parent dfdc9561
...@@ -55,7 +55,8 @@ Create a ```config.json``` with e.g. the following contents: (all fields are opt ...@@ -55,7 +55,8 @@ Create a ```config.json``` with e.g. the following contents: (all fields are opt
"identifier": "hello!", /* additional string to the device name; helps source discovery/identification in the receiver if there are multiple sources on the network */ "identifier": "hello!", /* additional string to the device name; helps source discovery/identification in the receiver if there are multiple sources on the network */
"frameRate": 60.0, /* frames per second */ "frameRate": 60.0, /* frames per second */
"progressive": true, /* progressive or interleaved? */ "progressive": true, /* progressive or interleaved? */
} },
"postExitCmd":"copy_to_dropbox.bat" /* this command gets ran when you quit Bonzomatic, and the shader filename gets passed to it as first parameter. Use this to take regular backups. */
} }
``` ```
......
...@@ -3,5 +3,6 @@ ...@@ -3,5 +3,6 @@
namespace Misc namespace Misc
{ {
void InitKeymaps(); void InitKeymaps();
void GetKeymapName( char * sz); void GetKeymapName( char * sz );
bool ExecuteCommand( char * cmd, char * param );
} }
\ No newline at end of file
...@@ -167,6 +167,8 @@ int main() ...@@ -167,6 +167,8 @@ int main()
float fFFTSmoothingFactor = 0.9f; // higher value, smoother FFT float fFFTSmoothingFactor = 0.9f; // higher value, smoother FFT
float fFFTSlightSmoothingFactor = 0.6f; // higher value, smoother FFT float fFFTSlightSmoothingFactor = 0.6f; // higher value, smoother FFT
std::string sPostExitCmd;
if (!options.empty()) if (!options.empty())
{ {
if (options.has<jsonxx::Object>("rendering")) if (options.has<jsonxx::Object>("rendering"))
...@@ -222,6 +224,10 @@ int main() ...@@ -222,6 +224,10 @@ int main()
midiRoutes.insert( std::make_pair( it->second->number_value_, it->first ) ); midiRoutes.insert( std::make_pair( it->second->number_value_, it->first ) );
} }
} }
if (options.has<jsonxx::String>("postExitCmd"))
{
sPostExitCmd = options.get<jsonxx::String>("postExitCmd");
}
Capture::LoadSettings( options ); Capture::LoadSettings( options );
} }
if ( !Capture::Open( settings ) ) if ( !Capture::Open( settings ) )
...@@ -508,5 +514,11 @@ int main() ...@@ -508,5 +514,11 @@ int main()
} }
Renderer::Close(); Renderer::Close();
if ( !sPostExitCmd.empty() )
{
Misc::ExecuteCommand( (char*)sPostExitCmd.c_str(), Renderer::defaultShaderFilename );
}
return 0; return 0;
} }
...@@ -44,4 +44,9 @@ namespace Misc ...@@ -44,4 +44,9 @@ namespace Misc
CharLowerA( szCode ); CharLowerA( szCode );
strncpy( sz, keymaps.count(szCode) ? keymaps[szCode].c_str() : "<unknown>" ,255); strncpy( sz, keymaps.count(szCode) ? keymaps[szCode].c_str() : "<unknown>" ,255);
} }
bool ExecuteCommand( char * cmd, char * param )
{
HINSTANCE hI = ShellExecute( NULL, NULL, cmd, param, NULL, SW_SHOW );
return (int)hI >= 32;
}
} }
\ No newline at end of file
...@@ -11,3 +11,8 @@ void Misc::InitKeymaps() { ...@@ -11,3 +11,8 @@ void Misc::InitKeymaps() {
void Misc::GetKeymapName(char* sz) { void Misc::GetKeymapName(char* sz) {
strncpy(sz,"<native>",7); strncpy(sz,"<native>",7);
} }
bool Misc::ExecuteCommand( char * cmd, char * param )
{
return false;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment