enbPanels is a enbseries plugin that comes with a Lua script VM (LuaJIT) that allows user to program their own custom UI that access ENB parameters and more.
list of enbPanels supported function
function onDestroy()
Invoked when the script is reloaded or on game exit.
function onENBCallback_BeginFrame()
Invoked when the frame just drawn.
function onENBCallback_EndFrame()
Invoked when runtime is about to draw the frame.
function onENBCallback_PreReset()
Invoked when the frame object is about to be destroy. (alt-tab from fullscreen or exit)
function onENBCallback_PostReset()
Invoked when the frame object is recovered. (alt-tab from fullscreen or app launched)
function onENBCallback_PreSave()
Invoked when enb save button is pressed, but before enb write to config.
function onENBCallback_PostLoad()
Invoked when enb load button is pressed, and after enb read the config.
number GetSDKVersion()
Return version number of exported enbseries sdk.
number GerVersion()
Return version number of active enbseries dll.
string GetGameIdentifier()
Return unique GameID of the runtime. ..* SkyrimSE: "0x10000002" ..* Fallout4: "0x10000006"
bool IsEditorActive()
Return true if enb GUI is opened.
bool IsEffectsWndActive()
Return true if enb shader effects window is opened.
number ScreenX, number ScreenY = GetScreenSize()
Return the screen dimension.
- ScreenX
- Horizontal pixel count.
- ScreenY
- Vertical pixel count.
bool SetTex( string filename, string section, string keyname, tex val)
bool SetBool( string filename, string section, string keyname, bool val)
bool SetInt( string filename, string section, string keyname, int val)
bool SetFloat( string filename, string section, string keyname, float val)
bool SetColorRGB( string filename, string section, string keyname, table val)
bool SetColorRGBA( string filename, string section, string keyname, table val)
bool SetSetVector3( string filename, string section, string keyname, table val)
Return true if succeseed.
- filename
- Is something people use sometimes.
- section
- If filename is set to "enbseries.ini", section can be one of the section name listed insides "enbseries.ini"
If filename is set to "", section can be one of the shader name.
In either case, the string have to be all caps. ie: "ENBEFFECT.FX", "EFFECT" - keyname
- the "UIName" set inside shader variable annotation
- val
- Values to be set. For SetColorRGB, SetColorRGBA, and SetSetVector3,
value input has to be a table array of respective size. ie: {0.1, 1.2, -0.7}
bool GetParameter( string filename, string section, string keyname, table val )
Return true if succeeded.
- filename
- Refer to Set### for details.
- section
- Refer to Set### for details.
- keyname
- Refer to Set### for details.
- val
- Values retrieved. For multi component types, the additional component will be assign to respective slot in the table array.
_PATH
full path to the plugin
_NAME
name of the plugin
_DIR
plugin directory
_VERSION
plugin version
tex2D createTexture2D(string path)
tex2D createTexture2D(string name)
tex2D createTexture2D(int x, int y, format fmt)
Load a texture from path, by global name, or create a read/write texture by size and format.
- path
- Path to the texture, relative to runtime directory.
- name
- Name of a predefined global tex resource. ie. TEX_FRAMEBUFFER
- x
- width of newly created texture
- y
- height of newly created texture
- fmt
- format of newly created texture. See
DXGI_FORMAT
for supported format
shader createPixelShader(string name)
shader createPixelShader(string path, string entryPoint)
Load a pixel shader from path and entry point, or by global name.
- path
- Path to the shader, relative to runtime directory.
SeePixel Shader
for more detail. - entryPoint
- Program entry point for the shader obj.
- name
- Name of a predefined global shader resource. ie. PS_LOD
rState createRenderState(opt shader ps)
rState createRenderState(table tex, opt shader ps)
Create a render state object from graphic resources.
- ps
- pixel shader assigned to the render state
- tex
- table of tex2D objects assigned to the render state. support up to 16 tex2Ds
config getConfig()
config getConfig(string path)
Load or create new config file at path.
- path
- Absolute path to the config file, or path relative to game directory.
texture object for either ENB or ImGui RenderState.
Active(); -- forced lua VM not to delete the obj in current scope.
Update(); -- update the texture content if it support write.
example usage:
local ENB = require "ENB"
local ImGui = require "ImGui"
local Plugin = require "Plugin"
-- create a rw 1x64 R8_UNORM texture
local intTex = Plugin.createTexture2D( 1, 64, DXGI_FORMAT["DXGI_FORMAT_R8_UNORM"])
-- assign intTex to ENB
ENB.SetTex("ENBEFFECTPOSTPASS.FX", "dynamicTexture", intTex)
function onENBCallback_EndFrame()
intTex:Active() -- keeps the object alive.
ImGui.Begin("demoWnd")
if( ImGui.SliderFloat("gradient", wLevel, 0, 1)) then
for i=1, 64 do intMem[i] = math.min(1.0, ((i - 1)/63.0) / wLevel[1]) end
intTex:Update(intMem); -- cpu updates intTex
end
ImGui.End()
end
4-components:
DXGI_FORMAT_R32G32B32A32_FLOAT
DXGI_FORMAT_R32G32B32A32_UINT
DXGI_FORMAT_R32G32B32A32_SINT
DXGI_FORMAT_R16G16B16A16_FLOAT
DXGI_FORMAT_R16G16B16A16_UNORM
DXGI_FORMAT_R16G16B16A16_UINT
DXGI_FORMAT_R16G16B16A16_SNORM
DXGI_FORMAT_R16G16B16A16_SINT
DXGI_FORMAT_R10G10B10A2_UNORM
DXGI_FORMAT_R10G10B10A2_UINT
DXGI_FORMAT_R8G8B8A8_UNORM
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
DXGI_FORMAT_R8G8B8A8_UINT
DXGI_FORMAT_R8G8B8A8_SNORM
DXGI_FORMAT_R8G8B8A8_SINT
3-components:
DXGI_FORMAT_R32G32B32_FLOAT
DXGI_FORMAT_R32G32B32_UINT
DXGI_FORMAT_R32G32B32_SINT
DXGI_FORMAT_R11G11B10_FLOAT
2-components:
DXGI_FORMAT_R32G32_FLOAT
DXGI_FORMAT_R32G32_UINT
DXGI_FORMAT_R32G32_SINT
DXGI_FORMAT_R16G16_FLOAT
DXGI_FORMAT_R16G16_UNORM
DXGI_FORMAT_R16G16_UINT
DXGI_FORMAT_R16G16_SNORM
DXGI_FORMAT_R16G16_SINT
DXGI_FORMAT_R8G8_UNORM
DXGI_FORMAT_R8G8_UINT
DXGI_FORMAT_R8G8_SNORM
DXGI_FORMAT_R8G8_SINT
1-component:
DXGI_FORMAT_R32_FLOAT
DXGI_FORMAT_R32_UINT
DXGI_FORMAT_R32_SINT
DXGI_FORMAT_R16_FLOAT
DXGI_FORMAT_R16_UNORM
DXGI_FORMAT_R16_UINT
DXGI_FORMAT_R16_SNORM
DXGI_FORMAT_R16_SINT
DXGI_FORMAT_R8_UNORM
DXGI_FORMAT_R8_UINT
DXGI_FORMAT_R8_SNORM
DXGI_FORMAT_R8_SINT
shader object for ImGui RenderState.
Active(); -- forced lua VM not to delete the obj in current scope.
Update(); -- update the cBuffer bound to the shader object.
// predef objects
sampler pointSampler : register(s0);
sampler linearSampler : register(s1);
cbuffer global : register(b0) {
float2 ScreenSize; // Width, Height
}
//this can be updated by shaderObj:Update();
cbuffer user : register(b1) {
float userVal0;
float3 userVal1;
}
//tex2D objects assigned to renderState object
Texture2D myTex : register(t0);
//... up to t15
// LoadConstBuffer function will only look for register "b1".
// user can set the values of it from script through "Update()" method under const buffer object.
cbuffer user : register(b1) {
float param0;
//...
}
// pixel shader, with entry point "ps_main" and input layout.
floa4 ps_main(float4 pos : SV_POSITION, float4 col : COLOR0, float2 uv : TEXCOORD0) : SV_Target {
return 0.5;
}
renderState object for ImGui widgets.
Active(); -- forced lua VM not to delete the obj in current scope.
tex -- table of tex2D objects
ps -- shader object
config object for saving or loading presets.
Read(); -- read from config file.
Write(); -- write to config file.
GetFloat(string sec, string key); -- retreive float by section and key
GetInt(string sec, string key); -- retreive integer by section and key
GetString(string sec, string key); -- retreive string by section and key
GetBool(string sec, string key); -- retreive boolean by section and key
local str_val = ConfigObj.Section.Key; -- retreive string value by section and key
ConfigObj.Section.Key = str_val; -- assign string value to specified section and key
ConfigObj.Section = {}; -- assign table of key-value pair to section.
_PATH
full path to the runtime
_NAME
name of the runtime
_DIR
runtime directory
_VERSION
runtime version
SetOffsetFloat( string rel_addr, number val_float)
SetOffsetFloat( string rel_addr, table tbl_float)
SetFloat( string abs_addr, number val_float)
SetFloat( string abs_addr, table tbl_float)
SetOffsetBool( string rel_addr, bool val_bool)
SetOffsetBool( string rel_addr, table tbl_bool)
SetBool( string abs_addr, bool val_bool)
SetBool( string abs_addr, table tbl_bool)
SetOffsetInt( string rel_addr, int val_int)
SetOffsetInt( string rel_addr, table tbl_int)
SetInt( string abs_addr, int val_int)
SetInt( string abs_addr, table tbl_int)
SetOffsetAOB( string rel_addr, string val_aob)
SetOffsetAOB( string rel_addr, table tbl_aob)
SetAOB( string abs_addr, string val_aob)
SetAOB( string abs_addr, table tbl_aob)
SetOffsetPtr( string rel_addr, string val_ptr)
SetOffsetPtr( string rel_addr, table tbl_ptr)
SetPtr( string abs_addr, string val_ptr)
SetPtr( string abs_addr, table tbl_ptr)
Set value to runtime offset address.
- rel_addr
- String representation of the offset address that will be written by the function. ie: "0x02F6284C"
- abs_addr
- String representation of the absolute address that will be written by the function. ie: "0x02F6284C"
- val_float
- Number to write to the address.
- val_bool
- Boolean to write to the address.
- val_int
- Integer to write to the address.
- val_aob
- String representation of a byte to write to the address. ie: "0xC0"
- val_ptr
- String representation of a pointer(8 bytes) to write to the address. ie: "0x0015477AC"
- tbl_###
- Table array input of respective type.
number GetOffsetFloat( string rel_addr)
table GetOffsetFloat( string rel_addr, int len)
number GetFloat( string abs_addr)
table GetFloat( string abs_addr, int len)
bool GetOffsetBool( string rel_addr)
table GetOffsetBool( string rel_addr, int len)
bool GetBool( string abs_addr)
table GetBool( string abs_addr, int len)
int GetOffsetInt( string rel_addr)
table GetOffsetInt( string rel_addr, int len)
int GetInt( string abs_addr)
table GetInt( string abs_addr, int len)
string GetOffsetAOB( string rel_addr)
table GetOffsetAOB( string rel_addr, int len)
string GetAOB( string abs_addr)
table GetAOB( string abs_addr, int len)
string GetOffsetPtr( string rel_addr)
table GetOffsetPtr( string rel_addr, int len)
string GetPtr( string abs_addr)
table GetPtr( string abs_addr, int len)
Retreive value from runtime offset address.
- rel_addr
- String representation of the offset address that the function will retrieve its value from. ie: "0x02F6284C"
- abs_addr
- String representation of the absolute address that the function will retrieve its value from. ie: "0x02F6284C"
- len
- Number of elements to retrieve.