Homebrew RELEASE NX Activity Log - View (slightly) more detailed play statistics!

blawar

Developer
Developer
Joined
Nov 21, 2016
Messages
1,708
Trophies
1
Age
40
XP
4,311
Country
United States
@lordelan Sorry to hear about your switch... but I have no idea about that as I'm just using some functions that libnx provides, not actually reading the save file (well at least not yet)

@veekay Unfortunately it doesn't show uninstalled games just yet, that's on the to-do list!

@blawar Thanks, I didn't even know where the save file was before so I'll probably have some questions ;)

@mathew77 I'll add that in soon!

You cant mount or read from the system save while HOS is running, because a service is holding it open. My idea was to forcibly read the file with raw BIS calls and then manually parse the save format container (pain in the ass). A much simpler approach would be to use raw bis to copy the save to another save id that is unused, then mount the copy and then read PlayLog.dat inside of it.
 

tallbl0nde

Well-Known Member
OP
Member
Joined
Jan 11, 2019
Messages
147
Trophies
0
Age
24
XP
1,538
Country
Australia
You cant mount or read from the system save while HOS is running, because a service is holding it open. My idea was to forcibly read the file with raw BIS calls and then manually parse the save format container (pain in the ass). A much simpler approach would be to use raw bis to copy the save to another save id that is unused, then mount the copy and then read PlayLog.dat inside of it.
Thanks that makes sense, however I have no idea how to go about that (let alone dump the file to start looking at it)... guess I'd better poke around switchbrew!
 

xmp8851

Well-Known Member
Newcomer
Joined
Jul 23, 2018
Messages
61
Trophies
0
XP
564
Country
Ukraine
This is awesome. I always wanted to check my playtime in detail.
I hope it supports non-english characters too.
 

1basti1

Well-Known Member
Member
Joined
Jun 30, 2019
Messages
215
Trophies
0
Age
33
XP
953
Country
Germany
Really nice. I love statistics. Thank you. :)
Would be nice to see even the days I played a specific game, like the diary on the 3ds. I dont know if thats even possible.
 
  • Like
Reactions: tallbl0nde

tallbl0nde

Well-Known Member
OP
Member
Joined
Jan 11, 2019
Messages
147
Trophies
0
Age
24
XP
1,538
Country
Australia
Really nice. I love statistics. Thank you. :)
Would be nice to see even the days I played a specific game, like the diary on the 3ds. I dont know if thats even possible.
Unfortunately I don't think the switch keeps track of that. I've had a few ideas of how I could implement that myself (maybe as a sysmodule, if it's actually possible) but it obviously wouldn't be able to record your activity while it isn't running. But it's early days :)
 
  • Like
Reactions: 1basti1

Garou

Well-Known Member
Member
Joined
Jan 13, 2015
Messages
1,213
Trophies
0
XP
1,667
Country
Unfortunately I don't think the switch keeps track of that. I've had a few ideas of how I could implement that myself (maybe as a sysmodule, if it's actually possible) but it obviously wouldn't be able to record your activity while it isn't running. But it's early days :)
it actually does
the api you're using simplify by summarizing all that, but actually the logs are stored in very detail

for example here's mine formatted in human readable format
Code:
00021088 0 2019-06-30 17:15:24 010068f00aa78000 65536 1 5 0 0
000210c0 4 2019-06-30 17:15:24 0100000000001000  3 3 1 4
000210f8 2 2019-06-30 17:15:25 010068f00aa78000 65536 1 5 0 2
00021168 4 2019-06-30 17:23:22 010068f00aa78000 65536 1 5 0 4
000211a0 2 2019-06-30 17:23:22 0100000000001000  3 3 1 2
00021210 1 2019-06-30 17:23:24 010068f00aa78000 65536 1 5 0 1

1st column is the log offset, then event type (0 = launch, 1 = exit, 2 = focus-in/resume, 4 = focus-out/pause), timestamp, title id, version. the rest are not really important
 

masagrator

The patches guy
Developer
Joined
Oct 14, 2018
Messages
6,274
Trophies
3
XP
12,037
Country
Poland
Unfortunately I don't think the switch keeps track of that. I've had a few ideas of how I could implement that myself (maybe as a sysmodule, if it's actually possible) but it obviously wouldn't be able to record your activity while it isn't running. But it's early days :)
It keeps. But until now it could be read only with devmenu and you could see it only for 2 last played games.
 

tallbl0nde

Well-Known Member
OP
Member
Joined
Jan 11, 2019
Messages
147
Trophies
0
Age
24
XP
1,538
Country
Australia
it actually does
the api you're using simplify by summarizing all that, but actually the logs are stored in very detail

