Waze for WP7 – Downloads

Source Code


Version (10/04/2013) – Reviving Live Tiles for WP8

Courtesy of Eli Ofek:

You can set Home and Work favorites and their arrival ETA will show up on Waze live tile.

– Fixed a bug for honoring back button from the main screen.



Version (06/02/2013) – Yet another voodoo fix

– Trying to close pop up messages in WP8 device led to unexplained crashes (voodoo). By applying the same spell of splitting the crashing function into 2 pieces I managed to make the crashes go away. Go figure…


Version (03/02/2013) – Works on WP8 (at least on Nokia Lumia 920)

– Due to some voodoo cibyl does, the network session variable was nullified in unexpected places. Splitting the function that consumes it solved the problem (at least for now).

Waze WP8

Version (27/6/2012) – More stabilizations

– Better zoom in/out gesture support

– Fixed many lockups scenarios

– Revived the ‘Resume Navigation’ dialog

– Revived the ‘Northify’ button

– Added ‘save logs’. Whenever you see a problem, click on this menu item and the logs will be sent to my dropbox.


Version (5/5/2012) – Missing Tiles / Search problems are over?

– HTTP Connections are much more reliable now. I hope missing tiles problem and search problems are over

– Fixed null pointer exception in RTLMessageBox

– Fixed WebStats crash


Version (16/4/2012) – And… another map stuck bug

– Now the map getting stuck was around the touch events handling – fixed

– As a result of the fix, map movement is much more reliable. No more map getting all blank when you swipe your finger fast. You can now really follow the proposed track with moving the map across the path.


Version (14/4/2012) – Another day, another endless loop fixed

– Fixed yet another endless loop causing map to get stuck

– Better HTTP handling. You should expect better tiles management.


Version (13/4/2012) – and… presto

– After several frustrating weeks I finally succeed in repro’ing the map being stuck bug. The reason it was so hard to find is the scenario where waze wants to display a bitmap but due to some reason the image size is 0. This leads to endless loop while trying to see what text size should fit into such bitmap.

– Fixed the appbar issues – the appbar will be always visible now.


Version (11.4.2012) – fixing a regression

– AppBar blocks the navigation bar (street name, eta etc.) – the appbar will be minimized again until we solve this issue.


Version (9.4.2012) – and still stabilizing

– Clicking on Alternate Routes in portrait mode did not do anything (problem was that it expected the finger to click 40 pixels below) – fixed.

– Fixed Race condition in language loading that cause Waze to crash during load.


Version (9.4.2012) – still stabilizing

– Fixed application lockups during map navigation

– AppBar menu is shown by default – more accessible and less confusing for new users

– Reporting fixed for languages other than English and Hebrew (yes, we have users from other countries)

– Pressing Back button takes the car back to focus on map (and then shows the confirmation message). This is good if you want a button that will always bring you back to same state, no matter where you are in the app.


Version (28.2.2012) – I wanna report this
Eli Ofek has done it again and redesigned the reporting screen with easy to use icons for your convenience.


Version – Stabilizations

Courtesy of Eli Ofek

– ETA now finds Work/Home favorites written in every casing permutation (Work,woRK, HOMe etc.)

– Exit

– You wanted Exit to be fast – you got it.

– Pressing Back button on main screen exists Waze (w/ Confirmation).

– No Exit option on menu – WP standard UI. Added settings to determine whether to show Confirmation or not. Disabling Live tile now really disabled it


-Accessibility fix – when pressing +/- Zoom button on map the flickering is now being done with black background instead of white

– ETA not always shown on live tile due to file access issues – fixed

– ETAs no longer show negative values


Version – Don’t Stop My Music

Eli Ofek keeps contributing great stuff. This time, helping feature for you who love to hear music/audio books while navigating. Waze will no longer stop you currently playing music but rather play the directions in a louder volume.


Version – The killer feature just got better

Eli Ofek doesn’t seem to stop surprising us and enhanced the When-To-Go-Home feature to include Work ETA too.

1. You now have dedicated screen for configuring the live tile settings. From this screen you can also email crash log to help us stabilize this feature.

