GameSimu.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:96k
源码类别:

MTK

开发平台:

C/C++

  1. #ifndef _MMI_GAME_C_ss
  2. #define _MMI_GAME_C_ss
  3. #if defined(__GAME_SIMU__)
  4. #include "GameSimuProts.h"     //KP Jerry add on 2007-4-19
  5. #include "game_simu_release.h"
  6. #include "Lcd_if.h"
  7. #include "USBDeviceGprot.h"
  8. #include "USBDeviceDefs.h"
  9. #include "USBDeviceGexdcl.h"
  10. #include "CommonScreens.h"
  11. #include "MainMenuDef.h"
  12. // for MMI
  13. #include "fs_type.h"
  14. #include "FileMgr.h"
  15. #include "FileManagerGProt.h"
  16. #include "FileManagerDef.h"
  17. #include "Conversions.h"
  18. #include "fs_errcode.h"
  19. //#include "EBookDefs.h"
  20. #define GAME_SEARCH_GB_STR            "*.gb"
  21. #define GAME_SEARCH_GBC_STR            "*.gbc"
  22. #define GAME_SEARCH_NES_STR            "*.nes"
  23. #define GAME_GB_FILE_EXT           ".gb"
  24. #define GAME_GBC_FILE_EXT           ".gbc"
  25. #define GAME_NES_FILE_EXT           ".nes"
  26. #define GAME_DOWNLOADED_PATH ":\Game\"
  27. #define   MAX_DWNL_GAME_PATH_LEN            (60)
  28. #define MAX_GAME_NAME_LENGTH 60
  29. #define   GAME_LIST_MAX_SETTINGS_MEM_TYPE      11
  30. typedef enum
  31. {
  32.     GAME_CARD_MEMORY = 0,
  33.     GAME_PHONE_MEMORY,
  34.     GAME_MAX_MEMORY
  35. } game_memory_type_enum;
  36. typedef enum
  37. {
  38.     GAME_FRM_SEARCH_DEFAULT = 0,
  39.     GAME_FRM_SEARCH_GB,
  40.     GAME_FRM_SEARCH_GBC,
  41.     GAME_FRM_SEARCH_NES,
  42.     GAME_FRM_SEARCH_MAX
  43. } game_list_frm_search_type_enum;
  44. ////////////////////////////////
  45. S8 memory_type_selected;
  46. S8 auto_gen_game_list;
  47. U8 game_simu_fmgr_filter;
  48. U8 game_simu_long_key_press = 0x00;
  49. U8 game_simu_play_audio_poweron = 0;
  50. extern pBOOL IsBackHistory;
  51. ////////////////////////////////
  52. //U8 file_path_buf[(FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH];
  53. U8 game_simu_search_type_path;
  54. typedef struct
  55. {
  56.     S32   inlineHighligtItemSelectMemory;
  57.  //   S32   inlineHighligtItemSelectAutoGen;
  58. } GAME_SIMU_SET_CNTX;
  59. typedef struct
  60. {
  61.     U8 *game_list_settings_memory_type[2];
  62. //    U8 *game_list_settings_auto_gen[2];
  63. } game_simu_app_cntx;
  64. typedef struct 
  65. {
  66. BOOL  bLCDState; // 0:竖屏, 1:横屏
  67. BOOL  bVolu; // 1:on 0:off
  68. }gamesimu_settings_struct;
  69. typedef enum
  70. {
  71.     MMI_GAMESIMU_SETTING_LCD,
  72.     MMI_GAMESIMU_SETTING_AUD,
  73.     MMI_GAMESIMU_SETTING_ITEM_COUNT
  74. } mmi_gamesimu_setting_inline_enum;
  75. typedef struct 
  76. {
  77.     /* strings for inline selection display */
  78.     UI_string_type lcd_str[2];
  79.     UI_string_type aud_str[2];
  80.     S32 lcd_selected;
  81.     S32 aud_selected;
  82.     /* inline selection item */
  83.     InlineItem inline_game_items[MMI_GAMESIMU_SETTING_ITEM_COUNT *2];      /* one for caption, one for selection */
  84. } mmi_gamesimu_cntx_struct;
  85. GAME_SIMU_SET_CNTX g_game_simu_set_cntx;
  86. game_simu_app_cntx g_game_simu_app_cntx;
  87. game_simu_app_cntx *g_game_simu_app_cntx_p = &g_game_simu_app_cntx;
  88. gamesimu_settings_struct game_simu_settings;
  89. mmi_gamesimu_cntx_struct gamesimu_cntx;
  90. void game_list_entry_settings(void);
  91. void mmi_entry_game_list_screen(void);
  92. //void mmi_gamesimu_highlight_help(void);
  93. void mmi_gamesimu_entry_help_screen(void);
  94. void mmi_gamesimu_store_setting(void);
  95. static void mmi_gamesimu_entry_setting_screen(void);
  96. /****************************************************************************
  97. * Macro                                                                
  98. *****************************************************************************/
  99. #define GAME_SIMU_SWITCH(index, func_ptr)                             
  100. {                                                                
  101.      SetLeftSoftkeyFunction(func_ptr,KEY_EVENT_UP);          
  102.      SetKeyHandler(func_ptr, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  103. }
  104. //====================================================================================================================//
  105. //====================================================================================================================//
  106. //==================================================游戏模拟器开放源代码==============================================//
  107. //====================================================================================================================//
  108. //====================================================================================================================//
  109. extern void debug_uart_output_data( const char *pu8_format_str, ... );
  110. extern  void printfbuf(U8 *pu8_buf, U32 u32_len);
  111. extern void ShowTimeMs(kal_char *u8_str, U32 u32_time1, U32 u32_time2); // DRV_Reg32(KEY_REGISTER_TIME)
  112. //======================================================================================================================//
  113. //======================================================================================================================//
  114. //=========================================== 一、按键接口        ======================================//
  115. //======================================================================================================================//
  116. //======================================================================================================================//
  117. //=============================游戏按键位定义(有键按下时为1)=============================//
  118. // MENU ESC MUTE|TOPR TOPL OK SELECT | Y X B A | RIGHT LEFT DOWN UP  //
  119. //   高位0000  1   1   1    1    1    1    1     1 1 1 1     1     1    1  1 低位  //
  120. // 作    者: 北京英晔科技  //
  121. //=======================================================================================//
  122. U32 u32_g_keypad_value; // 按键键值
  123. //===================================游戏按键寄存器定义==================================//
  124. // 说   明: 根据手机硬件的不同各按键对应寄存器以及位不同,需要在此定义  //
  125. // 作    者: 北京英晔科技  //
  126. //=======================================================================================//
  127. #define KEY_REGISTER_TIME 0x80200230
  128. #define KEY_REGISTER_LOW 0x80110004
  129. #define KEY_REGISTER_MID 0x80110008
  130. #define KEY_REGISTER_HIG 0x8011000c
  131. #if defined(__P02_QVGA__)
  132. const U16 KEY_PUB_LSK = (~(0x0001));
  133. const U16 KEY_LEFT = (~(0x0002));
  134. const U16 KEY_UP = (~(0x0004));
  135. const U16 KEY_PUB_RSK = (~(0x0008));
  136. const U16 KEY_PUB_VOLUP = (~(0x0010));
  137. //(~(0x0020));
  138. //(~(0x0040));
  139. const U16 KEY_PUB_CALL = (~(0x0080));
  140. const U16 KEY_DOWN = (~(0x0100));
  141. const U16 KEY_PUB_OK = (~(0x0200));
  142. const U16 KEY_RIGHT = (~(0x0400));
  143. const U16 KEY_PUB_VOLDOWN = (~(0x0800));
  144. //(~(0x1000));
  145. //(~(0x2000));
  146. const U16 KEY_PUB_1 = (~(0x4000));
  147. const U16 KEY_PUB_4 = (~(0x8000));
  148. const U16 KEY_PUB_7 = (~(0x0001));
  149. const U16 KEY_PUB_STAR = (~(0x0002));
  150. const U16 KEY_PUB_CAMERA = (~(0x0004));
  151. //(~(0x0008));
  152. //(~(0x0010));
  153. const U16 KEY_PUB_2 = (~(0x0020));
  154. const U16 KEY_PUB_5 = (~(0x0040));
  155. const U16 KEY_PUB_8 = (~(0x0080));
  156. const U16 KEY_PUB_0 = (~(0x0100));
  157. //(~(0x0200));
  158. //(~(0x0400));
  159. //(~(0x0800));
  160. const U16 KEY_PUB_3 = (~(0x1000));
  161. const U16 KEY_PUB_6 = (~(0x2000));
  162. const U16 KEY_PUB_9 = (~(0x4000));
  163. const U16 KEY_PUB_WELL = (~(0x8000));
  164. //(~(0x0001));
  165. //(~(0x0002));
  166. //(~(0x0004));
  167. //(~(0x0008));
  168. //(~(0x0010));
  169. //(~(0x0020));
  170. //(~(0x0040));
  171. //(~(0x0080));
  172. //(~(0x0100));
  173. const U16 KEY_PUB_ESC = (~(0x0200));
  174. const U32 REGISTER_PUB_LSK = KEY_REGISTER_LOW;
  175. const U32 REGISTER_LEFT = KEY_REGISTER_LOW;
  176. const U32 REGISTER_UP  = KEY_REGISTER_LOW;
  177. const U32 REGISTER_PUB_RSK = KEY_REGISTER_LOW;
  178. const U32 REGISTER_PUB_VOLUP = KEY_REGISTER_LOW;
  179. //
  180. //
  181. const U32 REGISTER_PUB_CALL = KEY_REGISTER_LOW;
  182. const U32 REGISTER_DOWN = KEY_REGISTER_LOW;
  183. const U32 REGISTER_PUB_OK  = KEY_REGISTER_LOW;
  184. const U32 REGISTER_RIGHT = KEY_REGISTER_LOW;
  185. const U32 REGISTER_PUB_VOLDOWN = KEY_REGISTER_LOW;
  186. //
  187. //
  188. const U32 REGISTER_PUB_1 = KEY_REGISTER_LOW;
  189. const U32 REGISTER_PUB_4 = KEY_REGISTER_LOW;
  190. const U32 REGISTER_PUB_7 = KEY_REGISTER_MID;
  191. const U32 REGISTER_PUB_STAR = KEY_REGISTER_MID;
  192. const U32 REGISTER_PUB_CAMERA = KEY_REGISTER_MID;
  193. //
  194. //
  195. const U32 REGISTER_PUB_2 = KEY_REGISTER_MID;
  196. const U32 REGISTER_PUB_5 = KEY_REGISTER_MID;
  197. const U32 REGISTER_PUB_8 = KEY_REGISTER_MID;
  198. const U32 REGISTER_PUB_0 = KEY_REGISTER_MID;
  199. //
  200. //
  201. //
  202. const U32 REGISTER_PUB_3 = KEY_REGISTER_MID;
  203. const U32 REGISTER_PUB_6 = KEY_REGISTER_MID;
  204. const U32 REGISTER_PUB_9 = KEY_REGISTER_MID;
  205. const U32 REGISTER_PUB_WELL = KEY_REGISTER_MID;
  206. //
  207. //
  208. //
  209. //
  210. //
  211. //
  212. //
  213. //
  214. //
  215. const U32 REGISTER_PUB_ESC = KEY_REGISTER_HIG;
  216. #elif defined(__P08_QVGA__)
  217. const U16 KEY_PUB_LSK = (~(0x0001));
  218. const U16 KEY_LEFT = (~(0x0002));
  219. const U16 KEY_UP = (~(0x0004));
  220. const U16 KEY_PUB_RSK = (~(0x0008));
  221. //(~(0x0010));
  222. //(~(0x0020));
  223. //(~(0x0040));
  224. const U16 KEY_PUB_CALL = (~(0x0080));
  225. const U16 KEY_DOWN = (~(0x0100));
  226. const U16 KEY_PUB_OK = (~(0x0200));
  227. const U16 KEY_RIGHT = (~(0x0400));
  228. //(~(0x0800));
  229. //(~(0x1000));
  230. //(~(0x2000));
  231. const U16 KEY_PUB_1 = (~(0x4000));
  232. const U16 KEY_PUB_4 = (~(0x8000));
  233. const U16 KEY_PUB_7 = (~(0x0001));
  234. const U16 KEY_PUB_STAR = (~(0x0002));
  235. const U16 KEY_PUB_VOLUP = (~(0x0004));
  236. //(~(0x0008));
  237. //(~(0x0010));
  238. const U16 KEY_PUB_2 = (~(0x0020));
  239. const U16 KEY_PUB_5 = (~(0x0040));
  240. const U16 KEY_PUB_8 = (~(0x0080));
  241. const U16 KEY_PUB_0 = (~(0x0100));
  242. const U16 KEY_PUB_VOLDOWN = (~(0x0200));
  243. //(~(0x0400));
  244. //(~(0x0800));
  245. const U16 KEY_PUB_3 = (~(0x1000));
  246. const U16 KEY_PUB_6 = (~(0x2000));
  247. const U16 KEY_PUB_9 = (~(0x4000));
  248. const U16 KEY_PUB_WELL = (~(0x8000));
  249. const U16 KEY_PUB_CAMERA = (~(0x0001));
  250. //(~(0x0002));
  251. //(~(0x0004));
  252. //(~(0x0008));
  253. //(~(0x0010));
  254. //(~(0x0020));
  255. //(~(0x0040));
  256. //(~(0x0080));
  257. //(~(0x0100));
  258. const U16 KEY_PUB_ESC = (~(0x0200));
  259. const U32 REGISTER_PUB_LSK = KEY_REGISTER_LOW;
  260. const U32 REGISTER_LEFT = KEY_REGISTER_LOW;
  261. const U32 REGISTER_UP  = KEY_REGISTER_LOW;
  262. const U32 REGISTER_PUB_RSK = KEY_REGISTER_LOW;
  263. //
  264. //
  265. //
  266. const U32 REGISTER_PUB_CALL = KEY_REGISTER_LOW;
  267. const U32 REGISTER_DOWN = KEY_REGISTER_LOW;
  268. const U32 REGISTER_PUB_OK  = KEY_REGISTER_LOW;
  269. const U32 REGISTER_RIGHT = KEY_REGISTER_LOW;
  270. //
  271. //
  272. //
  273. const U32 REGISTER_PUB_1 = KEY_REGISTER_LOW;
  274. const U32 REGISTER_PUB_4 = KEY_REGISTER_LOW;
  275. const U32 REGISTER_PUB_7 = KEY_REGISTER_MID;
  276. const U32 REGISTER_PUB_STAR = KEY_REGISTER_MID;
  277. const U32 REGISTER_PUB_VOLUP = KEY_REGISTER_MID;
  278. //
  279. //
  280. const U32 REGISTER_PUB_2 = KEY_REGISTER_MID;
  281. const U32 REGISTER_PUB_5 = KEY_REGISTER_MID;
  282. const U32 REGISTER_PUB_8 = KEY_REGISTER_MID;
  283. const U32 REGISTER_PUB_0 = KEY_REGISTER_MID;
  284. const U32 REGISTER_PUB_VOLDOWN = KEY_REGISTER_MID;
  285. //
  286. //
  287. const U32 REGISTER_PUB_3 = KEY_REGISTER_MID;
  288. const U32 REGISTER_PUB_6 = KEY_REGISTER_MID;
  289. const U32 REGISTER_PUB_9 = KEY_REGISTER_MID;
  290. const U32 REGISTER_PUB_WELL = KEY_REGISTER_MID;
  291. const U32 REGISTER_PUB_CAMERA = KEY_REGISTER_HIG;
  292. //
  293. //
  294. //
  295. //
  296. //
  297. //
  298. //
  299. //
  300. const U32 REGISTER_PUB_ESC = KEY_REGISTER_HIG;
  301. #elif defined(__S03_QVGA__)
  302. const U16 KEY_PUB_1 = (~(0x0001));
  303. const U16 KEY_PUB_2 = (~(0x0002));
  304. const U16 KEY_PUB_3 = (~(0x0004));
  305. const U16 KEY_PUB_4 = (~(0x0008));
  306. const U16 KEY_PUB_VOLUP = (~(0x0010));
  307. //(~(0x0020));
  308. //(~(0x0040));
  309. const U16 KEY_PUB_6 = (~(0x0080));
  310. const U16 KEY_PUB_7 = (~(0x0100));
  311. const U16 KEY_PUB_8 = (~(0x0200));
  312. const U16 KEY_PUB_9 = (~(0x0400));
  313. const U16 KEY_PUB_VOLDOWN = (~(0x0800));
  314. //(~(0x1000));
  315. //(~(0x2000));
  316. const U16 KEY_PUB_STAR = (~(0x4000));
  317. const U16 KEY_PUB_0 = (~(0x8000));
  318. const U16 KEY_PUB_WELL = (~(0x0001));
  319. const U16 KEY_PUB_5 = (~(0x0002));
  320. const U16 KEY_PUB_CAMERA = (~(0x0004));
  321. //(~(0x0008));
  322. //(~(0x0010));
  323. const U16 KEY_UP = (~(0x0020));
  324. const U16 KEY_DOWN = (~(0x0040));
  325. const U16 KEY_LEFT = (~(0x0080));
  326. const U16 KEY_RIGHT = (~(0x0100));
  327. //(~(0x0200));
  328. //(~(0x0400));
  329. //(~(0x0800));
  330. const U16 KEY_PUB_OK = (~(0x1000));
  331. const U16 KEY_PUB_LSK = (~(0x2000));
  332. const U16 KEY_PUB_RSK = (~(0x4000));
  333. //(~(0x8000));
  334. //(~(0x0001));
  335. //(~(0x0002));
  336. //(~(0x0004));
  337. //(~(0x0008));
  338. const U16 KEY_PUB_CALL = (~(0x0010));
  339. //(~(0x0020));
  340. //(~(0x0040));
  341. //(~(0x0080));
  342. //(~(0x0100));
  343. const U16 KEY_PUB_ESC = (~(0x0200));
  344. const U32 REGISTER_PUB_1 = KEY_REGISTER_LOW;
  345. const U32 REGISTER_PUB_2 = KEY_REGISTER_LOW;
  346. const U32 REGISTER_PUB_3 = KEY_REGISTER_LOW;
  347. const U32 REGISTER_PUB_4 = KEY_REGISTER_LOW;
  348. const U32 REGISTER_PUB_VOLUP = KEY_REGISTER_LOW;
  349. //
  350. //
  351. const U32 REGISTER_PUB_6 = KEY_REGISTER_LOW;
  352. const U32 REGISTER_PUB_7 = KEY_REGISTER_LOW;
  353. const U32 REGISTER_PUB_8 = KEY_REGISTER_LOW;
  354. const U32 REGISTER_PUB_9 = KEY_REGISTER_LOW;
  355. const U32 REGISTER_PUB_VOLDOWN = KEY_REGISTER_LOW;
  356. //
  357. //
  358. const U32 REGISTER_PUB_STAR = KEY_REGISTER_LOW;
  359. const U32 REGISTER_PUB_0 = KEY_REGISTER_LOW;
  360. const U32 REGISTER_PUB_WELL = KEY_REGISTER_MID;
  361. const U32 REGISTER_PUB_5 = KEY_REGISTER_MID;
  362. const U32 REGISTER_PUB_CAMERA = KEY_REGISTER_MID;
  363. //
  364. //
  365. const U32 REGISTER_UP  = KEY_REGISTER_MID;
  366. const U32 REGISTER_DOWN = KEY_REGISTER_MID;
  367. const U32 REGISTER_LEFT = KEY_REGISTER_MID;
  368. const U32 REGISTER_RIGHT = KEY_REGISTER_MID;
  369. //
  370. //
  371. //
  372. const U32 REGISTER_PUB_OK  = KEY_REGISTER_MID;
  373. const U32 REGISTER_PUB_LSK = KEY_REGISTER_MID;
  374. const U32 REGISTER_PUB_RSK = KEY_REGISTER_MID;
  375. //
  376. //
  377. //
  378. //
  379. //
  380. const U32 REGISTER_PUB_CALL = KEY_REGISTER_HIG;
  381. //
  382. //
  383. //
  384. //
  385. const U32 REGISTER_PUB_ESC = KEY_REGISTER_HIG;
  386. #endif
  387. //KP Jerry add on 2007-4-9 start
  388. U16 KEY_PUB_UP;
  389. U16 KEY_PUB_DOWN;
  390. U16 KEY_PUB_LEFT;
  391. U16 KEY_PUB_RIGHT;
  392. U32 REGISTER_PUB_UP;
  393. U32 REGISTER_PUB_DOWN;
  394. U32 REGISTER_PUB_LEFT;
  395. U32 REGISTER_PUB_RIGHT;
  396. //KP Jerry add on 2007-4-9 end
  397. void GameSimuInitSetKeyValue(U8 lcd_state)
  398. {
  399. U32 TempUp, TempDown, TempLeft, TempRight;
  400. KEY_PUB_UP = (lcd_state  == 0) ? KEY_UP : KEY_LEFT;
  401. KEY_PUB_DOWN = (lcd_state  == 0) ? KEY_DOWN : KEY_RIGHT;
  402. KEY_PUB_LEFT = (lcd_state  == 0) ? KEY_LEFT : KEY_DOWN;
  403. KEY_PUB_RIGHT = (lcd_state  == 0) ? KEY_RIGHT : KEY_UP;
  404. REGISTER_PUB_UP = (lcd_state  == 0) ? REGISTER_UP : REGISTER_LEFT;
  405. REGISTER_PUB_DOWN = (lcd_state  == 0) ? REGISTER_DOWN : REGISTER_RIGHT;
  406. REGISTER_PUB_LEFT = (lcd_state  == 0) ? REGISTER_LEFT : REGISTER_DOWN;
  407. REGISTER_PUB_RIGHT = (lcd_state  == 0) ? REGISTER_RIGHT : REGISTER_UP;
  408. }
  409. void GameSimulatorState()
  410. {
  411. GameSimulatorInterface_LcdRotate();
  412. GameSimuInitSetKeyValue(GameSimulatorInterface_GetLCDStatus());
  413. }
  414. //======================================================================================================================//
  415. //======================================================================================================================//
  416. //=========================================== 二、显示接口        ======================================//
  417. //======================================================================================================================//
  418. //======================================================================================================================//
  419. U8 *pu8_g_lcd_buffer; // 游戏显示数据缓冲区首地址
  420. U32 u32_g_lcd_buflen; // 游戏显示数据缓冲区大小
  421. U32 u32_g_lcd_width; // 显示缓冲区宽度
  422. U32 u32_g_lcd_height; // 显示缓冲区高度
  423. //======================================================================================================================//
  424. //======================================================================================================================//
  425. //=========================================== 三、声音接口        ======================================//
  426. //======================================================================================================================//
  427. //======================================================================================================================//
  428. U8 u8_g_sound_playflag=0; // 声音播放标志
  429. U8 *pu8_g_sound_bufstart; // 声音数据缓冲区首地址
  430. U32 u32_g_sound_bufsize; // 声音缓冲区大小
  431. U8 *pu8_g_sound_out_ptr; // 声音播出指针
  432. U8 *pu8_g_sound_in_ptr; // 声音写入指针
  433. //======================================================================================================================//
  434. //======================================================================================================================//
  435. //=========================================== 四、手柄接口        ======================================//
  436. //======================================================================================================================//
  437. //======================================================================================================================//
  438. U8 *pu8_g_uart_rx_buf; // 串口接收缓冲区首地址
  439. U32 u32_g_uart_rx_buf_size; // 串口接收缓冲区大小
  440. U16 u16_g_uart_rx_in; // 串口接收缓冲区写入偏移
  441. U32 u32_g_uart_portx; // 手柄通讯使用的串口号
  442. //======================================================================================================================//
  443. //======================================================================================================================//
  444. //=========================================== 五、游戏文件接口       ======================================//
  445. //======================================================================================================================//
  446. //======================================================================================================================//
  447. U8 *pu8_g_game_rom; // 游戏文件加载到内存的首地址
  448. U32 u32_g_game_file_size; // 加载游戏文件的大小
  449. U8 u8_g_game_type; // 游戏类型
  450. //======================================================================================================================//
  451. //======================================================================================================================//
  452. //=========================================== 六、存档提档接口       ======================================//
  453. //======================================================================================================================//
  454. //======================================================================================================================//
  455. U32 *pu32_g_game_save_buf; // 游戏存档/提档内存的首地址
  456. U32 u32_g_game_save_buf_size; // 游戏存档/提档内存的大小
  457. U32 u32_g_game_save_status; // 游戏存档/提档状态字
  458. void bra_view_create_view(void)
  459. {
  460. }
  461. void bra_send_request(char *mychar)
  462. {
  463. }
  464. void GameSimuSetKeyValue1ByLongPress(void)
  465. {
  466. game_simu_long_key_press |= 0x01;
  467. }
  468. void GameSimuSetKeyValue2ByLongPress(void)
  469. {
  470. game_simu_long_key_press |= 0x02;
  471. }
  472. //======================================================================================================================//
  473. //======================================================================================================================//
  474. //=========================================== 一、按键接口        ======================================//
  475. //======================================================================================================================//
  476. //======================================================================================================================//
  477. //==========================================================================================//
  478. // 函 数 名: GameSimuKeyValue //
  479. // 入   参: - //
  480. // 出   参: - //
  481. // 返 回 值: - //
  482. // 功   能: 模拟向u32_g_keypad_value变量中配置手机按键 //
  483. // 作    者: 纪诚 //
  484. //==========================================================================================//
  485. void GameSimuKeyValue(void)
  486. {
  487. u32_g_keypad_value = 0;
  488. //debug_uart_output_data("nu32_g_keypad_value = %d n", u32_g_keypad_value);
  489. if(!(DRV_Reg32(REGISTER_PUB_UP)&(~KEY_PUB_UP)))
  490. u32_g_keypad_value |= 0x0001;
  491. if(!(DRV_Reg32(REGISTER_PUB_DOWN)&(~KEY_PUB_DOWN)))
  492. u32_g_keypad_value |= 0x0002;
  493. if(!(DRV_Reg32(REGISTER_PUB_LEFT)&(~KEY_PUB_LEFT)))
  494. u32_g_keypad_value |= 0x0004;
  495. if(!(DRV_Reg32(REGISTER_PUB_RIGHT)&(~KEY_PUB_RIGHT)))
  496. u32_g_keypad_value |= 0x0008;
  497. if(!(DRV_Reg32(REGISTER_PUB_5)&(~KEY_PUB_5)))//A
  498. u32_g_keypad_value |= 0x0010;
  499. if(!(DRV_Reg32(REGISTER_PUB_6)&(~KEY_PUB_6)))//B
  500. u32_g_keypad_value |= 0x0020;
  501. if(!(DRV_Reg32(REGISTER_PUB_8)&(~KEY_PUB_8)))//X
  502. u32_g_keypad_value |= 0x0040;
  503. if(!(DRV_Reg32(REGISTER_PUB_9)&(~KEY_PUB_9)))//Y
  504. u32_g_keypad_value |= 0x0080;
  505. if( (!(DRV_Reg32(REGISTER_PUB_0)&(~KEY_PUB_0))) || (!(DRV_Reg32(REGISTER_PUB_CALL)&(~KEY_PUB_CALL))) )//SELECT
  506. u32_g_keypad_value |= 0x0100;
  507. if( (!(DRV_Reg32(REGISTER_PUB_WELL)&(~KEY_PUB_WELL))) || (!(DRV_Reg32(REGISTER_PUB_OK)&(~KEY_PUB_OK))) )//OK
  508. u32_g_keypad_value |= 0x0200;
  509. if(!(DRV_Reg32(REGISTER_PUB_2)&(~KEY_PUB_2)))//TOPL
  510. u32_g_keypad_value |= 0x0400;
  511. if(!(DRV_Reg32(REGISTER_PUB_3)&(~KEY_PUB_3)))//TOPR
  512. u32_g_keypad_value |= 0x0800;
  513. if(!(DRV_Reg32(REGISTER_PUB_RSK)&(~KEY_PUB_RSK)))//ESC
  514. u32_g_keypad_value |= 0x2000;
  515. if(!(DRV_Reg32(REGISTER_PUB_1)&(~KEY_PUB_1)))//MUTE
  516. u32_g_keypad_value |= 0x1000;
  517. if(!(DRV_Reg32(REGISTER_PUB_LSK)&(~KEY_PUB_LSK)))//MENU
  518. u32_g_keypad_value |= 0x4000;
  519. if(!(DRV_Reg32(REGISTER_PUB_VOLUP)&(~KEY_PUB_VOLUP)))//VOLUP
  520. {
  521. if (game_simu_long_key_press & 0x01)
  522. u32_g_keypad_value |= 0x0040;     //X
  523. else
  524. u32_g_keypad_value |= 0x0010;     //A
  525. }
  526. else if(game_simu_long_key_press & 0x01)
  527. {
  528. game_simu_long_key_press &= (~(0x01));
  529. }
  530. if(!(DRV_Reg32(REGISTER_PUB_VOLDOWN)&(~KEY_PUB_VOLDOWN)))//VOLDOWN
  531. {
  532. if (game_simu_long_key_press & 0x02)
  533. u32_g_keypad_value |= 0x0080;     //Y
  534. else
  535. u32_g_keypad_value |= 0x0020;     //B
  536. }
  537. else if(game_simu_long_key_press & 0x02)
  538. {
  539. game_simu_long_key_press &= (~(0x02));
  540. }
  541. debug_uart_output_data("nGameSimuKeyValue:u32_g_keypad_value = %x n", u32_g_keypad_value);
  542. }
  543. //======================================================================================================================//
  544. //======================================================================================================================//
  545. //=========================================== 二、显示接口        ======================================//
  546. //======================================================================================================================//
  547. //======================================================================================================================//
  548. extern  U8 gdi_base_layer_buffer_pool[];
  549. //==========================================================================================//
  550. // 函 数 名: GameSimuLcdUpdate_Init //
  551. // 入   参: - //
  552. // 出   参: - //
  553. // 返 回 值: - //
  554. // 功   能: 刷屏初始化 //
  555. // 作    者: 纪诚 //
  556. //==========================================================================================//
  557. void GameSimuLcdUpdate_Init(void)
  558. {
  559. pu8_g_lcd_buffer = (U8 *)gdi_base_layer_buffer_pool;
  560. u32_g_lcd_width  = LCD_WIDTH;
  561. u32_g_lcd_height = LCD_HEIGHT;
  562. u32_g_lcd_buflen = LCD_WIDTH*LCD_HEIGHT*2;
  563. // 禁止LCD休眠
  564.     TurnOnBacklight(0);
  565.     /* avoid status bar */
  566.     entry_full_screen();
  567. gdi_layer_blt_ext(GDI_LAYER_MAIN_BASE_LAYER_HANDLE, 0, 0, 0,
  568. #ifdef GDI_6_LAYERS
  569. 0, 0,
  570. #endif
  571. 0, 0, LCD_WIDTH-1, LCD_HEIGHT-1);
  572. lcd_power_up();
  573.     gdi_layer_lock_frame_buffer();
  574. }
  575. //==========================================================================================//
  576. // 函 数 名: GameSimuLcdUpdate_Terminate //
  577. // 入   参: - //
  578. // 出   参: - //
  579. // 返 回 值: - //
  580. // 功   能: 刷屏初始化 //
  581. // 作    者: 纪诚 //
  582. //==========================================================================================//
  583. void GameSimuLcdUpdate_Terminate(void)
  584. {
  585.     gdi_layer_unlock_frame_buffer();
  586. lcd_power_down();
  587. // 禁止LCD休眠
  588.     TurnOffBacklight();
  589. }
  590. //==========================================================================================//
  591. // 函 数 名: GameSimuLcdUpdateone //
  592. // 入   参: - //
  593. // 出   参: - //
  594. // 返 回 值: - //
  595. // 功   能: 完成刷一屏的动作 //
  596. // 作    者: 纪诚 //
  597. //==========================================================================================//
  598. void GameSimuLcdUpdateone(void)
  599. {
  600. START_LCD_TRANSFER;
  601. }
  602. //======================================================================================================================//
  603. //======================================================================================================================//
  604. //=========================================== 三、声音接口        ======================================//
  605. //======================================================================================================================//
  606. //======================================================================================================================//
  607. #define  C16_SOUND_BUFFER_SIZE  0x10000
  608. U8 u8_g_sound_buffer[C16_SOUND_BUFFER_SIZE];
  609. //==========================================================================================//
  610. // 函 数 名: GameSimuAudio_Open //
  611. // 入   参: - //
  612. // 出   参: - //
  613. // 返 回 值: - //
  614. // 功   能: 打开AUDIO任务 //
  615. // 作    者: 纪诚 //
  616. //==========================================================================================//
  617. void GameSimuAudio_Open( void )
  618. {
  619. u8_g_sound_playflag = 1;
  620. pu8_g_sound_bufstart = (U8 *)u8_g_sound_buffer;
  621. u32_g_sound_bufsize = C16_SOUND_BUFFER_SIZE;
  622. pu8_g_sound_in_ptr = pu8_g_sound_out_ptr = pu8_g_sound_bufstart;
  623. switch(u8_g_game_type)
  624. {
  625. case GAME_SIMU_TYPE_GB:
  626. case GAME_SIMU_TYPE_GBC:
  627. mdi_audio_play_string(pu8_g_sound_bufstart, u32_g_sound_bufsize, MDI_FORMAT_PCM_16K, DEVICE_AUDIO_PLAY_INFINITE, NULL, NULL);
  628. break;
  629. case GAME_SIMU_TYPE_NES:
  630. mdi_audio_play_string(pu8_g_sound_bufstart, u32_g_sound_bufsize, MDI_FORMAT_PCM_8K, DEVICE_AUDIO_PLAY_INFINITE, NULL, NULL);
  631. break;
  632. default:
  633. break;
  634. }
  635. }
  636. //==========================================================================================//
  637. // 函 数 名: GameSimuAudio_Close //
  638. // 入   参: - //
  639. // 出   参: - //
  640. // 返 回 值: - //
  641. // 功   能: 关闭AUDIO任务 //
  642. // 作    者: 纪诚 //
  643. //==========================================================================================//
  644. void GameSimuAudio_Close(void)
  645. {
  646. u8_g_sound_playflag = 0;
  647. mdi_audio_stop_string();
  648. }
  649. //======================================================================================================================//
  650. //======================================================================================================================//
  651. //=========================================== 四、手柄接口        ======================================//
  652. //======================================================================================================================//
  653. //======================================================================================================================//
  654. #define C32_GAME_SIMU_UART_RX_BUF_SIZE 2048
  655. U8 u8_game_simu_uart_rx_buf[C32_GAME_SIMU_UART_RX_BUF_SIZE];
  656. //==========================================================================================//
  657. // 函 数 名: GameSimuUartFIFO //
  658. // 入   参: - //
  659. // 出   参: - //
  660. // 返 回 值: - //
  661. // 功   能: 接收串口数据,放到串口的FIFO中 //
  662. // 作    者: 王险峰 //
  663. //==========================================================================================//
  664. void GameSimuUartFIFO(UART_PORT port)
  665. {
  666. U8 u8_tmp_buf[100];
  667. U8 u8_status = 0;
  668. U32 u32_read_length = 0;
  669. U16 u16_i = 0;
  670. U8 *pu8_buf_ptr;
  671. U8 *pu8_buf_end_ptr;
  672. // 从串口获得数据
  673. u32_read_length = UART_GetBytes(u32_g_uart_portx, u8_tmp_buf, 100, &u8_status, MOD_L4C);
  674. // 将数据写到 FIFO 中
  675. pu8_buf_ptr = pu8_g_uart_rx_buf + u16_g_uart_rx_in;
  676. pu8_buf_end_ptr = pu8_g_uart_rx_buf + u32_g_uart_rx_buf_size;
  677. for( u16_i = 0 ; u16_i < u32_read_length ; u16_i ++ )
  678. {
  679. *pu8_buf_ptr++ = u8_tmp_buf[u16_i];
  680. if( pu8_buf_ptr == pu8_buf_end_ptr ) pu8_buf_ptr = pu8_g_uart_rx_buf;
  681. }
  682. // 调整写入指针
  683. u16_g_uart_rx_in = (pu8_buf_ptr-pu8_g_uart_rx_buf);
  684. }
  685. //==========================================================================================//
  686. // 函 数 名: GameSimeUartInit //
  687. // 入   参: - //
  688. // 出   参: - //
  689. // 返 回 值: - //
  690. // 功   能: 初始化串口相关变量, 并注册串口接收CALLBACK函数 //
  691. // 作    者: 王险峰 //
  692. //==========================================================================================//
  693. extern kal_bool  UART_Open(UART_PORT port, module_type owner);
  694. extern void UART_Close(UART_PORT port, module_type ownerid);
  695. void GameSimeUartInit(void)
  696. {
  697. // 设置串口接口变量初值
  698. pu8_g_uart_rx_buf = u8_game_simu_uart_rx_buf;
  699. u32_g_uart_rx_buf_size = C32_GAME_SIMU_UART_RX_BUF_SIZE;
  700. u16_g_uart_rx_in = 0;
  701. // 设置使用的串口
  702. u32_g_uart_portx = uart_port1;
  703. UART_Close(u32_g_uart_portx, MOD_L4C);
  704. UART_Open(u32_g_uart_portx, MOD_L4C);
  705. // 串口接收缓冲区清0
  706. memset( u8_game_simu_uart_rx_buf, 0, C32_GAME_SIMU_UART_RX_BUF_SIZE );
  707. // 设置串口接收回调函数
  708.     if (MMIUSB_GET_FLAG(MMIUSB_MASK_IS_CONNECT) != MMI_TRUE)
  709. UART_Register_RX_cb(u32_g_uart_portx, MOD_L4C, GameSimuUartFIFO);
  710. }
  711. //======================================================================================================================//
  712. //======================================================================================================================//
  713. //=========================================== 五、游戏文件接口       ======================================//
  714. //======================================================================================================================//
  715. //======================================================================================================================//
  716. //#define C32_GAME_ROM_BUFFER_SIZE (0X400000-(0x0030d000+0x0002a024)) // 游戏ROM BUFFER大小
  717. #define C32_GAME_ROM_BUFFER_SIZE (1024*1024) // 游戏ROM BUFFER大小
  718. //#define C32_GAME_ROM_BUFFER_SIZE (300*1024*1) // 游戏ROM BUFFER大小
  719. #pragma arm section zidata = "game_simu_rom"
  720. __align(4)
  721. U8 u8_g_game_rom[C32_GAME_ROM_BUFFER_SIZE];
  722. #pragma arm section zidata
  723. #define MAX_FILE_NAME_WIDTH 128
  724. //U16 u16_g_game_file_name[]=L"e:\Game\Super Gryzor.nes";
  725. //U16 u16_g_game_file_name[]=L"e:\Game\super mario bros.gbc";
  726. U16 file_path_buf[(FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH];
  727. // U16 u16_g_game_file_name[]=L"c:\test.nes";
  728. //==========================================================================================//
  729. // 函 数 名: GameSimuLoadFileToRam //
  730. // 入   参: - //
  731. // 出   参: - //
  732. // 返 回 值: 0-游戏文件长度大于BUFFER长度不能玩 //
  733. // 1-游戏可以正常运行下去 //
  734. // 功   能: 打开游戏文件读文件并判断长度 //
  735. // 作    者: 纪诚 //
  736. //==========================================================================================//
  737. BOOL GameSimuLoadFileToRam( void )
  738. {
  739. U32  u32_read_size;
  740. U32 u32_file_size;
  741. FS_HANDLE fh_gbc_rom_file;
  742. // ROM指针初始化
  743. pu8_g_game_rom = (kal_uint8 *)u8_g_game_rom;
  744. // 读出ROM文件
  745. //if( (fh_gbc_rom_file = FS_Open( u16_g_game_file_name, FS_READ_ONLY)) <0 )
  746. if( (fh_gbc_rom_file = FS_Open( file_path_buf, FS_READ_ONLY)) <0 )
  747. {
  748. debug_uart_output_data("n file can't open!");
  749. return (0);
  750. }
  751. FS_GetFileSize(fh_gbc_rom_file, &u32_file_size);
  752. if(u32_file_size <= C32_GAME_ROM_BUFFER_SIZE)
  753. {
  754. FS_Read(fh_gbc_rom_file, pu8_g_game_rom, u32_file_size, (UINT*)&u32_g_game_file_size );
  755. FS_Close(fh_gbc_rom_file);
  756. return (1);
  757. }
  758. else
  759. {
  760. FS_Close(fh_gbc_rom_file);
  761. debug_uart_output_data("n file too big!");
  762. return (0);
  763. }
  764. }
  765. //======================================================================================================================//
  766. //======================================================================================================================//
  767. //=========================================== 六、存档提档接口       ======================================//
  768. //======================================================================================================================//
  769. //======================================================================================================================//
  770. // =============================================================================
  771. // 功  能: 游戏存档初始化
  772. // 作  者: 纪诚
  773. // =============================================================================
  774. void GameSimuSaveInit(void)
  775. {
  776. pu32_g_game_save_buf = (U32 *)u8_g_sound_buffer;
  777. u32_g_game_save_buf_size = (U32)C16_SOUND_BUFFER_SIZE;
  778. }
  779. // =============================================================================
  780. // 功  能: 获得游戏存档文件名
  781. // 入  参: u16_x_game_file 当前游戏文件
  782. //    u16_x_save_suffix存档文件后缀名
  783. // 出  参: u16_x_game_file 当前游戏文件
  784. // 返回值: -
  785. // 作  者: 徐 杰
  786. // =============================================================================
  787. void GameSimuSaveFileName ( U16 *u16_x_game_file, U16 *u16_x_save_suffix, U16 *u16_x_save_file)
  788. {
  789. U16 u16_char;
  790. memcpy ( (S8*)u16_x_save_file, (S8*)u16_x_game_file, MAX_FILE_NAME_WIDTH );
  791. // 指向后缀处
  792. while ( *u16_x_save_file )
  793. u16_x_save_file ++;
  794. while ( ( *u16_x_save_file ) != 0x2e )
  795. u16_x_save_file --;
  796. u16_x_save_file ++;
  797. // 修改后缀
  798. u16_char = *u16_x_save_suffix ++;
  799. while ( u16_char )
  800. {
  801. *u16_x_save_file ++ = u16_char;
  802. u16_char = *u16_x_save_suffix ++;
  803. }
  804. *u16_x_save_file = u16_char;
  805. }
  806. // =============================================================================
  807. // 功  能: 存档Buf到文件
  808. // 入  参: u8_x_buf 存档Buf地址
  809. //    u32_x_buf_size 存档Buf大小
  810. //    u16_x_game_file 当前游戏文件
  811. //    u16_x_save_suffix存档文件后缀名
  812. // 返回值: 0  失败
  813. //    1 成功
  814. // 作  者: 徐 杰
  815. // =============================================================================
  816. U8 GameSimuSaveFile ( U8 *u8_x_buf, U32 u32_x_buf_size, U16 *u16_x_game_file, U8 u8_x_game_type )
  817. {
  818. U16 u16_save_file [ MAX_FILE_NAME_WIDTH / 2 ];
  819. U32 u32_write_size;
  820. FS_HANDLE fh_save_file;
  821. switch(u8_x_game_type)
  822. {
  823. case GAME_SIMU_TYPE_GB:
  824. // 获得存档文件名
  825. GameSimuSaveFileName ( u16_x_game_file, L"gb0", u16_save_file);
  826. break;
  827. case GAME_SIMU_TYPE_GBC:
  828. // 获得存档文件名
  829. GameSimuSaveFileName ( u16_x_game_file, L"gf0", u16_save_file);
  830. break;
  831. case GAME_SIMU_TYPE_NES:
  832. // 获得存档文件名
  833. GameSimuSaveFileName ( u16_x_game_file, L"nf0", u16_save_file);
  834. break;
  835. default:
  836. break;
  837. }
  838. fh_save_file = FS_Open ( u16_save_file, FS_CREATE );
  839. if ( fh_save_file == NULL)
  840. return 0;
  841. FS_Write ( fh_save_file, u8_x_buf, u32_x_buf_size, (UINT*)&u32_write_size );
  842. FS_SetAttributes(u16_save_file, FS_ATTR_HIDDEN);     //KP Jerry add on 2007-4-14
  843. FS_Close ( fh_save_file );
  844. if ( u32_x_buf_size != u32_write_size)
  845. return 0;
  846. else
  847. return 1;
  848. }
  849. // =============================================================================
  850. // 功  能: 从文件读取存档Buf
  851. // 入  参: u32_x_buf_size 存档Buf大小
  852. //    u16_x_game_file 当前游戏文件
  853. //    u16_x_save_suffix存档文件后缀名
  854. // 出  参: u8_x_buf 存档Buf地址
  855. // 返回值: 0  失败
  856. //    1 成功
  857. // 作  者: 徐 杰
  858. // =============================================================================
  859. U8 GameSimuLoadFile ( U8 *u8_x_buf, U32 u32_x_buf_size, U16 *u16_x_game_file, U8 u8_x_game_type )
  860. {
  861. U16 u16_save_file [ MAX_FILE_NAME_WIDTH / 2 ];
  862. U32 u32_read_size;
  863. FS_HANDLE fh_save_file;
  864. switch(u8_x_game_type)
  865. {
  866. case GAME_SIMU_TYPE_GB:
  867. // 获得存档文件名
  868. GameSimuSaveFileName ( u16_x_game_file, L"gb0", u16_save_file);
  869. break;
  870. case GAME_SIMU_TYPE_GBC:
  871. // 获得存档文件名
  872. GameSimuSaveFileName ( u16_x_game_file, L"gf0", u16_save_file);
  873. break;
  874. case GAME_SIMU_TYPE_NES:
  875. // 获得存档文件名
  876. GameSimuSaveFileName ( u16_x_game_file, L"nf0", u16_save_file);
  877. break;
  878. default:
  879. break;
  880. }
  881. fh_save_file = FS_Open ( u16_save_file, FS_READ_ONLY );
  882. if ( fh_save_file == NULL)
  883. return 0;
  884. FS_Read ( fh_save_file, u8_x_buf, u32_x_buf_size, (UINT*)&u32_read_size );
  885. FS_Close ( fh_save_file );
  886. if ( u32_x_buf_size != u32_read_size)
  887. return 0;
  888. else
  889. return 1;
  890. }
  891. //======================================================================================================================//
  892. //======================================================================================================================//
  893. //=========================================== 七、窗口接口        ======================================//
  894. //======================================================================================================================//
  895. //======================================================================================================================//
  896. //==========================================================================================//
  897. // 函 数 mmi_game_simu_pause_msg_hdlr //
  898. // 入   参:- //
  899. // 出   参:- //
  900. // 返 回 值:- //
  901. // 功   能:在游戏运行期间, 如果有会导致切换出游戏窗口的消息到来的时候, 请使用这个函数//
  902. //   暂停游戏, 再处理完这个消息后, 会自动继续游戏. //
  903. // 作    者:王险峰 //
  904. //==========================================================================================//
  905. void mmi_game_simu_pause_msg_hdlr(void)
  906. {
  907. debug_uart_output_data("n PAUSE");
  908. // 游戏暂停
  909. ClearProtocolEventHandler(MSG_ID_CUSTOM2_CUSTOM1);
  910. GameSimulatorInterface_Pause();
  911. // 恢复LCD刷新设置
  912. GameSimuLcdUpdate_Terminate();
  913. /* Don't store temp user information */
  914. //game_simu_settings.bLCDState = GameSimulatorInterface_GetLCDStatus();
  915. //game_simu_settings.bVolu = u8_g_sound_playflag;
  916. game_simu_play_audio_poweron = 0;
  917. //mmi_gamesimu_store_setting();
  918. // 关闭声音任务
  919. GameSimuAudio_Close();
  920. //
  921. UART_dafault_rx_cb(u32_g_uart_portx);
  922. }
  923. //==========================================================================================//
  924. // 函 数 名:mmi_game_simu_exit_msg_hdlr //
  925. // 入   参:- //
  926. // 出   参:- //
  927. // 返 回 值:- //
  928. // 功   能:在游戏运行期间, 如果有希望终止游戏的消息到来的时候, 请使用这个函数退出游戏//
  929. // 作    者:王险峰 //
  930. //==========================================================================================//
  931. static U8 mmi_game_simu_exit_msg_hdlr(void *inMsg)
  932. {
  933. debug_uart_output_data("n STOP");
  934. // 游戏模拟器终止
  935. GameSimulatorInterface_Terminate();
  936. // debug_uart_output_data("n first byte = %x",*u8_g_game_rom);
  937. // debug_uart_output_data("n first byte = %x",*(u8_g_game_rom+1024*1024-4));
  938. memset(u8_g_game_rom,0,C32_GAME_ROM_BUFFER_SIZE);
  939. // debug_uart_output_data("n first byte = %x",*u8_g_game_rom);
  940. // debug_uart_output_data("n first byte = %x",*(u8_g_game_rom+1024*1024-4));
  941. }
  942. //==========================================================================================//
  943. // 函 数 名: SendMsgToMMI //
  944. // 入   参: u32_x_msg_id 需要发送的消息ID //
  945. // 出   参: - //
  946. // 返 回 值: - //
  947. // 功   能: 给MMI消息队列发消息 //
  948. // 作    者: 王险峰 //
  949. //==========================================================================================//
  950. void SendMsgToMMI(U32 u32_x_msg_id)
  951. {
  952. ilm_struct *send_ilm;
  953. send_ilm = allocate_ilm(MOD_MMI);
  954. send_ilm->src_mod_id = MOD_MMI;
  955. send_ilm->dest_mod_id = MOD_MMI;
  956. send_ilm->msg_id = u32_x_msg_id;
  957. msg_send_ext_queue(send_ilm);
  958. }
  959. static U8 mmi_gamesimu_post_interrupt_hdlr(void *inMsg)
  960. {
  961.     /*----------------------------------------------------------------*/
  962.     /* Local Variables                                                */
  963.     /*----------------------------------------------------------------*/
  964.     /*----------------------------------------------------------------*/
  965.     /* Code Body                                                      */
  966.     /*----------------------------------------------------------------*/
  967.     SetInterruptPopupDisplay(POPUP_ALL_ON);
  968.     return FALSE;
  969. }
  970. static U8 mmi_gamesimu_sms_interrupt_hdlr(void *inMsg)
  971. {
  972.     /*----------------------------------------------------------------*/
  973.     /* Local Variables                                                */
  974.     /*----------------------------------------------------------------*/
  975.     /*----------------------------------------------------------------*/
  976.     /* Code Body                                                      */
  977.     /*----------------------------------------------------------------*/
  978.     SetInterruptPopupDisplay(POPUP_ALL_OFF);
  979.     return FALSE;
  980. }
  981. //void key_scan();//测试键值属于那个寄存器,通过trace打印出来
  982. //==========================================================================================//
  983. // 函 数 名: GameSimuRun //
  984. // 入   参: - //
  985. // 出   参: - //
  986. // 返 回 值: - //
  987. // 功   能: 处理游戏RUN消息,运行一帧游戏 //
  988. // 作    者: 王险峰 //
  989. //==========================================================================================//
  990. void GameSimuRun(void)
  991. {
  992. U32 u32_game_run_return_flag;
  993. //key_scan();
  994. // 模拟获得键值
  995. GameSimuKeyValue();
  996. // 仿真器运行一次
  997. u32_game_run_return_flag = GameSimulatorInterface_Run();
  998. // 刷屏
  999. if((u32_game_run_return_flag&GAME_SIMU_UPDATE_BIT))
  1000. GameSimuLcdUpdateone();
  1001. // 继续运行
  1002. if((u32_game_run_return_flag&GAME_SIMU_RUNING_BIT))
  1003. SendMsgToMMI(MSG_ID_CUSTOM2_CUSTOM1);
  1004. // 停止运行
  1005. if(!(u32_game_run_return_flag&GAME_SIMU_RUNING_BIT))
  1006. GoBackHistory();
  1007. // 存档
  1008. if((u32_g_game_save_status&GAME_SIMU_SAVE_REQ_BIT))
  1009. {
  1010. //GameSimuSaveFile((U8 *)pu32_g_game_save_buf,u32_g_game_save_buf_size,u16_g_game_file_name,u8_g_game_type);
  1011. GameSimuSaveFile((U8 *)pu32_g_game_save_buf,u32_g_game_save_buf_size,file_path_buf,u8_g_game_type);
  1012. u32_g_game_save_status = GAME_SIMU_SAVE_RSP_BIT;
  1013. }
  1014. // 提档
  1015. if((u32_g_game_save_status&GAME_SIMU_LOAD_REQ_BIT))
  1016. {
  1017. //if(GameSimuLoadFile((U8 *)pu32_g_game_save_buf,u32_g_game_save_buf_size,u16_g_game_file_name,u8_g_game_type))
  1018. if(GameSimuLoadFile((U8 *)pu32_g_game_save_buf,u32_g_game_save_buf_size,file_path_buf,u8_g_game_type))
  1019. u32_g_game_save_status = GAME_SIMU_LOAD_RSP_BIT;
  1020. }
  1021. }
  1022. //==========================================================================================//
  1023. // 函 数 名: EntryGameSimu //
  1024. // 入   参: - //
  1025. // 出   参: - //
  1026. // 返 回 值: - //
  1027. // 功   能: 游戏窗口,处理游戏于MMI消息的交互 //
  1028. // 作    者: 王险峰 //
  1029. //==========================================================================================//
  1030. void EntryGameSimu(void)
  1031. {
  1032. ilm_struct *send_ilm;
  1033. PsFuncPtr pf_game_simu_run;
  1034. debug_uart_output_data(" entry EntryGameSimu n");
  1035. GameSimuInitSetKeyValue(game_simu_settings.bLCDState);
  1036. if (GameSimulatorInterface_GetLCDStatus() != game_simu_settings.bLCDState)
  1037. {
  1038. GameSimulatorInterface_LcdRotate();
  1039. }
  1040. // 注册游戏窗口ID号、和重入和退出的函数操作。
  1041. EntryNewScreen(SCR_ID_GAMESIMU_RUN, mmi_game_simu_pause_msg_hdlr, EntryGameSimu, NULL);
  1042.      SetDelScrnIDCallbackHandler(SCR_ID_GAMESIMU_RUN, mmi_game_simu_exit_msg_hdlr);
  1043. pf_game_simu_run  = (PsFuncPtr)GameSimuRun;
  1044. // SMS短消息处理
  1045. SetInterruptEventHandler(
  1046.         mmi_gamesimu_sms_interrupt_hdlr,
  1047.         mmi_gamesimu_post_interrupt_hdlr,
  1048.         PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND );
  1049. SetInterruptEventHandler(
  1050.         mmi_gamesimu_sms_interrupt_hdlr,
  1051.         mmi_gamesimu_post_interrupt_hdlr,
  1052.         PRT_MSG_ID_MMI_SMS_STATUS_REPORT_IND);
  1053. SetInterruptEventHandler(
  1054.         mmi_gamesimu_sms_interrupt_hdlr,
  1055.         mmi_gamesimu_post_interrupt_hdlr,
  1056.         PRT_MSG_ID_MMI_SMS_MSG_WAITING_IND );
  1057. // T卡插拔处理
  1058. SetInterruptEventHandler(
  1059.         mmi_gamesimu_sms_interrupt_hdlr,
  1060.         mmi_gamesimu_post_interrupt_hdlr,
  1061.         MSG_ID_FMT_MMI_CARD_PLUG_IN_IND );
  1062. SetInterruptEventHandler(
  1063.         mmi_gamesimu_sms_interrupt_hdlr,
  1064.         mmi_gamesimu_post_interrupt_hdlr,
  1065.         MSG_ID_FMT_MMI_CARD_PLUG_OUT_IND );
  1066. // 注册游戏消息处理函数
  1067. SetProtocolEventHandler(pf_game_simu_run,   MSG_ID_CUSTOM2_CUSTOM1);
  1068. //u8_g_game_type = GAME_SIMU_TYPE_GBC;
  1069. //u8_g_game_type = GAME_SIMU_TYPE_NES;
  1070. // 显示初始化
  1071. GameSimuLcdUpdate_Init();
  1072. // 游戏ROM初始化
  1073. GameSimuLoadFileToRam();
  1074. // 声音初始化
  1075. GameSimuAudio_Open();
  1076. GameSimulatorInterface_SetSound(game_simu_settings.bVolu);
  1077. // 初始化串口, 并注册串口接收CALLBACK函数
  1078. GameSimeUartInit();
  1079. // 存档提档初始化
  1080. GameSimuSaveInit();
  1081. // 清除游戏运行中按键定义的HANDLER的处理
  1082. ClearAllKeyHandler();
  1083. // 注册音量调节按键HANDLER处理
  1084. //SetKeyHandler(mmi_gfx_volume_up, KEY_VOL_UP, KEY_EVENT_DOWN);
  1085. //SetKeyHandler(mmi_gfx_volume_down, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1086. SetKeyHandler(mmi_gfx_volume_up, KEY_2, KEY_EVENT_DOWN);
  1087. SetKeyHandler(mmi_gfx_volume_down, KEY_3, KEY_EVENT_DOWN);
  1088. SetKeyHandler(GameSimuSetKeyValue1ByLongPress, KEY_VOL_UP, KEY_EVENT_LONG_PRESS);
  1089. SetKeyHandler(GameSimuSetKeyValue2ByLongPress, KEY_VOL_DOWN, KEY_EVENT_LONG_PRESS);
  1090. // ferz add on 2007-03-30
  1091. SetKeyHandler(GameSimulatorState, KEY_STAR, KEY_EVENT_UP);
  1092. SetKeyHandler(GameSimulatorState, KEY_CAMERA, KEY_EVENT_UP);
  1093. // ferz add end
  1094. // 游戏模拟器初始化
  1095. {
  1096. U32  initValue = GameSimulatorInterface_Init();
  1097. debug_uart_output_data(" initValue = %d ", initValue);
  1098. if (initValue != GAME_SIMU_INIT_OK)
  1099. {
  1100. GoBackHistory();
  1101. if (initValue == GAME_SIMU_INIT_PARA_ERR)
  1102. DisplayPopup((PU8) GetString(STR_ID_GAME_SIMU_INTERFACE_ERROR), IMG_GLOBAL_INFO, 1, 2000, MESSAGE_TONE);
  1103. else if (initValue == GAME_SIMU_INIT_FILE_ERR)
  1104. DisplayPopup((PU8) GetString(STR_ID_GAME_FILE_ERROR), IMG_GLOBAL_INFO, 1, 2000, MESSAGE_TONE);
  1105. else if (initValue == GAME_SIMU_INIT_NOT_SUPPORT)
  1106. DisplayPopup((PU8) GetString(STR_ID_GAME_FILE_TYPE_ERROR), IMG_GLOBAL_INFO, 1, 2000, MESSAGE_TONE);
  1107. }
  1108.     else SendMsgToMMI(MSG_ID_CUSTOM2_CUSTOM1);
  1109. }
  1110. #if 0
  1111. if( GameSimulatorInterface_Init() != GAME_SIMU_INIT_OK)
  1112. {
  1113. GoBackHistory();
  1114. }
  1115. #endif
  1116. // 发送游戏模拟器启动消息
  1117.     //else SendMsgToMMI(MSG_ID_CUSTOM2_CUSTOM1);
  1118. }
  1119. void InitGameSimuEntryListApp()
  1120. {
  1121.     SetHiliteHandler(MENU_ID_GAME_RFS_OPTION_LIMITED, mmi_game_simu_highlight_refresh_game_list);
  1122.     SetHiliteHandler(MENU_ID_GAME_SETTINGS_LIMITED, mmi_game_simu_highlight_game_data_settings);
  1123.     SetHiliteHandler(MENU_ID_GAME_LIST_PLAY, mmi_game_simu_highlight_play);
  1124.     SetHiliteHandler(MENU_ID_GAME_LIST_RFS_OPTION, mmi_game_simu_highlight_refresh_game_list);
  1125.     SetHiliteHandler(MENU_ID_GAME_LIST_SETTINGS, mmi_game_simu_highlight_game_data_settings);
  1126.   //  SetHiliteHandler(MENU_ID_GAME_SIMU_HELP, mmi_gamesimu_highlight_help);
  1127.     //SetHiliteHandler(MENU_ID_GAME_LIST_INFO, mmi_game_simu_higlight_game_info);
  1128.     //SetHiliteHandler(MENU_ID_GAME_LIST_DELETE, mmi_game_simu_highlight_delete_game);
  1129.     //SetHiliteHandler(MENU_ID_GAME_LIST_DELETE_ALL, mmi_game_simu_highlight_delete_all);
  1130.    // SetHiliteHandler(MENU_ID_GAME_LIST_HELP, mmi_game_simu_highlight_help);
  1131.     game_simu_frm_init();
  1132. }
  1133. ///////////////////////////////////////
  1134. /*****************************************************************************
  1135.  * FUNCTION
  1136.  *  ebr_show_limit_book_shelf_option
  1137.  * DESCRIPTION
  1138.  *  Options for Limited Book Shelf
  1139.  * PARAMETERS
  1140.  *  void
  1141.  * RETURNS
  1142.  *  void
  1143.  *****************************************************************************/
  1144. void game_simu_show_limit_option(void)
  1145. {
  1146.     /*----------------------------------------------------------------*/
  1147.     /* Local Variables                                                */
  1148.     /*----------------------------------------------------------------*/
  1149.     U8 *guiBuffer;
  1150.     U16 nNumofItem;
  1151.     U16 nStrItemList[MAX_SUB_MENUS];
  1152.     U16 nImgIltemList[MAX_SUB_MENUS];
  1153.     U8 *hintList[MAX_SUB_MENUS];
  1154.     /*----------------------------------------------------------------*/
  1155.     /* Code Body                                                      */
  1156.     /*----------------------------------------------------------------*/
  1157.     EntryNewScreen(SCR_ID_GAMESIMU_OPTION, NULL, game_simu_show_limit_option, NULL);
  1158.     guiBuffer = GetCurrGuiBuffer(SCR_ID_GAMESIMU_OPTION);
  1159.     
  1160.     nNumofItem = GetNumOfChild(MENU_ID_GAME_LIMITED_GAME_LIST_OPTION);
  1161.     GetSequenceStringIds(MENU_ID_GAME_LIMITED_GAME_LIST_OPTION, nStrItemList);
  1162.     GetSequenceImageIds(MENU_ID_GAME_LIMITED_GAME_LIST_OPTION, nImgIltemList);
  1163.     SetParentHandler(MENU_ID_GAME_LIMITED_GAME_LIST_OPTION);
  1164. debug_uart_output_data("n nNumofItem = %d", nNumofItem);
  1165.     /* Construct List To Show Hint */
  1166.     ConstructHintsList(MENU_ID_GAME_LIMITED_GAME_LIST_OPTION, hintList);
  1167.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1168.     ShowCategory52Screen(
  1169.         STR_GLOBAL_OPTIONS,
  1170.         //GetRootTitleIcon(MAIN_MENU_EBOOK_MENUID),
  1171.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1172.         STR_GLOBAL_OK,
  1173.         IMG_GLOBAL_OK,
  1174.         STR_GLOBAL_BACK,
  1175.         IMG_GLOBAL_BACK,
  1176.         nNumofItem,
  1177.         nStrItemList,
  1178.         (U16*) gIndexIconsImageList,
  1179.         hintList,
  1180.         0,
  1181.         0,
  1182.         guiBuffer);
  1183.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1184.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1185. }
  1186. void game_list_exit_settings(void)
  1187. {
  1188.     /*----------------------------------------------------------------*/
  1189.     /* Local Variables                                                */
  1190.     /*----------------------------------------------------------------*/
  1191.     history Scr;
  1192.     S16 nHistory = 0;
  1193.     U16 size;
  1194.     /*----------------------------------------------------------------*/
  1195.     /* Code Body                                                      */
  1196.     /*----------------------------------------------------------------*/
  1197.     CloseCategory57Screen();
  1198. /*    Scr.scrnID = GAME_LIST_SETTINGS_SCREEN_ID;
  1199.     CloseCategory57Screen();
  1200.     Scr.entryFuncPtr = game_list_entry_settings;
  1201.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
  1202.     GetCategoryHistory(Scr.guiBuffer);
  1203.     size = (U16) GetCategory57DataSize();
  1204.     GetCategory57Data((U8*) Scr.inputBuffer);
  1205.     AddNHistory(Scr, size);*/
  1206. }
  1207. void game_list_frm_get_default_settings_value(void)
  1208. {
  1209. S16 error;
  1210. ReadValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, &g_game_simu_set_cntx.inlineHighligtItemSelectMemory, DS_BYTE, &error);
  1211. // ReadValue(NVRAM_GAME_LIST_AUTO_GEN_ID, &g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen, DS_BYTE, &error);
  1212. return;
  1213. }
  1214. void game_simu_fill_settings_inline_edit_struct(void *pInlineStruct)
  1215. {
  1216.     S16 i = 0;
  1217.     U8 status = 0;
  1218.     InlineItem *InlineStruct = (InlineItem*) pInlineStruct;
  1219.     g_game_simu_app_cntx_p->game_list_settings_memory_type[0] = (U8*) GetString(STR_ID_GAME_SIMU_STORAGE_PHONE);
  1220.     g_game_simu_app_cntx_p->game_list_settings_memory_type[1] = (U8*) GetString(STR_ID_GAME_SIMU_STORAGE_CARD);
  1221. //    g_game_simu_app_cntx_p->game_list_settings_auto_gen[0] = (U8*) GetString(STR_ID_GAME_SIMU_UPDATE_YES);
  1222. //    g_game_simu_app_cntx_p->game_list_settings_auto_gen[1] = (U8*) GetString(STR_ID_GAME_SIMU_UPDATE_NO);
  1223.     SetInlineItemActivation(&InlineStruct[0], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1224.     SetInlineItemCaption(&InlineStruct[0], (PU8) (U8*) GetString(STR_ID_GAME_SIMU_STORAGE));
  1225. //    SetInlineItemActivation(&InlineStruct[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1226. //    SetInlineItemCaption(&InlineStruct[2], (PU8) (U8*) GetString(STR_ID_GAME_SIMU_UPDATE_QUE));
  1227.     SetInlineItemActivation(&InlineStruct[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1228.     SetInlineItemSelect(
  1229.         &InlineStruct[1],
  1230.         2,
  1231.         g_game_simu_app_cntx_p->game_list_settings_memory_type,
  1232.         (S32*) &(g_game_simu_set_cntx.inlineHighligtItemSelectMemory) /* CurrSelect */ );
  1233. //    SetInlineItemActivation(&InlineStruct[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1234. //    SetInlineItemSelect(
  1235. //       &InlineStruct[3],
  1236. //        2,
  1237. //        g_game_simu_app_cntx_p->game_list_settings_auto_gen,
  1238. //        (S32*) &(g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen) /* CurrSelect */ );
  1239. }
  1240. MMI_BOOL mmi_game_list_is_memory_type_changed(S8 memoryType)
  1241. {
  1242. //    if (g_curr_book_cntx_p->g_nfo_book_struct.memory_type == memoryType)
  1243.     {
  1244.         return MMI_FALSE;
  1245.     }
  1246. //    else
  1247.     {
  1248. //        return MMI_TRUE;
  1249.     }
  1250. }
  1251. void game_simu_frm_set_settings_and_save_in_nvram(void)
  1252. {
  1253. S16 error;
  1254. // WriteValue(NVRAM_GAME_LIST_AUTO_GEN_ID, &g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen, DS_BYTE, &error);
  1255. WriteValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, &(g_game_simu_set_cntx.inlineHighligtItemSelectMemory), DS_BYTE, &error);
  1256. }
  1257. void game_simu_entry_settings_done_hndlr(void)
  1258. {
  1259.     /*----------------------------------------------------------------*/
  1260.     /* Local Variables                                                */
  1261.     /*----------------------------------------------------------------*/
  1262.     /*----------------------------------------------------------------*/
  1263.     /* Code Body                                                      */
  1264.     /*----------------------------------------------------------------*/
  1265.     game_simu_frm_set_settings_and_save_in_nvram();
  1266.   //  DeleteUptoScrID(GAME_LIST_SETTINGS_SCREEN_ID);
  1267.     DeleteUptoScrID(SCR_FMGR_EXPLORER);
  1268.     IsBackHistory = MMI_TRUE;
  1269.     DisplayPopupCallBack(
  1270.         (PU8) GetString(STR_GLOBAL_DONE),
  1271.         IMG_GLOBAL_ACTIVATED,
  1272.         1,
  1273.         UI_POPUP_NOTIFYDURATION_TIME,
  1274.         SUCCESS_TONE,
  1275.         mmi_entry_game_list_screen);
  1276. }
  1277. void game_list_settings_confirm_pop_up(void)
  1278. {
  1279.     /*----------------------------------------------------------------*/
  1280.     /* Local Variables                                                */
  1281.     /*----------------------------------------------------------------*/
  1282.     /*----------------------------------------------------------------*/
  1283.     /* Code Body                                                      */
  1284.     /*----------------------------------------------------------------*/
  1285.     DisplayConfirm(
  1286.         STR_GLOBAL_YES,
  1287.         IMG_GLOBAL_YES,
  1288.         STR_GLOBAL_NO,
  1289.         IMG_GLOBAL_NO,
  1290.         get_string(STR_GLOBAL_SAVE),
  1291.         IMG_GLOBAL_QUESTION,
  1292.         WARNING_TONE);
  1293.         SetLeftSoftkeyFunction(game_simu_entry_settings_done_hndlr, KEY_EVENT_UP);
  1294.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1295. }
  1296. void game_list_entry_settings(void)
  1297. {
  1298.     /*----------------------------------------------------------------*/
  1299.     /* Local Variables                                                */
  1300.     /*----------------------------------------------------------------*/
  1301.     U8 *guiBuffer = NULL;
  1302.     U8 status;
  1303.     U8 *inputBuffer;
  1304.     U16 nNumofItem = 2;   /* Stores no of children in the submenu */
  1305.     U16 inputBufferSize;
  1306.     U16 gIndexIconsImageList_local[] = 
  1307.     {
  1308.         IMG_GLOBAL_L1,
  1309.         0 //,
  1310.  //       IMG_GLOBAL_L2,
  1311.  //       0
  1312.     };
  1313.     /*----------------------------------------------------------------*/
  1314.     /* Code Body                                                      */
  1315.     /*----------------------------------------------------------------*/
  1316.     mmi_fmgr_get_exist_storage_inline_list(NULL, &status, NULL, NULL);                
  1317.     EntryNewScreen(GAME_LIST_SETTINGS_SCREEN_ID, game_list_exit_settings, game_list_entry_settings, NULL);
  1318.     InitializeCategory57Screen();
  1319.         
  1320.     guiBuffer = GetCurrGuiBuffer(GAME_LIST_SETTINGS_SCREEN_ID);
  1321.     inputBuffer = GetCurrNInputBuffer(GAME_LIST_SETTINGS_SCREEN_ID, &inputBufferSize);   /* added for inline edit history */
  1322.     if (inputBuffer != NULL)
  1323.     {
  1324.         SetCategory57Data(wgui_inline_items, nNumofItem, inputBuffer);
  1325.     }    
  1326.     else
  1327.     {
  1328.         //ClearHighlightHandler();
  1329.  /* Get the Default value from NVRAM */
  1330.  game_list_frm_get_default_settings_value();    
  1331.     }
  1332. game_simu_fill_settings_inline_edit_struct((void*)&wgui_inline_items);
  1333. //RegisterHighlightHandler(NULL);
  1334.     if (mmi_game_list_is_memory_type_changed(memory_type_selected) && GetInlineDoneFlag(guiBuffer) == 0)
  1335.     {
  1336.         SetInlineDoneFlag(guiBuffer);
  1337.     }
  1338.     
  1339.     ShowCategory57Screen(
  1340.         STR_GLOBAL_SAVE,
  1341.         //GetRootTitleIcon(MAIN_MENU_EXTRA_MENUID),
  1342.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1343.         STR_GLOBAL_OK,
  1344.         IMG_GLOBAL_OK,
  1345.         STR_GLOBAL_DONE,
  1346.         IMG_GLOBAL_BACK,
  1347.         nNumofItem,
  1348.         (U16*) gIndexIconsImageList_local,
  1349.         wgui_inline_items,
  1350.         0,
  1351.         guiBuffer);
  1352.     /* Register function for right soft key */
  1353.     SetCategory57RightSoftkeyFunctions(game_list_settings_confirm_pop_up, GoBackHistory);
  1354. }
  1355. S8 *game_frm_get_file_path(S8 memory_type_selected, game_list_frm_search_type_enum search_type_path)
  1356. {
  1357.     /*----------------------------------------------------------------*/
  1358.     /* Local Variables                                                */
  1359.     /*----------------------------------------------------------------*/
  1360.     S8 file_path_in_ascii[MAX_DWNL_GAME_PATH_LEN];
  1361.     static S8 file_path[MAX_DWNL_GAME_PATH_LEN * ENCODING_LENGTH];
  1362.     static game_list_frm_search_type_enum prev_search_type_path = GAME_FRM_SEARCH_MAX;    
  1363.     static S8 prev_memory_type_selected = 0;
  1364.     S8 div_path;
  1365.     /*----------------------------------------------------------------*/
  1366.     /* Code Body                                                      */
  1367.     /*----------------------------------------------------------------*/
  1368. //    if (prev_memory_type_selected == memory_type_selected && prev_search_type_path == search_type_path)
  1369. //    {
  1370. //        return file_path;
  1371. //    }
  1372. if (g_game_simu_set_cntx.inlineHighligtItemSelectMemory == 0)
  1373. div_path = (S8)MMI_PUBLIC_DRV;
  1374. else
  1375. div_path = (S8)MMI_CARD_DRV;
  1376.     switch (search_type_path)
  1377.     {
  1378.         case GAME_FRM_SEARCH_GB:
  1379.             sprintf((char*)file_path_in_ascii, "%c%s%s", div_path, GAME_DOWNLOADED_PATH, GAME_SEARCH_GB_STR);
  1380.             break;
  1381.         case GAME_FRM_SEARCH_GBC:
  1382.             sprintf((char*)file_path_in_ascii, "%c%s%s", div_path, GAME_DOWNLOADED_PATH, GAME_SEARCH_GBC_STR);
  1383.             break;
  1384.         case GAME_FRM_SEARCH_NES:
  1385.             sprintf((char*)file_path_in_ascii, "%c%s%s", div_path, GAME_DOWNLOADED_PATH, GAME_SEARCH_NES_STR);
  1386.             break;
  1387.         default:
  1388.             sprintf((char*)file_path_in_ascii, "%c%s", div_path, GAME_DOWNLOADED_PATH);
  1389.             break;
  1390.     }
  1391.     AnsiiToUnicodeString((PS8) file_path, file_path_in_ascii);
  1392. // prev_memory_type_selected = memory_type_selected;
  1393. // prev_search_type_path = search_type_path;
  1394.     return file_path;
  1395. }
  1396. void game_simu_set_selected_file_name(FMGR_FILE_INFO_STRUCT *file_info)
  1397. {
  1398.     /*----------------------------------------------------------------*/
  1399.     /* Local Variables                                                */
  1400.     /*----------------------------------------------------------------*/
  1401.     U8 tmp_path_buf[(FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH];
  1402.     /*----------------------------------------------------------------*/
  1403.     /* Code Body                                                      */
  1404.     /*----------------------------------------------------------------*/
  1405.     memset(file_path_buf, 0, (FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH);
  1406.     if (file_info->is_short)
  1407.     {
  1408. memset(tmp_path_buf, 0, (FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH);
  1409. mmi_chset_mixed_text_to_ucs2_str(
  1410.             (U8*) tmp_path_buf,
  1411.             (FMGR_MAX_PATH_LEN + 1) * ENCODING_LENGTH,
  1412.             (U8*) file_info->file_name,
  1413.             g_chset_text_encoding);
  1414. pfnUnicodeStrcpy((S8*) file_path_buf, (S8*) game_frm_get_file_path(g_game_simu_set_cntx.inlineHighligtItemSelectMemory, GAME_FRM_SEARCH_DEFAULT));
  1415. pfnUnicodeStrcat((S8*) file_path_buf, (S8*) tmp_path_buf);
  1416.     }
  1417.     else
  1418.     {
  1419. pfnUnicodeStrcpy((S8*) file_path_buf, (S8*) game_frm_get_file_path(g_game_simu_set_cntx.inlineHighligtItemSelectMemory, GAME_FRM_SEARCH_DEFAULT));
  1420. pfnUnicodeStrcat((S8*) file_path_buf, (S8*) file_info->file_name);
  1421.     }
  1422. }
  1423. void game_simu_please_wait_actual_screen(void)
  1424. {
  1425.     /*----------------------------------------------------------------*/
  1426.     /* Local Variables                                                */
  1427.     /*----------------------------------------------------------------*/
  1428.     /*----------------------------------------------------------------*/
  1429.     /* Code Body                                                      */
  1430.     /*----------------------------------------------------------------*/
  1431.     EntryNewScreen(SCR_ID_GAMESIMU_WAITSCREEN, NULL, NULL, NULL);
  1432.     ClearHighlightHandler();
  1433.     /* ShowCategory151Screen(0, 0, 0, 0, 0, 0, (PU8)GetString(STR_ID_GAME_SIMU_WAIT_STRING), 0, NULL); */
  1434.     ShowCategory66Screen(
  1435.         (U16) STR_ID_GAME_SIMU_GAME_LIST,
  1436.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  1437.         0,
  1438.         0,
  1439.         0,
  1440.         0,
  1441.         (U8*) GetString(STR_ID_GAME_SIMU_WAIT_STRING),
  1442.         IMG_GLOBAL_PROGRESS,
  1443.         NULL);
  1444.     /* ShowCategory9Screen(wait_string, wait_image_id, NULL); */
  1445.     ClearAllKeyHandler();
  1446. }
  1447. void game_simu_entry_refresh_game_list(void)
  1448. {
  1449.     /*----------------------------------------------------------------*/
  1450.     /* Local Variables                                                */
  1451.     /*----------------------------------------------------------------*/
  1452.     /*----------------------------------------------------------------*/
  1453.     /* Code Body                                                      */
  1454.     /*----------------------------------------------------------------*/
  1455.     mmi_entry_game_list_screen();
  1456.     DisplayPopup(
  1457.         (PU8) GetString(STR_ID_GAME_LIST_RES_OPTION), //need update
  1458.         IMG_GLOBAL_ACTIVATED,
  1459.         1,
  1460.         UI_POPUP_NOTIFYDURATION_TIME,
  1461.         SUCCESS_TONE);
  1462.  //   if (IsScreenPresent(SCR_FMGR_APP_FILE_OPTION))
  1463. //    {
  1464.  //       DeleteNScrId(SCR_FMGR_APP_FILE_OPTION);
  1465. //    }
  1466. //    else
  1467.  //   {
  1468. //        DeleteNScrId(EBOOK_OPEN_OPTION_SCREENID); //need update
  1469.  //   }
  1470. }
  1471. void game_simu_entry_play(void)
  1472. {
  1473. /*----------------------------------------------------------------*/
  1474. /* Local Variables                                                */
  1475. /*----------------------------------------------------------------*/
  1476. FMGR_FILE_INFO_STRUCT file_info;
  1477. /*----------------------------------------------------------------*/
  1478. /* Code Body                                                      */
  1479. /*----------------------------------------------------------------*/
  1480. ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1481. ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1482. mmi_fmgr_kernel_get_file_info(mmi_fmgr_kernel_get_cur_idx(), &file_info);
  1483. game_simu_set_selected_file_name(&file_info);
  1484. //
  1485. EntryGameSimu();
  1486. return;
  1487. }
  1488. void mmi_game_simu_highlight_play(void)
  1489. {
  1490. /*----------------------------------------------------------------*/
  1491. /* Local Variables                                                */
  1492. /*----------------------------------------------------------------*/
  1493. /*----------------------------------------------------------------*/
  1494. /* Code Body                                                      */
  1495. /*----------------------------------------------------------------*/
  1496.     SetLeftSoftkeyFunction(game_simu_entry_play, KEY_EVENT_UP);
  1497.     SetKeyHandler(game_simu_entry_play, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1498.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1499.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1500. }
  1501. void mmi_game_simu_highlight_refresh_game_list(void)
  1502. {
  1503.     /*----------------------------------------------------------------*/
  1504.     /* Local Variables                                                */
  1505.     /*----------------------------------------------------------------*/
  1506.     /*----------------------------------------------------------------*/
  1507.     /* Code Body                                                      */
  1508.     /*----------------------------------------------------------------*/
  1509.     /* 1 Change left soft key icon and label */
  1510.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1511.     /* 2 Change right soft key icon and label */
  1512.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1513.     /* 3 Register function for left soft key */
  1514.     SetLeftSoftkeyFunction(mmi_entry_game_list_screen, KEY_EVENT_UP);
  1515.     /* 4 Register function for right soft key */
  1516.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1517.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1518.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1519. }
  1520. void mmi_game_simu_highlight_game_data_settings(void)
  1521. {
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Local Variables                                                */
  1524.     /*----------------------------------------------------------------*/
  1525.     /*----------------------------------------------------------------*/
  1526.     /* Code Body                                                      */
  1527.     /*----------------------------------------------------------------*/
  1528.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1529.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1530.     SetLeftSoftkeyFunction(game_list_entry_settings, KEY_EVENT_UP);
  1531.     SetKeyHandler(game_list_entry_settings, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1532. //    g_ebook_app_cntx_p->ebr_set_local_setting_flag = 0;
  1533.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1534.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1535. }
  1536. #if 0
  1537. void mmi_game_simu_higlight_game_info(void)
  1538. {
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Local Variables                                                */
  1541.     /*----------------------------------------------------------------*/
  1542.     /*----------------------------------------------------------------*/
  1543.     /* Code Body                                                      */
  1544.     /*----------------------------------------------------------------*/
  1545.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1546.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1547. //    SetLeftSoftkeyFunction(ebr_entry_book_info, KEY_EVENT_UP);
  1548. //    SetKeyHandler(ebr_entry_book_info, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1549.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1550. }
  1551. void mmi_game_simu_highlight_delete_game(void)
  1552. {
  1553.     /*----------------------------------------------------------------*/
  1554.     /* Local Variables                                                */
  1555.     /*----------------------------------------------------------------*/
  1556.     /*----------------------------------------------------------------*/
  1557.     /* Code Body                                                      */
  1558.     /*----------------------------------------------------------------*/
  1559.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1560.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1561. //    SetLeftSoftkeyFunction(ebr_entry_delete_book_popup, KEY_EVENT_UP);
  1562.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1563.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1564. }
  1565. void mmi_game_simu_highlight_delete_all(void)
  1566. {
  1567.     /*----------------------------------------------------------------*/
  1568.     /* Local Variables                                                */
  1569.     /*----------------------------------------------------------------*/
  1570.     /*----------------------------------------------------------------*/
  1571.     /* Code Body                                                      */
  1572.     /*----------------------------------------------------------------*/
  1573.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1574.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1575.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1576.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1577.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1578.     highlight_fmgr_delete_all_file();
  1579. }
  1580. void mmi_game_simu_highlight_help(void)
  1581. {
  1582.     /*----------------------------------------------------------------*/
  1583.     /* Local Variables                                                */
  1584.     /*----------------------------------------------------------------*/
  1585.     /*----------------------------------------------------------------*/
  1586.     /* Code Body                                                      */
  1587.     /*----------------------------------------------------------------*/
  1588.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1589.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  1590. //    SetLeftSoftkeyFunction(ebr_entry_help, KEY_EVENT_UP);
  1591. //    SetKeyHandler(ebr_entry_help, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1592.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1593. }
  1594. #endif
  1595. ///////////////////////////
  1596. S32 game_simu_frm_get_total_file(void)
  1597. {
  1598.     /*----------------------------------------------------------------*/
  1599.     /* Local Variables                                                */
  1600.     /*----------------------------------------------------------------*/
  1601.     FS_HANDLE fh_cur;
  1602.     FS_DOSDirEntry file_info;
  1603.     UI_character_type filename[MAX_GAME_NAME_LENGTH];
  1604.     U8 count = 0;
  1605.     S8 path[MAX_DWNL_GAME_PATH_LEN * ENCODING_LENGTH];
  1606.     /*----------------------------------------------------------------*/
  1607.     /* Code Body                                                      */
  1608.     /*----------------------------------------------------------------*/
  1609.     pfnUnicodeStrcpy(
  1610.         (S8*) path,
  1611.     (S8*) game_frm_get_file_path((S8)g_game_simu_set_cntx.inlineHighligtItemSelectMemory, game_simu_search_type_path));
  1612.     if ((fh_cur = FS_FindFirst(
  1613.                     (const WCHAR*)path,
  1614.                     0,
  1615.                     0,
  1616.                     &file_info,
  1617.                     (U16*) filename,
  1618.                     MAX_GAME_NAME_LENGTH * ENCODING_LENGTH)) >= 0)
  1619.     {
  1620.         do
  1621.         {
  1622.             if (!(file_info.Attributes & FS_ATTR_DIR))
  1623.             {
  1624.                 count++;
  1625.                 break;
  1626.             }
  1627.         } while ((FS_FindNext(fh_cur, &file_info, (U16*) filename, MAX_GAME_NAME_LENGTH * ENCODING_LENGTH) ==
  1628.                   FS_NO_ERROR));
  1629.         FS_FindClose(fh_cur);
  1630.     }
  1631.     return count;
  1632. }
  1633. U16 mmi_game_simu_get_menuId(void)
  1634. {
  1635.     /*----------------------------------------------------------------*/
  1636.     /* Local Variables                                                */
  1637.     /*----------------------------------------------------------------*/
  1638.     S16 count_no_of_game_file;
  1639.     /*----------------------------------------------------------------*/
  1640.     /* Code Body                                                      */
  1641.     /*----------------------------------------------------------------*/
  1642.     count_no_of_game_file = game_simu_frm_get_total_file();
  1643. debug_uart_output_data("ncount_no_of_game_file = %dn", count_no_of_game_file);
  1644. //    ebr_frm_write_default_value_for_nfo_id_in_nvram();
  1645.     if (count_no_of_game_file <= 0)
  1646.     {
  1647.         return MENU_ID_GAME_LIMITED_GAME_LIST_OPTION;
  1648.     }
  1649.     else
  1650.     {
  1651.         return MENU_ID_GAME_GAME_LIST_OPTION;
  1652.     }
  1653. }
  1654. S8 *game_list_frm_get_path_for_game(void)
  1655. {
  1656.     /*----------------------------------------------------------------*/
  1657.     /* Local Variables                                                */
  1658.     /*----------------------------------------------------------------*/
  1659.     /*----------------------------------------------------------------*/
  1660.     /* Code Body                                                      */
  1661.     /*----------------------------------------------------------------*/
  1662.     return game_frm_get_file_path(memory_type_selected, GAME_FRM_SEARCH_DEFAULT);
  1663. }
  1664. void game_list_file_callback(void *fullname, int is_short)
  1665. {
  1666.     /*----------------------------------------------------------------*/
  1667.     /* Local Variables                                                */
  1668.     /*----------------------------------------------------------------*/
  1669.     /*----------------------------------------------------------------*/
  1670.     /* Code Body                                                      */
  1671.     /*----------------------------------------------------------------*/
  1672.     GoBackHistory();
  1673. }
  1674. #if 0
  1675. void game_simu_is_drive_letter_valid(void)
  1676. {
  1677. S16 error;
  1678. S8 div_path;
  1679. S8  memory_type_selected;
  1680. MMI_BOOL status;
  1681. ReadValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, (void *)&g_game_simu_set_cntx.inlineHighligtItemSelectMemory, DS_BYTE, &error);
  1682. if (g_game_simu_set_cntx.inlineHighligtItemSelectMemory == 0)
  1683. memory_type_selected = (S8)MMI_PUBLIC_DRV;
  1684. else
  1685. memory_type_selected = (S8)MMI_CARD_DRV;
  1686.    status = mmi_fmgr_is_drive_letter_valid(memory_type_selected);
  1687. if (status && FS_GetDevStatus(memory_type_selected, FS_MOUNT_STATE_ENUM) == FS_NO_ERROR)
  1688. {
  1689. return ;
  1690. }
  1691. else
  1692. {
  1693. memory_type_selected = MMI_PUBLIC_DRV;
  1694. g_game_simu_set_cntx.inlineHighligtItemSelectMemory = 0;
  1695. WriteValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, &(g_game_simu_set_cntx.inlineHighligtItemSelectMemory), DS_BYTE, &error);
  1696. return ;
  1697. }
  1698. }
  1699. #endif
  1700. void mmi_entry_game_list_screen(void)
  1701. {
  1702.     /*----------------------------------------------------------------*/
  1703.     /* Local Variables                                                */
  1704.     /*----------------------------------------------------------------*/
  1705.     FMGR_FILTER filter;
  1706.     S16 local_nfo_id;
  1707. /*----------------------------------------------------------------*/
  1708. /* Code Body                                                      */
  1709. /*----------------------------------------------------------------*/
  1710. /* DeleteScreenIfPresent(SCR_ID_GAMESIMU_LIST); */
  1711. switch(game_simu_fmgr_filter)
  1712. {
  1713. case FMGR_TYPE_GAME_GB:
  1714. game_simu_search_type_path = GAME_FRM_SEARCH_GB;
  1715. break;
  1716. case FMGR_TYPE_GAME_GBC:
  1717. game_simu_search_type_path = GAME_FRM_SEARCH_GBC;
  1718. break;
  1719. case FMGR_TYPE_GAME_NES:
  1720. game_simu_search_type_path = GAME_FRM_SEARCH_NES;
  1721. break;
  1722. default:
  1723. game_simu_search_type_path = GAME_FRM_SEARCH_DEFAULT;
  1724. break;
  1725. }
  1726.      game_simu_please_wait_actual_screen();
  1727. FMGR_FILTER_INIT(&filter);
  1728. FMGR_FILTER_SET(&filter, game_simu_fmgr_filter);
  1729. mmi_fmgr_select_path_and_enter(
  1730.     APP_GAMESIMU,
  1731.     FMGR_SELECT_BROWSE,
  1732.     filter,
  1733.     (PS8) game_list_frm_get_path_for_game(),
  1734.     game_list_file_callback);
  1735. DeleteScreenIfPresent(SCR_ID_GAMESIMU_WAITSCREEN);
  1736. ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1737. }
  1738. void game_simu_frm_check_is_game_folder_created(void)
  1739. {
  1740.     /*----------------------------------------------------------------*/
  1741.     /* Local Variables                                                */
  1742.     /*----------------------------------------------------------------*/
  1743.     S8 tmp_str[MAX_DWNL_GAME_PATH_LEN];
  1744.     S8 game_folder_path[MAX_DWNL_GAME_PATH_LEN * ENCODING_LENGTH];
  1745.     /*----------------------------------------------------------------*/
  1746.     /* Code Body                                                      */
  1747.     /*----------------------------------------------------------------*/
  1748.     sprintf(tmp_str, "%c%s", MMI_CARD_DRV, GAME_DOWNLOADED_PATH);
  1749.     AnsiiToUnicodeString((S8*) game_folder_path, (S8*) tmp_str);
  1750.     FS_CreateDir((PU16) game_folder_path);
  1751.     sprintf(tmp_str, "%c%s", MMI_PUBLIC_DRV, GAME_DOWNLOADED_PATH);
  1752.     AnsiiToUnicodeString((S8*) game_folder_path, (S8*) tmp_str);
  1753.     FS_CreateDir((PU16) game_folder_path);
  1754. }
  1755. game_memory_type_enum game_simu_frm_get_memory_type_selected(void)
  1756. {
  1757. /*----------------------------------------------------------------*/
  1758. /* Local Variables                                                */
  1759. /*----------------------------------------------------------------*/
  1760. S8 memory_type_selected;
  1761. S16 error;
  1762. MMI_BOOL status;
  1763. /*----------------------------------------------------------------*/
  1764. /* Code Body                                                      */
  1765. /*----------------------------------------------------------------*/
  1766. ReadValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, &(g_game_simu_set_cntx.inlineHighligtItemSelectMemory), DS_BYTE, &error);
  1767. if (g_game_simu_set_cntx.inlineHighligtItemSelectMemory == 0)
  1768. {
  1769. memory_type_selected = MMI_PUBLIC_DRV;
  1770. }
  1771. else
  1772. {
  1773. memory_type_selected = MMI_CARD_DRV;
  1774. }
  1775. status = mmi_fmgr_is_drive_letter_valid(memory_type_selected);
  1776. if (status && FS_GetDevStatus(memory_type_selected, FS_MOUNT_STATE_ENUM) == FS_NO_ERROR)
  1777. {
  1778. return memory_type_selected;
  1779. }
  1780. else
  1781. {
  1782. memory_type_selected = MMI_PUBLIC_DRV;
  1783. g_game_simu_set_cntx.inlineHighligtItemSelectMemory = 0;
  1784. WriteValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, &(g_game_simu_set_cntx.inlineHighligtItemSelectMemory), DS_BYTE, &error);
  1785.      }
  1786.      return memory_type_selected;
  1787.     
  1788. }
  1789. void game_simu_frm_init(void)
  1790. {
  1791. /*----------------------------------------------------------------*/
  1792. /* Local Variables                                                */
  1793. /*----------------------------------------------------------------*/
  1794. S16 error;
  1795. /*----------------------------------------------------------------*/
  1796. /* Code Body                                                      */
  1797. /*----------------------------------------------------------------*/
  1798. //    g_curr_book_cntx_p->state_recursive_conversion = EBR_FRM_NO_CONVERSION;
  1799. // ReadValue(NVRAM_GAME_LIST_AUTO_GEN_ID, &g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen, DS_BYTE, &error);
  1800. ReadValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, &g_game_simu_set_cntx.inlineHighligtItemSelectMemory, DS_BYTE, &error);
  1801. // if (g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen < 0 || g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen > 1)
  1802. // {
  1803. // g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen= 0;
  1804. // WriteValue(NVRAM_GAME_LIST_AUTO_GEN_ID, &g_game_simu_set_cntx.inlineHighligtItemSelectAutoGen, DS_BYTE, &error);
  1805. // }
  1806. if (g_game_simu_set_cntx.inlineHighligtItemSelectMemory < 0 || g_game_simu_set_cntx.inlineHighligtItemSelectMemory > 1)
  1807. {
  1808. g_game_simu_set_cntx.inlineHighligtItemSelectMemory = 0;
  1809. WriteValue(NVRAM_GAME_LIST_MEMORY_TYPE_ID, &(g_game_simu_set_cntx.inlineHighligtItemSelectMemory), DS_BYTE, &error);
  1810. }
  1811. game_simu_frm_check_is_game_folder_created();
  1812. game_simu_frm_get_memory_type_selected();
  1813. }
  1814. //KP Jerry add on 2007-4-14 start
  1815. /*****************************************************************************
  1816.  * FUNCTION
  1817.  *  mmi_gamesimu_load_setting
  1818.  * DESCRIPTION
  1819.  *  load gamesimu setting from NVRAM
  1820.  * PARAMETERS
  1821.  *  void
  1822.  * RETURNS
  1823.  *  void
  1824.  *****************************************************************************/
  1825. void mmi_gamesimu_load_setting(void)
  1826. {
  1827.     /*----------------------------------------------------------------*/
  1828.     /* Local Variables                                                */
  1829.     /*----------------------------------------------------------------*/
  1830.     S16 error;
  1831.     /*----------------------------------------------------------------*/
  1832.     /* Code Body                                                      */
  1833.     /*----------------------------------------------------------------*/
  1834.     ReadValue(NVRAM_GAME_SIMU_LCD_STATE_ID, &game_simu_settings.bLCDState, DS_BYTE, &error);
  1835.     /* if not init, init as HORIZONTAL */
  1836.     if (game_simu_settings.bLCDState == 0xff)
  1837.     {
  1838.         game_simu_settings.bLCDState = TRUE;
  1839.         WriteValue(NVRAM_GAME_SIMU_LCD_STATE_ID, &game_simu_settings.bLCDState, DS_BYTE, &error);
  1840.     }
  1841.     ReadValue(NVRAM_GAME_SIMU_AUDIO_ID, &game_simu_settings.bVolu, DS_BYTE, &error);
  1842.     /* if not init, init as OFF */
  1843.     if (game_simu_settings.bVolu == 0xff)
  1844.     {
  1845.         game_simu_settings.bVolu = TRUE;
  1846.         WriteValue(NVRAM_GAME_SIMU_AUDIO_ID, &game_simu_settings.bVolu, DS_BYTE, &error);
  1847.     }
  1848. }
  1849. /*****************************************************************************
  1850.  * FUNCTION
  1851.  *  mmi_gamesimu_exit_setting_screen
  1852.  * DESCRIPTION
  1853.  *  exit point for gamesimu setting screen
  1854.  * PARAMETERS
  1855.  *  void
  1856.  *  viud(?)     [IN]        
  1857.  * RETURNS
  1858.  *  void
  1859.  *****************************************************************************/
  1860. static void mmi_gamesimu_exit_setting_screen(void)
  1861. {
  1862.     /*----------------------------------------------------------------*/
  1863.     /* Local Variables                                                */
  1864.     /*----------------------------------------------------------------*/
  1865.     U16 inputBufferSize;
  1866.     history h;
  1867.     S16 nHistory = 0;
  1868.     /*----------------------------------------------------------------*/
  1869.     /* Code Body                                                      */
  1870.     /*----------------------------------------------------------------*/
  1871.     h.scrnID = SCR_ID_GAMESIMU_SETTING;
  1872.     CloseCategory57Screen();
  1873.     h.entryFuncPtr = mmi_gamesimu_entry_setting_screen;
  1874.     pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  1875.     GetCategory57History(h.guiBuffer);
  1876.     inputBufferSize = (U16) GetCategory57DataSize();
  1877.     GetCategory57Data((U8*) h.inputBuffer);
  1878.     AddNHistory(h, inputBufferSize);
  1879. }
  1880. /*****************************************************************************
  1881.  * FUNCTION
  1882.  *  mmi_gamesimu_store_setting
  1883.  * DESCRIPTION
  1884.  *  store gamesimu setting back to NVRAM
  1885.  * PARAMETERS
  1886.  *  void
  1887.  * RETURNS
  1888.  *  void
  1889.  *****************************************************************************/
  1890. void mmi_gamesimu_store_setting(void)
  1891. {
  1892.     /*----------------------------------------------------------------*/
  1893.     /* Local Variables                                                */
  1894.     /*----------------------------------------------------------------*/
  1895.     S16 error;
  1896.     /*----------------------------------------------------------------*/
  1897.     /* Code Body                                                      */
  1898.     /*----------------------------------------------------------------*/
  1899.     WriteValue(NVRAM_GAME_SIMU_LCD_STATE_ID, &game_simu_settings.bLCDState, DS_BYTE, &error);
  1900.     WriteValue(NVRAM_GAME_SIMU_AUDIO_ID, &game_simu_settings.bVolu, DS_BYTE, &error);
  1901. }
  1902. /*****************************************************************************
  1903.  * FUNCTION
  1904.  *  mmi_gamesimu_setting_done_hdlr
  1905.  * DESCRIPTION
  1906.  *  done hdlr for game setting
  1907.  * PARAMETERS
  1908.  *  void
  1909.  * RETURNS
  1910.  *  void
  1911.  *****************************************************************************/
  1912. static void mmi_gamesimu_setting_done_hdlr(void)
  1913. {
  1914.     /*----------------------------------------------------------------*/
  1915.     /* Local Variables                                                */
  1916.     /*----------------------------------------------------------------*/
  1917.     /*----------------------------------------------------------------*/
  1918.     /* Code Body                                                      */
  1919.     /*----------------------------------------------------------------*/
  1920.     /* game effect */
  1921.     game_simu_settings.bLCDState = gamesimu_cntx.lcd_selected;
  1922.     game_simu_settings.bVolu = gamesimu_cntx.aud_selected;
  1923.     mmi_gamesimu_store_setting();
  1924.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, ST_NOTIFYDURATION, SUCCESS_TONE);
  1925.     DeleteNHistory(1);
  1926. }
  1927. /*****************************************************************************
  1928.  * FUNCTION
  1929.  *  mmi_gamesimu_setting_highlight_hdlr
  1930.  * DESCRIPTION
  1931.  *  highlight hdlr
  1932.  * PARAMETERS
  1933.  *  index       [IN]        
  1934.  * RETURNS
  1935.  *  void
  1936.  *****************************************************************************/
  1937. static void mmi_gamesimu_setting_highlight_hdlr(S32 index)
  1938. {
  1939.     /*----------------------------------------------------------------*/
  1940.     /* Local Variables                                                */
  1941.     /*----------------------------------------------------------------*/
  1942.     /*----------------------------------------------------------------*/
  1943.     /* Code Body                                                      */
  1944.     /*----------------------------------------------------------------*/
  1945.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1946.     SetCategory57LeftSoftkeyFunction(mmi_gamesimu_setting_done_hdlr);
  1947. }
  1948. /*****************************************************************************
  1949.  * FUNCTION
  1950.  *  mmi_gamesimu_entry_setting_screen
  1951.  * DESCRIPTION
  1952.  *  entry point for gamesimu setting screen
  1953.  * PARAMETERS
  1954.  *  void
  1955.  * RETURNS
  1956.  *  void
  1957.  *****************************************************************************/
  1958. static void mmi_gamesimu_entry_setting_screen(void)
  1959. {
  1960.     /*----------------------------------------------------------------*/
  1961.     /* Local Variables                                                */
  1962.     /*----------------------------------------------------------------*/
  1963.     U8 *guiBuffer;
  1964.     U8 *inputBuffer;
  1965.     U16 inputBufferSize;
  1966.     S32 item_offset = 0;
  1967.     MMI_ID_TYPE item_icons[] = 
  1968.     {
  1969.         IMG_ID_GAME_SETTING_VIB,// FOR LCD STATE SMALL ICON
  1970.         0,
  1971.         IMG_ID_GAME_SETTING_AUD, // FOR AUDIO SMALL ICON
  1972.         0,
  1973.     };
  1974.     /*----------------------------------------------------------------*/
  1975.     /* Code Body                                                      */
  1976.     /*----------------------------------------------------------------*/
  1977.     /* load setting */
  1978.     mmi_gamesimu_load_setting();
  1979.     EntryNewScreen(SCR_ID_GAMESIMU_SETTING, mmi_gamesimu_exit_setting_screen, NULL, NULL);
  1980.    /***************************************************************************** 
  1981.    * Game simu
  1982.    *****************************************************************************/
  1983.     /* TRUE (1) is on */
  1984.    gamesimu_cntx.lcd_selected = game_simu_settings.bLCDState;
  1985.    gamesimu_cntx.aud_selected = game_simu_settings.bVolu;
  1986.    
  1987.     gamesimu_cntx.lcd_str[0] = (UI_string_type) GetString((U16) (STR_ID_GAME_SIMU_LCD_V));
  1988.     gamesimu_cntx.lcd_str[1] = (UI_string_type) GetString((U16) (STR_ID_GAME_SIMU_LCD_H));
  1989.     gamesimu_cntx.aud_str[0] = (UI_string_type) GetString((U16) (STR_GLOBAL_OFF));
  1990.     gamesimu_cntx.aud_str[1] = (UI_string_type) GetString((U16) (STR_GLOBAL_ON));
  1991.     memset((void*)gamesimu_cntx.inline_game_items, 0, sizeof(InlineItem) * MMI_GAMESIMU_SETTING_ITEM_COUNT * 2);
  1992.     InitializeCategory57Screen();
  1993.     /* game simu LCD */
  1994.     SetInlineItemCaption(
  1995.         &gamesimu_cntx.inline_game_items[item_offset++],
  1996.         (PU8) GetString((U16) (STR_ID_GAME_SIMU_LCD_STATE)));
  1997.     SetInlineItemActivation(&gamesimu_cntx.inline_game_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  1998.     SetInlineItemSelect(
  1999.         &gamesimu_cntx.inline_game_items[item_offset++],
  2000.         2,
  2001.         (U8 **) gamesimu_cntx.lcd_str,
  2002.         &gamesimu_cntx.lcd_selected);
  2003.     /* game simu audio */
  2004.     SetInlineItemCaption(
  2005.         &gamesimu_cntx.inline_game_items[item_offset++],
  2006.         (PU8) GetString((U16) (STR_ID_GAME_SIMU_VOL_SWITCH)));
  2007.     SetInlineItemActivation(&gamesimu_cntx.inline_game_items[item_offset], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2008.     SetInlineItemSelect(
  2009.         &gamesimu_cntx.inline_game_items[item_offset++],
  2010.         2,
  2011.         (U8 **) gamesimu_cntx.aud_str,
  2012.         &gamesimu_cntx.aud_selected);
  2013.     guiBuffer = GetCurrGuiBuffer(SCR_ID_GAMESIMU_SETTING);
  2014.     inputBuffer = GetCurrNInputBuffer(SCR_ID_GAMESIMU_SETTING, &inputBufferSize);
  2015.     if (inputBuffer != NULL)
  2016.     {
  2017.         SetCategory57Data(gamesimu_cntx.inline_game_items, MMI_GAMESIMU_SETTING_ITEM_COUNT * 2, inputBuffer);
  2018.     }
  2019.     RegisterHighlightHandler(mmi_gamesimu_setting_highlight_hdlr);
  2020.     /* show category */
  2021.     ShowCategory57Screen(
  2022.         STR_ID_GAME_SETTING,
  2023.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  2024.         STR_GLOBAL_OK,
  2025.         IMG_GLOBAL_OK,
  2026.         STR_GLOBAL_BACK,
  2027.         IMG_GLOBAL_BACK,
  2028.         item_offset,
  2029.         item_icons,
  2030.         gamesimu_cntx.inline_game_items,
  2031.         0,
  2032.         guiBuffer);
  2033.     /* set key hdlr */
  2034.     SetCategory57LeftSoftkeyFunction(mmi_gamesimu_setting_done_hdlr);
  2035.     SetCategory57RightSoftkeyFunctions(GoBackHistory, GoBackHistory);
  2036.     DisableCategory57ScreenDone();
  2037. }
  2038. //KP Jerry add on 2007-4-14 end
  2039. /*****************************************************************************
  2040.  * FUNCTION
  2041.  *  mmi_gamesimu_highlight_hdlr
  2042.  * DESCRIPTION
  2043.  *  highlight hdlr for games
  2044.  * PARAMETERS
  2045.  *  index       [IN]        Highlighted index
  2046.  * RETURNS
  2047.  *  void
  2048.  *****************************************************************************/
  2049. static void mmi_gamesimu_highlight_hdlr(S32 index)
  2050. {
  2051.     /*----------------------------------------------------------------*/
  2052.     /* Local Variables                                                */
  2053.     /*----------------------------------------------------------------*/
  2054.     /*----------------------------------------------------------------*/
  2055.     /* Code Body                                                      */
  2056.     /*----------------------------------------------------------------*/
  2057.     switch (index)
  2058.     {
  2059.     /*
  2060.      case index:
  2061.       {
  2062.    SetLeftSoftkeyFunction(EntryGameSimu,KEY_EVENT_UP); 
  2063.           SetKeyHandler(EntryGameSimu, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  2064.        }
  2065.    break;
  2066. */
  2067. //GAME_SWITCH(GAME_SIMU_TYPE_GB, EntryGameSimu);
  2068. //GAME_SWITCH(GAME_SIMU_TYPE_GBC, EntryGameSimu);
  2069. //GAME_SWITCH(GAME_SIMU_TYPE_NES, EntryGameSimu);
  2070. #ifdef __GAME_SIMU_E_GB__
  2071. case GAME_SIMU_TYPE_GB:
  2072. {
  2073. game_simu_fmgr_filter = FMGR_TYPE_GAME_GB;
  2074. u8_g_game_type = GAME_SIMU_TYPE_GB;
  2075. //mmi_entry_game_list_screen();
  2076. //goto SETKEYHANDLE;
  2077. //GAME_SIMU_SWITCH(GAME_SIMU_TYPE_GB, mmi_entry_game_list_screen);
  2078. //EntryGameSimu();
  2079. break;
  2080. }
  2081. #endif
  2082. #ifdef __GAME_SIMU_E_GBC__
  2083. case GAME_SIMU_TYPE_GBC:
  2084. {
  2085. game_simu_fmgr_filter = FMGR_TYPE_GAME_GBC;
  2086. u8_g_game_type = GAME_SIMU_TYPE_GBC;
  2087. //mmi_entry_game_list_screen();
  2088. //goto SETKEYHANDLE;
  2089. //GAME_SIMU_SWITCH(GAME_SIMU_TYPE_GBC, mmi_entry_game_list_screen);
  2090. //EntryGameSimu();
  2091. break;
  2092. }
  2093. #endif
  2094. #ifdef __GAME_SIMU_E_NES__
  2095. case GAME_SIMU_TYPE_NES:
  2096. {
  2097. game_simu_fmgr_filter = FMGR_TYPE_GAME_NES;
  2098. u8_g_game_type = GAME_SIMU_TYPE_NES;
  2099. //mmi_entry_game_list_screen();
  2100. //goto SETKEYHANDLE;
  2101. //GAME_SIMU_SWITCH(FMGR_TYPE_GAME_NES, mmi_entry_game_list_screen);
  2102. //EntryGameSimu();
  2103. break;
  2104. }
  2105. #endif
  2106. case GAME_SIMU_SETTING:
  2107.      SetLeftSoftkeyFunction(mmi_gamesimu_entry_setting_screen,KEY_EVENT_UP);
  2108.      SetKeyHandler(mmi_gamesimu_entry_setting_screen, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  2109. return;
  2110. case GAME_SIMU_HELP:
  2111.      SetLeftSoftkeyFunction(mmi_gamesimu_entry_help_screen,KEY_EVENT_UP);
  2112.      SetKeyHandler(mmi_gamesimu_entry_help_screen, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  2113. return;
  2114.         default:
  2115.             /* shall not enter here */
  2116.             MMI_ASSERT(0);
  2117.             break;
  2118.     }
  2119.    GAME_SIMU_SWITCH(u8_g_game_type, mmi_entry_game_list_screen);
  2120. //SETKEYHANDLE:
  2121. //   SetLeftSoftkeyFunction(mmi_entry_game_list_screen,KEY_EVENT_UP); 
  2122. //  SetKeyHandler(mmi_entry_game_list_screen, KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  2123. }
  2124. /*****************************************************************************
  2125.  * FUNCTION
  2126.  *  mmi_gamesimu_entry_game_list
  2127.  * DESCRIPTION
  2128.  *  entry game app screen
  2129.  * PARAMETERS
  2130.  *  void
  2131.  * RETURNS
  2132.  *  void
  2133.  *****************************************************************************/
  2134. static void mmi_gamesimu_entry_game_list(void)
  2135. {
  2136.     /*----------------------------------------------------------------*/
  2137.     /* Local Variables                                                */
  2138.     /*----------------------------------------------------------------*/
  2139.     U8 *guiBuffer;
  2140.     UI_time t;
  2141.     U16 menu_str[GAME_SIMU_LIST_COUNT];
  2142.     U16 menu_img[GAME_SIMU_LIST_COUNT];
  2143.     U16 index = 0;
  2144.     /*----------------------------------------------------------------*/
  2145.     /* Code Body                                                      */
  2146.     /*----------------------------------------------------------------*/
  2147. debug_uart_output_data(" n entry game list n");
  2148. #ifdef __GAME_SIMU_E_GB__
  2149.     menu_str[index] = STR_ID_GAME_SIMU_E_GB;
  2150.     menu_img[index++] = IMG_GLOBAL_L1;
  2151. #endif
  2152. #ifdef __GAME_SIMU_E_GBC__
  2153.     menu_str[index] = STR_ID_GAME_SIMU_E_GBC;
  2154.     menu_img[index++] = IMG_GLOBAL_L2;
  2155. #endif
  2156. #ifdef __GAME_SIMU_E_NES__
  2157.     menu_str[index] = STR_ID_GAME_SIMU_E_NES;
  2158.     menu_img[index++] = IMG_GLOBAL_L3;
  2159. #endif
  2160.     menu_str[index] = STR_ID_GAME_SIMU_SETTING;
  2161.     menu_img[index++] = IMG_GLOBAL_L4;
  2162.     
  2163.     menu_str[index] = STR_ID_GAME_SIMU_HELP_TITLE;
  2164.     menu_img[index++] = IMG_GLOBAL_L5;
  2165.     /* Set random seed */
  2166.     GetDateTime(&t);
  2167.     srand(t.nMin);
  2168.     EntryNewScreen(SCR_ID_GAMESIMU_LIST, NULL, mmi_gamesimu_entry_game_list, NULL);
  2169.     guiBuffer = GetCurrGuiBuffer(SCR_ID_GAMESIMU_LIST);
  2170.     RegisterHighlightHandler(mmi_gamesimu_highlight_hdlr);
  2171.     ShowCategory15Screen(
  2172.         STR_ID_GAME_SIMU,
  2173.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  2174.         STR_GLOBAL_OK,
  2175.         IMG_GLOBAL_OK,
  2176.         STR_GLOBAL_BACK,
  2177.         IMG_GLOBAL_BACK,
  2178.         index,
  2179.         menu_str,
  2180.         menu_img,
  2181.         1,
  2182.         0,
  2183.         guiBuffer);
  2184. debug_uart_output_data(" n entry ShowCategory15Screen() n");
  2185.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2186.     mmi_gamesimu_load_setting();
  2187. }
  2188. void mmi_gamesimu_entry_help_screen(void)
  2189. {
  2190.     /*----------------------------------------------------------------*/
  2191.     /* Local Variables                                                */
  2192.     /*----------------------------------------------------------------*/
  2193.     PS8 buffer;
  2194.     S32 bufferSize;
  2195.     /*----------------------------------------------------------------*/
  2196.     /* Code Body                                                      */
  2197.     /*----------------------------------------------------------------*/
  2198.     EntryNewScreen(SCR_ID_GAMESIMU_HELP, NULL, mmi_gamesimu_entry_help_screen, NULL);
  2199.     buffer = GetString(STR_ID_GAME_SIMU_HELP);
  2200.     bufferSize = pfnUnicodeStrlen(buffer);
  2201.     ShowCategory74Screen(
  2202.         STR_ID_GAME_SIMU_HELP_TITLE,
  2203.         MAIN_MENU_TITLE_FUNANDGAMES_ICON,
  2204.         0,
  2205.         0,
  2206.         STR_GLOBAL_BACK,
  2207.         IMG_GLOBAL_BACK,
  2208.         (PU8) buffer,
  2209.         bufferSize,
  2210.         NULL);
  2211.     /* go back to game menu */
  2212.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2213.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2214. }
  2215. #if 0
  2216. void mmi_gamesimu_highlight_help(void)
  2217. {
  2218.     /*----------------------------------------------------------------*/
  2219.     /* Local Variables                                                */
  2220.     /*----------------------------------------------------------------*/
  2221.     /*----------------------------------------------------------------*/
  2222.     /* Code Body                                                      */
  2223.     /*----------------------------------------------------------------*/
  2224.     SetLeftSoftkeyFunction(mmi_gamesimu_entry_help_screen, KEY_EVENT_UP);
  2225.     SetKeyHandler(mmi_gamesimu_entry_help_screen, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2226. }
  2227. #endif
  2228. /*****************************************************************************
  2229.  * FUNCTION
  2230.  *  mmi_gamesimu_highlight_app
  2231.  * DESCRIPTION
  2232.  *  highlight game app menitem
  2233.  * PARAMETERS
  2234.  *  void
  2235.  * RETURNS
  2236.  *  void
  2237.  *****************************************************************************/
  2238. void mmi_gamesimu_highlight_app(void)
  2239. {
  2240.     /*----------------------------------------------------------------*/
  2241.     /* Local Variables                                                */
  2242.     /*----------------------------------------------------------------*/
  2243.     /*----------------------------------------------------------------*/
  2244.     /* Code Body                                                      */
  2245.     /*----------------------------------------------------------------*/
  2246.     SetLeftSoftkeyFunction(mmi_gamesimu_entry_game_list, KEY_EVENT_UP);
  2247.     SetKeyHandler(mmi_gamesimu_entry_game_list, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2248. }
  2249. //KP Jerry add on 2007-4-14 start
  2250. void mmi_gameply_entry_player_screen_from_file(PS8 filename, fmgr_filter_type_enum filtertype)
  2251. {
  2252. //memcpy(file_path_buf, filename, sizeof(filename));
  2253. memset(file_path_buf, 0, sizeof(file_path_buf));
  2254. pfnUnicodeStrcpy((PS8)file_path_buf, filename);
  2255. switch (filtertype)
  2256. {
  2257. case FMGR_TYPE_GAME_GB:
  2258. u8_g_game_type = GAME_SIMU_TYPE_GB;
  2259. break;
  2260. case FMGR_TYPE_GAME_GBC:
  2261. u8_g_game_type = GAME_SIMU_TYPE_GBC;
  2262. break;
  2263. case FMGR_TYPE_GAME_NES:
  2264. u8_g_game_type = GAME_SIMU_TYPE_NES;
  2265. break;
  2266. default:
  2267. return;
  2268. }
  2269. #ifdef DEBUG_TEST
  2270. debug_uart_output_data("n u8_g_game_type = %d n", u8_g_game_type);
  2271. #endif
  2272. EntryGameSimu();
  2273. }
  2274. //KP Jerry add on 2007-4-14 end
  2275. #endif/* defined(__GAME_SIMU__)*/
  2276. #endif