mirror of https://github.com/mgba-emu/mgba.git
Perf: Fix crash when the GBA thread fails to start
This commit is contained in:
parent
e70df7b6f7
commit
09db378531
1
CHANGES
1
CHANGES
|
@ -28,6 +28,7 @@ Bugfixes:
|
|||
- GBA BIOS: Fix BIOS prefetch after reset
|
||||
- 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
|
||||
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
|
||||
|
|
|
@ -86,7 +86,11 @@ int main(int argc, char** argv) {
|
|||
GBAMapArgumentsToContext(&args, &context);
|
||||
GBAMapOptionsToContext(&opts, &context);
|
||||
|
||||
GBAThreadStart(&context);
|
||||
int didStart = GBAThreadStart(&context);
|
||||
|
||||
if (!didStart) {
|
||||
goto cleanup;
|
||||
}
|
||||
GBAGetGameCode(context.gba, gameCode);
|
||||
|
||||
int frames = perfOpts.frames;
|
||||
|
@ -102,12 +106,6 @@ int main(int argc, char** argv) {
|
|||
uint64_t duration = end - start;
|
||||
|
||||
GBAThreadJoin(&context);
|
||||
GBAConfigFreeOpts(&opts);
|
||||
freeArguments(&args);
|
||||
GBAConfigDeinit(&config);
|
||||
free(context.debugger);
|
||||
|
||||
free(renderer.outputBuffer);
|
||||
|
||||
float scaledFrames = frames * 1000000.f;
|
||||
if (perfOpts.csv) {
|
||||
|
@ -123,7 +121,14 @@ int main(int argc, char** argv) {
|
|||
printf("%u frames in %" PRIu64 " microseconds: %g fps (%gx)\n", frames, duration, scaledFrames / duration, scaledFrames / (duration * 60.f));
|
||||
}
|
||||
|
||||
return GBAThreadHasCrashed(&context);
|
||||
cleanup:
|
||||
GBAConfigFreeOpts(&opts);
|
||||
freeArguments(&args);
|
||||
GBAConfigDeinit(&config);
|
||||
free(context.debugger);
|
||||
free(renderer.outputBuffer);
|
||||
|
||||
return !didStart || GBAThreadHasCrashed(&context);
|
||||
}
|
||||
|
||||
static void _GBAPerfRunloop(struct GBAThread* context, int* frames, bool quiet) {
|
||||
|
|
Loading…
Reference in New Issue