void handle_message(uint8_t msg_type, char* ident, char* message) { uint8_t icon; switch (msg_type) { case ELEMENT_TYPE_MESSAGE_SMS: icon = ICON_MSG; break; case ELEMENT_TYPE_MESSAGE_FB: icon = ICON_FACEBOOK; break; case ELEMENT_TYPE_MESSAGE_TW: icon = ICON_TWITTER; break; case ELEMENT_TYPE_MESSAGE_WEATHER: case ELEMENT_TYPE_MESSAGE_BATTERY: case ELEMENT_TYPE_MESSAGE_CALL: case ELEMENT_TYPE_MESSAGE_REMINDER: //TODO: impelment all these icon = ICON_MSG; break; case ELEMENT_TYPE_MESSAGE_RANGE: //TODO: this is special: phone out of range is merely an option //in message, if the value is "off" turn off the alarm //in message, if the value is "on" turn on the alarm break; default: return; break; } window_notify(ident, message, NOTIFY_OK, icon); }
/* * イベントセットアップ */ static void FASTCALL display_setup(void) { #if (XM7_VER >= 3) || (XM7_VER == 1 && defined(L4CARD)) /* 200ライン,400ラインの判別 */ #if XM7_VER >= 3 if (screen_mode == SCR_400LINE) { #else if (enable_400line && enable_400linecard) { #endif blank_count = 0x1000; schedule_setevent(EVENT_VSYNC, 340, display_vsync); schedule_setevent(EVENT_BLANK, 1650, display_blank); } else { blank_count = 0; schedule_setevent(EVENT_VSYNC, 1520, display_vsync); schedule_setevent(EVENT_BLANK, 3940, display_blank); } #else blank_count = 0; schedule_setevent(EVENT_VSYNC, 1520, display_vsync); schedule_setevent(EVENT_BLANK, 3940, display_blank); /* 垂直ブランキング期間 */ vsync_flag = FALSE; blank_flag = TRUE; #endif /* VSYNC通知 */ if (!draw_aftervsync) { vsync_notify(); } } /* * サブCPU * イベント処理 */ static BOOL FASTCALL subcpu_event(void) { #if XM7_VER >= 2 /* 念のため、チェック */ if (!subnmi_flag && (fm7_ver >= 2)) { return FALSE; } #endif /* NMI割り込みを起こす */ subcpu_nmi(); return TRUE; } /* * ポインタ再設定 */ void FASTCALL display_setpointer(BOOL redraw) { #if XM7_VER >= 3 /* 画面モード番号 */ if (mode400l) { screen_mode = SCR_400LINE; } else if (mode256k) { screen_mode = SCR_262144; } else if (mode320) { screen_mode = SCR_4096; } else { screen_mode = SCR_200LINE; } #endif #if XM7_VER >= 2 /* アクティブポインタ・アクティブブロックポインタ */ vram_aptr = vram_c; #if XM7_VER >= 3 vram_ablk = vram_c; switch (screen_mode) { case SCR_400LINE: /* 640x400 8色 */ vram_aptr += (subram_vrambank * 0x8000); if (block_active) { vram_aptr += 0x18000; vram_ablk += 0x18000; } break; case SCR_262144: /* 320x200 262144色 */ switch (subram_vrambank) { case 0: break; case 1: vram_aptr += 0x4000; break; case 2: vram_aptr += 0x18000; break; } break; default: /* 640x200か、320x200 4096色 */ if (vram_active) { vram_aptr += 0x4000; } if (block_active) { vram_aptr += 0x18000; } } #else if (vram_active) { vram_aptr += 0xc000; } #endif /* 表示ポインタ、裏表示ブロックポインタ */ vram_dptr = vram_c; #if XM7_VER >= 3 vram_dblk = vram_c; vram_bdblk = vram_c; if ((screen_mode == SCR_200LINE) && vram_display) { vram_dptr += 0x4000; } vram_bdptr = vram_dptr; if (block_display) { vram_dptr += 0x18000; vram_dblk += 0x18000; } else { vram_bdptr += 0x18000; vram_bdblk += 0x18000; } #else if (!mode320 && vram_display) { vram_dptr += 0xc000; } #endif /* XM7_VER >= 3 */ #endif /* XM7_VER >= 2 */ /* 必要なら再描画 */ if (redraw) { display_notify(); } } /* * ハードウェアウインドウ * オープンチェック・書き換え範囲決定 */ #if XM7_VER >= 3 static void FASTCALL check_window_open(void) { /* Xs<Xe and Ys<Ye であれば、ウィンドウオープン */ if ((window_x1 < window_x2) && (window_y1 < window_y2)) { window_open = TRUE; } else { window_open = FALSE; window_dx1 = 0; window_dx2 = 0; window_dy1 = 0; window_dy2 = 0; } /* 再描画指示 */ window_notify(); } /* * ハードウェアウインドウ * クリッピング */ void FASTCALL window_clip(int mode) { static const WORD max_x[4] = { 640, 320, 640, 320 }; static const WORD max_y[4] = { 200, 200, 400, 200 }; ASSERT((mode >= 0) && (mode <= 2)); /* Xクリッピング */ window_dx1 = window_x1; window_dx2 = window_x2; if (window_dx1 > max_x[mode]) { window_dx1 = max_x[mode]; } if (window_dx2 > max_x[mode]) { window_dx2 = max_x[mode]; } /* Yクリッピング */ window_dy1 = window_y1; window_dy2 = window_y2; if (window_dy1 > max_y[mode]) { window_dy1 = max_y[mode]; } if (window_dy2 > max_y[mode]) { window_dy2 = max_y[mode]; } } #endif /* * 4096色/262144色モード用 VRAMスクロール */ #if XM7_VER >= 2 static void FASTCALL vram_scroll_analog(WORD offset, DWORD addr) { int i; BYTE *vram; #if XM7_VER >= 3 for (i = 0; i < 3; i++) { vram = (BYTE *) ((vram_c + addr) + 0x8000 * i); /* テンポラリバッファへコピー */ memcpy_200l(vram_buf, vram, offset); memcpy_200l(&vram_buf[0x2000], &vram[0x2000], offset); /* 前へ詰める */ memcpy_200l(vram, (vram + offset), 0x4000 - offset); /* テンポラリバッファより復元 */ memcpy_200l(vram + (0x2000 - offset), vram_buf, offset); memcpy_200l(vram + (0x4000 - offset), &vram_buf[0x2000], offset); } #else for (i = 0; i < 6; i++) { vram = (BYTE *) ((vram_c + addr) + 0x2000 * i); /* テンポラリバッファへコピー */ memcpy_200l(vram_buf, vram, offset); /* 前へ詰める */ memcpy_200l(vram, (vram + offset), 0x2000 - offset); /* テンポラリバッファより復元 */ memcpy_200l(vram + (0x2000 - offset), vram_buf, offset); } #endif }
void TestNotification(CuTest *tc) { GrContextClipRegionSet(&context, &fullscreen_clip); handle_message('S', "+8615618273349", "hey KREYOS, how are you doing today? I will be dropping by later at CES to check out the Meteor!"); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_current()(EVENT_KEY_PRESSED, KEY_DOWN, NULL); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_close(); handle_message('S', "+8615618273349", "testing 123"); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_close(); window_notify("Facebook", "Tom Paker\nOur schedule is crazy next a few days unfortunately.", NOTIFY_OK, 'a'); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_close(); window_notify("Facebook", "Tom Paker\nOurscheduleiscrazynextafewdaysunfortunately.", NOTIFY_OK, 'a'); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_close(); window_notify("SMS", chinesedata, NOTIFY_OK, 'a'); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_close(); window_notify_ancs(0, 9, 1, 1); window_notify_ancs(0, 10, 1, 1); window_notify_ancs(0, 11, 1, 1); window_notify_ancs(2, 9, 1, 1); window_notify_ancs(0, 12, 1, 1); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_current()(EVENT_KEY_PRESSED, KEY_DOWN, NULL); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_current()(EVENT_KEY_PRESSED, KEY_DOWN, NULL); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_current()(EVENT_KEY_PRESSED, KEY_DOWN, NULL); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_current()(EVENT_KEY_PRESSED, KEY_DOWN, NULL); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_current()(EVENT_KEY_PRESSED, KEY_DOWN, NULL); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_close(); window_messagebox(ICON_LARGE_WARNING, "Please Pair your Smartphone to the meteor.", 0); window_current()(EVENT_WINDOW_PAINT, 0, &context); GrFlush(&context); window_close(); }