Hext files are loaded regardless of conditional met or not.
wturner859 opened this issue · 4 comments
<Conditional Folder="testfolder" ActiveWhen="option = 1"> <RuntimeVar Var="Byte:0x913FC3" Values="01" /> </Conditional>
Let's say in that testfolder there is a hext file and an image file.
If the condition 01 is met, both the hext file and the image will load.
If the condition is not met, the image will not load, but the hext will regardless of the conditional.
AFAIK Hext files have no conditional loading logic, they are just loaded and applied when the game is launched.
This is basically a feature request.
The entire folder the hext file is in isn't supposed to be loaded at all unless the condition is met. That's why the image doesn't load. But the hext still does.
I would think this isn't intended considering this wouldn't load unless the option is 1 even though hext files exist there. It doesn't just blindly load any hext file that may be in the mod:
<ModFolder Folder="Folder_With_Hext_Files" ActiveWhen="Option = 1" />
Maybe not so much a bug as much as never implemented.
If this is implemented it will allow some pretty cool things like automatically detecting if another mod is loaded, boom no more need for "are you using echo-s" option.
After speding an entire evening understanding how hext files are being loaded in 7th, unfortunately we are not able to introduce a smart hext loading based on for eg. a variable with a value while the game is loading.
This is mainly because of 2 reasons:
- The profile that is loaded by
7thWrapperLib
( our C# mod injector ) is being generated statically by 7th when you hit the Play button. That profile file is then read by the lib file and parsed, on top of what was generated, the lib applies hext files on top of what was found during that Play button moment. - As the hext file patches are applied before the game starts you won't even know if a mod did apply something or not, at least not using the
<RuntimeVar>
the way it works right now.
Because of these both cases, we can't support yet dynamic hext loading, but you could filter them using something like this, which works already on the current 7th code:
<ConfigOption>
<Type>List</Type>
<Default>1</Default>
<ID>FFNxHext</ID>
<Name>FFNx hext</Name>
<Description>Enable default FFNx hext</Description>
<Option Value="0" Name="OFF"/>
<Option Value="1" Name="ON"/>
</ConfigOption>
<ModFolder Folder="FFNx" ActiveWhen="FFNxHext = 1" />
and this is how your folder structure would look like:
\FFNx\hext\test.txt
\mod.xml
The trick is basically TO NOT put any hext file in \hext
as it would be applied no matter what condition you put on the XML file.
By using this trick you can then use the usual syntax to enable/disable an option based on compatibility.
I'm going therefore to close this ticket as at the moment, and likely in the future, we would never be able to support this unless we do a very huge architectural change of 7th itself.