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,859
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
  • Psionic Roshambo @ Psionic Roshambo:
    I wonder who will survive in prison I wonder who it will be!
  • Psionic Roshambo @ Psionic Roshambo:
    Jared and his blood covered foot long
  • meowie13 @ meowie13:
    hellooo everyone
  • K3Nv2 @ K3Nv2:
    https://a.co/d/7FN990Y lol flip my switch
  • Veho @ Veho:
    How to automate the un-automatable.
  • K3Nv2 @ K3Nv2:
    Kind of useless now considering my cat probably has a wifi chip inside it
  • Veho @ Veho:
    I guess it's useful if your landlord doesn't let you rewire the apartment or change the switches.
  • K3Nv2 @ K3Nv2:
    Smart plugs and bulbs are already around the same price
  • K3Nv2 @ K3Nv2:
    Wifi power strips even becoming common
  • Veho @ Veho:
    Having a remote servo that can push/pull something for you is still useful.
  • Veho @ Veho:
    It could operate a latch.
  • Veho @ Veho:
    On the other hand there are those chandeliers with like 50 lightbulbs and that would be a bit expensive to replace with smart bulbs.
    +1
  • K3Nv2 @ K3Nv2:
    Maybe if your hands are decapitated
  • Veho @ Veho:
    Maybe if I'm lazy.
    +1
  • Veho @ Veho:
    I have a number of geriatric relatives.
    +1
  • Veho @ Veho:
    Anbernic's SP clone will be $60 and I think I'll buy it. Looks decent enough and it will stop me from drooling over every single new handheld that comes out.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    It does look fun lol
    +1
  • Veho @ Veho:
    I love the GBA SP and this is the GBA SP on steroids. WiFi, Bluetooth, HDMI out, two microSD card slots, sleep mode on screen close, it has everything :D
    +1
  • SylverReZ @ SylverReZ:
    Hey guys. What's new about the Anbernic SP clone?
  • Veho @ Veho:
    They announced the price.
  • Veho @ Veho:
    Here's an overview:
  • Veho @ Veho:
    SHUT UP AND TAKE MY MONEY
    Veho @ Veho: SHUT UP AND TAKE MY MONEY