mirror of https://github.com/mgba-emu/mgba.git
Switch: Fix final cleanup (fixes #1283)
This commit is contained in:
parent
2d303cdda3
commit
0eaa9e487f
1
CHANGES
1
CHANGES
|
@ -5,6 +5,7 @@ Bugfixes:
|
||||||
- GBA: All IRQs have 7 cycle delay (fixes mgba.io/i/539, mgba.io/i/1208)
|
- GBA: All IRQs have 7 cycle delay (fixes mgba.io/i/539, mgba.io/i/1208)
|
||||||
- GBA: Reset now reloads multiboot ROMs
|
- GBA: Reset now reloads multiboot ROMs
|
||||||
- GBA BIOS: Fix multiboot entry point (fixes Magic Floor)
|
- GBA BIOS: Fix multiboot entry point (fixes Magic Floor)
|
||||||
|
- Switch: Fix final cleanup (fixes mgba.io/i/1283)
|
||||||
Misc:
|
Misc:
|
||||||
- GBA Savedata: EEPROM performance fixes
|
- GBA Savedata: EEPROM performance fixes
|
||||||
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
|
- GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
|
||||||
|
|
|
@ -100,63 +100,64 @@ static enum ScreenMode {
|
||||||
} screenMode = SM_PA;
|
} screenMode = SM_PA;
|
||||||
|
|
||||||
static bool initEgl() {
|
static bool initEgl() {
|
||||||
s_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
s_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
if (!s_display) {
|
if (!s_display) {
|
||||||
goto _fail0;
|
goto _fail0;
|
||||||
}
|
}
|
||||||
|
|
||||||
eglInitialize(s_display, NULL, NULL);
|
eglInitialize(s_display, NULL, NULL);
|
||||||
|
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
EGLint numConfigs;
|
EGLint numConfigs;
|
||||||
static const EGLint attributeList[] = {
|
static const EGLint attributeList[] = {
|
||||||
EGL_RED_SIZE, 1,
|
EGL_RED_SIZE, 1,
|
||||||
EGL_GREEN_SIZE, 1,
|
EGL_GREEN_SIZE, 1,
|
||||||
EGL_BLUE_SIZE, 1,
|
EGL_BLUE_SIZE, 1,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
eglChooseConfig(s_display, attributeList, &config, 1, &numConfigs);
|
eglChooseConfig(s_display, attributeList, &config, 1, &numConfigs);
|
||||||
if (!numConfigs) {
|
if (!numConfigs) {
|
||||||
goto _fail1;
|
goto _fail1;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_surface = eglCreateWindowSurface(s_display, config, nwindowGetDefault(), NULL);
|
s_surface = eglCreateWindowSurface(s_display, config, nwindowGetDefault(), NULL);
|
||||||
if (!s_surface) {
|
if (!s_surface) {
|
||||||
goto _fail1;
|
goto _fail1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint contextAttributeList[] = {
|
EGLint contextAttributeList[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 3,
|
EGL_CONTEXT_CLIENT_VERSION, 3,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
s_context = eglCreateContext(s_display, config, EGL_NO_CONTEXT, contextAttributeList);
|
s_context = eglCreateContext(s_display, config, EGL_NO_CONTEXT, contextAttributeList);
|
||||||
if (!s_context) {
|
if (!s_context) {
|
||||||
goto _fail2;
|
goto _fail2;
|
||||||
}
|
}
|
||||||
|
|
||||||
eglMakeCurrent(s_display, s_surface, s_surface, s_context);
|
eglMakeCurrent(s_display, s_surface, s_surface, s_context);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
_fail2:
|
_fail2:
|
||||||
eglDestroySurface(s_display, s_surface);
|
eglDestroySurface(s_display, s_surface);
|
||||||
s_surface = NULL;
|
s_surface = NULL;
|
||||||
_fail1:
|
_fail1:
|
||||||
eglTerminate(s_display);
|
eglTerminate(s_display);
|
||||||
s_display = NULL;
|
s_display = NULL;
|
||||||
_fail0:
|
_fail0:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinitEgl() {
|
static void deinitEgl() {
|
||||||
if (s_display) {
|
if (s_display) {
|
||||||
if (s_context) {
|
eglMakeCurrent(s_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
eglDestroyContext(s_display, s_context);
|
if (s_context) {
|
||||||
}
|
eglDestroyContext(s_display, s_context);
|
||||||
if (s_surface) {
|
}
|
||||||
eglDestroySurface(s_display, s_surface);
|
if (s_surface) {
|
||||||
}
|
eglDestroySurface(s_display, s_surface);
|
||||||
eglTerminate(s_display);
|
}
|
||||||
}
|
eglTerminate(s_display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _mapKey(struct mInputMap* map, uint32_t binding, int nativeKey, enum GBAKey key) {
|
static void _mapKey(struct mInputMap* map, uint32_t binding, int nativeKey, enum GBAKey key) {
|
||||||
|
@ -726,8 +727,14 @@ int main(int argc, char* argv[]) {
|
||||||
mGUIRunloop(&runner);
|
mGUIRunloop(&runner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mGUIDeinit(&runner);
|
||||||
|
|
||||||
|
audoutStopAudioOut();
|
||||||
|
GUIFontDestroy(font);
|
||||||
|
|
||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
|
||||||
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
||||||
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
glDeleteBuffers(1, &pbo);
|
glDeleteBuffers(1, &pbo);
|
||||||
|
|
||||||
glDeleteTextures(1, &tex);
|
glDeleteTextures(1, &tex);
|
||||||
|
|
Loading…
Reference in New Issue