Skip to content

Fixes for libretro on Mac#885

Merged
flyinghead merged 5 commits intoflyinghead:masterfrom
warmenhoven:warmenhoven/libretro-osx
Jan 20, 2023
Merged

Fixes for libretro on Mac#885
flyinghead merged 5 commits intoflyinghead:masterfrom
warmenhoven:warmenhoven/libretro-osx

Conversation

@warmenhoven
Copy link
Contributor

Static variables can get left around and reused following dlclose/dlopen (the manpage for dlclose is deliberately unclear about whether that will happen). RetroArch on OSX crashes when trying to load flycast a second time because the core fails to reinitialize, because it thinks it is terminated.

@warmenhoven
Copy link
Contributor Author

In posix_vmem.cpp's allocate_shared_filemem(), if the user data dir has not been set, the path that tries to get opened on OSX is just dcnzorz_mem, which fails to open properly.

@flyinghead
Copy link
Owner

The reason why you can't call Emulator::init() after having called Emulator::term() is because some components don't support it.

This is a problem for libretro when the core is not unloaded after retro_deinit() in some environments, as is the case for linux already. On linux, term() is never called and init() is called on first load only.

You can have a look at the changes in libretro.cpp in e0058c1. Adding APPLE to the list would probably fix the issue.

@warmenhoven warmenhoven changed the title Allow reinitialization after termination Fixes for libretro on Mac Jan 20, 2023
@flyinghead flyinghead merged commit 1948c66 into flyinghead:master Jan 20, 2023
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

Successfully merging this pull request may close these issues.

2 participants