for example here's mine formatted in human readable format
Code:
00021088 0 2019-06-30 17:15:24 010068f00aa78000 65536 1 5 0 0
000210c0 4 2019-06-30 17:15:24 0100000000001000  3 3 1 4
000210f8 2 2019-06-30 17:15:25 010068f00aa78000 65536 1 5 0 2
00021168 4 2019-06-30 17:23:22 010068f00aa78000 65536 1 5 0 4
000211a0 2 2019-06-30 17:23:22 0100000000001000  3 3 1 2
00021210 1 2019-06-30 17:23:24 010068f00aa78000 65536 1 5 0 1

1st column is the log offset, then event type (0 = launch, 1 = exit, 2 = focus-in/resume, 4 = focus-out/pause), timestamp, title id, version. the rest are not really important
Wow I imagined if it logged in this amount of detail Nintendo actually would have created a decent log. Regardless, it looks like I really need to look into this more... is that in PlayLog.dat or another file? Also is there somewhere I can find more info about these files? I've haven't really found much on switchbrew and I don't know where else to look.
 

Zidapi

Well-Known Member
Member
Joined
Dec 1, 2002
Messages
3,112
Trophies
3
Age
42
Website
Visit site
XP
2,681
Country
Thank you for this, it’s one of the features I’ve missed from the 3DS.

Hopefully you can get the calendar implemented. It’s definitely tracked and the information is stored locally, as it’s shown in the Parental Control App even if you only go online to sync it every few weeks.
 
  • Like
Reactions: tallbl0nde

Garou

Well-Known Member
Member
Joined
Jan 13, 2015
Messages
1,213
Trophies
0
XP
1,667
Country
Wow I imagined if it logged in this amount of detail Nintendo actually would have created a decent log. Regardless, it looks like I really need to look into this more... is that in PlayLog.dat or another file? Also is there somewhere I can find more info about these files? I've haven't really found much on switchbrew and I don't know where else to look.
it's in the PlayEvent.dat. you should be able to mount save for 0x80000000000000F0 to get this file
I suppose play time was calculated based on the time elapsed between focus-in and focus-out

file structure is documented in https://switchbrew.org/wiki/Shared_Database_services#PlayEvent or if you're more comfortable with code then https://github.com/switchbrew/libnx/blob/master/nx/include/switch/services/pdm.h#L78

couldn't find the documentation for the file header but here's what works for me
offset 0x0 size 0x4: zero
offset 0x4 size 0x4: number of play event entries
and after that you can just loop as many as the number of entries. each entry will be 0x38 in size
 
  • Like
Reactions: tallbl0nde

tallbl0nde

Well-Known Member
OP
Member
Joined
Jan 11, 2019
Messages
147
Trophies
0
Age
24
XP
1,538
Country
Australia
it's in the PlayEvent.dat. you should be able to mount save for 0x80000000000000F0 to get this file
I suppose play time was calculated based on the time elapsed between focus-in and focus-out

file structure is documented in https://switchbrew.org/wiki/Shared_Database_services#PlayEvent or if you're more comfortable with code then https://github.com/switchbrew/libnx/blob/master/nx/include/switch/services/pdm.h#L78

couldn't find the documentation for the file header but here's what works for me
offset 0x0 size 0x4: zero
offset 0x4 size 0x4: number of play event entries
and after that you can just loop as many as the number of entries. each entry will be 0x38 in size

Thanks so much for sharing all this, it should be of a big help once I start looking into it!
 
  • Like
Reactions: 1basti1

tallbl0nde

Well-Known Member
OP
Member
Joined
Jan 11, 2019
Messages
147
Trophies
0
Age
24
XP
1,538
Country
Australia
Is it planned/possible in the future to track unofficial NSPs like RetroArch? It shows up as 0 hours for me.
For now the plan is to just read what the switch logs. I haven't checked if it does yet, however seeing as they don't show up on the user page makes me think it doesn't (but I could be wrong!)
 

lordelan

Well-Known Member
Member
Joined
Jan 4, 2015
Messages
5,788
Trophies
1
Age
44
XP
6,519
Country
Germany
Is it planned/possible in the future to track unofficial NSPs like RetroArch? It shows up as 0 hours for me.
It hasn't anything to do with official or unofficial but whether the installed title wants you to confirm a user when you launch it.
By most of the Switch games, this happens before Launch. By some it just happens within the main menu (Dead Cells).
The problem is, that NSPs created with NRO2NSP are not requiring a Switch user account to launch the title with so the play time isn't counted towards that playlog file and appears as 0 hours.
I already asked about this here:
https://gbatemp.net/posts/8818277
Let's see if something can be done about this.
I'd love to have the RetroArch NSP's playtime in my log as well as the one of Blobby Volley 2 (another homebrew game I installed a NSP for).
 
Last edited by lordelan,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: Yeah agreed