WriteRes.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:142k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*******************************************************************************
- * Filename:
- * ---------
- * WriteRes.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- *
- *
- * Author:
- * -------
- *
- *
- *==============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *==============================================================================
- *******************************************************************************/
- /**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**********************************************************************************
- FILENAME : WriteRes.c
- PURPOSE : Helper Functions to Write/Generate the Customizable Resources like Strings,Images,MenuItems..etc.
- REMARKS : nil
- AUTHOR : Subramanya BG
- DATE : 20thSept 2002.
- Copyright (c) 2002 All rights reserved by Pixtel Communications
- **********************************************************************************/
- #include "GlobalMenuItems.h"
- #include "buildcfg.h"
- #include "pixteldatatypes.h"
- #include "CustDataRes.h"
- #include "CustDataProts.h"
- #include "CustMenuRes.h"
- #include "mmi_features.h"//070306 Alpha layer
- #include <string.h>
- #include <stdio.h>
- #include <stdarg.h>
- #include "OslMemory.h"
- // #include "UCS2prot.h"
- #include "Unicodexdcl.h"
- #include "CustResDef.h"
- #include "gui.h"
- #define MAX_NAME_LENGTH 100
- #define MENUITEM_ID_TYPE 9
- #define PARENT_ITEM_ID_TYPE 8
- #define NUMBER_OF_MENUITEMS_TYPE 7
- #define MENU_ITEM_ORDER_TYPE 6
- #define HIDE_FLAG_TYPE 5
- #define MOVEABLE_FLAG_TYPE 4
- #define DISPLAY_ATTRIBUTE_TYPE 3
- #define MENU_ITEM_STRING_ID_TYPE 2
- #define MENU_ITEM_IMAGE_ID_TYPE 1
- #define TRUE 1
- #define FALSE 0
- #define IMAGE_DESCRIPTOR_SIZE 2
- #define BUFFER_SIZE 4096
- #define BUFFER_SIZE1 16
- /* MTK added by JL */
- #define OUTPUT_DATA_FILENAME "..\..\Customer\CustResource\CustImgDataHW.h"
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- #define OUTPUT_DATA_FILENAME_EXT "..\..\Customer\CustResource\CustImgDataHWExt.h" /* 040805 CustPack: Calvin added */
- /* __CUSTPACK_MULTIBIN Calvin END */
- #define OUTPUT_MENUTREE_FILENAME "..\..\Customer\CustResource\CustMenuTree_Out.c"
- #define OUTPUT_IMAGE_NAMES_END "[]=n{"
- #define NOIMAGE_FILENAMEBUFFER "..\\..\\Customer\\IMAGES\\NOIMAGE.BMP"
- #define DEFAULT_FILENAMEBUFFER "..\..\Customer\Images\Default.bmp"
- #define DEFAULT_FILEBUFFER "________CUSTOMER__IMAGES__DEFAULT_BMP"
- /* 101205 audio resource Calvin Satrt */
- #define AUDIO_OUTPUT_DATA_FILENAME "..\..\Customer\CustResource\CustAdoDataHW.h"
- #define AUDIO_OUTPUT_DATA_FILENAME_EXT "..\..\Customer\CustResource\CustAdoDataHWExt.h"
- #define OUTPUT_AUDIO_NAMES_END "[]=n{"
- #define NOAUDIO_FILENAMEBUFFER "..\\..\\Customer\\AUDIO\\NOAUDIO.MP3"
- #define AUDIO_DEFAULT_FILENAMEBUFFER "..\..\Customer\Audio\Default.mp3"
- #define AUDIO_DEFAULT_FILEBUFFER "________CUSTOMER__AUDIO__DEFAULT_MP3"
- /* 101205 audio resource Calvin End */
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- #define ENFB_IMAGE_DATA_FILENAME "..\..\Customer\CustResource\CustENFBImgData"//100206 ENFB support
- #endif
- #ifdef MMI_ON_WIN32
- #include <stdafx.h>
- #endif
- /* 101205 audio resource Calvin move tp PixtelDataType.h */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- image_type_enum ExtImageFlag = SYSTEM_IMAGE;
- // __CUSTPACK_MULTIBIN Calvin BEGIN
- //BOOL ExtImageFlag=FALSE; //040805 CustPack: Calvin added for distinguish which set of images is populated
- // __CUSTPACK_MULTIBIN Calvin END
- /* 101205 audio resource Calvin Satrt */
- BOOL ExtAudioFlag = FALSE;
- /* 101205 audio resource Calvin End */
- #ifdef DEVELOPER_BUILD_FIRST_PASS
- static U8 is_first = 1;
- static U32 image_idx = 1;
- /* 101205 audio resource Calvin Satrt */
- static U32 audio_idx = 1;
- /* 101205 audio resource Calvin End */
- void Extract_Name(S8 *dest, S8 *src, U32 res_type);
- MMI_BOOL Iload(S8 *string, U16 *pType);
- extern CUSTOM_STRING *gpStringRes;
- extern CUSTOM_STRING_MAP *gpStringMapRes;
- /* MTK Leo add, to generate String list in first build. */
- extern FILE *StringListFile;
- extern FILE *EnumListFile;
- /* MTK Leo add,20040318, for new ResGenerator */
- U8 StrIsPopulate[MAX_STRING_MAP_SIZE];
- //MTK Leo end
- //MTK end
- /* 091004 MTK Calvin added to reduce populate time */
- extern FILE *OutputImgIDFile;
- extern FILE *OutputMenutreeIDFile;
- extern FILE *RepeatIDListFile; /* 102604 MTK Calvin added */
- /* MTK Calvin end */
- /* 101806 E-NFB start */
- #include "ImageGetDimension.h"
- /* 101806 E-NFB end */
- #define _POPULATE_RES_C
- S32 g_ressize = 0;
- S8 g_resmenu_filename[MAX_FILENAME_LEN] = "";
- #ifdef _POPULATE_RES_C
- extern mmi_resource_base_struct g_mmi_resource_base_table[];
- extern FILE *fpMenuResourceUsage;
- extern FILE *fpImageResourceUsage;
- extern FILE *fpAudioResourceUsage;
- extern FILE *fpStringResourceUsage;
- U32 g_resimg_count = 0;
- U32 g_resado_count = 0;
- CUSTOM_RESOURCE_SIZE g_resimg_table[MAX_IMAGE_IDS_SIZE];
- CUSTOM_RESOURCE_SIZE g_resado_table[MAX_AUDIO_IDS_SIZE];
- #endif /* _POPULATE_RES_C */
- /* decalred in the CustImageRes.c */
- extern CUSTOM_IMAGE nCustImageNames[];
- extern IMAGENAME_LIST ImageNameList[];
- extern CUSTOM_IMAGE_MAP ImageIdMap[];
- extern CUSTOM_IMAGE_SEARCH_MAP ImageIdSearchMap[];
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- /* 040805 CustPack: Calvn added */
- extern IMAGENAME_LIST ImageNameListEXT[];
- extern CUSTOM_IMAGE_MAP ImageIdMapEXT[];
- extern CUSTOM_IMAGE_SEARCH_MAP ImageIdSearchMapEXT[];
- /* Calvin end */
- /* __CUSTPACK_MULTIBIN Calvin END */
- /* 101205 audio resource Calvin Satrt */
- extern FILE *OutputAdoIDFile;
- /* decalred in the CustAudioRes.c */
- extern CUSTOM_AUDIO nCustAudioNames[];
- extern AUDIONAME_LIST AudioNameList[];
- extern CUSTOM_AUDIO_MAP AudioIdMap[];
- extern CUSTOM_AUDIO_SEARCH_MAP AudioIdSearchMap[];
- extern AUDIONAME_LIST AudioNameListEXT[];
- extern CUSTOM_AUDIO_MAP AudioIdMapEXT[];
- extern CUSTOM_AUDIO_SEARCH_MAP AudioIdSearchMapEXT[];
- /* 101205 audio resource Calvin End */
- /* decalred in the CustScreenData.c */
- extern CUSTOM_SCREEN nCustScreens[MAX_SCREEN_IDS];
- /* declared in the CustMenuDataRes.c */
- #ifdef MMI_ON_HARDWARE_P
- extern const CUSTOM_MENU nCustMenus[MAX_MENU_ITEMS];
- #else
- extern CUSTOM_MENU nCustMenus[MAX_MENU_ITEMS];
- #endif
- /* Global Variables */
- /* 101205 audio resource Calvin Satrt */
- S8 filename_buffer[BUFFER_SIZE];
- S8 tempBMPFile[BUFFER_SIZE];//070306 Alpha layer
- S8 autofilename_buffer[BUFFER_SIZE];
- S8 number_string[BUFFER_SIZE1];
- S8 autoimagename_buffer[BUFFER_SIZE];
- FILE *output_data_file;
- FILE *image_data_file;
- FILE *nfb_img_res_file;
- S8 *output_image_names = NULL;
- S32 n_supported_extensions = 1;
- FILE *audio_data_file;
- S8 *output_audio_names = NULL;
- /* 101205 audio resource Calvin End */
- /* 120704 Calvin added */
- #define SUPPORT_N_MEDIA_TYPE 3
- S8 *support_media_ext[SUPPORT_N_MEDIA_TYPE] = { "AVI", "3GP", "MP4" };
- /* Calvin end */
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- /* 040805 CustPack: Calvin added */
- FILE *dest_file;
- int toolFlag = 0; /* decide if this is run by CustPack tool */
- int resultFailFlag = 0; /* decide if this is run by CustPack tool */
- /* Calvin end */
- /* __CUSTPACK_MULTIBIN Calvin END */
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- FILE *enfb_img_data_file;//100206 ENFB support
- int enfbFlag = 0;
- int disableENFB = 0;
- U32 enfb_offset = 0;
- U32 enfb_size = 0;
- #endif
- /* 101205 audio resource Calvin modifiied */
- typedef struct Resource_Info
- {
- S8 *filename_ext;
- U8 file_type;
- } RESOURCE_INFO;
- #define MAX_SEQUENTIAL_IMAGE_FRAME 512
- #define SUPPORT_N_SEQUENTIAL_IMAGE_TYPE 3
- RESOURCE_INFO sequential_image[SUPPORT_N_SEQUENTIAL_IMAGE_TYPE] = { {"BMP", IMAGE_TYPE_BMP_SEQUENCE},
- {"JPG", IMAGE_TYPE_JPG_SEQUENCE},
- {"PNG", IMAGE_TYPE_PNG_SEQUENCE}
- }; /* 101205 audio resource Calvin */
- RESOURCE_INFO image_resource_info[] =
- {
- {"BMP", IMAGE_TYPE_BMP},
- {"PBM", IMAGE_TYPE_DEVICE_BITMAP},//070306 Alpha layer
- {"GIF", IMAGE_TYPE_GIF},
- {"JPG", IMAGE_TYPE_JPG},
- {"AVI", IMAGE_TYPE_AVI},
- {"3GP", IMAGE_TYPE_3GP},
- {"MP4", IMAGE_TYPE_MP4},
- {"PNG", IMAGE_TYPE_PNG},
- {"PPN", IMAGE_TYPE_PPN},//070306 Alpha layer
- {"M3D", IMAGE_TYPE_M3D},
- {"CMP", IMAGE_TYPE_SWFLASH}
- };
- RESOURCE_INFO audio_resource_info[] = { {"MP3", AUDIO_TYPE_MP3},
- {"IMY", AUDIO_TYPE_IMY},
- {"MID", AUDIO_TYPE_MID},
- {"WAV", AUDIO_TYPE_WAV},
- {"MMF", AUDIO_TYPE_MMF},
- {"PCM", AUDIO_TYPE_PCM},
- {"DVI", AUDIO_TYPE_DVI},
- {"AMR", AUDIO_TYPE_AMR},
- {"AAC", AUDIO_TYPE_AAC},
- {"WMA", AUDIO_TYPE_WMA},
- {"M4A", AUDIO_TYPE_M4A}
- };
- /* 101205 audio resource Calvin end */
- S32 sequential_interval[MAX_SEQUENTIAL_IMAGE_FRAME];
- S32 sequential_filesize[MAX_SEQUENTIAL_IMAGE_FRAME];
- S32 sequential_offset[MAX_SEQUENTIAL_IMAGE_FRAME];
- S32 sequential_extension_type; /* 031705 Calvin modified */
- S32 sequential_frame;
- /* Calvin end */
- extern S8 CustImgPath[];
- extern S8 CustAdoPath[]; /* 101205 audio resource Calvin Add */
- #ifdef __UCS2_ENCODING
- U16 AnsiiToUnicodeString(S8 *pOutBuffer, S8 *pInBuffer);
- #endif
- extern HWND hWnd;
- U16 CurrMaxStringId;
- extern U16 CurrMaxImageNum;
- extern U16 CurrMaxImageId;
- extern U16 CurrMaxMenuItemIndex;
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- /* 040805 CustPack: Calvin added */
- extern U16 CurrMaxImageNumEXT;
- extern U16 CurrMaxImageIdEXT;
- /* Calvin end */
- /* __CUSTPACK_MULTIBIN Calvin END */
- /* 101205 audio resource Calvin Satrt */
- extern U16 CurrMaxAudioNum;
- extern U16 CurrMaxAudioId;
- extern U16 CurrMaxAudioNumEXT;
- extern U16 CurrMaxAudioIdEXT;
- /* 101205 audio resource Calvin End */
- #ifdef __POPULATE_ENGINE_
- void AddStringInfo(int StrId, char *pString, char *pStringDisplay);
- void AddImageInfo(int ImgId, char *pImage, char *pIMageDisplay);
- void AddApplicationInfo(U32 nId, S8 *pName, U32 nMinId, U32 nMaxId);
- #endif /* __POPULATE_ENGINE_ */
- /* 101806 E-NFB start */
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- MMI_BOOL ENFBAssociatedIDFlag = MMI_FALSE;
- MMI_BOOL ENFBAssociatedIDAdded = MMI_FALSE;
- extern unsigned short CurrMaxENFBAssociatedIDNum;
- extern CUSTOM_ENFB_STR ENFBAssociatedIDList[];
- #endif
- /* 101806 E-NFB end */
- /* 101806 E-NFB start */
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * SetENFBAssociatedID
- * DESCRIPTION
- * start to record associated ID list
- * PARAMETERS
- * void
- * RETURNS
- * MMI_BOOL MMI_TRUE or MMI_FALSE
- *****************************************************************************/
- MMI_BOOL SetENFBAssociatedID(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* if flag = false, set flag = true, allocate memory, and no++ */
- if (ENFBAssociatedIDFlag == MMI_FALSE)
- {
- CUSTOM_ENFB_STR *enfb;
- int str_size = 256;
- int i;
- ENFBAssociatedIDFlag = MMI_TRUE;
- CurrMaxENFBAssociatedIDNum++;
- enfb = &ENFBAssociatedIDList[CurrMaxENFBAssociatedIDNum];
- enfb->count = 0;
- enfb->IDs = (U16 *)malloc(MAX_ASSOCIATED_LIST_IDS*sizeof(U16));
- enfb->Ptr = (S8 **)malloc(MAX_ASSOCIATED_LIST_IDS*sizeof(S8*));
- for (i = 0; i < MAX_ASSOCIATED_LIST_IDS ; i++)
- {
- enfb->Ptr[i] = (S8 *)malloc(str_size*sizeof(S8));
- }
- return MMI_TRUE;
- }
- /* error: cannot set flag twice */
- else
- {
- return MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * AddENFBAssociatedIDItem
- * DESCRIPTION
- * add item to current associated list
- * PARAMETERS
- * ImageID [IN]
- * filename [IN]
- * RETURNS
- * MMI_BOOL MMI_TRUE or MMI_FALSE
- *****************************************************************************/
- MMI_BOOL AddENFBAssociatedIDItem(U16 ImageID, S8 *filename, U32 type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* if flag = true, record this item: imagd ID & pointer variable */
- if (ENFBAssociatedIDFlag == MMI_TRUE)
- {
- CUSTOM_ENFB_STR *enfb;
- int i;
- enfb = &ENFBAssociatedIDList[CurrMaxENFBAssociatedIDNum];
- enfb->IDs[enfb->count] = ImageID;
- Extract_Name(enfb->Ptr[enfb->count], filename, type);
- for (i = 0; i < strlen(enfb->Ptr[enfb->count]); i++)
- {
- enfb->Ptr[enfb->count][i] = toupper(enfb->Ptr[enfb->count][i]);
- }
- enfb->count++;
- return MMI_TRUE;
- }
- /* if flag = false, do not record this item */
- else
- {
- return MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ResetENFBAssociatedID
- * DESCRIPTION
- * end of one associated ID list
- * PARAMETERS
- * void
- * RETURNS
- * MMI_BOOL MMI_TRUE or MMI_FALSE
- *****************************************************************************/
- MMI_BOOL ResetENFBAssociatedID(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* if flag = true, set flag = false */
- if (ENFBAssociatedIDFlag == MMI_TRUE)
- {
- ENFBAssociatedIDFlag = MMI_FALSE;
- /* if current associated list is empty, reuse it for next list */
- if (ENFBAssociatedIDList[CurrMaxENFBAssociatedIDNum].count == 0)
- {
- CurrMaxENFBAssociatedIDNum--;
- }
- return MMI_TRUE;
- }
- /* error: can not set flag = false twice */
- else
- {
- return MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GetCurrENFBAssociatedID
- * DESCRIPTION
- * end of one associated ID list
- * PARAMETERS
- * void
- * RETURNS
- * U32 current associated ID
- *****************************************************************************/
- U16 GetCurrENFBAssociatedID(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ENFBAssociatedIDFlag == MMI_TRUE)
- {
- return CurrMaxENFBAssociatedIDNum;
- }
- else
- {
- return 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IfItemExistENFBAssociatedID
- * DESCRIPTION
- * test if the ImageID has already existed in one associated ID list
- * PARAMETERS
- * ImageID [IN]
- * RETURNS
- * MMI_BOOL MMI_TRUE or MMI_FALSE
- *****************************************************************************/
- MMI_BOOL IfItemExistENFBAssociatedID(S8 *filename, U32 type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i, j, k;
- int str_size = 256;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 1; i <= (int)CurrMaxENFBAssociatedIDNum; i++)
- {
- CUSTOM_ENFB_STR *enfb;
- S8 *ptr;
- enfb = &ENFBAssociatedIDList[i];
- for (j = 0; j <= (int)enfb->count; j++)
- {
- ptr = (S8 *)malloc(str_size*sizeof(S8));
- Extract_Name(ptr, filename, type);
- for (k = 0; k < strlen(ptr); k++)
- {
- ptr[k] = toupper(ptr[k]);
- }
- if (strcmp((char *)ptr, (char *)enfb->Ptr[j]) == 0)
- {
- return MMI_TRUE;
- }
- }
- }
- return MMI_FALSE;
- }
- #endif
- /* 101806 E-NFB end */
- #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE)
- U32 GetOffsetFromResourceBase(U16 ImageID)
- {
- U32 i = 0;
- while (1)
- {
- if (strncmp(g_mmi_resource_base_table[i].appname, "END", 3) == 0)
- {
- break;
- }
- else if ((ImageID >= g_mmi_resource_base_table[i].min) &&
- (ImageID < g_mmi_resource_base_table[i].max))
- {
- return i;
- }
- else
- {
- i++;
- }
- }
- return 0xFFFFFFFF;
- }
- #define RESPRT(fp, app, base, ID, strID, size, data, resfile)
- do
- {
- fprintf(fp, "%st%dt%dt%st%dt%st%sn",
- app, base, ID, strID, size, data, resfile);
- } while (0)
- #define RESPRTONERECORD(fp, nImgId, data, enum_value, resfile)
- do
- {
- if (fp != NULL)
- {
- U32 offset = GetOffsetFromResourceBase(nImgId);
- if (offset == 0xFFFFFFFF)
- {
- RESPRT(fp, "NO_APP", -1, nImgId, enum_value,
- g_ressize, data, resfile);
- }
- else
- {
- RESPRT(fp,
- g_mmi_resource_base_table[offset].appname,
- g_mmi_resource_base_table[offset].min,
- nImgId, enum_value, g_ressize, data,
- resfile);
- }
- }
- } while (0)
- #endif /* #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE) */
- /*****************************************************************************
- * FUNCTION
- * InitStrPopulate
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void InitStrPopulate()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MAX_STRING_MAP_SIZE; i++)
- {
- StrIsPopulate[i] = 0;
- }
- }
- /* MTK Leo add, to store new string */
- /*****************************************************************************
- * FUNCTION
- * ConvertToPrintable
- * DESCRIPTION
- *
- * PARAMETERS
- * original [?]
- * converted [?]
- * RETURNS
- * void
- *****************************************************************************/
- void ConvertToPrintable(S8 *original, S8 *converted)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i = 0, j = 0, strlength = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- strlength = wcslen((wchar_t*) original);
- for (i = 0; i < strlength * 2; i++)
- {
- if (original[i] == 10)
- {
- converted[j] = 92;
- converted[++j] = 0;
- converted[++j] = 'n';
- j++;
- }
- else
- {
- converted[j++] = original[i];
- }
- }
- if (strlength == 0)
- { /* If NULL string, fill in " " */
- converted[0] = 20;
- converted[1] = ' ';
- converted[2] = ' ';
- converted[3] = ' ';
- }
- else
- {
- converted[j++] = ' ';
- converted[j] = ' ';
- }
- }
- /* MTK Leo end */
- /* MTK Leo add, to generate String list in first build. */
- /*****************************************************************************
- * FUNCTION
- * SetStringWithDisplay
- * DESCRIPTION
- *
- * PARAMETERS
- * nStrId [IN]
- * pString1 [?]
- * pDisplay1 [?]
- * enum_value [?]
- * RETURNS
- * void
- *****************************************************************************/
- void SetStringWithDisplay(U16 nStrId, S8 *pString1, S8 *pDisplay1, S8 *enum_value, S8 *resfile)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 found = 0;
- S8 *pString = NULL;
- S8 *pDisplay = NULL;
- ResourceInfo sInfo;
- S8 *sString = NULL;
- U16 StrTotalLen = 0;
- U16 nLen = 0;
- /* MTK Leo add, to store new string */
- S8 cString[1024], cDisplay[1024];
- S8 *pEnum_value = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MTK Leo end */
- g_ressize = 1; //strlen(pString1);
- #ifdef _POPULATE_RES_C
- if (strstr(pString1, "n") == NULL)
- {
- RESPRTONERECORD(fpStringResourceUsage, nStrId, pString1, enum_value, resfile);
- }
- else
- {
- RESPRTONERECORD(fpStringResourceUsage, nStrId, "N/A", enum_value, resfile);
- }
- #endif /* _POPULATE_RES_C */
- #ifdef __ASCII
- pString = pString1;
- pDisplay = pDisplay1;
- #endif /* __ASCII */
- #ifdef __UCS2_ENCODING
- pString = OslMalloc((strlen(pString1) + 1) * 2);
- AnsiiToUnicodeString(pString, pString1);
- pDisplay = OslMalloc((strlen(pDisplay1) + 1) * 2);
- AnsiiToUnicodeString(pDisplay, pDisplay1);
- pEnum_value = OslMalloc((strlen(enum_value) + 1) * 2);
- AnsiiToUnicodeString(pEnum_value, enum_value);
- #endif /* __UCS2_ENCODING */
- /* Leo remove, no need to set limit */
- // if(CurrMaxStringId >= MAX_STRING_IDS) return; /* Can't add more than max number of string ids allowed */
- // if (gpStringMapRes[nStrId]==(U16)-1)
- if (StrIsPopulate[nStrId] == 0)
- {
- CurrMaxStringId++;
- StrIsPopulate[nStrId] = 1;
- ConvertToPrintable(pString, cString);
- ConvertToPrintable(pDisplay, cDisplay);
- fwprintf(
- StringListFile,
- L"%lst%dt%lst%lsrn",
- (wchar_t*) pEnum_value,
- nStrId,
- (wchar_t*) cDisplay,
- (wchar_t*) cString);
- fprintf(EnumListFile, "%s,n", enum_value);
- }
- else /* 102604 MTK Calvin added */
- {
- fprintf(RepeatIDListFile, "%dt%stt%sn", nStrId, enum_value, "String");
- }
- }
- /* MTK Leo end */
- /*****************************************************************************
- * FUNCTION
- * AddApp
- * DESCRIPTION
- * Function to Add a new application into the framework
- * PARAMETERS
- * nId [IN] App Id
- * pName [IN] Application name.
- * nMinId [IN] Minimum Id value supported
- * nMaxId [IN] Maximum Id value
- * RETURNS
- * void
- *****************************************************************************/
- void AddApp(U32 nId, S8 *pName, U16 nMinId, U16 nMaxId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- ResourceInfo sInfo;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- sInfo.nAppId = nId;
- sInfo.nMaxId = nMaxId;
- sInfo.nMinId = nMinId;
- sInfo.pValue = pName;
- }
- /*****************************************************************************
- * FUNCTION
- * SetString
- * DESCRIPTION
- * Function to Update the Customizable Resource String & Mapping Array.
- * PARAMETERS
- * StrId [IN]
- * String1 [?]
- * enum_value [?]
- * U16(?) [OUT] String Number which is Mapped with the StringId.
- * RETURNS
- * StringNumber which is mapped with the StringID.(?)
- *****************************************************************************/
- /* MTK Leo add, to generate String list in first build. */
- void SetString(U16 StrId, S8 *String1, S8 *enum_value, S8 *resfile)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- SetStringWithDisplay(StrId, String1, String1, enum_value, resfile); /* 040805 CustPack: Calvin revised */
- /* __CUSTPACK_MULTIBIN Calvin END */
- }
- /* MTK Leo end */
- /*****************************************************************************
- * FUNCTION
- * SetImage
- * DESCRIPTION
- * Function to Update the Customizable Image Filename & Mapping Array.
- * PARAMETERS
- * ImgId [IN]
- * filename [?]
- * enum_value [?]
- * res_type [IN]
- * U16(?) [OUT] Image Number which is Mapped with the ImageId.
- * RETURNS
- * Image Number which is mapped with the ImageId.(?)
- *****************************************************************************/
- void SetImage(U16 ImgId, S8 *filename, S8 *enum_value, U32 res_type, S8 *resfile) /* 120304 Calvin modified for media resource */
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- SetImageWithBuffer(ImgId, filename, "", enum_value, res_type, FALSE, resfile); /* 040805 CustPack: Calvin revised */
- /* __CUSTPACK_MULTIBIN Calvin END */
- }
- /*****************************************************************************
- * FUNCTION
- * SetNFBImage
- * DESCRIPTION
- *
- * PARAMETERS
- * filename [?]
- * RETURNS
- * void
- *****************************************************************************/
- void SetNFBImage(S8 *filename)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 nType;
- S16 nStrlen;
- S8 upperFileName[MAX_FILENAME_LEN];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (strlen(filename) >= MAX_FILENAME_LEN)
- {
- filename[MAX_FILENAME_LEN - 1] = ' ';
- }
- if (!(strcmp(filename, "")))
- {
- strcpy(filename_buffer, NOIMAGE_FILENAMEBUFFER);
- }
- nStrlen = strlen(filename);
- while (nStrlen >= 0)
- {
- upperFileName[nStrlen] = toupper(filename[nStrlen]);
- --nStrlen;
- }
- ExtImageFlag = NFB_PROGRESS_IMAGE;
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- disableENFB = 1;//100206 ENFB support
- #endif
- Iload(upperFileName, &nType);
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- disableENFB = 0;
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * SetImageWithBuffer
- * DESCRIPTION
- * Function to copy the image file to buffer
- * PARAMETERS
- * nImgId [IN]
- * filename [?]
- * pDisplayName [?]
- * enum_value [?]
- * res_type [IN]
- * imgFlag [IN]
- * S8(?) [OUT] -> filename of the image to be displayed.
- * U16(?) [IN] -> ImageId
- * RETURNS
- * void
- *****************************************************************************/
- void SetImageWithBuffer(U16 nImgId, S8 *filename, S8 *pDisplayName, S8 *enum_value, U32 res_type, BOOL imgFlag, S8 *resfile) /* 120304 Calvin modified for media resource */
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 found = 0;
- S16 nStrlen;
- ResourceInfo sInfo;
- U16 nType;
- S8 upperFileName[MAX_FILENAME_LEN];
- unsigned short *pCurrMaxImageId;
- unsigned short *pCurrMaxImageNum;
- IMAGENAME_LIST *pImageNameList;
- CUSTOM_IMAGE_MAP *pImageIdMap;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (imgFlag == TRUE)
- {
- ExtImageFlag = EXT_IMAGE;
- pCurrMaxImageId = &CurrMaxImageIdEXT;
- pCurrMaxImageNum = &CurrMaxImageNumEXT;
- pImageNameList = ImageNameListEXT;
- pImageIdMap = ImageIdMapEXT;
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- #ifdef MULTIPLE_BINARY_FILES
- disableENFB = 1;//100206 ENFB support
- #endif
- #endif
- }
- else
- {
- ExtImageFlag = SYSTEM_IMAGE;
- pCurrMaxImageId = &CurrMaxImageId;
- pCurrMaxImageNum = &CurrMaxImageNum;
- pImageNameList = ImageNameList;
- pImageIdMap = ImageIdMap;
- }
- if (*pCurrMaxImageId >= MAX_IMAGE_IDS_SIZE)
- {
- return; /* Can't add more than max number of image ids allowed */
- }
- fprintf(OutputImgIDFile, "file name%d = %s n", image_idx++, filename);
- if (strlen(filename) >= MAX_FILENAME_LEN)
- {
- filename[MAX_FILENAME_LEN - 1] = ' ';
- }
- if (!(strcmp(filename, "")))
- {
- strcpy(filename_buffer, NOIMAGE_FILENAMEBUFFER);
- }
- nStrlen = strlen(filename);
- while (nStrlen >= 0)
- {
- upperFileName[nStrlen] = toupper(filename[nStrlen]);
- --nStrlen;
- }
- for (i = 0; i < *pCurrMaxImageNum; i++)
- {
- if (!strcmp(pImageNameList[i].filename, upperFileName))
- {
- found = 1;
- break;
- }
- }
- if (pImageIdMap[nImgId].nImageId != 0) /* 102604 MTK Calvin added */
- {
- switch (res_type)
- {
- case RES_IMAGE:
- fprintf(RepeatIDListFile, "%dt%stt%sn", nImgId, enum_value, "Image");
- break;
- case RES_MEDIA:
- fprintf(RepeatIDListFile, "%dt%stt%sn", nImgId, enum_value, "Media");
- break;
- default:
- printf("Non supported resource type!n");
- }
- }
- g_ressize = 0;
- if (found)
- {
- pImageIdMap[nImgId].nImageId = nImgId;
- pImageIdMap[nImgId].nImageNum = i;
- (*pCurrMaxImageId)++;
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__//100206 ENFB support
- if ((disableENFB == 0) && (ENFBAssociatedIDFlag == MMI_TRUE))
- {
- if (IfItemExistENFBAssociatedID(upperFileName, res_type))//already in other associated group
- {
- AddENFBAssociatedIDItem(nImgId, upperFileName, res_type);
- }
- else
- {
- fprintf(RepeatIDListFile, "nn!!!!!!!!!!!!%dt%stt%s!!!!!!!!!!!!!nn", nImgId, enum_value, upperFileName);
- }
- }
- #endif
- #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE)
- {
- S8 str1[MAX_IMAGE_NAMES_SIZE];
- S8 str2[MAX_IMAGE_NAMES_SIZE];
- U32 i, j;
- strcpy(str1, filename);
- for (j = 0; j < strlen(str1); j++)
- {
- str1[j] = toupper(str1[j]);
- }
- for (i = 0; i < g_resimg_count; i++)
- {
- strcpy(str2, g_resimg_table[i].filename);
- for (j = 0; j < strlen(str1); j++)
- {
- str2[j] = toupper(str2[j]);
- }
- if (strcmp(str1, str2) == 0)
- {
- g_ressize = g_resimg_table[i].size;
- break;
- }
- }
- }
- RESPRTONERECORD(fpImageResourceUsage, nImgId, filename, enum_value, resfile);
- #endif /* #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE) */
- }
- else
- {
- if (res_type == RES_JAVA_GAME)
- {
- printf("Populating Java Game Resourcen");
- FILE *data_file = fopen(upperFileName, "rb+");
- output_data_file = fopen(JAVA_GAME_FILENAME, "ab+");
- if (data_file == NULL)
- {
- }
- else
- {
- U8 ch = 0, count = 0;
- S32 data;
- printf("Open data file successfullyn");
- Extract_Name(output_image_names, upperFileName, RES_JAVA_GAME);
- fprintf(output_data_file, "const U8 ");
- fprintf(output_data_file, output_image_names);
- fprintf(output_data_file, "[]={nt");
- while (!feof(data_file))
- {
- ch = fgetc(data_file);
- count++;
- fprintf(output_data_file, "0x%02X,", ch);
- if (count == 16)
- {
- fprintf(output_data_file, "nt");
- count = 0;
- }
- }
- fprintf(output_data_file, "n};");
- pImageIdMap[nImgId].nImageId = nImgId;
- strcpy(pImageNameList[*pCurrMaxImageNum].filename, upperFileName);
- pImageIdMap[nImgId].nImageNum = *pCurrMaxImageNum;
- (*pCurrMaxImageNum)++;
- (*pCurrMaxImageId)++;
- fclose(output_data_file);
- fclose(data_file);
- }
- }
- else if (Iload(upperFileName, &nType))
- {
- pImageIdMap[nImgId].nImageId = nImgId;
- strcpy(pImageNameList[*pCurrMaxImageNum].filename, upperFileName);
- pImageIdMap[nImgId].nImageNum = *pCurrMaxImageNum;
- (*pCurrMaxImageNum)++;
- (*pCurrMaxImageId)++;
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__//100206 ENFB support
- if ((disableENFB == 0) && (ENFBAssociatedIDFlag == MMI_TRUE))
- {
- if (ENFBAssociatedIDAdded == MMI_TRUE)//already in other associated group
- {
- AddENFBAssociatedIDItem(nImgId, upperFileName, res_type);
- ENFBAssociatedIDAdded = MMI_FALSE;
- }
- }
- #endif
- #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE)
- g_resimg_table[g_resimg_count].size = g_ressize;
- strcpy(g_resimg_table[g_resimg_count].filename, filename);
- g_resimg_count ++;
- RESPRTONERECORD(fpImageResourceUsage, nImgId, filename, enum_value, resfile);
- #endif /* #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE) */
- }
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- else /* 040805 CustPack: Calvin modified else case to let new set of images share the same resource of default image */
- {
- if (toolFlag)
- {
- resultFailFlag = 1;
- }
- ImageIdMap[nImgId].nImageId = nImgId;
- strcpy(ImageNameList[CurrMaxImageNum].filename, DEFAULT_FILEBUFFER);
- ImageIdMap[nImgId].nImageNum = CurrMaxImageNum;
- CurrMaxImageNum++;
- CurrMaxImageId++;
- }
- /* __CUSTPACK_MULTIBIN Calvin END */
- }
- sInfo.pDisplayValue = pDisplayName;
- sInfo.pValue = upperFileName;
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- disableENFB = 0;//100206 ENFB support
- #endif
- }
- /* 101205 audio resource Calvin Satrt */
- /*****************************************************************************
- * FUNCTION
- * SetAudioWithBuffer
- * DESCRIPTION
- * Function to copy the audio file to buffer
- * PARAMETERS
- * nAdoId [IN]
- * filename [?]
- * pDisplayName [?]
- * enum_value [?]
- * res_type [IN]
- * adoFlag [IN]
- * S8(?) [OUT] -> filename of the audio to be generated.
- * U16(?) [IN] -> AudioId
- * RETURNS
- * void
- *****************************************************************************/
- void SetAudioWithBuffer(U16 nAdoId, S8 *filename, S8 *pDisplayName, S8 *enum_value, U32 res_type, BOOL adoFlag, S8 *resfile) /* 120304 Calvin modified for media resource */
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 found = 0;
- S16 nStrlen;
- U16 nType;
- S8 upperFileName[MAX_FILENAME_LEN];
- unsigned short *pCurrMaxAudioId;
- unsigned short *pCurrMaxAudioNum;
- AUDIONAME_LIST *pAudioNameList;
- CUSTOM_AUDIO_MAP *pAudioIdMap;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (adoFlag == TRUE)
- {
- ExtAudioFlag = TRUE;
- pCurrMaxAudioId = &CurrMaxAudioIdEXT;
- pCurrMaxAudioNum = &CurrMaxAudioNumEXT;
- pAudioNameList = AudioNameListEXT;
- pAudioIdMap = AudioIdMapEXT;
- }
- else
- {
- ExtAudioFlag = FALSE;
- pCurrMaxAudioId = &CurrMaxAudioId;
- pCurrMaxAudioNum = &CurrMaxAudioNum;
- pAudioNameList = AudioNameList;
- pAudioIdMap = AudioIdMap;
- }
- if (*pCurrMaxAudioId >= MAX_AUDIO_IDS_SIZE)
- {
- return; /* Can't add more than max number of audio ids allowed */
- }
- fprintf(OutputAdoIDFile, "file name%d = %s n", audio_idx++, filename);
- if (strlen(filename) >= MAX_FILENAME_LEN)
- {
- filename[MAX_FILENAME_LEN - 1] = ' ';
- }
- if (!(strcmp(filename, "")))
- {
- strcpy(filename_buffer, NOAUDIO_FILENAMEBUFFER);
- }
- nStrlen = strlen(filename);
- while (nStrlen >= 0)
- {
- upperFileName[nStrlen] = toupper(filename[nStrlen]);
- --nStrlen;
- }
- for (i = 0; i < *pCurrMaxAudioNum; i++)
- {
- if (!strcmp(pAudioNameList[i].filename, upperFileName))
- {
- found = 1;
- break;
- }
- }
- if (pAudioIdMap[nAdoId].nAudioId != 0)
- {
- switch (res_type)
- {
- case RES_AUDIO:
- fprintf(RepeatIDListFile, "%dt%stt%sn", nAdoId, enum_value, "Audio");
- break;
- default:
- printf("Non supported resource type!n");
- }
- }
- g_ressize = 0;
- if (found)
- {
- pAudioIdMap[nAdoId].nAudioId = nAdoId;
- pAudioIdMap[nAdoId].nAudioNum = i;
- (*pCurrMaxAudioId)++;
- #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE)
- {
- S8 str1[MAX_AUDIO_NAMES_SIZE];
- S8 str2[MAX_AUDIO_NAMES_SIZE];
- U32 i, j;
- strcpy(str1, filename);
- for (j = 0; j < strlen(str1); j++)
- {
- str1[j] = toupper(str1[j]);
- }
- for (i = 0; i < g_resado_count; i++)
- {
- strcpy(str2, g_resado_table[i].filename);
- for (j = 0; j < strlen(str1); j++)
- {
- str2[j] = toupper(str2[j]);
- }
- if (strcmp(str1, str2) == 0)
- {
- g_ressize = g_resado_table[i].size;
- break;
- }
- }
- }
- RESPRTONERECORD(fpAudioResourceUsage, nAdoId, filename, enum_value, resfile);
- #endif /* #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE) */
- }
- else
- {
- if (Aload(upperFileName, &nType))
- {
- pAudioIdMap[nAdoId].nAudioId = nAdoId;
- strcpy(pAudioNameList[*pCurrMaxAudioNum].filename, upperFileName);
- pAudioIdMap[nAdoId].nAudioNum = *pCurrMaxAudioNum;
- (*pCurrMaxAudioNum)++;
- (*pCurrMaxAudioId)++;
- #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE)
- g_resado_table[g_resado_count].size = g_ressize;
- strcpy(g_resado_table[g_resado_count].filename, filename);
- g_resado_count ++;
- RESPRTONERECORD(fpAudioResourceUsage, nAdoId, filename, enum_value, resfile);
- #endif /* #if defined(_POPULATE_RES_C) && !defined(PRODUCTION_RELEASE) */
- }
- else
- {
- if (toolFlag)
- {
- resultFailFlag = 1;
- }
- AudioIdMap[nAdoId].nAudioId = nAdoId;
- strcpy(AudioNameList[CurrMaxAudioNum].filename, AUDIO_DEFAULT_FILEBUFFER);
- AudioIdMap[nAdoId].nAudioNum = CurrMaxAudioNum;
- CurrMaxAudioNum++;
- CurrMaxAudioId++;
- }
- }
- }
- /* 101205 audio resource Calvin End */
- /*****************************************************************************
- * FUNCTION
- * MenuItemPresent
- * DESCRIPTION
- * Function to find ImageId
- * PARAMETERS
- * ItemId [IN]
- * U16(?) [IN] -> ImageId
- * RETURNS
- * U16
- *****************************************************************************/
- U16 MenuItemPresent(U16 ItemId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < CurrMaxMenuItemIndex; i++)
- {
- if (nCustMenus[i].nMenuItemId == ItemId)
- {
- return TRUE;
- }
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * PrintMenuItems
- * DESCRIPTION
- * Fills the CUSTOM_MENU structure, for MenuTree Tool usage
- * PARAMETERS
- * arg1 [?]
- * U16(?) [IN] -> variable argument list
- * RETURNS
- * void
- *****************************************************************************/
- static char is_dummy_code = 0; /* To check if it needs to generate for menu tree tool or not. */
- void PrintMenuItems(char *arg1)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* static U8 is_first=1; */
- FILE *fout;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (is_dummy_code == 1)
- {
- return;
- }
- if (is_first)
- {
- fout = fopen(OUTPUT_MENUTREE_FILENAME, "w");
- is_first = 0;
- }
- else
- {
- fout = fopen(OUTPUT_MENUTREE_FILENAME, "a");
- }
- fprintf(fout, "ADD_APPLICATION_MENUITEM2(%s);n", arg1);
- fclose(fout);
- }
- /*****************************************************************************
- * FUNCTION
- * PrintMenuItems2
- * DESCRIPTION
- * Fills the CUSTOM_MENU structure, for MenuTree Tool usage
- * PARAMETERS
- * arg1 [?]
- * U16(?) [IN] -> variable argument list
- * RETURNS
- * void
- *****************************************************************************/
- void PrintMenuItems2(char *arg1, ...)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* static U8 is_first=1; */
- FILE *fout;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (is_dummy_code == 1)
- {
- return;
- }
- if (is_first)
- {
- fout = fopen(OUTPUT_MENUTREE_FILENAME, "w");
- is_first = 0;
- }
- else
- {
- fout = fopen(OUTPUT_MENUTREE_FILENAME, "a");
- }
- fprintf(fout, "ADD_APPLICATION_MENUITEM3(%s);n", arg1);
- fclose(fout);
- }
- /*****************************************************************************
- * FUNCTION
- * SetMenuItem
- * DESCRIPTION
- * Fills the CUSTOM_MENU structure
- * PARAMETERS
- * arg1 [IN]
- * U16(?) [IN] -> variable argument list
- * RETURNS
- * void
- *****************************************************************************/
- void SetMenuItem(U16 arg1, ...)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 MemberCounter = 9;
- U16 i = arg1;
- U16 j;
- U16 menuItemID;
- va_list argumentPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* 091004 MTK Calvin removed to reduce populate time */
- //FILE *fout;
- //static U8 is_first=1;
- //if (is_first)
- //{
- // fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"w");
- // is_first= 0;
- //}
- /* MTK Calvin end */
- #ifdef _POPULATE_RES_C
- va_start(argumentPtr, arg1);
- #endif /* _POPULATE_RES_C */
- RESPRT(fpMenuResourceUsage, "NO_APP", -1, i, "unknown", 1, "none", g_resmenu_filename);
- /* Need to decide whether menu item already present */
- if (!MenuItemPresent(i))
- {
- /* 091004 MTK Calvin removed fopen and fclose to reduce populate time and replaced fout with OutputMenutreeIDFile */
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "ADD_APPLICATION_MENUITEM2((", arg1);
- /* fclose(fout); */
- is_dummy_code = 0;
- while (MemberCounter)
- {
- switch (MemberCounter)
- {
- case MENUITEM_ID_TYPE:
- menuItemID = i - 1;
- nCustMenus[menuItemID].nMenuItemId = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- break;
- case PARENT_ITEM_ID_TYPE:
- nCustMenus[menuItemID].nParentId = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- break;
- case NUMBER_OF_MENUITEMS_TYPE:
- nCustMenus[menuItemID].nNumofMenuItem = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- break;
- case MENU_ITEM_ORDER_TYPE:
- if (nCustMenus[menuItemID].nNumofMenuItem == 0)
- {
- nCustMenus[menuItemID].nOrderMenuItemId = (U16*) 0;
- }
- else
- {
- nCustMenus[menuItemID].nOrderMenuItemId = (U16*) malloc(sizeof(U16) * MENU_ITEM_SIZE);
- for (j = 0; j < nCustMenus[menuItemID].nNumofMenuItem; j++)
- {
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- nCustMenus[menuItemID].nOrderMenuItemId[j] = i;
- i = va_arg(argumentPtr, int);
- }
- }
- break;
- case HIDE_FLAG_TYPE:
- nCustMenus[menuItemID].nHideFlag = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- break;
- case MOVEABLE_FLAG_TYPE:
- nCustMenus[menuItemID].nMovable = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- break;
- case DISPLAY_ATTRIBUTE_TYPE:
- nCustMenus[menuItemID].nDispAttribute = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- break;
- case MENU_ITEM_STRING_ID_TYPE:
- nCustMenus[menuItemID].nStrId = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d,", i);
- /* fclose(fout); */
- break;
- case MENU_ITEM_IMAGE_ID_TYPE:
- nCustMenus[menuItemID].nImageId = i;
- /* fout = fopen(OUTPUT_MENUTREE_ID_FILENAME,"a"); */
- fprintf(OutputMenutreeIDFile, "%d));n", i);
- /* fclose(fout); */
- break;
- }
- if (MemberCounter != MENU_ITEM_ORDER_TYPE)
- {
- i = va_arg(argumentPtr, int);
- }
- MemberCounter--;
- }
- /* MTK Calvin end */
- }
- else
- {
- is_dummy_code = 1;
- }
- va_end(argumentPtr);
- }
- /*****************************************************************************
- * FUNCTION
- * SetMenuItem2
- * DESCRIPTION
- * Fills the CUSTOM_MENU structure
- * PARAMETERS
- * arg1 [IN]
- * U16(?) [IN] -> variable argument list
- * RETURNS
- * void
- *****************************************************************************/
- void SetMenuItem2(U16 arg1, ...)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 MemberCounter = 9;
- U16 i = arg1;
- U16 j;
- U16 menuItemID;
- va_list argumentPtr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- va_start(argumentPtr, arg1);
- #ifdef _POPULATE_RES_C
- RESPRT(fpMenuResourceUsage, "NO_APP", -1, i, "unknown", 1, "none", g_resmenu_filename);
- #endif /* _POPULATE_RES_C */
- /* Need to decide whether menu item already present */
- if (!MenuItemPresent(i))
- {
- fprintf(OutputMenutreeIDFile, "ADD_APPLICATION_MENUITEM2((", arg1);
- is_dummy_code = 0;
- while (MemberCounter)
- {
- switch (MemberCounter)
- {
- case MENUITEM_ID_TYPE:
- menuItemID = i - 1;
- nCustMenus[menuItemID].nMenuItemId = i;
- fprintf(OutputMenutreeIDFile, "%d,", i);
- break;
- case PARENT_ITEM_ID_TYPE:
- nCustMenus[menuItemID].nParentId = i;
- fprintf(OutputMenutreeIDFile, "%d,", i);
- break;
- case MENU_ITEM_ORDER_TYPE:
- if ( /* nCustMenus[menuItemID].nNumofMenuItem==0 || */ i == MENU_ITEM_END)
- {
- nCustMenus[menuItemID].nOrderMenuItemId = (U16*) 0;
- fprintf(OutputMenutreeIDFile, "0,");
- i = va_arg(argumentPtr, int);
- }
- else
- {
- U16 number_of_child = 0;
- nCustMenus[menuItemID].nOrderMenuItemId = (U16*) malloc(sizeof(U16) * MENU_ITEM_SIZE);
- while (i < MENU_ITEM_END)
- {
- nCustMenus[menuItemID].nOrderMenuItemId[number_of_child] = i;
- i = va_arg(argumentPtr, int);
- number_of_child++;
- }
- nCustMenus[menuItemID].nNumofMenuItem = number_of_child; /* Set number of child field */
- fprintf(OutputMenutreeIDFile, "%d,", number_of_child);
- for (i = 0; i < number_of_child; i++)
- {
- fprintf(OutputMenutreeIDFile, "%d,", nCustMenus[menuItemID].nOrderMenuItemId[i]);
- }
- i = va_arg(argumentPtr, int); /* read in next argument. */
- }
- break;
- case HIDE_FLAG_TYPE:
- nCustMenus[menuItemID].nHideFlag = i;
- fprintf(OutputMenutreeIDFile, "%d,", i);
- break;
- case MOVEABLE_FLAG_TYPE:
- nCustMenus[menuItemID].nMovable = i;
- fprintf(OutputMenutreeIDFile, "%d,", i);
- break;
- case DISPLAY_ATTRIBUTE_TYPE:
- nCustMenus[menuItemID].nDispAttribute = i;
- fprintf(OutputMenutreeIDFile, "%d,", i);
- break;
- case MENU_ITEM_STRING_ID_TYPE:
- nCustMenus[menuItemID].nStrId = i;
- fprintf(OutputMenutreeIDFile, "%d,", i);
- break;
- case MENU_ITEM_IMAGE_ID_TYPE:
- nCustMenus[menuItemID].nImageId = i;
- fprintf(OutputMenutreeIDFile, "%d));n", i);
- break;
- }
- if (MemberCounter != MENU_ITEM_ORDER_TYPE)
- {
- i = va_arg(argumentPtr, int);
- }
- if (MemberCounter == PARENT_ITEM_ID_TYPE) /* Skip NUMBER_OF_MENUITEMS_TYPE field */
- {
- MemberCounter -= 2;
- }
- else
- {
- MemberCounter--;
- }
- }
- }
- else
- {
- is_dummy_code = 1;
- }
- va_end(argumentPtr);
- }
- /*****************************************************************************
- * FUNCTION
- * Get_Image_Identifier
- * DESCRIPTION
- * Identifies the image , BMP , ppf etc
- *
- * This function will be refined later when multiple
- * image type will be supported by the frame work
- * rt. now it just a added hook to make the design complete
- * PARAMETERS
- * extension_type [IN]
- * RETURNS
- * U8
- *****************************************************************************/
- U8 Get_Image_Identifier(S32 extension_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 ret;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (extension_type < 0)
- {
- ret = 0;
- }
- else if (extension_type == 0)
- {
- ret = 1;
- }
- return (U8) ret;
- }
- /*****************************************************************************
- * FUNCTION
- * Load_Image_Data
- * DESCRIPTION
- * Identifies the image , BMP , ppf etc
- * PARAMETERS
- * offset [OUT] File offset --> file offset
- * output_file [IN] -> Name of the file to which buffer
- * input_file [IN] -> Name of the input image file
- * pImgData [OUT] -> buffer containing image data
- * image_identifier [IN] -> image identifier
- * n_frames [IN] -> no of frames
- * is(?) [IN] To be written
- * RETURNS
- * S32 --> file size
- *****************************************************************************/
- /* __CUSTPACK_MULTIBIN Calvin BEGIN */
- /* 040805 CustPack: Calvin modified */
- S32 Load_Image_Data(
- U32 *offset,
- FILE *output_file,
- FILE *input_file,
- U8 *pImgData,
- U8 image_identifier,
- S32 n_frames)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 file_size, i, o = 0;
- U8 ch;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- fseek(input_file, 0, SEEK_END);
- file_size = ftell(input_file);
- fseek(input_file, 0, SEEK_SET);
- if (toolFlag)
- {
- fprintf(dest_file, "%c%c", image_identifier, n_frames);
- if (image_identifier == IMAGE_TYPE_GIF || image_identifier == IMAGE_TYPE_3GP ||
- image_identifier == IMAGE_TYPE_MP4 || image_identifier == IMAGE_TYPE_AVI ||
- image_identifier == IMAGE_TYPE_PNG || image_identifier == IMAGE_TYPE_M3D ||
- image_identifier == IMAGE_TYPE_SWFLASH)
- {
- fprintf(
- dest_file,
- "%c%c%c%c%c%c",
- file_size & 0xff,
- (file_size & 0xff00) >> 8,
- (file_size & 0xff0000) >> 16,
- (file_size & 0xff000000) >> 24,
- 0,
- 0);
- }
- else
- {
- fprintf(
- dest_file,
- "%c%c%c%c",
- file_size & 0xff,
- (file_size & 0xff00) >> 8,
- (file_size & 0xff0000) >> 16,
- (file_size & 0xff000000) >> 24);
- }
- }
- /* 100206 ENFB support Start */
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- else if (enfbFlag == 1) /* write ENFB header to CustImgDataxxx.h and image header/data to ENFB image data file */
- {
- fprintf(enfb_img_data_file, "%c%c", image_identifier, n_frames);
- if (image_identifier == IMAGE_TYPE_GIF || image_identifier == IMAGE_TYPE_3GP ||
- image_identifier == IMAGE_TYPE_MP4 || image_identifier == IMAGE_TYPE_AVI ||
- image_identifier == IMAGE_TYPE_PNG || image_identifier == IMAGE_TYPE_M3D ||
- image_identifier == IMAGE_TYPE_SWFLASH)
- {
- fprintf(
- enfb_img_data_file,
- "%c%c%c%c%c%c",
- file_size & 0xff,
- (file_size & 0xff00) >> 8,
- (file_size & 0xff0000) >> 16,
- (file_size & 0xff000000) >> 24,
- 0,
- 0);
- enfb_size = 8 + file_size;
- }
- else
- {
- fprintf(
- enfb_img_data_file,
- "%c%c%c%c",
- file_size & 0xff,
- (file_size & 0xff00) >> 8,
- (file_size & 0xff0000) >> 16,
- (file_size & 0xff000000) >> 24);
- enfb_size = 6 + file_size;
- }
- /* write ENFB header to CustImgDataxxx.h */
- fprintf(
- output_file,
- "nt0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02Xt",
- (U8) 255,//type
- (U8) ENFBAssociatedIDAdded,//associated id
- (U8) 0,//reserved
- (U8) 0,//reserved
- (U8) (enfb_offset & 0xff),
- (U8) ((enfb_offset >> 8) & 0xff),
- (U8) ((enfb_offset >> 16) & 0xff),
- (U8) ((enfb_offset >> 24) & 0xff),
- (U8) (enfb_size & 0xff),
- (U8) ((enfb_size >> 8) & 0xff),
- (U8) ((enfb_size >> 16) & 0xff),
- (U8) ((enfb_size >> 24) & 0xff));
- enfb_offset += enfb_size;
- }
- #endif
- /* 100206 ENFB support End */
- else
- {
- fprintf(output_data_file, "nt0x%02X, 0x%02X, ", image_identifier, n_frames);
- if (image_identifier == IMAGE_TYPE_GIF || image_identifier == IMAGE_TYPE_3GP ||
- image_identifier == IMAGE_TYPE_MP4 || image_identifier == IMAGE_TYPE_AVI ||
- image_identifier == IMAGE_TYPE_PNG || image_identifier == IMAGE_TYPE_M3D ||
- image_identifier == IMAGE_TYPE_SWFLASH)
- {
- fprintf(
- output_file,
- "0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x00, 0x00,nt",
- file_size & 0xff,
- (file_size & 0xff00) >> 8,
- (file_size & 0xff0000) >> 16,
- (file_size & 0xff000000) >> 24);
- }
- else
- {
- fprintf(
- output_file,
- "0x%02X, 0x%02X, 0x%02X, 0x%02X,nt",
- file_size & 0xff,
- (file_size & 0xff00) >> 8,
- (file_size & 0xff0000) >> 16,
- (file_size & 0xff000000) >> 24);
- }
- }
- pImgData[0] = (U8) image_identifier;
- pImgData[1] = (U8) n_frames;
- pImgData[2] = (U8) (file_size & 0xff);
- pImgData[3] = (U8) ((file_size & 0xff00) >> 8);
- pImgData[4] = (U8) ((file_size & 0xff0000) >> 16);
- pImgData[5] = (U8) ((file_size & 0xff000000) >> 24);
- for (i = 0; i < file_size; i++)
- {
- ch = fgetc(input_file);
- if (toolFlag)
- {
- fputc(ch, dest_file);
- (*offset)++;
- (pImgData)[i + 6] = ch;
- }
- /* 100206 ENFB support Start */
- #ifdef __MMI_RESOURCE_ENFB_SUPPORT__
- else if (enfbFlag == 1) /* write image data to ENFB image data file */
- {
- fputc(ch, enfb_img_data_file);
- (*offset)++;
- (pImgData)[i + 6] = ch;
- }
- #endif
- /* 100206 ENFB support End */
- else
- {
- fprintf(output_file, "0x%02X, ", ch);
- (*offset)++;
- (pImgData)[i + 6] = ch;
- o++;
- if ((o % 16) == 0)
- {
- fprintf(output_file, "nt");
- }
- }
- }
- if (image_identifier == IMAGE_TYPE_GIF || image_identifier == IMAGE_TYPE_3GP ||
- image_identifier == IMAGE_TYPE_MP4 || image_identifier == IMAGE_TYPE_AVI ||
- image_identifier == IMAGE_TYPE_PNG || image_identifier == IMAGE_TYPE_M3D ||
- image_identifier == IMAGE_TYPE_SWFLASH)
- {
- return file_size + 8;
- }
- else
- {
- return file_size + 6;
- }
- }
- /* 101205 audio resource Calvin Satrt */
- /*****************************************************************************
- * FUNCTION