Affinity Photo: Creating a Microbutton or Antipixel

I wanted to create some new microbuttons for some of the cool stuff in the link roll.

I could, of course, use the online generator. But that would be boring – plus there is no option to add images/logos – so I would have to do some retouching anyway.

Instead I opted to create and share a simple template for Affinity Photo. You will need to install the Silkscreen font first.

It is easy to override pretty much every colour (border, text and background) and by smartly using the hierarchies in Affinity Photo, we can get some neat auto-masking.

The hardest part for me was to understand the way Affinity Photo tries to smooth elements. This is quite different from what I was used to in Photoshop.

Building a video soundboard in OBS

Despite the fact that I do not stream as much anymore, I continue to tinker with OBS on a daily basis. For a while now I wanted to have what I would call a “video soundboard”, a simple mechanism that allows me to quickly play short clips during my stream.

Now, this doesn’t really sound too hard. Create many scenes, add media sources, slap a StreamDeck button on top of that – boom, you are done. This is a crappy solution because it requires a ton of additional work to add new videos into the mix.

I wanted to have a mechanism that relies entirely on one single scene with one single media source for all the content. Control over what gets played is wholly set on the StreamDeck and the StreamDeck only, meaning that adding new content is as easy as adding a single new command to a new button on the StreamDeck.

Sounds interesting? Here is how it works.

Prerequisites

Before we start, you will need the following things ready:

The Basic Setup

Create a new button on your StreamDeck with the Text File Tools plugin.

Specify a target filename and set the Input Text to the location of your desired media file (i.e. C:/Temp/heheboi.mp4). Leave the “Append” checkbox unchecked so the entire file gets rewritten.

This is all you will need to do to add new media to the scene. We can now set up OBS.

Within OBS, create a new scene (i.e. “Scene – Memes”) and add a media source to that scene (i.e. “Media Source – Memes”). Make sure this is a media source and not a VLC source!

Open the properties of the media source and be sure to check the “Local File” checkbox, “Restart playback when source becomes active”, “Use hardware decoding when available” and “Show nothing when playback ends”.

Hide the media source via the Sources list by clicking on the “eye” icon in the source list.

Setting up Advanced Scene Switcher macros

Now open the Advanced Scene Switcher plugin via Tools – Advanced Scene Switcher, navigate to the Macro tab and add a new Macro called “Meme Scene (Start)”.

Check the “Perform actions only on condition change” checkbox and add the following condition:

[ If ] [ File ]
Content of [ local file ] [ <PATH ON STREAMDECK BUTTON> ] matches:
.*

(Yes, that is dot asterisk – no space or anything else before, after or inbetween)
Check the “use regular expressions” checkbox and the “if modification date changed” checkbox, and leave “if content changed” unchecked.

Now add the following actions:

[ Switch scene ]
Switch to scene [ Scene - Memes ]
Check the "Wait until transition to target scene is complete" checkbox.

[ Scene item visibility ]
On [ Scene - Memes ] [ Show ] [ Source ] [ Media Source - Memes ]

This takes care of actually playing the video when a change in the file is detected. But we also want to switch back to the previous scene when playback has finished, so we must add another macro.

Add the second macro “Meme Scene (End)”, check the “Perform actions only on condition change” checkbox and add the following conditions:

[ If ] [ Scene ]
[ Current scene is ] [ Scene - Memes ]

[ And ] [ Scene item visibility ] (Click the clock) [ For at least] [ 1.00 ] [ seconds ]
On [ Scene - Memes ] [ Media Source - Memes ] is [ Shown ]

[ And ] [ Media ]
[ Media Source - Memes ] state is [ Ended ]

Add the following actions to the second macro:

[ Switch scene ]
Switch to scene [ Previous Scene ]
(Check the "Wait until transition to target scene is complete" checkbox)

[ Scene item visibility ]
On [ Scene - Memes ] [ Hide ] [ Source ] [ Media Source - Memes ]

Now we should be good, right? Well, almost. While we react to changes in the file thanks to the macro and switch between the scenes, we still do not set the media file on the source. This is handled by the Lua script which we must set up as a final step.

Setting up the Lua script

Open the Scripts window via Tools – Scripts and add the VideoFileFromText.lua script.

You should see some options on the right side of the window.

Set the interval to 50ms, browse to select the same text file you used on the Elgato StreamDeck button for the Video File List, and select the “Scene – Memes” scene for the Scene, as well as the “Media Source – Memes” for the Media Source. Finally, check the “Enable script” button and you are done.

Tying it all together

Be sure that the Advanced Scene Switcher is active and press the button on the StreamDeck. The scene should switch to your Meme scene, play the video and then switch back. Add another button on the StreamDeck that writes a different video file path to the same text file.

Now press the new button, and the second video file should play.

This makes adding short clips really simple and pain-free. No need to manually create multiple scenes or deal with multi-action steps on the StreamDeck. Adding a new video is as quick as adding a new button, setting the path to the desired media file and giving it a nice button image.

Of course, this is just the solution that I came up with, so your mileage may vary.

However, I do think that the inherent simplicity makes it an ideal solution. What do you think?

Content-based file search with Powershell and FileLocator

I love Powershell. Unfortunately, as soon as we cross into the realm of trying to grep for a specific string in gigabytes worth of large files, Powershell becomes a bit of a slowpoke.

Thankfully I also use the incredible FileLocator Pro, a highly optimized tool for searching file contents – no matter the size. The search is blazingly fast – and you can easily utilize FileLocator’s magic within Powershell!

For the sake of clarity: I will be using Powershell 7.1.3 for the following example.

# Add the required assembly
Add-Type -Path "C:\Program Files\Mythicsoft\FileLocator Pro\Mythicsoft.Search.Core.dll"

# Prepare the base search engine and criteria
$searchEngine                      = New-Object Mythicsoft.Search.Core.SearchEngine
$searchCriteria                    = New-Object Mythicsoft.Search.Core.SearchFileSystemCriteria

$searchCriteria.FileName           = "*.log"
$searchCriteria.FileNameExprType   = [Mythicsoft.Search.Core.ExpressionType]::Boolean

$searchCriteria.LookIn             = "C:\Temp\LogData"
$searchCriteria.LookInExprType     = [Mythicsoft.Search.Core.ExpressionType]::Boolean

$searchCriteria.SearchSubDirectory = $true

$searchCriteria.ContainingText     = ".*The device cannot perform the requested procedure.*"
$searchCriteria.ContentsExprType   = [Mythicsoft.Search.Core.ExpressionType]::RegExp

# Actually perform the search, $false executes it on the same thread as the Powershell session (as in: it's blocking)
$searchEngine.Start($searchCriteria, $false)

foreach($result in $searchEngine.SearchResultItems)
{
   # SeachResultItems are on a per-file basis.
   foreach($line in $result.FoundLines)
   {
      "Match in $($result.FileName) on line $($line.LineNumber): $($line.Value)"
   }
}

Wowzers, that’s pretty easy! In fact, a lot easier (and quicker, to boot!) than playing around with Get-Contents, StreamReaders and the like.

One thing of note here: Between running this on a loop for every file in a directory, it is actually quicker to process an entire tree of folders/files. The larger the dataset, the larger the gains through invoking FileLocator.

And yeah, you can use FileLocator on the command line through flpsearch.exe – however the results are not as easily digestable as the IEnumerables you get through the assembly.

Launching FBA’s MVS Mode

FB-Alpha is an awesome piece of software. For the games I play (mostly NeoGeo games) it’s damn near perfect because it has an emulated MVS mode where you can queue up to 6 Neo-Geo cartridges and cycle through them after inserting a token. The only thing that urks me is the absence of a dedicated MVS switch to start the emulation directly, without me pressing enter first.

Lucky enough that’s where AutoIt comes in handy:

[code language=”ahk”]
; +——————————————————–+
; | |
; | FBA NeoGeo MVS Launcher |
; | |
; | Launches FBA in MVS mode and automatically applies the |
; | last cartridge configuration used. |
; | |
; +——————————————————–+

Global $executable = "fba64.exe";

If FileExists("fba.exe") Then
$executable = "fba.exe";
Else
$executable = "fba64.exe";
EndIf

If FileExists($executable) Then
ShellExecute("fba64.exe", "neogeo");

While Not WinActivate("Select cartridges to load…");
Sleep(500);
WEnd;

WinWaitActive("Select cartridges to load…");
Send("{ENTER}");
EndIf
[/code]

Simply compile the script, drop it into your FBA directory and pre-configure the MVS slots in FBA. Launch the script afterwards… and yeah, that’s it.

For your convience there’s also a precompiled version available.

Be sure to set the Neo-Geo BIOS to the correct 6-slot system, otherwise you obviously cannot cycle through the games.

Windows 7 – Enable concurrent RDP + multiple sessions per user

Let’s all admit it: Microsoft is still a bitch. Nowadays they try to push Metro down our throats, in the past they artificially limited the number of concurrent RDP sessions – and what’s worse: Limited the sessions to 1 per user on their client operating-systems. There’s no reason for limiting RDP on client systems (except for making it a premium feature) but a ton of scenarios where I need to be able to log-on more than once [with the same username] onto my workstation. Now, if you’re on a non-Ultimate version of Windows 7 you might be out of luck, but if you run Ultimate the following might be just what you’re looking for: Enter Concurrent RDP Patcher. Applying the patch is simple: Download, unpack and run it. Afterwards you’ll need to make a small change to your registry. Navigate to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server

and create/modify the following DWORD value with the value 0:

fSingleSessionPerUser

After a simple reboot you’ll be able to connect to your machine – multiple times. As usual when putting your fingers where they don’t belong, make sure you keep a backup of your original termsrv.dll (can be found in your system32 directory) before getting started.

Softsubs and XSplit

One of the things many people miss from XSplit is the ability to add a subtitle renderer like VSFilter to the graph. It simply doesn’t work – no matter how much you force HaaliSplitter to load VSFilter or ffdshow to enable the subtitle renderer – the subs won’t show.

As with so many other things in life there’s a workaround that sort of works: You can use Dxtory’s virtual camera to capture the window of (for example) MPC – including the already rendered subtitles. That way you can get the subs to show up.

Getting Unreal Tournament (1999) working on current Linux distros

Let’s be honest: Unreal Tournament, or UT99, is not only a piece of gaming history – it’s also still a very vibrant and active game. What’s even better: The game has a native Linux client, so there’s no shortage of fun to be had.

But there’s a problem: The client was made around the year 2000 and Linux has evolved since that time. There are a few guides around to help installing and troubleshooting UT on Linux but I didn’t find them particularly helpful. So here’s my attempt, maybe some will find it somewhat useful.

Please note that this is specifically for the original version of the game, not the Game of the Year or GOG editions.

What we need:

1. Insert the CD-ROM into your drive and be sure to mount it to /cdrom.

2. Install UT by using the Loki installer:

$ export _POSIX2_VERSION=199209
$ chmod +x ut-install-436.run
$ ./ut-install-436.run

If the installer won’t run because you’re on x86-64, simply start it by using ./ut-install-436.run –keep, browse the new ut-436 subdirectory and edit the setup.sh’s DetectARCH to look like this:

DetectARCH()
{
echo "x86"
return 0
}

Other errors can be ignored.

Now install the UTG patch 451 by unpacking it into your UT/System directory.

Open ~/.loki/ut/System/UnrealTournament.ini, find the line:

AudioDevice=ALAudio.ALAudioSubsystem

and replace it with:

AudioDevice=Audio.GenericAudioSubsystem

Now you should be able to start the game by typing:

padsp ./ut

 

Jumbo Frames, LACP, NFS

Now that my server is basically up and running for a while it’s time to get the neat stuff running 🙂 .

A to-do item on my list has always been enabling jumbo frames and LACP on my Opensolaris installation. So, let’s get this kicking!

Jumbo frames use a MTU of 9000 instead of 1500. Since I’ve aggregated nge0 and nge1 to aggr1 I can simply set the MTU of the aggr and the corresponding values will automatically be set on nge0 and nge1 (even if you don’t see them 😉 ):

ifconfig aggr1 unplumb
dladm set-linkprop -p mtu=9000 aggr1
ifconfig aggr1 plumb

Sweet stuff! Don’t forget to re-configure the address, netmask and gateway for the link. Now I want to enable LACP so I can make use of the combined throughput of the NICs:

dladm modify-aggr -L passive 1

Let’s check whether everything’s up and running as intended:

tsukasa@filesrv:/$ ifconfig aggr1
aggr1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 9000 index 2
inet 192.168.X.X netmask ffffff00 broadcast 192.168.X.X
tsukasa@filesrv:/$ dladm show-aggr 1
LINK            POLICY   ADDRPOLICY           LACPACTIVITY  LACPTIMER   FLAGS
aggr1           L4       auto                 passive       short       -----

And indeed, everything went smooth.

Now, even with this boost in performance watching HD video over the network sometimes stuttered with many concurrent connections/operations going up- and downstream at the same time. Also, the Opensolaris 2009.06’s CIFS service has the unpleasant habit of dying and refusing to come up again until I reboot, so I went the easy way and simply enabled NFS for this ZFS system (can we call this a system? Mount? I don’t know…):

zfs set sharenfs=on filesrv/video

I didn’t have to do anything else or specify explicit rw options since I already mapped all the stuff before. Now, the only thing left to do:

mount filesrv:/filesrv/video /home/tsukasa/video -t nfs -o defaults,users,noauto,rsize=8192,wsize=8192,timeo=14,intr

And guess what, no more problems 🙂 .

Howto: Run Vector Magic Desktop Edition with Wine

Vector Magic is pretty cool. I loved the project back in the days when everyone could use it for free and was happy to see that they started providing a desktop client after going commercial. Even better: The client is utilizing Qt so we have a Windows and a Mac version. But nothing for Linux.

Don’t fret, of course you can run this application with Wine:
The only thing to notice here is that you need to set your Windows version to Windows 98, otherwise the application will always go haywire when loading a picture.

vectormagicwine

All features are working perfectly, no native DLLs needed.

Stopping Sweetcron from breaking with too long posts

Okay, now this is really really bad, starting with MySQL 5 there is a strict mode. What does that mean? The strict mode will not silently swallow all your data and just cut off what’s left but throw an exception back at you when you try to insert more data than the field type allows.

Sweetcron is really vulnerable for this kind of problem. It always stopped fetching the feeds to complain about a single post. Now, while fixing the problem on the software side would be preferrable I opted for a simple configuration change on the server side this time.

All you really need to do is altering the my.ini line that activates the strict mode:

sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”

will either become

#sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”

or

sql-mode=”MYSQL40″

Simply restart the MySQL service afterwards and sweetcron should eat the posts without complaining (I don’t even want to think about the loss of data here, but who cares?).

How to deactivate (revoke) Far Cry 2

Far Cry 2 comes with a nasty copy protection. Actually, it’s more like a strict DRM variant that needs to be activated online and can only be used X times when not properly deactivating it.

You can manually revoke an activation without uninstalling the game by simply calling:

FarCry2.exe /revoke

Easy, huh? I’d prefer Ubisoft to not use any of these bugger DRM crap at all, but then again we all know the story of software piracy (note: pirates probably have a better version without this crap, so this whole thing is totally beyond the point anyway!).

Making the NX Client portable

NX is great. I’m deeply in love with it. Sometimes it’s acting like a real jerk, though. The NX Web Companion is installing a lot of crap into the active user’s profile. The NX client writes stuff in the active user’s profile. Both isn’t really convenient for me.

I prefer to have all my settings with me on a USB thumbdrive. So, in the spirit of PortableApps I’ll show you how to simply turn NX into a portable application.

First thing to do is installing NX client on a machine, if you have installed already – that’s fine. Copy the entire program folder to a new directory structure like NxClientPortable\App (I’ll follow the PortableApps schema here). In NxClientPortable create a new directory named “Data” and a batch file with the following contents:

@echo off
set USERPROFILE=%CD%\Data

App\nxclient.exe %*

reg delete /f /va "HKCU\Software\Cygnus Solutions"
reg delete /f /va "HKLM\Software\Cygnus Solutions"

That’s it. Start the batch file and you’ll be fine. No need for installations, no files in some stranger’s profile. Everything goes back to your thumbdrive neatly.

This example also demonstrates why batch still isn’t dead: The USERPROFILE variable will be changed just within the scope of our batch file, all other applications will still use the path specified in the “global” instance of the variable.