MCPcopy Create free account
hub / github.com/crosire/reshade / execute_screenshot_post_save_command

Method execute_screenshot_post_save_command

source/runtime.cpp:5053–5097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5051 }
5052}
5053bool reshade::runtime::execute_screenshot_post_save_command(const std::filesystem::path &screenshot_path, unsigned int screenshot_count, std::string_view postfix)
5054{
5055 if (_screenshot_post_save_command.empty())
5056 return false;
5057
5058 const std::wstring ext = _screenshot_post_save_command.extension().wstring();
5059
5060 std::string command_line;
5061 if (ext == L".bat" || ext == L".cmd")
5062 command_line = "cmd /C call ";
5063 else if (ext == L".ps1")
5064 command_line = "powershell -File ";
5065 else if (ext == L".py")
5066 command_line = "python ";
5067 else if (ext != L".exe")
5068 return false;
5069
5070 command_line += '\"';
5071 command_line += _screenshot_post_save_command.u8string();
5072 command_line += '\"';
5073
5074 if (!_screenshot_post_save_command_arguments.empty())
5075 {
5076 command_line += ' ';
5077 command_line += expand_macro_string(_screenshot_post_save_command_arguments, {
5078 { "AppName", g_target_executable_path.stem().u8string() },
5079 { "PresetName", _current_preset_path.stem().u8string() },
5080 { "BeforeAfter", std::string(postfix) },
5081 { "TargetPath", screenshot_path.u8string() },
5082 { "TargetDir", screenshot_path.parent_path().u8string() },
5083 { "TargetFileName", screenshot_path.filename().u8string() },
5084 { "TargetExt", screenshot_path.extension().u8string() },
5085 { "TargetName", screenshot_path.stem().u8string() },
5086 { "Count", std::to_string(screenshot_count) }
5087 }, _current_time);
5088 }
5089
5090 if (!utils::execute_command(command_line, g_reshade_base_path / _screenshot_post_save_command_working_directory, _screenshot_post_save_command_hide_window))
5091 {
5092 log::message(log::level::error, "Failed to execute screenshot post-save command!");
5093 return false;
5094 }
5095
5096 return true;
5097}
5098
5099bool reshade::runtime::get_texture_data(api::resource resource, api::resource_usage state, uint8_t *pixels, api::format quantization_format)
5100{

Callers

nothing calls this directly

Calls 3

expand_macro_stringFunction · 0.85
to_stringFunction · 0.85
messageFunction · 0.85

Tested by

no test coverage detected