Skip to content

DarkEdif ext dev features

Phi edited this page Sep 14, 2020 · 15 revisions

DarkEdif SDK is a continuation of Edif SDK with changes mostly coded by Phi, with some code contributions from LB and other developers. CT forum thread.

This page is a breakdown of extension developer's features, including those added silently, those activated by tools or keywords, and more "hidden" options.

Passive features

It includes all the features of Edif and some extra, including:

  • Multi-language JSON file
    See Bluewing Server's JSON for example; search for "French".
  • Properties defined in the JSON file
    See DarkEdif Template for properties available.
  • Error messages during Edif crash scenarios (e.g. missing actions)
    Not every Edif crash is prevented, but quite a few are checked for at runtime.
  • Minified SDK
    All unnecessary editor functions have been removed from compilation; in most cases Runtime.cpp is not necessary at all.
    The DarkEdif Template still has examples for all functions removed if you need them; uncomment and they'll work.
    On related note, the Ext.def file has been removed, as now the #pragma DllExportHint to make the function visible to Fusion. The runtime has also been minified.

Check that JSON and C++ parameters match

This is done by C++ template metaprogramming, with message boxes shown when object is created in Run Application and built EXEs. It is only active in Debug and Debug Unicode builds.

It can be disabled by defining FAST_ACE_LINK in project properties, but this is strongly discouraged, as Fusion limits the parameter types that can be used to very specific types, and trying to "trick" the SDK to letting you use the wrong types is will cause crashes from the processor reading wrong CPU registers.

JSON minifier

As only some parts of the JSON are read by the SDK at runtime, the SDK features a JSON minifier, which is automatic.
Whenever you build for Runtime or Runtime Unicode, a tool runs before compilation starts. In the tool:

  1. DarkExt.json, Extension.cpp, and Extension.h have their modified dates read.
  2. DarkExt.PostMinify.json is looked for
    If found, the date stored in the first line is compared against the most recent out of the three files above. If the date is lesser - a change has been made - then the PostMinify JSON is regenerated again.
    If not found, the PostMinify JSON will be generated again.
  3. DarkExt.json is read, and all parts not used by Runtime will be stripped and put in DarkExt.PostMinify.json.

The minifier works like this:

  • Comments removed
  • All whitespace outside of text will be removed
  • Actions, Conditions, Expressions titles and parameters names removed; the types are kept, as well as the Triggered property for conditions
  • Properties' names are used by EDITDATA reading functions; at least in this version of DarkEdif.
  • Any other language bar the first one is stripped entirely

The PostMinify JSON is handled separately in json.cpp (see the end of the file) and is expected to be in minified format during Runtime compilation by the resource compiler.

Active features

The following is a list of all features that must be activated by the extension developer.

Extension description defined at runtime

Only active during Editor builds.
If JSON_COMMENT_MACRO is defined, the extension description (or "comment") is put in a sprintf_s(), with the parameter list set to the content of JSON_COMMENT_MACRO.
JSON_COMMENT_MACRO is usually defined in Common.h. As the parameters will be evaluated at runtime, it's worth double-checking them against the sprintf parameter list.

An example can be seen in Bluewing Client (Common.h, DarkExt.json) and Bluewing Server (Common.h, DarkExt.json).

Fusion debugger access

Accessed via DarkEdif::FusionDebugger, and meant to be used with lambda functions, otherwise known as anonymous functions.
The feature is activated by definition USE_DARKEDIF_FUSION_DEBUGGER, which is set automatically by the DarkEdifPreBuildTool, when FusionDebugger is detected inside Extension.cpp.

See examples Bluewing Client (Extension.cpp, Extension.h), and Bluewing Server (Extension.cpp, Extension.h).

DarkEdif uses a pre-build standalone tool (and in non-Windows platforms, also a post-build standalone tool) programmed in C#. This tool is currently not open-source.

SDK update checker

The SDK update checker is activated by adding RunUpdateNotifs() in Edittime.cpp, which is normally done inside EditorDisplay(). When this function is added, the PROPS file will automatically define USE_DARKEDIF_UPDATE_CHECKER=1.

The update checker can be disabled or modified by the Fusion user's DarkEdif.ini file; your DarkEdif.ini also affects the update checker, like it does every other DarkEdif feature.

It's worth noting that this check is sent under basic HTTP 1.1, not HTTPS, as adding an encryption library to every DarkEdif extension would bloat extensions unnecessarily.

Details sent:

  • Project name; e.g. "DarkEdif Template"
  • Project configuration; e.g. "Debug" or "Edittime Unicode"
  • Extension::Version variable; e.g. "12"
  • DarkEdif::SDKVersion; e.g. "1"

The URL queried will look up an internal database, and either report no update, a minor update, a major update, or an error. Updates are set to major or minor by the extension developer, and a major one normally indicates a crash or otherwise important fix/improvement.

All serious errors are reported to the user. More errors are reported to testers and extension developers, who are detected by the page via the version they're using and the project configuration, respectively.
If built in Debug configuration, the SDK version is compared against the latest and an DarkEdif SDK version check is done too, to report if the DarkEdif SDK is out of date and the extension will be missing SDK fixes.

TODO: Expand

INI for code FusionSDKConfig.ini

FusionSDKConfig.ini TODO...

Clone this wiki locally