Welcome! Log In Create A New Profile

Advanced

How does the Wii update the message board with game play time?

Posted by agoaj 
How does the Wii update the message board with game play time?
June 25, 2009 06:07AM
Is this a function of the system menu or IOS?
Re: How does the Wii update the message board with game play time?
June 25, 2009 01:51PM
I'm assuming IOS since the system menu is not running while a game is being played. Which IOS though? Your guess is as good as mine, but we can safely say it's not 16, 60, 61, or 36.
Re: How does the Wii update the message board with game play time?
June 25, 2009 07:36PM
Why can't it be any of that 4, Arikado?

Has anybody experimtened with it?

What happens, when you play a normal Wii game and simply unplug the power after 17 Minutes, for example?
Re: How does the Wii update the message board with game play time?
June 25, 2009 08:49PM
Quote
daniel_c_w
Why can't it be any of that 4, Arikado?
16 shouldn't even be on your Wii. It was found on a pink fish disc (no one knows what it does) used to repair Wiis. It was the IOS ised by pirates for warez until Nintendo killed it in 4.0

60 handles all of the SD and SDHC functionality

61 is the shop channel IOS

36 is the main IOS used by system menu for some of its functionalities. I'm not really sure what that functionality is, but if you delete IOS36, you're bricked for good. AFAIK, it only runs when the system menu does though.
Re: How does the Wii update the message board with game play time?
June 25, 2009 09:15PM
Isn't only one IOS active at a time?
For example the 4.0 System menu uses IOS 60 and only IOS 60.
I remember that Bushing said, that Nintendo began to modularize the IOS functions.

Shouldn't a 4.0 Wii be able to boot without any IOS, but IOS 60?

EDIT: according to [wiibrew.org] no System menu uses IOS 36



