Thursday, January 23, 2014

Python Script to Remove Unbreakable Blocks in Robominer


Robominer is an Android game where you use a robot to drill around searching for a diamond. There are blocks that can't be drilled, so you have to either go around them or use dynamite to blow them up. After a while, I got really annoyed dealing with these blocks. So I poked around and found a way to replace them with other blocks.

Basically, when you save a game, it saves the entire map too. This includes the types and locations of all of the blocks. The save file can be modified to remove the unbreakable blocks.

I have SL4A and Python installed on my Android device, so I wrote a Python script I can run on my device to make the changes for me. If needed, you can also copy the file to a PC, run the script, and then copy it back. Note, however, that the script has to be run on every new level. Being able to run the script on the device is a lot more convenient.

Here is the script. It assumes your saved game file is on the SD card. I don't think you can modify the save file in the "Phone" slot unless your device is rooted.



#!/usr/bin/python
# Replace gray blocks with regular blocks on Android app Robominer
#
# 01-15-2013: Created by BitJunkie
# 01-16-2013: For gray blocks, generate random mineral type
# 01-22-2013: Block info starts 3 bytes before 0x3f80, adjust file pointer info
import random 

count=0
random.seed()
# Open the file in binary mode for reading and writing
fh=open("/sdcard/Android/data/com.rnet.robominer/files/last_1.sav","rb+")

# Go to the beginning of the block info +3 bytes, from the beginning of the file
fh.seek(0x30, 0)
header = fh.read(2)

while header == b"\x3f\x80": 
  fh.seek(-4,1)  # Move file pointer to start of block info
  blk = fh.read(1)
  if blk == b"\x01": # if block is gray
    fh.seek(-1,1)
    fh.write(b"\x02")  # Make it regular 
    r = random.sample(["\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08","\x09","\x0a","\x0b","\x0c","\x0d","\x0e","\x0f","\x10","\x11","\x12"],1)
    fh.write(r[0])  # Add random mineral/element
    fh.seek(13,1)  # Go to next block
    count+=1  # Count how many blocks are changed
  else:
  # Go to next block header
    fh.seek(14,1)
  header = fh.read(2)

print "Blocks changed: %d" % count

I have only used this for games on the "Easy" level. I'm sure the script would have to be modified for the higher difficulties.

Have fun!

Thursday, January 9, 2014

Gift Codes for Despicable Me: Minion Rush

Updated 5/14/2015. See below.
Updated 3/28/2015. See below.
Updated 2/11/2015. See below.
Updated 12/10/2014. See below.
Etc., etc.

NOTE: Comments are moderated, so it might take a while for posted comments to show up.

Despicable Me: Minion Rush is a running game for Android (maybe other OSes too). If you select Options from the main screen and press the gift icon, you can enter codes here to get some goodies. Here are the codes I've found so far.

Use the up and down arrows to select different minion types. The different types are: classic, baby, maid, golfer, dancer, firefighter, and dad.

classic, firefighter, baby: Unlock Baby minion
baby, dancer, golfer: Unlock x5 score perks
baby, firefighter, maid: Unlock x5 banana points
maid, classic, golfer: Unlock loser taunt
dancer, firefighter, dad: Unlock x3 minion launcher
----------------------------------------------------------------------------
May 14, 2015 Update: Version 2.8.0k; Content Version 421 (also Version 2.8.1d) 
Looks like gift codes have been removed in this update.
----------------------------------------------------------------------------
March 28, 2015 Update: Version 2.7.1c; Content Version 412
This update adds an April Fools Day special mission. But I didn't find any new gift codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
February 11, 2015 Update: Version 2.6.2c; Content Version 398
This update adds a Valentine's Day special mission. But I didn't find any new gift codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
December 10, 2014 Update: Version 2.5.0p; Content Version 383
This update adds special missions, in particular the Arctic Base mission. But I didn't find any new gift codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
November 10, 2014 Update: Version 2.3.1a; Content Version 370
I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
November 8, 2014 Update: Version 2.3.0f; Content Version 370
No surprise, I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
October 21, 2014 Update: Version 2.2.1f; Content Version 367
I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
September 18, 2014 Update: Version 2.1.0m; Content Version 343
I didn't find any new codes in this update. I'm starting to think this feature isn't used anymore. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
August 20, 2014 Update: Version 2.0.3b; Content Version 326
I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
July 30, 2014 Update: Version 2.0.2e; Content Version 325
Big update. The game mechanics have changed, but gameplay is about the same. But I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
May 26, 2014 Update: Version 1.8.1g; Content Version 294
I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
May 14, 2014 Update: Version 1.8.0u; Content Version 289
I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
March 22, 2014 Update: Version 1.7.2; Content Version 227
I didn't find any new codes in this update. If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
February 10, 2014 Update: Version 1.6.1b; Content Version 202
I didn't find any new codes in this update. :( If you find any, please leave a comment to let me know.
----------------------------------------------------------------------------
January 2014 Update: Version 1.6.0u; Content Version 200
Golfer, golfer, baby: x3 Score Perks

Golfer, dancer, dad: 20 Tokens

Dancer, maid, baby: x3 Banana Perks

Dad, baby, dancer: 1500 Bananas


Enjoy!

Thursday, November 7, 2013

Colors and Split Screens in Vim

Here is some info on vim that I put here mainly for my reference. Maybe someone else will find them useful.

Color schemes
Set the color scheme in .vimrc, e.g. add a line like "colorscheme ron"
In vim, you can list the color schemes with ":colo <TAB>" (space after "colo")
If no colors after setting the color scheme, make sure syntax is enabled. In .vimrc add the line "syntax on".

Editing Multiple Files
:ls - List open files
:n or :bn - Go to next file
:p or :bp - Go to previous file
:b10 - Go to 10th file
:b foo - Go to file named "foo"
:b <TAB-KEY> - Cycle through open files (space after ":b")
CTRL-w v - Split screen vertically
CTRL-w s - Split screen horizontally
CTRL-w h and CTRL-w l - Switch through vertical windows
CTRL-w k and CTRL-w j - Switch through horizontal windows

Wednesday, September 4, 2013

Android Google Services Data Usage is Huge

If you have a Nexus device running a custom ROM, you better check your data usage. A lot of people have noticed a huge spike in data usage on these platforms. The problem might not be limited to Nexus devices, but it is a problem with custom ROMs based on Android 4.2.2 and earlier. It seems to have started around the end of August. Some speculate that Google Services is downloading the Android 4.3 update, which fails since the ROM is custom, and then downloads the update again, etc.



I ran into this problem on my Nexus 7 (2012) running AOKP. This is how I fixed mine (hopefully, so far so good). Note that your device must be rooted, but if you're running a custom ROM, I assume it is.

  • Download FOTAKill.apk from CyanogenMod or from XDA
  • Move the APK to the /system/app folder (remember to remount /system read-write)
  • Change owner/group to root/root and change permissions to 0644 (not sure if this is needed, but I did it to match existing apps)
  • Reboot to recovery and wipe the cache
  • Reboot and done
Hope this helps someone out there.

Monday, August 19, 2013

Disable the Touchpad and Trackpoint Pointer in Linux

The mouse pointer on my Arch Linux system was going crazy. It was drifting badly and my mouse was unusable most of the time. Very frustrating. I thought I narrowed the problem down to a hardware issue on the touchpad. I have a USB mouse, so I don't really need the touchpad. I came across this script to toggle the touchpad on and off.
#!/bin/bash
synclient TouchpadOff=$(synclient -l | grep -c 'TouchpadOff.*=.*0')
This does indeed toggle the touchpad, but my problem still remained. So, the touchpad wasn't the problem. Then I saw the Trackpoint pointer sitting in the middle of my keyboard (otherwise known as an eraser pointer or the colorfully nicknamed clit mouse). So I dug around and found I could disable it easily enough. First, get the name of the device by running:
xinput
In my case the name is "TPPS/2 IBM TrackPoint". Then disable it with this:
xinput set-prop "TPPS/2 IBM TrackPoint" "Device Enabled" 0
Problem solved. Hopefully someone else will find this useful.

Tuesday, August 13, 2013

Setting up a Gogo6 / Freenet6 IPv6 tunnel in Linux

