Confirm the performance report saving to the user

Also fix a compilation issue with compilers not recognizing uint
This commit is contained in:
Alayan 2024-04-26 16:50:50 +02:00
parent 792c1e0926
commit 543ee92e00
No known key found for this signature in database
4 changed files with 17 additions and 1 deletions

View File

@ -849,6 +849,14 @@ std::string FileManager::getGPDir() const
return m_gp_dir;
} // getGPDir
//-----------------------------------------------------------------------------
/** Returns the directory in which the stdout file should be stored.
*/
std::string FileManager::getStdoutDir() const
{
return m_stdout_dir;
} // getStdoutDir
//-----------------------------------------------------------------------------
/** Returns the full path of a texture file name by searching in all
* directories currently in the texture search path. The difference to

View File

@ -155,6 +155,7 @@ public:
std::string getReplayDir() const;
std::string getCachedTexturesDir() const;
std::string getGPDir() const;
std::string getStdoutDir() const;
bool checkAndCreateDirectory(const std::string &path);
bool checkAndCreateDirectoryP(const std::string &path);
const std::string &getAddonsDir() const;

View File

@ -570,6 +570,13 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
if (action == "middle") // Save benchmark results
{
profiler.writeToFile();
// Disable the saving button to make it clearer that it has been done
getWidget<GUIEngine::IconButtonWidget>("middle")->setActive(false);
// Also push a confirmation to the message queue
core::stringw msg = _("Performance report saved in \"%s\".",
StringUtils::utf8ToWide(file_manager->getStdoutDir()));
MessageQueue::add(MessageQueue::MT_GENERIC, msg);
}
else // Leave to menu or video settings
{

View File

@ -622,7 +622,7 @@ void Profiler::computeStableFPS()
m_time_waited_in_slow_frames[i-1] = 0;
m_slow_frames[i-1] = m_frame_times.size(); // Will be updated if lower
for (uint j=0; j<m_frame_times.size(); j++)
for (int j=0; j<(int)m_frame_times.size(); j++)
{
if (m_frame_times[j] > max_microseconds)
{