Edited 1 time(s). Last edit at 06/25/2009 09:19PM by daniel_c_w.
Re: How does the Wii update the message board with game play time?
June 25, 2009 09:21PM
Actually, I just had a thought. Perhaps the main system menu IOS records the time before a game/channel is booted, and when you return to the system menu it subtracts the difference in time and records that difference (like 31 minutes) on the Wii Message Board under the name of the last game/channel booted. In that case, the main system menu IOS, 36 (or like you're suggesting 60) is the IOS responsible for stuff like this.

I can't really reply to your comment daniel_c_w, as this is where I begin to reach the limits of my knowledge :P I'm only saying what I believe to be true. to that end, some clarification by someone who knows more than I do would be much appreciated.
Re: How does the Wii update the message board with game play time?
June 25, 2009 10:04PM
I am fairly sure that System Menu 4.0 only requires IOS 60 to boot. Well at least AnyTitle Deleter will let you delete every IOS except IOS 60.
Re: How does the Wii update the message board with game play time?
August 10, 2009 10:50PM
It's done by code inside the SDK for each individual game.
Re: How does the Wii update the message board with game play time?
August 11, 2009 08:35PM
@bushing: Hmm, are you sure? Since even homebrew channel or other non-nintendo sdk channels gets recorded... I think system menu handles this log. If you manually launch a channel (through ES_LaunchTitle) nothing gets recorded...so...
Re: How does the Wii update the message board with game play time?
August 11, 2009 08:38PM
I think the messages output by games (like Wii Sports for example) are handled by the SDK for each individual game, but I still think the system menu handles record play times on the message board.
Re: How does the Wii update the message board with game play time?
August 11, 2009 11:58PM
HBC no longer appears in play time on the message board, so team twiizers must have control over that, so they must have put it in HBC to begin with, ad have now removed it. either that, or what bushing said is only valid for disk games, and channels are handled differently.
Re: How does the Wii update the message board with game play time?
September 08, 2009 11:39AM
We had code specifically written for the HBC, but it was unreliable. Please find me another homebrew app that leaves entries on the Playtime log.
Re: How does the Wii update the message board with game play time?
September 09, 2009 02:39AM
custom channels appear on the log
Re: How does the Wii update the message board with game play time?
September 09, 2009 06:26PM
Well, it probably depends how they're made tbh. My guess is that certain NAND loaders have playtime code in them, and they're generally the ones used for custom channels. Marcan's, which is used for HBC, must have had this removed. Either that, or I'm talking rubbish and the code isnt in the NAND loader, but its the only bit I can think of that could really be responsible.
Re: How does the Wii update the message board with game play time?
September 13, 2009 10:29AM
@SifJar : I don't think nand loader have any role in this... For example channels launched from Crazy Intro doesn't get recorded... be it official channels, or homebrew... It's all attached to the channel/disc start button when you click a certain channel I guess..
Re: How does the Wii update the message board with game play time?
September 13, 2009 01:41PM
Hmm, but how come HBC doesnt show up? If the System Menu records when it starts the game, why doesn't it record HBC?
Re: How does the Wii update the message board with game play time?
September 13, 2009 07:37PM
Twiizers included special code that allowed it to record time on the HBC. It was buggy so they removed it. Now it doesnt show in the play log. (might be wrong)



Edited 1 time(s). Last edit at 09/13/2009 07:37PM by TopGun96.
Re: How does the Wii update the message board with game play time?
September 13, 2009 09:57PM
Quote
TopGun96
Twiizers included special code that allowed it to record time on the HBC. It was buggy so they removed it. Now it doesnt show in the play log. (might be wrong)
maybe, maybe not...
Re: How does the Wii update the message board with game play time?
September 14, 2009 01:32PM
Meh.

Looks like at one time we had code that tried to properly handle playtime:
int playtime_init(void) {
       s32 res;
       u32 sum = 0;
       int i;

       gprintf("initializing playtime\n");

       if(_pt_fd >= 0) {
               gprintf("playtime already initialized (fd %d)\n",_pt_fd);

               return _pt_fd;
       }

       _pt_fd = IOS_Open(_playtime_path, IPC_OPEN_RW);
       if(_pt_fd < 0) {
               gprintf("playtime open failed: %d\n",_pt_fd);

               return _pt_fd;
       }

       res = IOS_Read(_pt_fd, &playtime_buf, sizeof(playtime_buf));

       if(res < 0) {
               gprintf("playtime read failed: %d\n",res);
               IOS_Close(_pt_fd);
               _pt_fd = -1;

               return res;
       }

       if(res != sizeof(playtime_buf)) {
               gprintf("playtime read bad size: %d\n",res);
               IOS_Close(_pt_fd);
               _pt_fd = -1;
               return -1;
       }

       for(i=0; i<0x1f; i++)
               sum += playtime_buf.data;

       if(sum != playtime_buf.checksum) {
               gprintf("playtime: bad checksum (read %08x, should be %08x)\n",
                                       playtime_buf.checksum,sum);
               IOS_Close(_pt_fd);
               _pt_fd = -1;

               return -1;
       }

       gprintf("playtime:\n");
       gprintf(" Boot:         0x%016llx\n",playtime_buf.ticks_boot);
       gprintf(" Last:         0x%016llx\n",playtime_buf.ticks_last);
       gprintf(" Title ID: 0x%08x\n",playtime_buf.title_id);

       gprintf("current UNIX time(): 0x%08lx\n",time(NULL));
       gprintf("current ticks: 0x%08llx\n",get_current_ticks());

       if((playtime_buf.ticks_boot == playtime_buf.ticks_last) &&
                       (playtime_buf.title_id == ((u32)MY_TITLEID))) {
               gprintf("playtime: we were started from the System Menu\n");
               booted_from_menu = true;
       } else {
               gprintf("playtime: we were started from somewhere else\n");
               booted_from_menu = false;
       }

       return _pt_fd;
 }

int playtime_update(void) {
       s32 res;
       u32 sum = 0;
       int i;
       int secs;

       if(_pt_fd < 0) {
               gprintf("playtime: not inited, can't update\n");
               return _pt_fd;
       }

       if(_playtime_busy) {
               gprintf("playtime: busy, can't update\n");
               return -1;
       }

       _playtime_busy = 1;

       playtime_buf.ticks_last = get_current_ticks();
       secs = ticks_to_secs(playtime_buf.ticks_last - playtime_buf.ticks_boot);

       for(i=0; i<0x1f; i++)
               sum += playtime_buf.data;
       playtime_buf.checksum = sum;

       gprintf("starting playtime update:\n");
       gprintf(" Boot:         0x%016llx\n",playtime_buf.ticks_boot);
       gprintf(" Last:         0x%016llx\n",playtime_buf.ticks_last);
       gprintf(" Delta:        0x%016llx\n",playtime_buf.ticks_last -
                               playtime_buf.ticks_boot);
       gprintf(" Playtime: %d:%02d:%02d\n", secs/3600, (secs/60)%60, secs%60);
       gprintf(" Checksum: 0x%08x\n",playtime_buf.checksum);

       gprintf("current UNIX time(): 0x%08lx\n",time(NULL));

       res = IOS_Seek(_pt_fd, 0, SEEK_SET);

       if(res < 0) {
               gprintf("playtime seek failed: %d\n",res);
               _playtime_busy = 0;
               return res;
       }

       res = IOS_WriteAsync(_pt_fd, &playtime_buf, sizeof(playtime_buf),
                                                       _playtime_cb, NULL);

       if(res < 0) {
               gprintf("playtime update write failed (in Async): %d\n",res);
               _playtime_busy = 0;
               return res;
       }

       return 0;
 }

This proved unreliable, so we now have:
void playtime_destroy(void) {
        s32 res;
        s32 pt_fd = -1;
        static u8 pt_buf[4] __attribute__((aligned(32)));

        gprintf("destroying playtime\n");

        res = ISFS_Initialize();
        if (res) {
                ISFS_Deinitialize();
                gprintf("error initializing isfs (%d)\n", res);
                return;
        }

        pt_fd = IOS_Open(_playtime_path, IPC_OPEN_RW);
        if(pt_fd < 0) {
                ISFS_Deinitialize();
                gprintf("playtime open failed: %d\n", pt_fd);
                return;
        }

        memset(pt_buf, 0, sizeof(pt_buf));

        res = IOS_Write(pt_fd, &pt_buf, sizeof(pt_buf));
        if (res != sizeof(pt_buf)) {
                IOS_Close(pt_fd);
                ISFS_Deinitialize();
                gprintf("error destroying playtime (%d)\n", res);
                return;
        }

        IOS_Close(pt_fd);
        ISFS_Deinitialize();

        return;
}

Take it for what it's worth.
Re: How does the Wii update the message board with game play time?
September 14, 2009 06:06PM
Oh, so now you manually destroy play time instead of allowing wii to record it? That makes sense now.
Sorry, only registered users may post in this forum.

Click here to login