2. The number in circle is Max(ETA Home, ETA Work) so on the mornings it will show ETA to Work and from afternoon will provide ETA to Home.

3. The flipped tile details both ETAs


Version – The feature you were all waiting for

“When to go home” feature was added by Eli Ofek and me. You now have live tile updating at the frequency you choose to update you about the time it will take you to drive home.

1. At the settings screen, go to Other screen and there you will find Live tile settings. Enable it and set its update frequency.

2. Add favorite named ‘home’

3. Watch update time inside you tile updated at the frequency you defined

4. After few seconds, watch detailed ETA message


Version – A couple of nice ones 

Courtesy of Eli Ofek:

– Fixed orientation issues – now you can rotate the device back and forth and picture will be set flawlessly

– Added new Setting for disabling auto-rotating picture when rotating the device – Street names on navigation bar are better aligned now

Courtesy of Eran Gonen:

– Added a native language select dialog to be shown at first use

– Changed the minimization of the application bar to be native, eliminating the map resize


– Stabilized the zoom-in/out gestures to avoid moving the map or showing context menu while pinching


Version – Even more stabilized

– Resolved a major issue where the navigation commands were still playing while the map is frozen

– Resolved the case where Waze was stuck forever with white screen during startup

– Change pinch gestures to be much less sensitive in order to provide better experience when zooming in/out


Version – Working on the small details

– Courtesy of Eli Ofek:

  • Added ‘Restore Favorites’ option under Settings screen for cases where they are not restored automatically
  • If Dialog is in progress, ignore map touches that are not GPS emulation or app bar requests

– Fixed crashes during writing long search string in Search Address page

– Setting a skin in Settings screen is now working

– Auto night-mode is now working. Expect different map colors at night

– Ads are now showing – not sure if it’s a good thing or bad 🙂

– Dialog border are being drawn correctly. Alerts are now readable

– Hazards, Wazers and Ads are now clickable

– Green bottom bar is finally showing – now you can see the directions properly


Version – It’s stabilization time

– Decreased memory consumption by 100MB – no more sporadic failures

– Fixed font issues – no more “System.ArgumentException: The character ‘С’ (0x0421) is not available in this SpriteFont. If applicable, adjust the font’s start and end CharacterRegions to include this character.”

– Added memory consumption on the About page

– Added initial Anti-Aliasing – map should look better now

– Fixed text alignment

– Added build number to the crash report email

– Fixed many other crashes – Screen is now turning white when switching between zoom levels

– Multitouch support – you can now pinch-to-zoom

– Courtesy of Eli Ofek: Fixed landscape mode


Version – TOUCHDOWN!

Welcome XNA: converted all graphic drawing to XNA. HUGE performance improvement – smooth map movement at all zoom levels. Finally a version that gives proper fight to iPhone/Android versions.


Version – The final touch

Another huge contribution by Eran Gonen:

– Settings are now implemented using native controls. Panorama screen allows you to edit all settings in one place

– Alternate routes are available  using native dialogs

– Navigation dialog now contains the destination and the dialog is finally properly aligned

Courtesy of Noam Ben-Yochanan:

– Waze initial position is no longer Bavli Tel Aviv but the current one

– Clicking on app-bar area does not count as clicking on map anymore


– Stabilization improvements – several null exceptions that were reported were fixed

– Scoreboard (ניקוד)  now opens the browser with your stats


– We have the Navigation List (מסלול) menu option the lists the navigation route steps


Version – More Native Dialogs

Another great contribution from Eran Gonen:
– App crash stack traces will be mailed to me.
– Added native screens for Favorites, Recent searches, Saved Locations, Map Settings and Car choosing. Long click on items in each of the screen brings up context menu with the relevant options.
– Search screen now has shortcuts for Favorites, Recent Searches and Saved Locations.
– No more ‘Waze needs to be restarted due to infra changes’ message.
– Messages are now aligned according to the language.


Version – Hello Native Dialogs

Huge contribution by Eran Gonen:

– Logon, Sign-in, Sign-up, Search and Search Results dialogs are now being drawn using WP7 controls. This means you should expect great experience when using them.

