ShaderDump2Source/UpdateOverrideEngine(Updated 05/05/16)
ShaderDump2Source(Updated 08/04/14): (Update: Added the ability to 'strip' a ShaderSource of irrelevant Shaders, just 'drag-n-drop' the ShaderSource folder onto the @ShaderDump2Source.exe and it will check the ShaderOverride folder for which Shaders to keep and delete non-matching ones from the ShaderSource directory) [s][url]ShaderDump2Source[/url][/s] Name changed and updated how it works, I didn't like the fact that it was renaming/removing the actual 'dumped' Shaders and if DumpAll was still set to true you'd wind up with doubles. So now instead of renaming/removing the files in the Dumps folder, it copies them with the correct filename format to ShaderSource(ShaderOverride), if the Dumps folder doesn't exist it will still ask to work off of the current location ... so it works like this: If there's no Shader Dump(Dumps\*) = Renames\Removes dupes in current location, this works off of the .txt extension ... I was able to come up with a way that it only renames the files if they 'appear' to be valid CRCs. ie. they only contain only the characters 0-9,A-F and are 8 digits or less. If there's an AllShaders Dump(Dumps\AllShaders\*) = Creates Copies of the Shaders with fixed CRC in the ShaderSource\ folder. If there's a SingleShaders Dump(Dumps\SingleShaders\*) = Creates Copies of the Shaders with fixed CRC in both the ShaderSource\ & ShaderOverride\ folders. If there's both Dumps(AllShaders+SingleShaders) = Same as above, Creates Copies of the Shaders with fixed CRC in both the ShaderSource\ & ShaderOverride\ folders. When using it ON a Shader Dump it will only copy files to the ShaderSource&ShaderOverride folders if they don't already exist, so running it a 2nd+ time will only import newly found Shaders and will not overwrite and Shaders in the ShaderSource&ShaderOverride folders. So what is a ShaderSource, and more importantly why create one? A ShaderSource is just a copy of all of the original unedited dumped Shaders with corrected CRCs, if a game is fixed using these Shaders and it's updated there's a chance that the CRCs will change but the contents of the the Shaders will stay the same. If you have the Source for each of the fixed Shaders, you can use a script to match the contents of the Source Shader with it's new updated CRC and then inject the fix into it. It may even be possible to use this method on different versions of games, eg. Gog, Steam, Origin. ---------------------------------------------------------------------------------------------------- I was thinking about adding choices if both(Dumps\AS&SS) exist, to run either or both, and possibly to disable the import SingleShaders to ShaderOverride but decided against it for now for simplicity's sake. I feel like the way it works now will work best for modders that are using the default method of finding and dumping Shaders. If DumpAll isn't set then only the SingleShaders that were dumped and their Sources will be copied over to ShaderSource and ShaderOverride. Minor but I thought it was funny ... I found/fixed an issue with the icon, no matter what it will only display a 32x32 icon even though the icon was 128x128(98KB) so I resized it to 32x32(4KB) and dramatically decreased the file size ... the icon was larger than the compiled script. :) [quote=CleanCRCsEngine]Another utility I've been working on, it 'cleans' and 'fixes' Shader filenames in the Dumps folder, or in the current location if it can't find the Dumps folder. I did put a prompt for using it on the current location, so you're not renaming .txt files erroneously. eg making LOG.txt 00000LOG.txt CleanCRCsEngine: (updated 10/23/13) [url]*update incoming*[/url] So far, using the various dlls and methods, I've found Dumped Shaders in the following formats: CRC32_4B666D14_66.txt (Dumps\AllShaders\PixelShader\) CRC32_4B666D13_66.txt (Dumps\AllShaders\VertexShader\)(added just in case) PixelShader_13_CRC32_D1D4C93C.txt (Dumps\SingleShaders\PixelShader\) VertexShader_44_CRC32_FF607031.txt (Dumps\SingleShaders\VertexShader\) VertexShader_46_CRC32_ 8456B9C.txt (Dumps\SingleShaders\VertexShader\) I designed it to look for and handle those specific issues as well as adding the necessary leading zeros. (As many as necessary to reach 8 digits, the smallest CRC I've seen so far was only 6 digits) You can run this from either from the main directory that contains the Dumps folder and it will fix all Shaders names within the 4 main Dump directories only, eg AllShaders\PixelShader\New Folder\ (etc) will remain untouched, or you can run it from within a Shader folder and (as long as a Dumps folder doesn't exist) it will fix just the Shader names within that folder. CRC32_4B666D14_66.txt > 4B666D14.txt PixelShader_13_CRC32_D1D4C93C.txt > D1D4C93C.txt VertexShader_44_CRC32_FF607031.txt > FF607031.txt VertexShader_46_CRC32_ 8456B9C.txt > 08456B9C.txt (Handles Any/All missing zeros & Any/All spaces) I've also noticed multiple Shaders using the same CRC, I've implemented a comparison check using FC, if both Shaders have the same exact contents (all the ones I've tried it on so far have) it will delete the extra one and if NOT it won't rename it all. If anyone finds any Shader filenames this won't work on, or any other filename 'formats' I should be looking for, please let me know. Notes: some of the fixes are case sensitive, just like how the Shaders were dumped, (CRC32_,PixelShader_ and VertexShader_ will work BUT crc32_,pixelshader_, and vertexshader_ won't) and some aren't. (removing spaces and adding leading zeros) Updated(09/21/13): Added a few things and cleaned up a few other, using all variables now instead of 'temp' files. One of the things I added is when it's finished it displays a list of *.txt files in either the current working directory or all of the 4 main dumps directories and checks whether or not they're 8 digits. eg: DUMPS\SingleShaders\VertexShader\ 03BB0FC8.txt = OK 0643E05B.txt = OK D7F061A9.txt = OK NewTextDocument.txt = ERROR Press any key to continue . . . Updated (10/23/13): Fixed a bug where it could get stuck in a loop, streamlined the process using variables now it only renames, and runs FC if needed, the files once.[/quote]
ShaderDump2Source(Updated 08/04/14):
(Update: Added the ability to 'strip' a ShaderSource of irrelevant Shaders, just 'drag-n-drop' the ShaderSource folder onto the @ShaderDump2Source.exe and it will check the ShaderOverride folder for which Shaders to keep and delete non-matching ones from the ShaderSource directory)
[url]ShaderDump2Source[/url]

Name changed and updated how it works, I didn't like the fact that it was renaming/removing the actual 'dumped' Shaders and if DumpAll was still set to true you'd wind up with doubles. So now instead of renaming/removing the files in the Dumps folder, it copies them with the correct filename format to ShaderSource(ShaderOverride), if the Dumps folder doesn't exist it will still ask to work off of the current location ... so it works like this:

If there's no Shader Dump(Dumps\*) = Renames\Removes dupes in current location, this works off of the .txt extension ... I was able to come up with a way that it only renames the files if they 'appear' to be valid CRCs. ie. they only contain only the characters 0-9,A-F and are 8 digits or less.

If there's an AllShaders Dump(Dumps\AllShaders\*) = Creates Copies of the Shaders with fixed CRC in the ShaderSource\ folder.

If there's a SingleShaders Dump(Dumps\SingleShaders\*) = Creates Copies of the Shaders with fixed CRC in both the ShaderSource\ & ShaderOverride\ folders.

If there's both Dumps(AllShaders+SingleShaders) = Same as above, Creates Copies of the Shaders with fixed CRC in both the ShaderSource\ & ShaderOverride\ folders.

When using it ON a Shader Dump it will only copy files to the ShaderSource&ShaderOverride folders if they don't already exist, so running it a 2nd+ time will only import newly found Shaders and will not overwrite and Shaders in the ShaderSource&ShaderOverride folders.

So what is a ShaderSource, and more importantly why create one? A ShaderSource is just a copy of all of the original unedited dumped Shaders with corrected CRCs, if a game is fixed using these Shaders and it's updated there's a chance that the CRCs will change but the contents of the the Shaders will stay the same. If you have the Source for each of the fixed Shaders, you can use a script to match the contents of the Source Shader with it's new updated CRC and then inject the fix into it. It may even be possible to use this method on different versions of games, eg. Gog, Steam, Origin.

----------------------------------------------------------------------------------------------------

I was thinking about adding choices if both(Dumps\AS&SS) exist, to run either or both, and possibly to disable the import SingleShaders to ShaderOverride but decided against it for now for simplicity's sake. I feel like the way it works now will work best for modders that are using the default method of finding and dumping Shaders. If DumpAll isn't set then only the SingleShaders that were dumped and their Sources will be copied over to ShaderSource and ShaderOverride.

Minor but I thought it was funny ... I found/fixed an issue with the icon, no matter what it will only display a 32x32 icon even though the icon was 128x128(98KB) so I resized it to 32x32(4KB) and dramatically decreased the file size ... the icon was larger than the compiled script. :)

CleanCRCsEngine said:Another utility I've been working on, it 'cleans' and 'fixes' Shader filenames in the Dumps folder, or in the current location if it can't find the Dumps folder. I did put a prompt for using it on the current location, so you're not renaming .txt files erroneously. eg making LOG.txt 00000LOG.txt

CleanCRCsEngine: (updated 10/23/13)
[url]*update incoming*[/url]

So far, using the various dlls and methods, I've found Dumped Shaders in the following formats:

CRC32_4B666D14_66.txt (Dumps\AllShaders\PixelShader\)

CRC32_4B666D13_66.txt (Dumps\AllShaders\VertexShader\)(added just in case)

PixelShader_13_CRC32_D1D4C93C.txt (Dumps\SingleShaders\PixelShader\)

VertexShader_44_CRC32_FF607031.txt (Dumps\SingleShaders\VertexShader\)

VertexShader_46_CRC32_ 8456B9C.txt (Dumps\SingleShaders\VertexShader\)

I designed it to look for and handle those specific issues as well as adding the necessary leading zeros. (As many as necessary to reach 8 digits, the smallest CRC I've seen so far was only 6 digits)

You can run this from either from the main directory that contains the Dumps folder and it will fix all Shaders names within the 4 main Dump directories only, eg AllShaders\PixelShader\New Folder\ (etc) will remain untouched, or you can run it from within a Shader folder and (as long as a Dumps folder doesn't exist) it will fix just the Shader names within that folder.

CRC32_4B666D14_66.txt > 4B666D14.txt

PixelShader_13_CRC32_D1D4C93C.txt > D1D4C93C.txt

VertexShader_44_CRC32_FF607031.txt > FF607031.txt

VertexShader_46_CRC32_ 8456B9C.txt > 08456B9C.txt (Handles Any/All missing zeros & Any/All spaces)

I've also noticed multiple Shaders using the same CRC, I've implemented a comparison check using FC, if both Shaders have the same exact contents (all the ones I've tried it on so far have) it will delete the extra one and if NOT it won't rename it all.

If anyone finds any Shader filenames this won't work on, or any other filename 'formats' I should be looking for, please let me know.

Notes:
some of the fixes are case sensitive, just like how the Shaders were dumped, (CRC32_,PixelShader_ and VertexShader_ will work BUT crc32_,pixelshader_, and vertexshader_ won't) and some aren't. (removing spaces and adding leading zeros)

Updated(09/21/13):
Added a few things and cleaned up a few other, using all variables now instead of 'temp' files. One of the things I added is when it's finished it displays a list of *.txt files in either the current working directory or all of the 4 main dumps directories and checks whether or not they're 8 digits. eg:

DUMPS\SingleShaders\VertexShader\

03BB0FC8.txt = OK
0643E05B.txt = OK
D7F061A9.txt = OK
NewTextDocument.txt = ERROR

Press any key to continue . . .

Updated (10/23/13):
Fixed a bug where it could get stuck in a loop, streamlined the process using variables now it only renames, and runs FC if needed, the files once.
#1
Posted 09/19/2013 12:46 PM   
I haven't tried to fix any games but thanks for your efforts :-)
I haven't tried to fix any games but thanks for your efforts :-)

GTX 1070 SLI, I7-6700k ~ 4.4Ghz, 3x BenQ XL2420T, BenQ TK800, LG 55EG960V (3D OLED), Samsung 850 EVO SSD, Crucial M4 SSD, 3D vision kit, Xpand x104 glasses, Corsair HX1000i, Win 10 pro 64/Win 7 64https://www.3dmark.com/fs/9529310

#2
Posted 09/21/2013 05:43 PM   
Thanks, but yeah this won't fix any games it just formats the filenames to the usable format for direct use in the ShaderOverride folder, quickly and easily. I made it specifically for use with my BinarySearchEngine and the latest(and some older) Debug(s) but hey I'm sure someone somewhere doesn't like renaming things and might find it handy. :) I've only messed with a few games myself but even then it's only been hunting for/disabling Shaders, I haven't learned enough to understand the code inside them, I don't know if I ever will ... so far I've been spending way more time on utilities. :)
Thanks, but yeah this won't fix any games it just formats the filenames to the usable format for direct use in the ShaderOverride folder, quickly and easily. I made it specifically for use with my BinarySearchEngine and the latest(and some older) Debug(s) but hey I'm sure someone somewhere doesn't like renaming things and might find it handy. :)

I've only messed with a few games myself but even then it's only been hunting for/disabling Shaders, I haven't learned enough to understand the code inside them, I don't know if I ever will ... so far I've been spending way more time on utilities. :)
#3
Posted 09/21/2013 07:20 PM   
Sounds like a good fix. Is this something you can add directly to the binarysearch utility so that it sets things up in a canonical order for its use? It seems like the end format in the override folder is the same, it's just that the dump comes out funny. Pretty sure this is unrelated, but figured I'd bring it to your attention in case it matters. You can have multiple shaders in the override folder that have the same CRC, but with different code, by appending .1, .2, etc. to the file. So 03BB0FC8.txt.1, 03BB0FC8.txt.2 as an example. Not at all sure that's still working in more recent DLLs. [url]http://helixmod.blogspot.com/2012/03/dlls-update.html[/url]
Sounds like a good fix. Is this something you can add directly to the binarysearch utility so that it sets things up in a canonical order for its use? It seems like the end format in the override folder is the same, it's just that the dump comes out funny.


Pretty sure this is unrelated, but figured I'd bring it to your attention in case it matters. You can have multiple shaders in the override folder that have the same CRC, but with different code, by appending .1, .2, etc. to the file. So 03BB0FC8.txt.1, 03BB0FC8.txt.2 as an example. Not at all sure that's still working in more recent DLLs.

http://helixmod.blogspot.com/2012/03/dlls-update.html

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

#4
Posted 09/22/2013 12:37 AM   
At the moment I have a few more utilities I'm working on as well, my plan is to put them all together and with the stuff I've learned and come up with myself from working on this one I plan on revamping the BSE as well but yes I planned to have it check for the issues and then clean/fix if necessary before using any of the search engines. Thanks for mentioning that, I had read about it when I was researching things for this but I haven't found a Debug/Game combo yet that produces different Shaders, ie the contents have always matched so far. That's why I was using FC to check the contents if there's an error when renaming for now it just doesn't do anything if they're different but I could try to come up with something that works with everything else. For now all the stuff I've been working on ignores anything other than .txt files. eg .txt.tmp, .txt.1, etc will be ignored. If anyone knows of any Debug/Game combos that produce different Shader contents with the same CRC please don't hesitate to share, I know I can just make them up for testing purposes but I am curious as to which Debug/Game combos do produce them. edit: One of the latest ones I have working will check an 'override's' CRCs (via an 'original dump's' Shader contents) against a 'new dump' and find the matches in the new dump ... could be useful if the only thing that changed in a game's update were the CRCs and not the actual content of the Shaders. From there I can have it rename the override CRCs (the contents stay the same ... fixed) with the new matching CRCs and the 'new' dump now becomes the new original dump ... in theory as long as the base contents never change this process could be done over and over again. :)
At the moment I have a few more utilities I'm working on as well, my plan is to put them all together and with the stuff I've learned and come up with myself from working on this one I plan on revamping the BSE as well but yes I planned to have it check for the issues and then clean/fix if necessary before using any of the search engines.

Thanks for mentioning that, I had read about it when I was researching things for this but I haven't found a Debug/Game combo yet that produces different Shaders, ie the contents have always matched so far. That's why I was using FC to check the contents if there's an error when renaming for now it just doesn't do anything if they're different but I could try to come up with something that works with everything else. For now all the stuff I've been working on ignores anything other than .txt files. eg .txt.tmp, .txt.1, etc will be ignored.

If anyone knows of any Debug/Game combos that produce different Shader contents with the same CRC please don't hesitate to share, I know I can just make them up for testing purposes but I am curious as to which Debug/Game combos do produce them.

edit: One of the latest ones I have working will check an 'override's' CRCs (via an 'original dump's' Shader contents) against a 'new dump' and find the matches in the new dump ... could be useful if the only thing that changed in a game's update were the CRCs and not the actual content of the Shaders. From there I can have it rename the override CRCs (the contents stay the same ... fixed) with the new matching CRCs and the 'new' dump now becomes the new original dump ... in theory as long as the base contents never change this process could be done over and over again. :)
#5
Posted 09/22/2013 02:10 PM   
Only one I know of that does the .2 type fix is X3: [url]http://helixmod.blogspot.com/2012/03/x3-terran-conflict-and-albion-prelude.html[/url] (Conveniently in Humble Bundle for 2 more days...)
Only one I know of that does the .2 type fix is X3:

http://helixmod.blogspot.com/2012/03/x3-terran-conflict-and-albion-prelude.html

(Conveniently in Humble Bundle for 2 more days...)

Acer H5360 (1280x720@120Hz) - ASUS VG248QE with GSync mod - 3D Vision 1&2 - Driver 372.54
GTX 970 - i5-4670K@4.2GHz - 12GB RAM - Win7x64+evilKB2670838 - 4 Disk X25 RAID
SAGER NP9870-S - GTX 980 - i7-6700K - Win10 Pro 1607
Latest 3Dmigoto Release
Bo3b's School for ShaderHackers

#6
Posted 09/23/2013 12:04 PM   
Any idea if that fix will work on X3:Reunion as well? For $1 I guess I could give it a try ... for $6 I'm not too sure if I'd even be into the game.
Any idea if that fix will work on X3:Reunion as well? For $1 I guess I could give it a try ... for $6 I'm not too sure if I'd even be into the game.
#7
Posted 09/23/2013 02:02 PM   
[s]I'll most likely compile it tomorrow, another utility I've been working on. If a game is updated and the CRCs/Shaders change this will run a comparison against a ShaderOverride,ShaderSource, and a ShaderDump if the code is unchanged it will update the fixed Shaders in the ShaderOverride with the updated CRCs. If there's no match it will rename it with the prefix _NotFound_ and if there's no Source Shader it will rename it with the prefix _NoSource_ ...[/s] Updated below ...
I'll most likely compile it tomorrow, another utility I've been working on. If a game is updated and the CRCs/Shaders change this will run a comparison against a ShaderOverride,ShaderSource, and a ShaderDump if the code is unchanged it will update the fixed Shaders in the ShaderOverride with the updated CRCs. If there's no match it will rename it with the prefix _NotFound_ and if there's no Source Shader it will rename it with the prefix _NoSource_ ... Updated below ...
#8
Posted 07/28/2014 04:30 AM   
That sounds very useful!
That sounds very useful!

#9
Posted 07/28/2014 05:57 AM   
[quote="TsaebehT"]I'll most likely compile it tomorrow, another utility I've been working on. If a game is updated and the CRCs/Shaders change this will run a comparison against a ShaderOverride,ShaderSource, and a ShaderDump if the code is unchanged it will update the fixed Shaders in the ShaderOverride with the updated CRCs. If there's no match it will rename it with the prefix _NotFound_ and if there's no Source Shader it will rename it with the prefix _NoSource_ ... [code]@Echo Off Title UpdateOverrideEngine ::(c)2014 TsaebehT - Please Do Not Copy, Modify and or Distribute Without Permission - SetLocal EnableDelayedExpansion Call :UpdateCRCs Pixel Vertex&&Pause&&Goto :Eof :UpdateCRCs if "%1" == "" Goto :Eof Set "$haderDump=Dumps\AllShaders\%1Shader\" Set "$haderOverride=ShaderOverride\%1Shaders\" Set "$haderSource=ShaderSource\%1Shaders\" for /F %%? in ('Dir /B !$haderOverride!*.txt') do ( Set "$CRC=%%~n?" for /F "tokens=* delims=0" %%? in ("!$CRC!") do (Set "$fCRC=%%?") if Not Exist !$haderSource!%%? Set "$fCRC=NoSource" if "!$fCRC!" NEQ "NoSource" ( if Exist !$haderDump!*!$fCRC!*.txt ( for /F %%@ in ('Dir /B !$haderDump!*!$fCRC!*.txt') do ( FC /LB1 "%%~dp?!$haderSource!%%?" "%%~dp@!$haderDump!%%@" if !Errorlevel! == 0 (Set "$fCRC=%%~n@") else (Set "$fCRC=NotFound") )) if "!$fCRC!" == "NotFound" ( for /F %%@ in ('Dir /B !$haderDump!*.txt') do ( FC /LB1 "%%~dp?!$haderSource!%%?" "%%~dp@!$haderDump!%%@" if !Errorlevel! == 0 Set "$fCRC=%%~n@" ))) if "!$fCRC!" NEQ "NoSource" ( if "!$fCRC!" NEQ "NotFound" ( for /F "tokens=1,2 delims=_ " %%? in ("!$fCRC!") do ( if /i "%%?" == "CRC32" ( Set "$fCRC=%%@" ) else ( Set "$fCRC=%%?" )) Call :zLoop ) if "!$CRC!" NEQ "!$fCRC!" Ren "!$haderOverride!!$CRC!.txt" "!$fCRC!.txt" ) if "!$fCRC!" == "NotFound" Ren "!$haderOverride!!$CRC!.txt" "_!$fCRC!_!$CRC!.txt" if "!$fCRC!" == "NoSource" Ren "!$haderOverride!!$CRC!.txt" "_!$fCRC!_!$CRC!.txt" ) Shift Goto :UpdateCRCs :zLoop Set "$zCRC=!$fCRC:~7,1!" if "!$zCRC!" == "" Set "$fCRC=0!$fCRC!"&&Goto :zLoop Goto :Eof[/code] [/quote] Nice work, but unless I am misunderstanding something, I think that you will also need to replace any CRCs listed in the DX9Settings.ini file, for example vertex shaders for which textures are being separated, or VS/PS that are re-using matrices or constants etc. I have to do this for my Divinity Dragon Commander and Divinity Original Sin fixes (and another game I can't remember now).
TsaebehT said:I'll most likely compile it tomorrow, another utility I've been working on. If a game is updated and the CRCs/Shaders change this will run a comparison against a ShaderOverride,ShaderSource, and a ShaderDump if the code is unchanged it will update the fixed Shaders in the ShaderOverride with the updated CRCs. If there's no match it will rename it with the prefix _NotFound_ and if there's no Source Shader it will rename it with the prefix _NoSource_ ...

@Echo Off
Title UpdateOverrideEngine
::(c)2014 TsaebehT - Please Do Not Copy, Modify and or Distribute Without Permission -
SetLocal EnableDelayedExpansion
Call :UpdateCRCs Pixel Vertex&&Pause&&Goto :Eof
:UpdateCRCs
if "%1" == "" Goto :Eof
Set "$haderDump=Dumps\AllShaders\%1Shader\"
Set "$haderOverride=ShaderOverride\%1Shaders\"
Set "$haderSource=ShaderSource\%1Shaders\"
for /F %%? in ('Dir /B !$haderOverride!*.txt') do (
Set "$CRC=%%~n?"
for /F "tokens=* delims=0" %%? in ("!$CRC!") do (Set "$fCRC=%%?")
if Not Exist !$haderSource!%%? Set "$fCRC=NoSource"
if "!$fCRC!" NEQ "NoSource" (
if Exist !$haderDump!*!$fCRC!*.txt (
for /F %%@ in ('Dir /B !$haderDump!*!$fCRC!*.txt') do (
FC /LB1 "%%~dp?!$haderSource!%%?" "%%~dp@!$haderDump!%%@"
if !Errorlevel! == 0 (Set "$fCRC=%%~n@") else (Set "$fCRC=NotFound")
))
if "!$fCRC!" == "NotFound" (
for /F %%@ in ('Dir /B !$haderDump!*.txt') do (
FC /LB1 "%%~dp?!$haderSource!%%?" "%%~dp@!$haderDump!%%@"
if !Errorlevel! == 0 Set "$fCRC=%%~n@"
)))
if "!$fCRC!" NEQ "NoSource" (
if "!$fCRC!" NEQ "NotFound" (
for /F "tokens=1,2 delims=_ " %%? in ("!$fCRC!") do (
if /i "%%?" == "CRC32" (
Set "$fCRC=%%@"
) else (
Set "$fCRC=%%?"
))
Call :zLoop
)
if "!$CRC!" NEQ "!$fCRC!" Ren "!$haderOverride!!$CRC!.txt" "!$fCRC!.txt"
)
if "!$fCRC!" == "NotFound" Ren "!$haderOverride!!$CRC!.txt" "_!$fCRC!_!$CRC!.txt"
if "!$fCRC!" == "NoSource" Ren "!$haderOverride!!$CRC!.txt" "_!$fCRC!_!$CRC!.txt"
)
Shift
Goto :UpdateCRCs
:zLoop
Set "$zCRC=!$fCRC:~7,1!"
if "!$zCRC!" == "" Set "$fCRC=0!$fCRC!"&&Goto :zLoop
Goto :Eof


Nice work, but unless I am misunderstanding something, I think that you will also need to replace any CRCs listed in the DX9Settings.ini file, for example vertex shaders for which textures are being separated, or VS/PS that are re-using matrices or constants etc. I have to do this for my Divinity Dragon Commander and Divinity Original Sin fixes (and another game I can't remember now).

Rig: Intel i7-8700K @4.7GHz, 16Gb Ram, SSD, GTX 1080Ti, Win10x64, Asus VG278

#10
Posted 07/28/2014 10:08 PM   
Thanks for the feedback ... yeah I kind of overlooked that when I was working on it this time. Oops. :) It's funny as soon as I was done with it I was already working on a faster version, I wasn't happy with how long it took and started thinking of ways that might make it faster. I still have to test if this new method will work on various dll dumps, and I'm still working on the 'ini' part of it but I didn't want to leave you hanging as far as a response goes. So far, it's coming along nicely ... if the new method works it'll be [u]much[/u] [u]much[/u] faster, the whole script took almost 3min(if I 'scramble' the CRCs/worst case scenario) to complete on the fairly small dump/fix I was testing it on before(31fixed/450Dumped/no ini CRCs). The file comparison part(what takes the longest) of the new one only takes 3secs on it ... really hoping this will work across multiple dll dumps. :) I plan on adding the ini part(Thanks again for mentioning it), maybe losing the renaming of missing shaders in favor of a log, and/or both? Either way it's taking a total rewrite. edit: it's fully functional(updating both the CRCs & the INI), just have to make a few tweaks here and there.
Thanks for the feedback ... yeah I kind of overlooked that when I was working on it this time. Oops. :) It's funny as soon as I was done with it I was already working on a faster version, I wasn't happy with how long it took and started thinking of ways that might make it faster. I still have to test if this new method will work on various dll dumps, and I'm still working on the 'ini' part of it but I didn't want to leave you hanging as far as a response goes.

So far, it's coming along nicely ... if the new method works it'll be much much faster, the whole script took almost 3min(if I 'scramble' the CRCs/worst case scenario) to complete on the fairly small dump/fix I was testing it on before(31fixed/450Dumped/no ini CRCs). The file comparison part(what takes the longest) of the new one only takes 3secs on it ... really hoping this will work across multiple dll dumps. :)

I plan on adding the ini part(Thanks again for mentioning it), maybe losing the renaming of missing shaders in favor of a log, and/or both? Either way it's taking a total rewrite.

edit: it's fully functional(updating both the CRCs & the INI), just have to make a few tweaks here and there.
#11
Posted 07/30/2014 01:01 PM   
Well the good news is I got this up and running with INI support*, [s]the bad news is I broke ShaderDump2Source[/s](fixed&ReUp'd) ... forgot to add the missing 's's to the 'source' ... Ooops. :) I wanted to name it UpdateOverrideEngine but apparently anything with 'Update' in the name or description Windows makes you run as admin, even if it's unnecessary it'll cause a UAC prompt ... so 'Updat3Overrid3Engin3' it is. [s][url]Updat3Overrid3Engin3[/url][/s] Like before it works off of Dumps/ShaderOverride/ShaderSource, gets CRC from the Override, the Shader code from the Source and get new CRCs from the Dumped Shaders(Dumps\AllShaders\*) and then applies the updated CRCs to the Override and the DX9Settings.ini*. I haven't done a lot of testing with it, so it couldn't hurt to make 'backups' of the ShaderOverride/DX9Settings.ini before using it ... the 'ini' part of it as far I could tell didn't like : and ! but seemed ok with other characters. It also creates a simple log like so: [quote]PS66572E6B 38572E6B VS66014D3F NoNewCRC <--- CRCs were the same VS66047E2B 46047E2B VS6604C551 1704C551 VS660688B4 FE0688B4 VS6611ABBB 8811ABBB VS6612230D 7512230D VS661D2191 EB1D2191 VS662263A1 0D2263A1 VS6624D213 3724D213 VS6624E8B1 1924E8B1 VS66284339 8E284339 VS662DE210 892DE210 VS663D548B E13D548B VS664EFC8E FE4EFC8E VS66563FB1 5C563FB1 VS665759A9 155759A9 VS666D9A46 B36D9A46 VS66814049 86814049 VS66892028 E8892028 VS66A23F88 B4A23F88 VS66A3FBCB NoSource <--- Couldn't find a Source VS66A95BE4 08A95BE4 VS66ACA82F AEACA82F VS66AE5E98 9BAE5E98 VS66CD2F9B 7FCD2F9B VS66CE8C32 65CE8C32 VS66CF89AE 2CCF89AE VS66E24854 7AE24854 VS66E3B255 4FE3B255[/quote]... technically the 'NoSource' Shader was updated, I didn't have Source Shaders for the Override and this was just a test run, it would have been 'NotFound' because the Shader code was changed in the update but it still would have been 'flagged' as what broke the Override at least. *if Texture CRCs are used and are changed they'll have to be updated manually.
Well the good news is I got this up and running with INI support*, the bad news is I broke ShaderDump2Source(fixed&ReUp'd) ... forgot to add the missing 's's to the 'source' ... Ooops. :)

I wanted to name it UpdateOverrideEngine but apparently anything with 'Update' in the name or description Windows makes you run as admin, even if it's unnecessary it'll cause a UAC prompt ... so 'Updat3Overrid3Engin3' it is.

[url]Updat3Overrid3Engin3[/url]

Like before it works off of Dumps/ShaderOverride/ShaderSource, gets CRC from the Override, the Shader code from the Source and get new CRCs from the Dumped Shaders(Dumps\AllShaders\*) and then applies the updated CRCs to the Override and the DX9Settings.ini*.

I haven't done a lot of testing with it, so it couldn't hurt to make 'backups' of the ShaderOverride/DX9Settings.ini before using it ... the 'ini' part of it as far I could tell didn't like : and ! but seemed ok with other characters.

It also creates a simple log like so:

PS66572E6B 38572E6B
VS66014D3F NoNewCRC <--- CRCs were the same
VS66047E2B 46047E2B
VS6604C551 1704C551
VS660688B4 FE0688B4
VS6611ABBB 8811ABBB
VS6612230D 7512230D
VS661D2191 EB1D2191
VS662263A1 0D2263A1
VS6624D213 3724D213
VS6624E8B1 1924E8B1
VS66284339 8E284339
VS662DE210 892DE210
VS663D548B E13D548B
VS664EFC8E FE4EFC8E
VS66563FB1 5C563FB1
VS665759A9 155759A9
VS666D9A46 B36D9A46
VS66814049 86814049
VS66892028 E8892028
VS66A23F88 B4A23F88
VS66A3FBCB NoSource <--- Couldn't find a Source
VS66A95BE4 08A95BE4
VS66ACA82F AEACA82F
VS66AE5E98 9BAE5E98
VS66CD2F9B 7FCD2F9B
VS66CE8C32 65CE8C32
VS66CF89AE 2CCF89AE
VS66E24854 7AE24854
VS66E3B255 4FE3B255
... technically the 'NoSource' Shader was updated, I didn't have Source Shaders for the Override and this was just a test run, it would have been 'NotFound' because the Shader code was changed in the update but it still would have been 'flagged' as what broke the Override at least.

*if Texture CRCs are used and are changed they'll have to be updated manually.
#12
Posted 08/01/2014 11:24 PM   
I'm not sure if anyone uses these or not but I thought I'd share the newest versions just in case anyone's interested in them... I've been mostly writing scripts in AHK lately but I thought I'd revisit my update override(for finding and updating changed/differnet CRCs) script when I picked up Darksiders Definitive Edition to see if it could've pulled off finding the different CRCs when installing to different locations. I was using FC to do file comparison's which worked on finding updated CRCs as long as the contents were the same, unfortunately the path lines(#line ## location) would be different so I came up with my own way to compare the files ignoring the #lines... and then I pretty much rewrote the entire thing. Since the updating script relies on a Shader Dump, Source and Override... I revisited ShaderDump2Source and basically ending up rewriting that as well. It's much faster than before, a Dump of roughly 2000 Shaders takes about 1min 24sec on my laptop with the old version. The latest version takes only 12secs, so I'm happy with that... it's not as 'verbose' as the previous version but outputting all those messages actually slows it down quite a bit, takes roughly 4x as much time. I'll have to take some time and update the OP but the basics are still the same, except they're bat files and not EXEs this time around... _sd2s_lite.bat(ShaderDump2Source):Run it from the dll/Dumps(DumpAll=True) location and it'll create a ShaderSource from the AllShaders Dump, as well as Import any SingleShaders into the ShaderOverride. If you Run it again it will only Import Shaders that aren't present in the ShaderSource/Override and if you drag and drop the ShaderSource folder onto the script(_sd2s.bat) it will Remove any Shaders from the ShaderSource that aren't present in the ShaderOverride. _sd2s_lite.bat [code]@Echo Off Title ShaderDump2Source :: ©2016 TsaebehT - For Intended Use Only. Please Do Not Copy in Part, Modify and/or Distribute Without Permission. SetLocal EnableDelayedExpansion pushd "%~dp0" if /i "%~n1" == "ShaderSource" ( for /F %%? in ('forfiles /P %1 /C "Cmd /C Echo @isdir"') do ( if /i "%%?" == "True" ( Echo Removing Irrelevant Shaders/Folders from ShaderSource: Timeout /T 3 for %%? in (Pixel;Vertex) do ( for /F %%@ in ('Dir /B ShaderSource\%%?Shaders\*.txt') do ( if Not Exist "ShaderOverride\%%?Shaders\%%@" ( Echo VS%%@&Del "ShaderSource\%%?Shaders\%%@" )) RD /Q "ShaderSource\%%?Shaders" "ShaderSource\"2>Nul ) Goto:nExit ))) for %%? in (Pixel;Vertex) do ( for %%@ in (AllShaders;SingleShaders) do ( if "%%@" == "AllShaders" ( for /F "delims=" %%A in ('Dir /B Dumps\%%@\%%?Shader\*.txt') do ( if Not Exist "ShaderSource\%%?Shaders\" MD "ShaderSource\%%?Shaders\" for /F "tokens=1-4 delims=_. " %%i in ("%%A") do ( if /i "%%l" == "txt" (Set "tCRC=00000000%%j") else (if /i "%%j" == "txt" (Set "tCRC=00000000%%i") else (Set "tCRC="&Echo ERROR: %%? "%%A"&Pause)) if "!tCRC!" NEQ "" ( Set "tCRC=!tCRC:~-8!" if Not Exist "ShaderSource\%%?Shaders\!tCRC!.txt" Copy "Dumps\%%@\%%?Shader\%%A" "ShaderSource\%%?Shaders\!tCRC!.txt">Nul ))) ) else ( for /F "delims=" %%A in ('Dir /B Dumps\%%@\%%?Shader\*.txt') do ( if Not Exist "ShaderOverride\%%?Shaders\" MD "ShaderOverride\%%?Shaders\" for /F "tokens=4,5 delims=_. " %%i in ("%%A") do ( if /i "%%j" == "txt" (Set "tCRC=00000000%%i") else (Set "tCRC="&Echo ERROR: %%? "%%A"&Pause) if "!tCRC!" NEQ "" ( Set "tCRC=!tCRC:~-8!" if Not Exist "ShaderOverride\%%?Shaders\!tCRC!.txt" Copy "Dumps\%%@\%%?Shader\%%A" "ShaderOverride\%%?Shaders\!tCRC!.txt">Nul ))) ) )) :nExit Echo Processing Complete...&Timeout /T 3&Goto:Eof[/code] _uoe.bat(UpdateOverrideEngine):Run it from the same location, it needs a fresh Dumps\AllShaders\*(DumpAll=true) + a previous ShaderOverride + ShaderSource from before the game was updated. It will create *_Backups of the ShaderOverride and DX9Settings.ini, only once just in case anything goes wrong... and then it will proceed to try to find updated CRCs for every Shader located in the ShaderSource, update the CRCs in the ShaderOverride and DX9Settings.ini... so in the case of Darksiders Definitive Edition if only the 3 unedited Shaders were in the ShaderSource folder it could find the new CRCs in the Dump and update them accordingly in the ShaderOverride/DX9Settings.ini. _uoe.bat [code]@Echo Off Title UpdateOverrideEngine :: ©2016 TsaebehT - For Intended Use Only. Please Do Not Copy in Part, Modify and/or Distribute Without Permission. SetLocal EnableDelayedExpansion pushd "%~dp0" if Not Exist "Dumps\AllShaders\VertexShader\*.txt" Echo Dumps Not Found&Timeout /T 3&Goto:Eof if Not Exist "ShaderOverride\" Echo ShaderOverride Not Found&Timeout /T 3&Goto:Eof if Not Exist "ShaderSource\" Echo ShaderSource Not Found&Timeout /T 3&Goto:Eof if Not Exist "ShaderOverride_Backup\" XCopy "ShaderOverride\*" "ShaderOverride_Backup\" /S /I if Exist "DX9Settings.ini" if Not Exist "DX9Settings_Backup.ini" Copy "DX9Settings.ini" "DX9Settings_Backup.ini" CLS&Call:UpdateCRCs Pixel Vertex Set $>Nul||Echo No Differences Encountered&&Pause&&Goto:Eof Echo(&Echo Creating Log... > dde_uoe.log ( for /F "tokens=1-4* delims=$S= " %%i in ('Set $') do ( Echo %%iS %%j %%k %%l %%m if /i "%%k" NEQ "REN" Set "$%%iS%%j=" )) Set "#Num=1000" for /F "tokens=1* delims=]" %%? in ('Type DX9Settings.ini^|find /n /v ""') do ( Set /A "#Num+=1"&Set "$Line=%%@"&if "!$Line!" NEQ "" ( if "!$Line:[V=!" NEQ "!$Line!" ( for /F "tokens=1,3 delims=$VS= " %%i in ('Set $') do ( if "[V%%i" == "!$Line:~0,2!!$Line:~3,8!" Set "$Line=!$Line:%%i=%%j!"&Set "$UpdIni=True" )) else ( if "!$Line:[P=!" NEQ "!$Line!" ( if "!$Line:[PRE=!" == "!$Line!" ( for /F "tokens=1,3 delims=$PS= " %%i in ('Set $') do ( if "[P%%i" == "!$Line:~0,2!!$Line:~3,8!" Set "$Line=!$Line:%%i=%%j!"&Set "$UpdIni=True" )))) Set "$X!#Num!=!$Line!" )) if "!$UpdIni!" == "True" ( Echo Updating DX9Settings.ini... > DX9Settings.ini ( for /L %%? in (1001,1,!#Num!) do (Echo/!$X%%?!) )) Echo Processing Complete&Pause&Goto:Eof :UpdateCRCs if "%1" == "" Goto:Eof Set "$haderDump=Dumps\AllShaders\%1Shader\" Set "$haderOverride=ShaderOverride\%1Shaders\" Set "$haderSource=ShaderSource\%1Shaders\" Set "$hS=%1"&Set "$hS=$!$hS:~0,1!S" if Exist "!$haderSource!*.txt" ( Echo Dividing %1Shaders into Lots... for /F "tokens=1,2 delims=:" %%? in ('Find /v /c ":\" !$haderDump!*.txt') do ( Set "$fn=%%?"&Set "$fn=!$fn:---------- %$haderDump%=!"&Set /A "$fc=%%@+0" for /F "tokens=1-4 delims=_. " %%i in ("!$fn!") do ( if /i "%%l" == "txt" ( Set "tCRC=00000000%%j"&Set "tCRC=!tCRC:~-8!" if "!$tL%%j!" == "" Set "$tL%%j=!$fn!=!$fc!=!tCRC!" ) else ( if "%%l" == "" ( Set "tCRC=00000000%%i"&Set "tCRC=!tCRC:~-8!" if "!$tL%%i!" == "" Set "$tL%%i=!$fn!=!$fc!=!tCRC!" )))) for /F "tokens=1,2 delims=:" %%? in ('Find /v /c ":\" !$haderSource!*.txt') do ( Set "$fn=%%?"&Set "$fn=!$fn:---------- %$haderSource%=!"&Set /A "$fc=%%@+0" if Exist "!$haderSource!!$fn!" ( Set "!$hS!!$fn:.txt=!=NID --------"&Call:FindCRCs !$fn! !$fc! ) else ( Set "!$hS!!$fn:.txt=!=NIF --------" ))) ) for /F "delims=PV=" %%? in ('Set $') do (Set "%%?=") Shift&Goto:UpdateCRCs :FindCRCs Echo(&Echo Comparing "%1" Against Lot "%2": for /F "delims=" %%? in (!$haderSource!%1) do ( Set "$tmp=%%?"&if "!$tmp::\=!" == "%%?" Set "$tmp=!$tmp: =!"&Set "Fc1=!Fc1!!$tmp!" ) for /F "tokens=2-4 delims==" %%? in ('Set $tL') do (::%%? = "filename.txt", %%@ = fsize, %%A = CRC if "%%@" == "%2" ( Echo !$haderDump!%%? for /F "delims=" %%? in (!$haderDump!%%~?) do ( Set "$tmp=%%?"&if "!$tmp::\=!" == "%%?" Set "$tmp=!$tmp: =!"&Set "Fc2=!Fc2!!$tmp!" ) if "!Fc1!" == "!Fc2!" ( if "!tList!" == "" (Set "tList=%%A") else (Set "tList=!tList! %%A") ) Set "Fc2=" )) Set "Fc1=" if "!tList!" == "%~n1" (Set "!$hS!%~n1=EQU --------") else ( if "!tList:%~n1=!" NEQ "!tList!" (Set "!$hS!%~n1=EQU -------- !tList!") else ( if "!tList: =!" == "!tList!" (Ren "!$haderOverride!%1" "!tList!.txt"&Set "!$hS!%~n1=REN !tList!") else (Set "!$hS!%~n1=UNK -------- !tList!") )) Set "tList=" Goto:Eof[/code] ...*.bat files zipped up for the lazy :) [url]https://www.dropbox.com/s/j250rjrnym26g62/_sd2s_uoe.zip[/url] (updated zip... when I went to test them on my 3D rig I noticed Notepad/Win10 somehow corrupted the beginning of the scripts when I cleaned up the whitespace and saved them causing the @Echo Off to not work, so they're spitting everything out into the console making them super sssslllloooowwww...) [s]edit:apparently my code's too fancy to post... Lol... keeps causing weird errors...[/s] edit:edit:apparently it didn't like Goto:[u]On[/u]Exit, changed it to Goto:nExit... *sigh*
I'm not sure if anyone uses these or not but I thought I'd share the newest versions just in case anyone's interested in them... I've been mostly writing scripts in AHK lately but I thought I'd revisit my update override(for finding and updating changed/differnet CRCs) script when I picked up Darksiders Definitive Edition to see if it could've pulled off finding the different CRCs when installing to different locations.

I was using FC to do file comparison's which worked on finding updated CRCs as long as the contents were the same, unfortunately the path lines(#line ## location) would be different so I came up with my own way to compare the files ignoring the #lines... and then I pretty much rewrote the entire thing.

Since the updating script relies on a Shader Dump, Source and Override... I revisited ShaderDump2Source and basically ending up rewriting that as well. It's much faster than before, a Dump of roughly 2000 Shaders takes about 1min 24sec on my laptop with the old version. The latest version takes only 12secs, so I'm happy with that... it's not as 'verbose' as the previous version but outputting all those messages actually slows it down quite a bit, takes roughly 4x as much time.

I'll have to take some time and update the OP but the basics are still the same, except they're bat files and not EXEs this time around...

_sd2s_lite.bat(ShaderDump2Source):Run it from the dll/Dumps(DumpAll=True) location and it'll create a ShaderSource from the AllShaders Dump, as well as Import any SingleShaders into the ShaderOverride. If you Run it again it will only Import Shaders that aren't present in the ShaderSource/Override and if you drag and drop the ShaderSource folder onto the script(_sd2s.bat) it will Remove any Shaders from the ShaderSource that aren't present in the ShaderOverride.

_sd2s_lite.bat
@Echo Off
Title ShaderDump2Source
:: ©2016 TsaebehT - For Intended Use Only. Please Do Not Copy in Part, Modify and/or Distribute Without Permission.
SetLocal EnableDelayedExpansion
pushd "%~dp0"
if /i "%~n1" == "ShaderSource" (
for /F %%? in ('forfiles /P %1 /C "Cmd /C Echo @isdir"') do (
if /i "%%?" == "True" (
Echo Removing Irrelevant Shaders/Folders from ShaderSource:
Timeout /T 3
for %%? in (Pixel;Vertex) do (
for /F %%@ in ('Dir /B ShaderSource\%%?Shaders\*.txt') do (
if Not Exist "ShaderOverride\%%?Shaders\%%@" (
Echo VS%%@&Del "ShaderSource\%%?Shaders\%%@"
))
RD /Q "ShaderSource\%%?Shaders" "ShaderSource\"2>Nul
)
Goto:nExit
)))
for %%? in (Pixel;Vertex) do (
for %%@ in (AllShaders;SingleShaders) do (
if "%%@" == "AllShaders" (
for /F "delims=" %%A in ('Dir /B Dumps\%%@\%%?Shader\*.txt') do (
if Not Exist "ShaderSource\%%?Shaders\" MD "ShaderSource\%%?Shaders\"
for /F "tokens=1-4 delims=_. " %%i in ("%%A") do (
if /i "%%l" == "txt" (Set "tCRC=00000000%%j") else (if /i "%%j" == "txt" (Set "tCRC=00000000%%i") else (Set "tCRC="&Echo ERROR: %%? "%%A"&Pause))
if "!tCRC!" NEQ "" (
Set "tCRC=!tCRC:~-8!"
if Not Exist "ShaderSource\%%?Shaders\!tCRC!.txt" Copy "Dumps\%%@\%%?Shader\%%A" "ShaderSource\%%?Shaders\!tCRC!.txt">Nul
)))
) else (
for /F "delims=" %%A in ('Dir /B Dumps\%%@\%%?Shader\*.txt') do (
if Not Exist "ShaderOverride\%%?Shaders\" MD "ShaderOverride\%%?Shaders\"
for /F "tokens=4,5 delims=_. " %%i in ("%%A") do (
if /i "%%j" == "txt" (Set "tCRC=00000000%%i") else (Set "tCRC="&Echo ERROR: %%? "%%A"&Pause)
if "!tCRC!" NEQ "" (
Set "tCRC=!tCRC:~-8!"
if Not Exist "ShaderOverride\%%?Shaders\!tCRC!.txt" Copy "Dumps\%%@\%%?Shader\%%A" "ShaderOverride\%%?Shaders\!tCRC!.txt">Nul
)))
)
))
:nExit
Echo Processing Complete...&Timeout /T 3&Goto:Eof

_uoe.bat(UpdateOverrideEngine):Run it from the same location, it needs a fresh Dumps\AllShaders\*(DumpAll=true) + a previous ShaderOverride + ShaderSource from before the game was updated. It will create *_Backups of the ShaderOverride and DX9Settings.ini, only once just in case anything goes wrong... and then it will proceed to try to find updated CRCs for every Shader located in the ShaderSource, update the CRCs in the ShaderOverride and DX9Settings.ini... so in the case of Darksiders Definitive Edition if only the 3 unedited Shaders were in the ShaderSource folder it could find the new CRCs in the Dump and update them accordingly in the ShaderOverride/DX9Settings.ini.

_uoe.bat
@Echo Off
Title UpdateOverrideEngine
:: ©2016 TsaebehT - For Intended Use Only. Please Do Not Copy in Part, Modify and/or Distribute Without Permission.
SetLocal EnableDelayedExpansion
pushd "%~dp0"
if Not Exist "Dumps\AllShaders\VertexShader\*.txt" Echo Dumps Not Found&Timeout /T 3&Goto:Eof
if Not Exist "ShaderOverride\" Echo ShaderOverride Not Found&Timeout /T 3&Goto:Eof
if Not Exist "ShaderSource\" Echo ShaderSource Not Found&Timeout /T 3&Goto:Eof
if Not Exist "ShaderOverride_Backup\" XCopy "ShaderOverride\*" "ShaderOverride_Backup\" /S /I
if Exist "DX9Settings.ini" if Not Exist "DX9Settings_Backup.ini" Copy "DX9Settings.ini" "DX9Settings_Backup.ini"
CLS&Call:UpdateCRCs Pixel Vertex
Set $>Nul||Echo No Differences Encountered&&Pause&&Goto:Eof
Echo(&Echo Creating Log...
> dde_uoe.log (
for /F "tokens=1-4* delims=$S= " %%i in ('Set $') do (
Echo %%iS %%j %%k %%l %%m
if /i "%%k" NEQ "REN" Set "$%%iS%%j="
))
Set "#Num=1000"
for /F "tokens=1* delims=]" %%? in ('Type DX9Settings.ini^|find /n /v ""') do (
Set /A "#Num+=1"&Set "$Line=%%@"&if "!$Line!" NEQ "" (
if "!$Line:[V=!" NEQ "!$Line!" (
for /F "tokens=1,3 delims=$VS= " %%i in ('Set $') do (
if "[V%%i" == "!$Line:~0,2!!$Line:~3,8!" Set "$Line=!$Line:%%i=%%j!"&Set "$UpdIni=True"
)) else (
if "!$Line:[P=!" NEQ "!$Line!" (
if "!$Line:[PRE=!" == "!$Line!" (
for /F "tokens=1,3 delims=$PS= " %%i in ('Set $') do (
if "[P%%i" == "!$Line:~0,2!!$Line:~3,8!" Set "$Line=!$Line:%%i=%%j!"&Set "$UpdIni=True"
))))
Set "$X!#Num!=!$Line!"
))
if "!$UpdIni!" == "True" (
Echo Updating DX9Settings.ini...
> DX9Settings.ini (
for /L %%? in (1001,1,!#Num!) do (Echo/!$X%%?!)
))
Echo Processing Complete&Pause&Goto:Eof
:UpdateCRCs
if "%1" == "" Goto:Eof
Set "$haderDump=Dumps\AllShaders\%1Shader\"
Set "$haderOverride=ShaderOverride\%1Shaders\"
Set "$haderSource=ShaderSource\%1Shaders\"
Set "$hS=%1"&Set "$hS=$!$hS:~0,1!S"
if Exist "!$haderSource!*.txt" (
Echo Dividing %1Shaders into Lots...
for /F "tokens=1,2 delims=:" %%? in ('Find /v /c ":\" !$haderDump!*.txt') do (
Set "$fn=%%?"&Set "$fn=!$fn:---------- %$haderDump%=!"&Set /A "$fc=%%@+0"
for /F "tokens=1-4 delims=_. " %%i in ("!$fn!") do (
if /i "%%l" == "txt" (
Set "tCRC=00000000%%j"&Set "tCRC=!tCRC:~-8!"
if "!$tL%%j!" == "" Set "$tL%%j=!$fn!=!$fc!=!tCRC!"
) else (
if "%%l" == "" (
Set "tCRC=00000000%%i"&Set "tCRC=!tCRC:~-8!"
if "!$tL%%i!" == "" Set "$tL%%i=!$fn!=!$fc!=!tCRC!"
))))
for /F "tokens=1,2 delims=:" %%? in ('Find /v /c ":\" !$haderSource!*.txt') do (
Set "$fn=%%?"&Set "$fn=!$fn:---------- %$haderSource%=!"&Set /A "$fc=%%@+0"
if Exist "!$haderSource!!$fn!" (
Set "!$hS!!$fn:.txt=!=NID --------"&Call:FindCRCs !$fn! !$fc!
) else (
Set "!$hS!!$fn:.txt=!=NIF --------"
)))
)
for /F "delims=PV=" %%? in ('Set $') do (Set "%%?=")
Shift&Goto:UpdateCRCs
:FindCRCs
Echo(&Echo Comparing "%1" Against Lot "%2":
for /F "delims=" %%? in (!$haderSource!%1) do (
Set "$tmp=%%?"&if "!$tmp::\=!" == "%%?" Set "$tmp=!$tmp: =!"&Set "Fc1=!Fc1!!$tmp!"
)
for /F "tokens=2-4 delims==" %%? in ('Set $tL') do (::%%? = "filename.txt", %%@ = fsize, %%A = CRC
if "%%@" == "%2" (
Echo !$haderDump!%%?
for /F "delims=" %%? in (!$haderDump!%%~?) do (
Set "$tmp=%%?"&if "!$tmp::\=!" == "%%?" Set "$tmp=!$tmp: =!"&Set "Fc2=!Fc2!!$tmp!"
)
if "!Fc1!" == "!Fc2!" (
if "!tList!" == "" (Set "tList=%%A") else (Set "tList=!tList! %%A")
)
Set "Fc2="
))
Set "Fc1="
if "!tList!" == "%~n1" (Set "!$hS!%~n1=EQU --------") else (
if "!tList:%~n1=!" NEQ "!tList!" (Set "!$hS!%~n1=EQU -------- !tList!") else (
if "!tList: =!" == "!tList!" (Ren "!$haderOverride!%1" "!tList!.txt"&Set "!$hS!%~n1=REN !tList!") else (Set "!$hS!%~n1=UNK -------- !tList!")
))
Set "tList="
Goto:Eof

...*.bat files zipped up for the lazy :) https://www.dropbox.com/s/j250rjrnym26g62/_sd2s_uoe.zip
(updated zip... when I went to test them on my 3D rig I noticed Notepad/Win10 somehow corrupted the beginning of the scripts when I cleaned up the whitespace and saved them causing the @Echo Off to not work, so they're spitting everything out into the console making them super sssslllloooowwww...)

edit:apparently my code's too fancy to post... Lol... keeps causing weird errors...

edit:edit:apparently it didn't like Goto:OnExit, changed it to Goto:nExit... *sigh*
#13
Posted 05/05/2016 05:17 PM   
Scroll To Top