Friday 3 September 2010

China GPS (YF) - Adding a new item in the menu

Tasks:
- Backup the PNA's registry
- Change the default skins to add new button

The first thing we should do is to make the "Resident Flash2" drive visible (it's hidden by default), and to save the contents of the registry (in case something goes wrong)!

Preparations:

Download CeRegEditor from here and install it. We are going to use it to edit the WinCE registry.

If you have Windows XP, download and install Microsoft ActiveSync 4.5. For Vista or Windows 7, you need Microsoft Windows Mobile Device Center.



After this is done, set the USB mode of the PNA to use ActiveSync (Settings -> USB -> ActiveSync). Then connect the USB cable to the device and let MS ActiveSync (or MS Device Manager) to start. At the beginning it will ask you to synchronize or not. Do not synchronize, or connect to the device without settings! This program is no longer needed. You can minimize it.

Next step is important for backing up the registry. Start the CeRegEditor (in Vista or Win7 it should be "Run as Administrator"). Press "Make Connection with device" icon (F1) for the program to connect to the PNA's registry. Please note that doing something wrong could damage the PNA! Therefore, proceed with caution!

Save the contents of the registry: Tools / (Backup / Restore) / Create Image Backup (F2)
Now we will amend the registry to be able to see the "Resident Flash2" drive, and also to make a backup of it. Go to:

HKLM\System\StorageManager\Profiles\FlashDrv\MYFATFS

and change the value for "MountHidden" from 1 to 0 (double click on the selected line). Then save the changes by clicking the small floppy icon!

After this is done, you can now practice the restore! Chose "Tools -> (Backup / Restore) -> Restore Image" menu.  You can compare your new registry with your backed up one: "Compare -> Compare Registry (F3)" menu and pick a previously saved file. To restore a saved image to the registry, click "Tools -> Backup/Restore -> Restore an Image" and pick a saved registry image file. You may be asked to do a comparison first.

For each key that you want restored must have the checkbox marked , but if you want to restore everything, it easier to select the main library and then "Select" menu to "Select All", and all the keys will be restored. If in more than one main library are differences, when you want to restore, you have to do it for each library  individually! Check again after each "Restore", to make sure you've done everything right. If something is not clearly marked out, try again!

Install TotalCommander (if you don't have it) from here, then download the ActiveSync plugin from here. After you have installed and started Total Commander, if you double-click on the wince.zip file you will be asked to install the plugin. Just say "Yes". In Total Commander, if you go to "Network drives", you will have a "WinCE Device". If you double-click on it you will see the device as another drive. You will be able to transfer files, but because it uses ActiveSync connection the transfer will be a bit slower. Smaller files suitable for transfer, but larger files needs to be copied by setting USB to use Mass Storage mode in your device. In the meantime, do not change to Mass Storage mode, until we try the changes!

If you see the WinCE drive, but Total Commander doesn't see the ResidenFlash2 folder, then disconnect the device from the PC, go to Start / Settings / Control Panel on the device and select "Storage Manager". Here you should be very careful! Select Part01 (the partition of the ResidenFlash2 folder). Tap the Properties button. Here, Dismount, and then Mount. You can not be wrong! Then you can close the window. Connect the device to your PC, restart Total Commander and do the same thing as before. The folder should appear as "Resident Flash2". Make a backup of the entire folder somewhere on your PC.

Create a directory into which you can copy the original files, so you have a backup. Make a backup of the following files:

ResidentFlash2\YFAPP\Language\Hungarian.xml
ResidentFlash2\YFAPP\Skins\Color7_E93\Color7MoveShell.xml
ResidentFlash2\YFAPP\Skins\Color7_E93\Color7MoveShell_NOBT.xml

The "Color7_E93" is the folder currently in my "Skins" folder. Yours may be different. The Hungarian.xml includes definitions for the Hungarian equivalents of the Color7MoveShell.xml menu buttons, and among other things, their properties, positions, etc.

Using Notepad, or pressig F4 in Total Commander, open the "Color7MoveShell.xml" that's in your "Skins" folder in the "ResidentFlash2" drive. Right in front of our eyes we'll ahve a  <page paragraph, which is located under the "GPS, Media, Bluetooth, Tools, Games" buttons that are familiar to the factory menu. Then comes a <page1 paragraph, it will be the next page, where you have only two buttons. The <!--Alarm is a commented section. The comment begins with !-- and  ends with --. We will change the next section:

<page1 RECT="0,218,480,54" image="0">
        <GpsInfo
        IMAGE = "1018"
        Rect = "0,0,90,54"
        Style = "MainMenuBtnText"
        TEXT = "SH_GpsViewer"
        EXEPATH = "ToolBox \ YFGPSViewer.exe"
        Background = "1026"
        HEIGHT = "15"
        />
        <Setting
        IMAGE = "1018"
        Rect = "90,0,90,54"
        EXEPATH = "SettingDlg"
        Style = "MainMenuBtnText"
        TEXT = "SH_Setting"
        Background = "1025"
        HEIGHT = "15"
        />
        <! - Alarm
        IMAGE = "1067"
        Rect = "180,0,90,54"
        EXEPATH = "Alarm \ AlarmMenu.exe"
        Style = "MainMenuBtnText"
        TEXT = "SH_Alarm"
        Background = "1016"
        Align = "DT_CENTER, DT_BOTTOM"
        HEIGHT = "15"
        / ->
</page1>
Add an new item to the menu (the highlighted part of the section.)
<page1 RECT="0,218,480,54" image="0">
        <GpsInfo
        IMAGE = "1018"
        Rect = "0,0,90,54"
        Style = "MainMenuBtnText"
        TEXT = "SH_GpsViewer"
        EXEPATH = "ToolBox \ YFGPSViewer.exe"
        Background = "1026"
        HEIGHT = "15"
        />
        <Setting
        IMAGE = "1018"
        Rect = "90,0,90,54 '
        EXEPATH = "SettingDlg"
        Style = "MainMenuBtnText"
        TEXT = "SH_Setting"
        Background = "1025"
        HEIGHT = "15"
        />
        <GoWinCE
        IMAGE = "1018"
        Rect = "270,0,90,54"
        EXEPATH = "\ResidentFlash\MortScript\wince.exe"
        Style = "MainMenuBtnText"
        TEXT = "SH_GoWinCE"
        Background = "1027"
        HEIGHT = "15"
        />
</page1>

Make the same changes in "Color7MoveShell_NOBT.xml", just in case you don't know if your device has BlueTooth (BT) or not.

Save the modified file. We are not yet done, because the language file must also be modified to have a key belonging to the text for "SH_GoWinCE" from above... At the beginning of this file, you can see:

<language>
    <! - Common string prefix "COMMON_" ->
    <! - Shell string prefix "SHELL_" ->
    <SH_GPS TEXT="GPS"/>
    <SH_Music TEXT="Music"/>
    <SH_Photo TEXT="Photo"/>

You can insert the definition virtually anywhere:

<language>
    <! - Common string prefix "COMMON_" ->
    <! - Shell string prefix "SHELL_" ->
    <SH_GoWinCE TEXT="WinCE"/>
    <SH_GPS TEXT="GPS"/>
    <SH_Music TEXT="Music"/>
    <SH_Photo TEXT="Photo"/>

Save the file. Once completed, press "Disconnect" in Total Commander, then disconnect the device from the PC, then reset the device by pressing the reset button. You should have a new button called "WinCE".

Sources: Information found here: gpsforum.hu (thanks to everyone!)

Credit to @ion

No comments:

Post a Comment