virtfs: Tell file plugins which shut down.

We can have multiple, so it ideally needs to deal with the latest.
This commit is contained in:
Unknown W. Brackets
2023-03-26 14:35:54 -07:00
parent 921c4dccd9
commit 414be98489
2 changed files with 16 additions and 3 deletions

View File

@@ -831,7 +831,8 @@ void VirtualDiscFileSystem::HandlerLogger(void *arg, HandlerHandle handle, LogTy
}
}
VirtualDiscFileSystem::Handler::Handler(const char *filename, VirtualDiscFileSystem *const sys) {
VirtualDiscFileSystem::Handler::Handler(const char *filename, VirtualDiscFileSystem *const sys)
: sys_(sys) {
#if !PPSSPP_PLATFORM(SWITCH)
#ifdef _WIN32
#if PPSSPP_PLATFORM(UWP)
@@ -854,7 +855,12 @@ VirtualDiscFileSystem::Handler::Handler(const char *filename, VirtualDiscFileSys
Read = (ReadFunc)dlsym(library, "Read");
Close = (CloseFunc)dlsym(library, "Close");
if (Init == NULL || Shutdown == NULL || Open == NULL || Seek == NULL || Read == NULL || Close == NULL) {
VersionFunc Version = VersionFunc();
if (Version() >= 2) {
ShutdownV2 = (ShutdownV2Func)Shutdown;
}
if (!Init || !Shutdown || !Open || !Seek || !Read || !Close) {
ERROR_LOG(FILESYS, "Unable to find all handler functions: %s", filename);
dlclose(library);
library = NULL;
@@ -876,7 +882,10 @@ VirtualDiscFileSystem::Handler::Handler(const char *filename, VirtualDiscFileSys
VirtualDiscFileSystem::Handler::~Handler() {
if (library != NULL) {
Shutdown();
if (ShutdownV2)
ShutdownV2(sys_);
else
Shutdown();
#if !PPSSPP_PLATFORM(UWP) && !PPSSPP_PLATFORM(SWITCH)
#ifdef _WIN32