Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
287 commits
Select commit Hold shift + click to select a range
8c6f11e
add readability change to Hable tone mapping
EndlesslyFlowering Sep 29, 2023
a739a25
Polish LUTs a bit, simplify math and fix some issues with it (mostly …
Filoppi Sep 30, 2023
b5ddd42
WIP: Hable improvements
Filoppi Sep 30, 2023
3d12aef
Re-implement PR #4 from @clshortfuse
Filoppi Sep 30, 2023
703c7de
avoid using defines in funcs
Filoppi Sep 30, 2023
8420ceb
Add:
Filoppi Sep 30, 2023
26f9b6b
Move LUTs application to be after inverse tonemapping, this allows LU…
Filoppi Sep 30, 2023
d6cb484
Small tonemapper and LUT fixes (from ShortFuse)
Filoppi Sep 30, 2023
287f216
small cleanup + describe the pow(x, 2.2) for the toeLength parameter
EndlesslyFlowering Sep 30, 2023
0d3b403
add struct for hable parameters which are shared between tone mapping…
EndlesslyFlowering Sep 30, 2023
025b1c1
convert everything connected to shaders to use tab indentation and ad…
EndlesslyFlowering Sep 30, 2023
b156b7d
forgot to change something
EndlesslyFlowering Sep 30, 2023
ecd44e7
-Add support for "INVERT_TONEMAP_HIGHLIGHTS_ONLY" to ACES, so that mo…
Filoppi Oct 1, 2023
2fc0766
-Moved PostProcess changes to apply after inverse tonemap, just like …
Filoppi Oct 1, 2023
18a3dd7
added photo mode blocking
ersh1 Oct 2, 2023
e871228
moved to address library; updated the plugin to the newest template v…
ersh1 Oct 2, 2023
a3a9e47
add sigmoidal inspired contrast adjustment
EndlesslyFlowering Oct 1, 2023
24dda4d
add macro for comparing linearization of the LUTs with either sRGB or…
EndlesslyFlowering Oct 2, 2023
785f83d
refactored settings; sdr's swapchain is now RGB10A2
ersh1 Oct 2, 2023
a124fd9
Merge branch 'master' of https://github.com/EndlesslyFlowering/Starfi…
ersh1 Oct 2, 2023
a79c9d9
Add saturation formula
Filoppi Oct 2, 2023
5f69098
Remove useless "#if"
Filoppi Oct 2, 2023
adb5032
Add new gamma correction setting and unify all the defines around the…
Filoppi Oct 2, 2023
9bee85e
Add shader/pipeline root signatures for later use and modification
Nukem9 Oct 3, 2023
c7f80c2
Gamma correction fixes.
Filoppi Oct 3, 2023
1b45d9a
Fix RestorePostProcess() sometimes going crazy due to "postProcessCol…
Filoppi Oct 3, 2023
4682b38
rename CORRECT_LUT_GAMMA_CHANGES_TYPE to EMULATE_SDR_GAMMA_APPEARANCE…
EndlesslyFlowering Oct 3, 2023
1d7a7df
adjust sigmoidal inspired contrast adjustment to bias the contrastInt…
EndlesslyFlowering Oct 3, 2023
dead6b0
luts: use OKLCH for color boost
clshortfuse Oct 1, 2023
da019f8
luts: use OKLCH for color boost (#7)
Filoppi Oct 3, 2023
9d9f278
Polish
Filoppi Oct 3, 2023
ddbc0e2
fix float accuracy issues for sigmoidal inspired tone mapping
EndlesslyFlowering Oct 4, 2023
0de6cd9
fix indentation errors
EndlesslyFlowering Oct 4, 2023
e2df6cf
add better comments for the sigmoidal inspired contrast adjustment
EndlesslyFlowering Oct 4, 2023
d2d6cae
Clean up LUTs code and add a setting to make it linearize from gamma …
Filoppi Oct 4, 2023
d4914dd
Tonemapper stuff
Filoppi Oct 4, 2023
30d6775
Tonemappers and LUTs polish (done or removed all TODOs)
Filoppi Oct 5, 2023
1dfd688
Documentation on bink videos shader
Filoppi Oct 5, 2023
5cca2a7
Polish and add new user parameters
Filoppi Oct 5, 2023
f2f9cbb
Use root signatures dumped with a custom tool since dxa.exe ignores c…
Nukem9 Oct 5, 2023
d361850
- Rename main shader passes to use consistent file names
Nukem9 Oct 5, 2023
597a09f
- Connect root signatures to their respective shader entry points
Nukem9 Oct 5, 2023
d656949
Add placeholder for new constant buffer members
Nukem9 Oct 5, 2023
0e45573
Fix whitespace
Nukem9 Oct 5, 2023
d3478fa
Add plugin dll hooks to upload (root) constant buffer values to shaders
Nukem9 Oct 6, 2023
4b3aea3
Custom constant buffers (#9)
ersh1 Oct 6, 2023
b85822a
fixup CAS for HDR + a bunch of optimisation (performance is the same …
EndlesslyFlowering Oct 6, 2023
5e8691f
add handling SDR with gamma 2.2
EndlesslyFlowering Oct 6, 2023
c99667a
add ability to add custom compilation paramters to "compile_all_shade…
EndlesslyFlowering Oct 6, 2023
390f42c
added more settings; registered a settings overlay in reshade as a re…
ersh1 Oct 6, 2023
cc331f0
fix matrix in BinkMovie which was for BT.601 limited range. correct i…
EndlesslyFlowering Oct 7, 2023
97a52f8
forgot to change some stuff from float to half + small readability tweak
EndlesslyFlowering Oct 7, 2023
bee7e75
added missing displaymode to shader constants, moved settings below m…
ersh1 Oct 7, 2023
f84ce68
Merge branch 'master' of https://github.com/EndlesslyFlowering/Starfi…
ersh1 Oct 7, 2023
225fe6c
feat(filmgrain): add 2 new types
clshortfuse Oct 7, 2023
ff4b109
fixup CAS for HDR + a bunch of optimisation (performance is the same …
Filoppi Oct 7, 2023
0b7b6ce
Plug in new custom shader variables into shaders (almost all of them)
Filoppi Oct 7, 2023
66f3ef4
Polish user settings
Filoppi Oct 7, 2023
63189fa
Add HDR toggle support to UI shader
Filoppi Oct 7, 2023
e754cd9
Improve sharpening code
Filoppi Oct 7, 2023
101d252
Add BT.2020 toggle to CAS
Filoppi Oct 7, 2023
6af6111
add negative luminance handling
Filoppi Oct 7, 2023
c3bae1c
Fix build
Filoppi Oct 7, 2023
ff0beab
Fixed black screen with Hable
Filoppi Oct 7, 2023
77052ba
Add HDR/SDR runtime branches on all shaders
Filoppi Oct 7, 2023
691439c
fix the "just passthrough" mode for CAS and fix a compiler warning fo…
EndlesslyFlowering Oct 7, 2023
aa5571d
Remap user settings
Filoppi Oct 7, 2023
9998c57
Polish
Filoppi Oct 7, 2023
e899d5a
small cleanup for PostSharpen
EndlesslyFlowering Oct 7, 2023
bf69af6
Add minimum peak brightness and paper white checks to avoid the HDR D…
Filoppi Oct 7, 2023
d3e4d9f
fixup the error introduced by the last commit changes to PostSharpen
EndlesslyFlowering Oct 7, 2023
47a70a4
fix CAS issue and set it up for HDR
EndlesslyFlowering Oct 7, 2023
72f375d
fix(filmgrain): saturate(Y) on type2
clshortfuse Oct 7, 2023
2d845cf
feat(filmgrain): enable new midtone-baised film-grain
clshortfuse Oct 7, 2023
1f0ff2a
feat(filmgrain): enable new midtone-baised film-grain (#12)
Filoppi Oct 7, 2023
0532597
add fully described CAS input struct + add helper functions for input…
EndlesslyFlowering Oct 7, 2023
abe6929
commit unchanged CAS upscaling for git diff comparisons
EndlesslyFlowering Oct 7, 2023
c0d5e12
fixup CAS upscaling and optimise it a little (still needs to be hooke…
EndlesslyFlowering Oct 8, 2023
5c4cb1c
added CAS upscaling to cbuffer hook
ersh1 Oct 8, 2023
02cae2b
feat(filmgrain): use kodak-based midtones
clshortfuse Oct 8, 2023
f68dd8e
feat(filmgrain): use kodak-based midtones (#13)
Filoppi Oct 8, 2023
8df9cae
Polish hable black screen fix
Filoppi Oct 8, 2023
4f32360
Add a single define to force the SDR Vanilla look for quick screensho…
Filoppi Oct 8, 2023
320a8c3
Add PQ formulas
Filoppi Oct 8, 2023
4e04f8f
Add development on/off define and improve UI HDR blending
Filoppi Oct 8, 2023
c43df18
Polish:
Filoppi Oct 8, 2023
b7329f7
added PQ support (currently seems oversaturated, error in linear_to_PQ?)
ersh1 Oct 8, 2023
8770d60
Polish PostSharpen etcetc
Filoppi Oct 8, 2023
6cfef29
Add FilmGrainType setting and PostSharpening toggle
Filoppi Oct 8, 2023
dbd311f
Fix BT.2020
Filoppi Oct 8, 2023
41af4ea
Add latest release
Filoppi Oct 8, 2023
9ad635c
Fix up shaders variables being bool and risking mismatch due to padding
Filoppi Oct 8, 2023
1234476
improve ReadMe
Filoppi Oct 8, 2023
94d6a79
fix MS store setup
EndlesslyFlowering Oct 8, 2023
9c2375d
hooked up new settings, fixed up autopackage rules
ersh1 Oct 8, 2023
7259136
Merge branch 'master' of https://github.com/EndlesslyFlowering/Starfi…
ersh1 Oct 8, 2023
29aad6b
Comment on UI
Filoppi Oct 8, 2023
6d3a3f5
perf(luts): compute gain once
clshortfuse Oct 8, 2023
1920b20
fixed dev settings max values
ersh1 Oct 8, 2023
e80b6a8
Revert "perf(luts): compute gain once"
ersh1 Oct 9, 2023
5ae94a1
Added a setting that skips lut correction while in certain menus
ersh1 Oct 9, 2023
5d0aca2
substituted delta time with application runtime
ersh1 Oct 9, 2023
30d8f23
Polish:
Filoppi Oct 9, 2023
013605f
Discord link
Filoppi Oct 9, 2023
fbf0764
fixed color grading strength not being set to 1 with vanilla menu lut…
ersh1 Oct 10, 2023
5347c7a
Merge branch 'master' of https://github.com/EndlesslyFlowering/Starfi…
ersh1 Oct 10, 2023
0dbd421
feat(filmgrain): 24fps; film math
clshortfuse Oct 10, 2023
3baab1b
feat(filmgrain): 24fps; film math (#14)
Filoppi Oct 10, 2023
12a2f4b
1.7.36 support
ersh1 Oct 10, 2023
8ee65bb
update original shaders to 1.7.36.0
EndlesslyFlowering Oct 10, 2023
6b99362
Dev settings default
Filoppi Oct 10, 2023
a4c127d
Fix: make sure that gamma correction only applies to the 0-1 range, a…
Filoppi Oct 10, 2023
16b82cc
Make adaptive sharpening work in roughly the same range independently…
Filoppi Oct 10, 2023
22fcd6a
Rename variables
Filoppi Oct 10, 2023
d8cea10
Make ACES templatable
Filoppi Oct 10, 2023
8192e53
Add setting to draw the LUT on screen
Filoppi Oct 10, 2023
a25d898
Fix Hable colors below 0 would end up being being treated as highligh…
Filoppi Oct 10, 2023
beb20bd
Improve readme
Filoppi Oct 10, 2023
1de7159
Optimize inverse tonemapper by skipping it when not needed and by cac…
Filoppi Oct 10, 2023
4f89ddd
Add setting to store intermediary SDR images in linear space until ou…
Filoppi Oct 10, 2023
bcda968
Add gamma correction settings
Filoppi Oct 10, 2023
7b466d1
Exposed gamma adjustment settings to UI
Filoppi Oct 10, 2023
bd0b86c
Update ColorGradingMerge_cs.hlsl
Filoppi Oct 10, 2023
0faea55
Fix UI in SDR
Filoppi Oct 10, 2023
bd07f43
Polish (ColorGradingStrenght might also be used in the LUT mixing sha…
Filoppi Oct 10, 2023
cd1a405
Forgotten root signatures
Filoppi Oct 10, 2023
9d415a7
Compilation fix
Filoppi Oct 10, 2023
153b422
Fix build
Filoppi Oct 10, 2023
354fbd5
Fix
Filoppi Oct 10, 2023
f08519a
BinkMovie: remove unnecessary accuracy where it is not needed
EndlesslyFlowering Oct 10, 2023
a999219
CAS: remove clamps from texel loads (improves performance very slightly)
EndlesslyFlowering Oct 10, 2023
f9fd6da
Polish
Filoppi Oct 10, 2023
6ebd784
Fix UI gamma
Filoppi Oct 10, 2023
282d44f
HDRComposite: compile last permutation of the shader too for consistency
EndlesslyFlowering Oct 10, 2023
affd678
renamed the plugin to Luma
ersh1 Oct 10, 2023
632191a
Add AutoHDR pass on bink videos
Filoppi Oct 10, 2023
ad73052
Remove invalid colors from LUTs (probably useless)
Filoppi Oct 10, 2023
a6dc5ac
Fix highlights clipping
Filoppi Oct 10, 2023
fecf625
Fix up nans being generated by pow
Filoppi Oct 10, 2023
bc4ab92
Fix division by zero causing Nans that spread to other colors
Filoppi Oct 10, 2023
faaf8c3
Fix SDR film grain for WIP release
Filoppi Oct 11, 2023
12ba89b
Fix another NaN on post process contrast (pow)
Filoppi Oct 11, 2023
f466c36
update SFSE submodule
EndlesslyFlowering Oct 11, 2023
f3a1e4a
updated root signatures to use the macro
ersh1 Oct 11, 2023
c02a26a
feat(filmgrain): rewrite for linear
clshortfuse Oct 11, 2023
cf1235f
WIP: fix LUTs crushed blacks
Filoppi Oct 11, 2023
1dab6b3
fix(luts): always return black at (0,0,0)
clshortfuse Oct 11, 2023
dc29c15
- Fix UI slider option values disappearing
Nukem9 Oct 11, 2023
766a00c
UI slider fixes (#15)
ersh1 Oct 11, 2023
a3a2ccb
colour space additions:
EndlesslyFlowering Oct 11, 2023
d6a2b1f
Fix color being clipped by the secondary contrast power curve and dis…
Filoppi Oct 11, 2023
8e1dab5
Add LUTs extrapolation (WIP)
Filoppi Oct 12, 2023
c108b9c
More on LUT extrapolation
Filoppi Oct 12, 2023
8275e57
Minor polish
Filoppi Oct 12, 2023
7f1bf77
Add advanced settings of gamma handling for LUTs. Using the one that …
Filoppi Oct 12, 2023
a820c5a
Change gamma correction to be 50 by default (looks better) (WIP)
Filoppi Oct 12, 2023
fe50cb9
Tooltip
Filoppi Oct 12, 2023
ff071d6
Remove branch on color on LUTs normalization
Filoppi Oct 12, 2023
077ed0b
changed luminance settings to steppers, added unfinished hdr capabili…
ersh1 Oct 12, 2023
8347bea
uncommented technique id 0x800FF1A for root constants upload
ersh1 Oct 12, 2023
cf77eea
luts: debug/codereview/perf
clshortfuse Oct 12, 2023
e8ca802
fixed vcpkg/cmake issues, enabled hdr detection
ersh1 Oct 13, 2023
a037ceb
uploaded updated shader injector
ersh1 Oct 13, 2023
1fe3f9f
luts: debug/codereview/perf (#16)
clshortfuse Oct 13, 2023
b87e952
CAS: make the best use of the NormalizationFactor
EndlesslyFlowering Oct 13, 2023
64de6ca
Add hooks to swap ScaleformComposite render target blending with UAV …
Nukem9 Oct 14, 2023
0fa4fac
Update and refactor ScaleformComposite to use UAVs instead of PS rend…
Nukem9 Oct 14, 2023
5a98ce2
Test new way of doing UI alpha modulation to improve the blending in …
Filoppi Oct 14, 2023
ef04c6b
Rename SecondaryGamma to SecondaryBrightness and change the formula t…
Filoppi Oct 14, 2023
72dc001
Add a setting to force SDR tonemapping on scRGB HDR output, to easily…
Filoppi Oct 14, 2023
082bd67
Move the LUT debug color to define
Filoppi Oct 14, 2023
bddfb92
Add build distribution/release folder "Luma.exp" to ingored files (I …
Filoppi Oct 14, 2023
c805001
Add paper white multipler to SDR->HDR
Filoppi Oct 14, 2023
4246758
Finalize gamma correction logic, move it to LUTs directly
Filoppi Oct 14, 2023
16b648f
Improve which settings are enabled in each SDR/HDR mode
Filoppi Oct 14, 2023
8fd6f86
Fix build
Filoppi Oct 14, 2023
29d7c98
Fix SDR brightness slider and disable debug drawing
Filoppi Oct 14, 2023
851a8f5
Fixes for forced SDR mode
Filoppi Oct 14, 2023
694985d
Merge branch 'master' into scaleformcomposite-uav
ersh1 Oct 14, 2023
b56a144
Enable UAVs in ScaleformComposite for correct blending (#17)
ersh1 Oct 14, 2023
49b2ae5
fixed typo in merge
ersh1 Oct 14, 2023
e2c60c9
maybe fixed ui blending?
ersh1 Oct 14, 2023
932f620
Add LICENSE
EndlesslyFlowering Oct 14, 2023
3af0896
HDRComposite: optimize Tetrahedral interpolation
Nukem9 Oct 14, 2023
18e5633
Fix PaperWhite setting not updating when forcing SDR on HDR
Filoppi Oct 14, 2023
be1b723
added license exceptions
ersh1 Oct 14, 2023
dce242f
Implement proper HDR UI blending model to simulate the SDR gamma spac…
Filoppi Oct 15, 2023
120bd8e
Add negative scRGB colors support on reinhard
Filoppi Oct 15, 2023
b5bb7f2
Small optimization
Filoppi Oct 15, 2023
731c624
Fix up UI blends
Filoppi Oct 15, 2023
50664e3
Update readme
Filoppi Oct 15, 2023
d8ba839
Bump version
Filoppi Oct 15, 2023
988afed
Attempted fix for UI issues.
Filoppi Oct 15, 2023
8afbcbd
Enable replacing the R16G16B16A16F copy shader
Filoppi Oct 15, 2023
266e6c5
Fix up ReShade display mode setting not refreshing the swapchain
Filoppi Oct 15, 2023
ca1085a
Fix build
Filoppi Oct 15, 2023
1a5b726
Improve settings tooltips
Filoppi Oct 15, 2023
0db3561
Polish copy shader (for some reason the indentation was completely br…
Filoppi Oct 15, 2023
91cf90d
Improve refreshing SDR/HDR display support state (triggered when open…
Filoppi Oct 15, 2023
b5b2cbd
luts: add OKLab gradients
clshortfuse Oct 14, 2023
8eda33a
luts: add OKLab gradients (#18)
clshortfuse Oct 15, 2023
668e7a2
Polish LUT code (result is identical, only added comments around)
Filoppi Oct 15, 2023
fb5dfd3
Fix UI composition
Filoppi Oct 15, 2023
3b7bf5c
Final version of UI composition. This improve the detection of the ra…
Filoppi Oct 15, 2023
2e09695
Post merge fixup
Filoppi Oct 15, 2023
60d0a42
bump version
ersh1 Oct 15, 2023
9dbde87
Remove static const from non static non const variable
Filoppi Oct 15, 2023
d3f29b9
Hide ReShade sliders that don't apply to your current settings
Filoppi Oct 15, 2023
3e52f1b
Add missed return 0 to UI composition shader
Filoppi Oct 15, 2023
0f0d5a8
Fix build
Filoppi Oct 15, 2023
559ac16
Bump version
Filoppi Oct 15, 2023
2dc8cb0
Add ICtCp conversions. Minor polish.
Filoppi Oct 15, 2023
a7f5b08
Add function to extend gamut on bright saturated colors
Filoppi Oct 15, 2023
632213c
Fix build
Filoppi Oct 15, 2023
c007b4f
CAS: make the normalization factor a static const again because other…
EndlesslyFlowering Oct 15, 2023
01e0001
no abort
EndlesslyFlowering Oct 15, 2023
b873cdf
optimisation and simplification
EndlesslyFlowering Oct 15, 2023
fc1f5a9
HDRComposite: add tonemapping in ICtCp
EndlesslyFlowering Oct 16, 2023
8667137
debug: fix DRAW_LUT
clshortfuse Oct 16, 2023
46a1e4d
filmgrain: follow film stock shadows and midtones
clshortfuse Oct 16, 2023
b9eb1e8
simplification, optimisation and cleanup
EndlesslyFlowering Oct 16, 2023
e260a0d
HDRComposite: optimise the Hable Eval process
EndlesslyFlowering Oct 16, 2023
b958e61
fix all the indentation errors + optimisation in HDRComposite
EndlesslyFlowering Oct 16, 2023
7329628
HDRComposite: enable ICtCp HDR->HDR tone mapping by default
EndlesslyFlowering Oct 16, 2023
218d076
HDRComposite: optimization on HableEval
Nukem9 Oct 16, 2023
bff2ebb
a little bit more cleanup and optimisation
EndlesslyFlowering Oct 16, 2023
58a65c6
filmgrain: simplify and optimize
clshortfuse Oct 16, 2023
62fce43
Suggest film grain to 50% as suggested by ShortFuse
Filoppi Oct 16, 2023
11e1167
Replace hypot3 with premade "length" func
Filoppi Oct 16, 2023
b4f251a
Code polish:
Filoppi Oct 16, 2023
84964a6
Disable ICtCp DICE tonemapper until proven it's better
Filoppi Oct 16, 2023
f28d3dd
Re-enable ICtCp toneampper, looking good
Filoppi Oct 17, 2023
068830b
fix(filmgrain): sdr/hdr independent grain
clshortfuse Oct 17, 2023
2462275
HDRComposite: fix error in Dice tonemapping in ICtCp
EndlesslyFlowering Oct 17, 2023
2d0a0a4
Copy:
EndlesslyFlowering Oct 17, 2023
061f416
Add a couple tonenemapper settings, one to start the HDR tonemapping …
Filoppi Oct 17, 2023
d51839f
Fix up minor mistakes on copy shader
Filoppi Oct 17, 2023
bba38af
Added ExtendGamut setting in game
Filoppi Oct 17, 2023
573de34
HDRComposite: remove negative Luminance check as it causes black dots…
EndlesslyFlowering Oct 17, 2023
49a1d0b
remove all negative luminance checks as we clamp on output anyways
EndlesslyFlowering Oct 17, 2023
94597b6
Copy: enable AP0 clamp on scRGB output
EndlesslyFlowering Oct 17, 2023
39bc0c3
Filmgrain: fix blending issues caused by negative luminance
EndlesslyFlowering Oct 18, 2023
7ab8718
Fixed up LUT gradient scale (it was always multipled by the LUT size)
Filoppi Oct 17, 2023
29badee
Remove debug drawing of LUTs mixing with the neutral LUT as it was br…
Filoppi Oct 17, 2023
b998ce4
Wrap up gamma correction code
Filoppi Oct 18, 2023
f2e3762
Bump version to 0.3
Filoppi Oct 18, 2023
4677b73
Small comment
Filoppi Oct 18, 2023
ccb1c0b
Disable development settings for release (re-enable them locally pls)
Filoppi Oct 18, 2023
03edccb
feat(filmgrain): add FilmGrainCap option
clshortfuse Oct 18, 2023
e606b0f
Filmgrain: fix native filmgrain by making it work in approximate PQ s…
EndlesslyFlowering Oct 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
root = true
charset = utf-8
end_of_line = crlf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
[Bb]uild/
.vs/
.vscode/
*.zip
*.timestamp
deploy-*.ps1

shaders/target_folder.txt
tools/dxc_analysis_tools/dndxc.settings.xml

Plugin/dist/Data/*
Plugin/dist/ASI/*
Plugin/dist/SFSE/*
Plugin/dist/*.exp
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "extern/DKUtil"]
path = extern/DKUtil
url = https://github.com/gottyduke/DKUtil.git
[submodule "extern/SFSE"]
path = extern/SFSE
url = https://github.com/ianpatt/sfse.git
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions EXCEPTIONS
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This Program is intended to be used with and modify existing code (the "Modded Code") and to build a robust modding community with open source principles. The purpose of this exception is to address issues when an open source modding community interacts with potentially proprietary code. In addition, the modding community often uses libraries (the "Modding Libraries") under licenses that may be incompatible with the GPL ("Modding Library Licenses").

===

Modding Exception

In addition, as a special exception, the authors gives You the additional right to link the code of this Program with the existing code that this Program is intended to be used with or modify and to distribute linked combinations including the two, subject to the limitations in this paragraph. Modded Code permitted under this exception may link to the code of this Program without causing the Modded Code and portion of the combined work corresponding to the Modded Code to be covered by the GNU General Public License. You must obey the GNU General Public License in all respects for all of the Program code and other code used in conjunction with the Program except the Modded Code covered by this exception. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to provide this exception without modification, you must delete this exception statement from your version and license this file solely under the GPL without exception.

===

GPL-3.0 Linking Exception (with Corresponding Source)

Additional permission under GNU GPL version 3 section 7

If you modify this Program, or any covered work, by linking or combining it with Modding Libraries (or a modified version thereof), containing parts covered by the terms of Modding Library Licenses, the licensors of this Program grant you additional permission to convey the resulting work. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of Modding Libraries used as well as that of the covered work.
263 changes: 263 additions & 0 deletions Plugin/!update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
#Requires -Version 5

# args
param (
[Parameter(Mandatory)][ValidateSet('SOURCEGEN', 'DISTRIBUTE')][string]$Mode = 'SOURCEGEN',
[string]$Version,
[string]$Path,
[string]$Payload
)


$ErrorActionPreference = "Stop"

$Folder = $PSScriptRoot | Split-Path -Leaf
$SourceExt = @('.asm', '.c', '.cc', '.cpp', '.cxx', '.h', '.hpp', '.hxx', 'inc', '.inl', '.ixx')
$ConfigExt = @('.ini', '.json', '.toml', '.xml')
$DocsExt = @('.md')

function Normalize-Path {
param (
[string]$in
)

$out = $in -replace '\\', '/'
while ($out.Contains('//')) {
$out = $out -replace '//', '/'
}
return $out
}

function Resolve-Files {
param (
[Parameter(ValueFromPipeline)][string]$parent = $PSScriptRoot,
[string[]]$range = @('include', 'src', 'test')
)

process {
Push-Location $PSScriptRoot
$_generated = [System.Collections.ArrayList]::new()

try {
foreach ($directory in $range) {
if (!$env:RebuildInvoke) {
Write-Host "`t[$parent/$directory]"
}

Get-ChildItem "$parent/$directory" -Recurse -File -ErrorAction SilentlyContinue | Where-Object {
($_.Extension -in ($SourceExt + $DocsExt)) -and
($_.Name -notmatch 'Plugin.h|Version.h')
} | Resolve-Path -Relative | ForEach-Object {
if (!$env:RebuildInvoke) {
Write-Host "`t`t<$_>"
}
$_generated.Add("`n`t`"$(Normalize-Path $_.Substring(2))`"") | Out-Null
}
}

Get-ChildItem "$parent/dist" -Exclude "rules" | Get-ChildItem -File -Recurse -ErrorAction SilentlyContinue | Where-Object {
($_.Extension -in ($ConfigExt + $DocsExt)) -and
($_.Name -notmatch 'cmake|vcpkg')
} | Resolve-Path -Relative | ForEach-Object {
if (!$env:RebuildInvoke) {
Write-Host "`t`t<$_>"
}
$_generated.Add("`n`t`"$(Normalize-Path $_.Substring(2))`"") | Out-Null
}
}
finally {
Pop-Location
}

return $_generated
}
}


Write-Host "`n`t<$Folder> [$Mode]"


# @@SOURCEGEN
if ($Mode.ToUpper() -eq 'SOURCEGEN') {
Write-Host "`tGenerating CMake sourcelist..."
Remove-Item "$Path/sourcelist.cmake" -Force -Confirm:$false -ErrorAction Ignore

$generated = 'set(SOURCES'
$generated += $PSScriptRoot | Resolve-Files
if ($Path) {
$generated += $Path | Resolve-Files
}
$generated += "`n)"
[IO.File]::WriteAllText("$Path/sourcelist.cmake", $generated)
}

$RuleVarTbl = @{
config = 'debug';
cmake_output = Normalize-Path ($Path + '/');
dist = Normalize-Path "$PSScriptRoot/dist/";
project_name = $Payload;
project_version = $Version;
}
$RuleCmds = @()

function Resolve-RuleVar {
param (
[string]$Path
)

$Path = $Path.Trim(' ')
$any = [regex]::Matches($Path, '\{.*?\}').Value
$Resolved = $Path

# env:
foreach ($unset in $any) {
$inner = $unset.Trim('{', '}')
if ($inner.StartsWith('env:')) {
$Resolved = $Resolved -replace $unset, [System.Environment]::GetEnvironmentVariable($inner.TrimStart('env:'))
}
else {
$Resolved = if ($script:RuleVarTbl.Contains($inner)) {
$Resolved -replace $unset, $script:RuleVarTbl[$inner]
}
else {
$Resolved -replace $unset, $inner
}
}
}

return Normalize-Path $Resolved.Trim('{', '}')
}

function Resolve-Rules {
param (
[Object]$Deployee
)

switch ($Deployee.action) {
"base" {
$script:RuleVarTbl[($Deployee.params[0].Trim('{', '}'))] = Resolve-RuleVar $Deployee.params[1]
#"setting $($Deployee.params[0]) to $(Resolve-RuleVar $Deployee.params[1])"
break
}
"copy" {
$source = $(Resolve-RuleVar $Deployee.params[0])
$destination = $(Resolve-RuleVar $Deployee.params[1])
$dest_path = $destination.Substring(0, $destination.LastIndexOf('/') + 1)
$script:RuleCmds += "New-Item `'$dest_path`' -ItemType Directory -Force -ErrorAction:SilentlyContinue"
$script:RuleCmds += "Copy-Item `'$source`' `'$destination`' -Force -Recurse -ErrorAction:SilentlyContinue"
break
}
"copy_if" {
$source = $(Resolve-RuleVar $Deployee.params[0])
$destination = $(Resolve-RuleVar $Deployee.params[1])
$dest_path = $destination.Substring(0, $destination.LastIndexOf('/') + 1)
$script:RuleCmds += "if (Test-Path `'$source`') {"
$script:RuleCmds += "New-Item `'$dest_path`' -ItemType Directory -Force -ErrorAction:SilentlyContinue"
$script:RuleCmds += "Copy-Item `'$source`' `'$destination`' -Force -Recurse -ErrorAction:SilentlyContinue }"
break
}
"package" {
$source_tree = @()
foreach ($source in $Deployee.params[0..($Deployee.params.Length - 2)]) {
$source_tree += , "`'$(Resolve-RuleVar $source)`'"
}
$script:RuleCmds += "Compress-Archive -Path $($source_tree -join ',') -DestinationPath `'$(Resolve-RuleVar $Deployee.params[-1])`' -Force -ErrorAction:SilentlyContinue"
break
}
"remove" {
foreach ($to_remove in $Deployee.params) {
$script:RuleCmds += "Remove-Item `'$(Resolve-RuleVar $to_remove)`' -Force -Recurse -ErrorAction:SilentlyContinue"
}
break
}
"script" {
foreach ($raw_script in $Deployee.params) {
$script:RuleCmds += $raw_script
}
break
}
default {
break
}
}
}


# @@DISTRIBUTE
if ($Mode.ToUpper() -eq 'DISTRIBUTE') {
if ($Version.ToUpper() -eq '-1') {
# update script to every project
Get-ChildItem "$PSScriptRoot/$Path" -Directory -Recurse | Where-Object {
$_.Name -notin @('vcpkg', 'build', '.git', '.vs') -and
(Test-Path "$_/CMakeLists.txt" -PathType Leaf) -and
(Test-Path "$_/vcpkg.json" -PathType Leaf)
} | ForEach-Object {
Write-Host "`tUpdated <$_>"
Robocopy.exe "$PSScriptRoot" "$_" '!Update.ps1' /MT /NJS /NFL /NDL /NJH | Out-Null
}
exit
}

$Path = Normalize-Path $Path
$RuleVarTbl.config = $Path.Split('/')[-1].ToLower()

$rules = Get-ChildItem "$($RuleVarTbl.dist)/rules" -File *.json
$rule_timestamp = @( "!update : $((Get-Item $MyInvocation.MyCommand.Path).LastWriteTime.Ticks)" )

# generate timestamp & distribution step
foreach ($rule in $rules) {
$rule_timestamp += , "$($rule.BaseName) : $($rule.LastWriteTime.Ticks)"
}

$regenerate = $true
$timestamp = "$($RuleVarTbl.dist)/rules/$($RuleVarTbl.project_version).timestamp"
Write-Host "`tChecking deploy rules..."

if (Test-Path "$($RuleVarTbl.dist)/deploy.ps1") {
$rule_timestamp += , "deployer : $((Get-Item "$($RuleVarTbl.dist)/deploy.ps1").LastWriteTime.Ticks)"
}

if (Test-Path $timestamp) {
$old_timestamp = [IO.File]::ReadAllText($timestamp)

if ($old_timestamp -eq ($rule_timestamp | Out-String)) {
$regenerate = $false
Write-Host "`t...No changes"
}
else {
Write-Host "`t...Pending changes"
}
}

# parse all rules
if ($regenerate) {
Write-Host "`tRegenerating deploy rules..."

foreach ($rule in $rules) {
$deployer = [IO.File]::ReadAllText($rule.FullName) | ConvertFrom-Json

foreach ($deployee in $deployer) {
if (("config" -in $deployee.PSObject.Properties.Name) -and ($deployee.config -ne $RuleVarTbl.config)) {
continue
}
else {
Resolve-Rules $deployee
}
}
}

$RuleCmds | Out-File "$($RuleVarTbl.dist)/deploy-$($RuleVarTbl.config.ToLower()).ps1" utf8

$rule_timestamp[-1] = "deployer : $((Get-Item "$($RuleVarTbl.dist)/deploy-$($RuleVarTbl.config.ToLower()).ps1").LastWriteTime.Ticks)"
Remove-Item "$($RuleVarTbl.dist)/rules/*.timestamp" -Force -ErrorAction:SilentlyContinue | Out-Null
$rule_timestamp | Out-File $timestamp utf8

Write-Host "`t...Ok"
}

# deploy
Write-Host "`tExecuting deploy rules..."
& "$($RuleVarTbl.dist)/deploy-$($RuleVarTbl.config.ToLower()).ps1"

Write-Host "`t...Ok"
}
Loading