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,186
Trophies
2
Age
25
Location
Ecuador
Website
saulfabreg-wiivc.blogspot.com
XP
7,836
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.
  • The Real Jdbye @ The Real Jdbye:
    well, sonic fans are a whole separate thing from furries
  • The Real Jdbye @ The Real Jdbye:
    like bronys
  • The Real Jdbye @ The Real Jdbye:
    sonic porn is too weird even for me
  • Dumpflam @ Dumpflam:
    bruh
  • Dumpflam @ Dumpflam:
    guys how do i delete a post
  • The Real Jdbye @ The Real Jdbye:
    you don't
  • The Real Jdbye @ The Real Jdbye:
    you can report it and request deletion
  • BakerMan @ BakerMan:
    Also, no, that was his first time having a seizure, and hopefully the last
    +1
  • K3Nv2 @ K3Nv2:
    Ea play raised priced to $6 a month lol
  • BigOnYa @ BigOnYa:
    Same with uremum, she's now $2 a month
    +1
  • K3Nv2 @ K3Nv2:
    Also seizures come and and go they don't have an off switch like that it all depends
  • BakerMan @ BakerMan:
    alright guys, who would win, sonic or goku?
  • BigOnYa @ BigOnYa:
    Knuckles
  • BakerMan @ BakerMan:
    knuckles vs broly could also be a good one tbh
    +1
  • BigOnYa @ BigOnYa:
    Bakerman vs. Wario
  • BigOnYa @ BigOnYa:
    Announcer - "Ok folks we have a good fight today, Bakerman takes on Wario. This should be a good fight. Wait...why is bakerman undressing?"
  • BakerMan @ BakerMan:
    Oh sorry, this is Wario? I thought it was your wife
    +1
  • E @ eenterx:
    hello guys how do i type on forums?
  • E @ eenterx:
    i am the new user
    +1
  • BigOnYa @ BigOnYa:
    I am the Eggman... I am the Walrus...
    +1
  • E @ eenterx:
    oh ok
  • RedColoredStars @ RedColoredStars:
    What does it tell you when you try to type?
  • BakerMan @ BakerMan:
    @BigOnYa speaking of eggmen... eggman for smash
  • RedColoredStars @ RedColoredStars:
    You click where it says "Write your reply..." and start typing? lol
    +1
    RedColoredStars @ RedColoredStars: https://suckmybeatles.com/