Wednesday, November 30, 2016

AbiathRPC - Version check

I might eventually want to add some features to AbiathRPC after its first public release. Therefore, it'll need some sort of versioning system. I added an operation contract to the server's service contract that gets a string describing the server's version. If a client connects to a server with a different version, it warns the user about possible bizarre behavior. Since the client reports its own version when asking for the server's, the server has the opportunity to lie about its version if it decides it can accommodate the client despite their differences. That ability may or may not prove useful as I add more features after a release.

Tuesday, November 29, 2016

AbiathRPC - Remote ADEPS fragment

AbiathRPC level sets can't have all the fancy configuration available to local level sets because there isn't a real ADEPS file to load. For example, there isn't a way to set the number of infoplane tiles, which is kind of a problem because it's different for different episodes. So I added a server configuration option that has it load an ADEPS fragment from a file. When a client connects, it asks for that fragment and if it's found, the connection routine has the core configuration object load that text. Servers can now share these extra properties - e.g. path tile IDs, Level Inspector and Resource Accountant configuration - with clients.

Monday, November 28, 2016

AbiathRPC - Keep unnecessary menus disabled

Though I had already added code to AbiathRPC's connection routine to disable the menu items that don't make sense for a remote level set, I found today that they get re-enabled when the user switches levels. That's because Abiathar's SetCurLevel looks through the list of lockable menus and sets each to an appropriate state depending on whether there is a level set and whether there are any levels in it. I added an event handler on the TextChanged event of the level name label (which is fired after the level name indicator is updated, which is after menu re-enabling part) to disable those menus again.

Sunday, November 27, 2016

AbiathRPC - Debugging level creation

I noticed today that though creating levels in AbiathRPC worked, trying to edit the new ones in the instance that created them would cause a crash. The old level wrapper (one around the plain GalaxyLevel) was still held in the current tool. Even after I made ScanForLevelSetChanges refresh the current tool when necessary, the watchdog render planes were still holding onto the wrong wrapper. There isn't a convenient way to make sure they always have the right kind, so AbiathRPC now keeps a table of plain level instances and tagged ones, updating it when a new level is created and consulting it when looking for a given level wrapper's level ID. Editing new levels now works.

Saturday, November 26, 2016

Opening a file from Task Scheduler

Some might think that to open a file (e.g. a plain text document) from Task Scheduler, you need some sort of script to use Windows's "open this document with whatever it needs" mode. Interestingly enough, you don't - and since you don't have to, you don't have to see the flash of a command prompt or whatever you use to launch the final thing. Instead, you can just put the full path to the target document as the "program" in a "start a program" action and sure enough, when the task is run, up will pop that document in its default application. (Caveat: Task Scheduler doesn't seem to like spaces in the path, even if you quote it.)

Friday, November 25, 2016

A guide to installing Abiathar on Ubuntu 14.04

Last time I tried Ubuntu, I never got anything interesting running on it. Today I tried again, and after a ton of fiddling I managed to get Abiathar running on it. Note that I barely know anything about Linux and I'm just compiling a bunch of instructions into one place.

First, you'll need to download the update client (EXE link), which fetches the newest version. Your Downloads folder is a good place for that. Fire up a Terminal and navigate to wherever you put it. Mark it executable with chmod +x AbiatharUpdater.exe.

Now you need Mono, which is like .NET for Linux. Open the Ubuntu Software Center application, then find and install the Mono Runtime (searching for "mono" should pull it up). You need some extra packages:

sudo apt-get install mono-vbnc
sudo apt-get install mono-devel

Unfortunately, those don't include the SSL certificates that Mono needs to fetch HTTPS files, and mozroots is no more, so we need to add another repository?
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install ca-certificates-mono

For reasons unknown, installing that last certificates package takes a really long time and pokes at a bunch of other packages. Once it's done, you can finally run the Abiathar updater.

mono AbiatharUpdater.exe

If everything goes well, it will download three files. It fails with "The method or operation is not supported" at the very end, but that's OK; it was trying to launch Abiathar using a Windows function that doesn't exist on Linux.

OK, now we need WINE, which is a Windows emulator. (Abiathar needs a UI, which means window handles and stuff that isn't .NET, so just Mono won't do it.) Before we do that, mark Abiathar executable with chmod +x Abiathar.exe.

sudo apt-get install wine
sudo apt-add-repository ppa:wine/wine-builds
sudo apt-get update
sudo apt-get install winehq-staging

That installs the normal WINE package, then it gets the staging (development) branch, which has features we need. Now we need to configure stuff to get the .NET framework running inside WINE.

rm -rf ~/.wine
export WINEARCH=win32
export WINEPREFIX="/home/USER/.wine"
winecfg

Replace "USER" with your home folder's name. The last command produces a GUI configuration utility. While it's loading, it might ask to install some things; install them. Once the dialog comes up, change the Windows version dropdown to Windows 7, then OK out. Now we need extra WINE-related utilities to get .NET.
mkdir Winetricks
cd Winetricks
wget -r -c -N https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks

That downloads a script from the Winetricks GitHub repository. cd down through all the new folders.

chmod +x winetricks
sh winetricks

When you get a GUI, choose to "Select the default wineprefix", then choose "Install a Windows DLL or component." Scroll through the list and find dotnet40. It'll warn you about lacking support, but that's OK. Soon, you'll get the normal .NET 4 installer. Go through it as usual, and once done, cancel out of Winetricks.

Finally, cd back to where you put Abiathar, and run it.

wine Abiathar.exe

Abiathar running on Ubuntu

Thursday, November 24, 2016

AbiathRPC - Level creation message size

While testing AbiathRPC's new ability to replicate newly created levels, I found that the client "received no meaningful response" from the method call that sent the level's contents to the server. I recalled that this had also happened when downloading the initial levels from the server, I remembered that I need to adjust the MaxReceivedMessageSize on the server end as well to allow it to handle the big packages that include full levels. With that done, the crash went away.