From 58c913b186fcc053fc9d53227cd80409e106f36e Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Thu, 12 Jan 2023 13:41:41 -0600 Subject: [PATCH] lib: fix library filter generator --- src/lib/libXbSymbolDatabase.c | 47 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/lib/libXbSymbolDatabase.c b/src/lib/libXbSymbolDatabase.c index c2f30a59..9987f887 100644 --- a/src/lib/libXbSymbolDatabase.c +++ b/src/lib/libXbSymbolDatabase.c @@ -528,33 +528,38 @@ uint32_t XbSymbolDatabase_GenerateLibraryFilter(const void* xb_header_addr, XbSD } // If found DSOUND library, then skip the manual check. - if (library_flag == XbSymbolLib_DSOUND && !has_dsound_library) { - has_dsound_library = true; + if (library_flag == XbSymbolLib_DSOUND) { + if (!has_dsound_library) { + has_dsound_library = true; + } } // If D3D8 and D3D8LTCG library details may had bundled by accident, then do manual fix below. // See details from https://github.com/Cxbx-Reloaded/XbSymbolDatabase/issues/178 - if (has_d3d8__ltcg_library) { - if (library_header != NULL) { - if (library_flag == XbSymbolLib_D3D8LTCG) { - // Force set to D3D8LTCG if D3D8 flag was found first. - internal_LibraryFilterUpdateFlagIfExist(library_header->filters, - count, - XbSymbolLib_D3D8, - XbSymbolLib_D3D8LTCG); + if (library_flag & (XbSymbolLib_D3D8 | XbSymbolLib_D3D8LTCG)) { + if (has_d3d8__ltcg_library) { + if (library_header != NULL) { + if (library_flag == XbSymbolLib_D3D8LTCG) { + // Force set to D3D8LTCG if D3D8 flag was found first. + internal_LibraryFilterUpdateFlagIfExist(library_header->filters, + count, + XbSymbolLib_D3D8, + XbSymbolLib_D3D8LTCG); + } + // Update duplicated library detail + internal_LibraryFilterUpdateVersionIfGreater(library_header->filters, + count, + XbSymbolLib_D3D8 | XbSymbolLib_D3D8LTCG, + xb_library_versions[library_index].wBuildVersion, + xb_library_versions[library_index].wFlags.QFEVersion); } - // Update duplicated library detail - internal_LibraryFilterUpdateVersionIfGreater(library_header->filters, - count, - XbSymbolLib_D3D8 | XbSymbolLib_D3D8LTCG, - xb_library_versions[library_index].wBuildVersion, - xb_library_versions[library_index].wFlags.QFEVersion); + + // Skip duplicate library finding. + continue; + } + else if (!has_d3d8__ltcg_library) { + has_d3d8__ltcg_library = true; } - // Skip duplicate library finding. - continue; - } - else if (!has_d3d8__ltcg_library && (library_flag & (XbSymbolLib_D3D8 | XbSymbolLib_D3D8LTCG))) { - has_d3d8__ltcg_library = true; } // Append the information to the array.