Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & setlocal enableDelayedExpansion
- :getBuffer posInt "char" return_varName
- for /l %%a in (1,1,%~1) do set "x=!x!%~2"
- set "%~3=%x%" & set "x="
- goto :eof
- ::------------------------------------------------------------------------------
- :length var return_varName
- set "str=X%~1"
- set length=0
- for /L %%a in (12,-1,0) do (
- set /a "length|=1<<%%a"
- for %%b in (!length!) do if "!str:~%%b,1!" equ "" set /a "length&=~1<<%%a"
- )
- set "%~2=%length%"
- set "str="
- goto :eof
- ::------------------------------------------------------------------------------
- ::Millisecond delay
- :delay
- for /f "tokens=2 delims=." %%a in ("%time%") do (set "c=%%a")
- if "%c:~0,1%" == "0" set "c=%c:~1%"
- set /a l=%c% + %~1
- :wait
- set "cPrev=%c%"
- for /f "tokens=2 delims=." %%a in ("%time%") do (set "c=%%a")
- if "%c:~0,1%" == "0" set "c=%c:~1%"
- if %cPrev% GTR %c% set /a l-=100
- if %c% LSS %l% goto :wait
- goto :eof
- ::------------------------------------------------------------------------------
- :MultiThread_dispatcher[1]
- if not "%~1" equ "" goto :%1
- ( start /b cmd /c "%~nx0" %~2 ) | "%~nx0" %~3
- goto :eof
- REM -- OR --
- REM start /b cmd /c "%~nx0" LABEL
- ::------------------------------------------------------------------------------
- :: FPS CALC and FPS Delay
- : prep calcFPS
- set /A maxFPS=99
- set /A cs=100/maxFPS
- set t=!time: =0!
- goto :eof
- :calcFPS
- (
- set tc=!time: =0!
- for /F "tokens=1-8 delims=:.," %%a in ("!t!:!tc!") do (
- set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31) & 8640000"
- )
- if !a! lss !cs! goto :calcFPS
- if !a! gtr !cs! set /a a-=1
- set t=!tc!
- if !a! neq 0 (set /A fps=100/a) else set fps=?
- title FPS:!fps!/s
- )
- goto :eof
- ::------------------------------------------------------------------------------
- :color
- set nL=%3
- if not defined nL echo requires third argument & pause > nul & goto :eof
- if %3 == 0 <nul set /p ".=">%2 & findstr /v /a:%1 /r "^$" %2 nul & del %2 2>&1 & goto :eof
- if %3 == 1 echo >%2 & findstr /v /a:%1 /r "^$" %2 nul & del %2 2>&1 & goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement