Hörmetjan Yiltiz http://hyiltiz.github.io 2019-03-07T10:44:17+00:00 hyiltiz@gmail.com EverWing superpowers, poor JavaScript web app game twicks http://hyiltiz.github.io/en/15-06-2017/EverWing-superpowers-poor-JavaScript-web-app-game-twicks.html 2017-06-15T00:00:00+00:00 Hörmetjan Yiltiz http://hyiltiz.github.io/en/15-06-2017/EverWing-superpowers-poor-JavaScript-web-app-game-twicks One day, Facebook suggested me to play EverWing “because some of my friends also play it”. It is a slide and shoot game with very basic game mechanics. You have several characters (like planes) to upgrade, and some dragon babies to fly along and fire along. Those are also upgradable. Game is very straightforward without any complexity, thus nothing is really rewarding; even with the best things you can get, you still play the same game as you did at day 1, and will be almost as effective as you were after about 2 hours of playing.

At some point, someone in a Facebook game group blocked another accusing that the player was cheating. Well, I wasn’t aware of being able to do that, as a well designed web game should always run game mechanics at the backend, and only do IO related stuff at the front end, such as rendering graphics and sound, collecting input interactions from the player etc. Well, this game wasn’t.

The game is a huge bloated JavaScript file that runs on the clientside, and is MIT licensed. So, I could go ahead and dig into the code.

With about 3 hours of playing around, I taught myself JavaScript again (I did once about five years ago), and with the help of searching and StackOverflow for basic syntax and library functions, I came up with the following script, which gives maximum game points, upgrades everything to maximum, unlocks everything.

For the hack, run the game in a desktop browser, open the browser’s Developer Tools, place a stopping point in the debugger at the definition of the function Query.prototype.run, and change some game settings until game stops at the breakpoint and goes into the debugging mode. Then, paste this snippet in the Console and run the game. Game will hit the breakpoint consecutively for several times, and will try to change back the original values once, so simply run the snippet every time game stops at the breakpoint until game continues. Then, remove the breakpoint, and play your game with super powers!

/*!
* Copyright 2017, hyiltiz@gmail.com
* Released under GNU GPLv3+ license.
* More information: https://www.gnu.org/licenses/gpl-3.0.en.html
*/

/* Variables found by inspection and trial, 
/* valid max values found by trial and error.

Object.keys(e).forEach(function(key) {
    if (/sidekick:...._zodiac/g.test(e[key].schemaPrimativeID)) {
        e[key].maximum = 50;
        e[key].value = 50;
    }
    if (/sidekick:...._zodiacbonus/g.test(e[key].schemaPrimativeID)) {
        e[key].maximum = 2;
        e[key].value = 2;
    }
    if (/sidekick:...._maturity/g.test(e[key].schemaPrimativeID)) {
        e[key].maximum = 3;
        e[key].value = 3;
    }
    if (/sidekick:...._xp/g.test(e[key].schemaPrimativeID)) {
        e[key].maximum = 214000;
        e[key].value = 214000;
    }
    if (/character:jade_item_character/g.test(e[key].schemaPrimativeID)) {
        e[key].state = "idle"
    }
    if (/character:jade_stat1/g.test(e[key].schemaPrimativeID)) {
        e[key].maximum = 50;
        e[key].value = 50;
    }
    if (/character:arcana_item_character/g.test(e[key].schemaPrimativeID)) {
        e[key].state = "idle"
    }
    if (/character:arcana_stat1/g.test(e[key].schemaPrimativeID)) {
        e[key].maximum = 50;
        e[key].value = 50;
    }
    if (/currency:trophy/g.test(e[key].schemaPrimativeID)) {
        e[key].balance = 99999;
        e[key].value = 99999;
    }
    if (/currency:coin/g.test(e[key].schemaPrimativeID)) {
        e[key].balance = 999999;
        e[key].value = 999999;
    }
});
]]>
Fix Firefox address bar Enter bug http://hyiltiz.github.io/en/04-04-2017/Fix-Firefox-address-bar-Enter-bug.html 2017-04-04T00:00:00+00:00 Hörmetjan Yiltiz http://hyiltiz.github.io/en/04-04-2017/Fix-Firefox-address-bar-Enter-bug I love using Firefox (can’t wait to see Servo up and running!). Now, for some unknown reason, my fresh installed Firefox 52, 53, 54 (Stable, Beta and Aurora/Developer version) in a new macOS iMac computer is having very annoyingly:

[Command+L]google.com[Enter]

When you press Enter, Firefox should open https://www.google.com/. However, nothing happens. You press Enter frantically yet nothing happens, until you reach over to your mouse, click on the -> arrow to the right of the address bar. This behavior persists even if you start Firefox with the -safe-mode without any add-ons.

I looked all around the Internet, through Firefox bug reports, and forums, but nothing helped. After one day of digging through, I found a work-around and a fix:

Workaround

Before pressing Enter, just press Space.

[Command+L]google.com[Space][Enter]

Pressing Space triggers the search in the Address bar, then pressing Enter executes the top action in the search from the address bar: go to site.

You would’ve thought that, being a browser, going to a website or opening a URL doesn’t require any extra Spaces.

Fix

Open about:config (you still have to press Space for the first time). Look for a key called browser.urlbar.autoFill. Click on its value to set it to false, which disables the dumb extra Space requirement. Chrome has similar features in the address bar, and they did not require an extra space bar to function well, so I assume it might as well be a bug in Firefox.

]]>
The Bridge http://hyiltiz.github.io/en/11-02-2015/The-Bridge.html 2015-02-11T00:00:00+00:00 Hörmetjan Yiltiz http://hyiltiz.github.io/en/11-02-2015/The-Bridge The Bridge

Once there was a man. And a woman.

And there were a world. He lived a happy but solitary life seeking for his soul mate. And she kept reminding herself that she felt lonely and needed a company.

He was young and handsome. She was young and beautiful.

Everyday he woke up to find himself in a feeling that he is getting closer to his soul mate; she told herself every single night before going to bed that the one to keep her company for the rest of her life will soon be found.

At last came that day.

He was walking past a lake as bright as the sun, when he saw her for the first time of his life. But she had a memory as clear as the lake that it was only yesterday that she was with him.

And each loved the other.

Next day, she found him at the top of a mountain. She was sure that he was the one she needed since the beginning of dawn; he was certain that she was his very soul mate since there was light.

And each agreed to meet the other next day under a tree by the river, where the birds danced to the melody of the waters.

That day, she went straight to the tree by the river, instead of going back home. He went back home to get the ring so that he could ask her to marry him the next day.

She stayed under the tree that night, listening to the melody of the waters, and spent the next day watching the birds dance. But he was nowhere to be seen.

Then she went back home wearily with a broken heart.

He woke up and felt his heart was unquiet, leaping desparately for something. He ran towards the river, and waited for her for a day and a night. But she was nowhere to be seen.

Then he went back home exhausted with a broken heart.

Next day, each met the other on the way to the market where garneners offered the best of their fruit. But neither recognized the other; each bought some fruit and went on.

Oh my dear, I will love you in my dreams where you are living in your reality; and you will wake me up from my dreams into yours, and we shall be together for ever and ever afterwards.

]]>
Tumiki Fighters Cheat to be Invincible and Super-powerful http://hyiltiz.github.io/en/11-03-2014/Tumiki-Fighters-Cheat-to-be-Invincible-and-Super-powerful.html 2014-03-11T00:00:00+00:00 Hörmetjan Yiltiz http://hyiltiz.github.io/en/11-03-2014/Tumiki-Fighters-Cheat-to-be-Invincible-and-Super-powerful Introduction

Among all those interesting games under GNU/Linux, Tumiki Fighters is one of my favourite.

In this funny game, you can not only shoot and destroy your enemies, you can even catch their broken pieces for protection as well as for bonus points. They even shoot for you! Yes, the more you got those stuck pieces, the more it gets complicated to protect them. But don’t worry! You can pull them in, so that you are small enough to dodge bullets! This time your bullet goes straighter than normal.

Mischief

There are many tricks and cheats that benefits (benefits?) the player. Espacially when it comes to POSIX compliant systems, such as GNU/Linux, Android, iOS, Mac OS X, BSD etc. You can look into the data files of the game, and also monitor the game process, and interfere its state.

For the latter, you can peek into /tmp while pausing the game, and saving the correspondsing data files if your game progress is promising. You can even change some data in /tmp and /proc in those corresponding areas. As this just may depend on how the software is implemented. You can play around if you are interesed.

We are going to enjoy the freedom that GPL gives us; run it as we wish, and modify if we’d like to. Tumiki Fighters is such a fun to play, and even more interesting if you prefer to poke around its source code. The game has been written by Kenta Cho cs8k-cyu@asahi-net.or.jp

Tutorial

Enough talking for now. Let’s just go get its source, change whatever we like, and then compile it to have fun.

I am using Debian, following its testing branch. If you are using other OS, the basic procedure would be the same, but you may have to use your own package management system, such as yum, or ports.

First, get its source, and install the dependencies for successful compilation.

$ sudo apt-get update & sudo apt-get upgrade $ sudo apt-get build-dep tumiki-fighters $ sudo apt-get source tumiki-fighters

So now we have the source code. What now? We can be super powerful, so that any enemy is nothing but another crunch standing in the way. Or, we can change the life system, so that we have more lives than the default 3.

Super Tumiki

As for being super powerful, or shall we say, invincible, we can just change some of the data files that the games loads before running. It is not hard coded in order to be compiled. The file in this case, is about our own ship. We look at our game directory /usr/share/games/tumiki-fighters/. With commands like find . or tree ., the games directory structure is so obvious. In the last, you can find a file ./tumiki/myship, where there is a table of numbers.

The file defines the pieces and their colors, the bullets, its attributes and speed, and how the pieces is combined. Backup the file with cp myship myship.bak, then change one parameter at a time, then run the game tumiki-fighters to see what is changed.

You can change the speed of your bullet, when it goes big enough, almost no enemy stands in your way. You can also make yoursolf very big, which helps you to stick enemies. Since you will die only when the center of the red center piece got bullet, it does you no harm to get superbig.

When you have enough found, remember to change the original file back, with cp myship.bak myship.

Invincible Tumiki

So what about the lives? It would have been nice if we had five or more ships that the default three.

A exquisite analysis of the game directory /usr/share/games/tumiki-fighters does not help us with that. You find that those data is only relevant with the structure of the game play, such as how is your ship, how is enemy ship, and how is the boss, how does they fire and so on. But for your life, there is no clue. ( Please DO NOT go look for it yourself, because you are most likely to be not able to find anything relevant. I did that already. That was an interesting journey, yet quite time consuming.)

So we come up with the following hypothesis: the life you left is hard coded in the game source, and compiled into binary. If this is the case, we have to read the code itself.

We already downloaded the code, and you can find that the game is written in D, another programming language quite like C itself. If you are reading this, as you are now, you know basic English, and that is enough for reading and understating the source code. Do not freak away!

And we do not have to read all of the source, and understand how the whole program is written, just in order to change a default value of 3 to something like 20. Here we use GNU coreutils such as grep, sed, awk, and find to hunt down the beast.

    $ cd /the/path/to/the/source
    # recursively look for char 3 and write the output
    $ grep '3' -r . > out
    # 3 should be alone, unlike 32,a3,3f, which get filtered
    $ sed -i 's/^.*\w3.*$\n//g' ./out 
    $ sed -i 's/^.*3\w.*$\n//g' ./out 

The original out file was more than one thousand lines. After filtering the obvious ones we are not looking for, we have a file about two hundred lines. Far better, yet not good enough. The file is a list of lines describing the filename of the occurrences 3 in all the source directory, and the line in that file. You can read each line, and go on filtering using your intelligence. So far, AI.

I believe you are not patient enough to go over this list of 200 more lines. Good! I made sure that all the occurrences of 3 have nothing to do with the beast we are hunting!

Consider the scenario. What if the programmer implemented the left life such a way, that it is not 3? Say, what if it is a 2 we are looking for. In which case, the game is over when our life is less than 0, rather than equal to zero. Quite possibly what a programmer prefers.

Rather than grepping all the lines that has a 2 in it and then filtering through them, let’s think of something else. We can look for keywords such as game over, game control, life manager so on.

Or just read the documentation. The game is poorly documented. Yet you can still find something useful in the README file.

The ship extends at 200,000 and every 500,000 points.

Looking for a number like 200000 or 500000 is far easier than looking for 0,2,3! We found our beast! This has something to do with life control.

    $ grep '200000' -r .

All the occurrences is in the file ./src/abagames/tf/gamemanager.d. Now open the file, and change what needs to be changed.

    $ sudo gedit ./src/abagames/tf/gamemanager.d




    int score;
    const int LEFT_BONUS_NORMAL = 10000;
    const int LEFT_BONUS_EXTRA = 30000;
    int leftBonus;
    const int LEFT_NUM = 2;
    int left;
    const int FIRST_EXTEND_NORMAL = 100000;
    const int EVERY_EXTEND_NORMAL = 300000;
    const int FIRST_EXTEND_EXTRA = 200000;
    const int EVERY_EXTEND_EXTRA = 500000;
    int firstExtend, everyExtend;
    int extendScore;
    const int BOSSTIMER_FREEZED = 999999999;
    ####### some other code ######
    if (score > extendScore) {
      SoundManager.playSe(SoundManager.Se.EXTEND);
      left++;
      if (extendScore <= firstExtend)
        extendScore = everyExtend;
      else 
        extendScore += everyExtend;
    ####### some other code ######

The study got its significant result, at last! We see every once the score exceeds extendScore, your get another ship for bonus, see left++ above.

So, change LEFT_NUM to some number larger that its original 2 (this is the proof that we should not have been looking for 3), to get your default life larger.

Change EVERY_EXTEND_EXTRA to about 200, so that about every 10 second in the game, you get another ship for bonus. Other numbers could also be changed to smaller, to get bonus ship quicklier.

Now we studied, and changed the code. Now build it, and run it!

    $ cd /to/the/source/path
    $ sh ./configure
    $ make

Now you can find the file tumiki-fighters in the source directory. Run it with ./tumiki-fighters.

Have fun!

]]>
Watching Progress of Processes like dd via Signals http://hyiltiz.github.io/en/14-05-2013/Watching-Progress-of-Processes-like-dd-via-Signals.html 2013-05-14T00:00:00+00:00 Hörmetjan Yiltiz http://hyiltiz.github.io/en/14-05-2013/Watching-Progress-of-Processes-like-dd-via-Signals May 7 of 2013 is one of the best moments of my life. Yanni arrived in Beijing, and we were able to be there at his convert. What a wonderful night!

And one of my friend took his camera that night to capture the amazing moments. And I must admit I was too noisy for him to catch a less disturbing music concert. Anyway, it recorded my passion and Yanni’s delicate and sublime and beautiful musics.

Data Broken!

But nothing can be too perfect! (Is this because in perfectness there is already a too?) 30 minutes of data cannot be played or even get copied via cp or dd due to a I/O error, though the camera itself can play all the files normally.

I used badblocks to find all the bad blocks in the card, and carefully used dd to avoid reading those blocks of data, using /dev/zero to fill them in. After this, a simple cat a b c > full and mount -o loop full /mnt will help open all the files. Mission accomplished!

The SD card was 32G, and using cp or dd gives no literally no output, letting us unable to know how long we are gonna wait. Most of my times I use gcp for this kind of big files, and since for this I had to use dd, I looked up the internet for showing progress in dd. And I found a way to do it.

Basically run the dd, and then send a USR1 SIGNAL to its process.

To illustrate, you run the following (valid, but perhaps not very useful) dd copy:

    # It will run for a few minutes as it copies (and immediately discards)
    # 100 blocks of randomly generated data, each of size 1 KB. 
    $ dd if=/dev/random of=/dev/null bs=1K count=100 

    # To get a progress report while dd is running, you need to open
    # another virtual terminal, and then send a special USR1 signal to the dd
    # process.
    $ pgrep -l '^dd$'
    8789 dd
    # To send the USR1 signal to the dd prcoess:
    $ kill -USR1  8789

    # After reporting the status, dd will resume copying. You can repeat the above
    # kill command any time you want to see the interim statistics. Alternatively,
    # you can use the watch command to execute kill at a set interval.
    $ watch -n 10 kill -USR1 8789

I found out another similar way to watch the progress of the process using the virtual filesystem /proc/. For the porpose described above, simply run:

    $ cat /proc/8789/io

The output is not exactly the same with what you’d have using USR1 SIGNAL, but it is much better than having nothing to look at when you are having a cup of coffee.

]]>
He Walks An Hour For Each Meal! http://hyiltiz.github.io/en/14-05-2013/He-walks-an-hour-for-each-meal!.html 2013-05-14T00:00:00+00:00 Hörmetjan Yiltiz http://hyiltiz.github.io/en/14-05-2013/He-walks-an-hour-for-each-meal! It has been a long time since he called me last time, and longer since we last met.

He was a good friend in high school. He has acute perspective to art, and with his beautiful drawings and guitar, he has always proving that. And he knows how and when to express sympathy towards peopling around him, and when necessary, reach out a helping hand. I always appreciated him.

Isn't he cool!

He applied the Sci-Tech University of China and I kind of influenced his choice here, mostly because I was not able to go to the University myself. And I was quite glad that he made it.

But we did not keep close contact since he went to the University. And I was wondering why. Recently I heard that the food offered in the University is very poor for Muslims. I felt very bad and more than sorry for him then.

Surprisingly he called yesterday morning. As we were talking, he told me we was just walking to a restaurant for a meal. And he has to walk there every day for every meal, unless we prepares his supper during lunchtime. This is normal for most people. What is not normal, is that it takes him one hour to walk over there! And half an hour by bike.

I guess I will never be able to find a reason for not having a meal, and I will try to have three meal a day. Thankee buddy!

]]>
A Test On Markdown Language http://hyiltiz.github.io/en/23-04-2013/this-is-an-test.html 2013-04-23T00:00:00+00:00 Hörmetjan Yiltiz http://hyiltiz.github.io/en/23-04-2013/this-is-an-test This page is intended to read its markdown code. You may find it here.

Recently I learned markdown, and I found I have already wrote some scripts with it even before without realizing. I can remember hearing of it a long time ago in some girl’s personal page. This page is written while I was learning markdown according to the tutorial in their official website.

A First Level Header

A Second Level Header

Please don’t use any <blink> tags. Now is the time that AT&T, not [Google][] day for all good men to come to the aid of their country. This is just a *this text is surrounded by literal asterisks* regular paragraph. Visit [Daring Fireball][] for more information. There is a literal backtick (`) here. 5 < 4 is not true! (I could just type < there, but Vim’s highlight has problems with it.)

There is more that one way to print horizontal lines.





And we went on writing and writing. Yes.

1986. What a great season. And we are not counting till 1986, since it is just a year!

For example. We can try not to use this form, actually.

This is all ‘bout lists.

  • Candy.
  • Gum.

    So gums are interesting stuff.
    We all appreciate them.
    This is an not working [example link](http://example.com/). Come back
    to it later. Need to make it work.
    
  • Booze.
  • iCandy.

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
  • Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
  • iGum.
  • iBooze.
  • This is a list item with two paragraphs.

    This is the second paragraph in the list item. You’re only required to indent the first line, though indenting makes it easier to read. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

  • Another item in the same list.
  • A list item with a blockquote:

    This is a blockquote inside a list item.

  1. This is a list item with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.

    Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. Donec sit amet nisl. Aliquam semper ipsum sit amet velit.

  2. Suspendisse id sem consectetuer libero luctus adipiscing. Indent the code.

    #!/bin/bash
    #
    CHARMAP=`locale -c charmap`
    CHARMAP=${CHARMAP#LC_CTYPE}
    yes "markdown is great!"
    echo "/dev/null is also great!"
    

Some of these words are emphasized. Some of these words are emphasized also.

This is good picture

beauty picture

I get 10 times more traffic from [Google][1] than from [Yahoo][2] or [MSN][3]. I start my morning with a cup of coffee and [The New York Times][NY Times].

Use two asterisks for strong emphasis. Or, if you prefer, use two underscores instead. I strongly recommend against using any <blink> tags. So here is some code I use in school:

#!/bin/bash
#
# shell client of ipgw
#
# by jiang***@gmail.com


CHARMAP=`locale -c charmap`
CHARMAP=${CHARMAP#LC_CTYPE}

# default operation when non option given
# IPGWOP=connect

##usage ipgw_operation uid password operation
function ipgw_operation
{
    local U=$1
    local P=$2
    local OP=$3
    wget -q --no-check-certificate 'https://162.105.67.5/ipgw/ipgw.ipgw' \
        --post-data "uid=$U&password=$P&range=2&timeout=1&operation=$OP" \
        -O - | \
        iconv -f gbk -t $CHARMAP  | \
        sed -n -e '/<table/,/<\/table>/{s/&nbsp;/ /g;s/<[^>]*>//g;p;}'
}

function usage
{
    echo -e "Usage:\n\tcipgw\t[-u uid -p password] [-c] [-a] [-d] [-h]"
    echo -e "\t -c\tConnect to ipgw"
    echo -e "\t -d\tdisconnect from ipgw"
    echo -e "\t -a\tdisconnectall from ipgw"
    echo -e "\t -h\thelp, print this message then exit"
    echo -e "the last operation action, eg. -ac will just connect"
}

while getopts ":p:ucad" Option
do
    case $Option in
        u   )   IPGWU=$OPTARG;;
        p   )   IPGWP=$OPTARG;;
        c   )   IPGWOP=connect;;
        d   )   IPGWOP=disconnect;;
        a   )   IPGWOP=disconnectall;;
        h|* )   usage
            exit 1;;
    esac
done



if [[ -n $IPGWOP && -n $IPGWU && -n $IPGWP ]]; then
    ipgw_operation $IPGWU $IPGWP $IPGWOP;
else
    echo non ipgw operation or uid or password seted
    usage
fi

I wish SmartyPants used named entities like &mdash; instead of decimal-encoded entites like &#8212;.

If you want your page to validate under XHTML 1.0 Strict, you’ve got to put paragraph tags in your blockquotes:

For example.

The quick brown fox jumped over the lazy dog’s back. This is an example link.

Header 3

This is good text

Header 4

This is a blockquote.

This is the second paragraph in the blockquote.

And this is even a blockquite with these.

and these.

This is an H2 in a blockquote

This is an H4 in a blockquite

In the end, here is a vedio:

</param> </param> </param> </embed> ]]>