diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-01-28 22:00:22 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-01-28 22:00:22 +0100 |
| commit | 7ebfe844892f9f4822046f98f91bfa85b3e39714 (patch) | |
| tree | ffbaea7de870b4340acb6da9970e5a047e9a14fe /src/librarian | |
| parent | 4e645debaadb92a8dc38e305bac2ccdee939c3ca (diff) | |
| download | box64-7ebfe844892f9f4822046f98f91bfa85b3e39714.tar.gz box64-7ebfe844892f9f4822046f98f91bfa85b3e39714.zip | |
Fixed some isse with last lib init/fini refactor (fixed ut2004, maybe pokewilds too)
Diffstat (limited to 'src/librarian')
| -rwxr-xr-x | src/librarian/librarian.c | 4 | ||||
| -rwxr-xr-x | src/librarian/library.c | 16 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/librarian/librarian.c b/src/librarian/librarian.c index 5504e961..919389bc 100755 --- a/src/librarian/librarian.c +++ b/src/librarian/librarian.c @@ -168,7 +168,7 @@ int AddNeededLib_add(lib_t* maplib, int local, needed_libs_t* needed, int n, box // first check if lib is already loaded library_t *lib = getLib(my_context->maplib, path); if(lib) { - IncRefCount(lib); // increment cntref + IncRefCount(lib, emu); // increment cntref needed->libs[n] = lib; printf_log(LOG_DEBUG, "Already present in maplib => success\n"); return 0; @@ -178,7 +178,7 @@ int AddNeededLib_add(lib_t* maplib, int local, needed_libs_t* needed, int n, box if(lib) { printf_log(LOG_DEBUG, "Already present in local_maplib => success\n"); needed->libs[n] = lib; - IncRefCount(lib); // increment cntref + IncRefCount(lib, emu); // increment cntref if(local) { // add lib to maplib... if(maplib) { diff --git a/src/librarian/library.c b/src/librarian/library.c index 1c18c9dc..76fc2898 100755 --- a/src/librarian/library.c +++ b/src/librarian/library.c @@ -1058,13 +1058,17 @@ void setNeededLibs(library_t* lib, int n, ...) va_end (va); } -void IncRefCount(library_t* lib) +void IncRefCount(library_t* lib, x64emu_t* emu) { - if(lib->type!=LIB_WRAPPED && lib->type!=LIB_UNNKNOW) + if(lib->type==LIB_UNNKNOW) return; - if(lib->type==LIB_WRAPPED) { - ++lib->w.refcnt; - } else { - ++lib->e.elf->refcnt; + if(!lib->active) + ReloadLibrary(lib, emu); + switch (lib->type) { + case LIB_WRAPPED: + ++lib->w.refcnt; + break; + case LIB_EMULATED: + ++lib->e.elf->refcnt; } } \ No newline at end of file |