Depending on how far I got into my code, I am no longer able to do "consoleInit(nullptr);" + printing some debug or error messages. The exact point after which I am not able anymore is after I called eglCreateWindowSurface(). The yuzu emulator for example keeps haning on the emulator's "loading" screen. I'm unsure if anything until then went wrong, or if everything until then is just fine and something later doesn't work.
As for the EGL initialization part of my code, it looks like this:
Code: Select all
auto window = nwindowGetDefault();
nwindowSetDimensions(window, DISPLAY_WIDTH, DISPLAY_HEIGHT);
static const EGLint framebufferAttributeList[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_STENCIL_SIZE, 8,
EGL_NONE
};
static const EGLint contextAttributeList[] = {
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
EGL_CONTEXT_MAJOR_VERSION, 4,
EGL_CONTEXT_MINOR_VERSION, 3,
EGL_NONE
};
mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if(!mEglDisplay) {
throw new std::runtime_error(eglErrorToString(eglGetError()));
}
if(eglInitialize(mEglDisplay, nullptr, nullptr) == EGL_FALSE) {
throw new std::runtime_error(eglErrorToString(eglGetError()));
}
if(eglBindAPI(EGL_OPENGL_API) == EGL_FALSE) {
throw new std::runtime_error(eglErrorToString(eglGetError()));
}
EGLConfig config;
EGLint numConfigs;
eglChooseConfig(mEglDisplay, framebufferAttributeList, &config, 1, &numConfigs);
if(numConfigs == 0) {
throw new std::runtime_error(eglErrorToString(eglGetError()));
}
mEglSurface = eglCreateWindowSurface(mEglDisplay, config, window, nullptr); // <- emulator seems to hang here (?)
if(!mEglSurface) {
throw new std::runtime_error(eglErrorToString(eglGetError()));
}
mEglContext = eglCreateContext(mEglDisplay, config, EGL_NO_CONTEXT, contextAttributeList);
if(!mEglContext) {
throw new std::runtime_error(eglErrorToString(eglGetError()));
}
eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
The only relevant code, I run before initializing EGL, is creating some small classes, doing nothing really in their constructors, and optionally "romfsInit()" (I also tried without romfs).
Does anyone have any clue what is possibly going wrong or how I can debug the Switch ROM better?