That is a brilliant idea, will be really useful, for debugging also.
I was checking the AVS cpp code to see how the files are read/written. Here is what i've understood so far, if its of any help to anyone. Will need more help from someone with better understanding of the code.
The basic preset reading starts at __LoadPreset method in r_list.cpp. From there it goes on to read a root effectlist, and subsequently all the effects in the preset,
The basic structure is something like this:
- AVS Signature string - "Nullsoft AVS Preset 0.2\x1a"
- Root Effectlist Config - Effectlist config contains the following
- mode (1 BYTE + 1 optional INT depending on the value of the first byte) - Not exactly sure how this is used. but i think it determines how some of the effectlist settings are read.
- several INT values containing effect list settings. These i think are optional depending on the mode
- config data for all sub effects
The structure for each effect including effectlist (other than the root) is as follows.
- EffectId INT - This indicates the effect type. There are three cases for this
- if EffectId == LIST_ID (0xfffffffe) then this is an effectlist
- if EffectId < DLLRENDERBASE (16384) then this is a built in effect and EffectId is the index in the effect initializer declarations ie. DECLARE_EFFECT calls in rlib.cpp.
- if EffectId > DLLRENDERBASE then i think the effect is loaded externally. The EffectId in this case is followed by a 32 byte string identifying the effect.
- Length INT - Length number of bytes that follow make the config for this effect.
- Config Code (Length BYTES) - This data i think is passed to load_config method of corresponding effect classes to initialize each effect.
Further, for externally loaded effects, it seems that the Config Code Section again has a structure like
- use_code INT - Not sure what this means exactly.
- length INT - number of bytes of config data that follows.
- actual config data?
Meanwhile, on WebVS side, i ve added more stuff
- More Effects
- Blending related stuff
- Support for Registers and more avs functions
- The demo now runs UnConeD's "Silk Strings" preset.
Not sure how far i can maintain compatibility with AVS. I am also adding some improvements, like
- Named global vars - variables starting with @ symbol are global.
- clone - Effects can contain a clone parameter, an integer that would create multiple instances of the same effect. The clone index is then available as a variable in the avs expressions.
I am also trying to figure out a way to do an AVS editor like UI.