It's 2013....where's my IPV6? IPv6 was introduced to alleviate some of the problems with IPv4. It's been available for well over 10 years, but the internet is slow to adopt the new format. I wanted to start using IPv6 to become familiar with it but, like most ISPs, mine doesn't offer native IPv6.

When native IPv6 isn't available, one option is to use a tunnel broker. Basically a broker sets up a tunnel between your device and an endpoint at the broker. IPv6 is encapsulated in an IPv4 packet, sent through the tunnel to the broker, then sent out from there as IPv6. I looked at three brokers: Hurricane Electric, SixXS, and Gogo6 (which owns Freenet6). I chose Gogo6 for several reasons: it allows NAT traversal, it allows anonymous connections (the other two require registration), and it is touted as the easiest to set up. One of the down sides of using Gogo6 is that it currently appears to only have two Points of Presence (PoP), Montreal Canada and Amsterdam Netherlands. This is the location of the broker server, so your IPv6 traffic will appear to come from one of these areas.

To install the Gogo6 client in Ubuntu, run the following:
sudo apt-get install gogoc
This will install both gogoc and radvd. The radvd package is only needed if you plan on routing IPv6 from your PC. All done! You should now have an anonymous tunnel up and running. Test it by running
ping6 -c 5 ipv6.google.com
The tunnel will start when the system starts. If you don't want this, run
sudo mv /etc/rc5.d/S20gogoc /etc/rc5.d/s20gogoc
Then you can start and stop the tunnel with
sudo /etc/init.d/gogoc start
sudo /etc/init.d/gogoc stop

To install the Gogo6 client in Arch, install it from the AUR. Since this is Arch, I'll assume you know how to install a package from the AUR. To create the tunnel and start using IPv6, run (as root)
systemctl start gogoc
Wait a few seconds for the tunnel to come up and try pinging ipv6.google.com as above. If there are no problems and you want to create a tunnel when the system starts, run
systemctl enable gogoc

Anonymous connections are fine to play with but the IPv6 address will change when your IPv4 address changes. I suggest registering for an authenticated tunnel at Gogo6. This will get you a static IPv6 address, a DNS entry (e.g. username.broker.freenet6.net), and a /56 prefix (so you can set up a router and give out IPv6 addresses to the devices on your network if you want). If you do register, you'll have to edit the /etc/gogoc/gogoc.conf file and enter your username and password, and change the server to the authenticated one.

A couple of notes: IPv6 addresses are globally accessible, so make sure you have a firewall and that it is properly configured. And since traffic is going through a tunnel, speed will be impacted somewhat. Here are some of my speedtest results. Top bar (green) is IPv4 and bottom bar is IPv6.


Finally, here are some sites that might be of interest.
ipv6test.google.com
ipv6-test.com
ip6.me/
www.subnetonline.com/pages/ipv6-network-tools/online-ipv6-traceroute.php

Wednesday, August 7, 2013

Boot Multiple OSes Using Your Android Device and DriveDroid

DriveDroid is a neat app that allows you to boot ISO and IMG files that are stored on your Android device, just like you are booting from a USB drive. You can download a lot of images from within the app. You can also create blank images, but I haven't used this feature.

Your device must be rooted to use this app, so if it's not then this app isn't for you.

The process is quite simple. Start DriveDroid and press the "+" button and select "Download image" to get a list of available images. Select a distribution and then select the file you want. For the first time, I suggest trying Slitaz, since it is only about 35MB. Once it is downloaded, it will show up on DriveDroid's main screen.



To boot from an image, select it in DriveDroid, and select the host mode (e.g. Writable USB, etc). Then, connect the Android device to a PC using a USB cable and boot the PC. The PC will boot the selected image. If the image doesn't boot, check the PC's BIOS settings and make sure "Boot from USB" is set as the first boot device.

To stop hosting, just tap the DriveDroid icon in the Android notification area.


One requirement for the ISO images is that they must be in hybrid format. To check an ISO, type
fdisk -l file.iso
If no partition table is found, the ISO is not in hybrid format. One of my favorite tools, SystemRescueCd, isn't in this format. To make it work, all I had to do was download the ISO and run
isohybrid file.iso
This changes the file to the correct format and then it works with DriveDroid just fine.

DriveDroid makes it easy to try out new distributions. And with the right tools, your Android device can be an invaluable recovery tool.