– Long click on a search result will bring up context menu that will allow you to add the result to the favorites and additional useful options (see screenshot). Short click will calculate the route

Native Dialogs

Courtesy of Amit Finkelstein:

– Changed GPS to pull mode – no more “No GPS reception” when you are waiting for the green light.

Courtesy of Eli Ofek:

– App Bar is now visible on Waze startup and will stay opened while browsing through the menu items.

– Messages are now right aligned.


– Brought back WAV files instead of WMA – the media player handle compressed sound file too slowly. Sorry folks, the package is getting back to be 8MB.

– Changed application name to Waze so it will be easy to invoke it using Voice 🙂

– Reporting now works again – had some regression.


Version – It’s Mango time

Big contribution from Eli Ofek:
– Recompiled against mango (SL4)
– Changed the fav icon in the app bar to start Favorites and not Saved Locations.
– Removed the Nbidi transformation, as SL4 supports RTL, no need to convert the strings any more.
– Changed the AppBar to be hidden by default, to utilize the screen better while driving. Touching the bottom 60 pixels (approximately under the ETA bar) will pop the appbar back for 15 seconds or until a selection is made, whichever comes first.
– The previous item exposes new text line at the bottom of the screen that is used to directing the driver to where the next turn should be.
– Network now supports max 6 concurrent connections per host, and since then no more “Operation Failed” errors.
– Removed redundant lock statments to increase speed.
– Added support for Landscape mode. Rotating the device causes the map to rotate too.

Courtesy of Amit Finkelstein:
– Converted WAV files to WMA in order to decrease package size. XAP file is now only 4MB (thanks Eran Yariv for the tip).

Note: that the sporadic “oops” failure during Search won’t stop by the new version. it’s not a client  problem, it’s a server problem. it happens on WM6.5 & Android versions too the last few weeks.
We believe it’s load related, as it happens mainly when you try to calculate routes during rush hours.



– With courtesy of Meni Zalzman, converted queue implementation to real queue + changed ‘equals’ override from Java style to C# so that items will be actually checked for containment. This should result in better performance.
– Changed the Exit icon on the app bar to Favorites as it’s more common action. Exit is still available on the ellipsis (…) menu.
– Changed HTTP error handling to be more robust. This, along with the queue fixes should get Waze more reliable and less ‘Operation Failed’ kind of app.
– Fixed Realtime alerts menu. Now it will show all alerts from all categories.
– Increased pre-fetching to contain more tiles around the current point.


– Copying sound files from resource to isolatedStroage on demand. This should improve startup times and reliability.
– Fixed English sound files – now you can really hear English (rather than hebrew…)
– Added Menu Bar icon for quick actions: MeOnMap, Report, Navigate and Quit
– Quit really works now (had to throw unhandled exception to achieve that, go figure)
– Added cancel navigation menu item (just below Navigate)
– Cleaned up top toolbar – only GPS indication is shown as other icons were not functional
– Text should be more aligned now. Look at the settings menus.
– Clicking on report now offers you ‘Me On Map’ as one of the options in case you accidentally pressed it and want to go back to map.


– Added Tile Cache for last 500 tiles (tile == vector data describing area in the map). Whenever Waze downloads a tile from the web it will now keep it on isolated storage so next time you need it will load instantly. The cache is managed in Fifo way so only the last 500 tiles will be kept.

– Added pre-cached tiles for Tel-Aviv till Hod-Hashron. From the menu choose ‘טען מפה’ – (one item before Exit option). This will load the cache with tiles of the area starting from Tel Aviv till Hod Hasharon.

– Reliability fix – catching NotSupportedOperation coming from Web requests.


REPORTING WORKS! Now you can be good citizen and help Waze get more up-to-date data by posting alerts (on the menu, click ‘דווח’).
– Enhanced reliability – startup crashes are history.
– Back button regression resolved. Pressing Back will return to map.
– Clicking OK on ‘please wait’ dialogs was sometimes crashing – fixed.
– Fixed mumbling at the end of many wav files.
– Fixed timing issues with playing sounds to be more compatible with slower devices (and ones with Mango).
– When entering username/password/address – the Enter key in the on-screen keyboard is now connected to the OK button.
– The splash screen at startup no longer shows garbage at the bottom.


– Decent performance, finally. Zlib operations were done against IsolatedStorage temp files, one byte at a time. Now all is done in memory – huge performance gain.


  • Fixed map scrolling (at last). Now you can drag the map over and over again without  need to pin your last position before next dragging.
  • Sounds are now more reliable – Waze makes extra care of delivering them even if the application crashed during init phase.
  • Input dialogs are now automatically opening the keyboard pane, no need for the extra click in the textbox
  • Speed optimizations
  • Perception is everything: on logon screen you get ‘please wait’ message after clicking on every button so at least you will have feedback that the touch was received and being processed.


– (As you can see from the title) Added version number. From now on you will able to know what version is the latest vs. the one you have. From the menu choose ‘About’ to see your current version.


Hebrew support – finally you can use Native Keyboard to search address in hebrew.
– Application and tile icons – it’s about time.
– Increased street cached for better performance.
– No more language downloads.



– Replaced general menu icon with Waze icon.

– Made audio directions smoother – no more lagging.



– Speed improvements by eliminating log writing in Release mode
– Back button now returns to map instead of bailing out the app.
– Removed ‘Shortcuts’ menu item.
– Added ‘Save’ button for ‘Data Usage’ menu.


29/6/2011 (2)

– Added ‘Save’ button to General Settings and Navigation Settings page.

– Fixed ‘Save’ button location in ‘Map Settings’ page.



– Map browsing is much faster. Also, no more double clicks and other voodoo for entering user creds.
– Dialogs text are finally aligned. No more descriptions, ETAs and Speed coming out of their borders.
– In ‘Add to Favorites’ dialog, the ‘Save’ and ‘Cancel’ buttons are now visible.



– Added ‘Save’ button in Map Settings screen so values will be kept

– Increased the volume of the directions to 100% instead of 80%


25/7/2011 – Initial version


Posted in Waze, WP7 | Tagged | 120 Comments

Waze for WP7 – Deep dive into Cibyl

On my last post I introduced Cibyl as the tool I’m going to use for converting Waze to C#. Before talking about C#, let’s first learn how Cibyl converts C/C++ code to Java.

Let’s take the following simple program and see the list of actions one should do in order to convert it to fully running Java:

Original code

#include <stdio.h>

int main(int argc, char **argv)
  return 0;


Altered Code to comply with Cibyl:

#include <stdio.h>
#include <cibyl.h>

int main(int argc, char **argv)
  return 0;

The only line added was #include <cibyl.h>. What’s that?

Well, cibyl.h contains macros to replace every LIBC* (or MSVCRT if you want) function with Java byte code method with the same functionality. In this case printf will be replaced during pre-processing phase into 10K Java bytecode lines (I shit you not) that impement the entire functionality of, well, printf (parse the format params, add leading spaces etc.). Finally there will be a call from within the bytecode to Java code that implements writing character to the screen (the real I/O will always be implemented in Java so you can easily replace the implementation with your own one).

So if the input is main.c the output will be 2 files: Cibyl.j and Syscalls.java. Cibyl.j is a java bytecode file that contains the main and printf implementation in JVM bytecode commands. printf implementation contains the following call to Java code:

invokestatic Syscalls/NOPH_OutputStream_write(II)V

Syscalls.Java will contain the implementation of NOPH_OutputStream_write that simply outputs a character to the screen. Don’t worry about the (II)V notation, i will explain those later.

Both Cibyl.j and Syscalls.java are being compiled into corresponding class files and can be packaged in one Jar ready for execution. j files are JVM assembly files in Jasmin format ready to be compiled to class files. Read more about Jasmin in the link above.

Got you, what about real world code?

Real word code will contain calls to external libraries that implement drawing graphics, printing and all other I/O related functionality. I assume you already have this code contained in special directory in order to support multiple platforms (e.g. drawing pixels in iPhone is different than Android). So you need to add new directory for Java that will contain the same C/C++ code but all the external calls will be replaced with NOPH_<syscall>.

OK, you created new directory, added all C/C++ files and replaced every call with NOPH_ prefix. What’s next?

Since Simon (author of Cibyl) only provided replacement for LIB* functionality, you need to provide the Java functionality for any non-libc functionality you use. For example: if your code contains call to DrawPixel that was implemented in C by 3rd party library, now you will have to:

1. Replace the call to DrawPixel with a call to NOPH_DrawPixel.

2. Provide NOPH_DrawPixel Java code that implements the same functionality.

3. Tell Cibyl to connect 1+2.

When you execute Cibyl on your new code, Cibyl will identify each NOPH_ call and replace it with a call to your Java function that implements the NOPH_ call your provided in (2).

Well, how do i ‘tell’ Cibyl to connect 1+2?

Cibyl created syscalls directory under which there are implementation for LIBC system calls. You need to add new directory under Syscalls that will contain your specific Java functionality. This is splitted into 2 major parts:

1. Create Syscalls\MySyscalls\include directory. This directory will contain H files that contain the C prototypes of the system calls you’re about to implement in Java. For example:

typedef int NOPH_SoundMgr_t;

int NOPH_SoundMgr_listCreate(NOPH_SoundMgr_t sm, int flags);

2. Create Syscalls\MySyscalls\classes\SoundMgr.java that will contain:

