Log in

View Full Version : Alternate use of Avisynth scripts with 32bit and 64bit


KreuzBlick
19th October 2019, 13:29
Hi,

today I have a question about the alternate use of Avisynth scripts with 32bit and 64bit, for example when I use the corresponding variants of Virtualdub2 or MeGUI. Depending on bit depth, I have to load other plugins or use different instructions. So far, I do that with a Boolean variable

is64bit

which I set either true or false. I call my instructions with a kind of construction like

is64bit? Eval ("""
#Do everything with 64bit
"""): Eval ("""
#Do everything with 32bit
""")


My question is whether there is a function that automatically detects what kind of operating system is present.

Maybe I see it too complicated and there is a much simpler solution of my problem.

ChaosKing
19th October 2019, 14:27
There's the SysInfo plugin https://forum.doom9.org/showthread.php?t=176131 which can automate your switch.

int SI_ProcessBitness
Returns the bitness of the current process (64 or 32)

Edit:
Maybe Avsinit is also helpfull for auto-loading different dlls / scripts https://forum.doom9.org/showthread.php?t=176749

KreuzBlick
19th October 2019, 19:48
Thank you for that information. I have looked at the linked posts and they indeed give an indication that the determination of "bitness" in Avisynth should be possible.
However, I have not found a way to derive from it a function that I can use directly in my script.

ChaosKing
19th October 2019, 20:07
The download page seems to be currently offline, so I can't test it myself. But you can do it without a plugin

version()
subtitle(String(is64bit()))

function is64bit()
{
FindStr(VersionString, "x86_64") != 0
}

it show true in 64 bit avisynth+ and false in 32bit

StainlessS
19th October 2019, 22:39
Alternative, using Groucho2004 SysInfo plugin.

Function is64bit() { return SI_ProcessBitness==64 }

Untested

EDIT: I'll add it to avsInit.avsi, also IsXP()
EDIT: Added.

KreuzBlick
20th October 2019, 09:41
I have tested both versions in my computing environment.

When I drag the script from Post #4 to Virtualdub32 or Virtualdub64, it behaves as expected.

If I replace the function by the one from the current avsInit.avsi, then my result in 32bit is correct, but with Virtualdub64 the following error message comes up:

"Avisynth open failure: 'I don't know, what 'SystemInfoExists' means'."

In any case, my problem is solved, my handling of scripts in 32- and 64-bit environments has become much easier.

Thanks to ChaosKing and StainlessS for the great help!

StainlessS
20th October 2019, 14:58
The one in post #5 should work [req SysInfo], the one in AvsInit depends upon SysInfo RT_Stats and is not intended to be extracted from AvsInit [as it also depends upon a script function SystemInfoExists too].

If you intend using avs standard with GScript and avs+, then AvsInit is the only game in town [Complete Script].

EDIT: ChaosKing post has no requirements [other than that the Avisynth Version strings remain fairly static].