DashingStrike / Automato-ATITD

Automato scripts for A Tale in the Desert
MIT License
5 stars 25 forks source link

Has anyone had success running Automato on Linux or Mac with Wine? #113

Closed leviable closed 5 years ago

leviable commented 6 years ago

Before I go down the rabbit hole of messing with Wine, has anyone already tried using Wine to run Automato on Linux or Mac? Did it work? Any insights you can provide?

leviable commented 6 years ago

Update: I was able to get Automato running with wine, but it appears that it can't capture the screen correctly.

If anyone else wants to try, follow these basic steps:

  1. Install wine with brew brew install wine winetricks
  2. Set up a 32 bit prefix version: WINEPREFIX="$HOME/prefix32" WINEARCH=win32 wine wineboot
  3. Install Automato into the 32 bit space: WINEPREFIX=~/prefix32 WINEARCH=win32 wine ~/Downloads/AutomatoInstaller.exe
  4. Run Automato WINEPREFIX=~/prefix32 WINEARCH=win32 wine drive_c/Games/Automato/Automato.exe
Jimbly commented 6 years ago

The engine (Glov), that Automato uses for UI, I/O, etc, has been ported to Linux natively (for my first Steam game, Splody), so it might not be too much work to get Automato running natively on Linux, however Automato has a lot of OS specific code dealing with screen scraping and input automation, all of which probably exist on Linux, but they're not likely easy to find, so it would probably require someone with some experience.

Would also likely run into a bunch of scripts people wrote which rely on the case-insensitive file system, though that can be patched into Automato logic without updating all of the scripts.

On Mar 16, 2018 9:22 AM, "Levi Noecker" notifications@github.com wrote:

Update: I was able to get Automato running with wine, but it appears that it can't capture the screen correctly.

If anyone else wants to try, follow these basic steps:

  1. Install wine with brew brew install wine winetricks
  2. Set up a 32 bit prefix version: WINEPREFIX="$HOME/prefix32" WINEARCH=win32 wine wineboot
  3. Install Automato into the 32 bit space: WINEPREFIX=~/prefix32 WINEARCH=win32 wine ~/Downloads/AutomatoInstaller.exe
  4. Run Automato WINEPREFIX=~/prefix32 WINEARCH=win32 wine drive_c/Games/Automato/Automato.exe

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DashingStrike/Automato-ATITD/issues/113#issuecomment-373766883, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvQ7wKaGJw9aixWINTYmLeN1voK3eszks5te-a5gaJpZM4St9IM .

leviable commented 6 years ago

I would love it if automato could run on linux/mac natively. I would be willing to help nail down the specifics of screen scraping and input automation, if that helps.

Jimbly commented 6 years ago

Hmm... looks like I already figured most of this out many years ago, looks like I had screen reading and key sending working, so maybe it wouldn't be too hard to do =). I can't promise anything, but if I have time one of the next couple weekends I can take a stab at it - at least get the build scripts and such working on Linux =).

Jimbly commented 6 years ago

One thing I didn't figure out before is how to grab the window under the cursor, and find its dimensions - I think reading from the main display will work fine, but we need to know what subsection is the ATITD window (so we can translate mouse positions to window positions, etc). If you've got any idea how to do that, any help would be appreciated =). For now I'm just going through and trying to get Automato compiling and linking on Linux, leaving a bunch of stuff (like this) unimplemented.

leviable commented 6 years ago

This seems close to what you describe: How do I get the window that currently has the cursor on top of it with X11?

Also, this small program seems to do exactly what you describe: get the window under the mouse cursor: https://github.com/gholken/Mousetrap/blob/master/main.cpp

Jimbly commented 6 years ago

Just a status update - I've got Automato compiling and linking with all dependencies on Linux now, but still have a handful of automation things stubbed out. Haven't actually had a chance to test it, since I need to swap a hard drive around to actually have a computer running X11, but will perhaps get to that next weekend and wrap this up =).

Jimbly commented 5 years ago

It lives! You can download Automato v2.28 from the downloads page, which has Linux support (under downloads, grab the Zip version). I've not had a chance to test it with ATITD specifically, so would love to get some feedback as to whether or not it works there before rolling out to the general public. In theory, Windows and Linux binaries will be included in all Automato distributions from now on.

I'm not 100% sure what packages are required (unfortunately I've got a huge splattering of packages installed from when debugging things), but I've started a wiki page about Linux pre-requisites here. Please update that (or comment here or in Discord) with any other dependencies you find you're missing that are required. I think I listed the right package for getting access to Xtst (I have libxtst-dev installed, but that's way more than what is needed just to run Automato).

Note: This is not being pushed to all users yet, so do not click the "Update Automato" button when it wants to "upgrade" to v2.27, which does not have a Linux executable included.

leviable commented 5 years ago

Awesome! Thanks Jimbly, I'll see if I can get this installed and running this evening.

Jimbly commented 5 years ago

Cool, let me know how it goes, and if any additional packages need to be installed to get it to work. Drop by the Discord channel if you have any issues or questions =).

leviable commented 5 years ago

So, first thing I noticed when unzipping the .zip file: every unzipped file has the path in the filename, with window's \ separators:

➜  automato ls -al
total 48544
drwx------@ 1104 levi.noecker  857013695    35328 Dec  1 19:09 .
drwx------+  147 levi.noecker  857013695     4704 Dec  1 19:09 ..
-rwxr-xr-x@    1 levi.noecker  857013695  3817208 Nov 26 13:59 automato\Automato.exe
-rwxr-xr-x@    1 levi.noecker  857013695    24038 Aug 22  2017 automato\Automato.ico
-rwxr-xr-x@    1 levi.noecker  857013695  4768744 Nov 26 13:59 automato\AutomatoLinux
-rwxr-xr-x@    1 levi.noecker  857013695     1756 Aug 22  2017 automato\LICENSE.TXT
-rwxr-xr-x@    1 levi.noecker  857013695    26528 May 12  2018 automato\ScriptingReference.txt
-rwxr-xr-x@    1 levi.noecker  857013695    97792 Nov 16 16:08 automato\VeggieTales.exe
-rwxr-xr-x@    1 levi.noecker  857013695    68934 May  9  2018 automato\data\fonts\arial32.png
-rwxr-xr-x@    1 levi.noecker  857013695    11651 Jul 16 08:03 automato\data\fonts\arial32.txt
-rwxr-xr-x@    1 levi.noecker  857013695    28536 Nov 16 16:02 automato\data\graphics\DS.png
-rwxr-xr-x@    1 levi.noecker  857013695     8549 Aug 22  2017 automato\data\graphics\GlovTiles.png
-rwxr-xr-x@    1 levi.noecker  857013695        9 Mar  6  2018 automato\data\graphics\GlovTiles.png.texopt
-rwxr-xr-x@    1 levi.noecker  857013695      927 Aug 22  2017 automato\data\graphics\admin.png
-rwxr-xr-x@    1 levi.noecker  857013695     5586 Nov 26 13:13 automato\data\graphics\automato_64.png
-rwxr-xr-x@    1 levi.noecker  857013695      508 Mar 19  2018 automato\data\graphics\discord.png
-rwxr-xr-x@    1 levi.noecker  857013695     2293 Aug 22  2017 automato\data\graphics\ui\BrokenImage.png
-rwxr-xr-x@    1 levi.noecker  857013695      347 Nov 16 16:02 automato\data\graphics\ui\ButtonGlowHBox.png
-rwxr-xr-x@    1 levi.noecker  857013695       16 Jun 18 14:00 automato\data\graphics\ui\ButtonGlowHBox.png.texopt
<etc>

Some googling indicates it might be an issue with how the zip is created, as normally zipping and unzipping respects the OS directory separator without needing to do anything special.

Trying to run the linux executable as-is I get an exec error:

➜  automato ./automato\\AutomatoLinux
zsh: exec format error: ./automato\AutomatoLinux
➜  automato file automato\\AutomatoLinux
automato\AutomatoLinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=73f185cf9f49a4f43ab2f2b7479ad60d57bd9e7f, stripped

Both of the above is from my macbook. I'm going to fire up a virtual machine with ubuntu on it and see what happens.

Jimbly commented 5 years ago

Heh, that's annoying =). I'll find a different way to zip it, I was using some built-in Windows PowerShell way, but apparently it sucks ^_^.

Executable is definitely Linux, I have no idea how to do the automation stuff on Mac (though, if the Linux version works, might not be too hard to get that figured out, however I have zero access to any Mac systems, so someone else would need to debug/test).

leviable commented 5 years ago

A couple more things:

If I unzip the automato.zip from the command line on my macbook (unzip automato.zip), it unzips just fine. The oddball output I got above was after clicking the download link in chrome, so no idea what happened there. That said, AutomatoLinux still wont run on the macbook, with the same error as above.

I installed Ubuntu on a VM, installed the ATITD and automato, and it works fine as far as I can tell. Tried a couple scripts, and it looks like the screen scraping and everything works fine. My machine is a little too underpowered right now to run much, so I need to reconfigure a few things to really try it out.

On a base install of Ubuntu 18.04 I didn't need to install any additional packages for Automato to work. I did need to jump through several hoops to get ATITD to work (mainly installing i386 versions of packages), but Automato was straight forward with no problems.

Jimbly commented 5 years ago

I've published a new build with the .zip file in a cross-platform format that shouldn't contain any backslashes, and set the Linux binaries going out to all users now (so if you do run it, feel free to let it self-update now).

Thanks for testing in a VM! I think native Mac support will be unavailable until a Mac developer wants to volunteer to dive into the code, but the Linux version should now be fully supported.

Jimbly commented 5 years ago

Have had reports of this actually working on Linux by another user, so closing this issue now =)