Skip to content

Commit

Permalink
Confirm the performance report saving to the user
Browse files Browse the repository at this point in the history
Also fix a compilation issue with compilers not recognizing uint
  • Loading branch information
Alayan-stk-2 committed Apr 26, 2024
1 parent 792c1e0 commit 543ee92
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/io/file_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/io/file_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class FileManager : public NoCopy
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;
Expand Down
7 changes: 7 additions & 0 deletions src/states_screens/race_result_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/utils/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 543ee92

Please sign in to comment.