| 1 | |
|---|
| 2 | #include "DHL_DBG.h" |
|---|
| 3 | #include "DHL_OSAL.h" |
|---|
| 4 | #include "DHL_OSAL_Config.h" |
|---|
| 5 | |
|---|
| 6 | #include "cc_config.h" |
|---|
| 7 | #include "cc_def.h" |
|---|
| 8 | #include "cc_private.h" |
|---|
| 9 | |
|---|
| 10 | #include "DMW_Dummy.h" |
|---|
| 11 | |
|---|
| 12 | #include <stdarg.h> /* for va_list */ |
|---|
| 13 | //#include <string.h> |
|---|
| 14 | |
|---|
| 15 | #define MAX_NUM_PIC_UD_Q CC_NUM_PIC_USER_Q |
|---|
| 16 | |
|---|
| 17 | #define IS_FONT_BMF (FONT_ID==FONT_BMF) |
|---|
| 18 | |
|---|
| 19 | static tDCC_PicUDRaw p_ud_buf[MAX_NUM_PIC_UD_Q]; |
|---|
| 20 | |
|---|
| 21 | // zooyouny: »ç¿ëµÇ´Â °÷ ¾øÀ½ |
|---|
| 22 | // static tDCCDDI_MSGQ p_ud_msgq; |
|---|
| 23 | static int p_ud_buf_wr_idx=0; |
|---|
| 24 | static tDCC_UserCallback p_ud_callback = NULL; |
|---|
| 25 | |
|---|
| 26 | #include "DHL_Graphic.h" |
|---|
| 27 | #include "DHL_AVCAP.h" |
|---|
| 28 | //#include "DHL_AVCAP_Priv.h" |
|---|
| 29 | #include "DMG_Draw.h" |
|---|
| 30 | |
|---|
| 31 | #if IS_FONT_JUNGLE |
|---|
| 32 | //.#include "utfAPI.h" |
|---|
| 33 | #elif IS_FONT_MLF |
|---|
| 34 | #include "MLSupport.h" |
|---|
| 35 | #elif IS_FONT_BMF |
|---|
| 36 | #include "BMF.h" |
|---|
| 37 | #endif |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | #if 0 |
|---|
| 41 | __Local_Func__() {} |
|---|
| 42 | #endif |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | static void p_check_region(int x, int y, int w, int h) |
|---|
| 46 | { |
|---|
| 47 | BOOL bvalid=((x>=0) && (y>=0) && (x+w<720) && (y+h<480)); |
|---|
| 48 | |
|---|
| 49 | if(!bvalid) |
|---|
| 50 | CCPRINT("error", "! fatal error : region(%d,%d,%d,%d)\n", x, y, w, h); |
|---|
| 51 | //DHL_ASSERT(bvalid, "!! FATAL ERROR : CC check region failed\n"); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | static UINT16 p_remap_char(UINT16 ch) |
|---|
| 57 | { |
|---|
| 58 | #if FONT_ID==FONT_BMF |
|---|
| 59 | struct { |
|---|
| 60 | UINT16 orig; |
|---|
| 61 | UINT16 dst; |
|---|
| 62 | } table[]={ |
|---|
| 63 | {0x520, 0x20},{0x521, 0x20},{0x522, 0x20},{0x525, 0x2026}, |
|---|
| 64 | {0x52a, 0x0160},{0x52c, 0x0152},{0x530, 0xb7},{0x531, 0x2018}, |
|---|
| 65 | {0x532, 0x2019},{0x533, 0x201c},{0x534, 0x201d},{0x535, 0x2022}, |
|---|
| 66 | {0x539, 0x2122},{0x53a, 0x0161},{0x53c, 0x0153},{0x53d, 0x2120}, |
|---|
| 67 | {0x53f, 0x0178},{0x576, 0x215b},{0x577, 0x215c},{0x578, 0x215d}, |
|---|
| 68 | {0x579, 0x215e},{0x57a, 0x2503},{0x57b, 0x2512},{0x57c, 0x2517}, |
|---|
| 69 | {0x57d, 0x2501},{0x57e, 0x251b},{0x57f, 0x250f},{0x5ff, 0x266a}, |
|---|
| 70 | {0x5a0, 0x1a0} |
|---|
| 71 | }; |
|---|
| 72 | |
|---|
| 73 | int i; |
|---|
| 74 | |
|---|
| 75 | for(i=0; i<sizeof(table)/sizeof(table[0]); i++) { |
|---|
| 76 | if(ch==table[i].orig) return table[i].dst; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | return ch; |
|---|
| 80 | |
|---|
| 81 | #elif FONT_ID==FONT_JUNGLE |
|---|
| 82 | //0x5xx´ë¸¦ 0x1xx´ë·Î ¿Å±è |
|---|
| 83 | if((ch&0x500)==0x500) |
|---|
| 84 | return ch&(~0x400); |
|---|
| 85 | else |
|---|
| 86 | return ch; |
|---|
| 87 | |
|---|
| 88 | #endif |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | //static FILE *p_fd; |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | void *DCCDDI_Malloc(int size) |
|---|
| 95 | { |
|---|
| 96 | return DHL_OS_Malloc(size); |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | void DCCDDI_Printf(const char *fmt, ...) |
|---|
| 101 | { |
|---|
| 102 | char buf[512]; |
|---|
| 103 | va_list v; |
|---|
| 104 | |
|---|
| 105 | va_start(v, fmt); |
|---|
| 106 | |
|---|
| 107 | vsnprintf(buf, 512, fmt, v); |
|---|
| 108 | |
|---|
| 109 | va_end(v); |
|---|
| 110 | |
|---|
| 111 | DHL_OS_Printf("%s", buf); |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | void DCCDDI_SpawnTask(void *func) |
|---|
| 117 | { |
|---|
| 118 | DHL_OS_CreateTask((DHL_OS_TASKFUNCTION)func, "CC", TASK_PRI_DCC_DMX, 16384, 0); |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | tDCCDDI_MSGQ DCCDDI_CreateMessageQueue(char *pname, UINT32 num_msgq, UINT32 size_msgq) |
|---|
| 123 | { |
|---|
| 124 | return (tDCCDDI_MSGQ)DHL_OS_CreateMessageQueue(pname, 0, num_msgq, size_msgq); |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | |
|---|
| 128 | tDCCDDI_SEM DCCDDI_CreateMutexSemaphore(char *pname) |
|---|
| 129 | { |
|---|
| 130 | return (tDCCDDI_SEM)DHL_OS_CreateMutexSemaphore(pname); |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | tDCCDDI_SEM DCCDDI_CreateBinarySemaphore(char *pname) |
|---|
| 135 | { |
|---|
| 136 | return (tDCCDDI_SEM)DHL_OS_CreateBinarySemaphore(pname, 0, 0); |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | void DCCDDI_SendMessage(tDCCDDI_MSGQ id, void *buf, UINT32 len) |
|---|
| 141 | { |
|---|
| 142 | DHL_OS_SendMessage((DHL_OS_MSGQ_ID)id, buf, len); |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | int DCCDDI_ReceiveMessage(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len) |
|---|
| 147 | { |
|---|
| 148 | return DHL_OS_ReceiveMessage((DHL_OS_MSGQ_ID)id, buf, DHL_TIMEOUT_FOREVER); |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | int DCCDDI_ReceiveMessage_Wait(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len, UINT32 msec) |
|---|
| 153 | { |
|---|
| 154 | return DHL_OS_ReceiveMessage((DHL_OS_MSGQ_ID)id, buf, msec); |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | int DCCDDI_ReceiveMessage_NoWait(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len) |
|---|
| 158 | { |
|---|
| 159 | return DHL_OS_ReceiveMessage((DHL_OS_MSGQ_ID)id, buf, 0); |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | void DCCDDI_TakeSemaphore(tDCCDDI_SEM id) |
|---|
| 164 | { |
|---|
| 165 | DHL_OS_TakeSemaphore((DHL_OS_SEMA_ID)id, DHL_TIMEOUT_FOREVER); |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | void DCCDDI_GiveSemaphore(tDCCDDI_SEM id) |
|---|
| 169 | { |
|---|
| 170 | DHL_OS_GiveSemaphore((DHL_OS_SEMA_ID)id); |
|---|
| 171 | } |
|---|
| 172 | |
|---|
| 173 | void DCCDDI_Delay(UINT32 msec) |
|---|
| 174 | { |
|---|
| 175 | DHL_OS_Delay(msec); |
|---|
| 176 | } |
|---|
| 177 | |
|---|
| 178 | UINT32 DCCDDI_GetCurMs() |
|---|
| 179 | { |
|---|
| 180 | return DHL_OS_GetMsCount(); |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | |
|---|
| 184 | #if 0 |
|---|
| 185 | __Picture_User_Data__() {} |
|---|
| 186 | #endif |
|---|
| 187 | |
|---|
| 188 | static BOOL p_check_cc_validity(UINT8 *buf, int *psize, int *ofs) |
|---|
| 189 | { |
|---|
| 190 | int i; |
|---|
| 191 | BOOL batsc=FALSE; |
|---|
| 192 | BOOL bscte=FALSE; |
|---|
| 193 | int size=*psize; |
|---|
| 194 | |
|---|
| 195 | //atsc identifier ȤÀº scte20ÀÇ 03ÀÌ ¿Í¾ßÇϴµ¥, ±×·¸Áö ¾ÊÀº °æ¿ìµµ ÀÖÀ½ |
|---|
| 196 | //±×·¸Áö ¾ÊÀº °æ¿ì¶ó¸é user_data_start_code¸¦ °Ë»öÇØºÁ¾ß ÇÔ(0x000001b2) |
|---|
| 197 | //atsc id |
|---|
| 198 | |
|---|
| 199 | for(i=0, *ofs=0; i<size-4; i++) { |
|---|
| 200 | if(buf[i]==0x47 && buf[i+1]==0x41 && buf[i+2]==0x39 && buf[i+3]==0x34) { |
|---|
| 201 | batsc=TRUE; |
|---|
| 202 | *ofs=i; |
|---|
| 203 | size-=i; |
|---|
| 204 | break; |
|---|
| 205 | } |
|---|
| 206 | |
|---|
| 207 | #if 0 //¾Æ·¡ ÄÚµå´Â ÀÇ¹Ì ¾ø´Â ÄÚµåÀÓ..¿ÀÈ÷·Á ºÎÀÛ¿ëÀ» ÀÏÀ¸Å³ ¼ö ÀÖÀ¸¹Ç·Î |
|---|
| 208 | //¿¹¸¦ µé¾î 0x000001b2 ´ÙÀ½¿¡ ¹Ù·Î 0x47413934°¡ ¿À´Â °Ô ¾Æ´Ï¶ó |
|---|
| 209 | //Áß°£¿¡ ´Ù¸¥ ÄÚµå °ªÀÌ ¿Ã ¼ö ÀÖÀ½. |
|---|
| 210 | if(i<size-8 && buf[i]==0x0 && buf[i+1]==0x0 && buf[i+2]==0x1 && buf[i+3]==0xb2) { |
|---|
| 211 | |
|---|
| 212 | if(buf[i+4]==0x47 && buf[i+5]==0x41 && buf[i+6]==0x39 && buf[i+7]==0x34) |
|---|
| 213 | batsc=TRUE; |
|---|
| 214 | else |
|---|
| 215 | bscte=TRUE; |
|---|
| 216 | *ofs=i+4; |
|---|
| 217 | size-=i+4; |
|---|
| 218 | break; |
|---|
| 219 | } |
|---|
| 220 | #endif |
|---|
| 221 | } |
|---|
| 222 | |
|---|
| 223 | if(!batsc && !bscte && buf[0]==0x3) bscte=TRUE; //¹Ù·Î 0x3ºÎÅÍ ³¯¶ó¿È. |
|---|
| 224 | |
|---|
| 225 | if(!batsc && !bscte) { |
|---|
| 226 | CCPRINT("ddi", "bad cc data\n"); |
|---|
| 227 | return FALSE; |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | if(size<5+2+(buf[*ofs+5]&0x1f)*3) { //size°¡ ½ÇÁ¦ CC dataº¸´Ù ÀÛÀ¸¸é ¿¡·¯ÀÓ. |
|---|
| 231 | CCPRINT("ddi", "cc data size is not enough(%d)\n", size); |
|---|
| 232 | return FALSE; |
|---|
| 233 | } |
|---|
| 234 | |
|---|
| 235 | *psize=5+2+(buf[*ofs+5]&0x1f)*3; //½ÇÁ¦ ó¸®ÇÒ sizeÀÓ. |
|---|
| 236 | |
|---|
| 237 | return TRUE; |
|---|
| 238 | } |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | static void p_user_data(tDHL_AVCallbackType cb_type, UINT32 param) |
|---|
| 242 | { |
|---|
| 243 | static UINT32 count=0; |
|---|
| 244 | static BOOL bprev_valid=FALSE; |
|---|
| 245 | BOOL bcur_valid; |
|---|
| 246 | int offset=0; |
|---|
| 247 | |
|---|
| 248 | UINT8 *pdata=(UINT8 *)((UINT32 *)param)[0]; |
|---|
| 249 | int size=((UINT32 *)param)[1]; |
|---|
| 250 | |
|---|
| 251 | if (cb_type != eDHL_CB_VideoUserData) |
|---|
| 252 | { |
|---|
| 253 | DHL_OS_Printf("|%s| wrong userdata callback(cb_type:0x%x).\n", |
|---|
| 254 | __FUNCTION__, cb_type); |
|---|
| 255 | |
|---|
| 256 | return; |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | //p_print_pic_ud(pdata, size); |
|---|
| 260 | |
|---|
| 261 | //¿©±â¼ ¾à°£ÀÇ Å×½ºÆ®¸¦ °ÅÃÄ ¾µ¸ð ¾ø´Â ÆÄÀϵéÀ» °É·¯³½´Ù. |
|---|
| 262 | bcur_valid=p_check_cc_validity(pdata, &size, &offset); |
|---|
| 263 | |
|---|
| 264 | if (MAX_SIZE_PIC_UD <= size) |
|---|
| 265 | { |
|---|
| 266 | //ÀÌ °æ¿ì additional cc data°¡ ÀÖÀ¸¸é ¹ß»ýÇÒ ¼ö ÀÖÀ½. |
|---|
| 267 | //additional cc data¸¦ Áö¿ö¹ö¸®°í ³²Àº ³ª¸ÓÁö¸¸ ó¸®ÇÔ. |
|---|
| 268 | |
|---|
| 269 | DHL_OS_Printf("|%s| too big userdata size(MAX : %d, data : %d). discard.\n", |
|---|
| 270 | __FUNCTION__, MAX_SIZE_PIC_UD, size); |
|---|
| 271 | |
|---|
| 272 | return; |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | if(!bcur_valid) { |
|---|
| 278 | CCPRINT("ddi", "!! all invalid packet!!\n"); |
|---|
| 279 | if(bprev_valid) bprev_valid=FALSE; |
|---|
| 280 | else return; |
|---|
| 281 | } |
|---|
| 282 | else { |
|---|
| 283 | bprev_valid=TRUE; |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | pdata = &(pdata[offset]); |
|---|
| 287 | memcpy(p_ud_buf[p_ud_buf_wr_idx].data, (void *)pdata, |
|---|
| 288 | size); |
|---|
| 289 | p_ud_buf[p_ud_buf_wr_idx].size = size; |
|---|
| 290 | |
|---|
| 291 | #if 0 |
|---|
| 292 | p_ud_buf[p_ud_buf_wr_idx].pic_type = ((UINT32 *)param)[2]; |
|---|
| 293 | #else |
|---|
| 294 | p_ud_buf[p_ud_buf_wr_idx].pic_type = eDCC_PIC_CT_I; |
|---|
| 295 | #endif |
|---|
| 296 | |
|---|
| 297 | #if 0 //scte20_21À» Áö¿øÇÒ °æ¿ì ¾Æ·¡ ±¸ÇöÀÌ ¹Ýµå½Ã ÇÊ¿äÇÔ. |
|---|
| 298 | p_ud_buf[p_ud_buf_wr_idx].pic_structure=pPic->pictureStructure[0]; |
|---|
| 299 | p_ud_buf[p_ud_buf_wr_idx].top_field_first = pPic->topFieldFirst; |
|---|
| 300 | p_ud_buf[p_ud_buf_wr_idx].repeat_first_field = pPic->repeatFirstField; |
|---|
| 301 | p_ud_buf[p_ud_buf_wr_idx].ms_rcv=count++; |
|---|
| 302 | #endif |
|---|
| 303 | |
|---|
| 304 | if(p_ud_callback) |
|---|
| 305 | p_ud_callback(&p_ud_buf[p_ud_buf_wr_idx]); |
|---|
| 306 | |
|---|
| 307 | if(++p_ud_buf_wr_idx>=MAX_NUM_PIC_UD_Q) |
|---|
| 308 | p_ud_buf_wr_idx=0; |
|---|
| 309 | } |
|---|
| 310 | |
|---|
| 311 | |
|---|
| 312 | void DCCDDI_SetUserCallback(tDCC_UserCallback func) |
|---|
| 313 | { |
|---|
| 314 | p_ud_callback=func; |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | // zooyouny: »ç¿ëµÇ´Â °÷ ¾øÀ½ |
|---|
| 319 | #if 0 |
|---|
| 320 | tDCC_PicUDRaw *DCCDDI_GetUserData() |
|---|
| 321 | { |
|---|
| 322 | int err; |
|---|
| 323 | int rcv_len; |
|---|
| 324 | int idx; |
|---|
| 325 | |
|---|
| 326 | err=DCCDDI_ReceiveMessage_Wait(p_ud_msgq, &idx, sizeof(idx), &rcv_len, 10); |
|---|
| 327 | |
|---|
| 328 | if(err) return NULL; |
|---|
| 329 | |
|---|
| 330 | return &p_ud_buf[idx]; |
|---|
| 331 | } |
|---|
| 332 | #endif |
|---|
| 333 | |
|---|
| 334 | int DCCDDI_Feeding608(BOOL is_even, UINT8 data1, UINT8 data2, BOOL is_end) |
|---|
| 335 | { |
|---|
| 336 | DHL_AV_VideoFeeding608(is_even, data1, data2, is_end); |
|---|
| 337 | |
|---|
| 338 | return 0; |
|---|
| 339 | } |
|---|
| 340 | |
|---|
| 341 | |
|---|
| 342 | #if 0 |
|---|
| 343 | __Graphic__() {} |
|---|
| 344 | #endif |
|---|
| 345 | |
|---|
| 346 | static tDMG_FontAttr p_backup_font; |
|---|
| 347 | |
|---|
| 348 | void DCCDDI_GraphicStart(UINT8 resolution) |
|---|
| 349 | { |
|---|
| 350 | DMG_GetFontAttr(&p_backup_font); |
|---|
| 351 | DMG_SetFont(eDMG_FONT_JUNGLE); |
|---|
| 352 | } |
|---|
| 353 | |
|---|
| 354 | void DCCDDI_GraphicStop() |
|---|
| 355 | { |
|---|
| 356 | DMG_SetFont(eDMG_FONT_BMF); |
|---|
| 357 | DMG_SetFontAttr(&p_backup_font); |
|---|
| 358 | DMG_EraseRect(0, 0, 720, 480, 0); |
|---|
| 359 | DMG_AutoRefresh(); |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | void DCCDDI_DrawBox(int x, int y, int w, int h, int color) |
|---|
| 363 | { |
|---|
| 364 | CCPRINT("ddi", "DCCDDI_DrawBox(%d,%d,%d,%d,%d)\n", x, y, w, h, color); |
|---|
| 365 | |
|---|
| 366 | if(w<=0 || h<=0) return; |
|---|
| 367 | |
|---|
| 368 | p_check_region(x, y, w, h); |
|---|
| 369 | |
|---|
| 370 | DMG_EraseRect(x, y, w, h, color); |
|---|
| 371 | } |
|---|
| 372 | |
|---|
| 373 | //height°¡ -À̸é up, +À̸é down |
|---|
| 374 | void DCCDDI_BLT(int x, int y, int w, int h, int height) |
|---|
| 375 | { |
|---|
| 376 | tDHL_GrpRect r1, r2; |
|---|
| 377 | |
|---|
| 378 | CCPRINT("ddi", "DCCDDI_BLT(%d,%d,%d,%d,%d)\n", x, y, w, h, height); |
|---|
| 379 | |
|---|
| 380 | if(height==0 || h==0) return; |
|---|
| 381 | |
|---|
| 382 | p_check_region(x, y, w, h); |
|---|
| 383 | p_check_region(x, y+height, w, h); |
|---|
| 384 | |
|---|
| 385 | DHL_FILLRECT(&r1, x, y, w, h); |
|---|
| 386 | DHL_FILLRECT(&r2, x, y+height, w, h); |
|---|
| 387 | |
|---|
| 388 | DMG_BLT(CC_PLANE, CC_TEMP_PLANE, &r1, &r1); |
|---|
| 389 | DMG_BLT(CC_TEMP_PLANE, CC_PLANE, &r1, &r2); |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | void DCCDDI_DrawHLine(int x, int y, int w, int color) |
|---|
| 393 | { |
|---|
| 394 | if(w<=0) return; |
|---|
| 395 | |
|---|
| 396 | p_check_region(x, y, w, 1); |
|---|
| 397 | |
|---|
| 398 | DMG_DrawHLine(x, y, w, color); |
|---|
| 399 | } |
|---|
| 400 | |
|---|
| 401 | |
|---|
| 402 | void DCCDDI_Refresh() |
|---|
| 403 | { |
|---|
| 404 | |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | |
|---|
| 408 | #if 0 |
|---|
| 409 | __Font__() {} |
|---|
| 410 | #endif |
|---|
| 411 | |
|---|
| 412 | #define USE_MARGINE 0 |
|---|
| 413 | |
|---|
| 414 | #if IS_FONT_JUNGLE |
|---|
| 415 | //static UT_FC p_reg_fc; |
|---|
| 416 | #elif IS_FONT_MLF |
|---|
| 417 | static RML_FC p_reg_fc; |
|---|
| 418 | #elif IS_FONT_BMF |
|---|
| 419 | static BMF_FC p_reg_fc; |
|---|
| 420 | #endif |
|---|
| 421 | |
|---|
| 422 | |
|---|
| 423 | static struct { |
|---|
| 424 | int size; |
|---|
| 425 | BOOL is_italic; |
|---|
| 426 | BOOL is_underline; |
|---|
| 427 | BOOL is_unicode; //2byte. ÇѱÛÀÎ °æ¿ì unicode/¿Ï¼ºÇü Áß ¾î´À °ÍÀÎÁö.. |
|---|
| 428 | BOOL is_p16; |
|---|
| 429 | int font_style; |
|---|
| 430 | int edge_type; |
|---|
| 431 | } p_font_attr; |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | |
|---|
| 435 | #define USE_FONT_CACHE 0 |
|---|
| 436 | //font cache¸¦ »ç¿ëÇÔ. |
|---|
| 437 | |
|---|
| 438 | #define CH_BLANK 0x20 |
|---|
| 439 | #define MAX_CH_W (p_font_attr.size*8/10) |
|---|
| 440 | //neverdai analog cc¿¡¸¸ »ç¿ëÇÔ. |
|---|
| 441 | |
|---|
| 442 | #if IS_FONT_JUNGLE |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | #if USE_FONT_CACHE |
|---|
| 446 | |
|---|
| 447 | #define IMG_CACHE_SIZE 128 |
|---|
| 448 | |
|---|
| 449 | static struct { |
|---|
| 450 | UINT16 ch; |
|---|
| 451 | |
|---|
| 452 | SINT8 x; |
|---|
| 453 | SINT8 y; |
|---|
| 454 | SINT8 w; |
|---|
| 455 | SINT8 h; |
|---|
| 456 | SINT8 pitch; |
|---|
| 457 | |
|---|
| 458 | UINT8 buf[512]; //ÃÖ´ë 45»çÀÌÁî ±ÛÀÚ±îÁö ÀúÀåÇÒ ¼ö ÀÖÀ½. |
|---|
| 459 | } p_ut_img_cache[IMG_CACHE_SIZE];//¾à 6.5K Á¤µµ |
|---|
| 460 | |
|---|
| 461 | static int p_cache_idx; |
|---|
| 462 | |
|---|
| 463 | #endif // USE_FONT_CACHE |
|---|
| 464 | |
|---|
| 465 | #endif /* IS_FONT_JUNGLE */ |
|---|
| 466 | |
|---|
| 467 | |
|---|
| 468 | |
|---|
| 469 | int DCCDDI_PrintCh(int x, int y, UINT16 ch, int c_font, int c_edge) |
|---|
| 470 | { |
|---|
| 471 | tDMG_FontAttr attr; |
|---|
| 472 | int width; |
|---|
| 473 | |
|---|
| 474 | if(!p_font_attr.is_unicode) { |
|---|
| 475 | //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ. |
|---|
| 476 | ch=DCCUtil_Ksx1001toUnicode(ch); |
|---|
| 477 | CCPRINT("ddi", "convert to ksx1001(0x%x)\n", ch); |
|---|
| 478 | } |
|---|
| 479 | |
|---|
| 480 | ch=p_remap_char(ch); |
|---|
| 481 | |
|---|
| 482 | DMG_GetFontAttr(&attr); |
|---|
| 483 | attr.c_edge=DMG_ConvertDefColor(c_edge); |
|---|
| 484 | DMG_SetFontAttr(&attr); |
|---|
| 485 | |
|---|
| 486 | p_check_region(x, y, 20, 20); //´ë·« width, height¸¦ 20À¸·Î ÇÔ. |
|---|
| 487 | |
|---|
| 488 | width=DMG_PrintCh(x, y, ch, c_font); |
|---|
| 489 | |
|---|
| 490 | DHL_PostDraw(CC_PLANE, x, y, width, DMG_GetChHeight(ch)); |
|---|
| 491 | |
|---|
| 492 | return width; |
|---|
| 493 | } |
|---|
| 494 | |
|---|
| 495 | |
|---|
| 496 | int DCCDDI_GetChWidth(UINT16 ch) |
|---|
| 497 | { |
|---|
| 498 | if(!p_font_attr.is_unicode) { |
|---|
| 499 | //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ. |
|---|
| 500 | CCPRINT("ddi_ch", "convert to ksx1001(0x%x->0x%x)\n", ch, DCCUtil_Ksx1001toUnicode(ch)); |
|---|
| 501 | ch=DCCUtil_Ksx1001toUnicode(ch); |
|---|
| 502 | } |
|---|
| 503 | |
|---|
| 504 | ch=p_remap_char(ch); |
|---|
| 505 | |
|---|
| 506 | return DMG_GetChWidth(ch); |
|---|
| 507 | } |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | int DCCDDI_GetChHeight(UINT16 ch) |
|---|
| 511 | { |
|---|
| 512 | if(!p_font_attr.is_unicode) { |
|---|
| 513 | //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ. |
|---|
| 514 | CCPRINT("ddi_ch", "convert to ksx1001(0x%x)\n", ch); |
|---|
| 515 | ch=DCCUtil_Ksx1001toUnicode(ch); |
|---|
| 516 | } |
|---|
| 517 | |
|---|
| 518 | ch=p_remap_char(ch); |
|---|
| 519 | |
|---|
| 520 | return DMG_GetChHeight(ch); |
|---|
| 521 | } |
|---|
| 522 | |
|---|
| 523 | |
|---|
| 524 | void DCCDDI_SetFontAttr(int size, BOOL is_italic, BOOL is_underline, UINT8 font_style, |
|---|
| 525 | UINT8 edge_type, BOOL is_p16) |
|---|
| 526 | { |
|---|
| 527 | tDMG_FontAttr attr; |
|---|
| 528 | |
|---|
| 529 | DMG_GetFontAttr(&attr); |
|---|
| 530 | |
|---|
| 531 | attr.size=size; |
|---|
| 532 | attr.is_italic=is_italic; |
|---|
| 533 | attr.is_underline=is_underline; |
|---|
| 534 | |
|---|
| 535 | if(is_p16) { |
|---|
| 536 | attr.font_style=eDMG_FS_KOREAN; |
|---|
| 537 | } |
|---|
| 538 | else { |
|---|
| 539 | attr.font_style=(tDMG_FontStyle)font_style; |
|---|
| 540 | } |
|---|
| 541 | |
|---|
| 542 | attr.edge_type=(tDMG_EdgeType)edge_type; |
|---|
| 543 | |
|---|
| 544 | DMG_SetFontAttr(&attr); |
|---|
| 545 | |
|---|
| 546 | } |
|---|
| 547 | |
|---|
| 548 | |
|---|
| 549 | #if 0 |
|---|
| 550 | __Init__() {} |
|---|
| 551 | #endif |
|---|
| 552 | |
|---|
| 553 | void DCCDDI_Init() |
|---|
| 554 | { |
|---|
| 555 | // zooyouny: »ç¿ëµÇ´Â °÷ ¾øÀ½ |
|---|
| 556 | // p_ud_msgq=DCCDDI_CreateMessageQueue("udmsgq", MAX_NUM_PIC_UD_Q, sizeof(int)); |
|---|
| 557 | |
|---|
| 558 | #if IS_FONT_JUNGLE |
|---|
| 559 | //ut_InitFontContext(&p_reg_fc, 0, 0); |
|---|
| 560 | #elif IS_FONT_MLF |
|---|
| 561 | RML_InitFontContext(&p_reg_fc, 0, 0); |
|---|
| 562 | #elif IS_FONT_BMF |
|---|
| 563 | BMF_InitFontContext(&p_reg_fc, 0, 0); |
|---|
| 564 | #endif |
|---|
| 565 | memset(p_ud_buf, 0, sizeof(tDCC_PicUDRaw) * MAX_NUM_PIC_UD_Q); |
|---|
| 566 | |
|---|
| 567 | /* user data callback ¼³Á¤ */ |
|---|
| 568 | DHL_AV_SetCallback(eDHL_CB_VideoUserData, p_user_data); |
|---|
| 569 | } |
|---|
| 570 | |
|---|
| 571 | void DCCDDI_SetKoreanMode(BOOL is_unicode) |
|---|
| 572 | { |
|---|
| 573 | //unicode¸¦ ¾µ °ÍÀÎÁö. |
|---|
| 574 | p_font_attr.is_unicode=is_unicode; |
|---|
| 575 | } |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | #if 0 |
|---|
| 579 | ___Debug___() |
|---|
| 580 | #endif |
|---|
| 581 | |
|---|
| 582 | void cc_ddi_info() |
|---|
| 583 | { |
|---|
| 584 | |
|---|
| 585 | } |
|---|
| 586 | |
|---|