BizHawk icon indicating copy to clipboard operation
BizHawk copied to clipboard

Refactor InputDisplayGenerator + LogEntryGenerator + ControllerDefinition

Open Morilli opened this issue 2 years ago • 0 comments

This PR supersedes / expands #3742. This also partially (fixes) #3779 (the exception is fixed and the movie imports fine, but the logkey is missing FDS controls and so the movie may misbehave when editing it).

The main goals here are to improve performance (e.g. for the movie importers) by improving caching, simplify code and make the structure better and clearer.

Now, the Bk2LogEntryGenerator and Bk2InputDisplayGenerator classes are entirely static and just take an IController as input. They now rely on the IController::Definitions MnemonicCache to be performant, whereas such a cache was previously built by the classes themselves. I'm not entirely sure about this cache being on ControllerDefinition, but I feel like it does make sense in the current code structure. The fact that this cache needs to be manually built is kinda ugly. The best solution I can see for that would be to move the Bk2MnemonicLookup to a place accessable by ControllerDefinition and build the mnemonic cache on MakeImmutable (which then needs an additional systemId arg).

Oh, I also removed the hacky SetMovieController function that was used for initial default.tasproj saving, didn't seem to be necessary? ~~this will 100% cause bugs later on~~

Check if completed:

Morilli avatar Sep 28 '23 22:09 Morilli