What are the latest variables used by Wii Message Board in latest devkitPPC/libOGC?

SaulFabre

I like Yoshis and the Wii/Wii U scene.
OP
Member
Joined
Feb 6, 2019
Messages
3,195
Trophies
2
Age
25
Location
Ecuador
Website
saulfabreg-wiivc.blogspot.com
XP
7,858
Country
Ecuador
Hello!!!

So i was tinkering a bit with the stuff of adding Wii Message Board support to homebrew apps, for be able to write the info of the time played in a game, if launched from a Wii forwarder channel (for example, my custom Single ROM Loaders).

Like @SuperrSonic did it with RA-SS / RA-HEXAeco and WiiMC-SSLC, with a piece of code made by users Marc, @tueidj, @dimok and SuSo.

I'm taking this commit as reference for add Wii Message Board support to homebrew apps: https://github.com/SuperrSonic/WiiMC-SSLC/commit/74286512
The files for Wii Message Board stuff i'm taking from RA-SS: https://github.com/SuperrSonic/RA-SS

BUT...

I've encountered into a problem. (Maybe @Wiimpathy can help me with this?)

The code shown here only works on old devkitPPC versions (until devkitPPC r29-1 i guess since i applied this to WiiStation and it works fine).

WMBPlaylog.c

Code:
/*
    WMBPlaylog.c
    This code allows to modify play_rec.dat in order to store the
    game time in Wii's log correctly.
    by Marc
    Thanks to tueidj for giving me some hints on how to do it :)
    Most of the code was taken from here:
    http://forum.wiibrew.org/read.php?27,22130
    Modified by Dimok and SuSo
*/

#include <stdio.h>
#include <string.h>
#include <ogcsys.h>
#include <malloc.h>

#define ALIGN32(x) (((x) + 31) & ~31)

#define SECONDS_TO_2000 946684800LL
#define TICKS_PER_SECOND 60750000LL

//! Should be 32 byte aligned
static const char PLAYRECPATH[] ATTRIBUTE_ALIGN(32) = "/title/00000001/00000002/data/play_rec.dat";

typedef struct _PlayRec
{
    u32 checksum;
    union
    {
        u32 data[31];
        struct
        {
            u16 name[42];
            u64 ticks_boot;
            u64 ticks_last;
            char title_id[6];
            char unknown[18];
        } ATTRIBUTE_PACKED;
    };
} PlayRec;

static u64 getWiiTime(void)
{
    time_t uTime = time(NULL);
    return TICKS_PER_SECOND * (uTime - SECONDS_TO_2000);
}

int Playlog_Exit(void)
{
    s32 res = -1;
    u32 sum = 0;
    u8 i;

    //Open play_rec.dat
    s32 fd = IOS_Open(PLAYRECPATH, IPC_OPEN_RW);
    if(fd < 0)
        return fd;

    PlayRec * playrec_buf = memalign(32, ALIGN32(sizeof(PlayRec)));
    if(!playrec_buf)
        goto cleanup;

    //Read play_rec.dat
    if(IOS_Read(fd, playrec_buf, sizeof(PlayRec)) != sizeof(PlayRec))
        goto cleanup;

    if(IOS_Seek(fd, 0, 0) < 0)
        goto cleanup;

    // update exit time
    u64 stime = getWiiTime();
    playrec_buf->ticks_last = stime;

    //Calculate and update checksum
    for(i = 0; i < 31; i++)
        sum += playrec_buf->data[i];

    playrec_buf->checksum = sum;

    if(IOS_Write(fd, playrec_buf, sizeof(PlayRec)) != sizeof(PlayRec))
        goto cleanup;

    res = 0;

cleanup:
    free(playrec_buf);
    IOS_Close(fd);
    return res;
}

WMBPlaylog.h

Code:
#ifndef WMBPLAYLOG_H_
#define WMBPLAYLOG_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <gctypes.h>

int Playlog_Exit(void);

#ifdef __cplusplus
}
#endif

#endif

When i tried to implement this on updated homebrew (FCEUGX, Snes9xGX, VBAGX, Genesis Plus GX, etc.), while it compiled fine i couldn't get the Wii Message Board write support to work, maybe because libOGC doesn't recognize them anymore on latest versions.

Can anyone tell me how i can fix these pieces of code for make homebrew compatible with writing playlog on Wii Message Board with latest devkitPPC/libOGC?

Thanks a lot ;)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    @Xdqwerty, People who create revival services for the Wii end up in disaster, same goes for Pretendo lol.
    +1
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, atleast wiimmfii went fine although people only use it for Mario kart Wii
  • SylverReZ @ SylverReZ:
    At least if they ban you for cheating, get another Wii. They're cheap as chips.
    +1
  • SylverReZ @ SylverReZ:
    Remember when RiiShop was a thing?
  • BakerMan @ BakerMan:
    not really
  • SylverReZ @ SylverReZ:
    It got shutdown because somebody "accidentally" leaked the database for the amount of people using the beta.
  • SylverReZ @ SylverReZ:
    RiiShop is the laziest way of downloading Wii games. Did somebody not think of this through?
  • BakerMan @ BakerMan:
    although i ended up accidentally changing my nand with no way of going back bc i didn't know you needed a gamecube controller to restore it (i have a wii minus/1.1, which doesn't have gamecube controller support)
  • SylverReZ @ SylverReZ:
    @BakerMan, I think you're talking about the recovery mode that the SaveMii used, and also was to restore softbricked systems.
  • SylverReZ @ SylverReZ:
    If your NAND was hardbricked, then just buy another Wii. Or go with the dirty NAND flasher method.
  • BakerMan @ BakerMan:
    and if i find the sd card i have my NAND backed up on, i can not only restore the NAND if i solder the right part in, but i can also put my NAND on dolphin, then i can play dolphin online, like PMEX Remix or MKWii Riibalanced
  • Xdqwerty @ Xdqwerty:
    Brb
  • SylverReZ @ SylverReZ:
    @BakerMan, Oh yeah, that was a thing too. Dolphin does support Wiimmfi.
  • BakerMan @ BakerMan:
    yeah you just need to put your NAND backup with wiimmfi on it
  • BakerMan @ BakerMan:
    ngl i feel like if a bunch of my friends have wiis and know how to get wiimmfi and back up their NAND, then we could do a PMEX Remix tournament
  • BakerMan @ BakerMan:
    maybe even add UMVC3/DBFZ and make it a biathlon/triathlon
  • Psionic Roshambo @ Psionic Roshambo:
    Too bad Excite Truck wasn't multi player :(
  • Psionic Roshambo @ Psionic Roshambo:
    Loved that game lol
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, sorry for the stupid suggestion I had in that thread
  • SylverReZ @ SylverReZ:
    Its fine
  • BakerMan @ BakerMan:
    what thread?
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/watch?v=lxR2jow50Bs