Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always launch rpcs3.exe on restart #7955

Merged
merged 1 commit into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Utilities/StrFmt.cpp
Expand Up @@ -18,7 +18,7 @@
std::string wchar_to_utf8(wchar_t *src)
{
std::string utf8_string;
auto tmp_size = WideCharToMultiByte(CP_UTF8, 0, src, -1, nullptr, 0, nullptr, nullptr);
const auto tmp_size = WideCharToMultiByte(CP_UTF8, 0, src, -1, nullptr, 0, nullptr, nullptr);
utf8_string.resize(tmp_size);
WideCharToMultiByte(CP_UTF8, 0, src, -1, utf8_string.data(), tmp_size, nullptr, nullptr);
return utf8_string;
Expand Down Expand Up @@ -47,7 +47,7 @@ std::string utf8_path_to_ansi_path(const std::string& src)
std::wstring buf_wide;

// Converts the utf-8 path to wide char
auto tmp_size = MultiByteToWideChar(CP_UTF8, 0, src.c_str(), -1, nullptr, 0);
const auto tmp_size = MultiByteToWideChar(CP_UTF8, 0, src.c_str(), -1, nullptr, 0);
buf_wide.resize(tmp_size);
MultiByteToWideChar(CP_UTF8, 0, src.c_str(), -1, buf_wide.data(), tmp_size);

Expand Down
11 changes: 8 additions & 3 deletions rpcs3/rpcs3qt/update_manager.cpp
Expand Up @@ -333,8 +333,13 @@ bool update_manager::handle_rpcs3()

#ifdef _WIN32
// Get executable path
wchar_t orig_path[32767];
GetModuleFileNameW(nullptr, orig_path, sizeof(orig_path) / 2);
const std::string orig_path = Emulator::GetExeDir() + "rpcs3.exe";

std::wstring wchar_orig_path;
const auto tmp_size = MultiByteToWideChar(CP_UTF8, 0, orig_path.c_str(), -1, nullptr, 0);
wchar_orig_path.resize(tmp_size);
MultiByteToWideChar(CP_UTF8, 0, orig_path.c_str(), -1, wchar_orig_path.data(), tmp_size);

#endif

#ifdef __linux__
Expand Down Expand Up @@ -596,7 +601,7 @@ bool update_manager::handle_rpcs3()
QMessageBox::information(m_parent, tr("Auto-updater"), tr("Update successful!"));

#ifdef _WIN32
const int ret = _wexecl(orig_path, orig_path, L"--updating", nullptr);
const int ret = _wexecl(wchar_orig_path.data(), wchar_orig_path.data(), L"--updating", nullptr);
#else
const int ret = execl(replace_path.c_str(), replace_path.c_str(), "--updating", nullptr);
#endif
Expand Down