mirror of https://github.com/mgba-emu/mgba.git
SDL: Properly clean up if a game doesn't launch
This commit is contained in:
parent
19eaba3cdd
commit
0367a9db06
1
CHANGES
1
CHANGES
|
@ -29,6 +29,7 @@ Bugfixes:
|
|||
- GBA Memory: Fix alignment of open bus 8- and 16-bit loads
|
||||
- GBA Thread: Fix possible hang when loading an archive
|
||||
- Perf: Fix crash when the GBA thread fails to start
|
||||
- SDL: Properly clean up if a game doesn't launch
|
||||
Misc:
|
||||
- GBA Audio: Change internal audio sample buffer from 32-bit to 16-bit samples
|
||||
- GBA Memory: Simplify memory API and use fixed bus width
|
||||
|
|
|
@ -105,12 +105,17 @@ int main(int argc, char** argv) {
|
|||
GBASDLEventsLoadConfig(&renderer.events, &config.configTable); // TODO: Don't use this directly
|
||||
context.overrides = &config.configTable;
|
||||
|
||||
GBAThreadStart(&context);
|
||||
int didFail = 0;
|
||||
if (GBAThreadStart(&context)) {
|
||||
GBASDLRunloop(&context, &renderer);
|
||||
GBAThreadJoin(&context);
|
||||
} else {
|
||||
didFail = 1;
|
||||
printf("Could not run game. Are you sure the file exists and is a Game Boy Advance game?\n");
|
||||
}
|
||||
|
||||
GBASDLRunloop(&context, &renderer);
|
||||
|
||||
GBAThreadJoin(&context);
|
||||
if (GBAThreadHasCrashed(&context)) {
|
||||
didFail = 1;
|
||||
printf("The game crashed!\n");
|
||||
}
|
||||
freeArguments(&args);
|
||||
|
@ -121,7 +126,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
_GBASDLDeinit(&renderer);
|
||||
|
||||
return 0;
|
||||
return didFail;
|
||||
}
|
||||
|
||||
static bool _GBASDLInit(struct SDLSoftwareRenderer* renderer) {
|
||||
|
|
Loading…
Reference in New Issue