Skip to content

VIDEO_Init crash when called in MIOS #188

Closed as not planned
Closed as not planned
@pyorot

Description

@pyorot

Bug Report

What's the issue you encountered?

Calling VIDEO_Init in MIOS PPC code crashes 20% of the time with visual garbage. Sometimes resettable with pressing Wii power button, other times requires holding down power button to turn off Wii.

VIDEO_Init.crash.mp4

(See also: crash art.)

Vanilla devkitPro, very recently updated (libogc 2.10).

How can the issue be reproduced?

Init video in a Wii app (I had console print output), then run ES_LaunchTitle(BC) to start GameCube mode, then in custom MIOS PPC code, call VIDEO_Init again.

Here's a reproduction of my code, which caused the behaviour in the video:

wii app:

static GXRModeObj* _vMode;
static void* _fb;

int main(int argc, char* argv[]) {
    VIDEO_Init();
    _vMode = VIDEO_GetPreferredMode(NULL);
    VIDEO_Configure(_vMode);
    _fb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(_vMode));
    PAD_Init();
    CON_Init(_fb, 0, 64, _vMode->fbWidth, _vMode->xfbHeight, _vMode->fbWidth * 2);
    VIDEO_ClearFrameBuffer(_vMode, _fb, color);
    VIDEO_SetNextFramebuffer(_fb);
    VIDEO_SetBlack(false);
    VIDEO_Flush();
    VIDEO_WaitVSync();
    VIDEO_WaitVSync();
    printf("xfb: %p\n", _fb);
    VIDEO_SetBlack(false);
    VIDEO_Flush();
    VIDEO_WaitVSync();
    VIDEO_WaitVSync();
    printf("== ExecGCDol ==\n\n");
    static tikview view ATTRIBUTE_ALIGN(32); // requires alignment, so static
    ES_GetTicketViews(BC, &view, 1);
    sleep(1);
    printf("\x1b[46;1m" "Launching...\n" "\x1b[40m");
    ES_LaunchTitle(0x0000000100000100ULL, &view); // launch BC
}

cmios:

int main(int argc, char **argv) {
    sleep(2);
    VIDEO_Init();
    // sleep(2) then next command, so i can confirm it was VIDEO_Init since that's when the video was corrupted.
}

Environment?

PAL Wii (vanilla video, probably 480p), hardware revision 01 (but I think I had it on 60 as well).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions