[core, android] Initial playtime implementation #2535
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "inix/eden:playtime-android"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
So firstly, playtime code is moved to src/common and qt specific code to yuzu/utils.cpp.
The dependency on ProfileManager was removed because it was working properly on Android, and I think a shared playtime is better behavior.
Now, playtime is stored in a file called "playtime.bin".
JNI code is from Azahar although modified by me, as well as that I added code to reset the game's playtime which was missing for some reason on there.
Before this gets merged, I plan to add the ability to manually edit the database as well.
Note: Code still needs a bit of cleanup.
I am aware of the frontend_common rework, files can be moved once that's merged.
I would argue the playtime manager should be moved into frontend_common. A similar thing was done with the firmware manager
Also--qt_common is already merged so you can probably move that stuff to
qt_common/qt_playtime_manager.*
d71814a68b
to4c7c2957ac
WIP: [core, android] Initial playtime implementationto [core, android] Initial playtime implementationI moved the qt specific code there
@ -0,0 +37,4 @@
default:
return QStringLiteral("0");
}
}
In these cases I would recommend making them FrontendCommon methods that return std::strings. For the ReadablePlayTime you can use fmt::format like in my DataManager PR
@ -565,2 +564,4 @@
QAction* remove_shader_cache = remove_menu->addAction(tr("Remove All Pipeline Caches"));
QAction* remove_all_content = remove_menu->addAction(tr("Remove All Installed Contents"));
QMenu* play_time_menu = context_menu.addMenu(tr("Manage Play Time"));
QAction* set_play_time = play_time_menu->addAction(tr("Set Play Time Data"));
"Edit" would work better here
@ -2637,0 +2639,4 @@
void GMainWindow::OnGameListSetPlayTime(u64 program_id) {
QDialog dialog(this);
dialog.setWindowTitle(tr("Set Play Time Data"));
dialog.setModal(true);
We can probably make this a .ui file
@ -2637,0 +2645,4 @@
auto* input_layout = new QHBoxLayout();
auto* hours_edit = new QLineEdit(&dialog);
auto* minutes_edit = new QLineEdit(&dialog);
auto* seconds_edit = new QLineEdit(&dialog);
These can be spin boxes
@ -2637,0 +2649,4 @@
hours_edit->setValidator(new QIntValidator(0, 9999, hours_edit));
minutes_edit->setValidator(new QIntValidator(0, 59, minutes_edit));
seconds_edit->setValidator(new QIntValidator(0, 59, seconds_edit));
And if we do go with QSpinBox you can just set the range and this won't be necessary
@ -2637,0 +2651,4 @@
minutes_edit->setValidator(new QIntValidator(0, 59, minutes_edit));
seconds_edit->setValidator(new QIntValidator(0, 59, seconds_edit));
using QtCommon::PlayTimeManager::TimeUnit;
You can remove the TimeUnit and then
QtCommon::PlayTimeManager::GetPlayTimeUnit
can also be shortened@ -2637,0 +2681,4 @@
connect(button_box, &QDialogButtonBox::accepted, [&]() {
const int hours = hours_edit->text().toInt();
const int minutes = minutes_edit->text().toInt();
const int seconds = seconds_edit->text().toInt();
Theoretically, this "should" be done as text is edited rather than as it's accepted.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.