Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - CBA - use PREPMAIN() instead of CfgFunctions #1338

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented May 15, 2020

When merged this pull request will:

  • title

  • allows recompiling with the PREP stuff, not the BI CfgFunctions stuff

  • functions may not be available in other components in preInit

  • CBA_fnc_isRecompileEnabled is compiled twice?


  • Handle CfgFunctions/init running multiple times
  • Handle DISABLE_COMPILE_CACHE for one component (leave copying to PREP's in components, but do not recompile pre preStart).
  • Macros in ACE.

@commy2 commy2 added this to the 3.15.2 milestone May 15, 2020
Copy link
Member

@veteran29 veteran29 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downside is that PREPMAIN functions will be not visible in function viewer.

@commy2
Copy link
Contributor Author

commy2 commented May 15, 2020

Upside will be that we can trim the header residue of both PREP and PREPMAIN after this is done and merged.

@PabstMirror
Copy link
Contributor

CBA_fnc_addSettings is defined by CfgFunctions, cba_settings_fnc_init by PREP.
This means that cba_settings_fnc_init will be undefined when used by an addon in preInit that does not require cba_settings and is therefore likely loaded before the settings XEH preInit can define the function.

ref #1111

addons/events/XEH_PREP.sqf Outdated Show resolved Hide resolved
@commy2
Copy link
Contributor Author

commy2 commented May 15, 2020

What Pabst said is a true concern and I don't know how to go about it (I will do the rest anyway for now).

@commy2 commy2 changed the title CBA - use PREPMAIN() instead of CfgFunctions [WIP] CBA - use PREPMAIN() instead of CfgFunctions May 15, 2020
@commy2 commy2 changed the title [WIP] CBA - use PREPMAIN() instead of CfgFunctions WIP CBA - use PREPMAIN() instead of CfgFunctions May 15, 2020
@commy2 commy2 changed the title WIP CBA - use PREPMAIN() instead of CfgFunctions WIP - CBA - use PREPMAIN() instead of CfgFunctions May 15, 2020
@PabstMirror
Copy link
Contributor

with current setup, I can start ace and then then disable compile cache as I need for each addon
with this PR once the game is started and the PREP_list is generated then it will always be there and compileFinaled,

so I find this more restrictive
preInit with cba and ace takes less than a second, so I don't know if this kind of optimization is worth the drawbacks

@commy2
Copy link
Contributor Author

commy2 commented May 16, 2020

This is not done, pabst. The recompiling stuff is not implemented.

@commy2
Copy link
Contributor Author

commy2 commented May 17, 2020

@PabstMirror You may test again now.

@commy2 commy2 removed the WIP label May 17, 2020
@PabstMirror
Copy link
Contributor

11:31:36 Attempt to override final function - ace_attach_fnc_attach
11:31:36 Attempt to override final function - ace_attach_fnc_canattach

for just about every ace func, DISABLE_COMPILE_CACHE has no effect

@commy2
Copy link
Contributor Author

commy2 commented May 17, 2020

DISABLE_COMPILE_CACHE has no effect

OK -.-

@PabstMirror
Copy link
Contributor

ace's prep is changed from cba

#ifdef DISABLE_COMPILE_CACHE
    #undef PREP
    #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf)
#else
    #undef PREP
    #define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction
#endif

@commy2
Copy link
Contributor Author

commy2 commented May 17, 2020

Attempt to override final function is caused by CfgFunction init being executed multiple times due to some vanilla bug or whatever. I can work around that, but it should not affect functionality for now.

ace's prep is changed from cba

Okay, that explains it. I will change it in ACE.

@commy2 commy2 added the WIP label May 17, 2020
@commy2
Copy link
Contributor Author

commy2 commented May 29, 2020

Attempt to override final function

spam should be fixed now.

Adds _autoPrep flag to CBA_fnc_compileFunction. Function is only added to PREP_List if this flag is set to true. PREPMAIN uses it, PREP does not, which means you can use DISABLED_COMPILE_CACHE in the component, but it also means you still need the PREP in preInit.

Any other issues with this?

@commy2
Copy link
Contributor Author

commy2 commented Jun 16, 2020

Test CBA_fnc_addKeybind without cba_main in requiredAddons.

@veteran29
Copy link
Member

Test CBA_fnc_addKeybind without cba_main in requiredAddons.

Tested with following addons:
required.zip
no_required.zip

When afm_pointing does not have anything in required addons then the keybind is not added when addKeybind function is called in preInit. When cba_main is required then it works.

@PabstMirror PabstMirror modified the milestones: 3.15.2, 3.16 Sep 16, 2020
@PabstMirror PabstMirror modified the milestones: 3.16, Ongoing Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants