## Like the title says:

How do I edot this texconv "IMGtoBC3.bat" file so it "READS FROM & PRESERVES the directory structure when writing the "resulting" dds files?

I have a large folder/sub-folders with many tiff’s that "have the same file name" divided up into "sets".

These dds files are for custom textures in a unity game, file naming is a forced event, but "sorted/selected" by folder.

I have about 3000 file sets ready to convert and I’m not doing them 1 by 1 in Nvidia tool (I hope) and AMD tool and the game have a MAJOR conflict (its as a no go)

BONUS points to anyone that could show me this "bat" file using unity’s new tree of "CRUNCH" cmd line dds compressor/encoder. Suggestions of other tools: I have tested over 50 apps, for my needs its: Nvidia, texconv and then crunch in level of quality/support

ECHO OFF Setlocal EnableDelayedExpansion  ::Variables SET @FORMAT=BC3_UNORM SET @InputFolder=%~dp0Input_IMG_TO_BC3\ SET @OutputFolder=%~dp0Output_DXT5_BC3\ SET @TEXCONVEXE=%~dp0texconv.exe SET @TEXCONVEXE02=%~dp0texconv.exe :: Check for texconv.exe IF EXIST "%@TEXCONVEXE%" SET @TEXCONVEXE=1 IF "%@TEXCONVEXE%"=="1" GOTO EXESTATE_1  :EXESTATE_0 TITLE - ERROR! texconv.exe not found!!! COLOR 04 ECHO: && ECHO: && ECHO: ECHO                 === ERROR! texconv.exe not found!=== ECHO: ECHO     Install Path: "%~dp0texconv.exe" ECHO: ECHO    The script needs texconv.exe in order to work properly. ECHO: ECHO    Please make sure texconv.exe is in: "%~dp0"  ECHO: && ECHO:  GOTO CONT01   :EXESTATE_1 TITLE - Texconv.exe found!!! COLOR 0A  ECHO: && ECHO: && ECHO: ECHO                 [ texconv.exe Is Installed! ] ECHO: ECHO     "%~dp0texconv.exe" ECHO: GOTO CONT00 :CONT01 ECHO: && ECHO: ECHO        Please copy/move the missing texconv.exe executable to where the script needs it to be and refresh this window. ECHO: :CONT00 IF "%@TEXCONVEXE%"=="1" GOTO START ECHO: && ECHO: && ECHO     [Press any key to refresh the window] && PAUSE>NUL GOTO SetTexConvPath  :START  :: Customize CMD Window TITLE HumanStuff TexConv Batch Directory Script v1.0.2 PROMPT $G COLOR 04 CLS :: Make The Folders IF NOT EXIST "%@InputFolder%" MKDIR "%@InputFolder%" IF NOT EXIST "%@OutputFolder%" MKDIR "%@OutputFolder%" ::Run TexConv.exe ::-srgb was added because PNG images were getting high contrast colors ::Sorry about the messy code but this was harder to do than it sounds FOR /R "%@InputFolder%" %%i IN (*.*) DO ( set word=%@OutputFolder% set str=%%~dpi CALL :REPLACESTRING SET @IFOL=!@OSTRING! CALL :MKFOL SET @ISTRING=%%i CALL :TexConv01 ) PAUSE GOTO SCRIPTEND :MKFOL IF NOT EXIST "%@IFOL%" ( MKDIR "%@IFOL%" ) GOTO SCRIPTEND :TexConv01 IF NOT "%@LOGO%"=="" SET @LOGO=-nologo "%@TEXCONVEXE02%" %@LOGO% -srgb -nogpu -pow2 -vflip -if triangle -bc u -f %@FORMAT% "%@ISTRING%" -o "%@OSTRING%" -y ECHO: SET @LOGO= GOTO SCRIPTEND :REPLACESTRING call set str=%%str:%@InputFolder%=%word%%% set @OSTRING=!str:~0,-1! GOTO SCRIPTEND :SCRIPTEND $$`$$ ## Writing a plugin to track user purchase and post back that using API? [closed] I am writing a plugin to track user purchase and post back that using API. First the user visit a third party listing site and logs in. Then he clicks the listing and visits a wordpress store with this plugin. I need to store that user info for 30 days. In that window period if he makes purchase i will pay commission to the third party listing site. Can you suggest any code examples or free and paid plugins to look at. ## I’m writing in an NPC that will become a wizard – how long will it take them to level up? [closed] There’s an option in my campaign that the characters can save a man cursed to be a stag, and if they can reverse the curse he will be really grateful, but doesn’t have anything to repay them with. I want to turn him into a wizard (lvl 5+ preferably) and then have him come back into contact and give them some magical calling item so he can come and fight alongside them once to help them out and settle his debt. How long does it make sense to wait (in game time) before the NPC could be Lvl 5+? I want to keep it realistic but I also don’t want to sit on it so long they forget who he is. ## Writing a list of names, with a limited amount of “active” letters at a time. Algorithm to sort the names to reduce the amount of swapping letters? While making name-tags for a dinner seating, I stumbled upon a problem which I can’t find any algorithm to solve, and I’m not sure where to begin. The goal is to write the name of each dinner guest on a card, completing one name at a time. The names are written with old-fashioned rubber stamps, so only 6 letters can be "active" at any given time. When a new letter is required, one of the active letters has to be swapped out for the new letter. The problem is to sort the names in such an order, that I need to do the least amount of letter-swapping. Example I want to write the names: • Jack • Julie • Chuck I can do this with 3 letter-swaps Initial letters: J A C K H U Write: Jack, Chuck {swap A, C, K with L, I, E} New active letters: J L I E H U Write: Julie Now I want to find an algorithm that, given a list of names and a limit of active characters, provide the order of names and which letters to swap at each name, to reduce the total amount of letter-swaps. Any ideas or pointers are welcome. ## how to get rid of curly brackets writing minimization output to file I have the following code SetDirectory["C:\test"]; fname = FileNameJoin[{%, "results.dat"}]; str = OpenWrite[fname, FormatType -> StandardForm] D1 = 0.4; D2start = 0.26; D2fin = 0.5; Ntot = 12; D2step = (D2fin - D2start)/Ntot; For[i = 0, i <= Ntot, i++, D2 = D2start + i*D2step ; With[{minsol = NMinimize[fnew[D1, D2, x], x]}, fmin = First@minsol; xn = Values@ Last@ minsol;]; Write[str, D2, " ", xn]; ] Close[str]; i.e I minimize the function fnew wrt x and write the value of x in the file results.dat. The problem is that the output is 0.26 {0.711259} 0.28 {0.744881} 0.3 {0.776204} 0.32 {0.805418} etc. How do I get rid of these annoying curly brackets? ## Writing generalized hypergeometric function${_nF}_{n-1}(\cdot)$as a function of$n$How can we code the hypergeometric function $$f(n,k,z)={_nF}_{n-1}{\huge(}{1-k,\overbrace{2,\dots,2}^{n-1\ \text{times}} \atop \underbrace{1,\dots,1}_{n-1\ \text{times}}};z{\huge)}$$ as a function that accepts any $$n=1,2,3,\dots$$? This function reduces to a rational function in $$z$$ but that is not what I’m after. I apologize for lack of an attempt here…did not have any idea where to start. ## Can the tongues spell decipher writing (directly or indirectly)? The description for tongues states, This spell grants the creature touched the ability to speak and understand the language of any intelligent creature It makes no special mention of understanding written languages–just that you can “understand the language”. If it doesn’t include this ability, though, could, for example, a Dwarf using the spell read aloud a message written by Orcs (since apparently Dwarvish and Orcish use the same writing system, but if that’s not how the actual languages in the settings work then replace the example with languages that do work that way), and then listen to and understand their own Orcish? ## Writing to .fini_array I’m learning about format string exploits, and am attempting to use one on an example program to overwrite the .fini_array section in virtual memory with a stack address containing shellcode (and hence redirect execution to the shellcode once main exits). Unfortunately, trying to write to this address raises a segmentation fault, and I have written the following program to try to understand what’s going on. (Disclaimer, I am running x64 linux with ASLR disabled while I am learning.) //fini_test.c #include <stdio.h> #define OFFSET 0x555555554000 int main(int argc, char **argv) { unsigned long int addr; char **ptr; static int canary=0xdeadbeef; if(argc<2) { printf("Usage: %s <position to write to in object file>\n", argv[0]); exit(0); } addr=stroul(argv[1], ptr, 16)+OFFSET; printf("[*] about to print\n"); printf("writing to %p\n%n", (void *) addr, (int *) addr); printf("[*] print complete\n"); printf("canary @ %p\t%d\t0x%08x\n\n", &canary, canary, canary); exit(0); } So, the program simply takes a position in the object file as a command line argument, and then writes some bytes to the corresponding position in the virtual memory space of the process. With GDB I found that the right offset between the location in the object file and the location in the virtual memory space was 0x555555554000. I then compiled and used objdump to find the desired sections in the object file.$  gcc fini_test.c -o fini_test $objdump -h ./fini_test Sections: Idx Name Size VMA LMA File off Algn ... 19 .fini_array 00000008 0000000000200da8 0000000000200da8 00000da8 2**3 CONTENTS, ALLOC, LOAD, DATA ... 22 .data 00000014 0000000000201000 0000000000201000 00001000 2**3 CONTENTS, ALLOC, LOAD, DATA ... So, the position of the .data section in ./fini_test is 0x201000 and the position of the .fini_array section is 0x200da8. I also noted that, like the .data section, the .fini_array section does not have a READONLY flag, so I assumed that I should be able to write to it with the appropriate command line argument. However, this is how execution behaved:$  ./dtors_test 0x2010000 [*] about to print writing to 0x555555755000 [*] print complete canary @ 0x555555755010 -559038737  0xdeadbeef  $./dtors_test 0x201010 [*] about to print writing to 0x555555755010 [*] print complete canary @ 0x555555755010 26 0x0000001a$  ./dtors_test 0x200da8 [*] about to print writing to 0x555555754da8 Segmentation fault (core dumped)

First, to verify that my code and choice of OFFSET were right, I tried to overwrite the value of canary. As a first approximation I just inputted the position of the .data section, which was unsuccessful because – as inspecting the outputted address of canary shows – the value of canary is stored beneath the two pointers addr and ptr. Hence I inputted the position of the .data section plus 0x10 to account for this, and indeed successfully overwrote the value of canary with the expected value of 26 (precisely the number of bytes in the string "writing to 0x555555755010\n".)

So everything to that point is working as expected. However, I then try to write to the start of the .fini_array section* and a segmentation fault is raised. This surprises me because this section is not marked as READONLY in the object file; can anyone help me understand what’s going on? Thank you in advance

*I know that destructor addresses are not stored at exactly the start of the .fini_array section, and so even if I could write to that address it would not yield the desired results. But for now, before I cross that bridge, I’m just trying to understand why I can’t write to an address that seemingly does not have a READONLY flag enabled. As a broader question, general references to understanding how .fini_array works in ELF files would be greatly appreciated!

## Best Resource for Writing Win32/64 Program Loader [closed]

I would like to learn the PE file format well enough to be able to write a program loader from scratch in C/C++. Could anyone with experience provide reference material, tutorials, books, etc that provide the requisite knowledge?