Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Key Modifiers:
- ; #=windows, +=shift, ^=ctrl, !=alt
- ; <=Left Key Only, >=Right Key Only
- ; RButton, LButton, MButton, WheelUP, WheelDown, XButton1, XButton2
- ;-----Initialize-----
- #SingleInstance force
- #UseHook
- #MaxThreadsPerHotkey 1
- #InstallKeybdHook
- SendMode Input
- FXSwitch(param)
- {
- ; #### OPEN OUR FILE ###
- file := FileOpen("MasterEffect.h", "rw")
- if !IsObject(file)
- {
- MsgBox Can't open "%FileName%" for writing.
- return
- }
- ; ### GET THE CONTENTS
- contents := file.Read()
- Needle := "`#define " . param
- ; ### FIND THE EFFECTS LINE
- pos := InStr(contents, Needle)
- ; find the end of line
- eol := "`r`n"
- endpos := Instr(contents, eol, , pos)
- ; get the full line
- FXLine := SubStr(contents, pos, endpos-pos)
- ; ### GET OUR TOGGLE VALUE (0 or 1)
- regex := "(" . Needle . ")([ \t]*)([0-1])([ \t]*)(.*)$"
- FXValue := RegExMatch(FXLine, regex, SubPat)
- ; ### TOGGLE THE VALUE
- if(SubPat3 = "1")
- {
- NewValue := "0"
- }
- else if (SubPat3 = "0")
- {
- NewValue := "1"
- }
- ; ### RECREATE FX LINE WITH NEW TOGGLE VALUE
- NewFXLine := SubPat1 . SubPat2 . NewValue . SubPat4 . SubPat5
- ; ### REPLACE THE FX LINE IN OUR ORIGINAL CONTENT
- StringReplace, output, contents, %FXLine%, %NewFXLine%
- ; **** WARNING: I COULDN'T SEEM TO OVERWRITE THE FILE SO IT NEEDS TO BE DELETED FIRST CURRENTLY ****
- ; ### DELETE THE OLD FILE
- file.Close()
- FileDelete, MasterEffect.h
- ; ### WRITE THE NEW FILE
- file := FileOpen("MasterEffect.h", "rw")
- file.Write(output)
- file.Close()
- }
- ;-----HotKeys-----
- #Numpad1::FXSwitch("USE_DEPTHBUFFER_OUTPUT")
- #Numpad2::FXSwitch("USE_TONEMAP")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement