Skip to content

Game List: Added Ability to Manually Edit Play Time - #14085

Open
Shaheen2323 wants to merge 3 commits into
PCSX2:masterfrom
Shaheen2323:edit-playtime
Open

Game List: Added Ability to Manually Edit Play Time#14085
Shaheen2323 wants to merge 3 commits into
PCSX2:masterfrom
Shaheen2323:edit-playtime

Conversation

@Shaheen2323

Copy link
Copy Markdown

Description of Changes

Added the option/ability to manually edit play time if needed in non Big Picture Mode (Qt).
image
image
image
image

Rationale behind Changes

If a user accidentally resets their play time, or if they would like to retain their play time on different devices (e.g., a desktop and a handheld PC), they can now manually edit the play time (Resolves #13007).

Suggested Testing Steps

  • I've already tried almost a hundred different combinations (hours, minutes, seconds), as well as resetting the play time first and/or after editing.
  • I've tried some edge cases (invalid input (negative, characters, etc.), min and max, etc.)
  • I've tried canceling out at different stages (editing hours, minutes, or seconds).
  • Try editing playtime.dat before, after, and at the same time as manually editing in the app, to see if anything breaks. I couldn't find any issues.
  • Try editing on different days, and see if "Last Played" breaks.

Did you use AI to help find, test, or implement this issue or feature?

No.

I can try to add this feature to the Big Picture Mode (FSUI) as well, but I had a bit of trouble wrapping my head around getting things to work with ImGui, as I don't have any experience with it. If you would like me to try some more, let me know, but if someone else wants to do it, feel free to do so.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting a contribution to PCSX2

As this is your first pull request, please be aware of the contributing guidelines.

Additionally, as per recent changes in GitHub Actions, your pull request will need to be approved by a maintainer before GitHub Actions can run against it. You can find more information about this change here.

Please be patient until this happens. In the meantime if you'd like to confirm the builds are passing, you have the option of opening a PR on your own fork, just make sure your fork's master branch is up to date!

@refractionpcsx2

Copy link
Copy Markdown
Member

Could this not all be done in the same dialogue instead of having 3 separate ones? It seems a little cumbersome to have to go through so many different dialogues, you could easily put hours, minutes and seconds next to each other and reference them separately.

@Shaheen2323

Copy link
Copy Markdown
Author

Could this not all be done in the same dialogue instead of having 3 separate ones? It seems a little cumbersome to have to go through so many different dialogues, you could easily put hours, minutes and seconds next to each other and reference them separately.

I agree with you on that. The reason I did three separate dialogues is that it was the easiest way to implement this feature while forcing valid input (i.e., ensuring only valid inputs come in). I'll work on it a bit more to see if I can come up with a better solution. One way I'm thinking is to take a single string input and parse it into separate parts after (into hours, minutes, and seconds), and another way is to write a custom dialogue. If you have any suggestions or ideas, let me know.

@Calinou

Calinou commented Mar 6, 2026

Copy link
Copy Markdown

To be fair, editing the number of seconds of playtime is probably not needed either. We can reset the existing seconds component of the playtime to 0 when it's edited, and only ask for hours and minutes.

If you want to simplify things further, you could only expose an hours field but allow floating-point values, so that minutes can be specified like 6.5 for 6 hours and 30 minutes. Most game launchers like Steam already display playtime in this fashion.

@Shaheen2323

Copy link
Copy Markdown
Author

To be fair, editing the number of seconds of playtime is probably not needed either. We can reset the existing seconds component of the playtime to 0 when it's edited, and only ask for hours and minutes.

If you want to simplify things further, you could only expose an hours field but allow floating-point values, so that minutes can be specified like 6.5 for 6 hours and 30 minutes. Most game launchers like Steam already display playtime in this fashion.

That's actually a great solution. I'll work on it once I get the chance.

@Shaheen2323

Shaheen2323 commented Mar 12, 2026

Copy link
Copy Markdown
Author

I implemented a single floating-point input for total hours instead of the previous three-stage integer input for hours, minutes, and seconds. Let me know if it works/flows better.

Example Screenshot:
image

Comment thread pcsx2-qt/MainWindow.cpp
if (entry_played_time)
connect(menu.addAction(tr("Reset Play Time")), &QAction::triggered, [this, entry, entry_played_time]() { clearGameListEntryPlayTime(*entry, entry_played_time); });
// Show this option whether play time exists or not.
connect(menu.addAction(tr("Edit Play Time")), &QAction::triggered, [this, entry, entry_played_time]() { editGameListEntryPlayTime(*entry, entry_played_time); });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this before "Reset Play Time"

Comment thread pcsx2-qt/MainWindow.cpp

bool ok;
double new_hours_minutes = QInputDialog::getDouble(this, tr("Edit Play Time For %1").arg(entry.title.empty() ? tr("empty title") : QString::fromStdString(entry.title)),
tr("Enter Play Time in Hours (Min: 0.00, Max: 99999.99):"), hours_minutes, 0.00, 99999.99, 2, &ok, Qt::WindowFlags(), 0.01);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the user needs to see "Min: 0.00", it's obvious that the minimum value is zero. And personally I'd remove the whole "(Min: 0.00, Max: 99999.99)" part of the label.

Comment thread pcsx2-qt/MainWindow.cpp
if (ok)
{
const int new_hours = static_cast<u32>(new_hours_minutes);
const int new_minutes = static_cast<u32>((new_hours_minutes - new_hours) * 60);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use std::modf() to separate integral and fractional parts.

Comment thread pcsx2/GameList.cpp
// Weird solution (i.e., to add the difference) to use the same function to update the file, but it works!
const PlayedTimeEntry pt(UpdatePlayedTimeFile(GetPlayedTimeFile(), serial, current_last, (new_time - current_time)));

for (GameList::Entry& entry : s_entries)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need to iterate the game list twice? can you not do the update in a single pass?

@JordanTheToaster JordanTheToaster added this to the Release 2.X milestone Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: The abillity to manually edit playtime.

6 participants