Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIDEO_Init crash when called in MIOS #188

Open
pyorot opened this issue Dec 31, 2024 · 1 comment
Open

VIDEO_Init crash when called in MIOS #188

pyorot opened this issue Dec 31, 2024 · 1 comment

Comments

@pyorot
Copy link

pyorot commented Dec 31, 2024

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).

@DacoTaco
Copy link
Member

DacoTaco commented Jan 1, 2025

seeing how its in MIOS this is waaaaay out of scope of libogc, however i do believe its worth investigating as it indicates either a memory issue or a mistake in the VI code. we should figure out what can fix it and what changed if we can fix it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants