Author Topic: Fixing Blockland Gamma in Wine: An Exhaustive Tutorial  (Read 797 times)

NOTE: This is a tutorial for proficient users of Linux and the like. Alcoholics Wine connoisseurs, please leave.

DISCLAIMER: No warranty is given as to the working of this. It may cause memory leaks, let hackers in, both of these at once and explode your computer too. That being said, an improperly patched executable shouldn't usually do more than crash.

DISCLAIMER VERSION FOR THE LAWYERS (it's supposed to mean exactly what the one above does): THE TUTORIAL IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TUTORIAL OR THE USE OR OTHER DEALINGS IN THE TUTORIAL.


Have you ever run Blockland 556 times without reboot just to discover that your screen is now completely white? No? Well, I haven't, too.
I have, however, run it ten times, and that was enough to notice that my screen was now noticeably whiter.

Further research revealed that my screen had by then its gamma increased by somewhere around 1.8%, a blazing 0.18% per launch. as long as my calculations are right since linux is mad

Now, before I elaborate as to how to fix that quirkyness, mind you a small Better Unasked Questions section...


But what does a rock band/Greek letter/radiation/brain wave type/statistical test/an encoding method have to do with Blockland?
Think of gamma as of a weird sort of brightness. Still not getting it? The tutorial's not for you.

What do you mean by "further research"?
xgamma and xrandr --verbose | grep Gamma.

Aargh! Go away, haxor!
...How about you just reboot every fifth run?


With that out of the way, let's go straight to the fixing.

Please choose the appropriate OS.

Windows and other noncompliant mess non-*nixes
That has the issue too? TIL. Find a random editor capable of modifying a binary without completely destroying it (a hex editor comes to mind) and replace the string "SetDeviceGammaRamp" with "GetDeviceGammaRamp" in C:\Program Files\Blockland\BlocklandLauncher.exe. If you're on 64-bit Windows, instead of Program Files, the folder Blockland is in Program Files (x86). Done.

Linux and other *nixes
Open the command line and run xgamma.
Code: [Select]
xgamma
Change the directory to the one containing the file BlocklandLauncher.exe. The following command should work for you. If it doesn't, it means that either you should know better where that directory is, or you use PlayOnLinux (or similar GUI mess). Don't use that, for it's evil; instead, grab some nice, raw wine-staging and use Wine like your native applications.
Code: [Select]
cd ~/.wine/drive_*/Program\ Files*/Blockland
Now that you're here, run the following command to patch BlocklandLauncher.exe.
Code: [Select]
sed -i 's/SetDeviceGammaRamp/GetDeviceGammaRamp/g' BlocklandLauncher.exe
It should be patched now. Run Blockland, wait for it to start and close it, then run xgamma again.
Code: [Select]
xgamma
If its output is same as the previous one, congratulations. It's fixed.

MacOS
While the recommended route is installing the MacOS version of the game, you may want to use the Windows version in Wine to fix certain issues in the game. In this case, the Linux tutorial should mostly work as intended, it wasn't however tested and may have issues with the command xgamma. In that case, just stare at the darker spots of your screen while the launcher is running.

I believe I actually suffer from this issue but have no idea what all of the above means nor what OS I use
Ask someone you consider competent with computers to apply the above steps for you. Done.


I would have just posted the patched BlocklandLauncher.exe, but that's not only vulnerable to h4xx0rs but also bannable, so enjoy this.

badspot pls fix
« Last Edit: March 17, 2017, 02:32:29 PM by Kikanek »

Wait, so your saying that repeat relaunches of Blockland will increase the gamma of your monitors by a noticeable amount?

I've never noticed anything like that, but I'm interested.

Yep, but I've only so far noticed this behavior with my wine-staging installation on Arch Linux, happened since at least a few versions. It's probably something with Wine interpreting a local gamma change call as one to apply for the whole screen, passing it to X.

Huh, I'd like to see if I can replicate the issue.
That would be spooky if it wasn't just your build.

This only happens with the launcher? Explains why I didn't notice anything.