public int listCreate(int flags) {

/* some code */


3. Run `cibyl-generate-c-header -o Syscalls/ sound_mgr`. This will create cibyl.h file that contains macro definition named ‘listCreate’ that order the JVM bytecode to call Java function named listCreate.

H file containing prototypes for Java methods, you must be kidding

There must be a way for your original C/C++ code to communicate with the new Java functionality. In order to achieve that, you define prototypes using the C builtin data types. These types have correspong types in Java so this is the way both language communicate. Similarily to Win32, most of the time you create objects in Java and return HANDLE (int) to the C/C++ code for further calls. In the example above NOPH_SoundMgr_t is such a handle that will represent the sound manager for both C/C++ and Java code. All other objects can be represented in similar way.

On my next post I will explain the conversion of Cibyl from yielding Java code into .NET code.

Posted in Waze, WP7 | Tagged | 1 Comment

Waze for WP7 – the journey begins

As Microsoft employee you are entitled to get Windows Phone device.

As a happy owner of iPhone I wanted to have similar experience and tools before moving to different device.

What i need before converting:

1. Hebrew support – there are all sorts of helpful utilities i can live with √

2. Hackernews app – I can (and will) write one pretty easily 

3. Calcalist technology RSS feeds – Mivzakim app covers that 

4. Waze – No current plans to provide WP7 version of that app.

OK – now i have a challenge – converting the client code (GPL) to managed code.

First Try

The naive way is take the C code and convert it line-by-line to C#.

3rd party code

Looking at the code i found out it uses several 3rd party libraries. No need to convert those as C# already has equivalents as part of the language or as a free managed library (zlib, libpng etc.).

Cool, so i took Waze code and replaced every call to 3rd party library with a call to C# exe file that does the equivalent action (need to uncompress steam? just call Uncompress.exe with input file containing the compressed data and filename for getting the uncompress payload back).

“3rd party graphics cannot work that way” you say. To mitigate that, i replaced each drawing command with code that write the shape types along with all the params to running-number file and built C# exe that monitors those files. Upon detecting new file it just parses the command and draws the required shape/text.

This helped me strip down the external code entirely while still being able to see nothing was broken.

Convert the code

I tried CppToCsharp hoping it will leave me reasonable amount of code to convert.

Well… it didn’t. While the tool did fine job at converting some of C/C++ challenging constructs (MACROs, pointers etc.) it left me with 20K errors spanning over 400 files.

Good thing is that you can evaluate the pace of conversion by number of files you convert per day. Once you finished with a file – you won’t come back editing it.

So after a week of intense evenings i got to 10% (40 out of 400 files were converted, 20K errors reduced to 18K).

This is not to say the program will even load – i just converted the commands to my best knowledge and expected long debugging sessions to see the areas i need to rewrite.

So we are talking about at least 10 weeks of conversion after which i will have specific version converted. Every fix to the original C code will have to be migrated to this version so i didn’t have high hopes Waze team will take my code and continue maintaining two different source codes.


Soon after getting to the 10% milestone, i got introduced to Waze’s CTO and discussed my plans with him.

Then he dropped the bomb: Waze’s BlackBerry version has similar issue as you can only develop in Java for this platform and guess what, they already have it running. Well, how did they do that you ask?

Cibyl is the answer. Naturally many people have though about this problem before and Simon, the creator of Cibyl, actually implemented fully working solution.

In short what Cibyl does is the following:

1. Compile your C/C++ code into MIPS ELF file.

2. Since MIPS is built on RISC architecture, it has small number of assembly commands. Each of them can be converted to JVM bytecode corresponding command(s).

3. Each system call (fputs etc…) is being replaced by a call to Java function with corresponding functionality

That’s it!

So your work is summed up to:

1. Getting your code compiled in GCC

2. Replace all system calls to NOPH_<syscall_name> in your C/C++ code.

3. Provide implementation for all NOPH_<syscall_name> in Java.

4. Run Cibyl

5. Collect all output class files to Jar and you that’s it.

This way you can keep ONE code base and keep only one dedicated sub-directory for system calls (which you probably already have if your product is cross-platform one).

More details on the next post.

Posted in Waze, WP7 | Tagged , , , , | Leave a comment

Game AI experiments

Have you ever had a dream to build a game AI? Real sophisticated one? Did you wish you had all the other stuff (graphics, sound and runtime) ready so you can focus solely on AI code? Now you can!

Warzone 2100 is a real-time strategy (RTS) game, originally written by Pumpkin software and later released as open source. The game contains c-like scripting language for programming the AI which is everything you could wish for (along with decent graphics and sounds). It is actively being enhanced all the time for better network gaming and other features.

Also, there are many AI people contributing their scripts in dedicated sites. The source code is Win32 VC solution file you can easily load and compile if you like so essentially you have all the control you need to change every aspect of the game.


The implementation of the AI language is using Lex and Yacc for parsing the script. Then, during runtime, every command is being mapped to its equivalent C function with the specific parameters so it will run blazingly fast. take a look at script_parser.yscript_parser.l and especially interpreter.cpp – it’s a real masterpiece!

As with every game, you need to split up your ubber sophisticated AI algorithm/heuristics into chunks that can be processed gradually during every frame processing. This, of course, makes things much more complicated and challenges the debugging of such code.

Take a look at the following event example:

Tank defense event code

I removed several lines from original code for brevity.

1. Whenever on tank observes dangerous situation, it notifies other tanks (dropBeacon call).

2. If alert is on, gather all tanks around (orderGroupScoutCMD).

3. If the enemy is visible start an attack, otherwise, gather around to defend.

As you can see, this event can be called several times per second and continuously adapt to the current situation and react correctly.

The AI essentially is list of such events – each one for different group of objects (attacking tanks, defending tanks etc.).

RAND is the game

Looking at existing scripts it stroke me how many RAND calls there are in order to avoid beating the computer AI by learning its moves. One example is deciding when you have enough tanks to attack the enemy: the AI rolls up a number between 4-8 and if the number of tanks near the enemy equals this number, the attack begins.


Suppose you get to do it as your day time job, I wonder how much does it take to get used of talking seriously about moving tanks, soldiers and building bases (“you will get a bonus this year for your excellent new heuristic that enables the computer player to find and destroy the player’s bases faster than ever”).


The official site. Get the game installation + code and everything else related to the game:


One of the best AI extensions:


AI Scripting manual

http://developer.wz2100.net/wiki/ScriptingIntroduction http://members.shaw.ca/kgmetcalfe4/artificial%20intelligence/scriptlanguage.html

Posted in AI | Tagged , , , | Leave a comment

Hello world!


I’m Meir Tsvi and my hobby as well as full time job is computers. I’m technology enthusiastic and like to spend all of the time i don’t have (with two children) on life hacking.

Posted in Uncategorized | 2 Comments