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
2,610
Trophies
1
Age
24
Location
Ecuador
Website
saulfabreg-wiivc.blogspot.com
XP
5,927
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 ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • SylverReZ @ SylverReZ:
    Hope they made lots of spaget
  • K3N1 @ K3N1:
    Chill dog
  • SylverReZ @ SylverReZ:
    Chilli dog
  • Skelletonike @ Skelletonike:
    Damn, I'm loving the new zelda.
  • xtremegamer @ xtremegamer:
    loving the new zelda, i started a game, it was so fucking good, so i
    am waiting on my friend to get home so we can start a new one together
  • Skelletonike @ Skelletonike:
    I just dislike that they don't let me choose the voices before the game starts. Happened with botw as well, had to change to japanese and restart.
  • K3N1 @ K3N1:
    But the important question is can you choose gender
  • Skelletonike @ Skelletonike:
    Same way you can choose Gerald's gender.
  • Skelletonike @ Skelletonike:
    *Geralt, damn autocorrect.
  • Psionic Roshambo @ Psionic Roshambo:
    But can he be trans? Lol
  • K3N1 @ K3N1:
    Zelda transforms into link
  • Psionic Roshambo @ Psionic Roshambo:
    Link I'm not the princess your looking for.... *Pulls a crying game*
  • K3N1 @ K3N1:
    *skirt up* it's exactly what I always wanted
  • Skelletonike @ Skelletonike:
    Just scanned all my zelda amiibos, took a while but didn't get anything that cool, did get the lon lon ranch hylian fabrics though.
  • Skelletonike @ Skelletonike:
    It was pretty funny when I scanned wolf link and got a shit load of meat.
  • K3N1 @ K3N1:
    @Skelletonike, btw I ran that custom for mgs4 on the deck I'm amazed it got that far in game
  • K3N1 @ K3N1:
    Plug in*
  • K3N1 @ K3N1:
    Your favorite activity
  • BentlyMods @ BentlyMods:
    My fav actvity is:

    mario-dancing.gif
  • Psionic Roshambo @ Psionic Roshambo:
    Do the Mario lol
  • K3N1 @ K3N1:
    🍑
  • K3N1 @ K3N1:
    Whoever developed Bramble was smoking that good shit fucking gnomes
    K3N1 @ K3N1: Whoever developed Bramble was smoking that good shit fucking gnomes