ME3Tweaks / LegendaryExplorer

Editor toolset for Mass Effect Trilogy and Mass Effect Legendary Edition
https://me3tweaks.com
GNU General Public License v3.0
125 stars 27 forks source link

Porting out of global files can generate incorrect imports that have ForcedExport flags #300

Open Mgamerz opened 2 years ago

Mgamerz commented 2 years ago

Please fill out the following form in its entirety.

The more information you provide, the easier it will be for us to reproduce the issue.

Describe the bug When porting an object out of a global file, such as SFXGame, incorrect imports can be generated for exports that have the ForcedExport flag. These are essentially exports from a different package that were 'forced' to be cooked into the local package. The generated imports are nested under the global filename (such as SFXGame.BioEngineResources.Default.Default2DA), which is wrong. ForcedExports do not get referenced by their containing package, as they 'originated' from a different package. As such the game fails to resolve these, according to our LE1 Debug Logger. This issue I am sure affects other games as well.

To Reproduce

  1. Create a new LE1 package file (e.g. Repro.pcc)
  2. Open LE1 SFXGame.pcc
  3. Port out Default__BioMusicVolume (export 15871) to the root of this new package
  4. Observe that the Default2DA reference got stuffed under the SFXGame package export, even though it shouldn't be

image

Expected behavior The generated import for BioEngineResources should not be nested under the SFXGame import as it does not originate from SFXGame. Consequently every import nested under this also fails to resolve.

Screenshots and files used to replicate this See above

Version information: Please include both the date and version number that is located on the top right side of the main window. This information is required.

12/9/2021 Nightly Build This issue has been in toolset probably since we started porting imports across files.

Stack trace If you see an error dialog with a details or copy button, please post the details here.

Other information We need to identify list of package export names in global files that all files under will be 'forcedexports'. When generating imports we need to make sure we don't include the originating global package name like SFXGame. This will likely be a significant challenge as the relinker was built around a certain premise that has now changed.

As a side note, the import resolver should refuse to resolve these imports, as the game will not.

Mgamerz commented 2 years ago

Upcoming work I'm doing will improve our ResolveImport() method to reject ForcedExport marked exports from resolving if they are referenced with the package name as the root:

image